Просмотр исходного кода

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

zouyong 5 лет назад
Родитель
Сommit
c214cc3a7c

+ 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() {

+ 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": {}
+}

+ 9 - 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,8 @@ 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];
@@ -91,8 +95,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 +189,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事件

+ 5 - 2
tower_sanguo/assets/scripts/module/turntable/turntableItem.ts

@@ -110,7 +110,7 @@ export default class turntableItem extends cc.Component {
                 outline.width = 1
             }), cc.scaleTo(0.3, 1.6), cc.callFunc(() => {
                 this.schedule(this.showAction, 0.015)
-            }), cc.delayTime((this.num - this.animNum) * 0.016), cc.scaleTo(0.3, 1), cc.callFunc(() => {
+            }), cc.delayTime((this.num - this.animNum) / 3 * 0.016), cc.scaleTo(0.3, 1), cc.callFunc(() => {
                 this.labNum.node.color = color
                 this.labNum.node.removeComponent(cc.LabelOutline)
             })))
@@ -119,7 +119,10 @@ export default class turntableItem extends cc.Component {
 
     showAction() {
         if (this.animNum < this.num) {
-            this.animNum++
+            this.animNum += 3
+            if (this.animNum > this.num) {
+                this.animNum = this.num
+            }
         }
 
         if (cc.isValid(this.labNum)) {

+ 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)
         }
     }
 }