예제 #1
0
    /// <summary>
    /// Destroy all draw calls we've created when this script gets disabled.
    /// </summary>

    void OnDisable()
    {
        for (int i = mDrawCalls.size; i > 0;)
        {
            UIDrawCall dc = mDrawCalls.buffer[--i];
            if (dc != null)
            {
                NGUITools.DestroyImmediate(dc.gameObject);
            }
        }
        mDrawCalls.Clear();
        mChanged.Clear();
        mChildren.Clear();
    }
    /// <summary>
    /// Finish the typewriter operation and show all the text right away.
    /// </summary>

    public void Finish()
    {
        if (mActive)
        {
            mActive = false;

            if (!mReset)
            {
                mCurrentOffset = mFullText.Length;
                mFade.Clear();
                mLabel.text = mFullText;
            }

            if (keepFullDimensions && scrollView != null)
            {
                scrollView.UpdatePosition();
            }

            current = this;
            EventDelegate.Execute(onFinished);
            current = null;
        }
    }
예제 #3
0
파일: UILabel.cs 프로젝트: vcan/CapsUnity
    /// <summary>
    /// Return the index of the character at the specified local position.
    /// </summary>

    public int GetCharacterIndex(Vector2 localPos)
    {
        if (isValid)
        {
            string text = processedText;
            if (string.IsNullOrEmpty(text))
            {
                return(0);
            }
            float pixelSize = (mFont != null) ? mFont.pixelSize : 1f;
            float scale     = mScale * pixelSize;
            bool  usePS     = usePrintedSize;

            if (usePS)
            {
                UpdateNGUIText(mPrintedSize, mWidth, mHeight);
            }
            else
            {
                UpdateNGUIText(fontSize, Mathf.RoundToInt(mWidth / scale), mHeight);
            }

            NGUIText.PrintCharacterPositions(text, mTempVerts, mTempIndices);

            if (mTempVerts.size > 0)
            {
                ApplyOffset(mTempVerts, usePS, scale, 0);
                int retVal = NGUIText.GetClosestCharacter(mTempVerts, localPos);
                retVal = mTempIndices[retVal];

                mTempVerts.Clear();
                mTempIndices.Clear();
                return(retVal);
            }
        }
        return(0);
    }
예제 #4
0
 public void ReleaseVertex()
 {
     for (int i = m_aSprite.size - 1; i >= 0; --i)
     {
         HUDVertex v = m_aSprite[i];
         if (v.hudMesh != null)
         {
             v.hudMesh.EraseHUDVertex(v);
         }
         v.hudMesh = null;
         HUDVertex.ReleaseVertex(v);
         m_aSprite[i] = null;
     }
     m_aSprite.Clear();
 }
    public void ReleaseAllDelayUnloadAssetBundles()
    {
        int i = 0;

        for (int size = delayUnloadAssetBundles.size; i < size; i++)
        {
            DelayUnloadAssetBundle obj = delayUnloadAssetBundles[i];
            if (GetCachedPackage(obj.name) != null)
            {
                obj.assetBundle = null;
            }
            DelayUnloadAssetBundle.Release(ref obj);
        }
        delayUnloadAssetBundles.Clear();
    }
예제 #6
0
    private void OnDisable()
    {
        int num = mDrawCalls.size;

        while (num > 0)
        {
            UIDrawCall uIDrawCall = mDrawCalls.buffer[--num];
            if (uIDrawCall != null)
            {
                NGUITools.DestroyImmediate(uIDrawCall.gameObject);
            }
        }
        mDrawCalls.Clear();
        mChanged.Clear();
    }
예제 #7
0
    public static void ReleaseInactive()
    {
        //IL_002c: Unknown result type (might be due to invalid IL or missing references)
        //IL_0031: Expected O, but got Unknown
        int num = mInactiveList.size;

        while (num > 0)
        {
            UIDrawCall uIDrawCall = mInactiveList[--num];
            if (Object.op_Implicit(uIDrawCall))
            {
                NGUITools.DestroyImmediate(uIDrawCall.get_gameObject());
            }
        }
        mInactiveList.Clear();
    }
예제 #8
0
    private void OnDisable()
    {
        var size = mDrawCalls.size;

        while (size > 0)
        {
            var call = mDrawCalls.buffer[--size];
            if (call != null)
            {
                NGUITools.DestroyImmediate(call.gameObject);
            }
        }

        mDrawCalls.Clear();
        mChanged.Clear();
    }
예제 #9
0
 static void PullFromCachedGeometries <T>(int vertexCount, SortedDictionary <int, Stack <BetterList <T> > > cache, ref BetterList <T> source)
 {
     foreach (var pair in cache)
     {
         if (pair.Key >= vertexCount && pair.Value.Count > 0)
         {
             source = pair.Value.Pop();
             source.Clear();
             return;
         }
     }
     if (source.buffer == null || source.buffer.Length < vertexCount)
     {
         source.buffer = new T[Mathf.Max(vertexCount, 32)];
     }
 }
예제 #10
0
    /// <summary>
    /// Recalculate all snapping edges.
    /// </summary>

    static public void Recalculate(Object obj)
    {
        mSnapCenter.Clear();
        mSnapCorners.Clear();

        if (obj is UIWidget)
        {
            UIWidget w = obj as UIWidget;
            Recalculate(w.cachedTransform);
        }
        else if (obj is UIPanel)
        {
            UIPanel p = obj as UIPanel;
            Recalculate(p.cachedTransform);
        }
    }
예제 #11
0
    /// <summary>
    /// Destroy all draw calls we've created when this script gets disabled.
    /// </summary>

    void OnDisable()
    {
        mParent = null;

        for (int i = mDrawCalls.size; i > 0;)
        {
            UIDrawCall dc = mDrawCalls.buffer[--i];

            if (dc != null)
            {
                UIDrawCall.list.Remove(dc);
                NGUITools.DestroyImmediate(dc.gameObject);
            }
        }
        mDrawCalls.Clear();
        list.Remove(this);
    }
