Parser hat seperaten Update und schreibt Player nicht jedes mal neu
This commit is contained in:
@@ -77,11 +77,21 @@ namespace WorldOfPeacecraft
|
||||
return Players[playerId];
|
||||
}
|
||||
|
||||
public Dictionary<int, Player> getPlayerList()
|
||||
{
|
||||
return Players;
|
||||
}
|
||||
|
||||
public Dragon getDragon (int dragonId)
|
||||
{
|
||||
return Dragons[dragonId];
|
||||
}
|
||||
|
||||
public Dictionary<int, Dragon> getDragonList()
|
||||
{
|
||||
return Dragons;
|
||||
}
|
||||
|
||||
public Map getMapObject ()
|
||||
{
|
||||
return Map;
|
||||
|
||||
@@ -300,11 +300,22 @@ namespace WorldOfPeacecraft
|
||||
|
||||
private void ProcessPlayer (Block playerBlock)
|
||||
{
|
||||
lock (Backend) {
|
||||
Backend.SetPlayer (MapPlayer (playerBlock));
|
||||
}
|
||||
Backend.RefreshGui ();
|
||||
int id = MapPlayer(playerBlock).GetId();
|
||||
if (Backend.getPlayer(id) == null)
|
||||
{
|
||||
lock (Backend)
|
||||
{
|
||||
Backend.SetPlayer(MapPlayer(playerBlock));
|
||||
}
|
||||
Backend.RefreshGui();
|
||||
}
|
||||
else
|
||||
{
|
||||
MapPlayerUPD(playerBlock);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ProcessMapcell (Block mapcellBlock)
|
||||
{
|
||||
@@ -405,6 +416,21 @@ namespace WorldOfPeacecraft
|
||||
int y = playerBlock.GetIntValue (ValueY);
|
||||
return new Player (id, x, y, desc, busy, score);
|
||||
}
|
||||
|
||||
private void MapPlayerUPD(Block playerBlock)
|
||||
{
|
||||
int id = playerBlock.GetIntValue(ValueId);
|
||||
int score = playerBlock.GetIntValue(ValuePoints);
|
||||
bool busy = playerBlock.GetBoolValue(ValueBusy);
|
||||
string desc = playerBlock.GetStringValue(ValueDescription);
|
||||
int x = playerBlock.GetIntValue(ValueX);
|
||||
int y = playerBlock.GetIntValue(ValueY);
|
||||
|
||||
Backend.getPlayer(id).SetScore(score);
|
||||
Backend.getPlayer(id).SetDesc(desc);
|
||||
Backend.getPlayer(id).SetX(x);
|
||||
Backend.getPlayer(id).SetY(y);
|
||||
}
|
||||
|
||||
private Tile MapMapcell (Block cellBlock)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user