PlotStopViewPresenter.ts
2.38 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// import { DailyQuestType } from "../../../avg/EditorEnums";
import { Presenter } from "../../../common/classbase/PresenterBase";
import { GetRewardType } from "../../../common/gameplay/gamedata/GameEnumData";
import { GameTextData } from "../../../common/gameplay/gamedata/GameTextData";
import { UIManager } from "../../../common/gameplay/managers/UIManager";
import { GameModelManager } from "../../model/GameModelManager";
import { RegPresenter } from "../PresenterCCViewFactory";
import { PlotStopView, PlotStopViewProps, PlotStopViewType } from "../view/type/PlotStopView";
@RegPresenter(PlotStopViewType)
export default class PlotStopViewPresenter extends Presenter<undefined, PlotStopView>{
static uuid = "PlotStopViewPresenter";
private _viewProps: PlotStopViewProps;
constructor() {
super();
}
initViewProps() {
this._viewProps = {
unlockPlotCallbackFunc: this.unlockPlotCallbackFunc,
onAddRes: this.onAddRes,
onCancelAdCallback: this.onCancelAdCallback,
}
}
onOpen() {
super.onOpen(undefined);
this.onShow();
}
onShow() {
super.onShow();
this.initViewProps();
this._view.setProps(this._viewProps);
this.view.adButton.loadSVConfig();
}
onClose() {
super.onClose();
}
onEnterForeground() {
super.onEnterForeground();
}
onEnterBackground() {
super.onEnterBackground();
}
onHide() {
}
unlockPlotCallbackFunc = () => {
}
onCancelAdCallback(type: GetRewardType) {
let content: string = "";
if (type == GetRewardType.Ad) {
content = GameModelManager.getLanguageTxt(GameTextData.GAME_TEXT_MALL_GIFT_ADFAILED_VALUE);
} else {
content = GameModelManager.getLanguageTxt(GameTextData.GAME_TEXT_MALL_GIFT_SHAREFAILED_VALUE);
}
UIManager.showToast(content);
this.view.closeView();
}
onAddRes = (type: string) => {
if (type === "video") {
GameModelManager.dealBlockedPlot(true);
} else {
if (cc.sys.browserType == cc.sys.BROWSER_TYPE_CHROME) {
GameModelManager.dealBlockedPlot(true);
} else {
UIManager.showToast(GameModelManager.getLanguageTxt(GameTextData.GAME_TEXT_DEAL_BLOCKED_PLOT_FAIL));
}
}
this.view.closeView();
}
}