예제 #12
0
 //播放特效
 public virtual void Play()
 {
     if (!isContinue)
     {
         if ((attackerCs.mCurMobalId == MobaObjectID.HeroXiongmao && mCurSkillNode.site == 1) ||
             (attackerCs.mCurMobalId == MobaObjectID.HeroHuonv && mCurSkillNode.site == 3) ||
             (attackerCs.mCurMobalId == MobaObjectID.HeroTongkunvwang && mCurSkillNode.site == 4) ||
             (attackerCs.mCurMobalId == MobaObjectID.HeroShawang && mCurSkillNode.site == 1) ||
             (attackerCs.mCurMobalId == MobaObjectID.HeroShengqi && mCurSkillNode.site == 1) ||
             (attackerCs.mCurMobalId == MobaObjectID.HeroChenmo && mCurSkillNode.site == 1) ||
             (attackerCs.mCurMobalId == MobaObjectID.HeroShenniu && mCurSkillNode.site == 3) ||
             (attackerCs.mCurMobalId == MobaObjectID.HeroMori && mCurSkillNode.site == 2) ||
             (attackerCs.mCurMobalId == MobaObjectID.HeroXiaoxiao && mCurSkillNode.site == 3) ||
             (attackerCs.mCurMobalId == MobaObjectID.HeroXiaolu && mCurSkillNode.site == 3) ||
             (attackerCs.mCurMobalId == MobaObjectID.HeroLuosa && (mCurSkillNode.site == 2 || mCurSkillNode.site == 4)) ||
             GameLibrary.Instance().CheckNotHeroBoss(attackerCs) ||
             GameLibrary.Instance().CheckIsEliteMonster(attackerCs))
         {
             attackerCs.HitActionDelegate += SingleHitDamage;
         }
         else
         {
             if (attackerCs.mCurMobalId == MobaObjectID.HeroXiongmao && mCurSkillNode.site == 4)
             {
                 CDTimer.GetInstance().AddCD(0.8f, HitTarget, 1);
             }
             else
             {
                 Hit(GetDamageTarget());
             }
         }
     }
     else
     {
         cds.Clear();
         int count = mCurSkillNode.interval_time.Length;
         for (int i = 0; i < count; i++)
         {
             if (i == count - 1 && attackerCs.mCurMobalId == MobaObjectID.HeroHuonv && mCurSkillNode.site == 4)
             {
                 cds.Add(CDTimer.GetInstance().AddCD(mCurSkillNode.interval_time[i], DestoryMe, 1));
             }
             cds.Add(CDTimer.GetInstance().AddCD(mCurSkillNode.interval_time [i], HitTarget, 1));
         }
     }
 }
예제 #13
0
    //清除池中的Item
    public void ClearItemsInPool(string itemTypeName)
    {
        BetterList <GameObject> list = GetList(itemTypeName);

        if (list == null)
        {
            return;
        }

        foreach (var obj in list)
        {
            obj.transform.parent = null;
            GameObject.Destroy(obj);
        }

        list.Clear();
    }
예제 #14
0
    public void Destroy()
    {
        if (logMessages)
        {
            Debug.Log(string.Format("SpawnPool {0}: Destroying...", loadType.ToString()));
        }

        ClearCache();
        if (prefabPools != null)
        {
            for (int i = 0; i < prefabPools.size; ++i)
            {
                prefabPools[i].Destroy();
            }

            prefabPools.Clear();
        }
    }
예제 #15
0
    /// <summary>
    /// Clear all draw calls.
    /// </summary>

    static public void ClearAll()
    {
        bool playing = Application.isPlaying;

        for (int i = mActiveList.size; i > 0;)
        {
            UIDrawCall dc = mActiveList[--i];
            if (playing)
            {
                NGUITools.SetActive(dc.gameObject, false);
            }
            else
            {
                NGUITools.DestroyImmediate(dc.gameObject);
            }
        }
        mActiveList.Clear();
    }
예제 #16
0
    /// <summary>
    /// Immediately destroy all inactive draw calls (draw calls that have been recycled and are waiting to be re-used).
    /// </summary>

    static public void ReleaseInactive()
    {
        for (int i = mInactiveList.size; i > 0;)
        {
            UIDrawCall dc = mInactiveList[--i];

            if (dc)
            {
#if SHOW_HIDDEN_OBJECTS && UNITY_EDITOR
                if (UnityEditor.Selection.activeGameObject == dc.gameObject)
                {
                    UnityEditor.Selection.activeGameObject = null;
                }
#endif
                NGUITools.DestroyImmediate(dc.gameObject);
            }
        }
        mInactiveList.Clear();
    }
예제 #17
0
 internal void Clear()
 {
     pathComplete = false;
     foreach (PathNode pn in closed)
     {
         Arr[pn.loc.X, pn.loc.Y] = null;
     }
     foreach (PathNode pn in openNodes.Keys)
     {
         Arr[pn.loc.X, pn.loc.Y] = null;
     }
     foreach (PathNode pn in listONodes)
     {
         Arr[pn.loc.X, pn.loc.Y] = null;
     }
     start = null;
     dest  = null;
     closed.Clear();
     openNodes.Clear();
 }
예제 #18
0
 private void DeletePackageObjects()
 {
     if (MonoBehaviourSingleton <ResourceManager> .I.isLoading || InstantiateManager.isBusy)
     {
         requestDeletePackageObjects = true;
     }
     else
     {
         int i = 0;
         for (int size = deletePackageObjects.size; i < size; i++)
         {
             PackageObject obj = deletePackageObjects[i];
             if (obj != null)
             {
                 PackageObject.Release(ref obj);
             }
         }
         deletePackageObjects.Clear();
         RequestUnloadUnusedAssets();
     }
 }
    void OnPostFill(UIWidget widget, BetterList <Vector3> verts, BetterList <Vector2> uvs, BetterList <Color32> cols)
    {
        //if (mSp.localSize.y > (spriteHeight * .9f))
        //    return;
        Vector4 v = mSp.drawingDimensions;
        Vector4 u = new Vector4(uvs[0].x, uvs[0].y, uvs[2].x, uvs[1].y);
        Color32 c = cols[0];

        verts.Clear();
        uvs.Clear();
        cols.Clear();

        int   count    = pieceCount;
        float rangeY   = (v.w - v.y) / (float)count;
        float rangeUvY = (u.w - u.y) / (float)count;

        for (int i = 0; i < count; i++)
        {
            Color32 mColor  = c;
            float   randomX = Random.Range(-shakeRange, shakeRange);
            if (isEnd)
            {
                randomX = 0;
            }
            verts.Add(new Vector3(v.x + randomX, rangeY * i + v.y));
            verts.Add(new Vector3(v.x + randomX, rangeY * (i + 1) + v.y));
            verts.Add(new Vector3(v.z + randomX, rangeY * (i + 1) + v.y));
            verts.Add(new Vector3(v.z + randomX, rangeY * i + v.y));

            uvs.Add(new Vector2(u.x, rangeUvY * i + u.y));
            uvs.Add(new Vector2(u.x, rangeUvY * (i + 1) + u.y));
            uvs.Add(new Vector2(u.z, rangeUvY * (i + 1) + u.y));
            uvs.Add(new Vector2(u.z, rangeUvY * i + u.y));

            cols.Add(mColor);
            cols.Add(mColor);
            cols.Add(mColor);
            cols.Add(mColor);
        }
    }
