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; } }
private static void ReplaceMainMenuButton() { Transform mainMenu = SingletonBehaviour <CanvasSpawner> .Instance.CanvasGO.transform.Find("Main Menu"); GameObject go = CreateButton(new ButtonBuilder("Multiplayer", "UI_Multiplayer.png", mainMenu, mainMenu.Find("Button Altfuture").gameObject, "Multiplayer")); Object.DestroyImmediate(go.GetComponent <MenuSocial>()); MenuButtonBase bbase = go.AddComponent <MenuButtonBase>(); MenuButtonBase refBase = SingletonBehaviour <CanvasSpawner> .Instance.CanvasGO.transform.Find("Main Menu").Find("Button Back to Game").GetComponent <MenuButtonBase>(); bbase.hoverAudio = refBase.hoverAudio; bbase.clickAudio = refBase.clickAudio; }