BaseCommit
This commit is contained in:
parent
5d8f48d3ba
commit
749f1d2bc3
7 changed files with 46 additions and 9 deletions
|
@ -121,7 +121,7 @@ namespace ZoFo.GameCore
|
|||
{
|
||||
mapObjects.Add(
|
||||
new MapObject(
|
||||
(update as UpdateTileCreated).Position,
|
||||
(update as UpdateTileCreated).Position.GetVector2(),
|
||||
(update as UpdateTileCreated).Size.GetPoint().ToVector2(),
|
||||
(update as UpdateTileCreated).sourceRectangle.GetRectangle(),
|
||||
(update as UpdateTileCreated).tileSetName
|
||||
|
|
|
@ -15,19 +15,16 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO
|
|||
{
|
||||
public SerializablePoint Size { get; set; }
|
||||
public SerializablePoint Location { get; set; }
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public SerializableRectangle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public SerializableRectangle(Rectangle rectangle) { X = rectangle.X; Y = rectangle.Y;
|
||||
Size = new SerializablePoint(rectangle.Size); Location = new SerializablePoint(rectangle.Location); }
|
||||
public SerializableRectangle(Rectangle rectangle) { Size = new SerializablePoint(rectangle.Size); Location = new SerializablePoint(rectangle.Location); }
|
||||
|
||||
public Rectangle GetRectangle()
|
||||
{
|
||||
return new Rectangle() { X = X, Y = Y, Size = Size.GetPoint(), Location = Location.GetPoint() };
|
||||
return new Rectangle(Location.GetPoint(), Size.GetPoint());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.SerializableDTO
|
||||
{
|
||||
public class SerializableVector2
|
||||
{
|
||||
public float X;
|
||||
public float Y;
|
||||
public SerializableVector2(Vector2 vector)
|
||||
{
|
||||
X = vector.X;
|
||||
Y = vector.Y;
|
||||
}
|
||||
public Vector2 GetVector2()
|
||||
{
|
||||
return new Vector2(X, Y);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates
|
||||
{
|
||||
public class Datagramm
|
||||
{
|
||||
public int DatagrammId { get; set; }
|
||||
public List<UpdateData> updateDatas { get; set; }
|
||||
public bool isImportant { get; set; }
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates.ServerToClient
|
|||
{
|
||||
public UpdateTileCreated() { UpdateType = "UpdateTileCreated"; }
|
||||
public Texture2D TextureTile { get; set; }
|
||||
public Vector2 Position { get; set; }
|
||||
public SerializableVector2 Position { get; set; }
|
||||
public SerializablePoint Size { get; set; }
|
||||
public SerializableRectangle sourceRectangle { get; set; }
|
||||
public string tileSetName { get; set; }
|
||||
|
|
|
@ -27,7 +27,8 @@ namespace ZoFo.GameCore.GameManagers.NetworkManager.Updates
|
|||
public class UpdateData
|
||||
{
|
||||
public int IdEntity { get; set; } //Id объекта
|
||||
public string UpdateType { get; protected set; } //тип обновления
|
||||
public string UpdateType { get; set; } //тип обновления
|
||||
public bool isImportant { get; set; }
|
||||
|
||||
public UpdateData()
|
||||
{
|
||||
|
|
|
@ -177,7 +177,7 @@ namespace ZoFo.GameCore
|
|||
{
|
||||
AddData(new UpdateTileCreated()
|
||||
{
|
||||
Position = (gameObject as MapObject).position,
|
||||
Position = new SerializableVector2((gameObject as MapObject).position),
|
||||
sourceRectangle = new SerializableRectangle((gameObject as MapObject).sourceRectangle),
|
||||
Size = new SerializablePoint((gameObject as MapObject).graphicsComponent.ObjectDrawRectangle.Size),
|
||||
tileSetName = ((gameObject as MapObject).graphicsComponent as StaticGraphicsComponent)._textureName
|
||||
|
|
Loading…
Add table
Reference in a new issue