GuideViewPresenter.ts
1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import { Presenter } from "../../../common/classbase/PresenterBase";
import { DirectionType } from "../../Enums";
import { RegPresenter } from "../PresenterCCViewFactory";
import { GuideView, GuideViewProps, GuideViewType } from "../view/type/GuideView";
export interface GuideViewParamModel {
x: number;
y: number;
w: number;
h: number;
d: DirectionType;
call?: () => void;
}
@RegPresenter(GuideViewType)
export default class GuideViewPresenter extends Presenter<GuideViewParamModel, GuideView>{
static uuid = "GuideViewPresenter";
private _viewProps: GuideViewProps;
private _callFunc?: () => void;
constructor() {
super();
this._viewProps = {
clickCallFunc: this.onGuideClick
};
}
onOpen(param: GuideViewParamModel) {
super.onOpen(param);
this._callFunc = param.call;
this.view.setGuideInfo(param.x, param.y, param.w, param.h, param.d);
this.view.setProps(this._viewProps);
}
onGuideClick = () => {
this.view.close();
if (this._callFunc) {
this._callFunc();
}
this._callFunc = undefined;
}
onClose() {
super.onClose();
}
}