b020f340-f6ad-428d-8769-c332b5e22752.js
8.4 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
"use strict";
cc._RF.push(module, 'b020fNA9q1CjYdpwzK14idS', 'ExtraPlotViewPresenter');
// script/game/ui/presenter/ExtraPlotViewPresenter.ts
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const simba_config_manager_1 = require("simba-config-manager");
const simba_sdk_1 = require("simba-sdk");
const EditorEnums_1 = require("../../../avg/EditorEnums");
const PresenterBase_1 = require("../../../common/classbase/PresenterBase");
const UIManager_1 = require("../../../common/gameplay/managers/UIManager");
const DateSceneConfig_1 = require("../../../config/DateSceneConfig");
const GameConfig_1 = require("../../../GameConfig");
const DatingEventSceneModel_1 = require("../../model/DatingEventSceneModel");
const ExtraStoryModelManager_1 = require("../../model/ExtraStoryModelManager");
const GameModelManager_1 = require("../../model/GameModelManager");
const PresenterCCViewFactory_1 = require("../PresenterCCViewFactory");
const ExtraPlotView_1 = require("../view/type/ExtraPlotView");
let ExtraPlotViewPresenter = /** @class */ (() => {
let ExtraPlotViewPresenter = class ExtraPlotViewPresenter extends PresenterBase_1.Presenter {
constructor() {
super();
this._tabbarId = 0;
this._markButtonsY = [];
this.onMarkButtonClickCallback = (tabbarId) => {
let cfg = simba_config_manager_1.ConfigManager.getAllConfig(DateSceneConfig_1.dateSceneConfig);
let index = [];
for (const id in cfg) {
if (cfg[id].DateType == EditorEnums_1.DateType.Date_Sp) {
index.push(cfg[id].chapter_index);
}
}
if (index.indexOf(tabbarId) == -1) {
UIManager_1.UIManager.showToast("敬请期待");
return;
}
this._viewState = ExtraPlotView_1.ExtraPlotViewState.List;
this._tabbarId = tabbarId;
this.risingAction();
};
this.onGotoShopButtonClickCallback = () => {
if (GameConfig_1.channel == "wechat") {
// GameCenter.getInstance().openSubProgram(GameConfig.youZanShopAppId);
let link = GameModelManager_1.GameModelManager.getYouZanShopUrlByType(8);
if (link) {
simba_sdk_1.SDK.openProgramV2(GameConfig_1.GameConfig.youZanShopAppId, link);
}
}
else if (GameConfig_1.channel == "android") {
let link = GameModelManager_1.GameModelManager.getTaoBaoShopUrlByType(8);
if (link) {
GameModelManager_1.GameModelManager.jumpToTaobaoShop(link);
}
}
else {
UIManager_1.UIManager.showToast("该功能在当前平台不可使用");
}
};
this.onCloseButtonClickCallback = async () => {
if (this._viewState == ExtraPlotView_1.ExtraPlotViewState.List) {
this.initViewDate();
}
else {
GameModelManager_1.GameModelManager.CloseExtraSceneView.emit();
GameModelManager_1.GameModelManager.setIsMainPlotSceneType(false);
this.view.close();
}
};
this._viewProps = {
onMarkButtonClickCallback: this.onMarkButtonClickCallback,
onCloseButtonClickCallback: this.onCloseButtonClickCallback,
onGotoShopButtonClickCallback: this.onGotoShopButtonClickCallback,
};
}
onOpen() {
super.onOpen(undefined);
this.view.setProps(this._viewProps);
this.onShow();
}
onShow() {
super.onShow();
if (this._viewState == ExtraPlotView_1.ExtraPlotViewState.List) {
GameModelManager_1.GameModelManager.RefreshExtraPlotByType.emit(this._tabbarId);
}
else {
this.initViewDate();
}
}
onEnterBackground() {
super.onEnterBackground();
}
onEnterForeground() {
super.onEnterForeground();
}
onClose() {
super.onClose();
}
initViewDate() {
this._viewState = ExtraPlotView_1.ExtraPlotViewState.Choose;
this.setMarkButtonsPosition();
this.dropAction();
this.updateRedDot();
}
setMarkButtonsPosition() {
for (let i = 0; i < this.view.getMarkButtonNodes().length; i++) {
let y = this.view.getMarkButtonNodes()[i].y;
if (!this._markButtonsY[i]) {
this._markButtonsY.push(y);
}
this.view.getMarkButtonNodes()[i].y = this._markButtonsY[i] + cc.winSize.height;
}
}
dropAction() {
this.view.getMaskNode().active = true;
GameModelManager_1.GameModelManager.RefreshExtraPlotByType.emit(0);
for (let i = 0; i < this.view.getMarkButtonNodes().length; i++) {
let node = this.view.getMarkButtonNodes()[i];
cc.tween(node)
.to(0.8 + i * 0.1, { y: this._markButtonsY[i] }, { easing: 'backOut' })
.call(() => {
if (i == (this.view.getMarkButtonNodes().length - 1)) {
this.view.getMaskNode().active = false;
}
})
.start();
}
}
risingAction() {
this.view.getMaskNode().active = true;
for (let i = 0; i < this.view.getMarkButtonNodes().length; i++) {
let node = this.view.getMarkButtonNodes()[i];
cc.tween(node)
.to(0.8 + i * 0.1, { y: this._markButtonsY[i] + cc.winSize.height }, { easing: 'backIn' })
.call(() => {
if (i == (this.view.getMarkButtonNodes().length - 1)) {
GameModelManager_1.GameModelManager.RefreshExtraPlotByType.emit(this._tabbarId);
this.view.getMaskNode().active = false;
}
})
.start();
}
}
async updateRedDot() {
for (let i = 0; i < this.view.getMarkButtonNodes().length; i++) {
let node = this.view.getMarkButtonNodes()[i].getChildByName("RedDotSprite");
node.active = false;
}
let cfg = simba_config_manager_1.ConfigManager.getAllConfig(DateSceneConfig_1.dateSceneConfig);
for (const id in cfg) {
for (let i = 0; i < this.view.getMarkButtonNodes().length; i++) {
if (cfg[id].DateType == EditorEnums_1.DateType.Date_Sp && cfg[id].chapter_index == (i + 1)) {
await ExtraStoryModelManager_1.ExtraStoryModelManager.startBranches([cfg[id].start_plot_id]);
let branchStatus = ExtraStoryModelManager_1.ExtraStoryModelManager.getBranchStatus(Number(id), cfg[id].start_plot_id);
if (branchStatus == DatingEventSceneModel_1.DatingEventStatus.New || branchStatus == DatingEventSceneModel_1.DatingEventStatus.InProgress) {
let node = this.view.getMarkButtonNodes()[i].getChildByName("RedDotSprite");
node.active = true;
}
}
}
}
}
};
ExtraPlotViewPresenter.uuid = "ExtraPlotViewPresenter";
ExtraPlotViewPresenter = __decorate([
PresenterCCViewFactory_1.RegPresenter(ExtraPlotView_1.ExtraPlotViewType)
], ExtraPlotViewPresenter);
return ExtraPlotViewPresenter;
})();
exports.default = ExtraPlotViewPresenter;
cc._RF.pop();