public void Load(SavedGameInfo savedGameData, IEnumerable <NamedStream> staticDataSources) { if (savedGameData == null) { throw new ArgumentNullException(nameof(savedGameData)); } IkonComposite saveRawData; using (var parser = new IkonParser(savedGameData.FileInfo.OpenText())) saveRawData = parser.ParseAll().Dequeue(MainGame.SaveGameTag).To <IkonComposite>(); this.gameController.LoadGame(GameBuilder.LoadGame(saveRawData, staticDataSources, GameController.GetStateManager())); }
public void CreateGame(NewGameController controller, IEnumerable <TracableStream> staticDataSources) { if (State != GameState.NoGame) { throw new InvalidOperationException("Game is already created."); } //TODO(later): Pass organization to player var players = controller.PlayerList.Select(info => new Player(info.Name, info.Color, /*info.Organization, */ info.ControlType) ).ToArray(); var organellePlayer = new Player("no name", System.Drawing.Color.Gray, new PlayerType(PlayerControlType.Neutral, new OrganellePlayerFactory())); var rng = new Random(); this.gameObj = GameBuilder.CreateGame(rng, players, organellePlayer, controller, staticDataSources); makePlayers(); }
public void CreateGame(NewGameController controller) { if (State != GameState.NoGame) { throw new InvalidOperationException("Game is already created."); } var rng = new Random(); var players = controller.PlayerList.Select(info => new Player(info.Name, info.Color, NewGameController.Resolve(info.Organization, rng), info.ControlType) ).ToArray(); var organellePlayer = new Player( "no name", System.Drawing.Color.Gray, null, new PlayerType(PlayerControlType.Neutral, new OrganellePlayerFactory()) ); this.gameObj = GameBuilder.CreateGame(rng, players, organellePlayer, controller); this.endedTurnPlayers.Clear(); makePlayers(); }
public void Load(SavedGameInfo savedGameData, IEnumerable <TracableStream> staticDataSources) { this.gameController.LoadGame(GameBuilder.LoadGame(savedGameData.RawData, staticDataSources)); }