예제 #20
0
        public void Update()
        {
            if (_funcs.size > 0)
            {
                lock (_funcs)
                {
                    for (int i = 0, size = _funcs.size; i < size; ++i)
                    {
                        Action func = _funcs[i];
                        try
                        {
                            func();
                        }catch (Exception e)
                        {
                            Debug.LogException(e);
                        }
                    }

                    _funcs.Clear();
                }
            }

            while (true)
            {
                Message msg = _queue.Dequeue();
                if (msg == null)
                {
                    break;
                }

                try
                {
                    msg.Handle();
                }catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }
        }
예제 #21
0
    public static void ClearAll()
    {
        bool isPlaying = Application.isPlaying;
        int  num       = mActiveList.size;

        while (num > 0)
        {
            UIDrawCall uIDrawCall = mActiveList[--num];
            if ((bool)uIDrawCall)
            {
                if (isPlaying)
                {
                    NGUITools.SetActive(uIDrawCall.gameObject, state: false);
                }
                else
                {
                    NGUITools.DestroyImmediate(uIDrawCall.gameObject);
                }
            }
        }
        mActiveList.Clear();
    }
예제 #22
0
    protected virtual void BuildMesh()
    {
        _verts.Clear();
        _tris.Clear();
        _colours.Clear();

        //---

        int vc = _verts.size;

        //UtilShape.BuildSphere(Vector3.zero, Quaternion.identity, Vector3.one, 24, 16,
        //	ref _verts, ref _tris);

        for (int i = vc; i < _verts.size; ++i)
        {
            _colours.Add(Color.white);
        }
        vc = _verts.size;

        UtilShape.BuildSphere(new Vector3(0f, 0f, 0f), Quaternion.identity, Vector3.one * 1f,
                              12, 8, ref _verts, ref _tris);

        for (int i = vc; i < _verts.size; ++i)
        {
            _colours.Add(Color.cyan);
        }
        vc = _verts.size;


        //---

        _mf.mesh.Clear();
        _mf.mesh.vertices  = _verts.ToArray();
        _mf.mesh.triangles = _tris.ToArray();
        _mf.mesh.colors    = _colours.ToArray();
        _mf.mesh.RecalculateBounds();
        _mf.mesh.RecalculateNormals();
    }
예제 #23
0
    void CheckObjLoaded()
    {
        if (imageList.size == transform.childCount && imageList.size == transList.size && imageList.size == rectTransList.size)
        {
            return;
        }

        imageList.Clear();
        transList.Clear();
        rectTransList.Clear();

        if (transform.childCount == 0)
        {
            for (int i = 0; i < numCount; i++)
            {
                imageList.Add(NewObj());
            }
        }
        else
        {
            for (int i = 0; i < transform.childCount; i++)
            {
                imageList.Add(transform.GetChild(i).gameObject.GetComponent <Image>());
            }
        }

        for (int i = 0; i < imageList.size; i++)
        {
            transList.Add(imageList[i].transform);
        }

        for (int i = 0; i < imageList.size; i++)
        {
            rectTransList.Add(imageList[i].rectTransform);
        }
    }
예제 #24
0
    /// <summary>
    /// Generate the height grid.
    /// </summary>

    protected override void Init()
    {
        mTrans = transform;

        // TODO:实际项目中,自己根据场景地图设置位置信息
        // 这里为了简单,战争迷雾Transform直接居中,原点位置为左下角
        mTrans.localPosition = new Vector3(0f, 0f, 0f);
        mOrigin    = mTrans.position;
        mOrigin.x -= worldSize * 0.5f;
        mOrigin.z -= worldSize * 0.5f;

        mTextureSizeSqr = textureSize * textureSize;
        mBuffer0        = new Color32[mTextureSizeSqr];
        mBuffer1        = new Color32[mTextureSizeSqr];
        mBuffer2        = new Color32[mTextureSizeSqr];
        mRevealers.Clear();
        mRemoved.Clear();
        mAdded.Clear();

        // Add a thread update function -- all visibility checks will be done on a separate thread
        mThread     = new Thread(ThreadUpdate);
        mThreadWork = true;
        mThread.Start();
    }
