PGRData/Script/matrix/xui/xuitheatre/XUiTheatreBattleRoomRoleDetail.lua

105 lines
4.1 KiB
Lua
Raw Normal View History

--######################## XUiTheatreRoleGrid ########################
local XUiBattleRoomRoleGrid = require("XUi/XUiNewRoomSingle/XUiBattleRoomRoleGrid")
2024-09-01 20:49:41 +00:00
---@class XUiTheatreRoleGrid:XUiBattleRoomRoleGrid
---@field Super XUiBattleRoomRoleGrid
local XUiTheatreRoleGrid = XClass(XUiBattleRoomRoleGrid, "XUiTheatreRoleGrid")
2024-09-01 20:49:41 +00:00
---@param entity XTheatreAdventureRole
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()
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
--######################## XUiTheatreBattleRoomRoleDetail ########################
local XUiBattleRoomRoleDetailDefaultProxy = require("XUi/XUiNewRoomSingle/XUiBattleRoomRoleDetailDefaultProxy")
2024-09-01 20:49:41 +00:00
---@class XUiTheatreBattleRoomRoleDetail:XUiBattleRoomRoleDetailDefaultProxy
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)
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()
end
end
2024-09-01 20:49:41 +00:00
return roles
end
function XUiTheatreBattleRoomRoleDetail:GetCharacterViewModelByEntityId(entityId)
2024-09-01 20:49:41 +00:00
local role = self.AdventureManager:GetRoleByRobotId(entityId)
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
return XUiTheatreBattleRoomRoleDetail