PGRData/Script/matrix/xui/xuiareawar/XUiAreaWarBattleRoleRoom.lua
2024-09-01 22:49:41 +02:00

55 lines
No EOL
1.8 KiB
Lua

---@class XUiAreaWarBattleRoleRoom : XUiBattleRoleRoomDefaultProxy
---@field Team XTeam
---@field StageId number
local XUiAreaWarBattleRoleRoom = XClass(require("XUi/XUiNewRoomSingle/XUiBattleRoleRoomDefaultProxy"), "XUiAreaWarBattleRoleRoom")
function XUiAreaWarBattleRoleRoom:Ctor(team, stateId)
self.Team = team
self.StageId = stateId
end
function XUiAreaWarBattleRoleRoom:GetAutoCloseInfo()
return true, XDataCenter.AreaWarManager.GetEndTime(), function(isClose)
if isClose then
XDataCenter.AreaWarManager.OnActivityEnd()
end
end
end
function XUiAreaWarBattleRoleRoom:GetRoleDetailProxy()
if self.DetailProxy then
return self.DetailProxy
end
self.DetailProxy = require("XUi/XUiAreaWar/XUiAreaWarBattleRoomRoleDetail")
return self.DetailProxy
end
--- 进入战斗
---@param team XTeam
---@return
--------------------------
function XUiAreaWarBattleRoleRoom:EnterFight(team, stageId, challengeCount, isAssist)
--判断消耗品是否足够
local blockId = XAreaWarConfigs.GetBlockIdByStageId(stageId)
local costActionPoint = XAreaWarConfigs.GetBlockActionPoint(blockId)
if not XDataCenter.AreaWarManager.CheckActionPoint(costActionPoint) then
XUiManager.OpenBuyAssetPanel(XDataCenter.ItemManager.ItemId.AreaWarActionPoint)
return
end
if not XTool.IsNumberValid(team:GetCaptainPosEntityId()) then
XUiManager.TipText("TeamManagerCheckCaptainNil")
return
end
if not XTool.IsNumberValid(team:GetFirstFightPosEntityId()) then
XUiManager.TipText("TeamManagerCheckFirstFightNil")
end
local stageConfig = XDataCenter.FubenManager.GetStageCfg(stageId)
XDataCenter.FubenManager.EnterFight(stageConfig, team:GetId(), isAssist, challengeCount)
end
return XUiAreaWarBattleRoleRoom