AkiraPixelWind/Assets/Scripts/Main/UI/UIMgr/InformMainThread.cs
2022-12-29 18:20:40 +08:00

31 lines
813 B
C#

using System.Collections.Concurrent;
using UnityEngine;
public class InformMainThread : MonoBehaviour {
public static InformMainThread Instance;
public ConcurrentQueue<eInformId> informIdCache = new ConcurrentQueue<eInformId>();
public ConcurrentQueue<string> informIdLuaCache = new ConcurrentQueue<string>();
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);
}
}