public override void WakeUp() { base.WakeUp(); if (mInterfaceLookup == null) { mInterfaceLookup = new Dictionary <string, PrimaryInterface>(); } if (ToggleAction != InterfaceActionType.NoAction) { Subscribe(ToggleAction, new ActionListener(Toggle)); } PrimaryInterface.mInterfaceLookup.Add(Name, this); GUITabs tabs = gameObject.GetComponent <GUITabs>(); if (tabs != null) { tabs.Initialize(this); } if (UserActions == null) { UserActions = gameObject.GetComponent <UserActionReceiver>(); } }
public void Initialize(GUITabs tabParent, GUITabPage page) { mInitialized = true; Page = page; TabParent = tabParent; mSelected = true; Selected = false; }
public override void WakeUp() { base.WakeUp(); TabPage = gameObject.GetComponent <GUITabPage>(); TabPage.OnDeselected += OnDeselected; SubSelectionTabs = gameObject.GetComponent <GUITabs>(); SubSelectionTabs.OnSetSelection += OnSetSelection; }
public override void WakeUp() { base.WakeUp(); SubSelectionTabs = gameObject.GetComponent <GUITabs>(); SubSelectionTabs.OnSetSelection += OnSetSelection; mPlantDoppleganger.PackName = "Plants"; mPlantDoppleganger.PrefabName = "WorldPlant"; mPlantDoppleganger.State = "Raw"; TabPage = gameObject.GetComponent <GUITabPage>(); TabPage.OnDeselected += OnDeselected; }
public override void WakeUp() { base.WakeUp(); TabPage = gameObject.GetComponent <GUITabPage>(); SubSelectionTabs = gameObject.GetComponent <GUITabs>(); if (SubSelectionTabs != null) { SubSelectionTabs.OnSetSelection += OnSetSelection; } else { //Debug.Log ("SUBSELECTION TABS WAS NULL IN " + name); } }
public void Initialize(GUITabs tabParent, GUITabButton button) { if (mInitialized) { return; } NGUICamera = tabParent.NGUICamera; TabParent = tabParent; Button = button; button.Page = this; UIPanel[] panels = gameObject.GetComponentsInChildren <UIPanel>(true); for (int i = 0; i < panels.Length; i++) { //make sure the panel isn't being managed by a sub-tab bool addPanel = true; for (int j = 0; j < TabParent.SubTabs.Count; j++) { if (TabParent.SubTabs[j].ManagesPanel(panels[i])) { addPanel = false; } } if (addPanel) { Panels.Add(panels[i]); } } UIPanel mainPanel = null; if (gameObject.HasComponent <UIPanel>(out mainPanel)) { Panels.SafeAdd(mainPanel); } Component[] tabPageChildren = gameObject.GetComponentsInChildren(typeof(IGUITabPageChild), true); for (int i = 0; i < tabPageChildren.Length; i++) { IGUITabPageChild tabPageChild = tabPageChildren[i] as IGUITabPageChild; Children.Add(tabPageChild); } OnSelected += Show; OnDeselected += Hide; TabParent.OnHide += Hide; mInitialized = true; }
public bool GetNextSubTab(GUITabs current, out GUITabs next) { if (current == null && SubTabs.Count > 0) { next = SubTabs[0]; } else { next = null; for (int i = 0; i < SubTabs.Count; i++) { if (SubTabs [i].Visible && SubTabs[i] == current && i > 0) { next = SubTabs[i - 1]; break; } } } return(next != null); }
public bool CanShowTab(string tabName, GUITabs tabs) { return(true); }
public void Initialize(IGUITabOwner owner) { if (owner == this) { Debug.Log("TABS CANNOT OWN THEMSELVES IN " + name); return; } Owner = owner; Owner.OnShow += Show; Owner.OnHide += Hide; NGUICamera = owner.NGUICamera; Buttons.Clear(); Pages.Clear(); foreach (Transform child in transform) { GUITabButton tabButton = null; if (child.gameObject.HasComponent <GUITabButton>(out tabButton)) { tabButton.name = name + "-" + tabButton.Name; Buttons.Add(tabButton); } GUITabPage page = null; if (child.gameObject.HasComponent <GUITabPage>(out page)) { page.NGUICamera = NGUICamera; Pages.Add(page); GUITabs subTabs = null; if (child.gameObject.HasComponent <GUITabs>(out subTabs)) { page.SubTabs = subTabs; subTabs.NGUICamera = NGUICamera; subTabs.ParentTabs = this; subTabs.Initialize(this); SubTabs.Add(subTabs); } } } //sort the buttons Buttons.Sort(); for (int i = 0; i < Pages.Count; i++) { for (int j = 0; j < Buttons.Count; j++) { if (Pages[i].name == Buttons[j].Name) { Pages[i].NGUICamera = NGUICamera; Pages[i].Initialize(this, Buttons[j]); Buttons[j].Initialize(this, Pages[i]); } } } for (int i = 0; i < Buttons.Count; i++) { if (!Buttons[i].Initialized) { Buttons[i].Initialize(this, null); } } mInitialized = true; if (Visible) { Show(); } else { Hide(); } }