servergui
|
@ -89,9 +89,9 @@ namespace MonogameLibrary.UI.Elements
|
||||||
if (hoverState == HoverState.None)
|
if (hoverState == HoverState.None)
|
||||||
{
|
{
|
||||||
if (isSelected == IsSelected.Selected)
|
if (isSelected == IsSelected.Selected)
|
||||||
_spriteBatch.Draw(texture, rectangle, new Color(220, 220, 220));
|
_spriteBatch.Draw(texture, rectangle, new Color(211, 211, 211));
|
||||||
else
|
else
|
||||||
_spriteBatch.Draw(texture, rectangle, new Color(245, 245, 245));
|
_spriteBatch.Draw(texture, rectangle, Color.White);
|
||||||
}
|
}
|
||||||
else if (hoverState == HoverState.Hovering)
|
else if (hoverState == HoverState.Hovering)
|
||||||
_spriteBatch.Draw(texture, rectangle, new Color(211, 211, 211));
|
_spriteBatch.Draw(texture, rectangle, new Color(211, 211, 211));
|
||||||
|
|
|
@ -34,6 +34,54 @@
|
||||||
/processorParam:TextureFormat=Compressed
|
/processorParam:TextureFormat=Compressed
|
||||||
/build:Fonts/Font3.spritefont
|
/build:Fonts/Font3.spritefont
|
||||||
|
|
||||||
|
#begin Textures/GUI/background/base.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:Textures/GUI/background/base.png
|
||||||
|
|
||||||
|
#begin Textures/GUI/background/join.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:Textures/GUI/background/join.png
|
||||||
|
|
||||||
|
#begin Textures/GUI/background/selectMode.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:Textures/GUI/background/selectMode.png
|
||||||
|
|
||||||
|
#begin Textures/GUI/background/waiting.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:Textures/GUI/background/waiting.png
|
||||||
|
|
||||||
#begin Textures/GUI/checkboxs_off-on.png
|
#begin Textures/GUI/checkboxs_off-on.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
|
BIN
ZoFo/Content/Textures/GUI/background/base.png
Normal file
After Width: | Height: | Size: 648 KiB |
BIN
ZoFo/Content/Textures/GUI/background/join.png
Normal file
After Width: | Height: | Size: 320 KiB |
BIN
ZoFo/Content/Textures/GUI/background/selectMode.png
Normal file
After Width: | Height: | Size: 198 KiB |
BIN
ZoFo/Content/Textures/GUI/background/waiting.png
Normal file
After Width: | Height: | Size: 148 KiB |
BIN
ZoFo/Content/Textures/GUI/feature/i (1).webp
Normal file
After Width: | Height: | Size: 7.7 KiB |
BIN
ZoFo/Content/Textures/GUI/feature/i (2).webp
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
ZoFo/Content/Textures/GUI/feature/i.webp
Normal file
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 11 KiB |
|
@ -21,13 +21,13 @@ public class SelectModeMenu : AbstractGUI
|
||||||
int width = AppManager.Instance.CurentScreenResolution.X;
|
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||||
int height = AppManager.Instance.CurentScreenResolution.Y;
|
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||||
|
|
||||||
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\MenuBackground" };
|
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\selectMode" };
|
||||||
Elements.Add(menuBackground);
|
Elements.Add(menuBackground);
|
||||||
menuBackground.LoadTexture(AppManager.Instance.Content);
|
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"});
|
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)
|
Button singleButton = new Button(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(width / 4 - (width / 7) / 2, height / 2, (int)(width / 7), (int)(height / 20)),
|
rectangle = new Rectangle(width / 4 - (width / 7) / 2, height / 2, (int)(width / 7), (int)(height / 20)),
|
||||||
text = "singleplayer",
|
text = "singleplayer",
|
||||||
|
@ -36,13 +36,13 @@ public class SelectModeMenu : AbstractGUI
|
||||||
mainColor = Color.Gray,
|
mainColor = Color.Gray,
|
||||||
fontName = "Fonts\\Font"
|
fontName = "Fonts\\Font"
|
||||||
};
|
};
|
||||||
playButton.LeftButtonPressed += () =>
|
singleButton.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
// single
|
// single
|
||||||
|
|
||||||
// ваш код здесь
|
// ваш код здесь
|
||||||
};
|
};
|
||||||
Elements.Add(playButton);
|
Elements.Add(singleButton);
|
||||||
Button optionButton = new Button(Manager)
|
Button optionButton = new Button(Manager)
|
||||||
{
|
{
|
||||||
rectangle = new Rectangle(width / 2 + width / 4 - (width / 7) / 2, height / 2, (int)(width / 7), (int)(height / 20)),
|
rectangle = new Rectangle(width / 2 + width / 4 - (width / 7) / 2, height / 2, (int)(width / 7), (int)(height / 20)),
|
||||||
|
@ -54,11 +54,20 @@ public class SelectModeMenu : AbstractGUI
|
||||||
};
|
};
|
||||||
optionButton.LeftButtonPressed += () =>
|
optionButton.LeftButtonPressed += () =>
|
||||||
{
|
{
|
||||||
|
AppManager.Instance.SetGUI(new SelectingServerGUI());
|
||||||
// multi
|
// multi
|
||||||
|
|
||||||
// ваш код здесь
|
// ваш код здесь
|
||||||
};
|
};
|
||||||
Elements.Add(optionButton);
|
Elements.Add(optionButton);
|
||||||
|
|
||||||
|
Button bTExit = new Button(Manager)
|
||||||
|
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||||
|
Elements.Add(bTExit);
|
||||||
|
bTExit.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
AppManager.Instance.SetGUI(new MainMenuGUI());
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
|
|
|
@ -9,19 +9,94 @@ using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using MonogameLibrary.UI.Base;
|
using MonogameLibrary.UI.Base;
|
||||||
using MonogameLibrary.UI.Elements;
|
using MonogameLibrary.UI.Elements;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GUI;
|
namespace ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
public class SelectingServerGUI : AbstractGUI
|
public class SelectingServerGUI : AbstractGUI
|
||||||
{
|
{
|
||||||
|
private DrawableUIElement menuBackground;
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
// int width = AppManager.Instance.inGameHUDHelperResolution.X;
|
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||||
// int height = AppManager.Instance.inGameHUDHelperResolution.Y;
|
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||||
|
|
||||||
|
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\join" };
|
||||||
|
Elements.Add(menuBackground);
|
||||||
|
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||||
|
|
||||||
|
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Select server", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
|
||||||
|
|
||||||
|
TextBox ipBox = new TextBox(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(width / 4 - (width / 4) / 2, height / 4, (int)(width / 4), (int)(height / 20)),
|
||||||
|
text = "ip",
|
||||||
|
scale = 0.2f,
|
||||||
|
fontColor = Color.White,
|
||||||
|
mainColor = Color.Gray,
|
||||||
|
textAligment = MonogameLibrary.UI.Enums.TextAligment.Left,
|
||||||
|
fontName = "Fonts\\Font"
|
||||||
|
};
|
||||||
|
ipBox.TextChanged += input => {
|
||||||
|
if (input == "ip")
|
||||||
|
{
|
||||||
|
ipBox.text = ""; ipBox.fontColor = Color.White;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ipBox.StopChanging += input => {
|
||||||
|
if (input.Length == 0)
|
||||||
|
{
|
||||||
|
ipBox.fontColor = Color.White;
|
||||||
|
ipBox.text = "ip";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Elements.Add(ipBox);
|
||||||
|
Button joinButton = new Button(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(width / 4 + (width / 4) / 2, height / 4, (int)(width / 15), (int)(height / 20)),
|
||||||
|
text = "Join",
|
||||||
|
scale = 0.3f,
|
||||||
|
fontColor = Color.White,
|
||||||
|
mainColor = Color.Gray,
|
||||||
|
fontName = "Fonts\\Font"
|
||||||
|
};
|
||||||
|
joinButton.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
AppManager.Instance.SetGUI(new WaitingForPlayersGUI(false));
|
||||||
|
// join
|
||||||
|
|
||||||
|
// ваш код здесь
|
||||||
|
};
|
||||||
|
Elements.Add(joinButton);
|
||||||
|
Button hostButton = new Button(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(width / 4 + (width / 4) / 2 + (width / 15), height / 4, (int)(width / 15), (int)(height / 20)),
|
||||||
|
text = "Host",
|
||||||
|
scale = 0.3f,
|
||||||
|
fontColor = Color.White,
|
||||||
|
mainColor = Color.Gray,
|
||||||
|
fontName = "Fonts\\Font"
|
||||||
|
};
|
||||||
|
hostButton.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
AppManager.Instance.SetGUI(new WaitingForPlayersGUI(true));
|
||||||
|
// host
|
||||||
|
|
||||||
|
// ваш код здесь
|
||||||
|
};
|
||||||
|
Elements.Add(hostButton);
|
||||||
|
|
||||||
|
Button bTExit = new Button(Manager)
|
||||||
|
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||||
|
Elements.Add(bTExit);
|
||||||
|
bTExit.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
AppManager.Instance.SetGUI(new SelectModeMenu());
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,19 +9,61 @@ using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using MonogameLibrary.UI.Base;
|
using MonogameLibrary.UI.Base;
|
||||||
using MonogameLibrary.UI.Elements;
|
using MonogameLibrary.UI.Elements;
|
||||||
|
using ZoFo.GameCore.GameManagers;
|
||||||
|
|
||||||
namespace ZoFo.GameCore.GUI;
|
namespace ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
public class WaitingForPlayersGUI : AbstractGUI
|
public class WaitingForPlayersGUI : AbstractGUI
|
||||||
{
|
{
|
||||||
|
private DrawableUIElement menuBackground;
|
||||||
|
private bool isHost;
|
||||||
|
|
||||||
|
public WaitingForPlayersGUI(bool isHost)
|
||||||
|
{
|
||||||
|
this.isHost = isHost;
|
||||||
|
}
|
||||||
protected override void CreateUI()
|
protected override void CreateUI()
|
||||||
{
|
{
|
||||||
// int width = AppManager.Instance.inGameHUDHelperResolution.X;
|
int width = AppManager.Instance.CurentScreenResolution.X;
|
||||||
// int height = AppManager.Instance.inGameHUDHelperResolution.Y;
|
int height = AppManager.Instance.CurentScreenResolution.Y;
|
||||||
|
|
||||||
|
menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\Waiting" };
|
||||||
|
Elements.Add(menuBackground);
|
||||||
|
menuBackground.LoadTexture(AppManager.Instance.Content);
|
||||||
|
|
||||||
|
Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 7, (int)(width / 4), (int)(height / 20)), text = "Waiting", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"});
|
||||||
|
|
||||||
|
if (isHost)
|
||||||
|
{
|
||||||
|
Button startButton = new Button(Manager)
|
||||||
|
{
|
||||||
|
rectangle = new Rectangle(width / 2 - (width / 15) / 2, height / 2 + height / 4, (int)(width / 15), (int)(height / 20)),
|
||||||
|
text = "Start",
|
||||||
|
scale = 0.3f,
|
||||||
|
fontColor = Color.White,
|
||||||
|
mainColor = Color.Gray,
|
||||||
|
fontName = "Fonts\\Font"
|
||||||
|
};
|
||||||
|
startButton.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
// start
|
||||||
|
|
||||||
|
// ваш код здесь
|
||||||
|
};
|
||||||
|
Elements.Add(startButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
Button bTExit = new Button(Manager)
|
||||||
|
{ fontName = "Fonts\\Font3", scale = 0.4f, text = "<-", fontColor = Color.Black, mainColor = Color.Transparent, rectangle = new Rectangle(width / 30, height / 30, width / 40, width / 40), textureName = "Textures\\GUI\\checkboxs_off"};
|
||||||
|
Elements.Add(bTExit);
|
||||||
|
bTExit.LeftButtonPressed += () =>
|
||||||
|
{
|
||||||
|
AppManager.Instance.SetGUI(new SelectingServerGUI());
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(GameTime gameTime)
|
public override void Update(GameTime gameTime)
|
||||||
{
|
{
|
||||||
|
base.Update(gameTime);
|
||||||
}
|
}
|
||||||
}
|
}
|