From 17582395514f57e21cfbddf5dbb2bf51707c6999 Mon Sep 17 00:00:00 2001 From: daniel Date: Thu, 10 Oct 2024 19:43:41 +0200 Subject: [PATCH] tweak(mono-rt2): change script initialization method --- code/client/clrcore-v2/BaseScript.cs | 7 ++----- code/client/clrcore-v2/Interop/EventsManager.cs | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/code/client/clrcore-v2/BaseScript.cs b/code/client/clrcore-v2/BaseScript.cs index bd4ea15e38..0e87432d58 100644 --- a/code/client/clrcore-v2/BaseScript.cs +++ b/code/client/clrcore-v2/BaseScript.cs @@ -118,7 +118,8 @@ internal void Initialize() } } - m_state = State.Initialized | State.Enabled; + m_state = State.Initialized; + Enable(); } /// @@ -129,7 +130,6 @@ public void Enable() if (m_state == State.Uninitialized) { Initialize(); - OnEnable(); } else if ((m_state & State.Enabled) == 0) { @@ -234,7 +234,6 @@ public void RegisterTick(Func tick, bool stopOnException = false) { CoroutineRepeat newTick = new CoroutineRepeat(tick, stopOnException); m_tickList.Add(newTick); - newTick.Schedule(); } } @@ -309,7 +308,6 @@ internal void RegisterNuiCallback(string callbackName, DynFunc dynFunc) throw new NotImplementedException(); #endif m_nuiCallbacks.Add(callbackName, dynFunc); - Native.CoreNatives.RegisterNuiCallback(callbackName, dynFunc); } /// @@ -328,7 +326,6 @@ public void RegisterNuiCallback(string callbackName, Delegate delegateFn) #endif DynFunc dynFunc = Func.Create(delegateFn); m_nuiCallbacks.Add(callbackName, dynFunc); - Native.CoreNatives.RegisterNuiCallback(callbackName, dynFunc); } /// diff --git a/code/client/clrcore-v2/Interop/EventsManager.cs b/code/client/clrcore-v2/Interop/EventsManager.cs index 58ce9878f6..8ab6e60df0 100644 --- a/code/client/clrcore-v2/Interop/EventsManager.cs +++ b/code/client/clrcore-v2/Interop/EventsManager.cs @@ -138,7 +138,6 @@ public EventHandlerSet(string eventName) public EventHandlerSet Add(DynFunc deleg, Binding binding = Binding.Local) { m_handlers.Add(deleg); - EventsManager.AddEventHandler(m_eventName, deleg, binding); return this; }