예제 #1
0
    public override IEnumerator OnRemoveFromStack()
    {
        if (ShowUIBlocker)
        {
            mTrigger  = null;
            mCollider = null;
            mBlocker  = null;
        }

        Show(false);

        Option = null;
        if (mClearQueue)
        {
            mQueue.Clear();
        }

        yield return(new WaitForEndOfFrame());

        if (mQueue.Count > 0)
        {
            Show(mQueue.Dequeue());
        }
        else if (!IsOpen())
        {
            DestroySelf();
        }
    }
예제 #2
0
    // recursively fine the transform include inRoot and the whole hierarchy under the inRoot, this also include the object that is deactivate
    public static Transform SearchHierarchyForBone(Transform inRoot, string inName, bool ignoreDisabled = false)
    {
        if (inRoot == null || inName.Length <= 0)
        {
            return(null);
        }
        // check if the current bone is the bone we're looking for, if so return it
        if (inRoot.name.Equals(inName))
        {
            return(inRoot);
        }

        EB.Collections.Queue <Transform> queue = new EB.Collections.Queue <Transform>(16);
        Transform result = null;

        queue.Enqueue(inRoot);
        while (queue.Count > 0)
        {
            Transform it = queue.Dequeue();
            result = it.Find(inName);
            if (result && (!ignoreDisabled || result.gameObject.activeInHierarchy))
            {
                return(result);
            }

            int childCount = it.childCount;
            for (int i = 0; i < childCount; ++i)
            {
                queue.Enqueue(it.GetChild(i));
            }
        }
        return(null);
    }
예제 #3
0
    public static List <TriangleMeshNode> GetAllNodesInRadius(Vector3 origin, float radius)
    {
        //float radiusSquared = radius * radius;

        TriangleMeshNode root = AStarPathfindingUtils.GetNearestNodeOnNavMesh(origin);

        List <TriangleMeshNode> validNodes = new List <TriangleMeshNode>();

        EB.Collections.Queue <TriangleMeshNode> toCheck = new EB.Collections.Queue <TriangleMeshNode>();
        HashSet <TriangleMeshNode> visited = new HashSet <TriangleMeshNode>();

        toCheck.Enqueue(root);
        while (toCheck.Count > 0)
        {
            TriangleMeshNode curNode = toCheck.Dequeue();

            if (SphereXZTriangleIntersect(origin, radius, (Vector3)curNode.GetVertex(0), (Vector3)curNode.GetVertex(1), (Vector3)curNode.GetVertex(2)))
            {
                validNodes.Add(curNode);
                for (int i = 0; i < curNode.connections.Length; i++)
                {
                    TriangleMeshNode connection = curNode.connections[i] as TriangleMeshNode;
                    if (!visited.Contains(connection))
                    {
                        toCheck.Enqueue(connection);
                    }
                }
            }

            visited.Add(curNode);
        }

        return(validNodes);
    }
예제 #4
0
 public void SetMovementTargetQueue(EB.Collections.Queue <Vector3> movePosQue, System.Action onEndCallback)
 {
     _movePosQue           = movePosQue;
     _onMoveEndActionByQue = onEndCallback;
     GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.AlliancesManager", "RecordTransferPointFromILRWithCallback", _movePosQue.Count - 1);
     SetMovementTarget(_movePosQue.Dequeue(), false, true, false, true);
 }
예제 #5
0
 /// <summary>
 /// 清除队列中的ui
 /// </summary>
 public void ClearEnstackQueue()
 {
     while (_toEnstackWhenPossible.Count > 0)
     {
         IStackableUI stackable = _toEnstackWhenPossible.Dequeue();
         if (stackable is Component)
         {
             Component c = (Component)stackable;
             if (c != null && c.transform.parent != null)
             {
                 c.gameObject.CustomSetActive(false);
                 Destroy(c.gameObject);
             }
         }
     }
 }
