"use strict"; cc._RF.push(module, '1ed8aLtU0NJKJA+X1LXJqRe', 'exchange_controller'); // Scripts/mod/exchange/exchange_controller.js "use strict"; // -------------------------------------------------------------------- // @author: xxx@syg.com(必填, 创建模块的人员) // @description: // 这里填写详细说明,主要填写该模块的功能简要 //
Create: 2018-12-25 16:37:10 // -------------------------------------------------------------------- var ExchangeEvent = require("exchange_event"); var ExchangeController = cc.Class({ "extends": BaseController, ctor: function ctor() {}, // 初始化配置数据 initConfig: function initConfig() { var ExchangeModel = require("exchange_model"); this.model = new ExchangeModel(); this.model.initConfig(); }, // 返回当前的model getModel: function getModel() { return this.model; }, // 注册监听事件 registerEvents: function registerEvents() { if (this.init_role_event == null) { this.init_role_event = gcore.GlobalEvent.bind(EventId.EVT_ROLE_CREATE_SUCCESS, function () { gcore.GlobalEvent.unbind(this.init_role_event); this.init_role_event = null; //-- 上线时请求 // this.send23606(); }.bind(this)); } }, // 注册协议接受事件 registerProtocals: function registerProtocals() { this.RegisterProtocal(23606, this.on23606); this.RegisterProtocal(23607, this.on23607); }, send23606: function send23606() { this.SendProtocal(23606, {}); }, on23606: function on23606(data) { this.model.setExchangeData(data); gcore.GlobalEvent.fire(ExchangeEvent.Extra_Reward, data); }, send23607: function send23607(id) { this.SendProtocal(23607, { id: id }); }, on23607: function on23607(data) { message(data.msg); }, openExchangeMainView: function openExchangeMainView(status) { if (status) { if (!this.exchange_win) { var ExchangeWindow = require("exchange_window"); this.exchange_win = new ExchangeWindow(); } this.exchange_win.open(); } else { if (this.exchange_win) { this.exchange_win.close(); this.exchange_win = null; } } } }); module.exports = ExchangeController; cc._RF.pop();