|
@@ -86,19 +86,47 @@ export default class CheckpointRedBagModle {
|
|
|
if (!this.isGetRedBag()) return;
|
|
if (!this.isGetRedBag()) return;
|
|
|
if (this.redbag_data.cumulative_count >= this.redbag_data.limit_count) 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.cur_count >= this.redbag_data.limit_count) return;
|
|
|
|
|
+ this.redBag_world_pos = world_pos;
|
|
|
|
|
+ // 掉落请求
|
|
|
|
|
+ GameController.http.saveStageReward();
|
|
|
|
|
+ }
|
|
|
|
|
+ /** 红包币世界坐标 */
|
|
|
|
|
+ private static redBag_world_pos: cc.Vec2 = null!;
|
|
|
|
|
+ /** 掉落请求回调
|
|
|
|
|
+ * - 服务端回复
|
|
|
|
|
+ // "stageRewardNum": Integer, (用户通关红包剩余数量)
|
|
|
|
|
+ // "stageRewardRedBag": Integer, (用户当前通关红包币数量)
|
|
|
|
|
+ // "stageRewardDrop": Integer, (用户当天红包掉落次数)
|
|
|
|
|
+ // "stageRewardLastTime": Long, (用户最后更新通关红包的时间)
|
|
|
|
|
+ // "stageRewardVideoTime": Integer (用户通关红包视频次数)
|
|
|
|
|
+ */
|
|
|
|
|
+ public static saveStageRewardCall(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.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(world_pos);
|
|
|
|
|
- node_red.setPosition(node_pos);
|
|
|
|
|
- })
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 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);
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/** 点击通关红包币事件触发 */
|
|
/** 点击通关红包币事件触发 */
|
|
|
public static onClickCal() {
|
|
public static onClickCal() {
|
|
|
if (!this.redbag_data.cur_count) {
|
|
if (!this.redbag_data.cur_count) {
|