// Token: 0x06004DEC RID: 19948 RVA: 0x0013675C File Offset: 0x0013495C
    private global::UIDrawCall.Iterator GetDrawCall(global::UIMaterial mat, bool createIfMissing)
    {
        global::UIDrawCall.Iterator result = (global::UIDrawCall.Iterator) this.mDrawCalls;
        while (result.Has)
        {
            if (result.Current.material == mat)
            {
                return(result);
            }
            result = result.Next;
        }
        global::UIDrawCall uidrawCall = null;

        if (createIfMissing)
        {
            uidrawCall = new GameObject("_UIDrawCall [" + mat.name + "]")
            {
                hideFlags = 4,
                layer     = base.gameObject.layer
            }.AddComponent <global::UIDrawCall>();
            uidrawCall.material = mat;
            uidrawCall.LinkedList__Insert(ref this.mDrawCalls);
            this.mDrawCallCount++;
        }
        return((global::UIDrawCall.Iterator)uidrawCall);
    }
Beispiel #2
0
 // Token: 0x06004AC3 RID: 19139 RVA: 0x001217B4 File Offset: 0x0011F9B4
 internal void LinkedList__Insert(ref global::UIDrawCall list)
 {
     this.mHasPrev = false;
     this.mHasNext = list;
     this.mNext    = list;
     this.mPrev    = null;
     if (this.mHasNext)
     {
         list.mHasPrev = true;
         list.mPrev    = this;
     }
     list = this;
 }
 // Token: 0x06004DFA RID: 19962 RVA: 0x00137430 File Offset: 0x00135630
 public bool Contains(global::UIDrawCall drawcall)
 {
     global::UIDrawCall.Iterator iterator = (global::UIDrawCall.Iterator) this.mDrawCalls;
     while (iterator.Has)
     {
         if (object.ReferenceEquals(drawcall, iterator.Current))
         {
             return(true);
         }
         iterator = iterator.Next;
     }
     return(false);
 }
 // Token: 0x06004DF8 RID: 19960 RVA: 0x001372B0 File Offset: 0x001354B0
 private void Delete(ref global::UIDrawCall.Iterator iter)
 {
     if (iter.Has)
     {
         global::UIDrawCall current = iter.Current;
         if (object.ReferenceEquals(current, this.mDrawCalls))
         {
             this.mDrawCalls = iter.Next.Current;
         }
         iter = iter.Next;
         current.LinkedList__Remove();
         this.mDrawCallCount--;
         global::NGUITools.DestroyImmediate(current.gameObject);
     }
 }
    // Token: 0x06004DF7 RID: 19959 RVA: 0x00137160 File Offset: 0x00135360
    private void Fill(global::UIMaterial mat)
    {
        int i = this.mWidgets.Count;

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

        while (j < count)
        {
            global::UIWidget uiwidget = this.mWidgets[j];
            if (uiwidget.visibleFlag == 1 && uiwidget.material == mat)
            {
                global::UINode node = this.GetNode(uiwidget.cachedTransform);
                if (node != null)
                {
                    uiwidget.WriteToBuffers(this.mCacheBuffer);
                }
                else
                {
                    Debug.LogError("No transform found for " + global::NGUITools.GetHierarchy(uiwidget.gameObject), this);
                }
            }
            j++;
        }
        if (this.mCacheBuffer.vSize > 0)
        {
            global::UIDrawCall current = this.GetDrawCall(mat, true).Current;
            current.depthPass          = this.depthPass;
            current.panelPropertyBlock = this.propertyBlock;
            current.Set(this.mCacheBuffer);
        }
        else
        {
            global::UIDrawCall.Iterator drawCall = this.GetDrawCall(mat, false);
            if (drawCall.Has)
            {
                this.Delete(ref drawCall);
            }
        }
        this.mCacheBuffer.Clear();
    }
    // Token: 0x06004DF6 RID: 19958 RVA: 0x00136FC4 File Offset: 0x001351C4
    public void UpdateDrawcalls()
    {
        Vector4 zero = Vector4.zero;

        if (this.mClipping != global::UIDrawCall.Clipping.None)
        {
            zero..ctor(this.mClipRange.x, this.mClipRange.y, this.mClipRange.z * 0.5f, this.mClipRange.w * 0.5f);
        }
        if (zero.z == 0f)
        {
            zero.z = (float)Screen.width * 0.5f;
        }
        if (zero.w == 0f)
        {
            zero.w = (float)Screen.height * 0.5f;
        }
        RuntimePlatform platform = Application.platform;

        if (platform == 2 || platform == 5 || platform == 7)
        {
            zero.x -= 0.5f;
            zero.y += 0.5f;
        }
        Vector3    position   = this.cachedTransform.position;
        Quaternion rotation   = this.cachedTransform.rotation;
        Vector3    lossyScale = this.cachedTransform.lossyScale;

        global::UIDrawCall.Iterator iterator = (global::UIDrawCall.Iterator) this.mDrawCalls;
        while (iterator.Has)
        {
            global::UIDrawCall current = iterator.Current;
            iterator                   = iterator.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;
        }
    }
 // Token: 0x06004DF0 RID: 19952 RVA: 0x0013691C File Offset: 0x00134B1C
 protected void OnDisable()
 {
     global::UIPanel.Global.PanelDisabled(this);
     if (this.mHotSpots != null)
     {
         foreach (global::UIHotSpot uihotSpot in this.mHotSpots)
         {
             uihotSpot.OnPanelDisable();
         }
     }
     global::UIDrawCall.Iterator iterator = (global::UIDrawCall.Iterator) this.mDrawCalls;
     while (iterator.Has)
     {
         global::UIDrawCall current = iterator.Current;
         iterator = iterator.Next;
         global::NGUITools.DestroyImmediate(current.gameObject);
     }
     this.mDrawCalls = null;
     this.mChanged.Clear();
     this.mChildren.Clear();
 }