Erste Gui Version. Es wird lediglich die Map gezeichnet. Das Backend ist angeschlossen

This commit is contained in:
2014-04-30 17:28:58 +02:00
parent 7a8df2e147
commit ba4eb0d2d9
19 changed files with 363 additions and 513 deletions

View File

@@ -2,25 +2,32 @@ using System.Net.Sockets;
using System.Collections.Generic;
using WorldOfPeacecraft;
namespace Frontend
namespace WorldOfPeacecraft
{
public class Backend : IBackend
{
private Sender Send;
private Receiver Rec;
private Parser Parse;
private TcpClient Client;
private Dictionary<int, Dragon> Dragons;
private Dictionary<int, Player> Players;
private Map Map;
private Buffer Buffer;
private Buffer SenderBuffer;
private IGui Gui;
public Backend ()
public Backend (IGui gui)
{
Parse = new Parser (Buffer);
Client = new TcpClient ("localhost", 9999);
Rec = new Receiver (Client, Buffer);
Gui = gui;
Dragons = new Dictionary<int, Dragon> ();
Players = new Dictionary<int, Player> ();
Client = new TcpClient ("localhost", 9999);
Buffer receiverBuffer = new Buffer(10000);
SenderBuffer = new Buffer(100);
Parse = new Parser (this, receiverBuffer);
Rec = new Receiver (Client, receiverBuffer);
Send = new Sender (Client, SenderBuffer);
SenderBuffer.AddLine("get:map");
}
public IEnumerable<IPositionable> getDragons ()
@@ -83,8 +90,11 @@ namespace Frontend
this.Map = map;
}
public ITile[,] getMap ()
public ITile[,] GetMap ()
{
if (Map == null) {
return null;
}
return Map.GetTiles ();
}
@@ -95,5 +105,10 @@ namespace Frontend
public void sendChat (string message)
{
}
public void RefreshGui()
{
Gui.PerformRefresh();
}
}
}