Merge pull request #18 from progtime-net/GUI

optionsDone
This commit is contained in:
SergoDobro 2024-08-16 12:14:46 +03:00 committed by GitHub
commit f840ea9e78
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 45 additions and 4 deletions

View file

@ -39,7 +39,7 @@ public class MainMenuGUI : AbstractGUI
};
playButton.LeftButtonPressed += () =>
{
AppManager.Instance.SetGUI(new SelectModeMenu());
};
Elements.Add(playButton);
Button optionButton = new Button(Manager)

View file

@ -9,19 +9,60 @@ using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MonogameLibrary.UI.Base;
using MonogameLibrary.UI.Elements;
using ZoFo.GameCore.GameManagers;
namespace ZoFo.GameCore.GUI;
public class SelectModeMenu : AbstractGUI
{
private DrawableUIElement menuBackground;
protected override void CreateUI()
{
// int width = AppManager.Instance.inGameHUDHelperResolution.X;
// int height = AppManager.Instance.inGameHUDHelperResolution.Y;
int width = AppManager.Instance.CurentScreenResolution.X;
int height = AppManager.Instance.CurentScreenResolution.Y;
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\MenuBackground" };
Elements.Add(menuBackground);
menuBackground.LoadTexture(AppManager.Instance.Content);
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 6, (int)(width / 4), (int)(height / 20)), text = "Select mode", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
Button playButton = new Button(Manager)
{
rectangle = new Rectangle(width / 4 - (width / 7) / 2, height / 2, (int)(width / 7), (int)(height / 20)),
text = "singleplayer",
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
};
playButton.LeftButtonPressed += () =>
{
// single
// ваш код здесь
};
Elements.Add(playButton);
Button optionButton = new Button(Manager)
{
rectangle = new Rectangle(width / 2 + width / 4 - (width / 7) / 2, height / 2, (int)(width / 7), (int)(height / 20)),
text = "multiplayer",
scale = 0.3f,
fontColor = Color.White,
mainColor = Color.Gray,
fontName = "Fonts\\Font"
};
optionButton.LeftButtonPressed += () =>
{
// multi
// ваш код здесь
};
Elements.Add(optionButton);
}
public override void Update(GameTime gameTime)
{
base.Update(gameTime);
}
}