This commit is contained in:
Michele 2021-01-02 00:45:23 +00:00
parent 901d8ff8c3
commit ee42010866
3 changed files with 337 additions and 52 deletions

View file

@ -28,6 +28,7 @@ namespace Sledgemapper.Shared.Entities
Walls = new ConcurrentDictionary<string, Wall>();
Notes = new ConcurrentDictionary<string, Note>();
Lines=new ConcurrentDictionary<string, Line>();
Rooms=new ConcurrentDictionary<string, Room>();
Players = new List<Player>();
Colors = new List<string>();
}
@ -42,6 +43,7 @@ namespace Sledgemapper.Shared.Entities
public string SessionName { get; set; }
public int SessionId { get; set; }
public ConcurrentDictionary<string, Line> Lines { get; private set; }
public ConcurrentDictionary<string, Room> Rooms { get; private set; }
public void NewTile(Tile selectedTile, string tileId)
{
@ -201,5 +203,25 @@ namespace Sledgemapper.Shared.Entities
//TODO fix this
//OnRaiseMapEntityAddedEvent(new MapEntityAddedEventArgs(newTile));
}
public void NewRoom(Room line)
{
if (line is null)
{
return;
}
var lineExist = Rooms.TryGetValue(line.ToString(), out var tile);
var newLine = new Room { Start=line.Start, End=line.End};
if (lineExist)
{
Rooms.TryRemove(line.ToString(), out var _);
}
Rooms.TryAdd(newLine.ToString(), newLine);
//TODO fix this
//OnRaiseMapEntityAddedEvent(new MapEntityAddedEventArgs(newTile));
}
}
}

View file

@ -29,6 +29,17 @@
}
}
public class Room : BaseMapEntity
{
public SnapPoint Start { get; set; }
public SnapPoint End { get; set; }
public override string ToString()
{
return $"{Start.X}_{Start.Y}_{Start.Index}_{End.X}_{End.Y}_{End.Index}";
}
}
public class SnapPoint : BaseMapEntity
{
public int Index { get; set; }