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