/// <summary>
 /// 停止运行单个
 /// </summary>
 /// <param name="id"></param>
 /// <param name="callback"></param>
 public void StopOnThread(int id, T2 callback)
 {
     lock (lockObj)
     {
         LoomLinkList <T1, T2> linkList = null;
         if (_current.ContainsKey(id))
         {
             linkList = _current[id];
         }
         else if (_Actions.ContainsKey(id))
         {
             linkList = _Actions[id];
         }
         if (linkList == null)
         {
             return;
         }
         LoomThreadObject <T2> currentNode = linkList.Head as LoomThreadObject <T2>;
         while (currentNode != null)
         {
             if ((object)currentNode.callback == (object)callback)
             {
                 currentNode.OnStop();
                 break;
             }
             currentNode = currentNode.Next as LoomThreadObject <T2>;
         }
     }
 }
 public void OnUpdate()
 {
     if (_current.Count == 0 && _Actions.Count == 0)
     {
         _hasAction = false;
         return;
     }
     _currentKeys = new List <int>(_current.Keys);
     for (int i = 0; i < _currentKeys.Count; i++)
     {
         LoomLinkList <T1, T2> linkList = _current[_currentKeys[i]];
         if (linkList.status == "END")
         {
             lock (lockObj)
             {
                 _current.Remove(_currentKeys[i]);
             }
             continue;
         }
         linkList.OnUpdate();
     }
     if (_currentKeys.Count < maxMainThreads)
     {
         if (_Actions.Count > 0)
         {
             lock (lockObj)
             {
                 List <int> _ActionKeys = new List <int>(_Actions.Keys);
                 _current[_ActionKeys[0]] = _Actions[_ActionKeys[0]];
                 _Actions.Remove(_ActionKeys[0]);
             }
         }
     }
 }
            public string GetLinkCurrentNodeStatus(int id)
            {
                LoomLinkList <T1, T2> link = null;

                _current.TryGetValue(id, out link);
                if (link != null)
                {
                    return(link.currentNodeStatus);
                }
                return("NONE");
            }
            public int GetLinkNodeRunIndex(int id)
            {
                LoomLinkList <T1, T2> link = null;

                _current.TryGetValue(id, out link);
                if (link != null)
                {
                    return(link.RunIndex);
                }
                return(-1);
            }
            public int GetLinkNodeCount(int id)
            {
                LoomLinkList <T1, T2> link = null;

                _current.TryGetValue(id, out link);
                if (link != null)
                {
                    return(link.Count);
                }
                return(0);
            }
 /// <summary>
 /// 添加到自定义系列
 /// </summary>
 /// <param name="id"></param>
 /// <param name="callback"></param>
 public void QueueOnThread(int id, T2 callback)
 {
     lock (lockObj)
     {
         LoomLinkList <T1, T2> actions = null;
         if (!_current.ContainsKey(id))
         {
             if (_current.Count >= maxThread)
             {
                 if (!_Actions.ContainsKey(id))
                 {
                     _Actions[id] = new LoomLinkList <T1, T2>();
                 }
                 actions = _Actions[id];
                 T1 t1 = new T1();
                 t1.callback = callback;
                 actions.AppendNode(t1);
             }
             else
             {
                 _current[id] = new LoomLinkList <T1, T2>();
                 actions      = _current[id];
                 T1 t1 = new T1();
                 t1.callback = callback;
                 actions.AppendNode(t1);
                 actions.OnStart();
             }
         }
         else
         {
             actions = _current[id];
             T1 t1 = new T1();
             t1.callback = callback;
             actions.AppendNode(t1);
             actions.OnStart();
         }
         _hasAction = true;
     }
 }