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