Exemplo n.º 1
0
    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();
         *    }
         * }*/
    }
Exemplo n.º 2
0
 void CloseAllExcept(MENUTYPE a_type)
 {
     foreach (MenuEntry entry in m_listMenu)
     {
         entry.m_menu.gameObject.SetActive(false);
     }
     OpenMenu(m_startMenu);
 }
Exemplo n.º 3
0
    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;
        }
    }
Exemplo n.º 4
0
    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);
         }
     }
 }
Exemplo n.º 6
0
    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;
        }
    }
Exemplo n.º 7
0
    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);
    }
Exemplo n.º 8
0
    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);
        }
    }
Exemplo n.º 9
0
    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);
    }
Exemplo n.º 10
0
 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);
     }
 }
Exemplo n.º 11
0
 public Menu OpenMenuEverywhere(MENUTYPE a_type)
 {
     RpcOpenMenu(a_type);
     return(OpenMenu(a_type));
 }
Exemplo n.º 12
0
 public void RpcOpenMenu(MENUTYPE a_type)
 {
     OpenMenu(a_type);
 }
Exemplo n.º 13
0
 Menu GetMenu(MENUTYPE a_menuType)
 {
     return(m_listMenu.Find(x => x.MenuType == a_menuType));
 }
Exemplo n.º 14
0
    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);
    }
Exemplo n.º 15
0
 public void CloseMenu(bool a_isBack = false, MENUTYPE a_nextMenu = MENUTYPE.NOTHING)
 {
     CloseMenu(m_history.Peek(), a_isBack, a_nextMenu);
 }