コード例 #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
ファイル: StaticDataStore.cs プロジェクト: johny5w/Pulsar4x
 internal void OnDeserialized(StreamingContext context)
 {
     foreach (string dataSet in _loadedDataSets.Select(dataVersionInfo => dataVersionInfo.Directory).ToList())
     {
         StaticDataManager.LoadData(dataSet, (Game)context.Context);
     }
     SetStorageTypeMap();
 }
コード例 #3
0
 public NewGameOptionsVM(GameVM gameVM)
 {
     _gameVM             = gameVM;
     CreatePlayerFaction = true;
     DefaultStart        = true;
     FactionName         = "United Earth Federation";
     FactionPassword     = "";
     GmPassword          = "";
     NumberOfSystems     = 50;
     AvailableModList    = new ObservableCollection <DataVersionInfo>(StaticDataManager.AvailableData());
     SelectedModList     = new ObservableCollection <DataVersionInfo>();
 }
コード例 #4
0
 public void ExportToFile()
 {
     StaticDataManager.ExportStaticData(_staticData.ComponentTemplates, "NewComponentData.json");
 }