81 lines
2.7 KiB
Lua
81 lines
2.7 KiB
Lua
|
---@class WBP_SettlementPanel_Item_C:UUserWidget
|
||
|
---@field Img_IsMVP UImage
|
||
|
---@field TextBlock_CombatPoint UTextBlock
|
||
|
---@field TextBlock_DamagePercent UTextBlock
|
||
|
---@field TextBlock_PlayerLevel UTextBlock
|
||
|
---@field TextBlock_PlayerName UTextBlock
|
||
|
---@field TextBlock_Score UTextBlock
|
||
|
---@field TextBlock_TotalDamage UTextBlock
|
||
|
--Edit Below--
|
||
|
local WBP_SettlementPanel_Item = {
|
||
|
bInitDoOnce = false,
|
||
|
IsMVP = false,
|
||
|
IsSelf = false,
|
||
|
|
||
|
SelfItemColor =
|
||
|
{
|
||
|
SpecifiedColor =
|
||
|
{
|
||
|
R = 1,
|
||
|
G = 0.298039,
|
||
|
B = 0.015686,
|
||
|
A = 1
|
||
|
},
|
||
|
ColorUseRule = 0,
|
||
|
},
|
||
|
OtherItemColor =
|
||
|
{
|
||
|
SpecifiedColor =
|
||
|
{
|
||
|
R = 1,
|
||
|
G = 1,
|
||
|
B = 1,
|
||
|
A = 1
|
||
|
},
|
||
|
ColorUseRule = 0,
|
||
|
}
|
||
|
};
|
||
|
|
||
|
function WBP_SettlementPanel_Item:Init(PlayerResultData)
|
||
|
self.PlayerResultData = PlayerResultData
|
||
|
|
||
|
self.TextBlock_PlayerName:SetText(PlayerResultData.PlayerName)
|
||
|
self.TextBlock_PlayerLevel:SetText(PlayerResultData.Level)
|
||
|
|
||
|
local CombatStr = string.format("%.2fw", math.ceil(PlayerResultData.CombatPoint / 100.0) / 100.0)
|
||
|
self.TextBlock_CombatPoint:SetText(CombatStr)
|
||
|
|
||
|
local TotalDamageStr = string.format("%.1fw", math.ceil(PlayerResultData.TotalDamage / 1000.0) / 10.0)
|
||
|
self.TextBlock_TotalDamage:SetText(TotalDamageStr)
|
||
|
|
||
|
local PercentText = tostring(math.ceil(PlayerResultData.DamagePercent * 100)).."%"
|
||
|
self.TextBlock_DamagePercent:SetText(PercentText)
|
||
|
|
||
|
if PlayerResultData.IsMVP == true then
|
||
|
local Score = PlayerResultData.Score
|
||
|
local ScoreText = tostring(Score - 2).."+2"
|
||
|
self.TextBlock_Score:SetText(ScoreText)
|
||
|
else
|
||
|
self.TextBlock_Score:SetText(PlayerResultData.Score)
|
||
|
end
|
||
|
|
||
|
self:SetTextBlockColor(PlayerResultData.PlayerKey)
|
||
|
self:SetMVPImageVisibility(PlayerResultData.IsMVP)
|
||
|
end
|
||
|
|
||
|
function WBP_SettlementPanel_Item:SetTextBlockColor(InPlayerKey)
|
||
|
local LocalPlayerState = GameDataManager.GetLocalPlayerState()
|
||
|
local Color = (LocalPlayerState and LocalPlayerState.PlayerKey == InPlayerKey) and self.SelfItemColor or self.OtherItemColor
|
||
|
self.TextBlock_PlayerName:SetColorAndOpacity(Color)
|
||
|
self.TextBlock_PlayerLevel:SetColorAndOpacity(Color)
|
||
|
self.TextBlock_CombatPoint:SetColorAndOpacity(Color)
|
||
|
self.TextBlock_TotalDamage:SetColorAndOpacity(Color)
|
||
|
self.TextBlock_DamagePercent:SetColorAndOpacity(Color)
|
||
|
self.TextBlock_Score:SetColorAndOpacity(Color)
|
||
|
end
|
||
|
|
||
|
function WBP_SettlementPanel_Item:SetMVPImageVisibility(IsMVP)
|
||
|
self.Img_IsMVP:SetVisibility(IsMVP and ESlateVisibility.SelfHitTestInvisible or ESlateVisibility.Collapsed)
|
||
|
end
|
||
|
|
||
|
return WBP_SettlementPanel_Item;
|