gui
|
@ -20,6 +20,42 @@
|
||||||
/processorParam:TextureFormat=Compressed
|
/processorParam:TextureFormat=Compressed
|
||||||
/build:ButtonFont.spritefont
|
/build:ButtonFont.spritefont
|
||||||
|
|
||||||
|
#begin checkboxs_off-on.png
|
||||||
|
/importer:TextureImporter
|
||||||
|
/processor:TextureProcessor
|
||||||
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
/processorParam:ColorKeyEnabled=True
|
||||||
|
/processorParam:GenerateMipmaps=False
|
||||||
|
/processorParam:PremultiplyAlpha=True
|
||||||
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
|
/processorParam:MakeSquare=False
|
||||||
|
/processorParam:TextureFormat=Color
|
||||||
|
/build:checkboxs_off-on.png
|
||||||
|
|
||||||
|
#begin checkboxs_off.png
|
||||||
|
/importer:TextureImporter
|
||||||
|
/processor:TextureProcessor
|
||||||
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
/processorParam:ColorKeyEnabled=True
|
||||||
|
/processorParam:GenerateMipmaps=False
|
||||||
|
/processorParam:PremultiplyAlpha=True
|
||||||
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
|
/processorParam:MakeSquare=False
|
||||||
|
/processorParam:TextureFormat=Color
|
||||||
|
/build:checkboxs_off.png
|
||||||
|
|
||||||
|
#begin checkboxs_on.png
|
||||||
|
/importer:TextureImporter
|
||||||
|
/processor:TextureProcessor
|
||||||
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
/processorParam:ColorKeyEnabled=True
|
||||||
|
/processorParam:GenerateMipmaps=False
|
||||||
|
/processorParam:PremultiplyAlpha=True
|
||||||
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
|
/processorParam:MakeSquare=False
|
||||||
|
/processorParam:TextureFormat=Color
|
||||||
|
/build:checkboxs_on.png
|
||||||
|
|
||||||
#begin deathBackground.jpg
|
#begin deathBackground.jpg
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -101,6 +137,18 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:MonstersAnimations.png
|
/build:MonstersAnimations.png
|
||||||
|
|
||||||
|
#begin optionsBackground.jpg
|
||||||
|
/importer:TextureImporter
|
||||||
|
/processor:TextureProcessor
|
||||||
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
/processorParam:ColorKeyEnabled=True
|
||||||
|
/processorParam:GenerateMipmaps=False
|
||||||
|
/processorParam:PremultiplyAlpha=True
|
||||||
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
|
/processorParam:MakeSquare=False
|
||||||
|
/processorParam:TextureFormat=Color
|
||||||
|
/build:optionsBackground.jpg
|
||||||
|
|
||||||
#begin PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
|
#begin PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -113,7 +161,7 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
|
/build:PC_Computer_Dangerous_Dave_In_The_Haunted_Mansion_Death_Sequences.png
|
||||||
|
|
||||||
#begin textboxbackground.png
|
#begin textboxbackground1-1.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
/processorParam:ColorKeyColor=255,0,255,255
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
@ -123,9 +171,9 @@
|
||||||
/processorParam:ResizeToPowerOfTwo=False
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
/processorParam:MakeSquare=False
|
/processorParam:MakeSquare=False
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:textboxbackground.png
|
/build:textboxbackground1-1.png
|
||||||
|
|
||||||
#begin textboxbackground2.png
|
#begin textboxbackground2-1.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
/processorParam:ColorKeyColor=255,0,255,255
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
@ -135,7 +183,31 @@
|
||||||
/processorParam:ResizeToPowerOfTwo=False
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
/processorParam:MakeSquare=False
|
/processorParam:MakeSquare=False
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:textboxbackground2.png
|
/build:textboxbackground2-1.png
|
||||||
|
|
||||||
|
#begin textboxbackground2,5-1.png
|
||||||
|
/importer:TextureImporter
|
||||||
|
/processor:TextureProcessor
|
||||||
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
/processorParam:ColorKeyEnabled=True
|
||||||
|
/processorParam:GenerateMipmaps=False
|
||||||
|
/processorParam:PremultiplyAlpha=True
|
||||||
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
|
/processorParam:MakeSquare=False
|
||||||
|
/processorParam:TextureFormat=Color
|
||||||
|
/build:textboxbackground2,5-1.png
|
||||||
|
|
||||||
|
#begin textboxbackground6-1.png
|
||||||
|
/importer:TextureImporter
|
||||||
|
/processor:TextureProcessor
|
||||||
|
/processorParam:ColorKeyColor=255,0,255,255
|
||||||
|
/processorParam:ColorKeyEnabled=True
|
||||||
|
/processorParam:GenerateMipmaps=False
|
||||||
|
/processorParam:PremultiplyAlpha=True
|
||||||
|
/processorParam:ResizeToPowerOfTwo=False
|
||||||
|
/processorParam:MakeSquare=False
|
||||||
|
/processorParam:TextureFormat=Color
|
||||||
|
/build:textboxbackground6-1.png
|
||||||
|
|
||||||
#begin wall.jpg
|
#begin wall.jpg
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
|
|
BIN
DangerousD/Content/checkboxs_off-on.png
Normal file
After Width: | Height: | Size: 9.1 KiB |
BIN
DangerousD/Content/checkboxs_off.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
DangerousD/Content/checkboxs_on.png
Normal file
After Width: | Height: | Size: 9.7 KiB |
Before Width: | Height: | Size: 197 KiB After Width: | Height: | Size: 7.5 MiB |
BIN
DangerousD/Content/optionsBackground.jpg
Normal file
After Width: | Height: | Size: 252 KiB |
BIN
DangerousD/Content/textboxbackground1-1.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
BIN
DangerousD/Content/textboxbackground2-1.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
@ -11,14 +11,14 @@ internal class DeathGUI : AbstractGui
|
||||||
{
|
{
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
int wigth = AppManager.Instance.Window.ClientBounds.Width;
|
int wigth = AppManager.Instance.inGameResolution.X;
|
||||||
int height = AppManager.Instance.Window.ClientBounds.Height;
|
int height = AppManager.Instance.inGameResolution.Y;
|
||||||
var menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), textureName = "deathBackground" };
|
var menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), textureName = "deathBackground" };
|
||||||
Elements.Add(menuBackground);
|
Elements.Add(menuBackground);
|
||||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2, 120, 50, 50), text = "You death", mainColor = Color.Transparent, scale = 0.5f, fontName = "ButtonFont", fontColor = Color.White });
|
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2, (height - 50) / 2 - 80, 50, 50), text = "You death", mainColor = Color.Transparent, scale = 0.7f, fontName = "ButtonFont", fontColor = Color.White });
|
||||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2, 190, 50, 50), text = $"Score = {0}", mainColor = Color.Transparent, scale = 0.5f, fontName = "ButtonFont", fontColor = Color.White });
|
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2, (height - 50) / 2, 50, 50), text = $"Score = {0}", mainColor = Color.Transparent, scale = 0.7f, fontName = "ButtonFont", fontColor = Color.White });
|
||||||
var butMenu = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 260, 300, 50), text = "Back to menu", fontName = "ButtonFont" };
|
var butMenu = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, (height - 50) / 2 + 80, 300, 50), text = "Back to menu", scale = 0.7f, fontName = "ButtonFont" };
|
||||||
Elements.Add(butMenu);
|
Elements.Add(butMenu);
|
||||||
butMenu.LeftButtonPressed += () =>
|
butMenu.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -31,67 +31,72 @@ namespace DangerousD.GameCore.GUI
|
||||||
|
|
||||||
// CheckBoxs
|
// CheckBoxs
|
||||||
var lobby = new Label(Manager) { rectangle = new Rectangle(screenWidth / 30 * 2, screenHeight / 30 * 5,
|
var lobby = new Label(Manager) { rectangle = new Rectangle(screenWidth / 30 * 2, screenHeight / 30 * 5,
|
||||||
screenWidth / 30 * 26, screenHeight / 15 * 10), textureName = "textboxbackground2" };
|
screenWidth / 30 * 26, screenHeight / 15 * 10), textureName = "textboxbackground2,5-1" };
|
||||||
Elements.Add(lobby);
|
Elements.Add(lobby);
|
||||||
lobby.LoadTexture(AppManager.Instance.Content);
|
lobby.LoadTexture(AppManager.Instance.Content);
|
||||||
|
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
{
|
{
|
||||||
Button backButton = new ButtonText(Manager)
|
Button backButton = new Button(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 30, screenHeight / 30, 60, 50),
|
rectangle = new Rectangle(screenWidth / 30, screenHeight / 30, (int)(40 * 2.4), (int)(40 * 2.4)),
|
||||||
text = "<-",
|
text = "<-",
|
||||||
scale = 0.3f,
|
scale = 0.72f,
|
||||||
fontColor = Color.Black,
|
fontColor = Color.Black,
|
||||||
fontName = "font2"
|
fontName = "font2",
|
||||||
|
textureName = "textboxbackground1-1"
|
||||||
};
|
};
|
||||||
backButton.LeftButtonPressed += () => {
|
backButton.LeftButtonPressed += () => {
|
||||||
AppManager.Instance.ChangeGameState(GameState.Menu);
|
AppManager.Instance.ChangeGameState(GameState.Menu);
|
||||||
};
|
};
|
||||||
|
|
||||||
Button hostButton = new ButtonText(Manager)
|
Button hostButton = new Button(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 30, screenHeight / 15 * 13, 120, 50),
|
rectangle = new Rectangle(screenWidth / 30, screenHeight / 15 * 13, (int)(120 * 2.4), (int)(50 * 2.4)),
|
||||||
text = "Host",
|
text = "Host",
|
||||||
scale = 0.2f,
|
scale = 0.48f,
|
||||||
fontColor = Color.Black,
|
fontColor = Color.DarkBlue,
|
||||||
fontName = "font2"
|
fontName = "buttonFont",
|
||||||
|
textureName = "textboxbackground2-1"
|
||||||
};
|
};
|
||||||
hostButton.LeftButtonPressed += () => {
|
hostButton.LeftButtonPressed += () => {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Button refreshButton = new ButtonText(Manager)
|
Button refreshButton = new Button(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 30 * 6, screenHeight / 15 * 13, 120, 50),
|
rectangle = new Rectangle(screenWidth / 30 * 6, screenHeight / 15 * 13, (int)(120 * 2.4), (int)(50 * 2.4)),
|
||||||
text = "Refresh",
|
text = "Refresh",
|
||||||
scale = 0.2f,
|
scale = 0.48f,
|
||||||
fontColor = Color.Black,
|
fontColor = Color.DarkBlue,
|
||||||
fontName = "font2"
|
fontName = "buttonFont",
|
||||||
|
textureName = "textboxbackground2-1"
|
||||||
};
|
};
|
||||||
refreshButton.LeftButtonPressed += () => {
|
refreshButton.LeftButtonPressed += () => {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Button joinSelectedButton = new ButtonText(Manager)
|
Button joinSelectedButton = new Button(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 30 * 25, screenHeight / 15 * 13, 120, 50),
|
rectangle = new Rectangle(screenWidth / 30 * 25, screenHeight / 15 * 13, (int)(120 * 2.4), (int)(50 * 2.4)),
|
||||||
text = "Join",
|
text = "Join",
|
||||||
scale = 0.2f,
|
scale = 0.48f,
|
||||||
fontColor = Color.Black,
|
fontColor = Color.DarkBlue,
|
||||||
fontName = "font2"
|
fontName = "buttonFont",
|
||||||
|
textureName = "textboxbackground2-1"
|
||||||
};
|
};
|
||||||
joinSelectedButton.LeftButtonPressed += () => {
|
joinSelectedButton.LeftButtonPressed += () => {
|
||||||
|
|
||||||
};
|
};
|
||||||
Button joinByIpButton = new ButtonText(Manager)
|
Button joinByIpButton = new Button(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 30 * 25, screenHeight / 30, 120, 50),
|
rectangle = new Rectangle(screenWidth / 30 * 25, screenHeight / 30, (int)(120 * 2.4), (int)(50 * 2.4)),
|
||||||
text = "JoinByIp",
|
text = "JoinByIp",
|
||||||
scale = 0.2f,
|
scale = 0.48f,
|
||||||
fontColor = Color.Black,
|
fontColor = Color.DarkBlue,
|
||||||
fontName = "font2"
|
fontName = "buttonFont",
|
||||||
|
textureName = "textboxbackground2-1"
|
||||||
};
|
};
|
||||||
joinByIpButton.LeftButtonPressed += () => {
|
joinByIpButton.LeftButtonPressed += () => {
|
||||||
|
|
||||||
|
@ -104,11 +109,11 @@ namespace DangerousD.GameCore.GUI
|
||||||
rectangle = new Rectangle(screenWidth / 30 * 14, screenHeight / 30,
|
rectangle = new Rectangle(screenWidth / 30 * 14, screenHeight / 30,
|
||||||
screenWidth / 30 * 10, screenHeight / 30 * 3),
|
screenWidth / 30 * 10, screenHeight / 30 * 3),
|
||||||
text = "ip",
|
text = "ip",
|
||||||
scale = 0.16f,
|
scale = 0.384f,
|
||||||
fontColor = Color.White,
|
fontColor = Color.White,
|
||||||
fontName = "font2",
|
fontName = "font2",
|
||||||
textAligment = TextAligment.Left,
|
textAligment = TextAligment.Left,
|
||||||
textureName = "textboxbackground"
|
textureName = "textboxbackground6-1"
|
||||||
|
|
||||||
};
|
};
|
||||||
searchBarTextBox.LoadTexture(AppManager.Instance.Content);
|
searchBarTextBox.LoadTexture(AppManager.Instance.Content);
|
||||||
|
|
|
@ -32,9 +32,9 @@ namespace DangerousD.GameCore.GUI
|
||||||
loginBackground.LoadTexture(AppManager.Instance.Content);
|
loginBackground.LoadTexture(AppManager.Instance.Content);
|
||||||
|
|
||||||
Elements.Add(new Label(Manager) {
|
Elements.Add(new Label(Manager) {
|
||||||
rectangle = new Rectangle(screenWidth / 2 - 250, screenHeight / 6 - 50, 500, 100),
|
rectangle = new Rectangle(screenWidth / 2 - (int)(250 * 2.4), screenHeight / 6 - 100, (int)(500 * 2.4), (int)(100 * 2.4)),
|
||||||
text = "Login",
|
text = "Login",
|
||||||
scale = 0.8f,
|
scale = 1.7f,
|
||||||
fontColor = Color.White,
|
fontColor = Color.White,
|
||||||
mainColor = Color.Transparent,
|
mainColor = Color.Transparent,
|
||||||
fontName = "ButtonFont"
|
fontName = "ButtonFont"
|
||||||
|
@ -44,13 +44,13 @@ namespace DangerousD.GameCore.GUI
|
||||||
{
|
{
|
||||||
TextBox loginTextBox = new TextBox(Manager)
|
TextBox loginTextBox = new TextBox(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 2 - 125, screenHeight / 6 * 2 - 20, 250, 40),
|
rectangle = new Rectangle(screenWidth / 2 - (int)(125 * 2.4), screenHeight / 6 * 2 - 20, (int)(250 * 2.4), (int)(40 * 2.4)),
|
||||||
text = "NickName",
|
text = "NickName",
|
||||||
scale = 0.16f,
|
scale = 0.33f,
|
||||||
fontColor = Color.Gray,
|
fontColor = Color.Gray,
|
||||||
fontName = "Font2",
|
fontName = "Font2",
|
||||||
textAligment = TextAligment.Left,
|
textAligment = TextAligment.Left,
|
||||||
textureName = "textboxbackground"
|
textureName = "textboxbackground6-1"
|
||||||
|
|
||||||
};
|
};
|
||||||
loginTextBox.LoadTexture(AppManager.Instance.Content);
|
loginTextBox.LoadTexture(AppManager.Instance.Content);
|
||||||
|
@ -70,13 +70,13 @@ namespace DangerousD.GameCore.GUI
|
||||||
|
|
||||||
TextBox passwordTextBox = new TextBox(Manager)
|
TextBox passwordTextBox = new TextBox(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 2 - 125, screenHeight / 6 * 3 - 40, 250, 40),
|
rectangle = new Rectangle(screenWidth / 2 - (int)(125 * 2.4), screenHeight / 6 * 3 - 40, (int)(250 * 2.4), (int)(40 * 2.4)),
|
||||||
text = "Password",
|
text = "Password",
|
||||||
scale = 0.16f,
|
scale = 0.33f,
|
||||||
fontColor = Color.Gray,
|
fontColor = Color.Gray,
|
||||||
fontName = "font2",
|
fontName = "font2",
|
||||||
textAligment = TextAligment.Left,
|
textAligment = TextAligment.Left,
|
||||||
textureName = "textboxbackground"
|
textureName = "textboxbackground6-1"
|
||||||
};
|
};
|
||||||
passwordTextBox.LoadTexture(AppManager.Instance.Content);
|
passwordTextBox.LoadTexture(AppManager.Instance.Content);
|
||||||
passwordTextBox.TextChanged += input => {
|
passwordTextBox.TextChanged += input => {
|
||||||
|
@ -96,12 +96,13 @@ namespace DangerousD.GameCore.GUI
|
||||||
|
|
||||||
// Кнопки
|
// Кнопки
|
||||||
{
|
{
|
||||||
Button logButton = new ButtonText(Manager) {
|
Button logButton = new Button(Manager) {
|
||||||
rectangle = new Rectangle(screenWidth / 4 + 50, screenHeight / 6 * 4, 100, 50),
|
rectangle = new Rectangle(screenWidth / 4 + (int)(50 * 2.4), screenHeight / 6 * 3 + 100, (int)(100 * 2.4), (int)(50 * 2.4)),
|
||||||
text = "LogIn",
|
text = "LogIn",
|
||||||
scale = 0.2f,
|
scale = 0.6f,
|
||||||
fontColor = Color.Black,
|
fontColor = Color.White,
|
||||||
fontName = "font2"
|
fontName = "ButtonFont",
|
||||||
|
textureName = "textboxbackground2-1"
|
||||||
};
|
};
|
||||||
logButton.LeftButtonPressed += () => {
|
logButton.LeftButtonPressed += () => {
|
||||||
if (CheckUser())
|
if (CheckUser())
|
||||||
|
@ -110,23 +111,25 @@ namespace DangerousD.GameCore.GUI
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Button regButton = new ButtonText(Manager)
|
Button regButton = new Button(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 4 * 2 + 50, screenHeight / 6 * 4, 100, 50),
|
rectangle = new Rectangle(screenWidth / 4 * 2 + (int)(50 * 2.4), screenHeight / 6 * 3 + 100, (int)(100 * 2.4), (int)(50 * 2.4)),
|
||||||
text = "Reg",
|
text = "Reg",
|
||||||
scale = 0.2f,
|
scale = 0.6f,
|
||||||
fontColor = Color.Black,
|
fontColor = Color.White,
|
||||||
fontName = "font2"
|
fontName = "ButtonFont",
|
||||||
|
textureName = "textboxbackground2-1"
|
||||||
};
|
};
|
||||||
regButton.LeftButtonPressed += GoToRegWebServer;
|
regButton.LeftButtonPressed += GoToRegWebServer;
|
||||||
|
|
||||||
Button backButton = new ButtonText(Manager)
|
Button backButton = new Button(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(screenWidth / 20, screenHeight / 15, 50, 50),
|
rectangle = new Rectangle(screenWidth / 20, screenHeight / 15, (int)(40 * 2.4), (int)(40 * 2.4)),
|
||||||
text = "<-",
|
text = "<-",
|
||||||
scale = 0.3f,
|
scale = 0.72f,
|
||||||
fontColor = Color.Black,
|
fontColor = Color.Black,
|
||||||
fontName = "font2"
|
fontName = "font2",
|
||||||
|
textureName = "textboxbackground1-1"
|
||||||
};
|
};
|
||||||
backButton.LeftButtonPressed += () => {
|
backButton.LeftButtonPressed += () => {
|
||||||
AppManager.Instance.ChangeGameState(GameState.Menu);
|
AppManager.Instance.ChangeGameState(GameState.Menu);
|
||||||
|
|
|
@ -13,35 +13,50 @@ internal class MenuGUI : AbstractGui
|
||||||
int selected = 0;
|
int selected = 0;
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
int wigth = AppManager.Instance.Window.ClientBounds.Width;
|
int wigth = AppManager.Instance.inGameResolution.X;
|
||||||
int height = AppManager.Instance.Window.ClientBounds.Height;
|
int height = AppManager.Instance.inGameResolution.Y;
|
||||||
|
|
||||||
var menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), textureName = "menuFon" };
|
var menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), textureName = "menuFon" };
|
||||||
Elements.Add(menuBackground);
|
Elements.Add(menuBackground);
|
||||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 - 60, 60, 50, 50), text = "Dangerous", mainColor = Color.Transparent, scale = 0.7f, fontName = "Font2", fontColor = Color.White });
|
|
||||||
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 + 250, 90, 50, 50), text = "D", mainColor = Color.Transparent, scale = 1.2f, fontName = "Font2", fontColor = Color.White });
|
Color[] colors = new Color[] { new Color(64, 53, 51), new Color(84, 58, 52),
|
||||||
var butSingle = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 130, 300, 50), text = "Singleplayer", fontName = "ButtonFont" };
|
new Color(170, 101, 63), new Color(254, 208, 116), new Color(252, 231, 124) };
|
||||||
|
for (int i = 0; i < colors.Length; i++)
|
||||||
|
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 - 60, 200, 50, 50), text = "Dangerous", mainColor = Color.Transparent, scale = 1.35f - 0.05f * i * i / 10, fontName = "Font2", fontColor = colors[i] });
|
||||||
|
|
||||||
|
int dx = 50;
|
||||||
|
Color[] colors2 = new Color[] { new Color(64, 53, 51), new Color(84, 58, 52),
|
||||||
|
new Color(170, 101, 63), new Color(254, 208, 116), new Color(252, 231, 124) };
|
||||||
|
for (int i = 0; i < colors2.Length; i++)
|
||||||
|
Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 + 480 + dx - i * i, 260 - i * i / 5, 50, 50), text = "D", mainColor = Color.Transparent, scale = 2.15f - 0.05f * i * i / 5, fontName = "Font2", fontColor = colors2[i] });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 - 60, 200, 50, 50), text = "Dangerous", mainColor = Color.Transparent, scale = 1.2f, fontName = "Font2", fontColor = Color.White });
|
||||||
|
//Elements.Add(new Label(Manager) { rectangle = new Rectangle((wigth - 50) / 2 + 480, 240, 50, 50), text = "D", mainColor = Color.Transparent, scale = 2f, fontName = "Font2", fontColor = Color.White });
|
||||||
|
var butSingle = new ButtonText(Manager) { rectangle = new Rectangle((wigth - (int)(300 * 2.4)) / 2, 350, (int)(300 * 2.4), (int)(50 * 2.4)), text = "Singleplayer", scale = 1.2f, fontName = "ButtonFont" };
|
||||||
Elements.Add(butSingle);
|
Elements.Add(butSingle);
|
||||||
butSingle.LeftButtonPressed += () =>
|
butSingle.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
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 - (int)(300 * 2.4)) / 2, 470, (int)(300 * 2.4), (int)(50 * 2.4)), text = "Multiplayer", scale = 1.2f, fontName = "ButtonFont" };
|
||||||
|
|
||||||
Elements.Add(butMulti);
|
Elements.Add(butMulti);
|
||||||
butMulti.LeftButtonPressed += () =>
|
butMulti.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
AppManager.Instance.ChangeGameState(GameState.Login);
|
AppManager.Instance.ChangeGameState(GameState.Login);
|
||||||
};
|
};
|
||||||
var butOption = new ButtonText(Manager) { rectangle = new Rectangle((wigth - 300) / 2, 250, 300, 50), text = "Option", fontName = "ButtonFont" };
|
var butOption = new ButtonText(Manager) { rectangle = new Rectangle((wigth - (int)(160 * 2.4)) / 2, 590, (int)(160 * 2.4), (int)(50 * 2.4)), text = "Option", scale = 1.2f, fontName = "ButtonFont" };
|
||||||
Elements.Add(butOption);
|
Elements.Add(butOption);
|
||||||
butOption.LeftButtonPressed += () =>
|
butOption.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
// открытие настроек
|
// открытие настроек
|
||||||
AppManager.Instance.ChangeGameState(GameState.Options);
|
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 - (int)(110 * 2.4)) / 2, 710, (int)(110 * 2.4), (int)(50 * 2.4)), text = "Exit", scale = 1.2f, fontName = "ButtonFont" };
|
||||||
Elements.Add(butExit);
|
Elements.Add(butExit);
|
||||||
butExit.LeftButtonPressed += () =>
|
butExit.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,58 +10,64 @@ namespace DangerousD.GameCore.GUI
|
||||||
{
|
{
|
||||||
public class OptionsGUI : AbstractGui
|
public class OptionsGUI : AbstractGui
|
||||||
{
|
{
|
||||||
|
int selectedGUI = 0;
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
|
int wigth = AppManager.Instance.inGameResolution.X;
|
||||||
|
int height = AppManager.Instance.inGameResolution.Y;
|
||||||
|
var menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, wigth, height), textureName = "optionsBackground" };
|
||||||
|
Elements.Add(menuBackground);
|
||||||
|
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||||
|
|
||||||
var slider = new Slider(Manager)
|
var slider = new Slider(Manager)
|
||||||
{
|
{
|
||||||
MinValue = 0,
|
MinValue = 0,
|
||||||
MaxValue = 1,
|
MaxValue = 1,
|
||||||
rectangle = new Rectangle(650, 150, 100, 40)
|
rectangle = new Rectangle(wigth / 2 + 220, 275, (int)(100 * 2.4), 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);
|
var cB = new CheckBox(Manager);
|
||||||
cB.rectangle = new Rectangle(690, 275, 40, 40);
|
cB.rectangle = new Rectangle(wigth / 2 + 440, 405, (int)(40 * 2.4), (int)(40 * 2.4));
|
||||||
cB.Checked += (newCheckState) =>
|
cB.Checked += (newCheckState) =>
|
||||||
{
|
{
|
||||||
SettingsManager sM = new SettingsManager();
|
SettingsManager sM = new SettingsManager();
|
||||||
};
|
};
|
||||||
|
cB.LoadTexture(AppManager.Instance.Content);
|
||||||
|
|
||||||
Label lblOptions = new Label(Manager);
|
var checkBox = new CheckBox(Manager);
|
||||||
lblOptions.fontName = "Font2";
|
checkBox.rectangle = new Rectangle(wigth / 2 + 360, 540, (int)(40 * 2.4), (int)(40 * 2.4));
|
||||||
lblOptions.text = "Options";
|
checkBox.Checked += (newCheckState) =>
|
||||||
lblOptions.rectangle = new Rectangle(300, 20, 210, 50);
|
{
|
||||||
lblOptions.mainColor = Color.Transparent;
|
SettingsManager sM = new SettingsManager();
|
||||||
|
};
|
||||||
|
checkBox.LoadTexture(AppManager.Instance.Content);
|
||||||
|
|
||||||
Label lblValue = new Label(Manager);
|
Label lblOptions = new Label(Manager)
|
||||||
lblValue.fontName = "Font2";
|
{ fontName = "buttonFont", scale = 1.2f, text = "Options", fontColor = Color.White, rectangle = new Rectangle((wigth - 50) / 2, 40, 50, 50), mainColor = Color.Transparent };
|
||||||
lblValue.text = "Valume";
|
Elements.Add(lblOptions);
|
||||||
lblValue.rectangle = new Rectangle(300, 150, 250, 40);
|
|
||||||
lblValue.mainColor = Color.Transparent;
|
|
||||||
|
|
||||||
Label lblIsFullScreen = new Label(Manager);
|
Label lblValue = new Label(Manager)
|
||||||
lblIsFullScreen.fontName = "Font2";
|
{ fontName = "buttonFont", scale = 1f, text = "Volume", fontColor = Color.White, rectangle = new Rectangle((wigth - 50) / 2, 250, 50, 50), mainColor = Color.Transparent };
|
||||||
lblIsFullScreen.text = "Full Screen";
|
Elements.Add(lblValue);
|
||||||
lblIsFullScreen.rectangle = new Rectangle(300, 400, 250, 40);
|
|
||||||
lblIsFullScreen.mainColor = Color.Transparent;
|
|
||||||
|
|
||||||
Label lblSwitchMode = new Label(Manager);
|
Label lblIsFullScreen = new Label(Manager)
|
||||||
lblSwitchMode.fontName = "Font2";
|
{ fontName = "buttonFont", scale = 1f, text = "Full Screen", fontColor = Color.White, rectangle = new Rectangle((wigth - 50) / 2, 580, 50, 50), mainColor = Color.Transparent };
|
||||||
lblSwitchMode.text = "Left/Right Mode";
|
Elements.Add(lblOptions);
|
||||||
lblSwitchMode.rectangle = new Rectangle(290, 275, 250, 40);
|
|
||||||
lblSwitchMode.mainColor = Color.Transparent;
|
|
||||||
|
|
||||||
ButtonText bTExit = new ButtonText(Manager);
|
Label lblSwitchMode = new Label(Manager)
|
||||||
bTExit.fontName = "Font2";
|
{ fontName = "buttonFont", scale = 1f, text = "Left/Right Mode", fontColor = Color.White, rectangle = new Rectangle((wigth - 50) / 2, 415, 50, 50), mainColor = Color.Transparent };
|
||||||
bTExit.text = "<-";
|
Elements.Add(lblSwitchMode);
|
||||||
bTExit.rectangle = new Rectangle(20 , 15, 20, 10);
|
|
||||||
bTExit.fontColor = Color.Black;
|
Button bTExit = new Button(Manager)
|
||||||
|
{ fontName = "Font2", scale = 0.72f, text = "<-", rectangle = new Rectangle(wigth / 30, height / 30, (int)(40 * 2.4), (int)(40 * 2.4)), textureName = "textboxbackground1-1" };
|
||||||
|
Elements.Add(bTExit);
|
||||||
|
bTExit.LeftButtonPressed += () => {
|
||||||
|
AppManager.Instance.ChangeGameState(GameState.Menu);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
public override void Update(GameTime gameTime)
|
||||||
|
{
|
||||||
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -11,7 +11,7 @@ namespace DangerousD.GameCore
|
||||||
{
|
{
|
||||||
public enum ScopeState { Up, Middle, Down }
|
public enum ScopeState { Up, Middle, Down }
|
||||||
public enum ControlsState { Gamepad, Keyboard, Mouse }
|
public enum ControlsState { Gamepad, Keyboard, Mouse }
|
||||||
class InputManager
|
public class InputManager
|
||||||
{
|
{
|
||||||
public delegate void Delegat();
|
public delegate void Delegat();
|
||||||
public event Delegat MovEventJump;
|
public event Delegat MovEventJump;
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace DangerousD.GameCore
|
||||||
private GraphicsDeviceManager _graphics;
|
private GraphicsDeviceManager _graphics;
|
||||||
private SpriteBatch _spriteBatch;
|
private SpriteBatch _spriteBatch;
|
||||||
public Point resolution = new Point(1920, 1080);
|
public Point resolution = new Point(1920, 1080);
|
||||||
public Point inGameResolution = new Point(800, 480);
|
public Point inGameResolution = new Point(1920, 1080);
|
||||||
GameState gameState;
|
GameState gameState;
|
||||||
IDrawableObject MenuGUI;
|
IDrawableObject MenuGUI;
|
||||||
IDrawableObject OptionsGUI;
|
IDrawableObject OptionsGUI;
|
||||||
|
@ -30,6 +30,7 @@ namespace DangerousD.GameCore
|
||||||
public GameManager GameManager { get; private set; } = new GameManager();
|
public GameManager GameManager { get; private set; } = new GameManager();
|
||||||
public AnimationBuilder AnimationBuilder { get; private set; } = new AnimationBuilder();
|
public AnimationBuilder AnimationBuilder { get; private set; } = new AnimationBuilder();
|
||||||
public NetworkManager NetworkManager { get; private set; } = new NetworkManager();
|
public NetworkManager NetworkManager { get; private set; } = new NetworkManager();
|
||||||
|
public InputManager InputManager { get; private set; } = new InputManager();
|
||||||
private RenderTarget2D renderTarget;
|
private RenderTarget2D renderTarget;
|
||||||
public AppManager()
|
public AppManager()
|
||||||
{
|
{
|
||||||
|
@ -40,8 +41,8 @@ namespace DangerousD.GameCore
|
||||||
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();
|
OptionsGUI = new OptionsGUI();
|
||||||
|
@ -82,6 +83,8 @@ namespace DangerousD.GameCore
|
||||||
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
|
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
|
||||||
Exit();
|
Exit();
|
||||||
|
|
||||||
|
InputManager.Update();
|
||||||
|
|
||||||
switch (gameState)
|
switch (gameState)
|
||||||
{
|
{
|
||||||
case GameState.Menu:
|
case GameState.Menu:
|
||||||
|
|
|
@ -11,11 +11,13 @@ using static System.Net.Mime.MediaTypeNames;
|
||||||
|
|
||||||
namespace MonogameLibrary.UI.Base
|
namespace MonogameLibrary.UI.Base
|
||||||
{
|
{
|
||||||
|
public enum InputState { GamePad, Keyboard, Mouse }
|
||||||
public class UIManager
|
public class UIManager
|
||||||
{
|
{
|
||||||
Dictionary<int, List<DrawableUIElement>> layerCollection = new();
|
Dictionary<int, List<DrawableUIElement>> layerCollection = new();
|
||||||
public GraphicsDevice GraphicsDevice { get; private set; }
|
public GraphicsDevice GraphicsDevice { get; private set; }
|
||||||
public SpriteFont BaseFont { get; private set; }
|
public SpriteFont BaseFont { get; private set; }
|
||||||
|
public InputState inputState = InputState.Mouse;
|
||||||
public void Initialize(GraphicsDevice graphicsDevice)
|
public void Initialize(GraphicsDevice graphicsDevice)
|
||||||
{
|
{
|
||||||
GraphicsDevice = graphicsDevice;
|
GraphicsDevice = graphicsDevice;
|
||||||
|
|
|
@ -24,6 +24,7 @@ namespace MonogameLibrary.UI.Elements
|
||||||
|
|
||||||
public virtual bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
|
public virtual bool InteractUpdate(MouseState mouseState, MouseState prevmouseState)
|
||||||
{
|
{
|
||||||
|
//if (Manager.)
|
||||||
if (rectangle.Intersects(new Rectangle(mouseState.Position, Point.Zero)))
|
if (rectangle.Intersects(new Rectangle(mouseState.Position, Point.Zero)))
|
||||||
{
|
{
|
||||||
if (mouseState.LeftButton == ButtonState.Pressed || mouseState.RightButton == ButtonState.Pressed)
|
if (mouseState.LeftButton == ButtonState.Pressed || mouseState.RightButton == ButtonState.Pressed)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Content;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using MonogameLibrary.UI.Base;
|
using MonogameLibrary.UI.Base;
|
||||||
|
@ -15,6 +16,9 @@ namespace MonogameLibrary.UI.Elements
|
||||||
public CheckBox(UIManager manager, int layerIndex = 0) : base(manager, layerIndex)
|
public CheckBox(UIManager manager, int layerIndex = 0) : base(manager, layerIndex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
private Texture2D texture1;
|
||||||
|
private Texture2D texture2;
|
||||||
|
private Texture2D texture3;
|
||||||
public delegate void OnCheck(bool checkState);
|
public delegate void OnCheck(bool checkState);
|
||||||
public event OnCheck? Checked;
|
public event OnCheck? Checked;
|
||||||
private bool isChecked;
|
private bool isChecked;
|
||||||
|
@ -42,25 +46,33 @@ namespace MonogameLibrary.UI.Elements
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void LoadTexture(ContentManager content)
|
||||||
|
{
|
||||||
|
texture1 = content.Load<Texture2D>("checkboxs_off");
|
||||||
|
texture2 = content.Load<Texture2D>("checkboxs_off-on");
|
||||||
|
texture3 = content.Load<Texture2D>("checkboxs_on");
|
||||||
|
base.LoadTexture(content);
|
||||||
|
}
|
||||||
public override void Draw(SpriteBatch _spriteBatch)
|
public override void Draw(SpriteBatch _spriteBatch)
|
||||||
{
|
{
|
||||||
if (isChecked)
|
if (isChecked)
|
||||||
{
|
{
|
||||||
if (hoverState == HoverState.None)
|
if (hoverState == HoverState.None)
|
||||||
_spriteBatch.Draw(texture, rectangle, new Color(124, 255, 0));
|
_spriteBatch.Draw(texture3, rectangle, Color.White);
|
||||||
else if (hoverState == HoverState.Hovering)
|
else if (hoverState == HoverState.Hovering)
|
||||||
_spriteBatch.Draw(texture, rectangle, new Color(124, 215, 0));
|
_spriteBatch.Draw(texture3, rectangle, Color.White);
|
||||||
else
|
else
|
||||||
_spriteBatch.Draw(texture, rectangle, new Color(124, 175, 0));
|
_spriteBatch.Draw(texture2, rectangle, Color.White );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (hoverState == HoverState.None)
|
if (hoverState == HoverState.None)
|
||||||
_spriteBatch.Draw(texture, rectangle, new Color(255, 20, 0));
|
_spriteBatch.Draw(texture1, rectangle, Color.White);
|
||||||
else if (hoverState == HoverState.Hovering)
|
else if (hoverState == HoverState.Hovering)
|
||||||
_spriteBatch.Draw(texture, rectangle, new Color(215, 20, 0));
|
_spriteBatch.Draw(texture2, rectangle, Color.White);
|
||||||
else
|
else
|
||||||
_spriteBatch.Draw(texture, rectangle, new Color(175, 20, 0));
|
_spriteBatch.Draw(texture2, rectangle, Color.White);
|
||||||
}
|
}
|
||||||
DrawText(_spriteBatch);
|
DrawText(_spriteBatch);
|
||||||
}
|
}
|
||||||
|
|