minor fixes
This commit is contained in:
parent
b9d32f2567
commit
bca2a30c65
5 changed files with 22 additions and 20 deletions
|
@ -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()
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue