Example #1
0
    //---- Menu Interface
    //-------------------
    public void Show(Menu menu)
    {
        if (current == menu)
        {
            Debug.LogWarning("Tring to show same open menu");
            return;
        }

        // exit current
        if (currentMenu != null)
        {
            currentMenu.Exit();
        }

        // swap
        current = menu;
        switch (current)
        {
        case Menu.None:
            currentMenu = null;
            return;

        case Menu.Main:
            currentMenu = mainMenu;
            break;

        case Menu.HostJoin:
            currentMenu = hostJoinMenu;
            break;

        // Host
        case Menu.HostSetup:
            currentMenu = hostMenu;
            break;

        case Menu.LobbyHost:
            currentMenu = lobbyHostMenu;
            break;

        // Client
        case Menu.ClientSetup:
            currentMenu = clientMenu;
            break;

        case Menu.LobbyClient:
            currentMenu = lobbyClientMenu;
            break;
        }

        // enter new
        currentMenu.Enter();
    }