예제 #25
0
    /// <summary>
    /// Set the draw call's geometry.
    /// </summary>

    public void UpdateGeometry()
    {
        int count = verts.size;

        // Safety check to ensure we get valid values
        if (count > 0 && (count == uvs.size && count == cols.size) && (count % 4) == 0)
        {
            // Cache all components
            if (mFilter == null)
            {
                mFilter = gameObject.GetComponent <MeshFilter>();
            }
            if (mFilter == null)
            {
                mFilter = gameObject.AddComponent <MeshFilter>();
            }

            if (verts.size < 65000)
            {
                // Populate the index buffer
                int  indexCount = (count >> 1) * 3;
                bool setIndices = (mIndices == null || mIndices.Length != indexCount);

                // Create the mesh
                if (mMesh == null)
                {
                    mMesh           = new Mesh();
                    mMesh.hideFlags = HideFlags.DontSave;
                    mMesh.name      = (mMaterial != null) ? mMaterial.name : "Mesh";
                    mMesh.MarkDynamic();
                    setIndices = true;
                }
#if !UNITY_FLASH
                // If the buffer length doesn't match, we need to trim all buffers
                bool trim = (uvs.buffer.Length != verts.buffer.Length) ||
                            (cols.buffer.Length != verts.buffer.Length) ||
                            (norms.buffer != null && norms.buffer.Length != verts.buffer.Length) ||
                            (tans.buffer != null && tans.buffer.Length != verts.buffer.Length);

                // Non-automatic render queues rely on Z position, so it's a good idea to trim everything
                if (!trim && panel.renderQueue != UIPanel.RenderQueue.Automatic)
                {
                    trim = (mMesh == null || mMesh.vertexCount != verts.buffer.Length);
                }

                // NOTE: Apparently there is a bug with Adreno devices:
                // http://www.tasharen.com/forum/index.php?topic=8415.0
                // According to version notes it's fixed in 4.5 rc5.
#if !UNITY_4_3 || !UNITY_ANDROID
                // If the number of vertices in the buffer is less than half of the full buffer, trim it
                if (!trim && (verts.size << 1) < verts.buffer.Length)
                {
                    trim = true;
                }
#endif
                mTriangles = (verts.size >> 1);

                if (trim || verts.buffer.Length > 65000)
                {
                    if (trim || mMesh.vertexCount != verts.size)
                    {
                        mMesh.Clear();
                        setIndices = true;
                    }

                    mMesh.vertices = verts.ToArray();
                    mMesh.uv       = uvs.ToArray();
                    mMesh.colors32 = cols.ToArray();

                    if (norms != null)
                    {
                        mMesh.normals = norms.ToArray();
                    }
                    if (tans != null)
                    {
                        mMesh.tangents = tans.ToArray();
                    }
                }
                else
                {
                    if (mMesh.vertexCount != verts.buffer.Length)
                    {
                        mMesh.Clear();
                        setIndices = true;
                    }

                    mMesh.vertices = verts.buffer;
                    mMesh.uv       = uvs.buffer;
                    mMesh.colors32 = cols.buffer;

                    if (norms != null)
                    {
                        mMesh.normals = norms.buffer;
                    }
                    if (tans != null)
                    {
                        mMesh.tangents = tans.buffer;
                    }
                }
#else
                mTriangles = (verts.size >> 1);

                if (mMesh.vertexCount != verts.size)
                {
                    mMesh.Clear();
                    setIndices = true;
                }

                mMesh.vertices = verts.ToArray();
                mMesh.uv       = uvs.ToArray();
                mMesh.colors32 = cols.ToArray();

                if (norms != null)
                {
                    mMesh.normals = norms.ToArray();
                }
                if (tans != null)
                {
                    mMesh.tangents = tans.ToArray();
                }
#endif
                if (setIndices)
                {
                    mIndices        = GenerateCachedIndexBuffer(count, indexCount);
                    mMesh.triangles = mIndices;
                }

#if !UNITY_FLASH
                if (trim || !alwaysOnScreen)
#endif
                mMesh.RecalculateBounds();

                mFilter.mesh = mMesh;
            }
            else
            {
                mTriangles = 0;
                if (mFilter.mesh != null)
                {
                    mFilter.mesh.Clear();
                }
                Debug.LogError("Too many vertices on one panel: " + verts.size);
            }

            if (mRenderer == null)
            {
                mRenderer = gameObject.GetComponent <MeshRenderer>();
            }

            if (mRenderer == null)
            {
                mRenderer = gameObject.AddComponent <MeshRenderer>();
#if UNITY_EDITOR
                mRenderer.enabled = isActive;
#endif
            }
            UpdateMaterials();
        }
        else
        {
            if (mFilter.mesh != null)
            {
                mFilter.mesh.Clear();
            }
            Debug.LogError("UIWidgets must fill the buffer with 4 vertices per quad. Found " + count);
        }

        verts.Clear();
        uvs.Clear();
        cols.Clear();
        norms.Clear();
        tans.Clear();
    }
예제 #26
0
 public static void PoolParamList(BetterList<CLS_Content.Value> paramList)
 {
     paramList.Clear();
     s_paramListPool.Add(paramList);
 }
예제 #27
0
    /// <summary>
    /// Read a single line of Comma-Separated Values from the file.
    /// </summary>

    public BetterList <string> ReadCSV()
    {
        mTemp.Clear();
        string line         = "";
        bool   insideQuotes = false;
        int    wordStart    = 0;

        while (canRead)
        {
            if (insideQuotes)
            {
                string s = ReadLine(false);
                if (s == null)
                {
                    return(null);
                }
                s     = s.Replace("\\n", "\n");
                line += "\n" + s;
            }
            else
            {
                line = ReadLine(true);
                if (line == null)
                {
                    return(null);
                }
                line      = line.Replace("\\n", "\n");
                wordStart = 0;
            }

            for (int i = wordStart, imax = line.Length; i < imax; ++i)
            {
                char ch = line[i];

                if (ch == ',')
                {
                    if (!insideQuotes)
                    {
                        mTemp.Add(line.Substring(wordStart, i - wordStart));
                        wordStart = i + 1;
                    }
                }
                else if (ch == '"')
                {
                    if (insideQuotes)
                    {
                        if (i + 1 >= imax)
                        {
                            mTemp.Add(line.Substring(wordStart, i - wordStart).Replace("\"\"", "\""));
                            return(mTemp);
                        }

                        if (line[i + 1] != '"')
                        {
                            mTemp.Add(line.Substring(wordStart, i - wordStart).Replace("\"\"", "\""));
                            insideQuotes = false;

                            if (line[i + 1] == ',')
                            {
                                ++i;
                                wordStart = i + 1;
                            }
                        }
                        else
                        {
                            ++i;
                        }
                    }
                    else
                    {
                        wordStart    = i + 1;
                        insideQuotes = true;
                    }
                }
            }

            if (wordStart < line.Length)
            {
                if (insideQuotes)
                {
                    continue;
                }
                mTemp.Add(line.Substring(wordStart, line.Length - wordStart));
            }
            return(mTemp);
        }
        return(null);
    }
