Ejemplo n.º 1
0
    private UIDrawCall.Iterator GetDrawCall(UIMaterial mat, bool createIfMissing)
    {
        for (UIDrawCall.Iterator i = (UIDrawCall.Iterator) this.mDrawCalls; i.Has; i = i.Next)
        {
            if (i.Current.material == mat)
            {
                return(i);
            }
        }
        UIDrawCall uIDrawCall = null;

        if (createIfMissing)
        {
            GameObject gameObject = new GameObject(string.Concat("_UIDrawCall [", mat.name, "]"))
            {
                hideFlags = HideFlags.DontSave,
                layer     = base.gameObject.layer
            };
            uIDrawCall          = gameObject.AddComponent <UIDrawCall>();
            uIDrawCall.material = mat;
            uIDrawCall.LinkedList__Insert(ref this.mDrawCalls);
            UIPanel uIPanel = this;
            uIPanel.mDrawCallCount = uIPanel.mDrawCallCount + 1;
        }
        return((UIDrawCall.Iterator)uIDrawCall);
    }
Ejemplo n.º 2
0
 private void PanelUpdate(bool letFill)
 {
     this.UpdateTransformMatrix();
     this.UpdateTransforms();
     if (this.mLayer != base.gameObject.layer)
     {
         this.mLayer = base.gameObject.layer;
         UICamera camera = UICamera.FindCameraForLayer(this.mLayer);
         this.mCam = (camera == null) ? NGUITools.FindCameraForLayer(this.mLayer) : camera.cachedCamera;
         SetChildLayer(this.cachedTransform, this.mLayer);
         for (UIDrawCall.Iterator iterator = (UIDrawCall.Iterator) this.mDrawCalls; iterator.Has; iterator = iterator.Next)
         {
             iterator.Current.gameObject.layer = this.mLayer;
         }
     }
     this.UpdateWidgets();
     if (this.mDepthChanged)
     {
         this.mDepthChanged = false;
         this.mWidgets.Sort(new Comparison <UIWidget>(UIWidget.CompareFunc));
     }
     if (letFill)
     {
         this.FillUpdate();
     }
     else
     {
         this.UpdateDrawcalls();
     }
     this.mRebuildAll = false;
 }
