"use strict"; cc._RF.push(module, '966e4GnW1BIsIjuBPIZS+yw', 'newfirstcharge_controller'); // Scripts/mod/newfirstcharge/newfirstcharge_controller.js "use strict"; // -------------------------------------------------------------------- // @author: xxx@syg.com(必填, 创建模块的人员) // @description: // 这里填写详细说明,主要填写该模块的功能简要 //
Create: 2019-03-22 11:01:46 // -------------------------------------------------------------------- var NewfirstchargeController = cc.Class({ "extends": BaseController, ctor: function ctor() {}, // 初始化配置数据 initConfig: function initConfig() { var NewfirstchargeModel = require("newfirstcharge_model"); this.model = new NewfirstchargeModel(); this.model.initConfig(); }, // 返回当前的model getModel: function getModel() { return this.model; }, // 注册监听事件 registerEvents: function registerEvents() {}, // 注册协议接受事件 registerProtocals: function registerProtocals() { this.RegisterProtocal(21012, this.handle21012); this.RegisterProtocal(21013, this.handle21013); this.RegisterProtocal(21014, this.handle21014); this.RegisterProtocal(21015, this.handle21015); this.RegisterProtocal(21000, this.handle21000); this.RegisterProtocal(21001, this.handle21001); }, openNewFirstChargeView: function openNewFirstChargeView(bool) { if (bool == true) { var MainuiController = require("mainui_controller"); var MainuiConst = require("mainui_const"); var first_icon = MainuiController.getInstance().getFunctionIconById(MainuiConst.icon.first_charge_new1); if (first_icon) { if (!this.new_first_charge_window) { this.new_first_charge_window = Utils.createClass("newfirstcharge1_window", this); } } var first_icon1 = MainuiController.getInstance().getFunctionIconById(MainuiConst.icon.first_charge_new); if (first_icon1) { if (!this.new_first_charge_window) { this.new_first_charge_window = Utils.createClass("newfirstcharge_window", this); } } if (!this.new_first_charge_window) return; var RoleController = require("role_controller"); var role_vo = RoleController.getInstance().getRoleVo(); var index = 1; if (role_vo.vip_exp != 0) { index = 2; } if (this.new_first_get_data) { // 首充是否可以领取 var first_status = false; for (var i = 1; i <= 3; i++) { if (this.new_first_get_data[i - 1] && this.new_first_get_data[i - 1].status == 1) { first_status = true; index = 1; break; } } // 累充是否可以领取 var total_status = false; for (var i = 4; i <= 6; i++) { if (this.new_first_get_data[i - 1] && this.new_first_get_data[i - 1].status == 1) { total_status = true; index = 2; break; } } if (first_status == true && total_status == true) { index = 1; } } this.new_first_charge_window.open(index); } else { if (this.new_first_charge_window) { this.new_first_charge_window.close(); this.new_first_charge_window = null; } } }, // 信息 sender21012: function sender21012() { this.SendProtocal(21012, {}); }, handle21012: function handle21012(data) { this.new_first_get_data = data.first_gift; //首充是否可领取的数据 this.model.setFirstBtnStatus(data.first_gift); var NewFirstChargeEvent = require("newfirstcharge_event"); gcore.GlobalEvent.fire(NewFirstChargeEvent.New_First_Charge_Event, data); }, // 领取 sender21013: function sender21013(id) { var proto = {}; proto.id = id; this.SendProtocal(21013, proto); }, handle21013: function handle21013(data) { message(data.msg); }, // 自选英雄 sender21014: function sender21014(id) { var proto = {}; proto.id = id; this.SendProtocal(21014, proto); }, handle21014: function handle21014(data) { message(data.msg); }, // 每日礼包红点 handle21015: function handle21015(data) { if (data.open_id && Utils.next(data.open_id) != null) {// WelfareController.getInstance().getModel().updateDailyGiftRedStatus(true) } }, //新版首充礼包信息 sender21000: function sender21000() { this.SendProtocal(21000, {}); }, handle21000: function handle21000(data) { this.new_first_get_data = data.first_gift; //--首充是否可领取的数据 this.model.setFirstBtnNewStatus(data.first_gift); var NewFirstChargeEvent = require("newfirstcharge_event"); gcore.GlobalEvent.fire(NewFirstChargeEvent.New_First_Charge_Event, data); }, //--领取新版首冲礼包 sender21001: function sender21001(id) { var protocal = {}; protocal.id = id; this.SendProtocal(21001, protocal); }, handle21001: function handle21001(data) { message(data.msg); }, getNewFirstChargeView: function getNewFirstChargeView() { return this.new_first_charge_window; }, __delete: function __delete() {// if(this.model != null){ // this.model.DeleteMe(); // this.model = null; // } } }); module.exports = NewfirstchargeController; cc._RF.pop();