예제 #28
0
    /// <summary>
    /// Returns the object under the specified position.
    /// </summary>

    static public bool Raycast(Vector3 inPos, out RaycastHit hit)
    {
        for (int i = 0; i < list.size; ++i)
        {
            UICamera cam = list.buffer[i];

            // Skip inactive scripts
            if (!cam.enabled || !NGUITools.GetActive(cam.gameObject))
            {
                continue;
            }

            // Convert to view space
            currentCamera = cam.cachedCamera;
            Vector3 pos = currentCamera.ScreenToViewportPoint(inPos);
            if (float.IsNaN(pos.x) || float.IsNaN(pos.y))
            {
                continue;
            }

            // If it's outside the camera's viewport, do nothing
            if (pos.x < 0f || pos.x > 1f || pos.y < 0f || pos.y > 1f)
            {
                continue;
            }

            // Cast a ray into the screen
            Ray ray = currentCamera.ScreenPointToRay(inPos);

            // Raycast into the screen
            int   mask = currentCamera.cullingMask & (int)cam.eventReceiverMask;
            float dist = (cam.rangeDistance > 0f) ? cam.rangeDistance : currentCamera.farClipPlane - currentCamera.nearClipPlane;

            if (cam.eventType == EventType.World)
            {
                if (Physics.Raycast(ray, out hit, dist, mask))
                {
                    hoveredObject = hit.collider.gameObject;
                    return(true);
                }
                continue;
            }
            else if (cam.eventType == EventType.UI)
            {
                RaycastHit[] hits = Physics.RaycastAll(ray, dist, mask);

                if (hits.Length > 1)
                {
                    for (int b = 0; b < hits.Length; ++b)
                    {
                        GameObject go = hits[b].collider.gameObject;
                        mHit.depth = NGUITools.CalculateRaycastDepth(go);

                        if (mHit.depth != int.MaxValue)
                        {
                            mHit.hit = hits[b];
                            mHits.Add(mHit);
                        }
                    }

                    mHits.Sort(delegate(DepthEntry r1, DepthEntry r2) { return(r2.depth.CompareTo(r1.depth)); });

                    for (int b = 0; b < mHits.size; ++b)
                    {
#if UNITY_FLASH
                        if (IsVisible(mHits.buffer[b]))
#else
                        if (IsVisible(ref mHits.buffer[b]))
#endif
                        {
                            hit           = mHits[b].hit;
                            hoveredObject = hit.collider.gameObject;
                            mHits.Clear();
                            return(true);
                        }
                    }
                    mHits.Clear();
                }
                else if (hits.Length == 1 && IsVisible(ref hits[0]))
                {
                    hit           = hits[0];
                    hoveredObject = hit.collider.gameObject;
                    return(true);
                }
                continue;
            }
        }
        hit = mEmpty;
        return(false);
    }
예제 #29
0
    /// <summary>
    /// Clear the context menu list.
    /// </summary>

    static public void Clear()
    {
        mEntries.Clear();
        mMenu = null;
    }