예제 #6
0
    public static Dictionary <int, GameObject> FindIndexedComponents(Transform root)
    {
        Dictionary <int, GameObject> allComponents = new Dictionary <int, GameObject>();

        EB.Collections.Queue <Transform> queue = new EB.Collections.Queue <Transform>(16);
        queue.Enqueue(root);
        while (queue.Count > 0)
        {
            Transform            it      = queue.Dequeue();
            IndexedZoneComponent indexer = it.GetComponent <IndexedZoneComponent>();

            if (indexer != null)
            {
                allComponents.Add(indexer.Index, indexer.gameObject);
            }

            int childCount = it.childCount;
            for (int i = 0; i < childCount; ++i)
            {
                queue.Enqueue(it.GetChild(i));
            }
        }

        return(allComponents);
    }
예제 #7
0
 /// <summary>
 /// 更新数据:从刷新列表拿去刷新之前是的数据
 /// </summary>
 private void ProcessUpdateLookupsCallsStack()
 {
     while (updateLookupsCallsStack.Count > 0)
     {
         UpdateLookupsCall call = updateLookupsCallsStack.Dequeue();
         UpdateLookups(call.DataID, call.Value);
     }
 }
예제 #8
0
 public bool MoveToNextPos()
 {
     if (_movePosQue.Count > 0)
     {
         GlobalUtils.CallStaticHotfix("Hotfix_LT.UI.AlliancesManager", "RecordTransferPointFromILRWithCallback", _movePosQue.Count - 1);
         SetMovementTarget(_movePosQue.Dequeue(), false, true, false, true);
         return(true);
     }
     else if (_onMoveEndActionByQue != null)
     {
         _onMoveEndActionByQue();
         _onMoveEndActionByQue = null;
     }
     return(false);
 }
예제 #9
0
 void Update()
 {
     if (_loads.Count > 0)
     {
         if (_concurrentRequests < kMaxConcurrentRequests)
         {
             var textureName = _loads.Dequeue();
             var info        = GetTextureInfo(textureName);
             if (info != null && info.texture == null)
             {
                 _concurrentRequests++;
                 StartCoroutine(ProcessNextTexture(info));
             }
         }
     }
 }
예제 #10
0
        public object GetNext()
        {
            object next = null;

            if (_inactive.Count == 0)
            {
                next = System.Activator.CreateInstance(_type);
            }
            else
            {
                next = _inactive.Dequeue();
            }

            (next as IPoolable).OnPoolActivate();
            _active.Add(next);

            return(next);
        }
예제 #11
0
        public T GetNext()
        {
            T next = default(T);

            if (_inactive.Count == 0)
            {
                next = new T();
            }
            else
            {
                next = _inactive.Dequeue();
            }

            next.OnPoolActivate();
            _active.Add(next);

            return(next);
        }
예제 #12
0
    private IDebuggable[] GetAllSystemsFromPath(string systemPath, IDebuggable parent = null)
    {
        if (systemPath == null)
        {
            return(new IDebuggable[0]);
        }

        string[] names = systemPath.Split('/');
        if (names.Length == 0)
        {
            return(new IDebuggable[0]);
        }

        EB.Collections.Queue <IDebuggable> currents = new EB.Collections.Queue <IDebuggable>();
        foreach (IDebuggable sys in GetAllSystemsFromName(names[0]))
        {
            if (_gameSystems[sys].parent == parent && _gameSystems[sys].systemName == names[0])
            {
                currents.Enqueue(sys);
            }
        }

        for (int i = 1; i < names.Length; i++)
        {
            while (currents.Count > 0 && _gameSystems[currents.Peek()].systemName == names[i - 1])
            {
                foreach (IDebuggable sub in _gameSystems[currents.Dequeue()].subSystems)
                {
                    if (_gameSystems[sub].systemName == names[i])
                    {
                        currents.Enqueue(sub);
                    }
                }
            }
        }

        return(currents.ToArray());
    }