protected override void OnLoad(Microsoft.Xna.Framework.Content.ContentManager content, Microsoft.Xna.Framework.Graphics.GraphicsDevice gd) { base.OnLoad(content, gd); // Add the gear and smoke. if (Structure.Team == Teams.Left) { AddChild(new DrawableImage(LEFT_IMAGE) { RelativeOrigin = new Vector2(0.5f, 1.0f) }, 2); DrawableImage gear = new DrawableImage("MapObjects/gearnexus") { RelativeOrigin = new Vector2(0.5f), Position = new Vector2(-70, -85) }; AddChild(gear); gear.PerformAction(new ActionSequence(ActionSequence.INFINITE_SEQUENCE, new ActionRotateBy(new TimeSpan(0, 0, 1), 20, false))); AddChild(new SmokeSystem() { Position = new Vector2(-80, -180) }); AddChild(new SmokeSystem() { Position = new Vector2(-13, -160) }); } else { AddChild(new DrawableImage(RIGHT_IMAGE) { RelativeOrigin = new Vector2(0.5f, 1f), Position = new Vector2(5, 5) }, 3); AddChild(Diamond = new DrawableImage("MapObjects/rbaseDiamond") { RelativeOrigin = new Vector2(0.5f, 1f), Position = new Vector2(5, -25) }, 2); } //Add the life bar AddChild(LifeBar, 3); }
public ESCMenu() { State = MenuState.AllClosed; PlacementLayer = new Container(); MainBackgroundLayer = new Container(); VideoBackgroundLayer = new Container(); AudioBackgroundLayer = new Container(); // Main MenuItem main1 = new MenuItem(new DrawableLabel() { Text = "Video settings", RelativeOrigin = new Vector2(0.5f, 0.0f) }, new DrawableLabel() { Text = "Video settings", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Chocolate }, new DrawableLabel() { Text = "Video settings", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Aquamarine }) { ClickAction = () => OpenVideo() }; MenuItem main2 = new MenuItem(new DrawableLabel() { Text = "Audio settings", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Gray }, new DrawableLabel() { Text = "Audio settings", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Chocolate }, new DrawableLabel() { Text = "Audio settings", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Aquamarine }) { /*ClickAction = () => OpenAudio()*/ }; MenuItem main3 = new MenuItem(new DrawableLabel() { Text = "Return to Game", RelativeOrigin = new Vector2(0.5f, 0.0f) }, new DrawableLabel() { Text = "Return to Game", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Chocolate }, new DrawableLabel() { Text = "Return to Game", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Aquamarine }) { ClickAction = () => OpenOrCloseMainMenu(null, null) }; MenuItem main4 = new MenuItem(new DrawableLabel() { Text = "Exit Game", RelativeOrigin = new Vector2(0.5f, 0.0f) }, new DrawableLabel() { Text = "Exit Game", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Chocolate }, new DrawableLabel() { Text = "Exit Game", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Aquamarine }) { ClickAction = () => OpenExit() }; MainMenu = new Menu(main1, main2, main3, main4); MainMenu.AlignItemsVertically(30f); MainMenu.AllowKeyboard = true; // Audio MenuItem audio1 = new MenuItem(new DrawableLabel() { Text = "Less boomboom", RelativeOrigin = new Vector2(0.5f, 0.0f) }, new DrawableLabel() { Text = "Less boomboom", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Chocolate }, new DrawableLabel() { Text = "Less boomboom", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Aquamarine }); MenuItem audio2 = new MenuItem(new DrawableLabel() { Text = "More boomboom", RelativeOrigin = new Vector2(0.5f, 0.0f) }, new DrawableLabel() { Text = "More boomboom", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Chocolate }, new DrawableLabel() { Text = "More boomboom", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Aquamarine }); MenuItem audio3 = new MenuItem(new DrawableLabel() { Text = "Return to Main Menu", RelativeOrigin = new Vector2(0.5f, 0.0f) }, new DrawableLabel() { Text = "Return to Main Menu", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Chocolate }, new DrawableLabel() { Text = "Return to Main Menu", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Aquamarine }) { ClickAction = () => OpenOrCloseMainMenu(null, null) }; AudioMenu = new Menu(audio1, audio2, audio3); AudioMenu.AlignItemsVertically(30f); AudioMenu.AllowKeyboard = true; // Video MenuItem video1 = new MenuItem(new DrawableLabel() { Text = "Big Texture", RelativeOrigin = new Vector2(0.5f, 0.0f) }, new DrawableLabel() { Text = "Big Texture", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Chocolate }, new DrawableLabel() { Text = "Big Texture", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Aquamarine }) { ClickAction = () => screenService.GameWindowSize = screenService.ScreenSize }; MenuItem video2 = new MenuItem(new DrawableLabel() { Text = "Small Texture", RelativeOrigin = new Vector2(0.5f, 0.0f) }, new DrawableLabel() { Text = "Small Texture", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Chocolate }, new DrawableLabel() { Text = "Small Texture", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Aquamarine }) { ClickAction = () => screenService.GameWindowSize = new Vector2(900, 700) }; MenuItem video25 = new MenuItem(new DrawableLabel() { Text = "Fullscreen", RelativeOrigin = new Vector2(0.5f, 0.0f) }, new DrawableLabel() { Text = "Fullscreen", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Chocolate }, new DrawableLabel() { Text = "Fullscreen", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Aquamarine }) { ClickAction = () => screenService.SwitchFullscreen() }; MenuItem video3 = new MenuItem(new DrawableLabel() { Text = "Return to Main Menu", RelativeOrigin = new Vector2(0.5f, 0.0f) }, new DrawableLabel() { Text = "Return to Main Menu", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Chocolate }, new DrawableLabel() { Text = "Return to Main Menu", RelativeOrigin = new Vector2(0.5f, 0.0f), Tint = Color.Aquamarine }) { ClickAction = () => OpenOrCloseMainMenu(null, null) }; VideoMenu = new Menu(video1, video2, video25, video3); VideoMenu.AlignItemsVertically(30f); VideoMenu.AllowKeyboard = true; // Exit MenuItem exit1 = new MenuItem(new DrawableLabel() { Text = "No" }, new DrawableLabel() { Text = "Nice", Tint = Color.Chocolate }, new DrawableLabel() { Text = "Nice", Tint = Color.Aquamarine }) { ClickAction = () => OpenOrCloseMainMenu(null, null) }; MenuItem exit2 = new MenuItem(new DrawableLabel() { Text = "Yes" }, new DrawableLabel() { Text = "Why", Tint = Color.Chocolate }, new DrawableLabel() { Text = "Why", Tint = Color.Aquamarine }) { ClickAction = () => { Screen s = GetScreen(); if (s != null) { s.Exit = true; } else { Debug.Fail("It should has a screen"); } } }; //Exit ExitMenu = new Menu(exit1, exit2); ExitMenu.AlignItemsHorizontally(80); ExitMenu.AllowKeyboard = true; ExitMenu.Position = new Vector2(160, 95); ExitLayer = new Container(); ExitBackground = new DrawableImage("UIObjects/menuExit"); ExitLayer.Visible = false; // Exit gear GearExit = new DrawableImage("UIObjects/menuGear"); GearExit.Scale = new Vector2(0.9f, 0.9f); GearExit.RelativeOrigin = new Vector2(0.5f, 0.5f); GearExit.Position = new Vector2(25, 130); GearExit.PerformAction(new ActionSequence(-1, new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 350), 2, false), new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 200), 18, false), new ActionDelay(new TimeSpan(0, 0, 0, 0, 450)))); GearExit2 = new DrawableImage("UIObjects/menuGear"); GearExit2.Scale = new Vector2(0.8f, 0.8f); GearExit2.RelativeOrigin = new Vector2(0.5f, 0.5f); GearExit2.Position = new Vector2(200, 130); GearExit2.PerformAction(new ActionSequence(-1, new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 350), 2, false), new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 200), 18, false), new ActionDelay(new TimeSpan(0, 0, 0, 0, 450)))); GearExitMini = new DrawableImage("UIObjects/menuGear"); GearExitMini.Scale = new Vector2(0.6f, 0.6f); GearExitMini.RelativeOrigin = new Vector2(0.5f, 0.5f); GearExitMini.Position = new Vector2(115, 130); GearExitMini.PerformAction(new ActionSequence(-1, new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 350), -2, false), new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 200), -18, false), new ActionDelay(new TimeSpan(0, 0, 0, 0, 450)))); //Main MainBackground = new DrawableImage("UIObjects/menu"); MainBackgroundLayer.Visible = false; MainMenu.Position = new Vector2(100, 25); // Main gear GearMain = new DrawableImage("UIObjects/menuGear"); GearMain.RelativeOrigin = new Vector2(0.5f, 0.5f); GearMain.Position = new Vector2(25, 35); GearMain.PerformAction(new ActionSequence(-1, new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 350), 2, false), new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 200), 18, false), new ActionDelay(new TimeSpan(0, 0, 0, 0, 450)))); GearMiniMain = new DrawableImage("UIObjects/menuGear"); GearMiniMain.Scale = new Vector2(0.5f, 0.5f); GearMiniMain.RelativeOrigin = new Vector2(0.5f, 0.5f); GearMiniMain.Position = new Vector2(13, 115); GearMiniMain.PerformAction(new ActionSequence(-1, new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 350), -2, false), new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 200), -18, false), new ActionDelay(new TimeSpan(0, 0, 0, 0, 450)))); //Audio AudioBackground = new DrawableImage("UIObjects/menuAudio"); AudioBackgroundLayer.Visible = false; AudioMenu.Position = new Vector2(130, 27); // Audio gear GearAudio = new DrawableImage("UIObjects/menuGear"); GearAudio.RelativeOrigin = new Vector2(0.5f, 0.5f); GearAudio.Position = new Vector2(130, 35); GearAudio.PerformAction(new ActionSequence(-1, new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 350), 2, false), new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 200), 18, false), new ActionDelay(new TimeSpan(0, 0, 0, 0, 450)))); //Video VideoBackground = new DrawableImage("UIObjects/menuVideo"); VideoBackgroundLayer.Visible = false; VideoMenu.Position = new Vector2(150, 25); //Gear GearVideo = new DrawableImage("UIObjects/menuGear"); GearVideo.Scale = new Vector2(0.6f, 0.6f); GearVideo.RelativeOrigin = new Vector2(0.5f, 0.5f); GearVideo.Position = new Vector2(290, 130); GearVideo.PerformAction(new ActionSequence(-1, new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 350), 2, false), new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 200), 18, false), new ActionDelay(new TimeSpan(0, 0, 0, 0, 450)))); // Gear2 GearVideo2 = new DrawableImage("UIObjects/menuGear"); GearVideo2.Scale = new Vector2(0.6f, 0.6f); GearVideo2.RelativeOrigin = new Vector2(0.5f, 0.5f); GearVideo2.Position = new Vector2(250, 170); GearVideo2.PerformAction(new ActionSequence(-1, new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 350), -2, false), new ActionRotateBy(new TimeSpan(0, 0, 0, 0, 200), -18, false), new ActionDelay(new TimeSpan(0, 0, 0, 0, 450)))); }