コード例 #1
0
 protected override void RecordPopupListState(string popupListName, string selectionName) {
     GameClockSpeed gameSpeedOnLoad;
     if (Enums<GameClockSpeed>.TryParse(selectionName, true, out gameSpeedOnLoad)) {
         //UnityEngine.D.Log("GameClockSpeedOnLoad recorded as {0}.".Inject(selectionName));
         _gameSpeedOnLoad = gameSpeedOnLoad;
     }
     // more popupLists here
 }
コード例 #2
0
 private void RefreshReadout(GameClockSpeed clockSpeed) {
     RefreshReadout(CommonTerms.MultiplySign + clockSpeed.SpeedMultiplier().ToString());
 }
コード例 #3
0
ファイル: GameTime.cs プロジェクト: Maxii/UnityEntry
 private void OnGameSpeedChanging(GameClockSpeed proposedSpeed) {
     SyncGameClock();
 }
コード例 #4
0
ファイル: GameTime.cs プロジェクト: Maxii/UnityEntry
        public void PrepareToResumeSavedGame() {
            EnableClock(false); // when saved it was enabled. Disable now pending re-enable on Running
            // cumTimeInPriorSessions was updated before saving, so it should be restored to the right value
            D.Log("GameTime.PrepareToResumeSavedGame() called. cumTimeInPriorSessions restored to {0:0.0)}.", _cumTimeInPriorSessions);
            // timeGameBeganInCurrentSession that was saved is irrelevant. It will be updated when the clock is enabled on Running
            // cumTimePaused was updated before saving, so it should be restored to the right value
            // timeCurrentPauseBegan will be set to a new value when the clock is paused again
            // _gameRealTimeAtLastSync will be set to the current RealTime_Game when the clock is started again

            // currentDateTime is key! It value when restored should be accurate as it was updated at every sync prior to being saved
            _currentDateTime = _savedCurrentDateTime; // FIXME bug? currentDateTime does not get properly restored
            D.Log("currentDateTime restored to {0:0.00}.", _currentDateTime);
            // don't wait for the Gui to set GameSpeed. Use the backing field as the Property calls OnGameSpeedChanged()
            _gameSpeed = _playerPrefsMgr.GameSpeedOnLoad; // the speed the clock was running at when saved is not relevant in the following session
            _gameSpeedMultiplier = _gameSpeed.SpeedMultiplier();
            // date that is saved is fine and should be accurate. It gets recalculated from currentDateTime everytime it is used
        }
コード例 #5
0
ファイル: GameTime.cs プロジェクト: Maxii/UnityEntry
 public void PrepareToBeginNewGame() {
     D.Log("GameTime.PrepareToBeginNewGame() called.");
     EnableClock(false);
     _cumTimeInPriorSessions = Constants.ZeroF;
     _timeGameBeganInCurrentSession = Constants.ZeroF;
     _cumTimePaused = Constants.ZeroF;
     _timeCurrentPauseBegan = Constants.ZeroF;
     _gameRealTimeAtLastSync = Constants.ZeroF;
     _currentDateTime = Constants.ZeroF;
     _savedCurrentDateTime = Constants.ZeroF;
     // don't wait for the Gui to set GameSpeed. Use the backing field as the Property calls OnGameSpeedChanged()
     _gameSpeed = _playerPrefsMgr.GameSpeedOnLoad;
     _gameSpeedMultiplier = _gameSpeed.SpeedMultiplier();
     _date = new GameDate(GameDate.PresetDateSelector.Start);
 }