Exemplo n.º 1
0
    // Token: 0x06004DF2 RID: 19954 RVA: 0x00136A68 File Offset: 0x00134C68
    private int GetChangeFlag(global::UINode start)
    {
        int num = start.changeFlag;

        if (num == -1)
        {
            Transform parent = start.trans.parent;
            while (this.mChildren.Contains(parent))
            {
                global::UINode uinode = (global::UINode)this.mChildren[parent];
                num    = uinode.changeFlag;
                parent = parent.parent;
                if (num != -1)
                {
IL_7D:
                    int i = 0;
                    int count = global::UIPanel.mHierarchy.Count;
                    while (i < count)
                    {
                        global::UINode uinode2 = global::UIPanel.mHierarchy[i];
                        uinode2.changeFlag = num;
                        i++;
                    }
                    global::UIPanel.mHierarchy.Clear();
                    return(num);
                }
                global::UIPanel.mHierarchy.Add(uinode);
            }
            num = 0;
            goto IL_7D;
        }
        return(num);
    }
Exemplo n.º 2
0
 // Token: 0x06004DEA RID: 19946 RVA: 0x0013662C File Offset: 0x0013482C
 public void AddWidget(global::UIWidget w)
 {
     if (w != null)
     {
         global::UINode uinode = this.AddTransform(w.cachedTransform);
         if (uinode != null)
         {
             uinode.widget = w;
             if (!this.mWidgets.Contains(w))
             {
                 this.mWidgets.Add(w);
                 if (!this.mChanged.Contains(w.material))
                 {
                     this.mChanged.Add(w.material);
                     this.mChangedLastFrame = true;
                 }
                 this.mDepthChanged = true;
             }
         }
         else
         {
             Debug.LogError("Unable to find an appropriate UIRoot for " + global::NGUITools.GetHierarchy(w.gameObject) + "\nPlease make sure that there is at least one game object above this widget!", w.gameObject);
         }
     }
 }
Exemplo n.º 3
0
    // Token: 0x06004DE3 RID: 19939 RVA: 0x00136244 File Offset: 0x00134444
    private global::UINode GetNode(Transform t)
    {
        global::UINode result = null;

        if (t != null && this.mChildren.Contains(t))
        {
            result = (global::UINode)this.mChildren[t];
        }
        return(result);
    }
Exemplo n.º 4
0
    // 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();
    }
Exemplo n.º 5
0
 // Token: 0x06004DEB RID: 19947 RVA: 0x001366DC File Offset: 0x001348DC
 public void RemoveWidget(global::UIWidget w)
 {
     if (w != null)
     {
         global::UINode node = this.GetNode(w.cachedTransform);
         if (node != null)
         {
             if (node.visibleFlag == 1 && !this.mChanged.Contains(w.material))
             {
                 this.mChanged.Add(w.material);
                 this.mChangedLastFrame = true;
             }
             this.RemoveTransform(w.cachedTransform);
         }
         this.mWidgets.Remove(w);
     }
 }
Exemplo n.º 6
0
    // Token: 0x06004DF5 RID: 19957 RVA: 0x00136F10 File Offset: 0x00135110
    private void UpdateWidgets()
    {
        int i     = 0;
        int count = this.mChildren.Count;

        while (i < count)
        {
            global::UINode   uinode = (global::UINode)this.mChildren[i];
            global::UIWidget widget = uinode.widget;
            if (uinode.visibleFlag == 1 && widget != null && widget.UpdateGeometry(ref this.mWorldToLocal, uinode.changeFlag == 1, this.generateNormals) && !this.mChanged.Contains(widget.material))
            {
                this.mChanged.Add(widget.material);
                this.mChangedLastFrame = true;
            }
            uinode.changeFlag = 0;
            i++;
        }
    }
Exemplo n.º 7
0
    // Token: 0x06004DE8 RID: 19944 RVA: 0x00136530 File Offset: 0x00134730
    private global::UINode AddTransform(Transform t)
    {
        global::UINode uinode = null;

        while (t != null && t != this.cachedTransform)
        {
            if (this.mChildren.Contains(t))
            {
                if (uinode == null)
                {
                    uinode = (global::UINode)this.mChildren[t];
                }
                break;
            }
            global::UINode uinode2 = new global::UINode(t);
            if (uinode == null)
            {
                uinode = uinode2;
            }
            this.mChildren.Add(t, uinode2);
            t = t.parent;
        }
        return(uinode);
    }
Exemplo n.º 8
0
    // Token: 0x06004DF4 RID: 19956 RVA: 0x00136CA0 File Offset: 0x00134EA0
    private void UpdateTransforms()
    {
        this.mChangedLastFrame = false;
        bool flag  = false;
        bool flag2 = Time.realtimeSinceStartup > this.mCullTime;

        if (!this.widgetsAreStatic || flag2 != this.mCulled)
        {
            int i     = 0;
            int count = this.mChildren.Count;
            while (i < count)
            {
                global::UINode uinode = (global::UINode)this.mChildren[i];
                if (uinode.trans == null)
                {
                    this.mRemoved.Add(uinode.trans);
                }
                else if (uinode.HasChanged())
                {
                    uinode.changeFlag = 1;
                    flag = true;
                }
                else
                {
                    uinode.changeFlag = -1;
                }
                i++;
            }
            int j      = 0;
            int count2 = this.mRemoved.Count;
            while (j < count2)
            {
                this.mChildren.Remove(this.mRemoved[j]);
                j++;
            }
            this.mRemoved.Clear();
        }
        if (!this.mCulled && flag2)
        {
            this.mCheckVisibility = true;
        }
        if (this.mCheckVisibility || flag || this.mRebuildAll)
        {
            int k      = 0;
            int count3 = this.mChildren.Count;
            while (k < count3)
            {
                global::UINode uinode2 = (global::UINode)this.mChildren[k];
                if (uinode2.widget != null)
                {
                    int num = 1;
                    if (flag2 || flag)
                    {
                        if (uinode2.changeFlag == -1)
                        {
                            uinode2.changeFlag = this.GetChangeFlag(uinode2);
                        }
                        if (flag2)
                        {
                            num = ((!this.mCheckVisibility && uinode2.changeFlag != 1) ? uinode2.visibleFlag : ((!this.IsVisible(uinode2.widget)) ? 0 : 1));
                        }
                    }
                    if (uinode2.visibleFlag != num)
                    {
                        uinode2.changeFlag = 1;
                    }
                    if (uinode2.changeFlag == 1 && (num == 1 || uinode2.visibleFlag != 0))
                    {
                        uinode2.visibleFlag = num;
                        global::UIMaterial material = uinode2.widget.material;
                        if (!this.mChanged.Contains(material))
                        {
                            this.mChanged.Add(material);
                            this.mChangedLastFrame = true;
                        }
                    }
                }
                k++;
            }
        }
        this.mCulled          = flag2;
        this.mCheckVisibility = false;
    }