void pressButton()
    {
        MenuButton.Data op = buttons[currentButton].data;
        if (!op.enabled)
        {
            return;
        }
        switch (op.opCode)
        {
        case 1:
            if (op.auxMenu == null)
            {
                Application.Quit();
            }
            else
            {
                currentMenu = op.auxMenu;
                op.auxMenu.Display();
            }
            break;

        case 2:
            currentMenu.ExecOperation(op);
            break;
        }
    }
Beispiel #2
0
    override public void ExecOperation(MenuButton.Data data)
    {
        if (data.auxValue == 200)
        {
            SceneManager.LoadScene(21);
            return;
        }

        gc.sound       = !gc.sound;
        layout[1].text = "Sound: " + (gc.sound ? "On" : "Off");
        manager.SetButtons(layout);
        actionSound.volume = gc.sound ? 1 : 0;
    }
Beispiel #3
0
    public MainMenu(MenuManager _manager, MenuManager.Menu _levelMenu, AudioSource _actionSound)
    {
        manager     = _manager;
        levelMenu   = _levelMenu;
        actionSound = _actionSound;
        gc          = GameController.Instance;
        layout      = new MenuButton.Data[4];
        layout[0]   = new MenuButton.Data("Play", true, 1, 0, levelMenu);
        layout[1]   = new MenuButton.Data("Sound: ", true, 2, 0, null);
        layout[2]   = new MenuButton.Data("Quit", true, 1, 0, null);
        layout[3]   = new MenuButton.Data("Credits", true, 2, 200, null);

        layout[1].text     = "Sound: " + (gc.sound ? "On" : "Off");
        actionSound.volume = gc.sound ? 1 : 0;
    }
Beispiel #4
0
 override public void ExecOperation(MenuButton.Data data)
 {
     if (data.auxValue == 500)
     {
         // Next page
         page++;
         if (page > 4)
         {
             page = 0;
         }
         UpdateLayout();
     }
     else
     {
         // Change scene
         SceneManager.LoadScene(data.auxValue);
     }
 }
Beispiel #5
0
    void UpdateLayout()
    {
        MenuButton.Data[] layout = new MenuButton.Data[6];
        int lCounter             = 0;
        int levelCounter         = page * 4;

        for (; levelCounter < (page + 1) * 4; ++levelCounter)
        {
            if (levelCounter < (gc.lastLevelCompleted + 1))
            {
                layout[lCounter++] = new MenuButton.Data("Level " + (levelCounter + 1), true, 2, levelCounter + 1, null);
            }
            else
            {
                layout[lCounter++] = new MenuButton.Data("Level " + (levelCounter + 1), false, 0, levelCounter + 1, null);
            }
        }

        layout[4] = new MenuButton.Data("More", true, 2, 500, null);
        layout[5] = new MenuButton.Data("Back", true, 1, 0, mainMenu);

        mm.SetButtons(layout);
    }
 public virtual void ExecOperation(MenuButton.Data op)
 {
 }