853 lines
29 KiB
JavaScript
853 lines
29 KiB
JavaScript
"use strict";
|
|
cc._RF.push(module, '2dffcv8hD1O0I8pPJXBDgcT', 'role_controller');
|
|
// Scripts/mod/personal/role_controller.js
|
|
|
|
"use strict";
|
|
|
|
var _cc$Class;
|
|
/*-----------------------------------------------------+
|
|
* 角色控制模块
|
|
* @author whjing2012@163.com
|
|
+-----------------------------------------------------*/
|
|
|
|
var BridgeController = require("bridge.controller");
|
|
var RoleEvent = require("role_event");
|
|
var RoleConst = require("role_const");
|
|
var TimeTool = require("timetool");
|
|
var RoleModel = require("role_model");
|
|
var FFSDK = require("ff_sdk");
|
|
var HeroController = require("hero_controller");
|
|
var FID = require("bridge.function.ids");
|
|
var RoleController = cc.Class((_cc$Class = {
|
|
"extends": BridgeController,
|
|
ctor: function ctor() {},
|
|
// 初始化配置数据
|
|
initConfig: function initConfig() {
|
|
this.model = new RoleModel();
|
|
this.model.initConfig();
|
|
this.is_re_connect = false;
|
|
this.apk_data = null;
|
|
this.openServer = {};
|
|
// SDK_.get_apk_url(function(_data){
|
|
// cc.log(_data)
|
|
// this.apk_data = _data;
|
|
// }.bind(this))
|
|
},
|
|
|
|
getModel: function getModel() {
|
|
return this.model;
|
|
},
|
|
getRoleVo: function getRoleVo() {
|
|
if (!this.model) {
|
|
nx.error("ROLE:尚未初始化角色!");
|
|
return null;
|
|
}
|
|
return this.model.getRoleVo();
|
|
},
|
|
// 注册监听事件
|
|
registerEvents: function registerEvents() {},
|
|
// 注册协议接受事件
|
|
registerProtocals: function registerProtocals() {
|
|
this.RegisterProtocal(10301, this.on10301); // 角色基本信息
|
|
this.RegisterProtocal(10302, this.on10302); // 资产信息
|
|
this.RegisterProtocal(10315, this.on10315); // 查看角色信息
|
|
this.RegisterProtocal(10306, this.on10306); // 战力变更推送
|
|
|
|
this.RegisterProtocal(10318, this.on10318); // 允许切磋状态
|
|
this.RegisterProtocal(10325, this.on10325); // 头像列表信息
|
|
this.RegisterProtocal(10327, this.on10327); // 头像变更
|
|
this.RegisterProtocal(10345, this.on10345); // 形象信息
|
|
this.RegisterProtocal(10346, this.on10346); // 形象使用
|
|
this.RegisterProtocal(10347, this.on10347); // 形象激活
|
|
|
|
this.RegisterProtocal(10342, this.on10342); // 强制改名
|
|
this.RegisterProtocal(10343, this.on10343); // 角色改名
|
|
this.RegisterProtocal(10344, this.on10344); //升级推送
|
|
|
|
this.RegisterProtocal(10317, this.on10317); // 形象激活
|
|
this.RegisterProtocal(10319, this.on10319); //周冠軍賽被點贊次數
|
|
|
|
this.RegisterProtocal(10316, this.on10316); // 膜拜角色
|
|
// this.RegisterProtocal(12741, this.on12741); // 能用提示信息
|
|
this.RegisterProtocal(12745, this.on12745); // 道具不足通用协议
|
|
|
|
this.RegisterProtocal(10906, this.on10906); // 开服天数
|
|
|
|
this.RegisterProtocal(10994, this.on10994); // 服务端通知整点更新
|
|
this.RegisterProtocal(10945, this.on10945); // 媒体卡兑换
|
|
|
|
this.RegisterProtocal(21500, this.on21500); // 头像框获取
|
|
this.RegisterProtocal(21501, this.on21501); // 使用头像框
|
|
this.RegisterProtocal(21502, this.on21502); // 更新头像框
|
|
this.RegisterProtocal(21503, this.on21503); // 激活头像框
|
|
|
|
this.RegisterProtocal(23300, this.on23300); // 称号信息
|
|
this.RegisterProtocal(23301, this.on23301); // 使用称号
|
|
this.RegisterProtocal(23302, this.on23302); // 更新称号数据
|
|
this.RegisterProtocal(23303, this.on23303); // 激活称号
|
|
|
|
this.RegisterProtocal(24500, this.on24500); // 当前特权情况
|
|
|
|
this.RegisterProtocal(10350, this.handle10350); //-- 获取活动资产id
|
|
this.RegisterProtocal(10351, this.handle10351); //-- 推送活动资产id
|
|
|
|
//聊天框专项
|
|
this.RegisterProtocal(12700, this.handle12700); //聊天框列表
|
|
this.RegisterProtocal(12701, this.handle12701); //使用聊天框
|
|
this.RegisterProtocal(12702, this.handle12702); //更新聊天框列表
|
|
this.RegisterProtocal(12703, this.handle12703); //使用聊天框
|
|
// this.RegisterProtocal( 12704, this.handle12704 )
|
|
|
|
this.RegisterProtocal(12770, this.handle12770); // -- 发送举报协议
|
|
this.RegisterProtocal(12771, this.handle12771); //-- 获取举报协议信息
|
|
this.RegisterProtocal(12772, this.handle12772); //-- 有參數的提示語
|
|
|
|
this.RegisterProtocal(10905, this.handle10905); //-- 世界等级
|
|
this.RegisterProtocal(10962, this.handle10962); //-- 綁定獎勵
|
|
|
|
var self = this;
|
|
self.RegisterProtocal(25805, this.handle25805); // 設置徽章使用
|
|
self.RegisterProtocal(25806, this.handle25806); // 請求所有徽章
|
|
self.RegisterProtocal(25807, this.handle25807); // 激活徽章推送
|
|
|
|
self.RegisterProtocal(25815, this.handle25815); // 徽章分享
|
|
// self.RegisterProtocal(25816, this.handle25816) // 查看徽章分享
|
|
|
|
self.RegisterProtocal(25817, this.handle25817); // 歷練任務 成就分享
|
|
// self.RegisterProtocal(25818, this.handle25818) // 查看成就分享
|
|
|
|
self.RegisterProtocal(25819, this.handle25819); // 榮譽分享 榮譽等級
|
|
// self.RegisterProtocal(25820, this.handle25820) // 查看榮譽分享" 榮譽等級
|
|
|
|
//成长之路
|
|
// this.RegisterProtocal(25830, this.handle25830); //查看成长之路
|
|
// this.RegisterProtocal(25831, this.handle25831); //成长之路分享
|
|
// this.RegisterProtocal(25832, this.handle25832); //查看成长之路分享
|
|
|
|
// 桌面主题
|
|
this.RegisterProtocal(10335, this.on10335); // 拥有主题信息
|
|
this.RegisterProtocal(10336, this.on10336); // 更换主题
|
|
|
|
this.RegisterProtocal(10380, this.on10380); // 获取开服相关信息
|
|
},
|
|
|
|
reqBaseFromServer: function reqBaseFromServer(_cb) {
|
|
this.SendProtocal(10380, {}, _cb);
|
|
this.SendProtocal(10905, {});
|
|
},
|
|
setReconnect: function setReconnect(status) {
|
|
console.log("...........断线状态", status);
|
|
this.is_re_connect = status;
|
|
},
|
|
//判断别人srv_id是不是与自己是不是同服
|
|
isTheSameSvr: function isTheSameSvr(srv_id) {
|
|
var is_same = this.model.isTheSame(srv_id);
|
|
if (srv_id && is_same) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
},
|
|
// 角色基本信息
|
|
on10301: function on10301(_data) {
|
|
// cc.log( _data );
|
|
|
|
// 埋点更新
|
|
if (_data && nx.mTrace) {
|
|
nx.mTrace.setRole(_data.srv_id || "", _data.rid || 0);
|
|
}
|
|
|
|
// SDK
|
|
if (_data && FFSDK.getInstance().isEnableSDK()) {
|
|
FFSDK.getInstance().reportServerID(_data.srv_id);
|
|
FFSDK.getInstance().reportRoleID(_data.rid);
|
|
}
|
|
if (!this.init_role) {
|
|
this.init_role = true;
|
|
//先实例化
|
|
this.model.initRoleBaseData(_data);
|
|
// 这里会有很多信息需要请求
|
|
this.requestOpenSrvDay(); // 开服天数
|
|
// if(PLATFORM_TYPR == "SH_SDK"){
|
|
// SDK.roleUpLevel(this.getRoleVo().lev);
|
|
// }
|
|
|
|
// 资产预加载
|
|
// if (_data.lev <= 5) {
|
|
// game.addGuideRes();
|
|
// if (_data.sex == 2) {
|
|
// game.addRenameRes();
|
|
// }
|
|
// }
|
|
|
|
// 章节资产预加载
|
|
// game.addChapterRes(_data.chapter_id);
|
|
|
|
var sys_func_id = 1;
|
|
if (_data.lev < 10) {
|
|
window.hide_loading = true;
|
|
} else {
|
|
sys_func_id = 2;
|
|
}
|
|
gcore.GlobalEvent.fire(EventId.EVT_ROLE_CREATE_SUCCESS);
|
|
} else {
|
|
this.model.initRoleBaseData(_data);
|
|
var sfg = game.configs.source_data.data_source_data[FID.Equips];
|
|
var eqm = nx.bridge.checkConditions(sfg.lev_limit);
|
|
if (nx.dt.objEmpty(eqm)) {
|
|
HeroController.getInstance().getModel().dealReformEqm();
|
|
}
|
|
}
|
|
// 断线重连抛出事件
|
|
if (this.is_re_connect) {
|
|
gcore.GlobalEvent.fire(EventId.EVT_RE_LINK_GAME);
|
|
this.is_re_connect = false;
|
|
}
|
|
},
|
|
// 角色资产信息
|
|
on10302: function on10302(_data) {
|
|
this.model.initRoleAssetsData(_data);
|
|
},
|
|
//查看角色信息
|
|
requestRoleInfo: function requestRoleInfo(rid, srv_id, setting) {
|
|
if (rid == 0 || !srv_id) return;
|
|
var protocal = {};
|
|
protocal.rid = rid;
|
|
protocal.srv_id = srv_id;
|
|
this.setting_10315 = setting;
|
|
this.SendProtocal(10315, protocal);
|
|
},
|
|
//查看角色信息
|
|
on10315: function on10315(_data) {
|
|
var self = this;
|
|
if (self.setting_10315) {
|
|
var form_type = self.setting_10315.form_type;
|
|
if (!form_type) return;
|
|
var setting = {};
|
|
setting.role_type = RoleConst.role_type.eOther;
|
|
setting.other_data = _data;
|
|
if (form_type == RoleConst.Other_Form_Type.eHonorLevelTips) {
|
|
setting.index = RoleConst.Tab_type.eHonorWall;
|
|
}
|
|
// elseif form_type == RoleConst.Other_Form_Type.eGrowthWayShare then
|
|
// local share_id = self.setting_10315.share_id or 0
|
|
// setting.index = RoleConst.Tab_type.eGrowthWay
|
|
// setting.growth_way_share_id = share_id
|
|
// elseif form_type == RoleConst.Other_Form_Type.eMessageBoardInfo then
|
|
// setting.index = RoleConst.Tab_type.eMessageBoard
|
|
// setting.bbs_id = self.setting_10315.bbs_id
|
|
// end
|
|
self.openRolePersonalSpacePanel(true, setting);
|
|
} else {
|
|
gcore.GlobalEvent.fire(RoleEvent.DISPATCH_PLAYER_VO_EVENT, _data);
|
|
}
|
|
},
|
|
// 膜拜
|
|
sender10316: function sender10316(rid, srv_id, index, type) {
|
|
if (!rid) return;
|
|
index = index || 0;
|
|
type = type || 0;
|
|
var protocal = {};
|
|
protocal.type = type;
|
|
protocal.rid = rid;
|
|
protocal.srv_id = srv_id;
|
|
protocal.idx = index;
|
|
this.SendProtocal(10316, protocal);
|
|
},
|
|
on10316: function on10316(_data) {
|
|
nx.tbox(_data.msg);
|
|
if (_data.code == 1) {
|
|
gcore.GlobalEvent.fire(RoleEvent.WorshipOtherRole, _data);
|
|
}
|
|
},
|
|
// 更新切磋状态
|
|
send10318: function send10318(auto_pk) {
|
|
this.SendProtocal(10318, {
|
|
auto_pk: auto_pk
|
|
});
|
|
},
|
|
// 更新切磋状态结果
|
|
on10318: function on10318(_data) {
|
|
nx.tbox(_data.msg);
|
|
if (_data.code == 1) {
|
|
this.model.setRoleAttribute("auto_pk", _data.auto_pk);
|
|
}
|
|
},
|
|
// 请求头像列表信息
|
|
send10325: function send10325(_cb) {
|
|
this.SendProtocal(10325, {}, _cb);
|
|
},
|
|
on10325: function on10325(_data) {
|
|
// 失败判定
|
|
if (!this.isGoodData(_data)) {
|
|
return;
|
|
}
|
|
this.model.setRoleAttribute("face_list", _data.face_list);
|
|
},
|
|
// 头像变更
|
|
send10327: function send10327(face_id, _cb) {
|
|
this.SendProtocal(10327, {
|
|
face_id: face_id
|
|
}, _cb);
|
|
},
|
|
on10327: function on10327(_data) {
|
|
// 失败判定
|
|
if (!this.isGoodData(_data)) {
|
|
return;
|
|
}
|
|
this.model.setRoleAttribute("face_id", _data.face_id);
|
|
},
|
|
// 通用提示信息
|
|
on12741: function on12741(_data) {
|
|
// nx.tbox(_data.msg);
|
|
},
|
|
// 道具不足通用提示
|
|
on12745: function on12745(_data) {
|
|
var item_config = Utils.getItemConfig(_data.bid);
|
|
if (!item_config) {
|
|
return;
|
|
}
|
|
if (_data.bid == game.configs.item_data.data_assets_label2id.gold || _data.bid == game.configs.item_data.data_assets_label2id.hero_exp) {
|
|
// if( IS_SHOW_CHARGE == false ) {
|
|
// nx.tbox( "lab_role_controller_tip_1" );
|
|
// } else {
|
|
// var fun = function() {
|
|
// require( "vip_controller" ).getInstance().openVipMainWindow( true, VIPTABCONST.CHARGE );
|
|
// }.bind( this );
|
|
// var str = cc.js.formatStr( nx.text.getKey( 'lab_role_controller_tip_2' ), item_config.name );
|
|
//
|
|
// }
|
|
} else if (_data.bid == game.configs.item_data.data_assets_label2id.energy) {
|
|
nx.tbox("lab_role_controller_tip_3");
|
|
} else {
|
|
var config = Utils.getItemConfig(_data.bid);
|
|
if (config) {
|
|
var BackpackController = require("backpack_controller");
|
|
var ifg = gdata("item_data", "data_unit1", config.id);
|
|
if (ifg) {
|
|
nx.tbox(nx.text.format(nx.text.getKey("lab_hero_break_window_tip1"), ifg.name));
|
|
}
|
|
// BackpackController.getInstance().openTipsSource( true, config.id );
|
|
}
|
|
}
|
|
},
|
|
|
|
on10994: function on10994(_data) {
|
|
if (_data.type == 6 || _data.type == 18) {} else if (_data.type == 0) {
|
|
this.requestOpenSrvDay();
|
|
require("startower.mod").getInstance().reqTowerInitData();
|
|
}
|
|
},
|
|
// 改名
|
|
changeRoleName: function changeRoleName(name, sex, _cb) {
|
|
this.SendProtocal(10343, {
|
|
name: name,
|
|
sex: sex
|
|
}, _cb);
|
|
},
|
|
// 改名结果
|
|
on10343: function on10343(_data) {
|
|
if (_data.code != 1) {
|
|
return;
|
|
}
|
|
this.model.setRoleAttribute("name", _data.name);
|
|
this.model.setRoleAttribute("sex", _data.sex);
|
|
this.model.setRoleAttribute("is_first_rename", _data.is_first_rename);
|
|
|
|
// SDK
|
|
if (FFSDK.getInstance().isEnableSDK() && nx.dt.strNEmpty(_data.name)) {
|
|
FFSDK.getInstance().reportRoleName(_data.name);
|
|
}
|
|
},
|
|
// 升级推送
|
|
on10344: function on10344(_data) {
|
|
nx.bridge.createPanel("PopupLevelUp", _data);
|
|
|
|
// SDK
|
|
if (FFSDK.getInstance().isEnableSDK() && nx.dt.numPositive(_data.lev, false)) {
|
|
FFSDK.getInstance().reportRoleLevel(_data.lev);
|
|
}
|
|
},
|
|
on10380: function on10380(_data) {
|
|
this.openServer = _data;
|
|
},
|
|
// 媒体卡领取
|
|
sender10945: function sender10945(card_id) {
|
|
this.SendProtocal(10945, {
|
|
card_id: card_id
|
|
});
|
|
},
|
|
on10945: function on10945(_data) {
|
|
nx.tbox(_data.msg);
|
|
},
|
|
// 头像框获取
|
|
send21500: function send21500(_cb) {
|
|
this.SendProtocal(21500, {}, _cb);
|
|
},
|
|
on21500: function on21500(_data) {
|
|
// 失败判定
|
|
if (!this.isGoodData(_data)) {
|
|
return;
|
|
}
|
|
gcore.GlobalEvent.fire(RoleEvent.GetFaceList, _data);
|
|
},
|
|
// 使用头像框
|
|
send21501: function send21501(base_id, _cb) {
|
|
this.SendProtocal(21501, {
|
|
base_id: base_id
|
|
}, _cb);
|
|
},
|
|
on21501: function on21501(_data) {
|
|
// 失败判定
|
|
if (!this.isGoodData(_data)) {
|
|
return;
|
|
}
|
|
},
|
|
// 更新头像框
|
|
on21502: function on21502(_data) {
|
|
gcore.GlobalEvent.fire(RoleEvent.GetFaceList, _data);
|
|
},
|
|
// 激活头像框
|
|
send21503: function send21503(base_id, _cb) {
|
|
this.SendProtocal(21503, {
|
|
base_id: base_id
|
|
}, _cb);
|
|
},
|
|
on21503: function on21503(_data) {
|
|
// 失败判定
|
|
if (!this.isGoodData(_data)) {
|
|
return;
|
|
}
|
|
gcore.GlobalEvent.fire(RoleEvent.GetFaceList, _data);
|
|
},
|
|
// 称号列表信息
|
|
send23300: function send23300(_cb) {
|
|
this.SendProtocal(23300, {}, _cb);
|
|
},
|
|
on23300: function on23300(_data) {
|
|
this.model.setRoleAttribute("title_id", _data.base_id);
|
|
this.model.setRoleAttribute("title_list", _data.honor);
|
|
gcore.GlobalEvent.fire(RoleEvent.GetTitleList, _data);
|
|
},
|
|
// 使用称号
|
|
send23301: function send23301(base_id, _cb) {
|
|
this.SendProtocal(23301, {
|
|
base_id: base_id
|
|
}, _cb);
|
|
},
|
|
on23301: function on23301(_data) {
|
|
this.model.setRoleAttribute("title_id", _data.base_id);
|
|
gcore.GlobalEvent.fire(RoleEvent.UseTitle, _data.base_id);
|
|
},
|
|
// 更新称号
|
|
on23302: function on23302(_data) {
|
|
this.model.setRoleAttribute("title_list", _data.honor);
|
|
gcore.GlobalEvent.fire(RoleEvent.UpdateTitleList, _data);
|
|
},
|
|
// 激活称号
|
|
send23303: function send23303(base_id, _cb) {
|
|
this.SendProtocal(23303, {
|
|
base_id: base_id
|
|
}, _cb);
|
|
},
|
|
on23303: function on23303(_data) {
|
|
this.model.setRoleAttribute("title_list", _data.honor);
|
|
gcore.GlobalEvent.fire(RoleEvent.UpdateTitleList, _data);
|
|
},
|
|
// -- 取名界面是否正在顯示
|
|
checkRoleSetNameViewIsOpen: function checkRoleSetNameViewIsOpen() {
|
|
if (this.role_setname_new) {
|
|
return true;
|
|
}
|
|
return false;
|
|
},
|
|
// 打开更改装饰界面
|
|
openRoleDecorateView: function openRoleDecorateView(status, index, setting) {
|
|
if (status) {
|
|
if (!this.role_decorate_view) {
|
|
var RoleDecorateWindow = require("role_decorate_window");
|
|
this.role_decorate_view = new RoleDecorateWindow();
|
|
}
|
|
this.role_decorate_view.open(index, setting);
|
|
} else {
|
|
if (this.role_decorate_view) {
|
|
this.role_decorate_view.close();
|
|
this.role_decorate_view = null;
|
|
}
|
|
}
|
|
},
|
|
//判断一个人是否是自己
|
|
checkIsSelf: function checkIsSelf(srv_id, rid) {
|
|
var role_vo = this.getRoleVo();
|
|
if (role_vo == null) return false;else return role_vo.srv_id == srv_id && role_vo.rid == rid;
|
|
},
|
|
// 当前特权情况
|
|
on24500: function on24500(_data) {
|
|
this.model.setPrivilegeData(_data.list);
|
|
},
|
|
// 请求开服天数
|
|
requestOpenSrvDay: function requestOpenSrvDay() {
|
|
this.SendProtocal(10906, {});
|
|
},
|
|
// 开服天数返回
|
|
on10906: function on10906(_data) {
|
|
this.model.setOpenSrvDay(_data.open_day);
|
|
},
|
|
// 强制改名
|
|
on10342: function on10342() {
|
|
console.log("开始注册姓名");
|
|
this.need_set_name = true;
|
|
},
|
|
// 点赞数量
|
|
on10317: function on10317() {},
|
|
requestCrossChamWorshipNum: function requestCrossChamWorshipNum() {
|
|
this.SendProtocal(10319, {});
|
|
},
|
|
on10319: function on10319(_data) {
|
|
var role_vo = this.model.getRoleVo();
|
|
if (role_vo != null) {
|
|
role_vo.cross_cham_worship = _data.worship;
|
|
gcore.GlobalEvent.fire(RoleEvent.UpdateCrossChamWorshipEvent, _data.worship);
|
|
}
|
|
},
|
|
getRandomName: function getRandomName(sex) {
|
|
sex = sex || 1;
|
|
var randomName = "";
|
|
for (var i in game.configs.random_name_data.data_list) {
|
|
var config = game.configs.random_name_data.data_list[i] || {};
|
|
// -- 取出所有符合性别要求的名称
|
|
var temp_data = [];
|
|
for (var k = 0; k < config.length; ++k) {
|
|
var v = config[k];
|
|
if (v && (v.sex == sex || v.sex == 0)) {
|
|
temp_data.push(v);
|
|
}
|
|
}
|
|
var random_data = temp_data[~~(Math.random() * temp_data.length)] || [];
|
|
randomName = randomName + (random_data.name || "");
|
|
}
|
|
return randomName;
|
|
},
|
|
// --[[活动资产推送]] --登陆的时候推送
|
|
handle10350: function handle10350(_data) {
|
|
this.model.initRoleActionAssetsData(_data.holiday_assets, false);
|
|
},
|
|
handle10351: function handle10351(_data) {
|
|
this.model.initRoleActionAssetsData(_data.holiday_assets, true);
|
|
},
|
|
// --打开举报界面
|
|
openRoleReportedPanel: function openRoleReportedPanel(status, rid, srv_id, play_name) {
|
|
var self = this;
|
|
if (status == true) {
|
|
if (self.role_reported_panel == null) {
|
|
var RoleReportedWindow = require("role_reported_window");
|
|
self.role_reported_panel = new RoleReportedWindow();
|
|
}
|
|
self.role_reported_panel.open({
|
|
rid: rid,
|
|
srv_id: srv_id,
|
|
play_name: play_name
|
|
});
|
|
} else {
|
|
if (self.role_reported_panel != null) {
|
|
self.role_reported_panel.close();
|
|
self.role_reported_panel = null;
|
|
}
|
|
}
|
|
},
|
|
//----------------------------------聊天框
|
|
// -- [[ 聊天框列表 ]]
|
|
sender12700: function sender12700(_cb) {
|
|
this.SendProtocal(12700, {}, _cb);
|
|
},
|
|
// -- [[ 聊天框列表 ]]
|
|
handle12700: function handle12700(_data) {
|
|
gcore.GlobalEvent.fire(RoleEvent.GetBubbleList, _data);
|
|
},
|
|
// -- [[ 使用聊天框 ]]
|
|
sender12701: function sender12701(base_id, _cb) {
|
|
var protocal = {};
|
|
protocal.base_id = base_id;
|
|
this.SendProtocal(12701, protocal, _cb);
|
|
},
|
|
// -- [[ 使用聊天框 ]]
|
|
handle12701: function handle12701(_data) {
|
|
var role = this.getRoleVo();
|
|
if (role && _data && _data.base_id > 0) {
|
|
role.setBubble(_data.base_id);
|
|
}
|
|
gcore.GlobalEvent.fire(RoleEvent.UseBubbleItem, _data);
|
|
},
|
|
// -- [[ 更新聊天框列表 ]]
|
|
handle12702: function handle12702(_data) {
|
|
gcore.GlobalEvent.fire(RoleEvent.GetBubbleList, _data);
|
|
},
|
|
// -- [[ 激活聊天框 ]]
|
|
sender12703: function sender12703(base_id, _cb) {
|
|
var protocal = {};
|
|
protocal.base_id = base_id;
|
|
this.SendProtocal(12703, protocal, _cb);
|
|
},
|
|
// -- [[ 激活聊天框 ]]
|
|
handle12703: function handle12703(_data) {
|
|
gcore.GlobalEvent.fire(RoleEvent.GetBubbleList, _data);
|
|
},
|
|
// -----------------------------------------------举报功能协议和打开方法-------------------------
|
|
send12770: function send12770(rid, srv_id, _type, msg, history, _cb) {
|
|
var protocal = {};
|
|
protocal.rid = rid;
|
|
protocal.srv_id = srv_id;
|
|
protocal.type = _type || 1;
|
|
protocal.msg = msg || "";
|
|
protocal.history = history || [];
|
|
this.SendProtocal(12770, protocal, _cb);
|
|
},
|
|
send12771: function send12771(rid, srv_id) {
|
|
var protocal = {};
|
|
protocal.rid = rid;
|
|
protocal.srv_id = srv_id;
|
|
this.SendProtocal(12771, protocal);
|
|
},
|
|
handle12770: function handle12770(_data) {
|
|
nx.tbox(_data.msg);
|
|
},
|
|
handle12771: function handle12771(_data) {
|
|
gcore.GlobalEvent.fire(RoleEvent.ROLE_REPORTED_EVENT, _data);
|
|
},
|
|
handle12772: function handle12772(_data) {
|
|
if (_data) {
|
|
var time = _data.end_time - client.socket.getTime();
|
|
nx.tbox(cc.js.formatStr(_data.msg, TimeTool.getTimeFormatDayIIIIII(time)));
|
|
}
|
|
}
|
|
}, _cc$Class["checkRoleSetNameViewIsOpen"] = function checkRoleSetNameViewIsOpen() {
|
|
if (this.role_setname_new) return true;
|
|
return false;
|
|
}, _cc$Class.on10306 = function on10306(_data) {
|
|
var role = this.getRoleVo();
|
|
if (!role) {
|
|
return;
|
|
}
|
|
var from = role.power;
|
|
if (nx.dt.numPositive(_data.power, false)) {
|
|
var add = _data.power - from;
|
|
nx.bridge.vset("BPChanged", [add, from]);
|
|
}
|
|
role.setPower(_data.power);
|
|
role.setMaxPower(_data.max_power);
|
|
}, _cc$Class.getApkData = function getApkData() {
|
|
if (this.apk_data) {
|
|
return this.apk_data;
|
|
}
|
|
}, _cc$Class.handle10905 = function handle10905(_data) {
|
|
this.model.setWorldLev(_data.world_lev);
|
|
}, _cc$Class.reqGetBindReward = function reqGetBindReward(_account, _cb) {
|
|
var info = {};
|
|
if (nx.dt.strNEmpty(_account)) {
|
|
info = {
|
|
account: _account
|
|
};
|
|
} else {
|
|
info = {};
|
|
}
|
|
// info = ? info.account = _account : info;
|
|
this.SendProtocal(10962, info, _cb);
|
|
}, _cc$Class.handle10962 = function handle10962(_data) {}, _cc$Class.send25805 = function send25805(pos, id) {
|
|
var protocal = {};
|
|
protocal.pos = pos;
|
|
protocal.id = id;
|
|
this.SendProtocal(25805, protocal);
|
|
}, _cc$Class.handle25805 = function handle25805(_data) {
|
|
gcore.GlobalEvent.fire(RoleEvent.ROLE_UPDATE_HONOR_WALL_EVENT, _data);
|
|
}, _cc$Class.send25806 = function send25806(rid, srv_id) {
|
|
var protocal = {};
|
|
protocal.rid = rid;
|
|
protocal.srv_id = srv_id;
|
|
this.SendProtocal(25806, protocal);
|
|
}, _cc$Class.handle25806 = function handle25806(_data) {
|
|
gcore.GlobalEvent.fire(RoleEvent.ROLE_GET_HONOR_WALL_EVENT, _data);
|
|
}, _cc$Class.handle25807 = function handle25807(_data) {
|
|
if (_data && _data.id) {
|
|
this.openRoleHonorUnlockPanel(true, _data);
|
|
}
|
|
}, _cc$Class.send25815 = function send25815(id, channel) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
protocal.channel = channel;
|
|
this.SendProtocal(25815, protocal);
|
|
}, _cc$Class.handle25815 = function handle25815(_data) {
|
|
nx.tbox(_data.msg);
|
|
}, _cc$Class.send25817 = function send25817(id, channel) {
|
|
var protocal = {};
|
|
protocal.id = id;
|
|
protocal.channel = channel;
|
|
this.SendProtocal(25817, protocal);
|
|
}, _cc$Class.handle25817 = function handle25817(_data) {
|
|
nx.tbox(_data.msg);
|
|
}, _cc$Class.send25819 = function send25819(channel) {
|
|
var protocal = {};
|
|
protocal.channel = channel;
|
|
this.SendProtocal(25819, protocal);
|
|
}, _cc$Class.handle25819 = function handle25819(_data) {
|
|
nx.tbox(_data.msg);
|
|
}, _cc$Class.send25830 = function send25830(start, num) {
|
|
var protocal = {};
|
|
protocal.start = start;
|
|
protocal.num = num;
|
|
this.SendProtocal(25830, protocal);
|
|
}, _cc$Class.handle25830 = function handle25830(_data) {
|
|
cc.log("25830", _data);
|
|
//num等于1是计算红点用途
|
|
if (_data.num == 1) {
|
|
// _data.is_redpoint = this.model.checkGrowthWayRedPoint(_data);
|
|
}
|
|
// this.model.setGrowthWayData(_data);
|
|
}, _cc$Class.send25831 = function send25831(channel) {
|
|
var protocal = {};
|
|
protocal.channel = channel;
|
|
this.SendProtocal(25831, protocal);
|
|
}, _cc$Class.handle25831 = function handle25831(_data) {
|
|
cc.log("25831", _data);
|
|
}, _cc$Class.send25832 = function send25832(rid, srv_id, start, num) {
|
|
var protocal = {};
|
|
protocal.rid = rid;
|
|
protocal.srv_id = srv_id;
|
|
protocal.start = start;
|
|
protocal.num = num;
|
|
this.SendProtocal(25832, protocal);
|
|
}, _cc$Class.handle25832 = function handle25832(_data) {
|
|
cc.log("25832", _data);
|
|
}, _cc$Class.openRolePersonalSpacePanel = function openRolePersonalSpacePanel(status, params) {
|
|
var setting = params || {};
|
|
var role_type = setting.role_type || RoleConst.role_type.eMySelf;
|
|
if (role_type == RoleConst.role_type.eOther) {
|
|
//由於會出現嵌套打開同一個ui界面..這裡相當於初始化兩個
|
|
this.openOtherRolePersonalSpacePanel(status, setting);
|
|
} else {
|
|
if (status) {
|
|
if (this.role_personal_space_panel) {
|
|
this.role_personal_space_panel.close();
|
|
this.role_personal_space_panel = null;
|
|
}
|
|
if (this.role_personal_space_panel == null) {
|
|
var RolePersonalSpacePanel = require("role_personal_space_panel");
|
|
this.role_personal_space_panel = new RolePersonalSpacePanel();
|
|
}
|
|
this.role_personal_space_panel.open(setting);
|
|
} else {
|
|
if (this.role_personal_space_panel != null) {
|
|
this.role_personal_space_panel.close();
|
|
this.role_personal_space_panel = null;
|
|
}
|
|
}
|
|
}
|
|
}, _cc$Class.openOtherRolePersonalSpacePanel = function openOtherRolePersonalSpacePanel(status, setting) {
|
|
var self = this;
|
|
if (status) {
|
|
if (self.role_other_personal_space_panel != null) {
|
|
self.role_other_personal_space_panel.close();
|
|
self.role_other_personal_space_panel = null;
|
|
}
|
|
if (self.role_other_personal_space_panel == null) {
|
|
var RolePersonalSpacePanel = require("role_personal_space_panel");
|
|
self.role_other_personal_space_panel = new RolePersonalSpacePanel();
|
|
}
|
|
self.role_other_personal_space_panel.open(setting);
|
|
} else {
|
|
if (self.role_other_personal_space_panel != null) {
|
|
self.role_other_personal_space_panel.close();
|
|
self.role_other_personal_space_panel = null;
|
|
}
|
|
}
|
|
}, _cc$Class.openRoleHeroShowFormPanel = function openRoleHeroShowFormPanel(status, setting) {
|
|
if (status) {
|
|
if (this.role_hero_show_form_panel == null) {
|
|
var RoleHeroShowFormPanel = require("role_hero_show_form_panel");
|
|
this.role_hero_show_form_panel = new RoleHeroShowFormPanel();
|
|
}
|
|
this.role_hero_show_form_panel.open(setting);
|
|
} else {
|
|
if (this.role_hero_show_form_panel != null) {
|
|
this.role_hero_show_form_panel.close();
|
|
this.role_hero_show_form_panel = null;
|
|
}
|
|
}
|
|
}, _cc$Class.openCommonExchangeAlertPanel = function openCommonExchangeAlertPanel(status) {
|
|
if (status) {
|
|
if (this.common_exchange_alert == null) {
|
|
var CommonExchangeAlert = require("common_exchange_alert");
|
|
this.common_exchange_alert = new CommonExchangeAlert();
|
|
}
|
|
this.common_exchange_alert.open();
|
|
} else {
|
|
if (this.common_exchange_alert != null) {
|
|
this.common_exchange_alert.close();
|
|
this.common_exchange_alert = null;
|
|
}
|
|
}
|
|
}, _cc$Class.isfirstRole = function isfirstRole() {
|
|
var role_vo = this.getRoleVo();
|
|
if (role_vo && role_vo.sex == 2) return true;
|
|
return false;
|
|
}, _cc$Class.fetchFigureData = function fetchFigureData(_cb) {
|
|
this.SendProtocal(10345, {}, _cb);
|
|
}, _cc$Class.on10345 = function on10345(_data) {
|
|
// TODO...
|
|
}, _cc$Class.reqUseFigure = function reqUseFigure(id, _cb) {
|
|
this.SendProtocal(10346, {
|
|
id: id
|
|
}, _cb);
|
|
}, _cc$Class.on10346 = function on10346(_data) {
|
|
// TODO...
|
|
gcore.GlobalEvent.fire(RoleEvent.UpdateModel, _data);
|
|
}, _cc$Class.send10347 = function send10347(id) {
|
|
this.SendProtocal(10347, {
|
|
id: id
|
|
});
|
|
}, _cc$Class.on10347 = function on10347(_data) {
|
|
// TODO...
|
|
}, _cc$Class.reqThemeData = function reqThemeData(_cb) {
|
|
this.SendProtocal(10335, {}, _cb);
|
|
}, _cc$Class.on10335 = function on10335(_data) {}, _cc$Class.reqSwapTheme = function reqSwapTheme(_id, _cb) {
|
|
this.SendProtocal(10336, {
|
|
id: _id
|
|
}, _cb);
|
|
}, _cc$Class.on10336 = function on10336(_data) {}, _cc$Class.dealOpenServer = function dealOpenServer() {
|
|
var cfg = game.configs.activity_advertisement_data.data_const;
|
|
var reg_time = this.openServer.reg_time + cfg.partner_time.val;
|
|
var left = reg_time - Math.floor(cc.sys.now() / 1000) > 0;
|
|
var openday = this.getRoleVo().open_day;
|
|
var canshow = 0;
|
|
var acts = nx.bridge.acts;
|
|
if (acts) {
|
|
if (acts.queryThemeBySource(FID.ActAppoint8)) {
|
|
canshow++;
|
|
}
|
|
if (acts.queryThemeBySource(FID.ActTrain7)) {
|
|
canshow++;
|
|
}
|
|
if (acts.queryThemeBySource(FID.ActGrowthRush)) {
|
|
canshow++;
|
|
}
|
|
if (acts.queryThemeBySource(FID.ActsHundreds)) {
|
|
canshow++;
|
|
}
|
|
if (acts.queryThemeBySource(FID.ActOptional)) {
|
|
canshow++;
|
|
}
|
|
}
|
|
var getlist = nx.bridge.vget("SpecialPass");
|
|
var count = 0;
|
|
var dfg = game.configs.dungeon_data.data_drama_reward;
|
|
for (var r in dfg) {
|
|
var item = dfg[r];
|
|
var ginfo = getlist[item.id];
|
|
if (!ginfo) {
|
|
count++;
|
|
}
|
|
}
|
|
return left || canshow > 0 || count != 0;
|
|
}, _cc$Class));
|
|
module.exports = RoleController;
|
|
|
|
cc._RF.pop(); |