Sfoglia il codice sorgente

Merge branch 'master' of http://git.mokasz.com/zouyong/tower_sanguo

kaka 5 anni fa
parent
commit
719c06a27d

+ 8 - 5
tower_sanguo/assets/scripts/data/GameData.ts

@@ -491,7 +491,7 @@ export default class GameData {
      * @param id 功能ID
      * @returns 
      */
-    checkUIOpenByUIID(id):boolean{
+    checkUIOpenByUIID(id): boolean {
         let fun = this.openfun_data.get(id);
         return fun && this.player.max_mission >= fun.openmission;
     }
@@ -607,7 +607,7 @@ export default class GameData {
         this.player.setProp(PLAYERPROP.USER_DAILY_ACTIVE_S_INFO, data.dailyTask);
         this.player.setProp(PLAYERPROP.USER_EXCHANGE_TIMES, data.userExchangeTimes);
         this.player.setProp(PLAYERPROP.PIGGYBOX_DATA, data.piggyBox);
-        
+
         // this.player.setProp(PLAYERPROP.GENERAL_TRAIN_TIMES, data.general_train_times);
         // this.player.setProp(PLAYERPROP.INVEST_TIMES, data.invest_times);
         // this.player.setProp(PLAYERPROP.GENERAL_LUCK_TIMES, data.general_luck_times);
@@ -742,9 +742,12 @@ export default class GameData {
         console.log("IsExist: " + isexist);
         if (isexist) {
             if (type == 1) {
-                let vo = this.createGeneralVO(id, type, num);
-                vo.fragment = this.player.generals_bag[id].fragment;
-                this.player.generals_bag[id] = vo;
+                // let vo = this.createGeneralVO(id, type, num);
+                // vo.fragment = this.player.generals_bag[id].fragment;
+                // this.player.generals_bag[id] = vo;
+                // 已有武将,根据星级转化成碎片
+                let tansChip = this.star_data[this.player.generals_bag[id].star].tansChip;
+                this.player.generals_bag[id].fragment += tansChip;
             } else if (type == 2) {
                 this.player.generals_bag[id].fragment += num;
             }

+ 4 - 0
tower_sanguo/assets/scripts/module/checkpointRedBag/CheckpointRedBagBtn.ts

@@ -64,6 +64,7 @@ export default class CheckpointRedBagBtn extends cc.Component {
         // let time = CheckpointRedBagModle.redbag_data.cur_count - this.targetProgress;
         // this.targetProgress = CheckpointRedBagModle.redbag_data.cur_count;
         // this.PlayMoneyAni(time / 2)
+        // this.lbl_chPo_count.string = `${CheckpointRedBagModle.redbag_data.cur_count}`;
         this.lbl_chPo_count.string = `${CheckpointRedBagModle.redbag_data.cur_count}`;
         if (CheckpointRedBagModle.redbag_data.cur_count <= 0) {
             this.lbl_chPo_count.node.parent.active = false;
@@ -76,7 +77,10 @@ export default class CheckpointRedBagBtn extends cc.Component {
         // let time = CheckpointRedBagModle.redbag_data.cur_count - this.targetProgress;
         // this.targetProgress = CheckpointRedBagModle.redbag_data.cur_count;
         // this.PlayMoneyAni(time / 2)
+
+        // this.lbl_chPo_count.string = `${CheckpointRedBagModle.redbag_data.cur_count}`;
         this.lbl_chPo_count.string = `${CheckpointRedBagModle.redbag_data.cur_count}`;
+        
     }
     //////////////////////////////////数字滚动效果//////////////////////////////////
     /** 滚动的目标值 */

+ 16 - 6
tower_sanguo/assets/scripts/module/checkpointRedBag/CheckpointRedBagModle.ts

@@ -49,6 +49,8 @@ export default class CheckpointRedBagModle {
     }
     /** 当前波有没有爆红包 */
     public static cur_is_get: boolean = false;
+    /** 服务端给的当前红包数量 */
+    // public static s_cur_is_get: number = 0;
     /** 主页组件 */
     private static comp_main: MainUI = null!;
     /** 每日需要刷新的数据 */
@@ -95,6 +97,10 @@ export default class CheckpointRedBagModle {
     }
     /** 红包币世界坐标 */
     private static redBag_world_pos: cc.Vec2 = null!;
+    /** 掉落红包币节点 
+     * - 改节点可能为空
+    */
+    private static node_red_item: cc.Node = null;
     /** 掉落请求回调 
      *  - 服务端回复
         "StageRewardNum": Integer, (用户通关红包当前数量)
@@ -111,17 +117,16 @@ export default class CheckpointRedBagModle {
             // this.redbag_data.cur_count = data2.StageRewardNum;
             this.redbag_data.cumulative_count = data2.StageRewardDrop;
 
-
             // this.redbag_data.cumulative_count++;
             this.cur_is_get = true;
             // 模拟数据,直接出现
             let red_bag_path = 'module/checkpointRedBag/btn_chPo_RedBag';
             XXLoader.loadAssetByType(red_bag_path, cc.Prefab, (asset) => {
                 if (!this.comp_main) this.comp_main = GameController.uiM.getUI(MainUI);
-                let node_red = cc.instantiate(asset);
-                node_red.parent = this.comp_main.node;
-                let node_pos = node_red.parent.convertToNodeSpaceAR(this.redBag_world_pos);
-                node_red.setPosition(node_pos);
+                this.node_red_item = cc.instantiate(asset);
+                this.node_red_item.parent = this.comp_main.node;
+                let node_pos = this.node_red_item.parent.convertToNodeSpaceAR(this.redBag_world_pos);
+                this.node_red_item.setPosition(node_pos);
             })
         } else if (data && data.code === 0) {
             // 达到上限
@@ -153,6 +158,11 @@ export default class CheckpointRedBagModle {
             let data2 = data.data;
             this.StageRewardRedBag = data2.StageRewardRedBag;
             this.redbag_data.cumulative_count = data2.StageRewardDrop;
+            if (cc.isValid(this.node_red_item)) {
+                this.redbag_data.cur_count = data2.StageRewardNum - 1;
+            } else {
+                this.redbag_data.cur_count = data2.StageRewardNum;
+            }
             this.lookVideoCall();
         } else {
 
@@ -192,7 +202,7 @@ export default class CheckpointRedBagModle {
             }
 
         }
-        GameController.uiM.openUI(RedEnvelopesUI, null, ViewZorder.UI, null, null, reward_data);
+        GameController.uiM.openUI(RedEnvelopesUI, null, ViewZorder.UI + 1, null, null, reward_data);
     }
     /** 飞item动画 */
     private static flyNode() {

+ 1 - 0
tower_sanguo/assets/scripts/module/result/ResultUI.ts

@@ -76,6 +76,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;
+        cc.log(this.ui_data)
         const n_count = this.arr_icon.length;
         for (let i = 0; i < n_count; i++) {
             let node_icon = this.arr_icon[i];

+ 1 - 5
tower_sanguo/assets/scripts/utils/StringUtil.ts

@@ -217,11 +217,7 @@ export default class StringUtil {
         } else if (item_id === 10) {// 武将
             GameController.gameData.addGeneralOrfragment(1, general_id, 0)
         } else if (item_id === 11) {// 武将碎片
-            if (GameController.useLocalServer) {
-                GameController.gameData.addGeneral(general_id, 2, count);
-            } else {
-                GameController.gameData.addGeneral(general_id, 4, count);
-            }
+            GameController.gameData.addGeneralOrfragment(2, general_id, count)
         }
     }
 }