예제 #1
0
파일: Game.cs 프로젝트: b4ux1t3/Pulsar4x
        public Game([NotNull] NewGameSettings newGameSettings) : this()
        {
            if (newGameSettings == null)
            {
                throw new ArgumentNullException(nameof(newGameSettings));
            }

            GalaxyGen = new GalaxyFactory(true, newGameSettings.MasterSeed);

            StaticRefLib.GameSettings   = newGameSettings;
            GameLoop.GameGlobalDateTime = newGameSettings.StartDateTime;

            // Load Static Data
            if (newGameSettings.DataSets != null)
            {
                foreach (string dataSet in newGameSettings.DataSets)
                {
                    StaticDataManager.LoadData(dataSet, this);
                }
            }
            if (StaticData.LoadedDataSets.Count == 0)
            {
                StaticDataManager.LoadData("Pulsar4x", this);
            }
            // Create SM


            SpaceMaster.ChangePassword(new AuthenticationToken(SpaceMaster, ""), newGameSettings.SMPassword);
            GameMasterFaction = FactionFactory.CreatePlayerFaction(this, SpaceMaster, "SpaceMaster Faction");

            if (newGameSettings.CreatePlayerFaction ?? false)
            {
                foreach (var kvp in newGameSettings.DefaultHaltOnEvents)
                {
                    //defaultPlayer.HaltsOnEvent.Add(kvp.Key, kvp.Value);
                }

                if (newGameSettings.DefaultSolStart ?? false)
                {
                    //DefaultStartFactory.DefaultHumans(this, newGameSettings.DefaultFactionName);
                }
                else
                {
                    //FactionFactory.CreatePlayerFaction(this, defaultPlayer, newGameSettings.DefaultFactionName);
                }
            }

            // Temp: This will be reworked later.
            GenerateSystems(new AuthenticationToken(SpaceMaster, newGameSettings.SMPassword), newGameSettings.MaxSystems);

            /*
             * GlobalManager.ManagerSubpulses.Init(GlobalManager);
             * foreach (StarSystem starSys in this.Systems.Values)
             * {
             *  starSys.ManagerSubpulses.Init(starSys);
             * }*/

            // Fire PostLoad event
            PostLoad += (sender, args) => { InitializeProcessors(); };
        }
예제 #2
0
 public StarSystemFactory(Game game)
 {
     GalaxyGen          = game.GalaxyGen;
     _systemBodyFactory = new SystemBodyFactory(GalaxyGen);
     _starFactory       = new StarFactory(GalaxyGen);
 }
예제 #3
0
 public StarFactory(GalaxyFactory galaxyGen)
 {
     _galaxyGen = galaxyGen;
 }