diff --git a/AnimationsFileCreator/AnimationsFileCreator.csproj b/AnimationsFileCreator/AnimationsFileCreator.csproj
new file mode 100644
index 0000000..b8c3b86
--- /dev/null
+++ b/AnimationsFileCreator/AnimationsFileCreator.csproj
@@ -0,0 +1,17 @@
+
+
+
+ Exe
+ net8.0
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AnimationsFileCreator/Program.cs b/AnimationsFileCreator/Program.cs
new file mode 100644
index 0000000..68768cf
--- /dev/null
+++ b/AnimationsFileCreator/Program.cs
@@ -0,0 +1,72 @@
+using DangerousD.GameCore.Graphics;
+using Microsoft.Xna.Framework;
+using Newtonsoft.Json;
+using System;
+using NativeFileDialogSharp;
+using System.IO;
+using System.Linq;
+using System.Reflection.Metadata;
+using Zofo.GameCore.ZoFo_grafics;
+
+namespace AnimationsFileCreator
+{
+ class Program
+ {
+ [STAThread]
+ static void Main(string[] args)
+ {
+ Console.WriteLine("Добро пожаловать в костыльную программу по созданию файлов анимации для игры DungerousD");
+ Console.Write("Введите название текстуры (нажмите enter, чтобы выбрать файл во всплывающем окошке): ");
+ string textureName = Console.ReadLine();
+ if (textureName == "")
+ {
+
+ DialogResult result = Dialog.FileOpen();
+ textureName = result.Path.Split('\\').Last();
+ textureName = textureName.Split('.')[0];
+ }
+ Console.WriteLine("Введите количество кадров анимации: ");
+ int framesCount = int.Parse(Console.ReadLine());
+ Console.WriteLine("Введите длительность кадра в анимации: ");
+ int interval = int.Parse(Console.ReadLine());
+ Console.WriteLine("Введите начальную позицию X ректенгла анимации: ");
+ Rectangle rectangle = new Rectangle();
+ rectangle.X = int.Parse(Console.ReadLine());
+ Console.WriteLine("Введите начальную позицию Y ректенгла анимации: ");
+ rectangle.Y = int.Parse(Console.ReadLine());
+ Console.WriteLine("Введите начальную позицию Width ректенгла анимации: ");
+ rectangle.Width = int.Parse(Console.ReadLine());
+ Console.WriteLine("Введите начальную позицию Height ректенгла анимации: ");
+ rectangle.Height = int.Parse(Console.ReadLine());
+ Console.WriteLine("Введите название для этого файла - id анимации");
+ string id = Console.ReadLine();
+ Console.WriteLine("Введите 1 если анимация зациклена, и 0 если нет");
+ AnimationContainer container = new AnimationContainer();
+
+ int a = int.Parse(Console.ReadLine());
+ if (a==1)
+ {
+ container.IsCycle = true;
+ }
+ else
+ {
+ container.IsCycle = false;
+ }
+ Console.WriteLine("Введите отклонение анимации от стандартной (сначала X, потом enter, потом Y): ");
+ int otklx = int.Parse(Console.ReadLine());
+ int otkly = int.Parse(Console.ReadLine());
+ container.Offset =new Vector2(otklx,otkly);
+ container.FramesCount = framesCount;
+ container.FrameTime = new System.Collections.Generic.List>();
+ container.FrameTime.Add(new Tuple(0, interval));
+ container.StartSpriteRectangle = rectangle;
+ container.TextureName = textureName;
+ container.TextureFrameInterval = 1;
+ container.Id = id;
+ string json = JsonConvert.SerializeObject(container);
+ StreamWriter writer = new StreamWriter("../../../../ZoFo/Content/animations/"+id);
+ writer.WriteLine(json);
+ writer.Close();
+ }
+ }
+}
diff --git a/MonogameLibrary/UI/Elements/Slider.cs b/MonogameLibrary/UI/Elements/Slider.cs
index f614f53..fd884d8 100644
--- a/MonogameLibrary/UI/Elements/Slider.cs
+++ b/MonogameLibrary/UI/Elements/Slider.cs
@@ -21,7 +21,7 @@ namespace MonogameLibrary.UI.Elements
public int indentation = 5;
Texture2D texture2;
- public Rectangle sliderRect = new Rectangle(0, 0, 30, 30);
+ public Rectangle sliderRect = new Rectangle(0, 0, 40, 40);
private float sliderValue = 0;
private float minValue = 0, maxValue = 1;
SliderState sliderState = SliderState.None;
@@ -56,7 +56,7 @@ namespace MonogameLibrary.UI.Elements
public override void LoadTexture(ContentManager content)
{
- texture2 = content.Load("Textures\\GUI\\checkboxs_off");
+ texture2 = content.Load("Textures\\GUI\\switch");
base.LoadTexture(content);
}
@@ -73,11 +73,11 @@ namespace MonogameLibrary.UI.Elements
sliderRect.X += (int)(sliderValue * (rectangle.Width - sliderRect.Width - indentation * 2) + indentation);
sliderRect.Y -= sliderRect.Height / 2 - rectangle.Height / 2;
if (sliderState == SliderState.Moving)
- _spriteBatch.Draw(texture2, sliderRect, Color.DarkRed);
+ _spriteBatch.Draw(texture2, sliderRect, Color.Gray);
else if(sliderState == SliderState.HoveringOverSliderButton)
- _spriteBatch.Draw(texture2, sliderRect, new Color(200,0 ,0));
+ _spriteBatch.Draw(texture2, sliderRect, Color.DarkGray);
else
- _spriteBatch.Draw(texture2, sliderRect, Color.Red);
+ _spriteBatch.Draw(texture2, sliderRect, Color.White);
DrawText(_spriteBatch);
}
}
diff --git a/ZoFo.sln b/ZoFo.sln
index 81a0c18..3ea9985 100644
--- a/ZoFo.sln
+++ b/ZoFo.sln
@@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ZoFo", "ZoFo\ZoFo.csproj",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonogameLibrary", "MonogameLibrary\MonogameLibrary.csproj", "{40880E68-4B3A-417B-A39B-95DE46AA2E7E}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnimationsFileCreator", "AnimationsFileCreator\AnimationsFileCreator.csproj", "{7B143D5C-5198-4ADE-9291-ECC924B78633}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
{40880E68-4B3A-417B-A39B-95DE46AA2E7E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40880E68-4B3A-417B-A39B-95DE46AA2E7E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40880E68-4B3A-417B-A39B-95DE46AA2E7E}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7B143D5C-5198-4ADE-9291-ECC924B78633}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7B143D5C-5198-4ADE-9291-ECC924B78633}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7B143D5C-5198-4ADE-9291-ECC924B78633}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7B143D5C-5198-4ADE-9291-ECC924B78633}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb
index e1730da..a608235 100644
--- a/ZoFo/Content/Content.mgcb
+++ b/ZoFo/Content/Content.mgcb
@@ -27,6 +27,13 @@
/processorParam:TextureFormat=Compressed
/build:Fonts/Font2.spritefont
+#begin Fonts/Font3.spritefont
+/importer:FontDescriptionImporter
+/processor:FontDescriptionProcessor
+/processorParam:PremultiplyAlpha=True
+/processorParam:TextureFormat=Compressed
+/build:Fonts/Font3.spritefont
+
#begin Textures/GUI/checkboxs_off-on.png
/importer:TextureImporter
/processor:TextureProcessor
@@ -75,3 +82,39 @@
/processorParam:TextureFormat=Color
/build:Textures/GUI/MenuBackground.jpg
+#begin Textures/GUI/mouse.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/mouse.png
+
+#begin Textures/GUI/Switch_backgrownd.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/Switch_backgrownd.png
+
+#begin Textures/GUI/switch.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/switch.png
+
diff --git a/ZoFo/Content/Fonts/Font3.spritefont b/ZoFo/Content/Fonts/Font3.spritefont
new file mode 100644
index 0000000..b82ba24
--- /dev/null
+++ b/ZoFo/Content/Fonts/Font3.spritefont
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+ MouldyCheeseRegular-WyMWG.ttf
+
+
+ 50
+
+
+ 0
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+ ~
+
+
+
+
diff --git a/ZoFo/Content/Fonts/MouldyCheeseRegular-WyMWG.ttf b/ZoFo/Content/Fonts/MouldyCheeseRegular-WyMWG.ttf
new file mode 100644
index 0000000..9c36cd0
Binary files /dev/null and b/ZoFo/Content/Fonts/MouldyCheeseRegular-WyMWG.ttf differ
diff --git a/ZoFo/Content/Textures/GUI/Switch_backgrownd.png b/ZoFo/Content/Textures/GUI/Switch_backgrownd.png
new file mode 100644
index 0000000..bd9e1d8
Binary files /dev/null and b/ZoFo/Content/Textures/GUI/Switch_backgrownd.png differ
diff --git a/ZoFo/Content/Textures/GUI/checkboxs_off-on.png b/ZoFo/Content/Textures/GUI/checkboxs_off-on.png
index 0537fc1..682b82a 100644
Binary files a/ZoFo/Content/Textures/GUI/checkboxs_off-on.png and b/ZoFo/Content/Textures/GUI/checkboxs_off-on.png differ
diff --git a/ZoFo/Content/Textures/GUI/checkboxs_off.png b/ZoFo/Content/Textures/GUI/checkboxs_off.png
index f258fcb..f6533ba 100644
Binary files a/ZoFo/Content/Textures/GUI/checkboxs_off.png and b/ZoFo/Content/Textures/GUI/checkboxs_off.png differ
diff --git a/ZoFo/Content/Textures/GUI/checkboxs_on.png b/ZoFo/Content/Textures/GUI/checkboxs_on.png
index 9f7a350..693b0cc 100644
Binary files a/ZoFo/Content/Textures/GUI/checkboxs_on.png and b/ZoFo/Content/Textures/GUI/checkboxs_on.png differ
diff --git a/ZoFo/Content/Textures/GUI/mouse.png b/ZoFo/Content/Textures/GUI/mouse.png
new file mode 100644
index 0000000..23146e6
Binary files /dev/null and b/ZoFo/Content/Textures/GUI/mouse.png differ
diff --git a/ZoFo/Content/Textures/GUI/switch.png b/ZoFo/Content/Textures/GUI/switch.png
new file mode 100644
index 0000000..a296c61
Binary files /dev/null and b/ZoFo/Content/Textures/GUI/switch.png differ
diff --git a/ZoFo/GameCore/GUI/AbstractGUI.cs b/ZoFo/GameCore/GUI/AbstractGUI.cs
index 2c2d7f6..bdc4d60 100644
--- a/ZoFo/GameCore/GUI/AbstractGUI.cs
+++ b/ZoFo/GameCore/GUI/AbstractGUI.cs
@@ -21,6 +21,8 @@ public abstract class AbstractGUI
protected DrawableUIElement SelectedElement;
private bool isStartedPrint = false;
private bool isPressed = false;
+ private Texture2D mouse;
+ private MouseState mouseState;
public AbstractGUI()
{
@@ -37,20 +39,20 @@ public abstract class AbstractGUI
public virtual void LoadContent()
{
Manager.LoadContent(AppManager.Instance.Content, "Font");
+ mouse = AppManager.Instance.Content.Load("Textures\\GUI\\mouse");
}
public virtual void Update(GameTime gameTime)
{
Manager.Update(gameTime);
+ mouseState = Mouse.GetState();
}
public virtual void Draw(SpriteBatch spriteBatch)
{
Manager.Draw(spriteBatch);
- }
-
- public virtual void ResolutioChenges()
- {
-
+ spriteBatch.Begin();
+ spriteBatch.Draw(mouse, new Rectangle(mouseState.Position.X, mouseState.Position.Y, 20, 40), Color.Red);
+ spriteBatch.End();
}
}
\ No newline at end of file
diff --git a/ZoFo/GameCore/GUI/MainMenuGUI.cs b/ZoFo/GameCore/GUI/MainMenuGUI.cs
index 9117807..4683ddd 100644
--- a/ZoFo/GameCore/GUI/MainMenuGUI.cs
+++ b/ZoFo/GameCore/GUI/MainMenuGUI.cs
@@ -39,14 +39,8 @@ public class MainMenuGUI : AbstractGUI
fontName = "Fonts\\Font"
};
playButton.LeftButtonPressed += () =>
- {
- Server server = new Server(); //Server Logic SinglePlayer
- Client client = new Client();
- server.CreateRoom(1);
- client.JoinYourself();
- AppManager.Instance.SetServer(server);
- AppManager.Instance.SetClient(client);
- AppManager.Instance.ChangeState(GameState.HostPlaying);
+ {
+ AppManager.Instance.SetGUI(new SelectModeMenu());
};
Elements.Add(playButton);
Button optionButton = new Button(Manager)
diff --git a/ZoFo/GameCore/GUI/OptionsGUI.cs b/ZoFo/GameCore/GUI/OptionsGUI.cs
index 11f8c5e..a60611b 100644
--- a/ZoFo/GameCore/GUI/OptionsGUI.cs
+++ b/ZoFo/GameCore/GUI/OptionsGUI.cs
@@ -30,11 +30,11 @@ public class OptionsGUI : AbstractGUI
Label label_OverallVolume = new Label(Manager)
- { fontName = "Fonts\\Font", scale = 0.2f, text = "All Volume", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3, 50, 50), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
+ { fontName = "Fonts\\Font", scale = 0.2f, text = "All Volume", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_OverallVolume);
var slider_OverallVolume = new Slider(Manager)
- { rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\checkbox_on", MinValue = 0, MaxValue = 1 };
+ { rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
slider_OverallVolume.SliderChanged += (newVal) =>
{
@@ -42,11 +42,11 @@ public class OptionsGUI : AbstractGUI
Elements.Add(slider_OverallVolume);
Label label_MusicVolume = new Label(Manager)
- { fontName = "Fonts\\Font", scale = 0.2f, text = "Music Volume", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 1, 50, 50), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
+ { fontName = "Fonts\\Font", scale = 0.2f, text = "Music Volume", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 1, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_MusicVolume);
var slider_MusicVolume = new Slider(Manager)
- { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 1, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\checkboxs_on", MinValue = 0, MaxValue = 1 };
+ { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 1, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
slider_MusicVolume.SliderChanged += (newVal) =>
{
@@ -55,11 +55,11 @@ public class OptionsGUI : AbstractGUI
Label label_EffectsVolume = new Label(Manager)
- { fontName = "Fonts\\Font", scale = 0.2f, text = "Effects Volume", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 2, 50, 50), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
+ { fontName = "Fonts\\Font", scale = 0.2f, text = "Effects Volume", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 2, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_EffectsVolume);
var slider_EffectsVolume = new Slider(Manager)
- { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 2, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\checkboxs_on", MinValue = 0, MaxValue = 1 };
+ { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 2, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
slider_EffectsVolume.SliderChanged += (newVal) =>
{
@@ -67,7 +67,7 @@ public class OptionsGUI : AbstractGUI
Elements.Add(slider_EffectsVolume);
Label lblSwitchMode = new Label(Manager)
- { fontName = "Fonts\\Font", scale = 0.2f, text = "Left/Right Mode", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 3, 50, 50), mainColor = Color.Transparent};
+ { fontName = "Fonts\\Font", scale = 0.2f, text = "Resolution set", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(lblSwitchMode);
//var button_left_right_mode = new CheckBox(Manager) { rectangle = new Rectangle(rightBorder - checkboxlength, lblSwitchMode.rectangle.Y - 12, checkboxlength, checkboxlength) };
@@ -76,10 +76,10 @@ public class OptionsGUI : AbstractGUI
Label label_IsFullScreen = new Label(Manager)
- { fontName = "Fonts\\Font", scale = 0.2f, text = "Full Screen", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 4, 50, 50), mainColor = Color.Transparent};
+ { fontName = "Fonts\\Font", scale = 0.2f, text = "Full Screen", fontColor = Color.White, rectangle = new Rectangle(width / 3, height / 3 + (height / 20 + height / 40) * 4, width / 40, width / 40), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left };
Elements.Add(label_IsFullScreen);
- var button_FullScreen = new CheckBox(Manager) { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 4, width / 30, width / 30) };
+ var button_FullScreen = new CheckBox(Manager) { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 4, width / 40, width / 40) };
button_FullScreen.Checked += (newCheckState) =>
{
@@ -88,11 +88,11 @@ public class OptionsGUI : AbstractGUI
Button bTExit = new Button(Manager)
- { fontName = "Fonts\\Font", scale = 0.2f, text = "<-", rectangle = new Rectangle(width / 30, height / 30, 40, 40), textureName = "Textures\\GUI\\checkboxs_off" };
+ { 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());
};
}
diff --git a/ZoFo/GameCore/GUI/SelectModeMenu.cs b/ZoFo/GameCore/GUI/SelectModeMenu.cs
index b08e782..5f3262e 100644
--- a/ZoFo/GameCore/GUI/SelectModeMenu.cs
+++ b/ZoFo/GameCore/GUI/SelectModeMenu.cs
@@ -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);
}
}
\ No newline at end of file
diff --git a/ZoFo/GameCore/GameManagers/AppManager.cs b/ZoFo/GameCore/GameManagers/AppManager.cs
index 53c5ee4..6b111bd 100644
--- a/ZoFo/GameCore/GameManagers/AppManager.cs
+++ b/ZoFo/GameCore/GameManagers/AppManager.cs
@@ -58,14 +58,14 @@ namespace ZoFo.GameCore.GameManagers
currentGUI = new MainMenuGUI();
debugHud = new DebugHUD();
+ IsMouseVisible = false;
}
protected override void Initialize()
{
currentGUI.Initialize();
- debugHud.Initialize();
-
+ debugHud.Initialize();
base.Initialize();
@@ -115,8 +115,8 @@ namespace ZoFo.GameCore.GameManagers
- debugHud.Draw(_spriteBatch);
currentGUI.Draw(_spriteBatch);
+ debugHud.Draw(_spriteBatch);
switch (gamestate)
{
case GameState.ClientPlaying:
diff --git a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs
index 73e1291..c092973 100644
--- a/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs
+++ b/ZoFo/GameCore/GameManagers/NetworkManager/ServerNetworkManager.cs
@@ -57,7 +57,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
public void AddData(IUpdateData data)
{
updates.Add(data);
- }
+ }
public void CloseConnection() //По сути коне игры и отключение игроков
{
foreach (var item in clients)
diff --git a/ZoFo/GameCore/GameManagers/SettingsManager.cs b/ZoFo/GameCore/GameManagers/SettingsManager.cs
new file mode 100644
index 0000000..25dd40d
--- /dev/null
+++ b/ZoFo/GameCore/GameManagers/SettingsManager.cs
@@ -0,0 +1,93 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using Microsoft.Xna;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Xna.Framework;
+using Newtonsoft.Json.Serialization;
+using Microsoft.Xna.Framework.Graphics;
+
+namespace ZoFo.GameCore.GameManagers
+{
+ public class SettingsManager //нужно что-то менять с разрешением
+ {
+ private SettingsContainer settingsContainer = new SettingsContainer();
+ public bool IsFullScreen { get => settingsContainer.IsFullScreen; }
+ public float MainVolume { get => settingsContainer.MainVolume; }
+ public float MusicVolume { get => settingsContainer.MusicVolume; }
+ public float SoundEffectsVolume { get => settingsContainer.SoundEffectsVolume; }
+ public Point Resolution { get => settingsContainer.Resolution; }
+ public void SetResolution(Point resolution)
+ {
+ settingsContainer.Resolution = resolution;
+ //AppManager.Instance.resolution = resolution;
+ }
+ public void SetMainVolume(float volume)
+ {
+ settingsContainer.MainVolume = volume;
+ //AppManager.Instance.SoundManager.Update();
+ SaveSettings();
+ }
+ public void SetMusicVolume(float volume)
+ {
+ settingsContainer.MusicVolume = volume;
+ SaveSettings();
+
+ }
+ public void SetSoundEffectsVolume(float volume)
+ {
+ settingsContainer.SoundEffectsVolume = volume;
+ SaveSettings();
+
+ }
+ public void SetIsFullScreen(bool isFullScreen)
+ {
+ settingsContainer.IsFullScreen = isFullScreen;
+ //AppManager.Instance.SetIsFullScreen(isFullScreen);
+ SaveSettings();
+ }
+ public void LoadSettings()
+ {
+ if (!File.Exists("GameSettings.txt"))
+ {
+ SaveSettings();
+ return;
+ }
+
+ settingsContainer = JsonConvert.DeserializeObject(File.ReadAllText("GameSettings.txt"));
+ SetIsFullScreen(settingsContainer.IsFullScreen);
+ SetMainVolume(settingsContainer.MainVolume);
+ SetMusicVolume(settingsContainer.MusicVolume);
+ SetResolution(settingsContainer.Resolution);
+ SetSoundEffectsVolume(settingsContainer.SoundEffectsVolume);
+
+
+ }
+ public void SaveSettings()
+ {
+ using (StreamWriter streamWriter = new StreamWriter("GameSettings.txt"))
+ {
+ string _str = JsonConvert.SerializeObject(settingsContainer);
+ streamWriter.Write(_str);
+ }
+ }
+
+ }
+ [Serializable]
+ public class SettingsContainer
+ {
+ [JsonProperty("IsFullScreen")]
+ public bool IsFullScreen { get; set; } = false;
+ [JsonProperty("MainVolume")]
+ public float MainVolume { get; set; } = 1;
+ [JsonProperty("MusicVolume")]
+ public float MusicVolume { get; set; } = 1;
+ [JsonProperty("SoundEffectsVolume")]
+ public float SoundEffectsVolume { get; set; } = 1;
+ [JsonProperty("Resolution")]
+ public Point Resolution { get; set; } = new Point(GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width, GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height);
+ }
+}
\ No newline at end of file
diff --git a/ZoFo/GameCore/GameManagers/SoundManager.cs b/ZoFo/GameCore/GameManagers/SoundManager.cs
index a43fc7c..d99211e 100644
--- a/ZoFo/GameCore/GameManagers/SoundManager.cs
+++ b/ZoFo/GameCore/GameManagers/SoundManager.cs
@@ -114,7 +114,7 @@ namespace ZoFo.GameCore.GameManagers
SoundEffect = soundEffect;
Position = position;
}
- /*/ public void UpdateVolume(Vector2 playerPos)
+ /*/public void UpdateVolume(Vector2 playerPos)
{
if (isAmbient)
SoundEffect.Volume = baseVolume * AppManager.Instance.SettingsManager.MusicVolume * AppManager.Instance.SettingsManager.MainVolume;
diff --git a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs
index a1333ea..39b9037 100644
--- a/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs
+++ b/ZoFo/GameCore/GameObjects/Entities/LivingEntities/Player/Player.cs
@@ -1,7 +1,21 @@
-using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using System;
+using ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient;
namespace ZoFo.GameCore.GameObjects.Entities.LivingEntities.Player;
public class Player : LivingEntity
{
+ private int health;
+ Server server = new Server();
+ public void Update(GameTime gameTime)
+ {
+ // server.AddData();
+ }
+
+ public void TextureLoad(SpriteBatch spriteBatch)
+ {
+
+ }
}
diff --git a/ZoFo/GameCore/Server.cs b/ZoFo/GameCore/Server.cs
index c758fba..9faf5df 100644
--- a/ZoFo/GameCore/Server.cs
+++ b/ZoFo/GameCore/Server.cs
@@ -56,8 +56,8 @@ namespace ZoFo.GameCore
UpdateGameEnded gameEnded = new UpdateGameEnded();
networkManager.AddData(gameEnded);
networkManager.CloseConnection();
- }
- public void Update(GameTime gameTime)
+ }
+ public void Update(GameTime gameTime)
{
}