예제 #1
0
 public void Set(object checkTimeout, DateTime timeout, int idnetity, callbackType type)
 {
     Timeout           = timeout;
     this.checkTimeout = checkTimeout;
     this.identity     = idnetity;
     this.type         = type;
 }
예제 #2
0
 /// <summary>
 /// 添加超时回调信息
 /// </summary>
 /// <param name="checkTimeout">是否超时判断</param>
 /// <param name="identity">超时判断标识</param>
 /// <param name="type">超时回调类型</param>
 internal void Add(object checkTimeout, int identity, callbackType type)
 {
     for (queueNode node = endNode; node.Add(checkTimeout, identity, type) == 0; node = endNode)
     {
         Monitor.Enter(endNodeLock);
         if (node == endNode)
         {
             Exception exception = null;
             try
             {
                 endNode.NextNode = queueNode.Get(timeoutTicks);
                 endNode          = endNode.NextNode;
             }
             catch (Exception error)
             {
                 exception = error;
             }
             finally { Monitor.Exit(endNodeLock); }
             if (exception != null)
             {
                 log.Error.Add(exception, null, false);
                 return;
             }
         }
         else
         {
             Monitor.Exit(endNodeLock);
         }
     }
     if (Interlocked.CompareExchange(ref isTask, 1, 0) == 0)
     {
         fastCSharp.threading.timerTask.Default.Add(this, thread.callType.TimeoutQueueCheck, date.Now.AddTicks(timeoutTicks));
     }
 }
예제 #3
0
 /// <summary>
 /// 添加超时回调信息
 /// </summary>
 /// <param name="checkTimeout">是否超时判断</param>
 /// <param name="socket">套接字</param>
 /// <param name="identity">超时判断标识</param>
 /// <param name="type">超时回调类型</param>
 /// <returns></returns>
 public int Add(object checkTimeout, Socket socket, int identity, callbackType type)
 {
     Monitor.Enter(callbackLock);
     if (endIndex == callbacks.Length)
     {
         Monitor.Exit(callbackLock);
         return(0);
     }
     callbacks[endIndex++].Set(checkTimeout, date.nowTime.Now.AddTicks(timeoutTicks), socket, identity, type);
     Monitor.Exit(callbackLock);
     return(1);
 }
예제 #4
0
    public static void Activate(callbackType _callback)
    {
        callback = _callback;
        _picker  = MenuListener.FindInActiveObjectByName("PawnPicker");
        _picker.SetActive(true);
        //Instantiate(MenuListener.FindInActiveObjectByName("PawnPicker"));
        //MenuListener.FindInActiveObjectByName("PawnPicker").SetActive(true);
        //GameManager.instance.board_picker.SetActive(true);

        /*
         * foreach (Transform child in GameManager.instance.board.transform)
         * {
         *  if (child.name == "PawnPicker")
         *  {
         *      //MenuListener.FindInActiveObjectByName("DDDText").SetActive(true);
         *      child.gameObject.SetActive(true);
         *      Debug.Log("Child found. Mame: " + child.name);
         *      break;
         *  }
         * }*/
    }