Merge branch 'Development' into Interactable
|
@ -21,6 +21,9 @@ namespace MonogameLibrary.UI.Elements
|
||||||
public int indentation = 5;
|
public int indentation = 5;
|
||||||
|
|
||||||
Texture2D texture2;
|
Texture2D texture2;
|
||||||
|
/// <summary>
|
||||||
|
/// ректенгл ползунка
|
||||||
|
/// </summary>
|
||||||
public Rectangle sliderRect = new Rectangle(0, 0, 40, 40);
|
public Rectangle sliderRect = new Rectangle(0, 0, 40, 40);
|
||||||
private float sliderValue = 0;
|
private float sliderValue = 0;
|
||||||
private float minValue = 0, maxValue = 1;
|
private float minValue = 0, maxValue = 1;
|
||||||
|
|
|
@ -103,6 +103,18 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/GUI/background/base.png
|
/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
|
#begin Textures/GUI/background/join.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/processor:TextureProcessor
|
||||||
|
@ -115,6 +127,30 @@
|
||||||
/processorParam:TextureFormat=Color
|
/processorParam:TextureFormat=Color
|
||||||
/build:Textures/GUI/background/join.png
|
/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
|
#begin Textures/GUI/background/selectMode.png
|
||||||
/importer:TextureImporter
|
/importer:TextureImporter
|
||||||
/processor:TextureProcessor
|
/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
|
// тут будет switch
|
||||||
foreach (var item in updateDatas)
|
foreach (var item in updateDatas)
|
||||||
{
|
{
|
||||||
/* switch (item.UpdateType) Здесь нужно отлавливать и регистрировать
|
GotData(item);
|
||||||
{
|
|
||||||
case "Tile":
|
|
||||||
MapObject map = new MapObject();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,6 @@ namespace ZoFo.GameCore.GUI;
|
||||||
|
|
||||||
public class HUD : AbstractGUI
|
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;
|
private GraphicsDevice graphicsDevice;
|
||||||
public virtual void Initialize()
|
public virtual void Initialize()
|
||||||
|
|
|
@ -22,11 +22,11 @@ public class MainMenuGUI : 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\\mainMenu" };
|
||||||
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 / 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)
|
Button playButton = new Button(Manager)
|
||||||
|
|
|
@ -21,56 +21,76 @@ public class OptionsGUI : 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\\options" };
|
||||||
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 / 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)
|
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);
|
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)
|
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.SetValue(AppManager.Instance.SettingsManager.MainVolume);
|
||||||
slider_OverallVolume.SliderChanged += (newVal) =>
|
slider_OverallVolume.SliderChanged += (newVal) =>
|
||||||
{
|
{
|
||||||
|
label_OverallVolume_Percent.text = Math.Round(slider_OverallVolume.GetSliderValue * 100) + "%";
|
||||||
AppManager.Instance.SettingsManager.SetMainVolume(newVal);
|
AppManager.Instance.SettingsManager.SetMainVolume(newVal);
|
||||||
};
|
};
|
||||||
Elements.Add(slider_OverallVolume);
|
Elements.Add(slider_OverallVolume);
|
||||||
|
|
||||||
|
//--------------------------------------
|
||||||
|
|
||||||
Label label_MusicVolume = new Label(Manager)
|
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);
|
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)
|
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.SetValue(AppManager.Instance.SettingsManager.MusicVolume);
|
||||||
slider_MusicVolume.SliderChanged += (newVal) =>
|
slider_MusicVolume.SliderChanged += (newVal) =>
|
||||||
{
|
{
|
||||||
|
label_MusicVolume_Percent.text = Math.Round(slider_MusicVolume.GetSliderValue * 100) + "%";
|
||||||
AppManager.Instance.SettingsManager.SetMusicVolume(newVal);
|
AppManager.Instance.SettingsManager.SetMusicVolume(newVal);
|
||||||
};
|
};
|
||||||
Elements.Add(slider_MusicVolume);
|
Elements.Add(slider_MusicVolume);
|
||||||
|
|
||||||
|
//--------------------------------------
|
||||||
|
|
||||||
Label label_EffectsVolume = new Label(Manager)
|
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);
|
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)
|
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.SetValue(AppManager.Instance.SettingsManager.SoundEffectsVolume);
|
||||||
slider_EffectsVolume.SliderChanged += (newVal) =>
|
slider_EffectsVolume.SliderChanged += (newVal) =>
|
||||||
{
|
{
|
||||||
|
label_EffectsVolume_Percent.text = Math.Round(slider_EffectsVolume.GetSliderValue * 100) + "%";
|
||||||
AppManager.Instance.SettingsManager.SetSoundEffectsVolume(newVal);
|
AppManager.Instance.SettingsManager.SetSoundEffectsVolume(newVal);
|
||||||
};
|
};
|
||||||
Elements.Add(slider_EffectsVolume);
|
Elements.Add(slider_EffectsVolume);
|
||||||
|
|
||||||
|
//--------------------------------------
|
||||||
|
|
||||||
Label lblSwitchMode = new Label(Manager)
|
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);
|
Elements.Add(lblSwitchMode);
|
||||||
|
|
||||||
//var button_left_right_mode = new CheckBox(Manager) { rectangle = new Rectangle(rightBorder - checkboxlength, lblSwitchMode.rectangle.Y - 12, checkboxlength, checkboxlength) };
|
//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)
|
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);
|
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) };
|
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);
|
Elements.Add(button_FullScreen);
|
||||||
|
|
||||||
|
//--------------------------------------
|
||||||
|
|
||||||
Button bTExit = new Button(Manager)
|
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"};
|
{ 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 Microsoft.Xna.Framework.Graphics.PackedVector;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
@ -57,12 +58,18 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager
|
||||||
updates.Clear();
|
updates.Clear();
|
||||||
return; //TODO TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK TODO REMOVE TO ADD NETWORK
|
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);
|
var databytes = Encoding.UTF8.GetBytes(data);
|
||||||
foreach (var item in clients)
|
foreach (var item in clients)
|
||||||
{
|
{
|
||||||
item.SendAsync(databytes);
|
item.SendAsync(databytes);
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < 5 && i< datasToSend.Count; i++)
|
||||||
|
updates.RemoveAt(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -19,7 +19,6 @@ public abstract class GameObject
|
||||||
public GameObject(Vector2 position)
|
public GameObject(Vector2 position)
|
||||||
{
|
{
|
||||||
this.position = position;
|
this.position = position;
|
||||||
AppManager.Instance.server.RegisterGameObject(this);
|
|
||||||
|
|
||||||
graphicsComponent.LoadContent();
|
graphicsComponent.LoadContent();
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,19 @@ namespace ZoFo.GameCore.GameObjects.MapObjects
|
||||||
public class MapObject : GameObject
|
public class MapObject : GameObject
|
||||||
{
|
{
|
||||||
public virtual bool IsColliderOn { get; protected set; } = true;//Who added that?
|
public virtual bool IsColliderOn { get; protected set; } = true;//Who added that?
|
||||||
public Rectangle _sourceRectangle;
|
public Rectangle sourceRectangle;
|
||||||
public override GraphicsComponent graphicsComponent { get; } = new();
|
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)
|
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.ObjectDrawRectangle = new Rectangle((int)position.X, (int)position.Y, (int)size.X, (int)size.Y);
|
||||||
graphicsComponent.BuildComponent(textureName);
|
graphicsComponent.BuildComponent(textureName);
|
||||||
|
|
||||||
|
@ -28,7 +35,7 @@ namespace ZoFo.GameCore.GameObjects.MapObjects
|
||||||
}
|
}
|
||||||
public override void Draw(SpriteBatch spriteBatch)
|
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()
|
AddData(new UpdateTileCreated()
|
||||||
{
|
{
|
||||||
Position = (gameObject as MapObject).position,
|
Position = (gameObject as MapObject).position,
|
||||||
sourceRectangle = (gameObject as MapObject)._sourceRectangle,
|
sourceRectangle = (gameObject as MapObject).sourceRectangle,
|
||||||
Size = (gameObject as MapObject).graphicsComponent.ObjectDrawRectangle.Size,
|
Size = (gameObject as MapObject).graphicsComponent.ObjectDrawRectangle.Size,
|
||||||
tileSetName = (gameObject as MapObject).graphicsComponent.mainTextureName
|
tileSetName = (gameObject as MapObject).graphicsComponent.mainTextureName
|
||||||
});//TODO
|
});//TODO
|
||||||
|
|