OptionsGUI
This commit is contained in:
parent
463db1b00a
commit
540f75734e
6 changed files with 93 additions and 2 deletions
38
DangerousD/GameCore/GUI/HUD.cs
Normal file
38
DangerousD/GameCore/GUI/HUD.cs
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using MonogameLibrary.UI.Elements;
|
||||||
|
|
||||||
|
namespace DangerousD.GameCore.GUI
|
||||||
|
{
|
||||||
|
public class HUD : IDrawableObject
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
public HUD()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Draw(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize(GraphicsDevice graphicsDevice)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void LoadContent()
|
||||||
|
{
|
||||||
|
var content = AppManager.Instance.Content;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ internal class MenuGUI : AbstractGui
|
||||||
{
|
{
|
||||||
AppManager.Instance.ChangeGameState(GameState.Game);
|
AppManager.Instance.ChangeGameState(GameState.Game);
|
||||||
};
|
};
|
||||||
|
|
||||||
var butMulti = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 190, 300, 50), text = "Multiplayer", fontName = "File" };
|
var butMulti = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 190, 300, 50), text = "Multiplayer", fontName = "File" };
|
||||||
Elements.Add(butMulti);
|
Elements.Add(butMulti);
|
||||||
butMulti.LeftButtonPressed += () =>
|
butMulti.LeftButtonPressed += () =>
|
||||||
|
@ -27,6 +28,7 @@ internal class MenuGUI : AbstractGui
|
||||||
butOption.LeftButtonPressed += () =>
|
butOption.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
// открытие настроек
|
// открытие настроек
|
||||||
|
AppManager.Instance.ChangeGameState(GameState.Options);
|
||||||
};
|
};
|
||||||
var butExit = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 310, 300, 50), text = "Exit", fontName = "File" };
|
var butExit = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 310, 300, 50), text = "Exit", fontName = "File" };
|
||||||
Elements.Add(butExit);
|
Elements.Add(butExit);
|
||||||
|
|
44
DangerousD/GameCore/GUI/OptionsGUI.cs
Normal file
44
DangerousD/GameCore/GUI/OptionsGUI.cs
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
using System;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
using MonogameLibrary.UI.Base;
|
||||||
|
using MonogameLibrary.UI.Elements;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
|
||||||
|
namespace DangerousD.GameCore.GUI
|
||||||
|
{
|
||||||
|
public class OptionsGUI : AbstractGui
|
||||||
|
{
|
||||||
|
protected override void CreateUI()
|
||||||
|
{
|
||||||
|
int wigth = AppManager.Instance.Window.ClientBounds.Width;
|
||||||
|
int height = AppManager.Instance.Window.ClientBounds.Height;
|
||||||
|
var butSingle = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 130, 300, 50), text = "Singleplayer", fontName = "File" };
|
||||||
|
Elements.Add(butSingle);
|
||||||
|
butSingle.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
AppManager.Instance.ChangeGameState(GameState.Game);
|
||||||
|
};
|
||||||
|
|
||||||
|
var butMulti = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 190, 300, 50), text = "Multiplayer", fontName = "File" };
|
||||||
|
Elements.Add(butMulti);
|
||||||
|
butMulti.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
AppManager.Instance.ChangeGameState(GameState.Login);
|
||||||
|
};
|
||||||
|
var butOption = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 250, 300, 50), text = "Option", fontName = "File" };
|
||||||
|
Elements.Add(butOption);
|
||||||
|
butOption.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
// открытие настроек
|
||||||
|
};
|
||||||
|
var butExit = new Button(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 310, 300, 50), text = "Exit", fontName = "File" };
|
||||||
|
Elements.Add(butExit);
|
||||||
|
butExit.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
AppManager.Instance.Exit();
|
||||||
|
};
|
||||||
|
|
||||||
|
var slider = new Slider(Manager) { };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using DangerousD.GameCore.Graphics;
|
using DangerousD.GameCore.Graphics;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -9,6 +10,10 @@ namespace DangerousD.GameCore.GameObjects.LivingEntities
|
||||||
{
|
{
|
||||||
public class Player : LivingEntity
|
public class Player : LivingEntity
|
||||||
{
|
{
|
||||||
|
public Player(Vector2 position) : base(position)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override GraphicsComponent GraphicsComponent => throw new NotImplementedException();
|
protected override GraphicsComponent GraphicsComponent => throw new NotImplementedException();
|
||||||
|
|
||||||
public void Kill()
|
public void Kill()
|
||||||
|
|
|
@ -8,7 +8,6 @@ namespace DangerousD.GameCore.Levels
|
||||||
{
|
{
|
||||||
public void InitLevel()
|
public void InitLevel()
|
||||||
{
|
{
|
||||||
new Player();
|
|
||||||
var Трава = new GrassBlock(new Vector2(0, 128));
|
var Трава = new GrassBlock(new Vector2(0, 128));
|
||||||
var Death = new TestAnimationDeath(new Vector2(128, 128));
|
var Death = new TestAnimationDeath(new Vector2(128, 128));
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ using DangerousD.GameCore.Graphics;
|
||||||
|
|
||||||
namespace DangerousD.GameCore
|
namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
public enum GameState { Menu, Options, Lobby, Game, Login }
|
public enum GameState { Menu, Options, Lobby, Game, Login, }
|
||||||
public class AppManager : Game
|
public class AppManager : Game
|
||||||
{
|
{
|
||||||
public static AppManager Instance { get; private set; }
|
public static AppManager Instance { get; private set; }
|
||||||
|
@ -38,6 +38,7 @@ namespace DangerousD.GameCore
|
||||||
gameState = GameState.Menu;
|
gameState = GameState.Menu;
|
||||||
MenuGUI = new MenuGUI();
|
MenuGUI = new MenuGUI();
|
||||||
LoginGUI = new LoginGUI();
|
LoginGUI = new LoginGUI();
|
||||||
|
OptionsGUI = new OptionsGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Initialize()
|
protected override void Initialize()
|
||||||
|
@ -45,6 +46,7 @@ namespace DangerousD.GameCore
|
||||||
AnimationBuilder.LoadAnimations();
|
AnimationBuilder.LoadAnimations();
|
||||||
MenuGUI.Initialize(GraphicsDevice);
|
MenuGUI.Initialize(GraphicsDevice);
|
||||||
LoginGUI.Initialize(GraphicsDevice);
|
LoginGUI.Initialize(GraphicsDevice);
|
||||||
|
OptionsGUI.Initialize(GraphicsDevice);
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +55,7 @@ namespace DangerousD.GameCore
|
||||||
_spriteBatch = new SpriteBatch(GraphicsDevice);
|
_spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||||
MenuGUI.LoadContent();
|
MenuGUI.LoadContent();
|
||||||
LoginGUI.LoadContent();
|
LoginGUI.LoadContent();
|
||||||
|
OptionsGUI.LoadContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update(GameTime gameTime)
|
protected override void Update(GameTime gameTime)
|
||||||
|
|
Loading…
Add table
Reference in a new issue