예제 #1
0
 private void RecreateStarmapPreview()
 {
     if (this._starmapPreview != null)
     {
         this._starmapPreview.Dispose();
         this.App.UI.Send((object)"SetGameObject", (object)"starmapPreviewImage", (object)0);
     }
     if (string.IsNullOrEmpty(this._tempGameSetup.StarMapFile))
     {
         return;
     }
     this._starmapPreview = new StarMapPreview(this.App, this._tempGameSetup);
     this.App.UI.Send((object)"SetGameObject", (object)"starmapPreviewImage", (object)this._starmapPreview.StarMap.ObjectID);
 }
예제 #2
0
 protected override void OnExit(GameState prev, ExitReason reason)
 {
     this.App.UI.DeleteScreen("GameSetup");
     if (this._starmapPreview != null)
     {
         this._starmapPreview.Dispose();
         this._starmapPreview = (StarMapPreview)null;
     }
     this._strategicTurnLengthSlider      = (TimeSlider)null;
     this._combatTurnLengthSlider         = (TimeSlider)null;
     this._economicEfficiencySlider       = (PercentageSlider)null;
     this._researchEfficiencySlider       = (PercentageSlider)null;
     this._planetResourcesSlider          = (ValueBoundSlider)null;
     this._planetSizeSlider               = (ValueBoundSlider)null;
     this._initialTreasurySlider          = (TreasurySlider)null;
     this._numPlayersSpinner              = (ValueBoundSpinner)null;
     this._initialSystemsSpinner          = (ValueBoundSpinner)null;
     this._initialTechnologiesSpinner     = (ValueBoundSpinner)null;
     this._randomEncounterFrequencySlider = (PercentageSlider)null;
     this._grandMenaceSlider              = (ValueBoundSlider)null;
     this._starmapIdMap  = (Dictionary <int, Starmap.StarmapInfo>)null;
     this._scenarioIdMap = (Dictionary <int, Scenario.ScenarioInfo>)null;
 }
예제 #3
0
 private void SelectStarMapOrScenario(int?nullableId, bool isMapFile)
 {
     if (!nullableId.HasValue)
     {
         this._tempGameSetup.StarMapFile  = string.Empty;
         this._tempGameSetup.ScenarioFile = string.Empty;
         if (this._starmapPreview == null)
         {
             return;
         }
         this._starmapPreview.Dispose();
         this._starmapPreview = (StarMapPreview)null;
     }
     else
     {
         int    index = nullableId.Value;
         string fallbackTitle;
         string strId;
         if (isMapFile)
         {
             fallbackTitle = this._starmapIdMap[index].GetFallbackTitle();
             strId         = this._starmapIdMap[index].Description;
         }
         else
         {
             fallbackTitle = this._scenarioIdMap[index].GetFallbackTitle();
             strId         = string.Empty;
         }
         this.App.UI.SetPropertyString("mapLabel", "text", App.Localize(fallbackTitle));
         this.App.UI.SetText("mapsummary_Content", App.Localize(strId));
         if (isMapFile)
         {
             foreach (Faction faction in this.App.AssetDatabase.Factions)
             {
                 this.App.GameSetup.AvailablePlayerFeatures.TryAddFaction(faction);
                 if (faction.IsPlayable)
                 {
                     this.App.UI.SetChecked(GameSetupState.UIAvailableFactionCheckBox(faction), true);
                     this.App.UI.SetEnabled(GameSetupState.UIAvailableFactionCheckBox(faction), true);
                 }
             }
             this._numPlayersSpinner.SetEnabled(true);
             this._initialSystemsSpinner.SetEnabled(true);
             this._initialTechnologiesSpinner.SetEnabled(true);
             this._initialTreasurySlider.SetEnabled(true);
             this.App.UI.SetEnabled("victoryToggle", true);
             Starmap.StarmapInfo starmapId = this._starmapIdMap[index];
             this._tempGameSetup.StarMapFile  = starmapId.FileName;
             this._tempGameSetup.ScenarioFile = string.Empty;
             this._numPlayersSpinner.SetValue((double)starmapId.NumPlayers);
             this._maxPlayers = starmapId.NumPlayers;
         }
         else
         {
             Scenario.ScenarioInfo scenarioId = this._scenarioIdMap[index];
             this._tempGameSetup.ScenarioFile = scenarioId.FileName;
             this._tempGameSetup.StarMapFile  = scenarioId.StarmapInfo.FileName;
             this._numPlayersSpinner.SetValue((double)scenarioId.StarmapInfo.NumPlayers);
             Scenario s = new Scenario();
             ScenarioXmlUtility.LoadScenarioFromXml(scenarioId.FileName, ref s);
             foreach (Faction faction in this.App.AssetDatabase.Factions)
             {
                 this.App.GameSetup.AvailablePlayerFeatures.TryRemoveFaction(faction);
                 if (faction.IsPlayable)
                 {
                     this.App.UI.SetChecked(GameSetupState.UIAvailableFactionCheckBox(faction), false);
                     this.App.UI.SetEnabled(GameSetupState.UIAvailableFactionCheckBox(faction), false);
                 }
             }
             foreach (Kerberos.Sots.Data.ScenarioFramework.Player playerStartCondition in s.PlayerStartConditions)
             {
                 Faction faction = this.App.AssetDatabase.GetFaction(playerStartCondition.Faction);
                 this.App.GameSetup.AvailablePlayerFeatures.TryAddFaction(faction);
                 if (faction.IsPlayable)
                 {
                     this.App.UI.SetChecked(GameSetupState.UIAvailableFactionCheckBox(faction), true);
                 }
             }
             this._numPlayersSpinner.SetEnabled(false);
             this._initialSystemsSpinner.SetEnabled(false);
             this._initialTechnologiesSpinner.SetEnabled(false);
             this._initialTreasurySlider.SetEnabled(false);
             this.App.UI.SetEnabled("victoryToggle", false);
         }
         this.RecreateStarmapPreview();
     }
 }