protected static void Save() { if (sSaveWasRequested) { return; } try { /* * if (!AcceptCancelDialog.Show(Common.LocalizeEAString("Ui/Caption/PromptedSave:PromptEditTown"))) * { * sSaveWasRequested = false; * sSaveWasPerformed = false; * return; * } */ PuckController controller = null; Puck puck = Puck.Instance; if (puck != null) { controller = puck.mPuckController; } if (GameStates.GetInWorldSubState() is LiveModeState) { if (Settings.mSwitchToMapView) { if (!CameraController.IsMapViewModeEnabled()) { Sims3.Gameplay.Core.Camera.ToggleMapView(); SpeedTrap.Sleep(); } } if (Saver.Settings.mPauseOnSave) { GameflowEx.Pause(); } } /*else * { * if (controller != null) * { * controller.ChangeToMode(PuckController.Mode.Live); * } * * GameflowEx.Pause(); * * while ((GameStates.GetInWorldSubState() is BuyModeState) || (GameStates.GetInWorldSubState() is BuildModeState)) * { * SpeedTrap.Sleep(); * } * }*/ Common.FunctionTask.Perform(OnSave); } catch (Exception exception) { Common.Exception("Save", exception); } }
protected override OptionResult Run(GameHitParameters <GameObject> parameters) { if (AcceptCancelDialog.Show(Common.Localize("ResetAll:Prompt"))) { GameflowEx.Pause(); Lot activeLot = null; if (Household.ActiveHousehold != null) { activeLot = Household.ActiveHousehold.LotHome; } Dictionary <IGameObject, bool> objs = new Dictionary <IGameObject, bool>(); try { ProgressDialog.Show(Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/Global:Processing", new object[0x0]), false); List <IGameObject> local = new List <IGameObject>(Sims3.Gameplay.Queries.GetObjects <IGameObject>()); foreach (IGameObject obj in local) { if (IsPartOfActiveLot(obj, activeLot)) { continue; } if (Households.Reset.ResetObject(obj, true)) { objs[obj] = true; } } List <IGameObject> global = new List <IGameObject>(Sims3.Gameplay.Queries.GetGlobalObjects <IGameObject>()); foreach (IGameObject obj in global) { if (IsPartOfActiveLot(obj, activeLot)) { continue; } if (Households.Reset.ResetObject(obj, true)) { objs[obj] = true; } } foreach (Lot lot in LotManager.AllLots) { if (!MasterController.Settings.mResetEverythingOnActive) { if (lot == activeLot) { continue; } } Households.Reset.ResetLot(lot, true); objs[lot] = true; } foreach (Situation situation in new List <Situation>(Situation.sAllSituations)) { if (!MasterController.Settings.mResetEverythingOnActive) { if (situation.Lot == activeLot) { continue; } } // Ignore the Butler situation, as exiting it will end the butler service if (situation is ButlerSituation) { continue; } try { Common.DebugNotify(situation.GetType().ToString()); situation.Exit(); } catch (Exception exception) { Common.Exception(situation.Lot, exception); } } } finally { ProgressDialog.Close(); } SimpleMessageDialog.Show(Name, Common.Localize("ResetAll:Result", false, new object[] { objs.Count })); } return(OptionResult.SuccessClose); }
protected override bool OnPerform() { while ((SimClock.CurrentTicks - mPreviousTime) < (sOneMinute - 1)) { if (mExit) { break; } SpeedTrap.Sleep(); } int overrideSpeed = 0; Sims3.Gameplay.Gameflow.ClockSpeedModel model = Sims3.UI.Responder.Instance.ClockSpeedModel as Sims3.Gameplay.Gameflow.ClockSpeedModel; if (model != null) { if (Settings.mPausingOnCompletion) { if (Sim.ActiveActor != null) { if (Sim.ActiveActor.CurrentInteraction == null) { Settings.mPausingOnCompletion = false; GameflowEx.Pause(); } } } if (Settings.mSkipOnHumanSleep) { bool allSleeping = true; if ((Sim.ActiveActor == null) || (!Sim.ActiveActor.IsHuman)) { allSleeping = false; } else { foreach (Sim sim in Households.AllHumans(Household.ActiveHousehold)) { if (!(sim.CurrentInteraction is ISleeping)) { allSleeping = false; } } } if (allSleeping) { if (model.CurrentGameSpeed != Sims3.SimIFace.Gameflow.GameSpeed.Triple) { Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.SimIFace.Gameflow.GameSpeed.Triple, Sims3.Gameplay.Gameflow.SetGameSpeedContext.Automation); } Settings.mSkippingSleep = true; } else if (Settings.mSkippingSleep) { switch (model.CurrentGameSpeed) { case Sims3.SimIFace.Gameflow.GameSpeed.Triple: case Sims3.SimIFace.Gameflow.GameSpeed.Skip: Sims3.Gameplay.Gameflow.SetGameSpeed(Sims3.SimIFace.Gameflow.GameSpeed.Normal, Sims3.Gameplay.Gameflow.SetGameSpeedContext.Automation); break; } } } Sims3.SimIFace.Gameflow.GameSpeed speed = model.CurrentGameSpeed; switch (speed) { case Sims3.SimIFace.Gameflow.GameSpeed.Pause: Settings.mPausingOnCompletion = false; Settings.mSkippingSleep = false; break; case Sims3.SimIFace.Gameflow.GameSpeed.Normal: Settings.mSkippingSleep = false; break; case Sims3.SimIFace.Gameflow.GameSpeed.Double: if (Settings.mSwitchSpeedOnFast > 0) { overrideSpeed = Settings.mSwitchSpeedOnFast; } Settings.mSkippingSleep = false; Settings.mPausingOnCompletion = false; break; case Sims3.SimIFace.Gameflow.GameSpeed.Triple: if (Settings.mSwitchSpeedOnFast > 0) { overrideSpeed = Settings.mSwitchSpeedOnFast; } Settings.mPausingOnCompletion = false; break; case Sims3.SimIFace.Gameflow.GameSpeed.Skip: if (Settings.mSwitchSpeedOnFast > 0) { overrideSpeed = Settings.mSwitchSpeedOnFast; } Settings.mPausingOnCompletion = false; if (Settings.mPauseOnCompletion) { if (Sim.ActiveActor != null) { if (Sim.ActiveActor.CurrentInteraction != null) { Settings.mPausingOnCompletion = true; } } } break; } } using (TestSpan span = new TestSpan(Relativity.Logger.sLogger, "Simulate")) { if (mExit) { return(false); } int speed = Settings.GetSpeed(SimClock.CurrentTime(), overrideSpeed); PersistedSettings.sRelativeFactor = 0; if (speed != 0) { PersistedSettings.sRelativeFactor = sOneMinute / (float)speed; } if (speed != mPriorValues.mPreviousSpeed) { PriorValues.sFactorChanged = true; } if (PriorValues.sFactorChanged) { PriorValues.sFactorChanged = false; mPriorValues.RevertCommodityGains(); TuningAlterations.Revert(); TuningAlterations.Apply(); } mPriorValues.ApplyCommodityGains(); mPriorValues.mPreviousSpeed = speed; if (speed < 0) { speed = 0; } SimClock.TicksAdvanced += (speed - sOneMinute); mPreviousTime = SimClock.CurrentTicks; } return(true); }