UGCProjects/ExtremeParkour/Script/UI/Rank/WB_ParkourRankItem.lua
2025-01-04 23:00:19 +08:00

41 lines
1.5 KiB
Lua

---@class WB_ParkourRankItem_C:UUserWidget
---@field Image_PlayerIcon UImage
---@field TextBlock_Level UTextBlock
---@field TextBlock_PlayerName UTextBlock
---@field TextBlock_RankNum UTextBlock
---@field TextBlock_Time UTextBlock
---@field WidgetSwitcher_IsLocalPlayer UWidgetSwitcher
--Edit Below--
---@type WB_ParkourRankItem_C
local WB_ParkourRankItem = {
bInitDoOnce = false;
};
function WB_ParkourRankItem:SetTeam(TeamType)
end
function WB_ParkourRankItem:SetIndex(Index)
self.TextBlock_RankNum:SetText(tostring(Index));
end
function WB_ParkourRankItem: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 Level = PlayerScoreSystem.GetPlayerScoreDataFromType(PlayerKey, PlayerScoreSystem.Config.EScoreType.Level)
local Remainder = PlayerScoreSystem.GetPlayerScoreDataFromType(PlayerKey, PlayerScoreSystem.Config.EScoreType.Remainder)
self.TextBlock_PlayerName:SetText(PlayerName);
self.TextBlock_Level:SetText(tostring(Level));
self.TextBlock_Time:SetText(tostring(UGCSystemLibrary.formatTime(Remainder, true, false, false)));
UGCSystemLibrary.DownloadImageToUImage(self.Image_PlayerIcon, UGCGameSystem.GameState:GetHeadIconByPlayerKey(PlayerKey), true);
end
return WB_ParkourRankItem;