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

72 lines
2.5 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 = {
[0] = { Func = function() WB_InTest_Side:SendRPC("Test_LaunchCharacter") end, Text = "冲刺", },
[1] = { Func =function() WB_InTest_Side:SendRPC("Test_Stun") end, Text = "眩晕", },
[2] = { Func =function() WB_InTest_Side:SendRPC("Test_CurrentWeapon") end, Text = "测试当前武器", },
[3] = { Func =function() WB_InTest_Side:SendRPC("Test_LogCurrArmor") end, Text = "日志输出当前的护甲", },
[4] = { Func =function() WB_InTest_Side:SendRPC("Test_AddArmor") end, Text = "测试添加Armor", },
[5] = { Func = function() WB_InTest_Side:SendRPC("Test_AddRangeParts") end, Text = "测试添加配件", },
[6] = { Func = function() WB_InTest_Side:SendRPC("Test_ApplyDamage") end, Text = "测试伤害", },
[7] = { Func = function() WB_InTest_Side:OpenSettings() 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, ...)
--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;