|
@@ -1,5 +1,12 @@
|
|
|
|
|
|
|
|
import BaseUI from "../../../MOKA/component/BaseUI";
|
|
import BaseUI from "../../../MOKA/component/BaseUI";
|
|
|
|
|
+import { ViewZorder } from "../../../MOKA/data/ViewZOrder";
|
|
|
|
|
+import { AUDIO_TYPE } from "../../data/GameDefinition";
|
|
|
|
|
+import GameController from "../../GameController";
|
|
|
|
|
+import barracksUI from "../barracks/barracksUI";
|
|
|
|
|
+import DrawRecruitUI from "../drawRecruit/DrawRecruitUI";
|
|
|
|
|
+import GeneralUI from "../general/GeneralUI";
|
|
|
|
|
+import MarshalStageUI from "../marshalStage/MarshalStageUI";
|
|
|
const { ccclass, property } = cc._decorator;
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
|
|
|
|
@ccclass
|
|
@ccclass
|
|
@@ -8,13 +15,101 @@ export default class ResultUI extends BaseUI {
|
|
|
protected static prefabUrl = "module/result/result";
|
|
protected static prefabUrl = "module/result/result";
|
|
|
protected static className = "ResultUI";
|
|
protected static className = "ResultUI";
|
|
|
|
|
|
|
|
- onLoad() {
|
|
|
|
|
|
|
+ /** 自动关闭时间 */
|
|
|
|
|
+ @property({ displayName: '自动关闭时间' })
|
|
|
|
|
+ private life_time: number = 5;
|
|
|
|
|
+ @property({ type: cc.Label, displayName: '自动关闭描述' })
|
|
|
|
|
+ private txt_time: cc.Label = null!;
|
|
|
|
|
+ @property({ type: cc.Node, displayName: '胜利界面' })
|
|
|
|
|
+ private node_victor: cc.Node = null!;
|
|
|
|
|
+ @property({ type: cc.Node, displayName: '失败界面' })
|
|
|
|
|
+ private node_defeat: cc.Node = null!;
|
|
|
|
|
+
|
|
|
|
|
+ @property({ type: cc.Button, displayName: 'btn训练武将' })
|
|
|
|
|
+ private btn_goto_1: cc.Button = null!;
|
|
|
|
|
+ @property({ type: cc.Button, displayName: 'btn获取武将' })
|
|
|
|
|
+ private btn_goto_2: cc.Button = null!;
|
|
|
|
|
+ @property({ type: cc.Button, displayName: 'btn调整阵容' })
|
|
|
|
|
+ private btn_goto_3: cc.Button = null!;
|
|
|
|
|
+ @property({ type: cc.Button, displayName: 'btn学习统帅技能' })
|
|
|
|
|
+ private btn_goto_4: cc.Button = null!;
|
|
|
|
|
+ @property({ type: cc.Button, displayName: 'btn升级兵营' })
|
|
|
|
|
+ private btn_goto_5: cc.Button = null!;
|
|
|
|
|
|
|
|
|
|
+ /** 界面数据 */
|
|
|
|
|
+ protected ui_data = {
|
|
|
|
|
+ /** 结果状态 */
|
|
|
|
|
+ result_state: false,
|
|
|
|
|
+ icon_data: [
|
|
|
|
|
+
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+ /** 当前时间s */
|
|
|
|
|
+ private cur_time = 0;
|
|
|
|
|
+ onLoad() {
|
|
|
|
|
+ XXEvent.addClickEvent(this.btn_goto_1, this.goToUI, this, 1);
|
|
|
|
|
+ XXEvent.addClickEvent(this.btn_goto_2, this.goToUI, this, 2);
|
|
|
|
|
+ XXEvent.addClickEvent(this.btn_goto_3, this.goToUI, this, 3);
|
|
|
|
|
+ XXEvent.addClickEvent(this.btn_goto_4, this.goToUI, this, 4);
|
|
|
|
|
+ XXEvent.addClickEvent(this.btn_goto_5, this.goToUI, this, 5);
|
|
|
|
|
+ this.schedule(this.upTextClose, 1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
start() {
|
|
start() {
|
|
|
-
|
|
|
|
|
|
|
+ if (this.ui_data.result_state) {
|
|
|
|
|
+ this.node_victor.active = true;
|
|
|
|
|
+ this.node_defeat.active = false;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.node_victor.active = false;
|
|
|
|
|
+ this.node_defeat.active = true;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ /** 界面跳转
|
|
|
|
|
+ * 1点击训练按钮,关闭当前界面返回主界面,出现引导玩家点击训练按钮,持续10秒或点击任意位置引导消失
|
|
|
|
|
+ 2点击点将台按钮,关闭当前界面跳转到抽卡页面
|
|
|
|
|
+ 3点击武将按钮,关闭当前界面跳转到武将-阵位页面
|
|
|
|
|
+ 4点击统帅台按钮,关闭当前界面跳转到统帅台-技能页面
|
|
|
|
|
+ 5点击兵营按钮,关闭当前界面跳转到兵营页面
|
|
|
|
|
+ */
|
|
|
|
|
+ private goToUI(comp_btn, btn_id) {
|
|
|
|
|
+ GameController.audioM.playEffect(AUDIO_TYPE.button);
|
|
|
|
|
+ this.close()
|
|
|
|
|
+ switch (btn_id) {
|
|
|
|
|
+ case 1:
|
|
|
|
|
+ XXEvent.emit("open-guide", btn_id);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 2:// 武将抽卡
|
|
|
|
|
+ GameController.uiM.openUI(DrawRecruitUI, null, ViewZorder.UI);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 3:// 武将-阵位
|
|
|
|
|
+ GameController.uiM.openUI(GeneralUI, null, ViewZorder.UI, null, null, { tab_type: 1 });
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 4:// 统帅台-技能
|
|
|
|
|
+ GameController.uiM.openUI(MarshalStageUI, () => {
|
|
|
|
|
+ let comp_tongshuai = GameController.uiM.getUI(MarshalStageUI);
|
|
|
|
|
+ if (comp_tongshuai) {
|
|
|
|
|
+ comp_tongshuai.tgl_skill.isChecked = true;
|
|
|
|
|
+ comp_tongshuai.click_Toggle2();
|
|
|
|
|
+ }
|
|
|
|
|
+ }, ViewZorder.UI);
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 5:
|
|
|
|
|
+ GameController.uiM.openUI(barracksUI, null, ViewZorder.UI);
|
|
|
|
|
+ break;
|
|
|
|
|
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ /** 关闭倒计时显示 */
|
|
|
|
|
+ private upTextClose() {
|
|
|
|
|
+ this.cur_time++;
|
|
|
|
|
+ if (this.cur_time >= this.life_time) {
|
|
|
|
|
+ this.unschedule(this.upTextClose);
|
|
|
|
|
+ this.close();
|
|
|
|
|
+ }
|
|
|
|
|
+ let gap = this.life_time - this.cur_time;
|
|
|
|
|
+ this.txt_time.string = gap + '秒后自动关闭';
|
|
|
|
|
+ }
|
|
|
// update (dt) {}
|
|
// update (dt) {}
|
|
|
}
|
|
}
|