diff --git a/MonogameLibrary/UI/Elements/Slider.cs b/MonogameLibrary/UI/Elements/Slider.cs index fd884d8..0e3b784 100644 --- a/MonogameLibrary/UI/Elements/Slider.cs +++ b/MonogameLibrary/UI/Elements/Slider.cs @@ -21,6 +21,9 @@ namespace MonogameLibrary.UI.Elements public int indentation = 5; Texture2D texture2; + /// + /// ректенгл ползунка + /// public Rectangle sliderRect = new Rectangle(0, 0, 40, 40); private float sliderValue = 0; private float minValue = 0, maxValue = 1; diff --git a/ZoFo/Content/Content.mgcb b/ZoFo/Content/Content.mgcb index e47b105..fd91add 100644 --- a/ZoFo/Content/Content.mgcb +++ b/ZoFo/Content/Content.mgcb @@ -103,6 +103,18 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/background/base.png +#begin Textures/GUI/background/endGame.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/endGame.png + #begin Textures/GUI/background/join.png /importer:TextureImporter /processor:TextureProcessor @@ -115,6 +127,30 @@ /processorParam:TextureFormat=Color /build:Textures/GUI/background/join.png +#begin Textures/GUI/background/mainMenu.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/mainMenu.png + +#begin Textures/GUI/background/options.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/options.png + #begin Textures/GUI/background/selectMode.png /importer:TextureImporter /processor:TextureProcessor diff --git a/ZoFo/Content/Textures/GUI/background/endGame.png b/ZoFo/Content/Textures/GUI/background/endGame.png new file mode 100644 index 0000000..2d9926c Binary files /dev/null and b/ZoFo/Content/Textures/GUI/background/endGame.png differ diff --git a/ZoFo/Content/Textures/GUI/background/join.png b/ZoFo/Content/Textures/GUI/background/join.png index 59d539a..6d45273 100644 Binary files a/ZoFo/Content/Textures/GUI/background/join.png and b/ZoFo/Content/Textures/GUI/background/join.png differ diff --git a/ZoFo/Content/Textures/GUI/background/mainMenu.png b/ZoFo/Content/Textures/GUI/background/mainMenu.png new file mode 100644 index 0000000..a0778fb Binary files /dev/null and b/ZoFo/Content/Textures/GUI/background/mainMenu.png differ diff --git a/ZoFo/Content/Textures/GUI/background/options.png b/ZoFo/Content/Textures/GUI/background/options.png new file mode 100644 index 0000000..ef917ce Binary files /dev/null and b/ZoFo/Content/Textures/GUI/background/options.png differ diff --git a/ZoFo/Content/Textures/GUI/background/selectMode.png b/ZoFo/Content/Textures/GUI/background/selectMode.png index 256ae2c..25bc33b 100644 Binary files a/ZoFo/Content/Textures/GUI/background/selectMode.png and b/ZoFo/Content/Textures/GUI/background/selectMode.png differ diff --git a/ZoFo/GameCore/GUI/MainMenuGUI.cs b/ZoFo/GameCore/GUI/MainMenuGUI.cs index 2c098ac..8ebfd74 100644 --- a/ZoFo/GameCore/GUI/MainMenuGUI.cs +++ b/ZoFo/GameCore/GUI/MainMenuGUI.cs @@ -21,15 +21,15 @@ public class MainMenuGUI : 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\\mainMenu" }; Elements.Add(menuBackground); menuBackground.LoadTexture(AppManager.Instance.Content); - - Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "ZoFo", fontColor = Color.White, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font" }); - - - Button playButton = new Button(Manager) + + Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "ZoFo", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"}); + + + Button playButton = new Button(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 10), height / 3 + height / 20 + height / 40, (int)(width / 5), (int)(height / 20)), text = "Play", diff --git a/ZoFo/GameCore/GUI/OptionsGUI.cs b/ZoFo/GameCore/GUI/OptionsGUI.cs index 991c04b..2a9b6ba 100644 --- a/ZoFo/GameCore/GUI/OptionsGUI.cs +++ b/ZoFo/GameCore/GUI/OptionsGUI.cs @@ -21,56 +21,73 @@ public class OptionsGUI : 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\\options" }; Elements.Add(menuBackground); menuBackground.LoadTexture(AppManager.Instance.Content); - Elements.Add(new Label(Manager) { rectangle = new Rectangle(width / 2 - (int)(width / 8), height / 5, (int)(width / 4), (int)(height / 20)), text = "Options", 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 / 5, (int)(width / 4), (int)(height / 20)), text = "Options", fontColor = Color.Black, mainColor = Color.Transparent, scale = 0.9f, fontName = "Fonts\\Font"}); 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, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left }; + { fontName = "Fonts\\Font", scale = 0.2f, text = "All Volume", fontColor = Color.Black, rectangle = new Rectangle(width / 3, height / 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left }; Elements.Add(label_OverallVolume); + + Label label_OverallVolume_Percent = new Label(Manager) + { fontName = "Fonts\\Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left }; + Elements.Add(label_OverallVolume_Percent); var slider_OverallVolume = new Slider(Manager) - { rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 4, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 }; - slider_OverallVolume.SetValue(AppManager.Instance.SettingsManager.MainVolume); + { rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 7, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 }; slider_OverallVolume.SliderChanged += (newVal) => { + label_OverallVolume_Percent.text = Math.Round(slider_OverallVolume.GetSliderValue * 100) + "%"; AppManager.Instance.SettingsManager.SetMainVolume(newVal); }; 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, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left }; + { fontName = "Fonts\\Font", scale = 0.2f, text = "Music Volume", fontColor = Color.Black, 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); + Label label_MusicVolume_Percent = new Label(Manager) + { fontName = "Fonts\\Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3 + (height / 20 + height / 40) * 1, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left }; + Elements.Add(label_MusicVolume_Percent); + 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\\Switch_backgrownd", MinValue = 0, MaxValue = 1 }; - slider_MusicVolume.SetValue(AppManager.Instance.SettingsManager.MusicVolume); + { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 1, width / 10, height / 20), indentation = 7, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 }; slider_MusicVolume.SliderChanged += (newVal) => { + label_MusicVolume_Percent.text = Math.Round(slider_MusicVolume.GetSliderValue * 100) + "%"; AppManager.Instance.SettingsManager.SetMusicVolume(newVal); }; Elements.Add(slider_MusicVolume); + //-------------------------------------- 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, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left }; + { fontName = "Fonts\\Font", scale = 0.2f, text = "Effects Volume", fontColor = Color.Black, 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); + + Label label_EffectsVolume_Percent = new Label(Manager) + { fontName = "Fonts\\Font3", scale = 0.4f, text = "", fontColor = Color.Black, rectangle = new Rectangle(width / 2 + width / 10, height / 3 + (height / 20 + height / 40) * 2, width / 40, height / 20), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left }; + Elements.Add(label_EffectsVolume_Percent); 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\\Switch_backgrownd", MinValue = 0, MaxValue = 1 }; - slider_EffectsVolume.SetValue(AppManager.Instance.SettingsManager.SoundEffectsVolume); + { rectangle = new Rectangle(width / 2, height / 3 + (height / 20 + height / 40) * 2, width / 10, height / 20), indentation = 7, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 }; slider_EffectsVolume.SliderChanged += (newVal) => { + label_EffectsVolume_Percent.text = Math.Round(slider_EffectsVolume.GetSliderValue * 100) + "%"; AppManager.Instance.SettingsManager.SetSoundEffectsVolume(newVal); }; Elements.Add(slider_EffectsVolume); + //-------------------------------------- + Label lblSwitchMode = new Label(Manager) - { 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 }; + { fontName = "Fonts\\Font", scale = 0.2f, text = "Resolution set", fontColor = Color.Black, 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) }; @@ -79,7 +96,7 @@ 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, width / 40, width / 40), mainColor = Color.Transparent, textAligment = MonogameLibrary.UI.Enums.TextAligment.Left }; + { fontName = "Fonts\\Font", scale = 0.2f, text = "Full Screen", fontColor = Color.Black, 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 / 40, width / 40) }; @@ -90,7 +107,8 @@ public class OptionsGUI : AbstractGUI }; Elements.Add(button_FullScreen); - + //-------------------------------------- + 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);