virtual protected void setup() { NwkUiTabs tabs = GameObject.FindObjectOfType <NwkUiTabs>(); NwkUiView[] views = GameObject.FindObjectsOfType <NwkUiView>(); if (views.Length > 0) { //hide(); // default is not visible when tabs is coming if (tabs == null) { NwkUiTabs.loadView("tabs", delegate(bool success) { //failed to load tabs view if (!success) { show(); } }); } } else { Debug.Log(name + " refreshing tabs", transform); tabs.refreshTabs(); // nwk ui view setup } //hide(); }
virtual protected void destroy() { gameObject.SetActive(false); if (Application.isPlaying) { //force refresh tabs NwkUiTabs views = GameObject.FindObjectOfType <NwkUiTabs>(); if (views != null) { views.refreshTabs(); // destroy ui view } } }
void loadViews() { string[] nms = getViewNames(); int count = nms.Length; for (int i = 0; i < nms.Length; i++) { string viewShortName = nms[i]; NwkUiTabs.loadView(viewShortName, delegate(bool success) { if (tabs == null) { tabs = GameObject.FindObjectOfType <NwkUiTabs>(); } if (openedStartupViewName.Length > 0) { //Debug.Log(viewShortName + " == " + openedStartupViewName); if (viewShortName.Contains(openedStartupViewName)) { iNwkUiTab tab = NwkUiTabs.getTabByNameGlobal(viewShortName); Debug.Log(tab); tab?.showTab(); //tabs.getTabByName(viewShortName).showTab(); } } count--; if (count <= 0) { onAllViewsLoaded(); } }); } }