Przeglądaj źródła

接口参数调整

薛鸿潇 5 lat temu
rodzic
commit
0cabc01de1

+ 3 - 2
tower_sanguo/assets/scripts/module/checkpointRedBag/CheckpointRedBagBtn.ts

@@ -18,7 +18,7 @@ export default class CheckpointRedBagBtn extends cc.Component {
         XXEvent.on('event-get-checkpoint-redbag', this.onAddRedBag, this);
         XXEvent.on('event-monster-died', this.onMonsterDied, this);
         XXEvent.on(XXConst.EventNewMissionStart, this.onNewMissionStart, this)// 新的一波开始了
-        XXEvent.on('http-stage-getStageReward', this.onReciveTVRewardCall, this);
+        XXEvent.on('http-stage-getStageReward', this.onReciveTVRewardCall, this);// 领取通关红包币
     }
 
     start() {
@@ -54,7 +54,8 @@ export default class CheckpointRedBagBtn extends cc.Component {
     private onReciveTVRewardCall(reply) {
         cc.log(reply)
         // 处理数据
-        CheckpointRedBagModle.onClickCal();
+        // 数量-1
+        CheckpointRedBagModle.onReciveTVRewardCall(reply);
 
         let time = CheckpointRedBagModle.redbag_data.cur_count - this.targetProgress;
         this.targetProgress = CheckpointRedBagModle.redbag_data.cur_count;

+ 21 - 19
tower_sanguo/assets/scripts/module/checkpointRedBag/CheckpointRedBagModle.ts

@@ -84,8 +84,8 @@ export default class CheckpointRedBagModle {
     public static requestRedBag(world_pos: cc.Vec2) {
         if (this.cur_is_get) return;
         if (!this.isGetRedBag()) return;
-        if (this.redbag_data.cumulative_count >= this.redbag_data.limit_count) return;
-        if (this.redbag_data.cur_count >= this.redbag_data.limit_count) return;
+        if (this.redbag_data.cumulative_count && this.redbag_data.limit_count && this.redbag_data.cumulative_count >= this.redbag_data.limit_count) return;
+        if (this.redbag_data.cur_count && this.redbag_data.limit_count && this.redbag_data.cur_count >= this.redbag_data.limit_count) return;
         this.redBag_world_pos = world_pos;
         // 掉落请求
         GameController.http.saveStageReward();
@@ -101,13 +101,13 @@ export default class CheckpointRedBagModle {
             // "stageRewardVideoTime": Integer (用户通关红包视频次数)
     */
     public static saveStageRewardCall(reply) {
-        cc.log('怪物掉落红包币:', reply)
+        cc.log('怪物掉落红包币结果:', reply)
         let data = reply.data;
         if (data && data.code === 1) {
             let data2 = data.data;
-            this.redbag_data.cur_count = data2.stageRewardRedBag;
-            this.redbag_data.cumulative_count = data2.stageRewardDrop;
-            let t_limit_count = data2.stageRewardNum + data2.stageRewardDrop;// 限制次数 = 剩余次数 + 当日累计
+            this.redbag_data.cur_count = data2.StageRewardRedBag;
+            this.redbag_data.cumulative_count = data2.StageRewardDrop;
+            let t_limit_count = data2.StageRewardNum + data2.StageRewardDrop;// 限制次数 = 剩余次数 + 当日累计
             this.redbag_data.limit_count = t_limit_count;
 
 
@@ -132,27 +132,29 @@ export default class CheckpointRedBagModle {
         if (!this.redbag_data.cur_count) {
             GameController.uiM.showToast('挂机可以产生红包');
         } else {
-            // 看视频
-            // 数量-1
-            this.subCount();
+            // 领取视频红包请求
+            GameController.http.getStageReward();
         }
     }
-    /** 红包币掉落 */
-    private static getRegBagByMonster() {
-
-    }
-    /** 掉落的红包币飞往 通关红包币仓库 */
-    private static flySaveNode() {
-
-    }
     /** 数量增加 */
     public static addCount() {
         this.redbag_data.cur_count += 1;
         this.saveCheckpointRedBag();
     }
     /** 数量减少 */
-    private static subCount() {
-        this.lookVideoCall();
+    public static onReciveTVRewardCall(reply) {
+        cc.log('领取通关红包币结果:', reply)
+        let data = reply.data;
+        if (data && data.code === 1) {
+            let data2 = data.data;
+            this.redbag_data.cur_count = data2.StageRewardRedBag;
+            this.redbag_data.cumulative_count = data2.StageRewardDrop;
+            let t_limit_count = data2.StageRewardNum + data2.StageRewardDrop;// 限制次数 = 剩余次数 + 当日累计
+            this.redbag_data.limit_count = t_limit_count;
+            this.lookVideoCall();
+        } else {
+
+        }
     }
     /** 看完视频回调 */
     private static lookVideoCall() {