using UnityEngine; using System.Collections; using System.Collections.Generic; using System; using System.Threading; using CScript.Utilities; namespace CScript.Net { public class NetGlobal : Singleton { public List list_action = new List(); private List list_actiondream = new List(); private Mutex mutex_actionList = new Mutex(); public string serverIP; public int udpSendPort; public int userUid; public void AddAction(Action _action) { //Debug.Log("AddAction"); mutex_actionList.WaitOne(); list_action.Add(_action); mutex_actionList.ReleaseMutex(); } public void AddActionDream(Action _action) { mutex_actionList.WaitOne(); list_actiondream.Add(_action); Debug.Log("Action Dream "+ list_actiondream.Count); mutex_actionList.ReleaseMutex(); } public void DoForAction() { mutex_actionList.WaitOne(); for (int i = 0; i < list_action.Count; i++) { list_action[i](); } //for (int i = 0; i < 1; i++) //{ // list_actiondream[i](); //} // list_actiondream.Clear(); list_action.Clear(); mutex_actionList.ReleaseMutex(); } } }