tiles and lines
This commit is contained in:
parent
9085f4d5cb
commit
b21a7c7ef2
4 changed files with 160 additions and 14 deletions
|
@ -27,6 +27,7 @@ namespace Sledgemapper.Shared.Entities
|
|||
Overlays = new ConcurrentDictionary<string, Overlay>();
|
||||
Walls = new ConcurrentDictionary<string, Wall>();
|
||||
Notes = new ConcurrentDictionary<string, Note>();
|
||||
Lines=new ConcurrentDictionary<string, Line>();
|
||||
Players = new List<Player>();
|
||||
Colors = new List<string>();
|
||||
}
|
||||
|
@ -40,6 +41,7 @@ namespace Sledgemapper.Shared.Entities
|
|||
public List<string> Colors { get; set; }
|
||||
public string SessionName { get; set; }
|
||||
public int SessionId { get; set; }
|
||||
public ConcurrentDictionary<string, Line> Lines { get; private set; }
|
||||
|
||||
public void NewTile(Tile selectedTile, string tileId)
|
||||
{
|
||||
|
@ -179,5 +181,25 @@ namespace Sledgemapper.Shared.Entities
|
|||
{
|
||||
MapEntityDeleted?.Invoke(this, e);
|
||||
}
|
||||
|
||||
public void NewLine(Line line)
|
||||
{
|
||||
if (line is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var lineExist = Lines.TryGetValue(line.ToString(), out var tile);
|
||||
var newLine = new Line { X = line.X, Y = line.Y,EndX=line.EndX, EndY=line.EndY };
|
||||
if (lineExist)
|
||||
{
|
||||
Lines.TryRemove(line.ToString(), out var _);
|
||||
}
|
||||
|
||||
Lines.TryAdd(newLine.ToString(), newLine);
|
||||
|
||||
//TODO fix this
|
||||
//OnRaiseMapEntityAddedEvent(new MapEntityAddedEventArgs(newTile));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,21 +1,30 @@
|
|||
namespace Sledgemapper.Shared.Entities
|
||||
{
|
||||
public abstract class BaseMapEntity
|
||||
{
|
||||
public int X { get; set; }
|
||||
public abstract class BaseMapEntity
|
||||
{
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public string ID { get; set; }
|
||||
public int Rotation { get; set; }
|
||||
public override string ToString()
|
||||
public int Rotation { get; set; }
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{X}_{Y}";
|
||||
}
|
||||
public double Timestamp {get;set;}
|
||||
}
|
||||
public double Timestamp { get; set; }
|
||||
}
|
||||
|
||||
public class Tile :BaseMapEntity
|
||||
public class Tile : BaseMapEntity
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public class Line : BaseMapEntity
|
||||
{
|
||||
public int EndX { get; set; }
|
||||
public int EndY { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{X}_{Y}_{EndX}_{EndY}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue