using System.Collections.Concurrent; using UnityEngine; public class InformMainThread : MonoBehaviour { public static InformMainThread Instance; public ConcurrentQueue informIdCache = new ConcurrentQueue(); public ConcurrentQueue informIdLuaCache = new ConcurrentQueue(); private void Awake() { Instance = this; } private void Update() { while (informIdCache.TryDequeue(out eInformId id) == true) { Inform.Dispatch(id); } //while (informIdLuaCache.TryDequeue(out string idLua) == true) { // XLuaManager.Instance.DoString("LuaGame.inform:Dispatch(\"" + idLua + "\")"); //} } public void Dispatch(eInformId _informId) { informIdCache.Enqueue(_informId); } public void DispatchLua(string _informId) { informIdLuaCache.Enqueue(_informId); } }