public SpaceBattleGame(Guid matchId, bool loadMatchData)
{
//load the match
if (loadMatchData)
{
var m = CloudWarsData.GetMatch(matchId);
this.MatchId = m.Id;
this.Player1 = m.Player1;
this.Player2 = m.Player2;
this.Player1Ready = m.Player1Ready;
this.Player2Ready = m.Player2Ready;
this.Turn = m.Turn;
this.Initialized = m.Initialized;
this.MatchEnded = m.MatchEnded;
this.Winner = m.Winner;
this.PlayingNow = m.PlayingNow;
//Get the units
var dbUnits = CloudWarsData.GetUnits(matchId);
Units = new List<IGameUnit>();
foreach (var u in dbUnits)
{
Units.Add(new GameUnit(u));
}
}
else
{
this.MatchId = matchId;
}
}