UGCProjects/SoloKing/Script/UI/InTest/WB_InTest_Side.lua
2025-01-04 23:00:19 +08:00

86 lines
3.2 KiB
Lua

---@class WB_InTest_Side_C:UUserWidget
---@field ShowTest UWidgetAnimation
---@field VerticalBox_Main UVerticalBox
--Edit Below--
---@type WB_InTest_Side_C
local WB_InTest_Side = { bInitDoOnce = false; };
function WB_InTest_Side:Construct()
self:LuaInit();
end
local TestMap = {
{ Func = function() WB_InTest_Side:SendMiniRPC("Test_PlayerLeave", LocalPlayerKey) end, Text = "测试玩家离开", },
{ Func = function() WB_InTest_Side:OpenRecord() end, Text = "测试打开举报UI", },
--{ Func = function() WB_InTest_Side:SendMiniRPC("Test_SetScore2000", LocalPlayerKey) end, Text = "测试设置2500分", },
--{ Func = function() WB_InTest_Side:SendMiniRPC("Test_AddRank500", LocalPlayerKey) end, Text = "添加500分", },
--{ Func = function() WB_InTest_Side:SendMiniRPC("Test_ReduceRank500", LocalPlayerKey) end, Text = "减少500分", },
--{ Func = function() WB_InTest_Side:SendMiniRPC("Test_ClearHistory", LocalPlayerKey) end, Text = "清除战绩", },
{ Func = function() WB_InTest_Side:SendMiniRPC("Test_HandleArchiveTable", LocalPlayerKey) end, Text = "重置存档", },
{ Func = function() WB_InTest_Side:SendMiniRPC("Test_InitAllHouse", LocalPlayerKey) end, Text = "初始化所有房子", },
{ Func = function() WB_InTest_Side:SendMiniRPC("Test_RestAllDoor", LocalPlayerKey) end, Text = "重置所有门", },
--{ Func = function() WB_InTest_Side:SendMiniRPC("Test_RemovePart", LocalPlayerKey, 4) end, Text = "重置存档", },
};
function WB_InTest_Side:LuaInit()
if self.bInitDoOnce then return end
UITool.HideAllChildren(self.VerticalBox_Main);
for i = 1, table.getCount(TestMap) do
local v = TestMap[i];
local Item = self.VerticalBox_Main:GetChildAt(i - 1);
Item:SetFunc(v.Func, self, v.Text);
Item:SetVisibility(ESlateVisibility.Visible);
end
self.bInitDoOnce = true;
end
function WB_InTest_Side:OpenSettings()
---@type MainControlPanelTochButton_C
local MainControlPanel = GameBusinessManager.GetWidgetFromName(ingame, "MainControlPanelTochButton_C");
if MainControlPanel then
MainControlPanel.MainControlBaseUI:OpenSettingPanel();
end
end
function WB_InTest_Side:SendMiniRPC(InFunc, ...)
GameState:SendMiniGameRPC(InFunc, ...);
end
function WB_InTest_Side:OpenRecord()
--WidgetManager:ShowPanel(WidgetConfig.EUIType.GameRecord, false);
UGCLogSystem.LogTree(string.format("[WB_InTest_Side:OpenRecord] ComplaintUI ="), ComplaintUI);
end
function WB_InTest_Side:SendRPC(InStr, ...)
--UGCLogSystem.Log("[WB_InTest_Side:SendRPC] InStr = %s", InStr);
--UGCLogSystem.Log("[WB_InTest_Side:SendRPC] LocalPlayerController = %s", UE.GetName(LocalPlayerController));
UnrealNetwork.CallUnrealRPC(LocalPlayerController, LocalPlayerController, "Test_Func", InStr, ...);
end
function WB_InTest_Side:SendPawnRPC(InStr, ...)
end
-- function WB_InTest_Side:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_InTest_Side:Destruct()
-- end
function WB_InTest_Side:ShowTestWidget(IsShow)
if IsShow then
self:PlayAnimation(self.ShowTest, 0, 1, EUMGSequencePlayMode.Reverse, 1.0)
else
self:PlayAnimation(self.ShowTest, 0, 1, EUMGSequencePlayMode.Forward, 1.0)
end
end
function WB_InTest_Side:UISomething()
LocalPlayerController:KillSomeCount(10);
self:SendRPC("UISomething")
end
return WB_InTest_Side;