Merge branch 'Development' into Interactable
|
@ -21,6 +21,9 @@ namespace MonogameLibrary.UI.Elements
|
|||
public int indentation = 5;
|
||||
|
||||
Texture2D texture2;
|
||||
/// <summary>
|
||||
/// ректенгл ползунка
|
||||
/// </summary>
|
||||
public Rectangle sliderRect = new Rectangle(0, 0, 40, 40);
|
||||
private float sliderValue = 0;
|
||||
private float minValue = 0, maxValue = 1;
|
||||
|
|
|
@ -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
|
||||
|
|
BIN
ZoFo/Content/Textures/GUI/background/endGame.png
Normal file
After Width: | Height: | Size: 256 KiB |
Before Width: | Height: | Size: 320 KiB After Width: | Height: | Size: 4.6 MiB |
BIN
ZoFo/Content/Textures/GUI/background/mainMenu.png
Normal file
After Width: | Height: | Size: 508 KiB |
BIN
ZoFo/Content/Textures/GUI/background/options.png
Normal file
After Width: | Height: | Size: 2.2 MiB |
Before Width: | Height: | Size: 198 KiB After Width: | Height: | Size: 5.8 MiB |
|
@ -32,13 +32,7 @@ namespace ZoFo.GameCore
|
|||
// тут будет switch
|
||||
foreach (var item in updateDatas)
|
||||
{
|
||||
/* switch (item.UpdateType) Здесь нужно отлавливать и регистрировать
|
||||
{
|
||||
case "Tile":
|
||||
MapObject map = new MapObject();
|
||||
|
||||
break;
|
||||
}*/
|
||||
GotData(item);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,12 +14,6 @@ namespace ZoFo.GameCore.GUI;
|
|||
|
||||
public class HUD : AbstractGUI
|
||||
{
|
||||
protected UIManager Manager = new();
|
||||
protected List<DrawableUIElement> Elements = new();
|
||||
private List<DrawableUIElement> ActiveElements;
|
||||
protected DrawableUIElement SelectedElement;
|
||||
private bool isStartedPrint = false;
|
||||
private bool isPressed = false;
|
||||
|
||||
private GraphicsDevice graphicsDevice;
|
||||
public virtual void Initialize()
|
||||
|
|
|
@ -22,11 +22,11 @@ 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" });
|
||||
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)
|
||||
|
|
|
@ -21,56 +21,76 @@ 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 };
|
||||
{ rectangle = new Rectangle(width / 2, height / 3, width / 10, height / 20), indentation = 7, textureName = "Textures\\GUI\\Switch_backgrownd", MinValue = 0, MaxValue = 1 };
|
||||
slider_OverallVolume.SetValue(AppManager.Instance.SettingsManager.MainVolume);
|
||||
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 };
|
||||
{ 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.SetValue(AppManager.Instance.SettingsManager.MusicVolume);
|
||||
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 };
|
||||
{ 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.SetValue(AppManager.Instance.SettingsManager.SoundEffectsVolume);
|
||||
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 +99,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,6 +110,7 @@ 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"};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Graphics.PackedVector;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -57,12 +58,18 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
|||
updates.Clear();
|
||||
return; //TODO TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK
|
||||
|
||||
string data = JsonSerializer.Serialize(updates);
|
||||
//по 10 паков за раз TODO FIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXITFIXIT
|
||||
List<UpdateData> datasToSend = new List<UpdateData>();
|
||||
for (int i = 0; i < 5 && i<updates.Count; i++)
|
||||
datasToSend.Add(updates[i]);
|
||||
string data = JsonSerializer.Serialize(datasToSend);
|
||||
var databytes = Encoding.UTF8.GetBytes(data);
|
||||
foreach (var item in clients)
|
||||
{
|
||||
item.SendAsync(databytes);
|
||||
}
|
||||
for (int i = 0; i < 5 && i< datasToSend.Count; i++)
|
||||
updates.RemoveAt(0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -19,7 +19,6 @@ public abstract class GameObject
|
|||
public GameObject(Vector2 position)
|
||||
{
|
||||
this.position = position;
|
||||
AppManager.Instance.server.RegisterGameObject(this);
|
||||
|
||||
graphicsComponent.LoadContent();
|
||||
}
|
||||
|
|
|
@ -14,12 +14,19 @@ namespace ZoFo.GameCore.GameObjects.MapObjects
|
|||
public class MapObject : GameObject
|
||||
{
|
||||
public virtual bool IsColliderOn { get; protected set; } = true;//Who added that?
|
||||
public Rectangle _sourceRectangle;
|
||||
public Rectangle sourceRectangle;
|
||||
public override GraphicsComponent graphicsComponent { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Создается простой объект на карте - no animations, только где, насколько крупно рисовать, по какой сорс ректанглу рисовать и из какой текстуры
|
||||
/// </summary>
|
||||
/// <param name="position"></param>
|
||||
/// <param name="size"></param>
|
||||
/// <param name="sourceRectangle"></param>
|
||||
/// <param name="textureName"></param>
|
||||
public MapObject(Vector2 position, Vector2 size, Rectangle sourceRectangle, string textureName) : base(position)
|
||||
{
|
||||
_sourceRectangle = sourceRectangle;
|
||||
this.sourceRectangle = sourceRectangle;
|
||||
graphicsComponent.ObjectDrawRectangle = new Rectangle((int)position.X, (int)position.Y, (int)size.X, (int)size.Y);
|
||||
graphicsComponent.BuildComponent(textureName);
|
||||
|
||||
|
@ -28,7 +35,7 @@ namespace ZoFo.GameCore.GameObjects.MapObjects
|
|||
}
|
||||
public override void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch, _sourceRectangle);
|
||||
graphicsComponent.DrawAnimation(graphicsComponent.ObjectDrawRectangle, spriteBatch, sourceRectangle);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -117,7 +117,7 @@ namespace ZoFo.GameCore
|
|||
AddData(new UpdateTileCreated()
|
||||
{
|
||||
Position = (gameObject as MapObject).position,
|
||||
sourceRectangle = (gameObject as MapObject)._sourceRectangle,
|
||||
sourceRectangle = (gameObject as MapObject).sourceRectangle,
|
||||
Size = (gameObject as MapObject).graphicsComponent.ObjectDrawRectangle.Size,
|
||||
tileSetName = (gameObject as MapObject).graphicsComponent.mainTextureName
|
||||
});//TODO
|
||||
|
|