89 lines
2.9 KiB
Lua
89 lines
2.9 KiB
Lua
---@class WB_ShowRankInheritance_C:UUserWidget
|
|
---@field ShowLastDan UWidgetAnimation
|
|
---@field Image_LastDan UImage
|
|
---@field Image_LastDanFX UImage
|
|
---@field Image_NewDan UImage
|
|
---@field NewButton_Close UNewButton
|
|
---@field TextBlock_HideScore UTextBlock
|
|
---@field TextBlock_LastCompetitionSeasonName UTextBlock
|
|
---@field TextBlock_LastDanName UTextBlock
|
|
---@field TextBlock_LastScore UTextBlock
|
|
---@field TextBlock_NowCompetitionSeasonName UTextBlock
|
|
---@field TextBlock_NowScore UTextBlock
|
|
--Edit Below--
|
|
local WB_ShowRankInheritance = { bInitDoOnce = false }
|
|
|
|
--[==[ Construct
|
|
function WB_ShowRankInheritance:Construct()
|
|
|
|
end
|
|
-- Construct ]==]
|
|
|
|
-- function WB_ShowRankInheritance:Tick(MyGeometry, InDeltaTime)
|
|
|
|
-- end
|
|
|
|
-- function WB_ShowRankInheritance:Destruct()
|
|
|
|
-- end
|
|
|
|
function WB_ShowRankInheritance:OnShowPanel(LastSeason, CurrSeason, LastScore, NowScore, HideScore)
|
|
UGCLogSystem.Log("[WB_ShowRankInheritance:OnShowPanel] 执行")
|
|
-- 绑定关闭UI
|
|
UITool.BindButtonClicked(self.NewButton_Close, self.CloseSelf, self)
|
|
|
|
UGCLogSystem.Log("[WB_ShowRankInheritance:OnShowPanel] LastScore = %s, NowScore = %s, HideScore = %s", LastScore, NowScore, HideScore);
|
|
|
|
-- 设置赛季名
|
|
self.TextBlock_LastCompetitionSeasonName:SetText('S' .. tostring(LastSeason) .. '赛季')
|
|
self.TextBlock_NowCompetitionSeasonName:SetText('S' .. tostring(CurrSeason) .. '赛季')
|
|
|
|
self.TextBlock_LastScore:SetText(tostring(LastScore))
|
|
-- 设置当前积分
|
|
self.TextBlock_NowScore:SetText(tostring(NowScore))
|
|
if HideScore > 0 then
|
|
self.TextBlock_HideScore:SetText("(" .. tostring(HideScore) .. ")")
|
|
else
|
|
self.TextBlock_HideScore:SetText("")
|
|
end
|
|
|
|
local LastDan = 1;
|
|
local NewDan = 1;
|
|
for i, v in pairs(RankInformationTable.DanInfo) do
|
|
if v.MinScore <= LastScore then
|
|
LastDan = i
|
|
end
|
|
if v.MinScore <= NowScore then
|
|
NewDan = i
|
|
end
|
|
end
|
|
|
|
-- 设置上一赛季段位名
|
|
local LastDanName = RankInformationTable.DanInfo[LastDan].Name
|
|
self.TextBlock_LastDanName:SetText(LastDanName)
|
|
|
|
-- 先隐藏图片
|
|
self.Image_LastDan:SetVisibility(ESlateVisibility.Hidden)
|
|
self.Image_NewDan:SetVisibility(ESlateVisibility.Hidden)
|
|
self.Image_LastDanFX:SetVisibility(ESlateVisibility.Hidden)
|
|
|
|
-- 设置图片
|
|
UE.AsyncLoadObject(RankInformationTable.DanInfo[LastDan].Icon, function(Tex)
|
|
self.Image_LastDan:SetBrushFromTexture(Tex);
|
|
self.Image_LastDanFX:SetBrushFromTexture(Tex);
|
|
self.Image_LastDan:SetVisibility(ESlateVisibility.HitTestInvisible)
|
|
self.Image_LastDanFX:SetVisibility(ESlateVisibility.HitTestInvisible)
|
|
|
|
self:PlayAnimation(self.ShowLastDan, 0, 1, EUMGSequencePlayMode.Forward, 1.0)
|
|
end);
|
|
UE.AsyncLoadObject(RankInformationTable.DanInfo[NewDan].Icon, function(Tex)
|
|
self.Image_NewDan:SetBrushFromTexture(Tex);
|
|
self.Image_NewDan:SetVisibility(ESlateVisibility.HitTestInvisible)
|
|
end);
|
|
end
|
|
|
|
function WB_ShowRankInheritance:CloseSelf()
|
|
WidgetManager:ClosePanel(self.UIType)
|
|
end
|
|
|
|
return WB_ShowRankInheritance |