Files

64 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, '37b3fmCRqdKGZlR3GRtG+jH', 'once.rewards.mod');
// Scripts/mod/once/once.rewards.mod.js
"use strict";
/*******************************************************************************
*
* 一键领取模块
*
* 2023.09.27
******************************************************************************/
var BridgeController = require("bridge.controller");
var OnceRewardsMod = cc.Class({
"extends": BridgeController,
// 注册协议接受事件
registerProtocals: function registerProtocals() {
this.RegisterProtocal(29800, this.onPushData.bind(this));
this.RegisterProtocal(29801, this.onReward.bind(this));
},
// 从服务器初始化数据
reqBaseFromServer: function reqBaseFromServer(_cb) {
nx.bridge.vset("OnceRewards", []);
nx.dt.fnInvoke(_cb, true);
this.reqBaseData();
},
// ============================================================
// 基本数据
// ============================================================
// 请求基本数据
reqBaseData: function reqBaseData(_cb) {
this.SendProtocal(29800, {}, _cb);
},
// 基本数据
onPushData: function onPushData(_data) {
if (!this.isGoodData(_data)) {
return;
}
var list = _data.reward_list || [];
nx.bridge.vset("OnceRewards", list);
nx.mTip.openTip("bar.once", nx.dt.arrNEmpty(list));
},
// ============================================================
// 领取相关
// ============================================================
// 请求领取
reqReward: function reqReward(_cb) {
this.SendProtocal(29801, {}, _cb);
},
// 领取返回
onReward: function onReward(_data) {
if (!this.isGoodData(_data)) {
return;
}
}
});
// 模块导出
module.exports = OnceRewardsMod;
cc._RF.pop();