52 lines
1.9 KiB
Lua
52 lines
1.9 KiB
Lua
---@class WB_HeadingInfo_C:UUserWidget
|
|
---@field TextBlock_Rank UTextBlock
|
|
---@field TextBlock_Score UTextBlock
|
|
---@field TextBlock_Team UTextBlock
|
|
---@field TextBlock_TechnicalScore UTextBlock
|
|
--Edit Below--
|
|
---@type WB_HeadingInfo_C
|
|
local WB_HeadingInfo = { bInitDoOnce = false; };
|
|
|
|
function WB_HeadingInfo:Construct()
|
|
UGCEventSystem.AddListener(EventEnum.UpdatePlayerScoreData, self.UpdatePlayerScoreData, self)
|
|
|
|
--UGCEventSystem.AddListener(EventEnum.UpdatePlayerRank, self.UpdateRank, self)
|
|
--self:UpdateRank()
|
|
|
|
--local TeamID = UGCPlayerControllerSystem.GetTeamID(UGCSystemLibrary.GetLocalPlayerController())
|
|
local TeamID = TeamConfig.TeamType.CT
|
|
|
|
|
|
if TeamID then
|
|
self.TextBlock_Team:SetText(tostring(TeamConfig.TeamName[TeamID]) .. " 方")
|
|
local TeamColor = TeamConfig.TeamColor[TeamID]
|
|
if TeamColor then
|
|
self.TextBlock_Team:SetColorAndOpacity({SpecifiedColor = TeamColor, ColorUseRule=0})
|
|
self.TextBlock_Score:SetColorAndOpacity({SpecifiedColor = TeamColor, ColorUseRule=0})
|
|
self.TextBlock_Rank:SetColorAndOpacity({SpecifiedColor = TeamColor, ColorUseRule=0})
|
|
self.TextBlock_TechnicalScore:SetColorAndOpacity({SpecifiedColor = TeamColor, ColorUseRule=0})
|
|
|
|
end
|
|
end
|
|
end
|
|
|
|
function WB_HeadingInfo:UpdateRank()
|
|
local Rank = UGCGameSystem.GameState:GetPlayerRankByPlayerKey(UGCSystemLibrary.GetLocalPlayerKey())
|
|
if Rank then
|
|
self.TextBlock_RankNum:SetText(tostring(Rank))
|
|
end
|
|
self.TextBlock_RankNum:SetText(tostring(Rank))
|
|
end
|
|
|
|
|
|
function WB_HeadingInfo:UpdatePlayerScoreData()
|
|
local ScoreDatas = UGCGameSystem.GameState:GetScoreDataByPlayerKey(UGCSystemLibrary.GetLocalPlayerKey())
|
|
if ScoreDatas then
|
|
self.TextBlock_Score:SetText(tostring(ScoreDatas.Score))
|
|
self.TextBlock_TechnicalScore:SetText(string.format("%.1f", ScoreDatas.TechnicalScore * GlobalConfigs.GameSetting.TechnicalScoreProportion))
|
|
end
|
|
end
|
|
|
|
|
|
|
|
return WB_HeadingInfo; |