优化属性更新逻辑

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2024-09-22 03:27:16 +08:00
parent c59ebd6280
commit 81fee86ba7
54 changed files with 271 additions and 97 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using JNGame.Util;
using UnityEngine;
namespace Plugins.JNGame.Util
@@ -107,6 +108,30 @@ namespace Plugins.JNGame.Util
}
}
}
/// <summary>
/// 主线程分发事件 [禁止帧同步中使用主线分发事件]
/// </summary>
public void TryMainDispatch<T>(string eventId, T args)
{
UnityMainThreadDispatcher.Instance.Enqueue(() =>
{
try
{
Dispatch<T>(eventId,args);
}catch(Exception e){Debug.LogError(e.Message);}
});
}
public void TryMainDispatch(string eventId)
{
UnityMainThreadDispatcher.Instance.Enqueue(() =>
{
try
{
Dispatch(eventId);
}catch(Exception e){Debug.LogError(e.Message);}
});
}
public void Reset()
{