mirror of
https://github.com/godotengine/godot.git
synced 2024-12-21 10:25:24 +08:00
2b55ac445b
Add `GodotTypeInfo::Metadata` to `MethodInfo`
51 lines
1.2 KiB
C#
51 lines
1.2 KiB
C#
using Godot;
|
|
using GodotTools.Internals;
|
|
using JetBrains.Annotations;
|
|
using static GodotTools.Internals.Globals;
|
|
|
|
namespace GodotTools
|
|
{
|
|
public partial class HotReloadAssemblyWatcher : Node
|
|
{
|
|
private Timer _watchTimer;
|
|
|
|
public override void _Notification(int what)
|
|
{
|
|
if (what == Node.NotificationWMWindowFocusIn)
|
|
{
|
|
RestartTimer();
|
|
|
|
if (Internal.IsAssembliesReloadingNeeded())
|
|
Internal.ReloadAssemblies(softReload: false);
|
|
}
|
|
}
|
|
|
|
private void TimerTimeout()
|
|
{
|
|
if (Internal.IsAssembliesReloadingNeeded())
|
|
Internal.ReloadAssemblies(softReload: false);
|
|
}
|
|
|
|
[UsedImplicitly]
|
|
public void RestartTimer()
|
|
{
|
|
_watchTimer.Stop();
|
|
_watchTimer.Start();
|
|
}
|
|
|
|
public override void _Ready()
|
|
{
|
|
base._Ready();
|
|
|
|
_watchTimer = new Timer
|
|
{
|
|
OneShot = false,
|
|
WaitTime = 0.5f
|
|
};
|
|
_watchTimer.Timeout += TimerTimeout;
|
|
AddChild(_watchTimer);
|
|
_watchTimer.Start();
|
|
}
|
|
}
|
|
}
|