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
|
||||
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()
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue