---@class WB_TestMain_C:UUserWidget ---@field Button_Test UButton ---@field Button_Test_Custom UButton ---@field Button_TestSide UButton ---@field TextBlock_ServerTime UTextBlock ---@field TextBlock_State UTextBlock ---@field WB_InTest_Side UWB_InTest_Side_C --Edit Below-- local WB_TestMain = { bInitDoOnce = false } WB_TestMain.IsTestShow = true; function WB_TestMain:Construct() self:LuaInit(); end function WB_TestMain:LuaInit() if self.bInitDoOnce then return ; end UGCEventSystem.AddListener(EventTypes.MiniStateChange, self.OnMiniStateChange, self) self.WB_InTest_Side:LuaInit(); UITool.ButtonOnClickShowPanel(self.Button_Test, WidgetConfig.EUIType.Test, true); UITool.BindButtonClicked(self.Button_TestSide, self.OnClickTestSide, self); UITool.BindButtonClicked(self.Button_Test_Custom, self.OnClickCustomTest, self); GlobalTickTool:AddTick(self, function(o, dt, st) o.TextBlock_ServerTime:SetText(string.format("服务器时间:%0.1f", st)) end); self:OnClickTestSide(); self.bInitDoOnce = true; end function WB_TestMain:OnClickTestSide() UITool.TurnVisible(self.WB_InTest_Side); end function WB_TestMain:OnClickCustomTest() if self.IsTestShow then self.WB_InTest_Side:SetVisibility(ESlateVisibility.Collapsed) self.Button_FaceNotice:SetVisibility(ESlateVisibility.Collapsed) self.Button_Test:SetVisibility(ESlateVisibility.Collapsed) self.Button_TestSide:SetVisibility(ESlateVisibility.Collapsed) else self.WB_InTest_Side:SetVisibility(ESlateVisibility.SelfHitTestInvisible) self.Button_FaceNotice:SetVisibility(ESlateVisibility.SelfHitTestInvisible) self.Button_Test:SetVisibility(ESlateVisibility.SelfHitTestInvisible) self.Button_TestSide:SetVisibility(ESlateVisibility.SelfHitTestInvisible) end self.IsTestShow = not self.IsTestShow; end ------------------------------------ Test ------------------------------------ function WB_TestMain:AddLogItems(InList) self.WB_TestLog:AddLogItems(InList); end function WB_TestMain:AddLogItem(Color, fmt, ...) self.WB_TestLog:AddLog(Color, fmt, ...); end function WB_TestMain:OnMiniStateChange(InState) self.TextBlock_State:SetText(TableHelper.printEnum(MiniGameState, InState)); end -- function WB_TestMain:Tick(MyGeometry, InDeltaTime) -- end -- function WB_TestMain:Destruct() -- end return WB_TestMain