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

76 lines
2.8 KiB
Lua

---@class WB_InTest_Side_C:UUserWidget
---@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:SendRPC("Test_MiniFunc", "Test_PrintItemId") end, Text = "测试玩家身上物品", },
{ Func = function() WB_InTest_Side:SendRPC("Test_MiniFunc", "Test_AddBuff", LocalPlayerKey, "AddHealth") end, Text = "测试玩家加血", },
{ Func = function() WB_InTest_Side:SendRPC("Test_MiniFunc", "Test_AddBuff", LocalPlayerKey, "AddSpeed") end, Text = "测试玩家加速", },
{ Func = function() WB_InTest_Side:SendRPC("Test_MiniFunc", "Test_AddBuff", LocalPlayerKey, "BreathingHeal") end, Text = "测试玩家自动回血", },
{ Func = function() WB_InTest_Side:SendRPC("Test_MiniFunc", "Test_TaskQueue") end, Text = "测试任务队列", },
{ Func = function() WB_InTest_Side:SendRPC("Test_MiniFunc", "Test_ShowAllPlayers", LocalPlayerKey) end, Text = "测试显示敌方位置", },
{ Func = function() WB_InTest_Side:SendRPC("Test_MiniFunc", "Test_PlayerLeave", LocalPlayerKey) end, Text = "测试显示敌方位置", },
};
function WB_InTest_Side:LuaInit()
if self.bInitDoOnce then return end
UITool.HideAllChildren(self.VerticalBox_Main);
for i, v in pairs(TestMap) do
self.VerticalBox_Main:GetChildAt(i):SetFunc(v.Func, self, v.Text);
self.VerticalBox_Main:GetChildAt(i):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:SendRPC(InStr, ...)
if InStr == "Test_MiniFunc" then
LocalPlayerController:MiniFunc(...);
end
UnrealNetwork.CallUnrealRPC(LocalPlayerController, LocalPlayerController, "Test_Func", InStr, ...);
end
WB_InTest_Side.IsPawnShow = true;
function WB_InTest_Side:HideSelf()
local Pawn = UGCGameSystem.GetPlayerPawnByPlayerKey(LocalPlayerKey);
Pawn:HiddenMySelf(self.IsPawnShow);
self.IsPawnShow = not self.IsPawnShow;
end
function WB_InTest_Side:Test_SwitchScope()
local MainControlPanel = GameBusinessManager.GetWidgetFromName(ingame, "MainControlPanelTochButton_C")
if MainControlPanel ~= nil then
local ChangeSight = MainControlPanel.MainControlBaseUI.ChangeSight_UIBP;
ChangeSight:SetVisibility(ESlateVisibility.Visible);
ChangeSight:ShowList();
end
end
-- function WB_InTest_Side:Tick(MyGeometry, InDeltaTime)
-- end
-- function WB_InTest_Side:Destruct()
-- end
function WB_InTest_Side:UISomething()
LocalPlayerController:KillSomeCount(10);
self:SendRPC("UISomething")
end
return WB_InTest_Side;