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); }
/// <summary> /// Loads the content. /// </summary> /// <param name="gd">The graphics device used for the screen.</param> /// <param name="batch">The spritebatch used to draw.</para> public void LoadContent(GraphicsDevice gd) { Graphics = gd; spriteBatch = new SpriteBatch(gd); OnLoadContent(); Cursor = new DrawableImage("Base/cursor"); AddChild(Cursor, 100); ((InputManager)Services.GetService(typeof(InputManager))).Cursor = Cursor; }
public DrawableBase(Base theBase, bool ally) : base(theBase) { Position = new Vector2(theBase.Rectangle.X + theBase.Rectangle.Width / 2f, theBase.Rectangle.Bottom); LifeBar = new DrawableBaseLifeBar(ally) { Position = new Vector2(0f,-250f), MaxHealth = theBase.MaxHealth, Health = theBase.Health }; Diamond = null; ticks = 0; }
public SpellMenuItem(SpellCastInfo info, DrawableImage icon) : base(new DrawableImage("UIObjects/spellBox"), new DrawableImage("UIObjects/spellBox"), new DrawableImage("UIObjects/spellBox")) { Clickable = false; //StateClicking.Position = new Vector2(2, 2); AddChild(new DrawableImage("UIObjects/spellBoxDropShadow"){Position = new Vector2(2,2)},0); //ClickAction = () => Cast(); Info = info; CoolDown = new DrawableRectangle(new Rectangle((int)NORMAL_WIDTH/2, (int)NORMAL_WIDTH, (int)NORMAL_WIDTH, (int)NORMAL_WIDTH), Color.Aqua); CoolDown.RelativeOrigin = new Vector2(0.5f,1f); CoolDown.Alpha = 0.3f; AddChild(CoolDown,3); Icon = icon; AddChild(Icon,2); }
public GameUI(CurrentChampionState ccs, PingCounter ping, GameScore score) { ChampionState = ccs; UIFPSCounter = new FPSCounter(); AddChild(UIFPSCounter,2); UIPingCounter = ping; AddChild(UIPingCounter,2); /*Map = new DrawableImage("UIObjects/map"); AddChild(Map);*/ SpellBackground = new DrawableImage("UIObjects/spellBackground"); AddChild(SpellBackground); LifeDropshadow = new DrawableImage("UIObjects/lifeDrop"); LifeDropshadow.RelativeOrigin = new Vector2(0f,1f); AddChild(LifeDropshadow); ResourceDropShadow = new DrawableImage("UIObjects/manaDrop"); ResourceDropShadow.RelativeOrigin = new Vector2(0f,1f); //AddChild(ResourceDropShadow); Life = new DrawableImage("UIObjects/life"); Life.RelativeOrigin = new Vector2(0f,1f); AddChild(Life); Resource = new DrawableImage("UIObjects/mana"); Resource.RelativeOrigin = new Vector2(0f,1f); //AddChild(Resource); ScoreBackground = new DrawableImage("UIObjects/boxBackground"); AddChild(ScoreBackground); MoneyBackground = new DrawableImage("UIObjects/boxBackground"); AddChild(MoneyBackground); /*ObjectBackground = new DrawableImage("UIObjects/boxBackground"); AddChild(ObjectBackground);*/ UISpellMenu = new SpellMenu(ChampionState); AddChild(UISpellMenu,3); GameScore = score; }
private void SetScore() { Kills = new DrawableLabel() { Text = "0"}; Deaths = new DrawableLabel() { Text = "0"}; TeamKills = new DrawableLabel() { Text = "0", Tint = Color.Green}; TeamDeaths = new DrawableLabel() { Text = "0", Tint = Color.Red}; AddChild(Kills,3); AddChild(Deaths,3); AddChild(TeamKills,3); AddChild(TeamDeaths,3); Kills.SetPositionRelativeToObject(ScoreBackground, new Vector2(20, 10)); Deaths.SetPositionRelativeToObject(Kills, new Vector2(70, 0)); TeamKills.SetPositionRelativeToObject(Deaths, new Vector2(120, 0)); TeamDeaths.SetPositionRelativeToObject(TeamKills, new Vector2(70, 0)); DrawableImage killIcon = new DrawableImage("UIObjects/killIcon"); DrawableImage deathIcon = new DrawableImage("UIObjects/deathIcon"); DrawableImage teamKillIcon = new DrawableImage("UIObjects/killIcon"); AddChild(killIcon,2); AddChild(deathIcon,2); AddChild(teamKillIcon,2); killIcon.SetPositionRelativeToObject(Kills, new Vector2(23, -2)); deathIcon.SetPositionRelativeToObject(Deaths, new Vector2(23, -2)); teamKillIcon.SetPositionRelativeToObject(TeamKills, new Vector2(23, -2)); }
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)))); }
/// <summary> /// Loads the content. /// </summary> /// <param name="gd">The graphics device used for the screen.</param> /// <param name="batch">The spritebatch used to draw.</para> public void LoadContent(GraphicsDevice gd) { Graphics = gd; spriteBatch = new SpriteBatch(gd); OnLoadContent(); Cursor = new DrawableImage("Base/cursor"); AddChild(Cursor,100); ((InputManager)Services.GetService(typeof(InputManager))).Cursor = Cursor; }