源战役客户端
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 

338 righe
13 KiB

--单人副本进入界面
ArenaView = ArenaView or BaseClass(BaseView)
local ArenaView = ArenaView
-----------------------扩展模块需要修改的地方--------------------------
ArenaView.Tab_list = {
[1] = {id = ArenaConst.TabId.PKRANK, name = "竞技联赛", light_res = "icon_jn1_1", dark_res = "icon_jn1_2", view = "PkRankSubView", bg = "pkrank_bg"},
[2] = {id = ArenaConst.TabId.ENDLESS, name = "无尽领域", light_res = "icon_jn1_1", dark_res = "icon_jn1_2", view = "EndlessSubView", bg = "endless_sub_bg"},
-- [3] = {id = ArenaConst.TabId.CSGWAR, name = "国战", light_res = "icon_jn1_1", dark_res = "icon_jn1_2", view = "CSGWarSubView", bg = "window_bg_5"},
[3] = {id = ArenaConst.TabId.WASTELAND, name = "饥饿游戏", light_res = "icon_jn1_1", dark_res = "icon_jn1_2", view = "WastelandSubView", bg = "wasteland_bg"},
[4] = {id = ArenaConst.TabId.RAGEWAR, name = "狂战领域", light_res = "icon_jn1_1", dark_res = "icon_jn1_2", view = "RageWarSubView", bg = "arena_ragewar_bg"},
[5] = {id = ArenaConst.TabId.CLOTHINGVOTE, name = "明日之星", light_res = "icon_jn1_1", dark_res = "icon_jn1_2", view = "ClothingVoteApplyView", bg = "clothing_vote_bg_1"},
}
ArenaView.clothing_vot_tab_list = {
[1] = {id = ArenaConst.TabId.CLOTHINGVOTE, name = "明日之星", light_res = "icon_jn1_1", dark_res = "icon_jn1_2", view = "ClothingVoteApplyView", bg = "clothing_vote_bg_1"},
[2] = {id = ArenaConst.TabId.CLOTHINGVOTE, name = "明日之星", light_res = "icon_jn1_1", dark_res = "icon_jn1_2", view = "ClothingVoteVotingView", bg = "clothing_vote_bg_3"},
}
-- ArenaView.Index2View = {
-- [1] = {id = 1,view = "PkRankSubView"},
-- [2] = {id = 3,view = "EndlessSubView"},
-- [3] = {id = 5,view = "PkBattleEnterView"},
-- [4] = {id = 4,view = "LeagueWarEnterView"},
-- [5] = {id = 6,view = "CSPvPMainView"},
-- [6] = {id = 7,view = "DiamondFightEnterView"},
-- [7] = {id = 8,view = "CSOnevNEnterView"},
-- [8] = {id = 9,view = "SpiritWarEnterView"},
-- }
-- ArenaView.Index2Name = {
-- [1] = {id = 1,name = "竞技场",light_res = "icon_jjc1_1",dark_res = "icon_jjc1_2"},
-- [2] = {id = 3,name = "巅峰竞技",light_res = "icon_dld1_1",dark_res = "icon_dld1_2"},
-- [3] = {id = 5,name = "丛林突围",light_res = "icon_dld_h",dark_res = "icon_dld_p"},
-- [4] = {id = 4,name = "三英会战",light_res = "icon_sx1_1",dark_res = "icon_sx1_2"},
-- [5] = {id = 6,name = "跨服3V3",light_res = "icon_dld1_1",dark_res = "icon_dld1_2"},
-- [6] = {id = 7,name = "彩钻大战",light_res = "icon_zs1_1",dark_res = "icon_zs1_2"},
-- [7] = {id = 8,name = "跨服1vN",light_res = "icon_dld1_1",dark_res = "icon_dld1_2"},
-- [8] = {id = 9,name = "星灵争霸",light_res = "icon_dld1_1",dark_res = "icon_dld1_2"},
-- }
function ArenaView:InitEvent()
local function onRefreshTabDot()
self:ShowTabRedPointState()
end
-- self:BindEvent(PkRankModel:getInstance(), PkRankModel.UPDATE_TAB_DOT, onRefreshTabDot)
self:BindEvent(self.model, ArenaConst.ANS_ARENA_UPDATE_RED_DOT, onRefreshTabDot)
--41600 明日之星切换阶段
local function on_update_clothing_view()
--重新初始化一下,更新tab信息,并重新打开明日之星界面
self:InitTabList()
--先把明日之星界面给清掉
if self.contaner_list[ArenaConst.TabId.CLOTHINGVOTE] then
self.contaner_list[ArenaConst.TabId.CLOTHINGVOTE]:DeleteMe()
self.contaner_list[ArenaConst.TabId.CLOTHINGVOTE] = nil
end
--如果是当前在这个明日之星界面,重新open一下
if self.select_index == ArenaConst.TabId.CLOTHINGVOTE then
if ClothingVoteModel:getInstance().vote_stage == 0 then--活动状态变成0,不能打开界面
self:Open(ArenaConst.TabId.PKRANK)
else
self:Open(ArenaConst.TabId.CLOTHINGVOTE)
end
end
end
self:BindEvent(ClothingVoteModel, ClothingVoteConst.INTO_CLOTHING_VOTE_NEXT_STAGE, on_update_clothing_view)
self:BindEvent(ClothingVoteModel, ClothingVoteConst.UPDATE_CLOTHING_VOTE_SUB_VIEW, on_update_clothing_view)
end
function ArenaView:Remove()
if self.refresh_red_point_id then
self.model:UnBind(self.refresh_red_point_id)
self.refresh_red_point_id = nil
end
for i, view in pairs(self.contaner_list) do
view:DeleteMe()
end
if self.tabWindowComponent then
self.tabWindowComponent:DeleteMe()
self.tabWindowComponent = nil
end
self.contaner_list = nil
end
----------------------------------------------------------------
function ArenaView:__init()
self.base_file = "arena"
self.layout_file = "ArenaView"
self.layer_name = "UI"
self.append_to_ctl_queue = true
self.use_background = true
self.hide_maincancas = true
self.change_scene_close = true
self.show_tabs = {}
self.tab_name_list = {}
self.contaner_list = {}
self.close_fog = true
--self.click_bg_toClose = true
-- self.blur_activity_bg = true
-- self.use_show_anim = true
-- self.use_hide_anim = true
self.model = ArenaModel:getInstance()
self:InitTabList()
self.load_callback = function ()
self:LoadSuccess()
self:InitEvent()
end
self.open_callback = function ()
self:SeletedTabbar(self.select_index, true)
end
self.close_callback = function ()
self:Remove()
end
end
function ArenaView:InitTabList( )
self.show_tabs = {}
self.tab_name_list = {}
local open_day = ServerTimeModel:getInstance():GetOpenServerDay()
local playerLv = RoleManager:getInstance():GetMainRoleVo().level
for i,v in ipairs(ArenaView.Tab_list) do
--判断明日之星应该用哪个界面
if i == ArenaConst.TabId.CLOTHINGVOTE then
local clothing_vote_stage = ClothingVoteModel:getInstance():GetClothingVoteStage()
if clothing_vote_stage <= 1 then
v = ArenaView.clothing_vot_tab_list[1]
else
v = ArenaView.clothing_vot_tab_list[2]
end
end
if i == ArenaConst.TabId.CLOTHINGVOTE then
if ClothingVoteModel:getInstance():CanClothingVoteOpen() then
table.insert(self.show_tabs, v)
table.insert(self.tab_name_list, v)
end
else
if Config.ViewTabbarOpenLevel.Arena[i].open_level <= playerLv and Config.ViewTabbarOpenLevel.Arena[i].open_day <= open_day then
if not ClientConfig.alpha_mode or (ClientConfig.alpha_mode and (i == 1)) then
table.insert(self.show_tabs, v)
table.insert(self.tab_name_list, v)
-- elseif i == ArenaConst.TabId.CLOTHINGVOTE and ClothingVoteModel:getInstance():CanClothingVoteOpen() then
-- --某个服务器开服天数不到要求但也必须开启靓丽大赛的情况
-- table.insert(self.show_tabs, v)
-- table.insert(self.tab_name_list, v)
end
end
end
end
end
function ArenaView:Open(index)
index = self:GetRealTabIndex(index or 1)
self.select_index = index or 1
if self.select_index == ArenaConst.TabId.CLOTHINGVOTE then--判断如果是明日之星界面,而活动状态是0,不允许打开界面
if ClothingVoteModel:getInstance().vote_stage == 0 then
index = ArenaConst.TabId.PKRANK
self.select_index = index
end
else
--这里是原来的逻辑
if #self.show_tabs == 0 or not self.show_tabs[self.select_index] then
Message.show("活动暂未开启~")
logWarn("ArenaView:Open=>Try to open a index that is not opened 1")
return
end
end
BaseView.Open(self)
end
function ArenaView:ReOpen(index)
index = self:GetRealTabIndex(index or 1)
self.select_index = index or 1
if self.select_index == ArenaConst.TabId.CLOTHINGVOTE then--判断如果是明日之星界面,而活动状态是0,不允许打开界面
if ClothingVoteModel:getInstance().vote_stage == 0 then
index = ArenaConst.TabId.PKRANK
self.select_index = index
end
else
--这里是原来的逻辑
if #self.show_tabs == 0 or not self.show_tabs[self.select_index] then
Message.show("活动暂未开启~")
logWarn("ArenaView:Open=>Try to open a index that is not opened 2 ")
return
end
end
self:SeletedTabbar(self.select_index, true)
self:ShowTabRedPointState()
end
function ArenaView:LoadSuccess()
self.winCon = self:GetChild("winCon")
local select_callback = function(index)
self:SeletedTabbar(index)
self:ShowTabRedPointState()
end
local closeWin_callback = function()
local helpVo = GuideModel:getInstance():GetHelpVo(HelpType.TYPE_PKRANK,3)
if helpVo or GuideModel:getInstance().need_force_do_task then
GuideModel:getInstance().need_force_do_task = false
GlobalEventSystem:Fire(EventName.FORCE_TO_DO_TASK)
end
self:Close()
end
self.tabWindowComponent = UITabWindow.New(self.transform,self.tab_name_list,select_callback,closeWin_callback,self.background_wnd,self.winCon, UITabWindow.SizeSmallHall, false,nil,true)
self.tabWindowComponent:SetTitleText("联赛")
-- self.tabWindowComponent:SetBackgroundRes("default_bg_6")
-- self.tabWindowComponent = TabWindowComponent.New(self.transform,"战场竞技",self.tab_name_list,1264,632,306,52,
-- select_callback,closeWin_callback,Vector3(0,-5,0),self.background_wnd,"arena_asset")
end
function ArenaView:SeletedTabbar(index, force)
local last_select_index = self.select_index or 1
if self.select_index == index and not force then
return
end
self.select_index = index
if index == ArenaConst.TabId.CLOTHINGVOTE and ClothingVoteModel:getInstance().vote_stage == 0 then
index = last_select_index
self.select_index = index
if ClothingVoteModel:getInstance().vote_round > 0 then
Message.show("活动正在结算中,请稍后再来吧~")
else
Message.show("明日之星活动尚未开启~")
end
end
if self.tabWindowComponent ~= nil then
self.tabWindowComponent:SetTabBarIndex(index)
self:SwitchBar()
end
end
function ArenaView:GetRealTabIndex(index)
return index
-- for i,v in ipairs(self.show_tabs) do
-- if v.index == index then
-- return i
-- end
-- end
end
function ArenaView:ShowTabRedPointState()
self.tabWindowComponent:ShowRedPoint(ArenaConst.TabId.PKRANK, PkRankModel:getInstance():PkRankModelCheckRedDot(false))
self.tabWindowComponent:ShowRedPoint(ArenaConst.TabId.ENDLESS, EndlessModel:getInstance():CheckEndlessRedDot())
self.tabWindowComponent:ShowRedPoint(ArenaConst.TabId.WASTELAND, WastelandModel:getInstance():CheckWastelandRedDot())
-- local csgwar_red_data = CSGWarModel:getInstance():GetCSGWarRedData()
-- local csgwar_red = csgwar_red_data.one_red or csgwar_red_data.support_red or csgwar_red_data.fight_red or csgwar_red_data.occupy_red
-- self.tabWindowComponent:ShowRedPoint(ArenaConst.TabId.CSGWAR, csgwar_red)
self.tabWindowComponent:ShowRedPoint(ArenaConst.TabId.CLOTHINGVOTE, ClothingVoteModel:getInstance():GetClothingVoteMainRed())
end
function ArenaView:SwitchBar()
local id = self.tabWindowComponent:GetCurrentSelectIndex()
local cfg = self:GetTabConfigById(id)
if not cfg then
print("[ArenaView 185]=> error !! tab cfg is nil, id: ",id)
return
end
self.tabWindowComponent:SetUIBack(
{
target = self,
bg1 = GameResPath.GetViewBigBg(cfg.bg),
})
--self.tabWindowComponent:SetBackgroundRes(cfg.bg)
local chile_view = self.contaner_list[id]
if not chile_view then
local viewModule = cfg
if viewModule then
chile_view = _G[viewModule.view].New(self.winCon)
self.contaner_list[id] = chile_view
end
end
if chile_view then
if id == ArenaConst.TabId.CSGWAR
or id == ArenaConst.TabId.CLOTHINGVOTE
then
chile_view:AppendToBackContainer(self)
end
if chile_view.SetData then
chile_view:SetData(self.skill_type,self.auto_click)
if self.skill_type then --生活技能特殊处理
local is_live_skill = cfg.id == 4
if is_live_skill then
self.skill_type = false
self.auto_click = false
end
end
end
self:PopUpChild(chile_view)
if id == ArenaConst.TabId.CLOTHINGVOTE then--重新打开界面后再刷一次模型
chile_view:SetData()
end
end
if id == ArenaConst.TabId.PKRANK then
local model = PkRankModel.getInstance()
if model.is_god_fight then
model.is_god_fight = false
model:Fire(PkRankModel.OPEN_GOD_VIEW)
end
end
end
function ArenaView:GetTabConfigById( id )
local cfg
for k,v in pairs(self.show_tabs) do
if v.id == id then
cfg = v
break
end
end
return cfg
end