2023-07-14 19:35:33 +00:00
|
|
|
--######################## XUiTheatreRoleGrid ########################
|
|
|
|
local XUiBattleRoomRoleGrid = require("XUi/XUiNewRoomSingle/XUiBattleRoomRoleGrid")
|
2024-09-01 20:49:41 +00:00
|
|
|
---@class XUiTheatreRoleGrid:XUiBattleRoomRoleGrid
|
|
|
|
---@field Super XUiBattleRoomRoleGrid
|
2023-07-14 19:35:33 +00:00
|
|
|
local XUiTheatreRoleGrid = XClass(XUiBattleRoomRoleGrid, "XUiTheatreRoleGrid")
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
---@param entity XTheatreAdventureRole
|
2023-07-14 19:35:33 +00:00
|
|
|
function XUiTheatreRoleGrid:SetData(entity)
|
|
|
|
self.Super.SetData(self, entity)
|
|
|
|
if not entity:GetIsLocalRole() then
|
|
|
|
self.TxtLevel.text = XDataCenter.TheatreManager.GetCurrentAdventureManager():GetCurrentLevel()
|
2024-09-01 20:49:41 +00:00
|
|
|
|
|
|
|
self.TxtFight.gameObject:SetActiveEx(true)
|
|
|
|
self.TxtFight.text = entity:GetAbility()
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
function XUiTheatreRoleGrid:UpdateFight()
|
|
|
|
if self.IsFragment then
|
|
|
|
self.PanelFight.gameObject:SetActiveEx(false)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
self.TxtFight.gameObject:SetActiveEx(true)
|
|
|
|
self.TxtLevel.text = self.Character:GetCharacterViewModel():GetLevel()
|
|
|
|
self.TxtFight.text = self.Character:GetCharacterViewModel():GetAbility()
|
|
|
|
self.PanelFight.gameObject:SetActiveEx(true)
|
|
|
|
end
|
|
|
|
|
2023-07-14 19:35:33 +00:00
|
|
|
--######################## XUiTheatreBattleRoomRoleDetail ########################
|
|
|
|
local XUiBattleRoomRoleDetailDefaultProxy = require("XUi/XUiNewRoomSingle/XUiBattleRoomRoleDetailDefaultProxy")
|
2024-09-01 20:49:41 +00:00
|
|
|
|
|
|
|
---@class XUiTheatreBattleRoomRoleDetail:XUiBattleRoomRoleDetailDefaultProxy
|
2023-07-14 19:35:33 +00:00
|
|
|
local XUiTheatreBattleRoomRoleDetail = XClass(XUiBattleRoomRoleDetailDefaultProxy, "XUiTheatreBattleRoomRoleDetail")
|
|
|
|
|
|
|
|
function XUiTheatreBattleRoomRoleDetail:Ctor()
|
|
|
|
self.TheatreManager = XDataCenter.TheatreManager
|
|
|
|
self.AdventureManager = self.TheatreManager.GetCurrentAdventureManager()
|
|
|
|
self.Chapter = self.AdventureManager:GetCurrentChapter()
|
2024-09-01 20:49:41 +00:00
|
|
|
self._IdDir = {}
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiTheatreBattleRoomRoleDetail:AOPOnBtnJoinTeamClickedAfter(ui)
|
|
|
|
local id = self._IdDir[ui.CurrentEntityId] and self._IdDir[ui.CurrentEntityId] or ui.CurrentEntityId
|
|
|
|
ui.Team:UpdateEntityTeamPos(id, ui.Pos, true)
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
-- characterType : XCharacterConfigs.CharacterType
|
|
|
|
function XUiTheatreBattleRoomRoleDetail:GetEntities(characterType)
|
|
|
|
local roles = self.AdventureManager:GetCurrentRoles(true)
|
|
|
|
for _, role in ipairs(roles) do
|
2024-09-01 20:49:41 +00:00
|
|
|
if not role:GetIsLocalRole() then
|
|
|
|
local robotId = role:GetRawData().Id
|
|
|
|
self._IdDir[robotId] = role:GetId()
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
end
|
2024-09-01 20:49:41 +00:00
|
|
|
return roles
|
2023-07-14 19:35:33 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function XUiTheatreBattleRoomRoleDetail:GetCharacterViewModelByEntityId(entityId)
|
2024-09-01 20:49:41 +00:00
|
|
|
local role = self.AdventureManager:GetRoleByRobotId(entityId)
|
2023-07-14 19:35:33 +00:00
|
|
|
if role == nil then return nil end
|
|
|
|
return role:GetCharacterViewModel()
|
|
|
|
end
|
|
|
|
|
|
|
|
-- team : XTeam
|
|
|
|
-- sortTagType : XRoomCharFilterTipsConfigs.EnumSortTag
|
|
|
|
function XUiTheatreBattleRoomRoleDetail:SortEntitiesWithTeam(team, entities, sortTagType)
|
|
|
|
table.sort(entities, function(entityA, entityB)
|
|
|
|
local _, posA = team:GetEntityIdIsInTeam(entityA:GetId())
|
|
|
|
local _, posB = team:GetEntityIdIsInTeam(entityB:GetId())
|
|
|
|
local teamWeightA = posA ~= -1 and (10 - posA) * 100000 or 0
|
|
|
|
local teamWeightB = posB ~= -1 and (10 - posB) * 100000 or 0
|
|
|
|
teamWeightA = teamWeightA + entityA:GetAbility()
|
|
|
|
teamWeightB = teamWeightB + entityB:GetAbility()
|
|
|
|
if teamWeightA == teamWeightB then
|
|
|
|
return entityA:GetId() > entityB:GetId()
|
|
|
|
else
|
|
|
|
return teamWeightA > teamWeightB
|
|
|
|
end
|
|
|
|
end)
|
|
|
|
return entities
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiTheatreBattleRoomRoleDetail:GetGridProxy()
|
|
|
|
return XUiTheatreRoleGrid
|
|
|
|
end
|
|
|
|
|
2024-09-01 20:49:41 +00:00
|
|
|
function XUiTheatreBattleRoomRoleDetail:GetFilterControllerConfig()
|
|
|
|
---@type XCharacterAgency
|
|
|
|
local characterAgency = XMVCA:GetAgency(ModuleId.XCharacter)
|
|
|
|
return characterAgency:GetModelCharacterFilterController()["UiTheatreBattleRoomDetail"]
|
|
|
|
end
|
|
|
|
|
|
|
|
---v2.6 新筛选器用
|
|
|
|
function XUiTheatreBattleRoomRoleDetail:CheckInTeam(team, entityId)
|
|
|
|
local id = self._IdDir[entityId] and self._IdDir[entityId] or entityId
|
|
|
|
return team:GetEntityIdIsInTeam(id)
|
|
|
|
end
|
|
|
|
|
|
|
|
function XUiTheatreBattleRoomRoleDetail:GetCurrentEntityId(currentEntityId)
|
|
|
|
return self._IdDir[currentEntityId] and self._IdDir[currentEntityId] or currentEntityId
|
|
|
|
end
|
|
|
|
|
2023-07-14 19:35:33 +00:00
|
|
|
return XUiTheatreBattleRoomRoleDetail
|