فهرست منبع

管卡结算bug修复

薛鸿潇 5 سال پیش
والد
کامیت
18ced8ffea

+ 3 - 2
tower_sanguo/assets/scripts/module/general/GeneralInfoUI.ts

@@ -90,6 +90,7 @@ export default class GeneralInfoUI extends BaseUI {
             cc.log('武将数据出错,请检查逻辑')
             return;
         }
+        cc.log('武将数据:%o', this.general_data)
         this.lbl_name.string = `${this.general_data.name}`;
         this.lbl_lv_value.string = 'lv.' + `${this.general_data.lv}`;
         this.lbl_speed_value.string = `${this.general_data.attSpeed}`;
@@ -201,7 +202,7 @@ export default class GeneralInfoUI extends BaseUI {
     /** 升星事件触发 */
     private onClickShengXing() {
         // 发送数据
-        GameController.http.composeGeneral(this.onStarUpCall.bind(this),this.general_data.id);
+        GameController.http.composeGeneral(this.onStarUpCall.bind(this), this.general_data.id);
     }
     /** 升星事件回调 */
     private onStarUpCall(data) {
@@ -209,7 +210,7 @@ export default class GeneralInfoUI extends BaseUI {
             cc.log(data.errmsg);
             return;
         }
-        
+
         let star_ratio1 = parseInt(this.general_data.growvalues[this.general_data.star - 1])
         let old_attack = `${XXMath.finalAttackValue(this.general_data.attack, this.general_data.lv, star_ratio1)}`
         let old_general = {

+ 22 - 0
tower_sanguo/assets/scripts/module/result/ResultModel.ts

@@ -0,0 +1,22 @@
+import StringUtil from "../../utils/StringUtil";
+
+/** 结算模块 
+ * - boss战时弹出ui
+ * - 失败弹出提升样式
+ * - 胜利弹出奖励样式
+ * - 关闭界面后执行flyNode动画,动画完成后再加奖励。
+*/
+export default class ResultModel {
+    /** 奖励列表 */
+    public static icon_list = [];
+    /** 发奖励 */
+    public static getReward() {
+        const n_count = this.icon_list.length;
+        for (let i = 0; i < n_count; i++) {
+            let icon_data = this.icon_list[i] as any;
+            // 加奖励
+            StringUtil.saveBag(parseInt(icon_data.id), parseInt(icon_data.count), parseInt(icon_data.general_id));
+        }
+        this.icon_list = [];
+    }
+}

+ 9 - 0
tower_sanguo/assets/scripts/module/result/ResultModel.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.0.8",
+  "uuid": "a228813a-e0b7-4556-b0d9-d4ae12421d75",
+  "isPlugin": false,
+  "loadPluginInWeb": true,
+  "loadPluginInNative": true,
+  "loadPluginInEditor": false,
+  "subMetas": {}
+}

+ 8 - 2
tower_sanguo/assets/scripts/module/result/ResultUI.ts

@@ -8,6 +8,7 @@ import barracksUI from "../barracks/barracksUI";
 import DrawRecruitUI from "../drawRecruit/DrawRecruitUI";
 import GeneralUI from "../general/GeneralUI";
 import MarshalStageUI from "../marshalStage/MarshalStageUI";
+import ResultModel from "./ResultModel";
 const { ccclass, property } = cc._decorator;
 
 @ccclass
@@ -49,6 +50,7 @@ export default class ResultUI extends BaseUI {
     /** 当前时间s */
     private cur_time = 0;
     onLoad() {
+        ResultModel.icon_list = [];
         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);
@@ -73,6 +75,7 @@ export default class ResultUI extends BaseUI {
     */
     private initIconStyle() {
         this.ui_data.icon_data = StringUtil.analysisItemStr(this.ui_data.icon_data);
+        ResultModel.icon_list = this.ui_data.icon_data;
         const n_count = this.arr_icon.length;
         for (let i = 0; i < n_count; i++) {
             let node_icon = this.arr_icon[i];
@@ -91,8 +94,6 @@ export default class ResultUI extends BaseUI {
             XXLoader.loadAssetByType(icon_path, cc.SpriteFrame, (asset) => {
                 img_icon.spriteFrame = asset;
             })
-            // 加奖励
-            StringUtil.saveBag(parseInt(icon_data.id), parseInt(icon_data.count), parseInt(icon_data.general_id));
         }
     }
     /** 界面跳转 
@@ -187,6 +188,11 @@ export default class ResultUI extends BaseUI {
                     start_pos: start_node_pos,
                     end_pos: end_node_pos,
                     complete_call: () => {
+                        if (arr_item[i] === 1) {
+                            this.scheduleOnce(() => {
+                                ResultModel.getReward();
+                            }, i * 1)
+                        }
                     },
                 }
                 // 发起飞item事件