feat: update Godot integration and coordinated package dependencies
This commit is contained in:
15 files changed
+576
-55
No files matched your search
@@ -37,7 +37,8 @@ namespace ShrinkEventBus
|
||||
}
|
||||
|
||||
#if UNITY_5_3_OR_NEWER
|
||||
internal sealed class ShrinkUnityMainThreadDispatcher : MainThreadDispatcherContract
|
||||
internal sealed class ShrinkUnityMainThreadDispatcher : MainThreadDispatcherContract,
|
||||
ShrinkSDK.Runtime.IShrinkDeferredMainThreadDispatcher
|
||||
{
|
||||
public bool IsMainThread => Cysharp.Threading.Tasks.PlayerLoopHelper.IsMainThread;
|
||||
|
||||
@@ -50,9 +51,20 @@ namespace ShrinkEventBus
|
||||
action);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryPostDeferred(Action action)
|
||||
{
|
||||
if (action == null)
|
||||
throw new ArgumentNullException(nameof(action));
|
||||
Cysharp.Threading.Tasks.PlayerLoopHelper.AddContinuation(
|
||||
Cysharp.Threading.Tasks.PlayerLoopTiming.Update,
|
||||
action);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#else
|
||||
internal sealed class ShrinkSynchronizationContextDispatcher : MainThreadDispatcherContract
|
||||
internal sealed class ShrinkSynchronizationContextDispatcher : MainThreadDispatcherContract,
|
||||
ShrinkSDK.Runtime.IShrinkDeferredMainThreadDispatcher
|
||||
{
|
||||
private readonly SynchronizationContext? _context;
|
||||
private readonly int _threadId;
|
||||
@@ -79,6 +91,16 @@ namespace ShrinkEventBus
|
||||
_context.Post(static state => ((Action)state!).Invoke(), action);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool TryPostDeferred(Action action)
|
||||
{
|
||||
if (action == null)
|
||||
throw new ArgumentNullException(nameof(action));
|
||||
if (_context == null)
|
||||
return false;
|
||||
_context.Post(static state => ((Action)state!).Invoke(), action);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in new issue
Block a user