|
@@ -1,6 +1,8 @@
|
|
|
-import { PLAYERPROP } from "../../data/GameDefinition";
|
|
|
|
|
|
|
+import { ViewZorder } from "../../../MOKA/data/ViewZOrder";
|
|
|
|
|
+import { PLAYERPROP, RewardState } from "../../data/GameDefinition";
|
|
|
import GameController from "../../GameController";
|
|
import GameController from "../../GameController";
|
|
|
import MainUI from "../main/MainUI";
|
|
import MainUI from "../main/MainUI";
|
|
|
|
|
+import RedEnvelopesUI from "../redEnvelopes/RedEnvelopesUI";
|
|
|
import CheckpointRedBagBtn from "./CheckpointRedBagBtn";
|
|
import CheckpointRedBagBtn from "./CheckpointRedBagBtn";
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -96,7 +98,7 @@ export default class CheckpointRedBagModle {
|
|
|
/** 掉落请求回调
|
|
/** 掉落请求回调
|
|
|
* - 服务端回复
|
|
* - 服务端回复
|
|
|
"StageRewardNum": Integer, (用户通关红包当前数量)
|
|
"StageRewardNum": Integer, (用户通关红包当前数量)
|
|
|
- "StageRewardRedBag": Integer, (用户打开通关红包币数量)
|
|
|
|
|
|
|
+ "StageRewardRedBag": Integer, (用户看视频打开通关红包,拿到的红包币数量)
|
|
|
"StageRewardDrop": Integer, (用户当天红包掉落次数)
|
|
"StageRewardDrop": Integer, (用户当天红包掉落次数)
|
|
|
"stageRewardLastTime": Long, (用户最后更新通关红包的时间)
|
|
"stageRewardLastTime": Long, (用户最后更新通关红包的时间)
|
|
|
"stageRewardVideoTime": Integer (用户通关红包视频次数)
|
|
"stageRewardVideoTime": Integer (用户通关红包视频次数)
|
|
@@ -141,13 +143,15 @@ export default class CheckpointRedBagModle {
|
|
|
this.redbag_data.cur_count += 1;
|
|
this.redbag_data.cur_count += 1;
|
|
|
this.saveCheckpointRedBag();
|
|
this.saveCheckpointRedBag();
|
|
|
}
|
|
}
|
|
|
|
|
+ /** 用户看视频打开通关红包,拿到的红包币数量 */
|
|
|
|
|
+ private static StageRewardRedBag: number = 0;
|
|
|
/** 数量减少 */
|
|
/** 数量减少 */
|
|
|
public static onReciveTVRewardCall(reply) {
|
|
public static onReciveTVRewardCall(reply) {
|
|
|
cc.log('领取通关红包币结果:', reply)
|
|
cc.log('领取通关红包币结果:', reply)
|
|
|
let data = reply.data;
|
|
let data = reply.data;
|
|
|
if (data && data.code === 1) {
|
|
if (data && data.code === 1) {
|
|
|
let data2 = data.data;
|
|
let data2 = data.data;
|
|
|
- // this.redbag_data.cur_count = data2.StageRewardNum;
|
|
|
|
|
|
|
+ this.StageRewardRedBag = data2.StageRewardRedBag;
|
|
|
this.redbag_data.cumulative_count = data2.StageRewardDrop;
|
|
this.redbag_data.cumulative_count = data2.StageRewardDrop;
|
|
|
this.lookVideoCall();
|
|
this.lookVideoCall();
|
|
|
} else {
|
|
} else {
|
|
@@ -161,7 +165,37 @@ export default class CheckpointRedBagModle {
|
|
|
if (!this.comp_main) this.comp_main = GameController.uiM.getUI(MainUI);
|
|
if (!this.comp_main) this.comp_main = GameController.uiM.getUI(MainUI);
|
|
|
this.redbag_data.cur_count--;
|
|
this.redbag_data.cur_count--;
|
|
|
this.saveCheckpointRedBag();
|
|
this.saveCheckpointRedBag();
|
|
|
|
|
+ // this.flyNode();
|
|
|
|
|
+ this.openRedBagAni();
|
|
|
|
|
+ }
|
|
|
|
|
+ /** 开红包动画 */
|
|
|
|
|
+ private static openRedBagAni() {
|
|
|
|
|
+ const world_pos = this.comp_main.btn_chPo_RedBag.node.parent.convertToWorldSpaceAR(this.comp_main.btn_chPo_RedBag.node.getPosition());
|
|
|
|
|
+ let reward_data = {
|
|
|
|
|
+ /** 活跃宝箱id */
|
|
|
|
|
+ id: PLAYERPROP.REDBAG,
|
|
|
|
|
+ /** 光圈起始位置【世界坐标】,有值则代表有移动效果 */
|
|
|
|
|
+ move_start_pos: world_pos,
|
|
|
|
|
+ count: this.StageRewardRedBag,
|
|
|
|
|
+ /** 起始缩放 */
|
|
|
|
|
+ move_start_scale: 0.08,
|
|
|
|
|
+ /** 存在双倍 */
|
|
|
|
|
+ exist_double: false,
|
|
|
|
|
+ tv_box_state: RewardState.lock,
|
|
|
|
|
+ /** 普通奖励状态 */
|
|
|
|
|
+ task_box_state: RewardState.unlock,
|
|
|
|
|
+ /** 不要在界面内加属性 */
|
|
|
|
|
+ addProp: true,
|
|
|
|
|
+ /** 界面关闭回调 */
|
|
|
|
|
+ close_call: () => {
|
|
|
|
|
+ this.flyNode();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ GameController.uiM.openUI(RedEnvelopesUI, null, ViewZorder.UI, null, null, reward_data);
|
|
|
|
|
+ }
|
|
|
|
|
+ /** 飞item动画 */
|
|
|
|
|
+ private static flyNode() {
|
|
|
let start_node_pos = new cc.Vec2(0, -200);
|
|
let start_node_pos = new cc.Vec2(0, -200);
|
|
|
|
|
|
|
|
let end_world_pos = this.comp_main.node_hb.node.parent.convertToWorldSpaceAR(this.comp_main.node_hb.node.getPosition());
|
|
let end_world_pos = this.comp_main.node_hb.node.parent.convertToWorldSpaceAR(this.comp_main.node_hb.node.getPosition());
|
|
@@ -175,7 +209,7 @@ export default class CheckpointRedBagModle {
|
|
|
end_pos: end_node_pos,
|
|
end_pos: end_node_pos,
|
|
|
complete_call: () => {
|
|
complete_call: () => {
|
|
|
// 玩家红包币增加
|
|
// 玩家红包币增加
|
|
|
- GameController.gameData.player.setProp(PLAYERPROP.CHECKPOINT_REGBAG_DATA, 1, true);
|
|
|
|
|
|
|
+ GameController.gameData.player.setProp(PLAYERPROP.REDBAG, this.StageRewardRedBag, true);
|
|
|
},
|
|
},
|
|
|
}
|
|
}
|
|
|
// 发起飞item事件
|
|
// 发起飞item事件
|