This commit is contained in:
gravity 2023-08-17 13:21:21 +03:00
commit 4ffae54437
6 changed files with 117 additions and 1 deletions

View 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();
}
}
}

View file

@ -26,7 +26,9 @@ internal class MenuGUI : AbstractGui
{ {
AppManager.Instance.ChangeGameState(GameState.Game); AppManager.Instance.ChangeGameState(GameState.Game);
}; };
var butMulti = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 190, 300, 50), text = "Multiplayer", fontName = "ButtonFont" }; var butMulti = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 190, 300, 50), text = "Multiplayer", fontName = "ButtonFont" };
Elements.Add(butMulti); Elements.Add(butMulti);
butMulti.LeftButtonPressed += () => butMulti.LeftButtonPressed += () =>
{ {
@ -37,6 +39,7 @@ internal class MenuGUI : AbstractGui
butOption.LeftButtonPressed += () => butOption.LeftButtonPressed += () =>
{ {
// открытие настроек // открытие настроек
AppManager.Instance.ChangeGameState(GameState.Options);
}; };
var butExit = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 310, 300, 50), text = "Exit", fontName = "ButtonFont" }; var butExit = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 310, 300, 50), text = "Exit", fontName = "ButtonFont" };
Elements.Add(butExit); Elements.Add(butExit);

View file

@ -0,0 +1,67 @@
using System;
using Microsoft.Xna.Framework;
using MonogameLibrary.UI.Base;
using MonogameLibrary.UI.Elements;
using System.Xml.Linq;
using DangerousD.GameCore.Managers;
using DangerousD.GameCore;
namespace DangerousD.GameCore.GUI
{
public class OptionsGUI : AbstractGui
{
protected override void CreateUI()
{
var slider = new Slider(Manager)
{
MinValue = 0,
MaxValue = 1,
rectangle = new Rectangle(650, 150, 100, 40)
};
var checkBox = new CheckBox(Manager);
checkBox.rectangle = new Rectangle(690, 400, 40, 40);
checkBox.Checked += (newCheckState) =>
{
SettingsManager sM = new SettingsManager();
};
var cB = new CheckBox(Manager);
cB.rectangle = new Rectangle(690, 275, 40, 40);
cB.Checked += (newCheckState) =>
{
SettingsManager sM = new SettingsManager();
};
Label lblOptions = new Label(Manager);
lblOptions.fontName = "Font2";
lblOptions.text = "Options";
lblOptions.rectangle = new Rectangle(300, 20, 210, 50);
lblOptions.mainColor = Color.Transparent;
Label lblValue = new Label(Manager);
lblValue.fontName = "Font2";
lblValue.text = "Valume";
lblValue.rectangle = new Rectangle(300, 150, 250, 40);
lblValue.mainColor = Color.Transparent;
Label lblIsFullScreen = new Label(Manager);
lblIsFullScreen.fontName = "Font2";
lblIsFullScreen.text = "Full Screen";
lblIsFullScreen.rectangle = new Rectangle(300, 400, 250, 40);
lblIsFullScreen.mainColor = Color.Transparent;
Label lblSwitchMode = new Label(Manager);
lblSwitchMode.fontName = "Font2";
lblSwitchMode.text = "Left/Right Mode";
lblSwitchMode.rectangle = new Rectangle(290, 275, 250, 40);
lblSwitchMode.mainColor = Color.Transparent;
ButtonText bTExit = new ButtonText(Manager);
bTExit.fontName = "Font2";
bTExit.text = "<-";
bTExit.rectangle = new Rectangle(20 , 15, 20, 10);
bTExit.fontColor = Color.Black;
}
}
}

View file

@ -38,13 +38,13 @@ namespace DangerousD.GameCore
Content.RootDirectory = "Content"; Content.RootDirectory = "Content";
IsMouseVisible = true; IsMouseVisible = true;
TargetElapsedTime = TimeSpan.FromMilliseconds(1000 / 30); TargetElapsedTime = TimeSpan.FromMilliseconds(1000 / 30);
_graphics.PreferredBackBufferWidth = resolution.X; _graphics.PreferredBackBufferWidth = resolution.X;
_graphics.PreferredBackBufferHeight = resolution.Y; _graphics.PreferredBackBufferHeight = resolution.Y;
//_graphics.IsFullScreen = true; //_graphics.IsFullScreen = true;
gameState = GameState.Menu; gameState = GameState.Menu;
MenuGUI = new MenuGUI(); MenuGUI = new MenuGUI();
LoginGUI = new LoginGUI(); LoginGUI = new LoginGUI();
OptionsGUI = new OptionsGUI();
LobbyGUI = new LobbyGUI(); LobbyGUI = new LobbyGUI();
DeathGUI = new DeathGUI(); DeathGUI = new DeathGUI();
UIManager.resolution = resolution; UIManager.resolution = resolution;
@ -56,6 +56,9 @@ namespace DangerousD.GameCore
AnimationBuilder.LoadAnimations(); AnimationBuilder.LoadAnimations();
MenuGUI.Initialize(GraphicsDevice); MenuGUI.Initialize(GraphicsDevice);
LoginGUI.Initialize(GraphicsDevice); LoginGUI.Initialize(GraphicsDevice);
OptionsGUI.Initialize(GraphicsDevice);
LobbyGUI.Initialize(GraphicsDevice); LobbyGUI.Initialize(GraphicsDevice);
DeathGUI.Initialize(GraphicsDevice); DeathGUI.Initialize(GraphicsDevice);
base.Initialize(); base.Initialize();
@ -66,6 +69,7 @@ namespace DangerousD.GameCore
_spriteBatch = new SpriteBatch(GraphicsDevice); _spriteBatch = new SpriteBatch(GraphicsDevice);
MenuGUI.LoadContent(); MenuGUI.LoadContent();
LoginGUI.LoadContent(); LoginGUI.LoadContent();
OptionsGUI.LoadContent();
LobbyGUI.LoadContent(); LobbyGUI.LoadContent();
DeathGUI.LoadContent(); DeathGUI.LoadContent();
GameObject.debugTexture = new Texture2D(GraphicsDevice, 1, 1); GameObject.debugTexture = new Texture2D(GraphicsDevice, 1, 1);

View file

@ -9,5 +9,9 @@ namespace DangerousD.GameCore.Managers
{ {
internal class SettingsManager internal class SettingsManager
{ {
public void SetFullScreen(bool IsFullScreen)
{
}
} }
} }

0
gitignore Normal file
View file