예제 #30
0
파일: UIPanel.cs 프로젝트: reaganq/mixabots
    /// <summary>
    /// Convenience function that figures out the panel's correct change flag by searching the parents.
    /// </summary>

    int GetChangeFlag(UINode start)
    {
        int flag = start.changeFlag;

        if (flag == -1)
        {
            Transform trans = start.trans.parent;
            UINode    sub;

            // Keep going until we find a set flag
            for (;;)
            {
                // Check the parent's flag
#if UNITY_FLASH
                if (trans != null && mChildren.TryGetValue(trans, out sub))
                {
#else
                if (trans != null && mChildren.Contains(trans))
                {
                    sub = (UINode)mChildren[trans];
#endif
                    flag  = sub.changeFlag;
                    trans = trans.parent;

                    // If the flag hasn't been set either, add this child to the hierarchy
                    if (flag == -1)
                    {
                        mHierarchy.Add(sub);
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    flag = 0;
                    break;
                }
            }

            // Update the parent flags
            for (int i = 0, imax = mHierarchy.size; i < imax; ++i)
            {
                UINode pc = mHierarchy.buffer[i];
                pc.changeFlag = flag;
            }
            mHierarchy.Clear();
        }
        return(flag);
    }

    /// <summary>
    /// Update the world-to-local transform matrix as well as clipping bounds.
    /// </summary>

    void UpdateTransformMatrix()
    {
        float time = Time.realtimeSinceStartup;

        if (time == 0f || mMatrixTime != time)
        {
            mMatrixTime   = time;
            mWorldToLocal = cachedTransform.worldToLocalMatrix;

            if (mClipping != UIDrawCall.Clipping.None)
            {
                Vector2 size = new Vector2(mClipRange.z, mClipRange.w);

                if (size.x == 0f)
                {
                    size.x = mScreenSize.x;
                }
                if (size.y == 0f)
                {
                    size.y = mScreenSize.y;
                }

                size *= 0.5f;

                mMin.x = mClipRange.x - size.x;
                mMin.y = mClipRange.y - size.y;
                mMax.x = mClipRange.x + size.x;
                mMax.y = mClipRange.y + size.y;
            }
        }
    }

    /// <summary>
    /// Run through all managed transforms and see if they've changed.
    /// </summary>

    void UpdateTransforms()
    {
        mChangedLastFrame = false;
        bool transformsChanged = false;

#if UNITY_EDITOR
        bool shouldCull = !Application.isPlaying || Time.realtimeSinceStartup > mCullTime;
        if (!Application.isPlaying || !widgetsAreStatic || mWidgetsAdded || shouldCull != mCulled)
#else
        bool shouldCull = Time.realtimeSinceStartup > mCullTime;
        if (!widgetsAreStatic || mWidgetsAdded || shouldCull != mCulled)
#endif
        {
#if UNITY_FLASH
            foreach (KeyValuePair <Transform, UINode> child in mChildren)
            {
                UINode node = child.Value;
#else
            for (int i = 0, imax = mChildren.Count; i < imax; ++i)
            {
                UINode node = (UINode)mChildren[i];
#endif
                if (node.trans == null)
                {
                    mRemoved.Add(node.trans);
                    continue;
                }

                if (node.HasChanged())
                {
                    node.changeFlag   = 1;
                    transformsChanged = true;
                }
                else
                {
                    node.changeFlag = -1;
                }
            }

            // Clean up the deleted transforms
            for (int i = 0, imax = mRemoved.Count; i < imax; ++i)
            {
                mChildren.Remove(mRemoved[i]);
            }
            mRemoved.Clear();
        }

        // If the children weren't culled but should be, check their visibility
        if (!mCulled && shouldCull)
        {
            mCheckVisibility = true;
        }

        // If something has changed, propagate the changes *down* the tree hierarchy (to children).
        // An alternative (but slower) approach would be to do a pc.trans.GetComponentsInChildren<UIWidget>()
        // in the loop above, and mark each one as dirty.

        if (mCheckVisibility || transformsChanged || mRebuildAll)
        {
#if UNITY_FLASH
            foreach (KeyValuePair <Transform, UINode> child in mChildren)
            {
                UINode pc = child.Value;
#else
            for (int i = 0, imax = mChildren.Count; i < imax; ++i)
            {
                UINode pc = (UINode)mChildren[i];
#endif
                if (pc.widget != null)
                {
                    int visibleFlag = 1;

                    // No sense in checking the visibility if we're not culling anything (as the visibility is always 'true')
                    if (shouldCull || transformsChanged)
                    {
                        // If the change flag has not yet been determined...
                        if (pc.changeFlag == -1)
                        {
                            pc.changeFlag = GetChangeFlag(pc);
                        }

                        // Is the widget visible?
                        if (shouldCull)
                        {
                            visibleFlag = (mCheckVisibility || pc.changeFlag == 1) ? (IsVisible(pc.widget) ? 1 : 0) : pc.visibleFlag;
                        }
                    }

                    // If visibility changed, mark the node as changed as well
                    if (pc.visibleFlag != visibleFlag)
                    {
                        pc.changeFlag = 1;
                    }

                    // If the node has changed and the widget is visible (or was visible before)
                    if (pc.changeFlag == 1 && (visibleFlag == 1 || pc.visibleFlag != 0))
                    {
                        // Update the visibility flag
                        pc.visibleFlag = visibleFlag;
                        Material mat = pc.widget.material;

                        // Add this material to the list of changed materials
                        if (!mChanged.Contains(mat))
                        {
                            mChanged.Add(mat);
                            mChangedLastFrame = true;
                        }
                    }
                }
            }
        }
        mCulled          = shouldCull;
        mCheckVisibility = false;
        mWidgetsAdded    = false;
    }

    /// <summary>
    /// Update all widgets and rebuild their geometry if necessary.
    /// </summary>

    void UpdateWidgets()
    {
#if UNITY_FLASH
        foreach (KeyValuePair <Transform, UINode> c in mChildren)
        {
            UINode pc = c.Value;
#else
        for (int i = 0, imax = mChildren.Count; i < imax; ++i)
        {
            UINode pc = (UINode)mChildren[i];
#endif
            UIWidget w = pc.widget;

            // If the widget is visible, update it
            if (pc.visibleFlag == 1 && w != null && w.UpdateGeometry(ref mWorldToLocal, (pc.changeFlag == 1), generateNormals))
            {
                // We will need to refill this buffer
                if (!mChanged.Contains(w.material))
                {
                    mChanged.Add(w.material);
                    mChangedLastFrame = true;
                }
            }
            pc.changeFlag = 0;
        }
    }

    /// <summary>
    /// Update the clipping rect in the shaders and draw calls' positions.
    /// </summary>

    public void UpdateDrawcalls()
    {
        Vector4 range = Vector4.zero;

        if (mClipping != UIDrawCall.Clipping.None)
        {
            range = new Vector4(mClipRange.x, mClipRange.y, mClipRange.z * 0.5f, mClipRange.w * 0.5f);
        }

        if (range.z == 0f)
        {
            range.z = mScreenSize.x * 0.5f;
        }
        if (range.w == 0f)
        {
            range.w = mScreenSize.y * 0.5f;
        }

        RuntimePlatform platform = Application.platform;

        if (platform == RuntimePlatform.WindowsPlayer ||
            platform == RuntimePlatform.WindowsWebPlayer ||
            platform == RuntimePlatform.WindowsEditor)
        {
            range.x -= 0.5f;
            range.y += 0.5f;
        }

        Transform t = cachedTransform;

        for (int i = 0, imax = mDrawCalls.size; i < imax; ++i)
        {
            UIDrawCall dc = mDrawCalls.buffer[i];
            dc.clipping     = mClipping;
            dc.clipRange    = range;
            dc.clipSoftness = mClipSoftness;
            dc.depthPass    = depthPass;

            // Set the draw call's transform to match the panel's.
            // Note that parenting directly to the panel causes unity to crash as soon as you hit Play.
            Transform dt = dc.transform;
            dt.position   = t.position;
            dt.rotation   = t.rotation;
            dt.localScale = t.lossyScale;
        }
    }

    /// <summary>
    /// Set the draw call's geometry responsible for the specified material.
    /// </summary>

    void Fill(Material mat)
    {
        // Cleanup deleted widgets
        for (int i = mWidgets.size; i > 0;)
        {
            if (mWidgets[--i] == null)
            {
                mWidgets.RemoveAt(i);
            }
        }

        // Fill the buffers for the specified material
        for (int i = 0, imax = mWidgets.size; i < imax; ++i)
        {
            UIWidget w = mWidgets.buffer[i];

            if (w.visibleFlag == 1 && w.material == mat)
            {
                UINode node = GetNode(w.cachedTransform);

                if (node != null)
                {
                    if (generateNormals)
                    {
                        w.WriteToBuffers(mVerts, mUvs, mCols, mNorms, mTans);
                    }
                    else
                    {
                        w.WriteToBuffers(mVerts, mUvs, mCols, null, null);
                    }
                }
                else
                {
                    Debug.LogError("No transform found for " + NGUITools.GetHierarchy(w.gameObject), this);
                }
            }
        }

        if (mVerts.size > 0)
        {
            // Rebuild the draw call's mesh
            UIDrawCall dc = GetDrawCall(mat, true);
            dc.depthPass = depthPass;
            dc.Set(mVerts, generateNormals ? mNorms : null, generateNormals ? mTans : null, mUvs, mCols);
        }
        else
        {
            // There is nothing to draw for this material -- eliminate the draw call
            UIDrawCall dc = GetDrawCall(mat, false);

            if (dc != null)
            {
                mDrawCalls.Remove(dc);
                NGUITools.DestroyImmediate(dc.gameObject);
            }
        }

        // Cleanup
        mVerts.Clear();
        mNorms.Clear();
        mTans.Clear();
        mUvs.Clear();
        mCols.Clear();
    }

    /// <summary>
    /// Main update function
    /// </summary>

    void LateUpdate()
    {
        UpdateTransformMatrix();
        UpdateTransforms();

        // Always move widgets to the panel's layer
        if (mLayer != gameObject.layer)
        {
            mLayer = gameObject.layer;
            UICamera uic = UICamera.FindCameraForLayer(mLayer);
            mCam = (uic != null) ? uic.cachedCamera : NGUITools.FindCameraForLayer(mLayer);
            SetChildLayer(cachedTransform, mLayer);
            for (int i = 0, imax = drawCalls.size; i < imax; ++i)
            {
                mDrawCalls.buffer[i].gameObject.layer = mLayer;
            }
        }

        UpdateWidgets();

        // If the depth has changed, we need to re-sort the widgets
        if (mDepthChanged)
        {
            mDepthChanged = false;
            mWidgets.Sort(UIWidget.CompareFunc);
        }

        // Fill the draw calls for all of the changed materials
        for (int i = 0, imax = mChanged.size; i < imax; ++i)
        {
            Fill(mChanged.buffer[i]);
        }

        // Update the clipping rects
        UpdateDrawcalls();
        mChanged.Clear();
        mRebuildAll = false;

#if UNITY_EDITOR
        mScreenSize = new Vector2(Screen.width, Screen.height);

        UIRoot root = NGUITools.FindInParents <UIRoot>(gameObject);
        if (root != null)
        {
            mScreenSize *= root.GetPixelSizeAdjustment(Screen.height);
        }
#endif
    }
예제 #31
0
    /// <summary>
    /// Convenience function that figures out the panel's correct change flag by searching the parents.
    /// </summary>

    int GetChangeFlag(UINode start)
    {
        int flag = start.changeFlag;

        if (flag == -1)
        {
            Transform trans = start.trans.parent;
            UINode    sub;

            // Keep going until we find a set flag
            for (;;)
            {
                // Check the parent's flag
#if USE_SIMPLE_DICTIONARY
                if (trans != null && mChildren.TryGetValue(trans, out sub))
                {
#else
                if (trans != null && mChildren.Contains(trans))
                {
                    sub = (UINode)mChildren[trans];
#endif
                    flag  = sub.changeFlag;
                    trans = trans.parent;

                    // If the flag hasn't been set either, add this child to the hierarchy
                    if (flag == -1)
                    {
                        mHierarchy.Add(sub);
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    flag = 0;
                    break;
                }
            }

            // Update the parent flags
            for (int i = 0, imax = mHierarchy.size; i < imax; ++i)
            {
                UINode pc = mHierarchy.buffer[i];
                pc.changeFlag = flag;
            }
            mHierarchy.Clear();
        }
        return(flag);
    }

    /// <summary>
    /// Run through all managed transforms and see if they've changed.
    /// </summary>

    void UpdateTransforms()
    {
        bool transformsChanged = false;
        bool shouldCull        = false;

#if UNITY_EDITOR
        shouldCull = (clipping != UIDrawCall.Clipping.None) && (!Application.isPlaying || (cullWhileDragging || mUpdateTime > mCullTime));
        if (!Application.isPlaying || !widgetsAreStatic || mWidgetsAdded || shouldCull != mCulled)
#else
        shouldCull = (clipping != UIDrawCall.Clipping.None) && (mUpdateTime > mCullTime);
        if (!widgetsAreStatic || mWidgetsAdded || shouldCull != mCulled)
#endif
        {
#if USE_SIMPLE_DICTIONARY
            foreach (KeyValuePair <Transform, UINode> child in mChildren)
            {
                UINode node = child.Value;
#else
            for (int i = 0, imax = mChildren.Count; i < imax; ++i)
            {
                UINode node = (UINode)mChildren[i];
#endif
                if (node.trans == null)
                {
                    mRemoved.Add(node.trans);
                    continue;
                }

                if (node.HasChanged())
                {
                    node.changeFlag   = 1;
                    transformsChanged = true;
#if UNITY_EDITOR
                    Vector3 s   = node.trans.lossyScale;
                    float   min = Mathf.Abs(Mathf.Min(s.x, s.y));

                    if (min == 0f)
                    {
                        Debug.LogError("Scale of 0 is invalid! Zero cannot be divided by, which causes problems. Use a small value instead, such as 0.01\n" +
                                       node.trans.lossyScale, node.trans);
                    }
#endif
                }
                else
                {
                    node.changeFlag = -1;
                }
            }

            // Clean up the deleted transforms
            for (int i = 0, imax = mRemoved.Count; i < imax; ++i)
            {
                mChildren.Remove(mRemoved[i]);
            }
            mRemoved.Clear();
        }

        // If the children weren't culled but should be, check their visibility
        if (!mCulled && shouldCull)
        {
            mCheckVisibility = true;
        }

        // If something has changed, propagate the changes *down* the tree hierarchy (to children).
        // An alternative (but slower) approach would be to do a pc.trans.GetComponentsInChildren<UIWidget>()
        // in the loop above, and mark each one as dirty.

        if (mCheckVisibility || transformsChanged || mRebuildAll)
        {
#if USE_SIMPLE_DICTIONARY
            foreach (KeyValuePair <Transform, UINode> child in mChildren)
            {
                UINode pc = child.Value;
#else
            for (int i = 0, imax = mChildren.Count; i < imax; ++i)
            {
                UINode pc = (UINode)mChildren[i];
#endif
                if (pc.widget != null)
                {
                    int visibleFlag = 1;

                    // No sense in checking the visibility if we're not culling anything (as the visibility is always 'true')
                    if (shouldCull || transformsChanged)
                    {
                        // If the change flag has not yet been determined...
                        if (pc.changeFlag == -1)
                        {
                            pc.changeFlag = GetChangeFlag(pc);
                        }

                        // Is the widget visible?
                        if (shouldCull)
                        {
                            visibleFlag = (mCheckVisibility || pc.changeFlag == 1) ? (IsVisible(pc.widget) ? 1 : 0) : pc.visibleFlag;
                        }
                    }

                    // If visibility changed, mark the node as changed as well
                    if (pc.visibleFlag != visibleFlag)
                    {
                        pc.changeFlag = 1;
                    }

                    // If the node has changed and the widget is visible (or was visible before)
                    if (pc.changeFlag == 1 && (visibleFlag == 1 || pc.visibleFlag != 0))
                    {
                        // Update the visibility flag
                        pc.visibleFlag = visibleFlag;
                        Material mat = pc.widget.material;

                        // Add this material to the list of changed materials
                        if (!mChanged.Contains(mat))
                        {
                            mChanged.Add(mat);
                        }
                    }
                }
            }
        }
        mCulled          = shouldCull;
        mCheckVisibility = false;
        mWidgetsAdded    = false;
    }

    /// <summary>
    /// Update all widgets and rebuild their geometry if necessary.
    /// </summary>

    void UpdateWidgets()
    {
#if USE_SIMPLE_DICTIONARY
        foreach (KeyValuePair <Transform, UINode> c in mChildren)
        {
            UINode pc = c.Value;
#else
        for (int i = 0, imax = mChildren.Count; i < imax; ++i)
        {
            UINode pc = (UINode)mChildren[i];
#endif
            UIWidget w = pc.widget;

            // If the widget is visible, update it
            if (pc.visibleFlag == 1 && w != null && w.UpdateGeometry(this, ref worldToLocal, (pc.changeFlag == 1), generateNormals))
            {
                // We will need to refill this buffer
                if (!mChanged.Contains(w.material))
                {
                    mChanged.Add(w.material);
                }
            }
            pc.changeFlag = 0;
        }
    }
#endif

    /// <summary>
    /// Update the clipping rect in the shaders and draw calls' positions.
    /// </summary>

    public void UpdateDrawcalls()
    {
        Vector4 range = Vector4.zero;

        if (mClipping != UIDrawCall.Clipping.None)
        {
            range = new Vector4(mClipRange.x, mClipRange.y, mClipRange.z * 0.5f, mClipRange.w * 0.5f);
        }

        if (range.z == 0f)
        {
            range.z = Screen.width * 0.5f;
        }
        if (range.w == 0f)
        {
            range.w = Screen.height * 0.5f;
        }

        RuntimePlatform platform = Application.platform;

        if (platform == RuntimePlatform.WindowsPlayer ||
            platform == RuntimePlatform.WindowsWebPlayer ||
            platform == RuntimePlatform.WindowsEditor)
        {
            range.x -= 0.5f;
            range.y += 0.5f;
        }

        Transform  t = cachedTransform;
        UIDrawCall dc;
        Transform  dt;

        for (int i = 0, imax = mDrawCalls.size; i < imax; ++i)
        {
            dc              = mDrawCalls.buffer[i];
            dc.clipping     = mClipping;
            dc.clipRange    = range;
            dc.clipSoftness = mClipSoftness;
            dc.depthPass    = depthPass && mClipping == UIDrawCall.Clipping.None;

            // Set the draw call's transform to match the panel's.
            // Note that parenting directly to the panel causes unity to crash as soon as you hit Play.
            dt            = dc.transform;
            dt.position   = t.position;
            dt.rotation   = t.rotation;
            dt.localScale = t.lossyScale;
        }
    }

    /// <summary>
    /// Set the draw call's geometry responsible for the specified material.
    /// </summary>

    void Fill(Material mat)
    {
        int highest = -100;

        // Fill the buffers for the specified material
        for (int i = 0; i < mWidgets.size;)
        {
            UIWidget w = mWidgets.buffer[i];

            if (w == null)
            {
                mWidgets.RemoveAt(i);
                continue;
            }
#if OLD_UNITY
            else if (w.visibleFlag == 1 && w.material == mat)
#else
            else if (w.material == mat && w.isVisible)
#endif
            {
                if (w.panel == this)
                {
                    int depth = w.depth;
                    if (depth > highest)
                    {
                        highest = depth;
                    }
                    if (generateNormals)
                    {
                        w.WriteToBuffers(mVerts, mUvs, mCols, mNorms, mTans);
                    }
                    else
                    {
                        w.WriteToBuffers(mVerts, mUvs, mCols, null, null);
                    }
                }
                else
                {
                    mWidgets.RemoveAt(i);
                    continue;
                }
            }
            ++i;
        }

        if (mVerts.size > 0)
        {
            // Rebuild the draw call's mesh
            UIDrawCall dc = GetDrawCall(mat, true);
            dc.depthPass = depthPass && mClipping == UIDrawCall.Clipping.None;
            dc.depth     = sortByDepth ? highest : 0;
            dc.Set(mVerts, generateNormals ? mNorms : null, generateNormals ? mTans : null, mUvs, mCols);
            dc.mainTexture = mat.mainTexture;
        }
        else
        {
            // There is nothing to draw for this material -- eliminate the draw call
            UIDrawCall dc = GetDrawCall(mat, false);

            if (dc != null)
            {
                mDrawCalls.Remove(dc);
                NGUITools.DestroyImmediate(dc.gameObject);
            }
        }

        // Cleanup
        mVerts.Clear();
        mNorms.Clear();
        mTans.Clear();
        mUvs.Clear();
        mCols.Clear();
    }

    /// <summary>
    /// Main update function
    /// </summary>

    void LateUpdate()
    {
        mUpdateTime = Time.realtimeSinceStartup;
        UpdateTransformMatrix();
#if OLD_UNITY
        UpdateTransforms();
#endif
        // Always move widgets to the panel's layer
        if (mLayer != cachedGameObject.layer)
        {
            mLayer = mGo.layer;
            UICamera uic = UICamera.FindCameraForLayer(mLayer);
            mCam = (uic != null) ? uic.cachedCamera : NGUITools.FindCameraForLayer(mLayer);
            SetChildLayer(cachedTransform, mLayer);
            for (int i = 0, imax = drawCalls.size; i < imax; ++i)
            {
                mDrawCalls.buffer[i].gameObject.layer = mLayer;
            }
        }

#if OLD_UNITY
        UpdateWidgets();
#else
#if UNITY_EDITOR
        bool forceVisible = cullWhileDragging ? false : (clipping == UIDrawCall.Clipping.None) || (Application.isPlaying && mCullTime > mUpdateTime);
#else
        bool forceVisible = cullWhileDragging ? false : (clipping == UIDrawCall.Clipping.None) || (mCullTime > mUpdateTime);
#endif
        // Update all widgets
        for (int i = 0, imax = mWidgets.size; i < imax; ++i)
        {
            UIWidget w = mWidgets[i];

            // If the widget is visible, update it
            if (w.UpdateGeometry(this, forceVisible))
            {
                // We will need to refill this buffer
                if (!mChanged.Contains(w.material))
                {
                    mChanged.Add(w.material);
                }
            }
        }
#endif
        // Inform the changed event listeners
        if (mChanged.size != 0 && onChange != null)
        {
            onChange();
        }

        // If the depth has changed, we need to re-sort the widgets
        if (mDepthChanged)
        {
            mDepthChanged = false;
            mWidgets.Sort(UIWidget.CompareFunc);
        }

        // Fill the draw calls for all of the changed materials
        for (int i = 0, imax = mChanged.size; i < imax; ++i)
        {
            Fill(mChanged.buffer[i]);
        }

        // Update the clipping rects
        UpdateDrawcalls();
        mChanged.Clear();
#if OLD_UNITY
        mRebuildAll = false;
#endif
#if UNITY_EDITOR
        mScreenSize = new Vector2(Screen.width, Screen.height);
#endif
    }