12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using System;
- using System.Threading;
- using CScript.Utilities;
- namespace CScript.Net
- {
- public class NetGlobal : Singleton<NetGlobal>
- {
- public List<Action> list_action = new List<Action>();
- private List<Action> list_actiondream = new List<Action>();
- 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();
- }
- }
- }
|