2023-07-15 02:35:33 +07:00
|
|
|
|
--===========================================================================
|
|
|
|
|
---@desc 角色列表元素
|
|
|
|
|
--===========================================================================
|
|
|
|
|
local XUiBattleRoomRoleGrid = require("XUi/XUiNewRoomSingle/XUiBattleRoomRoleGrid")
|
|
|
|
|
local XUiPivotCombatRoleGrid = XClass(XUiBattleRoomRoleGrid, "XUiPivotCombatRoleGrid")
|
|
|
|
|
|
|
|
|
|
function XUiPivotCombatRoleGrid:SetData(entity, team, stageId)
|
|
|
|
|
self.Super.SetData(self, entity, team, stageId)
|
|
|
|
|
local characterViewModel = entity:GetCharacterViewModel()
|
|
|
|
|
--无论是机器人还是玩家的角色,这里都是CharacterId不是RobotId
|
|
|
|
|
local id = characterViewModel:GetId()
|
2024-09-01 22:49:41 +02:00
|
|
|
|
local locked = XDataCenter.PivotCombatManager.CheckCharacterLocked(stageId, id)
|
|
|
|
|
self.ImgLock.gameObject:SetActiveEx(locked)
|
|
|
|
|
|
2023-07-15 02:35:33 +07:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--===========================================================================
|
|
|
|
|
---@desc SP枢纽作战选人代理界面
|
|
|
|
|
--===========================================================================
|
|
|
|
|
local XUiBattleRoomRoleDetailDefaultProxy = require("XUi/XUiNewRoomSingle/XUiBattleRoomRoleDetailDefaultProxy")
|
|
|
|
|
local XUiPivotCombatBattleRoomRoleDetail = XClass(XUiBattleRoomRoleDetailDefaultProxy, "XUiPivotCombatBattleRoomRoleDetail")
|
|
|
|
|
|
|
|
|
|
local EnhanceSkill = 5 --属性界面->独域技能
|
|
|
|
|
|
|
|
|
|
function XUiPivotCombatBattleRoomRoleDetail:Ctor(stageId, team, pos)
|
|
|
|
|
self.StageId = stageId
|
|
|
|
|
self.Team = team
|
|
|
|
|
self.Pos = pos
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function XUiPivotCombatBattleRoomRoleDetail:AOPOnStartBefore(rootUi)
|
|
|
|
|
self.Entities = {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function XUiPivotCombatBattleRoomRoleDetail:GetGridProxy()
|
|
|
|
|
return XUiPivotCombatRoleGrid
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function XUiPivotCombatBattleRoomRoleDetail:GetDefaultCharacterType()
|
|
|
|
|
local roles = self:GetEntities(XCharacterConfigs.CharacterType.Isomer)
|
|
|
|
|
return #roles > 0 and XCharacterConfigs.CharacterType.Isomer or XCharacterConfigs.CharacterType.Normal
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--获取角色
|
|
|
|
|
function XUiPivotCombatBattleRoomRoleDetail:GetEntities(characterType)
|
|
|
|
|
local result = {}
|
|
|
|
|
if XTool.IsTableEmpty(self.Entities[characterType]) then
|
|
|
|
|
self.Entities[characterType] = XDataCenter.PivotCombatManager.GetFightEntities(characterType)
|
|
|
|
|
end
|
|
|
|
|
for _, entity in ipairs(self.Entities[characterType]) do
|
|
|
|
|
table.insert(result, entity)
|
|
|
|
|
end
|
|
|
|
|
return result
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--角色排序
|
|
|
|
|
function XUiPivotCombatBattleRoomRoleDetail: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) * 1000000000 or 0
|
|
|
|
|
local teamWeightB = posB ~= -1 and (10 - posB) * 1000000000 or 0
|
|
|
|
|
local abilityA = entityA:GetCharacterViewModel():GetAbility() * 10
|
|
|
|
|
local abilityB = entityB:GetCharacterViewModel():GetAbility() * 10
|
|
|
|
|
local weightA = teamWeightA + abilityA + entityA:GetId() / 1000
|
|
|
|
|
local weightB = teamWeightB + abilityB + entityB:GetId() / 1000
|
|
|
|
|
return weightA > weightB
|
|
|
|
|
end)
|
|
|
|
|
return entities
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function XUiPivotCombatBattleRoomRoleDetail:CheckCustomLimit(entityId)
|
|
|
|
|
if not XTool.IsNumberValid(entityId) then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
local entity = self.Super.GetCharacterViewModelByEntityId(self, entityId)
|
|
|
|
|
local id = entity and entity:GetId() or 0
|
2024-09-01 22:49:41 +02:00
|
|
|
|
local locked = XDataCenter.PivotCombatManager.CheckCharacterLocked(self.StageId, id)
|
|
|
|
|
if locked then
|
2023-07-15 02:35:33 +07:00
|
|
|
|
XUiManager.TipError(XUiHelper.GetText("PivotCombatRoleLockTips"))
|
|
|
|
|
end
|
2024-09-01 22:49:41 +02:00
|
|
|
|
return locked
|
2023-07-15 02:35:33 +07:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function XUiPivotCombatBattleRoomRoleDetail:AOPOnBtnJoinTeamClickedBefore(rootUi)
|
|
|
|
|
local entity = self.Super.GetCharacterViewModelByEntityId(self, rootUi.CurrentEntityId)
|
|
|
|
|
local id = entity and entity:GetId() or 0
|
|
|
|
|
local isOwn = XDataCenter.CharacterManager.IsOwnCharacter(id)
|
|
|
|
|
if not isOwn then return end
|
2024-09-01 22:49:41 +02:00
|
|
|
|
local isRobot = XRobotManager.CheckIsRobotId(rootUi.CurrentEntityId)
|
|
|
|
|
if isRobot then return false end
|
|
|
|
|
|
2023-07-15 02:35:33 +07:00
|
|
|
|
local condition = XPivotCombatConfigs.GetSpecialSkillCheck(id)
|
2024-09-01 22:49:41 +02:00
|
|
|
|
|
2023-07-15 02:35:33 +07:00
|
|
|
|
|
|
|
|
|
if not condition then return end
|
|
|
|
|
|
|
|
|
|
local unlock, desc = XConditionManager.CheckCondition(condition, id)
|
2024-09-01 22:49:41 +02:00
|
|
|
|
|
|
|
|
|
|
2023-07-15 02:35:33 +07:00
|
|
|
|
local negativeCb = function()
|
|
|
|
|
--打开新的界面,会打断原来的界面关闭,这里重新关闭
|
2024-09-01 22:49:41 +02:00
|
|
|
|
rootUi:Close(true)
|
2023-07-15 02:35:33 +07:00
|
|
|
|
end
|
2024-09-01 22:49:41 +02:00
|
|
|
|
|
2023-07-15 02:35:33 +07:00
|
|
|
|
local positiveCb = function()
|
|
|
|
|
XLuaUiManager.Open("UiCharacter", id, nil, nil, nil, true, nil, nil, EnhanceSkill)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if not unlock then
|
2024-09-01 22:49:41 +02:00
|
|
|
|
XDataCenter.PivotCombatManager.ShowDialogHintTip(id, negativeCb, positiveCb)
|
2023-07-15 02:35:33 +07:00
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--活动结束
|
|
|
|
|
function XUiPivotCombatBattleRoomRoleDetail:GetAutoCloseInfo()
|
|
|
|
|
return true, XDataCenter.PivotCombatManager.GetActivityEndTime(), function(isClose)
|
|
|
|
|
if isClose then
|
|
|
|
|
XDataCenter.PivotCombatManager.OnActivityEnd()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return XUiPivotCombatBattleRoomRoleDetail
|