void Update() { MENUTYPE currentMenuType = m_history.Peek(); if (currentMenuType != MENUTYPE.NOTHING) { Menu menu = GetMenu(m_history.Peek()); if (menu != null) { MenuBackGround.Instance.SetAlpha(menu.GetAlphaBack()); } } else { MenuBackGround.Instance.Disable(); } /* if (Application.platform == RuntimePlatform.Android && Input.GetKeyDown(KeyCode.Escape)) * { * if(m_history.Count > 2) * { * Back(); * } * else * { * Utils.QuitApp(); * } * }*/ }
void CloseAllExcept(MENUTYPE a_type) { foreach (MenuEntry entry in m_listMenu) { entry.m_menu.gameObject.SetActive(false); } OpenMenu(m_startMenu); }
public void CloseMenu() { MenuEntry menuEntry = m_listMenu.Find(x => x.m_type == m_currentMenu); if (menuEntry != null) { menuEntry.m_menu.gameObject.SetActive(false); m_currentMenu = MENUTYPE.NOTHING; } }
public void OpenMenu(MENUTYPE a_type, MENUTYPE a_previous = MENUTYPE.NOTHING) { if (a_type == MENUTYPE.NOTHING) { return; } if (a_type != m_history.Peek()) { CloseMenu(false, a_type); } }
void SetMenu(MENUTYPE type) { for (int i = 0; i < menus.Count; i++) { if (i == (int)type) { menus[i].SetActive(true); } else { menus[i].SetActive(false); } } }
public void OpenMenu(MENUTYPE a_type) { if (a_type == m_currentMenu) { return; } CloseMenu(); MenuEntry menuEntry = m_listMenu.Find(x => x.m_type == a_type); if (menuEntry != null) { menuEntry.m_menu.gameObject.SetActive(true); m_currentMenu = a_type; } }
public Menu OpenMenu(MENUTYPE a_type) { if (!m_everOpen) { m_everOpen = true; CloseAllExcept(m_startMenu); } MenuEntry menuEntry = m_listMenu.Find(x => x.m_type == a_type); if (menuEntry != null && a_type != m_currentMenu) { CloseMenu(); menuEntry.m_menu.gameObject.SetActive(true); m_currentMenu = a_type; } return(menuEntry != null ? menuEntry.m_menu : null); }
void RealOpen(MENUTYPE a_type, MENUTYPE a_previous = MENUTYPE.NOTHING) { Menu menu = GetMenu(a_type); if (menu != null) { EnableMenu(menu, true); if (a_previous == MENUTYPE.NOTHING) { a_previous = m_history.Peek(); } if (m_history.Peek() != a_type) { m_history.Push(a_type); } menu.OnOpen(a_previous); } }
public Menu OpenMenu(MENUTYPE a_type) { if (!m_everOpen) { m_everOpen = true; CloseAllExcept(m_startMenu); } MenuEntry menuEntry = m_listMenu.Find(x => x.m_type == a_type); if (menuEntry != null && a_type != m_currentMenu) { CloseMenu(); menuEntry.m_menu.gameObject.SetActive(true); menuEntry.m_menu.OnOpen(); m_currentMenu = a_type; } Assert.AreNotEqual(menuEntry, null, "Menu " + a_type + " Unknow"); return(menuEntry != null ? menuEntry.m_menu : null); }
public void CloseMenu(Menu a_menu, bool a_isBack = false, MENUTYPE a_nextMenu = MENUTYPE.NOTHING) { if (a_menu != null) { //if it'sthe current menu, process if (m_history.Peek() == a_menu.MenuType) { Action callback; MENUTYPE previous = m_history.Peek(); if (a_isBack) { m_history.Pop(); a_nextMenu = m_history.Peek(); } callback = () => RealOpen(a_nextMenu, previous); a_menu.OnClose(a_nextMenu, () => RealClose(a_menu, callback)); } } else { RealOpen(a_nextMenu); } }
public Menu OpenMenuEverywhere(MENUTYPE a_type) { RpcOpenMenu(a_type); return(OpenMenu(a_type)); }
public void RpcOpenMenu(MENUTYPE a_type) { OpenMenu(a_type); }
Menu GetMenu(MENUTYPE a_menuType) { return(m_listMenu.Find(x => x.MenuType == a_menuType)); }
public void CloseMenu(MENUTYPE a_menuType, bool a_isBack = false, MENUTYPE a_nextMenu = MENUTYPE.NOTHING) { Menu menu = GetMenu(a_menuType); CloseMenu(menu, a_isBack, a_nextMenu); }
public void CloseMenu(bool a_isBack = false, MENUTYPE a_nextMenu = MENUTYPE.NOTHING) { CloseMenu(m_history.Peek(), a_isBack, a_nextMenu); }