UGCProjects/SoloKing/Script/UI/GameRecord/WB_RoundInfoItem.lua

70 lines
1.5 KiB
Lua
Raw Normal View History

2025-01-04 23:00:19 +08:00
---@class WB_RoundInfoItem_C:UUserWidget
---@field TextBlock_MatchScore UTextBlock
---@field TextBlock_WeaponName UTextBlock
---@field WidgetSwitcher_ComplexNum UWidgetSwitcher
---@field WidgetSwitcher_IsWin UWidgetSwitcher
--Edit Below--
---@type WB_PlayerInfoItem_C
local WB_RoundInfoItem = { bInitDoOnce = false; };
function WB_RoundInfoItem:Construct()
end
--function WB_RoundInfoItem:SetAsTitle()
-- self:SetIsMVP(false);
-- self:IsSelf(false);
--
--end
function WB_RoundInfoItem:SetIndex(InIndex)
self.Index = InIndex
self.WidgetSwitcher_ComplexNum:SetActiveWidgetIndex(InIndex % 2)
end
--[[
--回合武器ID
WeaponID:uint,
-- 回合比分
RoundScore:table {
MyScore:uint,
EnemyScore:uint
},
-- 回合是否胜利
IsWin:bool
]]
--- 设置信息
function WB_RoundInfoItem:SetItemInfo(Info)
self.TextBlock_MatchScore:SetText(string.format("%s - %s", tostring(Info.RoundScore.MyScore), tostring(Info.RoundScore.EnemyScore)))
if Info.WeaponID then
local WeaponInfo = UGCItemSystem.GetItemData(Info.WeaponID);
if WeaponInfo then
self.TextBlock_WeaponName:SetText(WeaponInfo.ItemName);
end
end
if Info.IsWin ~= nil then
if Info.IsWin then
self.WidgetSwitcher_IsWin:SetActiveWidgetIndex(0)
else
self.WidgetSwitcher_IsWin:SetActiveWidgetIndex(1)
end
else
self.WidgetSwitcher_IsWin:SetActiveWidgetIndex(2)
end
end
-- function WB_RoundInfoItem:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_RoundInfoItem:Destruct()
-- end
return WB_RoundInfoItem;