Exemple #1
0
 private void CreateUI()
 {
     this._strategicTurnLengthSlider      = new TimeSlider(this.App.UI, "gameStrategyTurnLength", this.App.GameSetup.StrategicTurnLength, 0.25f, 15f, 0.25f, true);
     this._combatTurnLengthSlider         = new TimeSlider(this.App.UI, "gameCombatTurnLength", this.App.GameSetup.CombatTurnLength, 3f, 12f, 1f, false);
     this._economicEfficiencySlider       = new PercentageSlider(this.App.UI, "gameEconomicEfficiency", this.App.GameSetup.EconomicEfficiency, 50, 200);
     this._researchEfficiencySlider       = new PercentageSlider(this.App.UI, "gameResearchEfficiency", this.App.GameSetup.ResearchEfficiency, 50, 200);
     this._planetResourcesSlider          = (ValueBoundSlider) new PercentageSlider(this.App.UI, "gameStarMapPlanetResSlider", this.App.GameSetup.PlanetResources, 50, 150);
     this._planetSizeSlider               = (ValueBoundSlider) new PercentageSlider(this.App.UI, "gameStarMapPlanetSizeSlider", this.App.GameSetup.PlanetSize, 50, 150);
     this._initialTreasurySlider          = new TreasurySlider(this.App.UI, "gameInitialTreasury", this.App.GameSetup.InitialTreasury, 0, 1000000);
     this._numPlayersSpinner              = new ValueBoundSpinner(this.App.UI, "gameNumPlayers", 2.0, 8.0, (double)this.App.GameSetup.Players.Count, 1.0);
     this._initialSystemsSpinner          = new ValueBoundSpinner(this.App.UI, "gameInitialSystems", 3.0, 9.0, (double)this.App.GameSetup.InitialSystems, 1.0);
     this._initialTechnologiesSpinner     = new ValueBoundSpinner(this.App.UI, "gameInitialTechs", 0.0, 10.0, (double)this.App.GameSetup.InitialTechnologies, 1.0);
     this._randomEncounterFrequencySlider = new PercentageSlider(this.App.UI, "gameRandomEncounterFrequency", this.App.GameSetup.RandomEncounterFrequency, 0, 200);
     this._grandMenaceSlider              = new ValueBoundSlider(this.App.UI, "gameGrandMenaces", 0, 5, this.App.GameSetup.GrandMenaceCount);
     foreach (Faction faction in this.App.AssetDatabase.Factions)
     {
         if (faction.IsPlayable)
         {
             this.App.UI.SetChecked(GameSetupState.UIAvailableFactionCheckBox(faction), this.App.GameSetup.AvailablePlayerFeatures.Factions.ContainsKey(faction));
         }
     }
     string[] strArray = new string[1] {
         "loa"
     };
     foreach (string str in strArray)
     {
         string expansionFactionName = str;
         if (!this.App.AssetDatabase.Factions.Any <Faction>((Func <Faction, bool>)(x => x.Name == expansionFactionName)))
         {
             this.App.UI.SetChecked(GameSetupState.UIAvailableFactionCheckBox(expansionFactionName), false);
             this.App.UI.SetVisible(GameSetupState.UIAvailableFactionFrame(expansionFactionName), false);
         }
     }
     this.App.UI.SetVisible("gameScenarioList", false);
     this.App.UI.SetVisible("gameStarMapList", true);
     this.App.UI.SetChecked("gameScenariosCheckbox", false);
     this.App.UI.SetChecked("gameMapsCheckbox", true);
     this.PopulateScenarioList();
     this.PopulateStarMapList();
     if (this._starmapIdMap.Count <= 0)
     {
         return;
     }
     if (ScriptHost.AllowConsole && this._starmapIdMap.Any <KeyValuePair <int, Starmap.StarmapInfo> >((Func <KeyValuePair <int, Starmap.StarmapInfo>, bool>)(x => x.Value.Title == "@STARMAP_TITLE_FIGHT")))
     {
         this.App.UI.SetSelection("gameStarMapList", this._starmapIdMap.FirstOrDefault <KeyValuePair <int, Starmap.StarmapInfo> >((Func <KeyValuePair <int, Starmap.StarmapInfo>, bool>)(x => x.Value.Title == "@STARMAP_TITLE_FIGHT")).Key);
     }
     else
     {
         this.App.UI.SetSelection("gameStarMapList", this._starmapIdMap.Keys.First <int>());
     }
 }
Exemple #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;
 }
Exemple #3
0
    //calculates the treatment assignment results for today;
    //creates a next day and displays it;
    //checks if player has reached a lose/win state;
    public IEnumerator taskOnClick()
    {
        //Calculate treatment decisions/apply treatment;
        if (state == 0)
        {
            if (clicked == true)
            {
                nextDay.enabled = false;
                lefty.GetComponent <Slider> ().enabled  = false;
                righty.GetComponent <Slider> ().enabled = false;
                world.calculate(init);
                if (world.totalDays() == 1)
                {
                    end = "none";
                    csv.firstDayAdder(world, init);
                }
                else
                {
                    csv.nextDayAdder(world, init);
                }
                j.jAdder(world, init, this);
                txt.updateText(world, 1);
                fill.nextDay(world, 1);

                //1. cure people in clinic and population
                yield return(StartCoroutine(spawner.cure(init, world)));

                spawner2.cure(init, world);


                //2. make cured/still sick people move from clinic to population
                GameObject.Find("Pump").GetComponent <Animator> ().SetBool("Pump", true);
                pump.Play();
                yield return(StartCoroutine(spawner.disappear()));

                GameObject.Find("Pump").GetComponent <Animator> ().SetBool("Pump", false);

                yield return(StartCoroutine(spawner2.appear()));

                clicked = false;
            }
            //Create a New Day;
            if (checker == true && end == "none")
            {
                world.nextDay(init);
                PercentageSlider.setter();
                txt.updateDay(world, 1);

                //commented out for now since we don't want to reset the values to 0;
                lefty.GetComponent <Slider> ().value  = 0f;
                righty.GetComponent <Slider> ().value = 0f;

                //3. make people catch disease in population
                yield return(StartCoroutine(spawner2.catchDisease(world)));

                //yield return new WaitForSecondsRealtime (1f);

                //4. move sick people from population to clinic

                yield return(StartCoroutine(spawner2.disappear()));

                GameObject.Find("Pump").GetComponent <Animator> ().SetBool("PumpBack", true);
                yield return(new WaitForSecondsRealtime(1f));

                yield return(StartCoroutine(spawner.appear(world)));

                GameObject.Find("Pump").GetComponent <Animator> ().SetBool("PumpBack", false);

                end = StopRule.check(world, init);
                if (end != "none")
                {
                    world.calculate(init);
                    j.jAdder(world, init, this);
                    go.gmOver(end);
                    yield return(null);
                }
                else
                {
                    checker         = false;
                    nextDay.enabled = true;
                    lefty.GetComponent <Slider> ().enabled  = true;
                    righty.GetComponent <Slider> ().enabled = true;
                    txt.sickUpdate(world);
                }
                yield return(null);
            }
            yield return(null);
        }
        yield return(null);
    }