コード例 #1
0
ファイル: SavesController.cs プロジェクト: weshec/Stareater
        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()));
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
 public void Load(SavedGameInfo savedGameData, IEnumerable <TracableStream> staticDataSources)
 {
     this.gameController.LoadGame(GameBuilder.LoadGame(savedGameData.RawData, staticDataSources));
 }