Ejemplo n.º 3
0
 public bool Contains(UIDrawCall drawcall)
 {
     for (UIDrawCall.Iterator iterator = (UIDrawCall.Iterator) this.mDrawCalls; iterator.Has; iterator = iterator.Next)
     {
         if (object.ReferenceEquals(drawcall, iterator.Current))
         {
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 4
0
    private void Fill(UIMaterial mat)
    {
        int count = this.mWidgets.Count;

        while (count > 0)
        {
            int num = count - 1;
            count = num;
            if (this.mWidgets[num] != null)
            {
                continue;
            }
            this.mWidgets.RemoveAt(count);
        }
        int num1   = 0;
        int count1 = this.mWidgets.Count;

        while (num1 < count1)
        {
            UIWidget item = this.mWidgets[num1];
            if (item.visibleFlag == 1 && item.material == mat)
            {
                if (this.GetNode(item.cachedTransform) == null)
                {
                    Debug.LogError(string.Concat("No transform found for ", NGUITools.GetHierarchy(item.gameObject)), this);
                }
                else
                {
                    item.WriteToBuffers(this.mCacheBuffer);
                }
            }
            num1++;
        }
        if (this.mCacheBuffer.vSize <= 0)
        {
            UIDrawCall.Iterator drawCall = this.GetDrawCall(mat, false);
            if (drawCall.Has)
            {
                this.Delete(ref drawCall);
            }
        }
        else
        {
            UIDrawCall current = this.GetDrawCall(mat, true).Current;
            current.depthPass          = this.depthPass;
            current.panelPropertyBlock = this.propertyBlock;
            current.Set(this.mCacheBuffer);
        }
        this.mCacheBuffer.Clear();
    }
Ejemplo n.º 5
0
 private void Delete(ref UIDrawCall.Iterator iter)
 {
     if (iter.Has)
     {
         UIDrawCall current = iter.Current;
         if (object.ReferenceEquals(current, this.mDrawCalls))
         {
             this.mDrawCalls = iter.Next.Current;
         }
         iter = iter.Next;
         current.LinkedList__Remove();
         this.mDrawCallCount--;
         NGUITools.DestroyImmediate(current.gameObject);
     }
 }
Ejemplo n.º 6
0
    private void Fill(UIMaterial mat)
    {
        int count = this.mWidgets.Count;

        while (count > 0)
        {
            if (this.mWidgets[--count] == null)
            {
                this.mWidgets.RemoveAt(count);
            }
        }
        int num2 = 0;
        int num3 = this.mWidgets.Count;

        while (num2 < num3)
        {
            UIWidget widget = this.mWidgets[num2];
            if ((widget.visibleFlag == 1) && (widget.material == mat))
            {
                if (this.GetNode(widget.cachedTransform) != null)
                {
                    widget.WriteToBuffers(this.mCacheBuffer);
                }
                else
                {
                    Debug.LogError("No transform found for " + NGUITools.GetHierarchy(widget.gameObject), this);
                }
            }
            num2++;
        }
        if (this.mCacheBuffer.vSize > 0)
        {
            UIDrawCall current = this.GetDrawCall(mat, true).Current;
            current.depthPass          = this.depthPass;
            current.panelPropertyBlock = this.propertyBlock;
            current.Set(this.mCacheBuffer);
        }
        else
        {
            UIDrawCall.Iterator drawCall = this.GetDrawCall(mat, false);
            if (drawCall.Has)
            {
                this.Delete(ref drawCall);
            }
        }
        this.mCacheBuffer.Clear();
    }
Ejemplo n.º 7
0
    public void UpdateDrawcalls()
    {
        Vector4 zero = Vector4.zero;

        if (this.mClipping != UIDrawCall.Clipping.None)
        {
            zero = new Vector4(this.mClipRange.x, this.mClipRange.y, this.mClipRange.z * 0.5f, this.mClipRange.w * 0.5f);
        }
        if (zero.z == 0f)
        {
            zero.z = Screen.width * 0.5f;
        }
        if (zero.w == 0f)
        {
            zero.w = Screen.height * 0.5f;
        }
        switch (Application.platform)
        {
        case RuntimePlatform.WindowsPlayer:
        case RuntimePlatform.WindowsWebPlayer:
        case RuntimePlatform.WindowsEditor:
            zero.x -= 0.5f;
            zero.y += 0.5f;
            break;
        }
        Vector3    position   = this.cachedTransform.position;
        Quaternion rotation   = this.cachedTransform.rotation;
        Vector3    lossyScale = this.cachedTransform.lossyScale;

        UIDrawCall.Iterator mDrawCalls = (UIDrawCall.Iterator) this.mDrawCalls;
        while (mDrawCalls.Has)
        {
            UIDrawCall current = mDrawCalls.Current;
            mDrawCalls                 = mDrawCalls.Next;
            current.clipping           = this.mClipping;
            current.clipRange          = zero;
            current.clipSoftness       = this.mClipSoftness;
            current.depthPass          = this.depthPass;
            current.panelPropertyBlock = this.propertyBlock;
            Transform transform = current.transform;
            transform.position   = position;
            transform.rotation   = rotation;
            transform.localScale = lossyScale;
        }
    }
Ejemplo n.º 8
0
    public void UpdateDrawcalls()
    {
        Vector4 vector4 = Vector4.zero;

        if (this.mClipping != UIDrawCall.Clipping.None)
        {
            vector4 = new Vector4(this.mClipRange.x, this.mClipRange.y, this.mClipRange.z * 0.5f, this.mClipRange.w * 0.5f);
        }
        if (vector4.z == 0f)
        {
            vector4.z = (float)Screen.width * 0.5f;
        }
        if (vector4.w == 0f)
        {
            vector4.w = (float)Screen.height * 0.5f;
        }
        RuntimePlatform runtimePlatform = Application.platform;

        if (runtimePlatform == RuntimePlatform.WindowsPlayer || runtimePlatform == RuntimePlatform.WindowsWebPlayer || runtimePlatform == RuntimePlatform.WindowsEditor)
        {
            vector4.x = vector4.x - 0.5f;
            vector4.y = vector4.y + 0.5f;
        }
        Vector3    vector3    = this.cachedTransform.position;
        Quaternion quaternion = this.cachedTransform.rotation;
        Vector3    vector31   = this.cachedTransform.lossyScale;

        UIDrawCall.Iterator next = (UIDrawCall.Iterator) this.mDrawCalls;
        while (next.Has)
        {
            UIDrawCall current = next.Current;
            next                       = next.Next;
            current.clipping           = this.mClipping;
            current.clipRange          = vector4;
            current.clipSoftness       = this.mClipSoftness;
            current.depthPass          = this.depthPass;
            current.panelPropertyBlock = this.propertyBlock;
            Transform transforms = current.transform;
            transforms.position   = vector3;
            transforms.rotation   = quaternion;
            transforms.localScale = vector31;
        }
    }
Ejemplo n.º 9
0
 protected void OnDisable()
 {
     Global.PanelDisabled(this);
     if (this.mHotSpots != null)
     {
         foreach (UIHotSpot spot in this.mHotSpots)
         {
             spot.OnPanelDisable();
         }
     }
     UIDrawCall.Iterator mDrawCalls = (UIDrawCall.Iterator) this.mDrawCalls;
     while (mDrawCalls.Has)
     {
         UIDrawCall current = mDrawCalls.Current;
         mDrawCalls = mDrawCalls.Next;
         NGUITools.DestroyImmediate(current.gameObject);
     }
     this.mDrawCalls = null;
     this.mChanged.Clear();
     this.mChildren.Clear();
 }
Ejemplo n.º 10
0
    private UIDrawCall.Iterator GetDrawCall(UIMaterial mat, bool createIfMissing)
    {
        for (UIDrawCall.Iterator iterator = (UIDrawCall.Iterator) this.mDrawCalls; iterator.Has; iterator = iterator.Next)
        {
            if (iterator.Current.material == mat)
            {
                return(iterator);
            }
        }
        UIDrawCall call = null;

        if (createIfMissing)
        {
            call = new GameObject("_UIDrawCall [" + mat.name + "]")
            {
                hideFlags = HideFlags.DontSave, layer = base.gameObject.layer
            }.AddComponent <UIDrawCall>();
            call.material = mat;
            call.LinkedList__Insert(ref this.mDrawCalls);
            this.mDrawCallCount++;
        }
        return((UIDrawCall.Iterator)call);
    }