---@class WB_TeamRankItem_C:UUserWidget ---@field Image_PlayerIcon UImage ---@field TextBlock_PlayerName UTextBlock ---@field TextBlock_RankNum UTextBlock ---@field TextBlock_Score UTextBlock ---@field TextBlock_TechnicalScore 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}) self.TextBlock_Score:SetColorAndOpacity({SpecifiedColor = TeamColor, ColorUseRule = 0}) else UGCLogSystem.LogError("[WB_TeamRankItem_SetTeam] TeamType:%s, TeamColorType: %s", tostring(TeamType), type(TeamColor)) end 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 ScoreData = UGCGameSystem.GameState:GetScoreDataByPlayerKey(PlayerKey) self.TextBlock_PlayerName:SetText(PlayerName); self.TextBlock_RankNum:SetText(tostring(RankNum)); if ScoreData then self.TextBlock_Score:SetText(tostring(ScoreData.Score)); self.TextBlock_TechnicalScore:SetText(string.format("%.1f", ScoreData.TechnicalScore * GlobalConfigs.GameSetting.TechnicalScoreProportion)); end UGCSystemLibrary.DownloadImageToUImage(self.Image_PlayerIcon, UGCGameSystem.GameState:GetHeadIconByPlayerKey(PlayerKey)); end return WB_TeamRankItem;