Setter für das Backend
This commit is contained in:
@@ -9,27 +9,47 @@ namespace Frontend
|
|||||||
private Receiver Rec;
|
private Receiver Rec;
|
||||||
private Parser Parse;
|
private Parser Parse;
|
||||||
private TcpClient Client;
|
private TcpClient Client;
|
||||||
|
private Dictionary<int, Dragon> Dragons;
|
||||||
|
private Dictionary<int, Player> Players;
|
||||||
|
private Map Map;
|
||||||
|
|
||||||
public Backend ()
|
public Backend ()
|
||||||
{
|
{
|
||||||
Parse = new Parser();
|
Parse = new Parser();
|
||||||
Client = new TcpClient("localhost",9999);
|
Client = new TcpClient("localhost",9999);
|
||||||
Rec = new Receiver(Client, Parse);
|
Rec = new Receiver(Client, Parse);
|
||||||
|
Dragons = new Dictionary<int, Dragon>();
|
||||||
|
Players = new Dictionary<int, Player>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IPositionable> getDragons()
|
public IEnumerable<IPositionable> getDragons()
|
||||||
{
|
{
|
||||||
return null;
|
return Dragons.Values;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IPositionable> getPlayers()
|
public IEnumerable<IPositionable> getPlayers()
|
||||||
{
|
{
|
||||||
return null;
|
return Players.Values;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDragon (Dragon dragon)
|
||||||
|
{
|
||||||
|
Dragons[dragon.GetId()] = dragon;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetPlayer (Player player)
|
||||||
|
{
|
||||||
|
Players[player.GetId()] = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetMap (Map map)
|
||||||
|
{
|
||||||
|
this.Map = map;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITile[,] getMap()
|
public ITile[,] getMap()
|
||||||
{
|
{
|
||||||
return null;
|
return Map.GetTiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendCommand(string command)
|
public void sendCommand(string command)
|
||||||
|
|||||||
@@ -9,64 +9,64 @@ namespace WorldOfPeacecraft
|
|||||||
{
|
{
|
||||||
public abstract class Entity : IPositionable
|
public abstract class Entity : IPositionable
|
||||||
{
|
{
|
||||||
public int id;
|
public int Id;
|
||||||
public int posX;
|
public int PosX;
|
||||||
public int posY;
|
public int PosY;
|
||||||
public string desc;
|
public string Desc;
|
||||||
public bool busy;
|
public bool Busy;
|
||||||
|
|
||||||
public Entity (int id, int posX, int posY, string desc, bool busy)
|
public Entity (int id, int posX, int posY, string desc, bool busy)
|
||||||
{
|
{
|
||||||
this.setId (id);
|
this.SetId (id);
|
||||||
this.setPosX (posX);
|
this.SetPosX (posX);
|
||||||
this.setPosY (posY);
|
this.SetPosY (posY);
|
||||||
this.setDesc (desc);
|
this.SetDesc (desc);
|
||||||
this.setBusy (busy);
|
this.SetBusy (busy);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId (int id)
|
public void SetId (int id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.Id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getId ()
|
public int GetId ()
|
||||||
{
|
{
|
||||||
return id;
|
return Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPosX (int x)
|
public void SetPosX (int x)
|
||||||
{
|
{
|
||||||
this.posX = x;
|
this.PosX = x;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getXPosition ()
|
public int GetXPosition ()
|
||||||
{
|
{
|
||||||
return posX;
|
return PosX;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPosY (int y)
|
public void SetPosY (int y)
|
||||||
{
|
{
|
||||||
this.posY = y;
|
this.PosY = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getYPosition ()
|
public int GetYPosition ()
|
||||||
{
|
{
|
||||||
return posY;
|
return PosY;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDesc (string desc)
|
public void SetDesc (string desc)
|
||||||
{
|
{
|
||||||
this.desc = desc;
|
this.Desc = desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBusy (bool busy)
|
public void SetBusy (bool busy)
|
||||||
{
|
{
|
||||||
this.busy = busy;
|
this.Busy = busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool getBusy ()
|
public bool GetBusy ()
|
||||||
{
|
{
|
||||||
return busy;
|
return Busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,17 +11,16 @@ namespace WorldOfPeacecraft
|
|||||||
map = new Tile[height, width];
|
map = new Tile[height, width];
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTile (Tile t)
|
public void SetTile (Tile t)
|
||||||
{
|
{
|
||||||
int x = t.getX ();
|
int x = t.getX ();
|
||||||
int y = t.getY ();
|
int y = t.getY ();
|
||||||
map [x, y] = t;
|
map [x, y] = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tile getTile (int x, int y)
|
public Tile[,] GetTiles ()
|
||||||
{
|
{
|
||||||
|
return map;
|
||||||
return map [x, y];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user