mirror: 上游快照导入
This commit is contained in:
commit
7475ccb467
86 files changed
+3213
No files matched your search
@@ -0,0 +1,58 @@
|
||||
using System;
|
||||
using CSharpModBase.Input;
|
||||
using UnrealEngine.Runtime;
|
||||
|
||||
namespace CSharpModBase
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
private static IInputManager? InputManager;
|
||||
|
||||
public static void InitInputManager(IInputManager inputManager)
|
||||
{
|
||||
InputManager = inputManager;
|
||||
}
|
||||
|
||||
public static HotKeyItem RegisterKeyBind(Key key, Action action)
|
||||
{
|
||||
return InputManager!.RegisterKeyBind(key, action);
|
||||
}
|
||||
|
||||
public static HotKeyItem RegisterKeyBind(ModifierKeys modifiers, Key key, Action action)
|
||||
{
|
||||
return InputManager!.RegisterKeyBind(modifiers, key, action);
|
||||
}
|
||||
|
||||
public static HotKeyItem RegisterGamePadBind(GamePadButton button, Action action)
|
||||
{
|
||||
return InputManager!.RegisterGamePadBind(button, action);
|
||||
}
|
||||
|
||||
public static void TryRun(Action aciton)
|
||||
{
|
||||
try
|
||||
{
|
||||
aciton();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
};
|
||||
}
|
||||
|
||||
public static void TryRunOnGameThread(Action aciton)
|
||||
{
|
||||
FThreading.RunOnGameThread(() =>
|
||||
{
|
||||
try
|
||||
{
|
||||
aciton();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user