85 lines
2.3 KiB
JavaScript
85 lines
2.3 KiB
JavaScript
|
|
"use strict";
|
||
|
|
cc._RF.push(module, 'cef8bHl4hNOjJhZvG2H1f1b', 'act.limit.shop.mod');
|
||
|
|
// Scripts/mod/acts/limitShop/act.limit.shop.mod.js
|
||
|
|
|
||
|
|
"use strict";
|
||
|
|
|
||
|
|
/*******************************************************************************
|
||
|
|
*
|
||
|
|
* 限购商城
|
||
|
|
*
|
||
|
|
*
|
||
|
|
******************************************************************************/
|
||
|
|
|
||
|
|
var BridgeController = require("bridge.controller");
|
||
|
|
var ActLimitShopMod = cc.Class({
|
||
|
|
"extends": BridgeController,
|
||
|
|
// 初始化配置数据
|
||
|
|
initConfig: function initConfig() {},
|
||
|
|
// 注册协议接受事件
|
||
|
|
registerProtocals: function registerProtocals() {
|
||
|
|
this.RegisterProtocal(16603, this.handle16603.bind(this));
|
||
|
|
this.RegisterProtocal(16604, this.handle16604.bind(this));
|
||
|
|
},
|
||
|
|
// 从服务器初始化数据
|
||
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
||
|
|
// 配置加载
|
||
|
|
var cfgs = ["recruit_shop_data"];
|
||
|
|
this.loadConfigs(cfgs, function (_ret, _data) {
|
||
|
|
nx.dt.fnInvoke(_cb, true);
|
||
|
|
});
|
||
|
|
},
|
||
|
|
// ============================================================
|
||
|
|
// 基本操作
|
||
|
|
// ============================================================
|
||
|
|
|
||
|
|
// 请求基本信息
|
||
|
|
reqBaseData: function reqBaseData(_campId, _cb) {
|
||
|
|
this.SendProtocal(16603, {
|
||
|
|
bid: _campId
|
||
|
|
}, _cb);
|
||
|
|
},
|
||
|
|
// 请求基本信息返回
|
||
|
|
handle16603: function handle16603(_data) {
|
||
|
|
if (!this.isGoodData(_data)) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// 钻石购买
|
||
|
|
reqBuyDiamondProdcut: function reqBuyDiamondProdcut(_campId, _num, _cb) {
|
||
|
|
this.SendProtocal(16604, {
|
||
|
|
bid: _campId,
|
||
|
|
aim: 0,
|
||
|
|
arg: _num
|
||
|
|
}, _cb);
|
||
|
|
},
|
||
|
|
// 钻石购买返回
|
||
|
|
handle16604: function handle16604(_data) {
|
||
|
|
if (!this.isGoodData(_data)) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
},
|
||
|
|
// ============================================================
|
||
|
|
// 配置相关
|
||
|
|
// ============================================================
|
||
|
|
|
||
|
|
// 获取配置
|
||
|
|
queryConfigs: function queryConfigs(_campId) {
|
||
|
|
var DATA = game.configs.recruit_shop_data;
|
||
|
|
if (!DATA) {
|
||
|
|
nx.error("$LimitShop:\u914D\u7F6E\u8868\u7F3A\u5931!");
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
var info = DATA.data_exchange_info[_campId];
|
||
|
|
if (!info) {
|
||
|
|
nx.error("$LimitShop:\u914D\u7F6E\u7F3A\u5931! " + _campId);
|
||
|
|
return null;
|
||
|
|
}
|
||
|
|
return nx.dt.objClone(info);
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
// 模块导出
|
||
|
|
module.exports = ActLimitShopMod;
|
||
|
|
|
||
|
|
cc._RF.pop();
|