"use strict"; cc._RF.push(module, '490d1uCJXtIoL7oaw9StSoQ', 'rank_controller'); // Scripts/mod/rank/rank_controller.js "use strict"; // -------------------------------------------------------------------- // @author: xxx@syg.com(必填, 创建模块的人员) // @description: // 这里填写详细说明,主要填写该模块的功能简要 //
Create: 2019-01-29 10:47:25 // -------------------------------------------------------------------- var BridgeController = require("bridge.controller"); var RankEvent = require("rank_event"); var RankConstant = require("rank_constant"); var ArenaController = require("arena_controller"); var RankController = cc.Class({ "extends": BridgeController, ctor: function ctor() {}, // 初始化配置数据 initConfig: function initConfig() { var RankModel = require("rank_model"); this.model = new RankModel(); this.model.initConfig(); }, // 返回当前的model getModel: function getModel() { return this.model; }, // 注册监听事件 registerEvents: function registerEvents() {}, requestBaseQuestData: function requestBaseQuestData(_cb) { var cluster = 1; var protocal = {}; protocal.is_cluster = cluster; this.SendProtocal(12902, protocal, _cb); }, // 注册协议接受事件 registerProtocals: function registerProtocals() { this.RegisterProtocal(12900, this.handle_12900); //排行榜数据 this.RegisterProtocal(12901, this.handle_12901); //指定排行榜最后更新时间 this.RegisterProtocal(12902, this.handle_12902); //请求各个排行榜第一数据 this.RegisterProtocal(12903, this.handle_12903); //请求公会排行榜数据 this.RegisterProtocal(12904, this.handle_12904); //请求公会排行榜数据 }, reqBaseFromServer: function reqBaseFromServer(_cb) { var _this = this; var cfgs = ["dungeon_data", "avatar_data"]; this.loadConfigs(cfgs, function (_ret, _data) { _this.requestBaseQuestData(_cb); }); }, //排行榜 send_12900: function send_12900(rank_type, start, num, is_cluster) { //请求排行榜 var cluster = 0; if (is_cluster == true) { cluster = 1; } var protocal = {}; protocal.type = rank_type; protocal.start = start || 1; protocal.num = num || 100; protocal.is_cluster = cluster; this.SendProtocal(12900, protocal); }, handle_12900: function handle_12900(data) { gcore.GlobalEvent.fire(RankEvent.RankEvent_Get_Rank_data, data); }, //指定排行榜最后更新时间 send_12901: function send_12901(type, is_cluster) { //请求排行榜 var cluster = 0; if (is_cluster == true) cluster = 1; var protocal = {}; protocal.type = type; protocal.is_cluster = cluster; this.SendProtocal(12901, protocal); }, handle_12901: function handle_12901(data) { gcore.GlobalEvent.fire(RankEvent.RankEvent_Get_Time_event, data); }, del_rankfirstlist: function del_rankfirstlist(data) { this.rank_firstList = data; }, //请求各个排行榜第一数据 send_12902: function send_12902(is_cluster) { //请求排行榜 var cluster = 0; if (is_cluster == true) cluster = 1; var protocal = {}; protocal.is_cluster = cluster; this.SendProtocal(12902, protocal); }, handle_12902: function handle_12902(data) { this.del_rankfirstlist(data); gcore.GlobalEvent.fire(RankEvent.RankEvent_Get_First_data, data); }, //请求公会排行榜数据 send_12903: function send_12903(start, num) { //请求排行榜 var protocal = {}; protocal.start = start || 1; protocal.num = num || 100; this.SendProtocal(12903, protocal); }, handle_12903: function handle_12903(data) { gcore.GlobalEvent.fire(RankEvent.RankEvent_Get_Rank_data, data); }, //请求英雄排行榜数据 send_12904: function send_12904(start, num) { var protocal = {}; protocal.start = start || 1; protocal.num = num || 100; this.SendProtocal(12904, protocal); }, handle_12904: function handle_12904(data) { gcore.GlobalEvent.fire(RankEvent.RankEvent_Get_Rank_data, data); }, //index打开对应的标签页 openMainView: function openMainView(bool) { if (bool == true) { if (!this.main_view) { this.main_view = Utils.createClass("cmp.rank.list.wnd"); } this.main_view.open(); } else { if (this.main_view) { this.main_view.close(); this.main_view = null; } } }, // nx 打开排行榜详情 openRankDetail: function openRankDetail(type, boss_id, curter) { if (curter === void 0) { curter = false; } nx.bridge.createPanel("WndRankInfo", { type: type, boss_id: boss_id }); }, //index打开对应的标签页 openCrossMainView: function openCrossMainView(bool) { if (bool == true) { if (!this.cross_main_view) { this.cross_main_view = Utils.createClass("rank_cross_main_window"); } this.cross_main_view.open(); } else { if (this.cross_main_view) { this.cross_main_view.close(); this.cross_main_view = null; } } }, //打开排行榜信息 openRankView: function openRankView(bool, index, is_cluster, data) { if (bool == true) { if (!this.rank_panel) { var view = require("rank_window"); this.rank_panel = new view(index, is_cluster); } this.rank_panel.open(data); } else { if (this.rank_panel) { this.rank_panel.close(); this.rank_panel = null; } } }, //打开奖励排行榜界面 openRankRewardPanel: function openRankRewardPanel(bool, rank_reward_type) { if (bool == true) { if (!this.rank_reward_panel) { this.rank_reward_panel = Utils.createClass("rank_reward_window"); } this.rank_reward_panel.open(rank_reward_type); } else { if (this.rank_reward_panel) { this.rank_reward_panel.close(); this.rank_reward_panel = null; } } }, //打開通用單個排行類型的排行榜界面 //@ setting 說明 //@setting.rank_type openSingleRankMainWindow: function openSingleRankMainWindow(bool, setting, view_type) { if (bool == true) { setting.view_type = view_type; if (!this.single_rank_main_window) { this.single_rank_main_window = Utils.createClass("single_rank_main_window"); } this.single_rank_main_window.open(setting); } else { if (this.single_rank_main_window) { this.single_rank_main_window.close(); this.single_rank_main_window = null; } } }, testOpenRankDetailWidnow: function testOpenRankDetailWidnow(status, data) { if (status == false) { if (this.rank_detail != null) { this.rank_detail.deleteMe(); this.rank_detail = null; } } else { if (this.rank_detail == null) { this.rank_detail = new RankDetailWidnow(); } this.rank_detail.open(data); } }, getFirstRankList: function getFirstRankList() { return this.rank_firstList; }, getListType: function getListType() { return this.lstType; }, saveListType: function saveListType(_data) { this.lstType = _data; } }); module.exports = RankController; cc._RF.pop();