"use strict";
|
cc._RF.push(module, '490d1uCJXtIoL7oaw9StSoQ', 'rank_controller');
|
// Scripts/mod/rank/rank_controller.js
|
|
"use strict";
|
|
// --------------------------------------------------------------------
|
// @author: xxx@syg.com(必填, 创建模块的人员)
|
// @description:
|
// 这里填写详细说明,主要填写该模块的功能简要
|
// <br/>Create: 2019-01-29 10:47:25
|
// --------------------------------------------------------------------
|
var RankEvent = require("rank_event");
|
|
var MainuiController = require("mainui_controller");
|
|
var MainuiConst = require("mainui_const");
|
|
var RankController = cc.Class({
|
"extends": BaseController,
|
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() {},
|
// 注册协议接受事件
|
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); //请求公会排行榜数据
|
},
|
//排行榜
|
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);
|
},
|
//请求各个排行榜第一数据
|
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) {
|
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 (MainuiController.getInstance().checkMainFunctionOpenStatus(MainuiConst.icon.rank, MainuiConst.function_type.other) == false) return;
|
|
if (!this.main_view) {
|
this.main_view = Utils.createClass("rank_main_window");
|
}
|
|
this.main_view.open();
|
} else {
|
if (this.main_view) {
|
this.main_view.close();
|
this.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;
|
}
|
}
|
}
|
});
|
module.exports = RankController;
|
|
cc._RF.pop();
|