void OpenVideo() { MainMenu.Active(false); VideoMenu.Active(true); State = MenuState.VideoOpened; VideoBackgroundLayer.Visible = true; MainBackgroundLayer.Visible = false; SetMenuSize(new Vector2(VideoBackground.Texture.Width, VideoBackground.Texture.Height)); }
// Use this for initialization void Start() { mainmenu = FindObjectOfType <MainMenu>(); soundmenu = FindObjectOfType <SoundMenu>(); videomenu = FindObjectOfType <VideoMenu>(); controlsmenu = FindObjectOfType <ControlsMenu>(); menus = new GameObject[] { mainmenu.gameObject, videomenu.gameObject, soundmenu.gameObject, controlsmenu.gameObject }; openMenu(0); }
public void OpenOrCloseMainMenu(object sender, EventArgs e) { var screen = (ScreenService)GetServices().GetService(typeof(ScreenService)); var sound = (SoundService)GetServices().GetService(typeof(SoundService)); sound.PlaySound(SoundsHelper.GetSoundPath(Sounds.OpenMenu), screen.GameWindowSize.X, screen.GameWindowSize.Y); if (State == MenuState.AllClosed) { State = MenuState.MainOpened; MainBackgroundLayer.Visible = true; MainMenu.Active(true); SetMenuSize(new Vector2(MainBackground.Texture.Width, MainBackground.Texture.Height)); screenService.IsMouseVisible = true; } else if (State == MenuState.MainOpened) { State = MenuState.AllClosed; MainBackgroundLayer.Visible = false; MainMenu.UnselectItems(); MainMenu.Active(false); screenService.IsMouseVisible = false; } else if (State == MenuState.AudioOpened) { State = MenuState.MainOpened; AudioBackgroundLayer.Visible = false; MainBackgroundLayer.Visible = true; AudioMenu.Active(false); MainMenu.Active(true); SetMenuSize(new Vector2(MainBackground.Texture.Width, MainBackground.Texture.Height)); } else if (State == MenuState.VideoOpened) { State = MenuState.MainOpened; VideoBackgroundLayer.Visible = false; MainBackgroundLayer.Visible = true; VideoMenu.Active(false); MainMenu.Active(true); SetMenuSize(new Vector2(MainBackground.Texture.Width, MainBackground.Texture.Height)); } else if (State == MenuState.ExitOpened) { State = MenuState.MainOpened; ExitLayer.Visible = false; MainBackgroundLayer.Visible = true; ExitMenu.Active(false); MainMenu.Active(true); SetMenuSize(new Vector2(MainBackground.Texture.Width, MainBackground.Texture.Height)); } }
protected override void OnLoad(ContentManager content, GraphicsDevice gd) { AddChild(PlacementLayer); PlacementLayer.AddChild(MainMenu, 2); PlacementLayer.AddChild(AudioMenu, 2); PlacementLayer.AddChild(VideoMenu, 2); PlacementLayer.AddChild(MainBackgroundLayer, 1); PlacementLayer.AddChild(AudioBackgroundLayer, 1); PlacementLayer.AddChild(VideoBackgroundLayer, 1); PlacementLayer.AddChild(ExitLayer, 1); VideoBackgroundLayer.AddChild(VideoBackground, 1); VideoBackgroundLayer.AddChild(new DrawableLabel() { Text = "*Changes will take effect after the next restart.", Scale = new Vector2(0.6f, 0.6f), Position = new Vector2(20, 150) }); VideoBackgroundLayer.AddChild(GearVideo, 0); VideoBackgroundLayer.AddChild(GearVideo2, 0); AudioBackgroundLayer.AddChild(AudioBackground, 1); AudioBackgroundLayer.AddChild(GearAudio, 0); MainBackgroundLayer.AddChild(GearMain, 0); MainBackgroundLayer.AddChild(GearMiniMain, 0); MainBackgroundLayer.AddChild(MainBackground, 1); ExitLayer.AddChild(ExitBackground, 1); ExitLayer.AddChild(new DrawableLabel() { Text = "Do you really want to quit?", Position = new Vector2(30, 25) }); ExitLayer.AddChild(ExitMenu, 2); ExitLayer.AddChild(GearExit, 0); ExitLayer.AddChild(GearExit2, 0); ExitLayer.AddChild(GearExitMini, 0); inputManager.RegisterEvent(InputActions.Escape, new EventHandler(OpenOrCloseMainMenu)); MainMenu.Active(false); AudioMenu.Active(false); VideoMenu.Active(false); ExitMenu.Active(false); SetMenuSize(new Vector2(MainBackground.Texture.Width, MainBackground.Texture.Height)); }
public void OnQuizzPressed() { VideoMenu.Show(); }