Exemplo n.º 1
0
        public static MainGame LoadGame(IkonComposite saveData, IEnumerable <TracableStream> staticDataSources)
        {
            var statics = StaticsDB.Load(staticDataSources);

            var deindexer = new ObjectDeindexer();
            int turn      = saveData[MainGame.TurnKey].To <int>();

            deindexer.AddAll(statics.Constructables, x => x.IdCode);
            deindexer.AddAll(statics.DevelopmentTopics, x => x.IdCode);
            deindexer.AddAll(statics.PredeginedDesigns);
            deindexer.AddAll(statics.ResearchTopics, x => x.IdCode);
            deindexer.AddAll(statics.Armors.Values, x => x.IdCode);
            deindexer.AddAll(statics.Hulls.Values, x => x.IdCode);
            deindexer.AddAll(statics.IsDrives.Values, x => x.IdCode);
            deindexer.AddAll(statics.MissionEquipment.Values, x => x.IdCode);
            deindexer.AddAll(statics.Reactors.Values, x => x.IdCode);
            deindexer.AddAll(statics.Sensors.Values, x => x.IdCode);
            deindexer.AddAll(statics.Shields.Values, x => x.IdCode);
            deindexer.AddAll(statics.SpecialEquipment.Values, x => x.IdCode);
            deindexer.AddAll(statics.Thrusters.Values, x => x.IdCode);
            deindexer.AddAll(statics.Traits.Values, x => x.IdCode);

            var loadedStates    = loadSaveData(saveData, deindexer, statics);
            var states          = loadedStates.Item1;
            var players         = loadedStates.Item2;
            var organellePlayer = loadedStates.Item3;
            var derivates       = initDerivates(statics, players, organellePlayer, states);

            var game = new MainGame(players.ToArray(), organellePlayer, statics, states, derivates);

            game.CalculateDerivedEffects();

            return(game);
        }
Exemplo n.º 2
0
        public static MainGame CreateGame(Random rng, Player[] players, Player organellePlayer, NewGameController controller, IEnumerable <TracableStream> staticDataSources)
        {
            var statics   = StaticsDB.Load(staticDataSources);
            var states    = createStates(rng, controller, players, statics);
            var derivates = createDerivates(players, organellePlayer, controller.SelectedStart, statics, states);

            var game = new MainGame(players, organellePlayer, statics, states, derivates);

            game.CalculateDerivedEffects();

            controller.SaveLastGame();
            return(game);
        }
Exemplo n.º 3
0
        public static MainGame CreateGame(Random rng, Player[] players, Player organellePlayer, NewGameController controller)
        {
            var statics   = controller.Statics;
            var states    = createStates(rng, controller, players, statics);
            var derivates = createDerivates(players, organellePlayer, controller.SelectedStart, statics, states);

            var game = new MainGame(players, organellePlayer, statics, states, derivates);

            initOrders(game);
            initPlayers(game);
            game.CalculateDerivedEffects();

            controller.SaveLastGame();
            return(game);
        }