---@class WB_TeamSettlementItem_C:UUserWidget ---@field Button_Result_AddFriend UButton ---@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_TeamSettlementItem_C local WB_TeamSettlementItem = { bInitDoOnce = false; PlayerKey = -1; }; function WB_TeamSettlementItem:LuaInit() if self.bInitDoOnce then return; end self.bInitDoOnce = true; WidgetLibrary.BindButtonClicked(self.Button_Result_AddFriend, self.AddFriend, self) end function WB_TeamSettlementItem: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_TeamSettlementItem:InitRankInfo(InPlayerKey) self:LuaInit() self.PlayerKey = InPlayerKey if self.PlayerKey == UGCSystemLibrary.GetLocalPlayerKey() then self.WidgetSwitcher_IsLocalPlayer:SetActiveWidgetIndex(1) self.Button_Result_AddFriend:SetVisibility(ESlateVisibility.Collapsed) else self.WidgetSwitcher_IsLocalPlayer:SetActiveWidgetIndex(0) end local PlayerName = UGCGameSystem.GameState:GetPlayerNameByPlayerKey(self.PlayerKey); local RankNum = UGCGameSystem.GameState:GetPlayerRankByPlayerKey(self.PlayerKey) local ScoreData = UGCGameSystem.GameState:GetScoreDataByPlayerKey(self.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(self.PlayerKey)); end function WB_TeamSettlementItem:AddFriend() local TargetPlayerData = UGCGameSystem.GameState.PlayerPersonalInfos[self.PlayerKey] if TargetPlayerData then UGCGameSystem.AddFriend(TargetPlayerData.UID) end end return WB_TeamSettlementItem;