public void AddChild(GameObject go) { IUIObject iUIObject = (IUIObject)go.GetComponent("IUIObject"); if (iUIObject != null) { if (iUIObject.Container != this) { iUIObject.Container = this; } if (!this.uiObjs.ContainsKey(iUIObject.GetHashCode())) { this.uiObjs.Add(iUIObject.GetHashCode(), iUIObject); } } else { UIPanelBase uIPanelBase = (UIPanelBase)go.GetComponent(typeof(UIPanelBase)); if (uIPanelBase != null) { if (uIPanelBase.Container != this) { uIPanelBase.Container = this; } this.childPanels.Add(new EZLinkedListNode <UIPanelBase>(uIPanelBase)); } } if (!base.gameObject.activeInHierarchy) { go.SetActive(false); } }
public void RemoveChild(GameObject go) { IUIObject iUIObject = (IUIObject)go.GetComponent("IUIObject"); if (iUIObject != null) { if (this.uiObjs.ContainsKey(iUIObject.GetHashCode())) { this.uiObjs.Remove(iUIObject.GetHashCode()); if (iUIObject.Container == this) { iUIObject.Container = null; } } } else { UIPanelBase uIPanelBase = (UIPanelBase)go.GetComponent(typeof(UIPanelBase)); if (uIPanelBase != null) { if (this.childPanels.Rewind()) { while (!(this.childPanels.Current.val == uIPanelBase)) { if (!this.childPanels.MoveNext()) { goto IL_CF; } } this.childPanels.Remove(this.childPanels.Current); } IL_CF: if (uIPanelBase.Container == this) { uIPanelBase.Container = null; } } } }