Ejemplo n.º 1
0
    private void OnButtonList(MenuButtonBase sender)
    {
        switch (sender.buttonType)
        {
        case MenuButtonBase.ButtonTypes.NewGame:
            XMLManager.Instance.NewGame();
            menuAnimator.DoNew();
            scenesManager.LoadSceneByNumberDelay(2, 1.45f);
            break;

        case MenuButtonBase.ButtonTypes.Continue:
            menuAnimator.DoContinue();
            scenesManager.LoadSceneByNumberDelay(gameManager.playerStatus.currentLevel, 1.45f);
            break;

        case MenuButtonBase.ButtonTypes.Options:
            Slider   musicVol   = GameObject.Find("volumeSlider").GetComponent <Slider>();
            Slider   effectsVol = GameObject.Find("effectSlider").GetComponent <Slider>();
            Toggle   vibration  = GameObject.Find("vibrationToggle").GetComponent <Toggle>();
            Dropdown quality    = GameObject.Find("qualityDropdown").GetComponent <Dropdown>();
            musicVol.normalizedValue   = gameManager.preferences.musicVolume;
            effectsVol.normalizedValue = gameManager.preferences.effectsVolume;
            vibration.isOn             = gameManager.preferences.vibration;
            quality.value = gameManager.GetQuality();
            menuAnimator.DoOptions();
            break;

        case MenuButtonBase.ButtonTypes.Credits:
            menuAnimator.DoCredits();
            break;

        case MenuButtonBase.ButtonTypes.Exit:
            XMLManager.Instance.SaveData();
            Application.Quit();
            break;

        case MenuButtonBase.ButtonTypes.Back:
            XMLManager.Instance.SaveData();
            menuAnimator.DoBack();
            break;

        case MenuButtonBase.ButtonTypes.Resume:
            gameManager.continueButton = true;
            break;

        case MenuButtonBase.ButtonTypes.ToMainMenu:
            ScenesManager.Instance.LoadSceneByNumber(1);
            break;

        default:
            break;
        }
    }