Beispiel #1
0
        public void OnTimer()
        {
            try
            {
                if (StoryProgression.Main == null)
                {
                    return;
                }

                Scenarios.IncStat("OnTimer Try");

                if (mInTimer)
                {
                    return;
                }

                mWatch.Restart();

                try
                {
                    mInTimer = true;

                    mRunning = true;

                    if (GetValue <ShowStartScreenOption, bool>())
                    {
                        FilePersistence.ImportFromTuning("NRaas.StoryProgression.Tuning");

                        if (!GetValue <ProgressionOption, bool>())
                        {
                            if (AcceptCancelDialog.Show(Localize("Welcome")))
                            {
                                GetOption <ProgressionOption>().SetValue(true);

                                new InitialHomelessScenario().Post(Households, true, false);
                            }
                        }
                    }

                    GetOption <ShowStartScreenOption>().SetValue(false);

                    if (GetValue <ProgressionOption, bool>())
                    {
                        int currentInterval = LifeSpan.GetHumanAgeSpanLength();

                        if (GetValue <LastAskedIntervalOption, int>() != currentInterval)
                        {
                            if (AcceptCancelDialog.Show(Localize("AgeSpan")))
                            {
                                AdjustSpeedForAgeSpan((float)currentInterval / GetValue <SavedIntervalOption, int>());

                                GetOption <SavedIntervalOption>().SetValue(currentInterval);
                            }

                            GetOption <LastAskedIntervalOption>().SetValue(currentInterval);
                        }
                    }

                    Update(false, false);
                }
                finally
                {
                    mInTimer = false;
                }

                Scenarios.IncStat("OnTimer Complete");
            }
            catch (Exception exception)
            {
                Common.Exception(UnlocalizedName, exception);
            }
        }