2025-01-04 23:00:19 +08:00

66 lines
1.8 KiB
Lua

---@class WB_GameEnd_C:UUserWidget
---@field Button_Return UButton
---@field Button_Share UButton
---@field TextBlock_Return UTextBlock
---@field WB_PlayerScores UWB_PlayerScores_C
---@field WidgetSwitcher_GameEnd UWidgetSwitcher
--Edit Below--
---@type WB_GameEnd_C
local WB_GameEnd = { bInitDoOnce = false; };
WB_GameEnd.ReturnTimer = nil;
function WB_GameEnd:Construct()
self:LuaInit();
end
function WB_GameEnd:OnShowPanel(InTime, ...)
-- 加载即可
self:AutoReturnToLobby(InTime);
local vars = {...};
UGCLogSystem.LogTree(string.format("[WB_GameEnd:OnShowPanel] vars ="), vars)
self:SetResultScores(table.unpackTable(vars));
end
function WB_GameEnd:SetResultScores(InScore)
UGCLogSystem.Log("[WB_GameEnd:SetResultScores] TeamId = %d", InScore);
self.WidgetSwitcher_GameEnd:SetActiveWidgetIndex(InScore == LocalTeamId and 1 or 0);
end
function WB_GameEnd:AutoReturnToLobby(InTime)
if InTime == nil then InTime = MiniGameTimes.GameEnd; end
GlobalTickTool:AddInternalCount(self, function(o, dt, ServerTime, t)
self.TextBlock_Return:SetText("返回大厅("..tostring(t)..')');
end, 1, InTime, function(o)
o:OnReturnToLobby();
end);
end
function WB_GameEnd:LuaInit()
if self.bInitDoOnce then return ; end
UGCLogSystem.Log("[WB_GameEnd:LuaInit] 执行")
self.WB_PlayerScores:LuaInit();
self.Button_Return.OnClicked:Add(self.OnReturnToLobby, self)
UITool.BindButtonToShare(self.Button_Share);
self.TextBlock_Return:SetText("返回大厅");
self.bInitDoOnce = true;
end
function WB_GameEnd:UpdatePlayerSoldiers(InList)
UGCLogSystem.LogTree(string.format("[WB_GameEnd:UpdatePlayerSoldiers] InList ="), InList)
self.WB_PlayerScores:UpdatePlayerSoldiers(InList);
end
function WB_GameEnd:OnReturnToLobby()
UE.ReturnToLobby();
end
-- function WB_GameEnd:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_GameEnd:Destruct()
-- end
return WB_GameEnd;