diff --git a/MonogameLibrary/UI/Elements/TextBox.cs b/MonogameLibrary/UI/Elements/TextBox.cs index 87534eb..529a8be 100644 --- a/MonogameLibrary/UI/Elements/TextBox.cs +++ b/MonogameLibrary/UI/Elements/TextBox.cs @@ -89,9 +89,9 @@ namespace MonogameLibrary.UI.Elements if (hoverState == HoverState.None) { if (isSelected == IsSelected.Selected) - _spriteBatch.Draw(texture, rectangle, new Color(220, 220, 220)); + _spriteBatch.Draw(texture, rectangle, new Color(211, 211, 211)); else - _spriteBatch.Draw(texture, rectangle, new Color(245, 245, 245)); + _spriteBatch.Draw(texture, rectangle, Color.White); } else if (hoverState == HoverState.Hovering) _spriteBatch.Draw(texture, rectangle, new Color(211, 211, 211)); diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index a608235..f9ac38a 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -34,6 +34,54 @@ /processorParam:TextureFormat=Compressed /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 /importer:TextureImporter /processor:TextureProcessor diff --git a/ZoFo/Content/Textures/GUI/background/base.png b/ZoFo/Content/Textures/GUI/background/base.png new file mode 100644 index 0000000..11cbac6 Binary files /dev/null and b/ZoFo/Content/Textures/GUI/background/base.png differ diff --git a/ZoFo/Content/Textures/GUI/background/join.png b/ZoFo/Content/Textures/GUI/background/join.png new file mode 100644 index 0000000..59d539a Binary files /dev/null and b/ZoFo/Content/Textures/GUI/background/join.png differ diff --git a/ZoFo/Content/Textures/GUI/background/selectMode.png b/ZoFo/Content/Textures/GUI/background/selectMode.png new file mode 100644 index 0000000..256ae2c Binary files /dev/null and b/ZoFo/Content/Textures/GUI/background/selectMode.png differ diff --git a/ZoFo/Content/Textures/GUI/background/waiting.png b/ZoFo/Content/Textures/GUI/background/waiting.png new file mode 100644 index 0000000..709fb0b Binary files /dev/null and b/ZoFo/Content/Textures/GUI/background/waiting.png differ diff --git a/ZoFo/Content/Textures/GUI/feature/i (1).webp b/ZoFo/Content/Textures/GUI/feature/i (1).webp new file mode 100644 index 0000000..751b392 Binary files /dev/null and b/ZoFo/Content/Textures/GUI/feature/i (1).webp differ diff --git a/ZoFo/Content/Textures/GUI/feature/i (2).webp b/ZoFo/Content/Textures/GUI/feature/i (2).webp new file mode 100644 index 0000000..a59827e Binary files /dev/null and b/ZoFo/Content/Textures/GUI/feature/i (2).webp differ diff --git a/ZoFo/Content/Textures/GUI/feature/i.webp b/ZoFo/Content/Textures/GUI/feature/i.webp new file mode 100644 index 0000000..69b1f1f Binary files /dev/null and b/ZoFo/Content/Textures/GUI/feature/i.webp differ diff --git a/ZoFo/Content/Textures/GUI/feature/огонь-искусства-пиксела-вектора-117929424.webp b/ZoFo/Content/Textures/GUI/feature/огонь-искусства-пиксела-вектора-117929424.webp new file mode 100644 index 0000000..a2178c4 Binary files /dev/null and b/ZoFo/Content/Textures/GUI/feature/огонь-искусства-пиксела-вектора-117929424.webp differ diff --git a/ZoFo/GameCore/GUI/SelectModeMenu.cs b/ZoFo/GameCore/GUI/SelectModeMenu.cs index 5f3262e..b5b5b29 100644 --- a/ZoFo/GameCore/GUI/SelectModeMenu.cs +++ b/ZoFo/GameCore/GUI/SelectModeMenu.cs @@ -21,13 +21,13 @@ public class SelectModeMenu : AbstractGUI 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" }; + menuBackground = new DrawableUIElement(Manager) { rectangle = new Rectangle(0, 0, width, height), mainColor = Color.White, textureName = "Textures\\GUI\\background\\selectMode" }; 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) + Button singleButton = new Button(Manager) { rectangle = new Rectangle(width / 4 - (width / 7) / 2, height / 2, (int)(width / 7), (int)(height / 20)), text = "singleplayer", @@ -36,13 +36,13 @@ public class SelectModeMenu : AbstractGUI mainColor = Color.Gray, fontName = "Fonts\\Font" }; - playButton.LeftButtonPressed += () => + singleButton.LeftButtonPressed += () => { // single // ваш код здесь }; - Elements.Add(playButton); + Elements.Add(singleButton); Button optionButton = new Button(Manager) { 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 += () => { + AppManager.Instance.SetGUI(new SelectingServerGUI()); // multi // ваш код здесь }; 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) diff --git a/ZoFo/GameCore/GUI/SelectingServerGUI.cs b/ZoFo/GameCore/GUI/SelectingServerGUI.cs index 0a7f049..a108a29 100644 --- a/ZoFo/GameCore/GUI/SelectingServerGUI.cs +++ b/ZoFo/GameCore/GUI/SelectingServerGUI.cs @@ -9,19 +9,94 @@ 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 SelectingServerGUI : 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\\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) { - + base.Update(gameTime); } } \ No newline at end of file diff --git a/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs b/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs index 893efc6..5c9250d 100644 --- a/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs +++ b/ZoFo/GameCore/GUI/WaitingForPlayersGUI.cs @@ -9,19 +9,61 @@ 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 WaitingForPlayersGUI : AbstractGUI { + private DrawableUIElement menuBackground; + private bool isHost; + + public WaitingForPlayersGUI(bool isHost) + { + this.isHost = isHost; + } 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\\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) { - + base.Update(gameTime); } } \ No newline at end of file