public void CloseAll() { while (m_stack.Count > 0) { UIContent content = m_stack.Pop() as UIContent; m_views[content.name].gameObject.SetActive(false); m_views[content.name].OnClose(); } }
public void Back() { UIContent content = m_stack.Pop() as UIContent; m_views[content.name].gameObject.SetActive(false); m_views[content.name].OnClose(); UIContent peek = m_stack.Peek() as UIContent; m_views[peek.name].gameObject.SetActive(true); }
public void Show <T>() { string name = typeof(T).ToString(); if (GetView <T>().isBottom) { CloseAll(); } UIContent content = new UIContent(name); m_stack.Push(content); ShowGameObject(name); }
private void ShowGameObject(string name) { UIContent peek = m_stack.Peek() as UIContent; m_views[peek.name].gameObject.SetActive(true); m_views[peek.name].OnOpen(); // hide others foreach (UIContent obj in m_stack) { if (obj != peek) { m_views[obj.name].gameObject.SetActive(false); m_views[obj.name].OnClose(); } } }