4371b04b-4aa9-4a61-91d1-e49da84b2aba.js
10.8 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
"use strict";
cc._RF.push(module, '4371bBLSqlKYZHR5J2oSyq6', 'UITitle');
// scripts/ui/uiView/UITitle.ts
"use strict";
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
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 });
var SaveDataManager_1 = require("../../component/SaveDataManager");
var SoundManager_1 = require("../../component/SoundManager");
var Global_1 = require("../../Global");
var TableDefine_1 = require("../../kernel/table/TableDefine");
var MainScene_1 = require("../../scenes/MainScene");
var UIBase_1 = require("../UIBase");
var UIManager_1 = require("../UIManager");
var UIBallSkin_1 = require("./UIBallSkin");
var UIShop_1 = require("./UIShop");
var UITitleData_1 = require("./UITitleData");
var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
var UITitle = /** @class */ (function (_super) {
__extends(UITitle, _super);
function UITitle() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this._ballSkinView = null;
_this._shopView = null;
_this.ballSkinIsShowing = false;
_this.shopIsShowing = false;
return _this;
//#endregion
}
// LIFE-CYCLE CALLBACKS:
UITitle.prototype.onLoad = function () {
this.node.getChildByName('top').getChildByName('btnTemp').active = CC_DEBUG;
this.node.getChildByName('bottom').getChildByName('btnTestFight').active = CC_DEBUG;
this.node.getChildByName('bottom').getChildByName('txiLevel').active = CC_DEBUG;
};
UITitle.prototype.start = function () {
};
UITitle.prototype.onEnable = function () {
this.schedule(this.lazyUpdate, 1 / 20);
this.lazyUpdate();
};
UITitle.prototype.onDisable = function () {
this.unschedule(this.lazyUpdate);
};
// update (dt) {}
UITitle.prototype.lazyUpdate = function () {
var maxLevel = Global_1.tMgr.getConfig(TableDefine_1.TableName.GAME_PLAY, 22).Value;
var nextLevel = SaveDataManager_1.SaveDataManager.ins.runtimeData.curLevel + 1;
if (nextLevel > maxLevel) {
nextLevel = maxLevel;
}
this.node.getChildByName('bottom').getChildByName('naviBar').getChildByName('btnLayer').getChildByName('btn3').getComponentInChildren(cc.Label).string = nextLevel.toString();
};
//#region events
UITitle.prototype.onBtnTempClick = function () {
// UIManager.ins.openScene('Temp');
SaveDataManager_1.SaveDataManager.ins.resetData();
SaveDataManager_1.SaveDataManager.ins.saveData();
location.reload();
};
UITitle.prototype.onBtnFightClick = function () {
var id = Number(this.node.getChildByName('bottom').getChildByName('txiLevel').getComponent(cc.EditBox).string);
UITitleData_1.UITitleData.id = id;
// id > 0 ? UIManager.ins.openWindow(WindowName.PREVIEW, UITitleData.id) : UIManager.ins.openScene('Battle');
UIManager_1.UIManager.ins.openWindow(Global_1.WindowName.PREVIEW, UITitleData_1.UITitleData.id);
};
UITitle.prototype.onBtnNaviClick = function (e, indexStr) {
var _this = this;
var index = Number(indexStr);
switch (index) {
case 1:
UIManager_1.UIManager.ins.loadWindow(Global_1.WindowName.SHOP, function (view) {
if (_this.shopIsShowing == true)
return;
_this.onBallSkinCloseClick(); //自动关闭
_this.node.getChildByName('middleMask').active = true;
if (!_this._shopView) {
_this._shopView = view;
}
view.active = true;
_this.shopIsShowing = true;
if (!view.parent) {
var container = _this.node.getChildByName('middle');
var targetY = (1030 / 2 - container.height / 2); //界面底端对齐 container
var startY = targetY - 1030;
view.setPosition(0, startY);
container.addChild(view);
cc.tween(view).to(0.3, { position: cc.v3(0, targetY, 0) }, { easing: 'backOut' }).start();
}
else {
var container = _this.node.getChildByName('middle');
var targetY = (1030 / 2 - container.height / 2); //界面底端对齐 container
var startY = targetY - 1030;
view.setPosition(0, startY);
cc.tween(view).to(0.3, { position: cc.v3(0, targetY, 0) }, { easing: 'backOut' }).start();
}
view.getComponent(UIShop_1.default).setAD();
});
break;
case 2:
// console.log('抽奖')
UIManager_1.UIManager.ins.openWindow(Global_1.WindowName.WHEEL);
break;
case 99:
e.target.destroy();
this.node.parent.getComponent(MainScene_1.default).onGuideClick();
case 3:
var maxLevel = Global_1.tMgr.getConfig(TableDefine_1.TableName.GAME_PLAY, 22).Value;
var nextLevel = SaveDataManager_1.SaveDataManager.ins.runtimeData.curLevel + 1;
if (nextLevel > maxLevel) {
nextLevel = maxLevel;
}
UITitleData_1.UITitleData.id = nextLevel;
UIManager_1.UIManager.ins.openWindow(Global_1.WindowName.PREVIEW, UITitleData_1.UITitleData.id);
// UIManager.ins.openScene('Battle');
break;
case 4:
UIManager_1.UIManager.ins.openWindow(Global_1.WindowName.SIGN);
break;
case 5:
UIManager_1.UIManager.ins.loadWindow(Global_1.WindowName.BALL_SKIN, function (view) {
if (_this.ballSkinIsShowing == true)
return;
_this.onShopCloseClick(); //自动关闭
_this.node.getChildByName('middleMask').active = true;
if (!_this._ballSkinView) {
_this._ballSkinView = view;
}
view.active = true;
_this.ballSkinIsShowing = true;
if (!view.parent) {
var container = _this.node.getChildByName('middle');
var targetY = (1030 / 2 - container.height / 2); //界面底端对齐 container
var startY = targetY - 1030;
view.setPosition(0, startY);
container.addChild(view);
cc.tween(view).to(0.3, { position: cc.v3(0, targetY, 0) }, { easing: 'backOut' }).start();
}
else {
var container = _this.node.getChildByName('middle');
var targetY = (1030 / 2 - container.height / 2); //界面底端对齐 container
var startY = targetY - 1030;
view.setPosition(0, startY);
cc.tween(view).to(0.3, { position: cc.v3(0, targetY, 0) }, { easing: 'backOut' }).start();
}
view.getComponent(UIBallSkin_1.default).setAD();
});
break;
default:
break;
}
};
UITitle.prototype.onBtnSettingClick = function () {
UIManager_1.UIManager.ins.openWindow(Global_1.WindowName.SETTING);
SoundManager_1.SoundManager.ins.playEffect('Click');
};
UITitle.prototype.onBallSkinCloseClick = function () {
var _this = this;
if (this._ballSkinView && this._ballSkinView.parent) {
var container = this.node.getChildByName('middle');
var targetY = (1030 / 2 - container.height / 2) - 1030;
cc.Tween.stopAllByTarget(this._ballSkinView);
cc.tween(this._ballSkinView).to(0.2, { position: cc.v3(0, targetY, 0) }).call(function () {
UIManager_1.UIManager.ins.closeWindow(Global_1.WindowName.BALL_SKIN);
_this.ballSkinIsShowing = false;
}).start();
this.node.getChildByName('middleMask').active = false;
}
};
UITitle.prototype.onShopCloseClick = function () {
var _this = this;
if (this._shopView && this._shopView.parent) {
var container = this.node.getChildByName('middle');
var targetY = (1030 / 2 - container.height / 2) - 1030;
cc.Tween.stopAllByTarget(this._shopView);
cc.tween(this._shopView).to(0.2, { position: cc.v3(0, targetY, 0) }).call(function () {
UIManager_1.UIManager.ins.closeWindow(Global_1.WindowName.SHOP);
_this.shopIsShowing = false;
}).start();
this.node.getChildByName('middleMask').active = false;
}
};
UITitle.prototype.onLevelRankClick = function () {
var _this = this;
// UIManager.ins.openWindow(WindowName.LEVEL_RANK);
UIManager_1.UIManager.ins.loadWindow(Global_1.WindowName.LEVEL_RANK, function (view) {
_this._levelRankView = view;
view.active = true;
_this.node.getChildByName('topWindow').addChild(view);
});
};
UITitle = __decorate([
ccclass
], UITitle);
return UITitle;
}(UIBase_1.UIBase));
exports.default = UITitle;
cc._RF.pop();