56 lines
2.1 KiB
Lua
56 lines
2.1 KiB
Lua
---@class WB_TeamRankItem_C:UUserWidget
|
|
---@field Image_6 UImage
|
|
---@field Image_PlayerIcon UImage
|
|
---@field TextBlock_Deaths UTextBlock
|
|
---@field TextBlock_Kills UTextBlock
|
|
---@field TextBlock_PlayerName UTextBlock
|
|
---@field TextBlock_RankNum UTextBlock
|
|
---@field WidgetSwitcher_IsLocalPlayer UWidgetSwitcher
|
|
--Edit Below--
|
|
---@type WB_TeamRankItem_C
|
|
local WB_TeamRankItem = {
|
|
bInitDoOnce = false;
|
|
};
|
|
|
|
function WB_TeamRankItem:SetTeam(TeamType)
|
|
-- UGCLogSystem.Log("[WB_TeamRankItem_SetTeam]")
|
|
local TeamColor = TeamConfig.TeamColor[TeamType]
|
|
-- 设置队伍颜色
|
|
if TeamColor then
|
|
self.TextBlock_RankNum:SetColorAndOpacity({SpecifiedColor = TeamColor, ColorUseRule = 0})
|
|
self.TextBlock_PlayerName:SetColorAndOpacity({SpecifiedColor = TeamColor, ColorUseRule = 0})
|
|
else
|
|
UGCLogSystem.LogError("[WB_TeamRankItem_SetTeam] TeamType:%s, TeamColorType: %s", tostring(TeamType), type(TeamColor))
|
|
end
|
|
end
|
|
|
|
function WB_TeamRankItem:SetIndex(Index)
|
|
self.TextBlock_RankNum:SetText(tostring(Index));
|
|
end
|
|
|
|
function WB_TeamRankItem:InitRankInfo(PlayerKey)
|
|
if PlayerKey == UGCSystemLibrary.GetLocalPlayerKey() then
|
|
self.WidgetSwitcher_IsLocalPlayer:SetActiveWidgetIndex(1)
|
|
else
|
|
self.WidgetSwitcher_IsLocalPlayer:SetActiveWidgetIndex(0)
|
|
end
|
|
|
|
local PlayerName = UGCGameSystem.GameState:GetPlayerNameByPlayerKey(PlayerKey);
|
|
-- local RankNum = UGCGameSystem.GameState:GetPlayerRankByPlayerKey(PlayerKey)
|
|
local Kills = PlayerScoreSystem.GetPlayerScoreDataFromType(PlayerKey, PlayerScoreSystem.Config.EScoreType.Kills)
|
|
local Damage = PlayerScoreSystem.GetPlayerScoreDataFromType(PlayerKey, PlayerScoreSystem.Config.EScoreType.Damage)
|
|
|
|
local Deaths = PlayerScoreSystem.GetPlayerScoreDataFromType(PlayerKey, PlayerScoreSystem.Config.EScoreType.Deaths)
|
|
|
|
self.TextBlock_PlayerName:SetText(PlayerName);
|
|
--self.TextBlock_RankNum:SetText(tostring(RankNum));
|
|
|
|
|
|
--self.TextBlock_Kills:SetText(tostring(Kills));
|
|
self.TextBlock_Kills:SetText(math.floor(Damage));
|
|
self.TextBlock_Deaths:SetText(tostring(Deaths));
|
|
|
|
UGCSystemLibrary.DownloadImageToUImage(self.Image_PlayerIcon, UGCGameSystem.GameState:GetHeadIconByPlayerKey(PlayerKey), true);
|
|
end
|
|
|
|
return WB_TeamRankItem; |