// -------------------------------------------------------------------- // @author: xxx@syg.com(必填, 创建模块的人员) // @description: // 这里填写详细说明,主要填写该模块的功能简要 //
Create: 2019-07-29 10:38:42 // -------------------------------------------------------------------- const BridgeClass = require( "bridge.class" ); var ArenaEvent = require("arena_event"); var ArenaConst = require("arena_const"); var RoleController = require("role_controller") var CrosschampionConst = require("crosschampion_const") var CrosschampionEvent = require("crosschampion_event") var CrosschampionModel = cc.Class({ extends: BridgeClass, ctor: function () { this.ctrl = arguments[0]; }, properties: { }, initConfig: function () { this.champion_red_list = {} // 紅點數據 }, // 跨服冠軍賽基礎數據 updateChampionBaseInfo( data ){ let self = this; self.base_info = data gcore.GlobalEvent.fire(ArenaEvent.UpdateChampionBaseInfoEvent, data) }, getBaseInfo(){ return this.base_info }, //跨服冠軍賽個人數據 setRoleInfo(data){ this.role_info = data gcore.GlobalEvent.fire(ArenaEvent.UpdateChampionRoleInfoEvent, data) }, getRoleInfo(){ return this.role_info; }, // 我的跨服冠軍賽狀態 getMyMatchStatus(){ let self =this; if (self.base_info && self.role_info) { if (self.base_info.step == ArenaConst.champion_step.unopened) { return ArenaConst.champion_my_status.unopened }else if (self.base_info.step == ArenaConst.champion_step.score && self.base_info.step_status == ArenaConst.champion_step_status.unopened) { return ArenaConst.champion_my_status.unopened }else if (self.role_info.rank == 0) { return ArenaConst.champion_my_status.unjoin }else{ return ArenaConst.champion_my_status.in_match } } return ArenaConst.champion_my_status.unopened }, // 當前周冠軍賽是否是未開啟狀態 getOpenCrosschampionViewStatus(){ let self = this; if( self.base_info && (self.base_info.step != ArenaConst.champion_step.match_8 || self.base_info.step_status != ArenaConst.champion_step_status.over)) { return true } return false }, // 獲取跨服冠軍賽功能是否開啟 checkCrossChampionIsOpen( nottips ){ let is_open = false let role_vo = RoleController.getInstance().getRoleVo() let limit_cfg = game.configs.arena_cluster_champion_data.data_const["guess_lev_limit"] if (limit_cfg && role_vo && role_vo.lev >= limit_cfg.val) { is_open = true } if (is_open == false && limit_cfg && !nottips) { // nx.mbox(limit_cfg.desc,["cancel","confirm"]); } return is_open; }, // 前三名角色數據 setTopThreeRoleData( data ){ this.top_three_role_data = data || {} this.checkTopThreeWorshipRedStatus() }, saveTopThreeRoleData( _data ){ this.top_three_role_datas = _data || {}; }, getThreeDatas : function( ){ return this.top_three_role_datas; }, updateTopThreeRoleWorshipStatus( rid, srv_id ){ if (this.top_three_role_data) { for(let k in this.top_three_role_data) { let v = this.top_three_role_data[k]; if (v.rid == rid && v.srv_id == srv_id) { v.worship_status = 1 break; } } } this.checkTopThreeWorshipRedStatus() }, checkTopThreeWorshipRedStatus(){ let self = this; let red_status = false if (self.top_three_role_data) { let role_vo = RoleController.getInstance().getRoleVo() for (let k in self.top_three_role_data) { let v = this.top_three_role_data[k]; if (v.worship_status == 0 && role_vo && !role_vo.isSameRole(v.srv_id, v.rid)) { red_status = true break } } } self.updateCrosschampionRedStatus(CrosschampionConst.Red_Type.Worship, red_status) }, // 紅點相關 updateCrosschampionRedStatus( bid, status ){ let self = this; let _status = self.champion_red_list[bid]; if( _status == status )return; self.champion_red_list[bid] = status let red_status = self.checkCrosschampionRedStatus() gcore.GlobalEvent.fire(CrosschampionEvent.Update_Red_Status_Event, bid, status) }, checkCrosschampionRedStatus(){ let status = false for(let k in this.champion_red_list) { let v = this.champion_red_list[k]; if (v) { status = true break } } return status }, // 根據紅點類型獲取紅點狀態 getCrossarenaRedStatus( red_type ){ return this.champion_red_list[red_type] || false; }, });