Setter für das Backend

This commit is contained in:
2014-04-05 13:55:18 +02:00
parent 24612b0901
commit 202cd1638e
3 changed files with 54 additions and 35 deletions

View File

@@ -9,27 +9,47 @@ namespace Frontend
private Receiver Rec;
private Parser Parse;
private TcpClient Client;
private Dictionary<int, Dragon> Dragons;
private Dictionary<int, Player> Players;
private Map Map;
public Backend ()
{
Parse = new Parser();
Client = new TcpClient("localhost",9999);
Rec = new Receiver(Client, Parse);
Dragons = new Dictionary<int, Dragon>();
Players = new Dictionary<int, Player>();
}
public IEnumerable<IPositionable> getDragons()
{
return null;
return Dragons.Values;
}
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()
{
return null;
return Map.GetTiles();
}
public void sendCommand(string command)

View File

@@ -9,64 +9,64 @@ namespace WorldOfPeacecraft
{
public abstract class Entity : IPositionable
{
public int id;
public int posX;
public int posY;
public string desc;
public bool busy;
public int Id;
public int PosX;
public int PosY;
public string Desc;
public bool Busy;
public Entity (int id, int posX, int posY, string desc, bool busy)
{
this.setId (id);
this.setPosX (posX);
this.setPosY (posY);
this.setDesc (desc);
this.setBusy (busy);
this.SetId (id);
this.SetPosX (posX);
this.SetPosY (posY);
this.SetDesc (desc);
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;
}
}

View File

@@ -11,17 +11,16 @@ namespace WorldOfPeacecraft
map = new Tile[height, width];
}
public void setTile (Tile t)
public void SetTile (Tile t)
{
int x = t.getX ();
int y = t.getY ();
map [x, y] = t;
}
public Tile getTile (int x, int y)
public Tile[,] GetTiles ()
{
return map [x, y];
return map;
}
}
}