private static void OnStartupApp(object sender, EventArgs e) { string station = ""; bool isWorkoutStation = false; bool isSlowDanceStation = false; if (Simulator.LoadXML(typeof(Bootstrap).Assembly.GetName().Name) is XmlDocument xmlDocument) { if (xmlDocument.GetElementsByTagName("Broadcaster")[0] is XmlElement xmlElement) { if (xmlElement.GetElementsByTagName("Station")[0] is XmlElement stationElement) { station = stationElement.GetAttribute("value"); } if (xmlElement.GetElementsByTagName("IsWorkoutStation")[0] is XmlElement workoutElement) { isWorkoutStation = workoutElement.GetAttribute("value") == "1" ? true : false; } if (xmlElement.GetElementsByTagName("IsSlowDanceStation")[0] is XmlElement danceElement) { isSlowDanceStation = danceElement.GetAttribute("value") == "1" ? true : false; } } } AddStationIfNeeded(station, isWorkoutStation, isSlowDanceStation); Simulator.AddObject(new Common.RepeatingFunctionTask(new Common.GenericDelegate <bool>(InjectOptions))); }
public static void SplitHousehold(EditTownController ths, UIBinInfo from) { try { if (ths == null) { return; } Household household = Household.Find(from.HouseholdId); if (household != null) { IMovingModel model = new GameEntryMovingModelEx(household); if (model != null) { EditTownSplitDialog.Show(model); Simulator.AddObject(new OneShotFunctionWithParams(ths.SplitHouseholdsTask, from)); } } } catch (Exception e) { Common.Exception("SplitHousehold", e); } }
public override bool OnLotPick(ulong id) { try { if (mPlacing) { return(false); } UIBinInfo lotInfo = FindBinInfoForLot(id, MaptagTypes.None); if (lotInfo == null) { return(false); } if (mModel.IsLotLocked(lotInfo.LotId) && !World.IsEditInGameFromWBMode()) { Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(delegate { SimpleMessageDialog.Show(null, Sims3.UI.Responder.Instance.LocalizationModel.LocalizeString("Ui/Tooltip/Maptag:Locked", new object[0x0]), ModalDialog.PauseMode.PauseTask); })); return(false); } OnSelection(lotInfo); return(true); } catch (Exception e) { Common.Exception("OnLotPick", e); return(false); } }
private static void OnAcceptHousehold(WindowBase sender, UIButtonClickEventArgs eventArgs) { try { CASPuck ths = CASPuck.Instance; Sims3.UI.Function f = null; if (!ths.mUiBusy && !ths.mAttemptingToAddSim) { ths.mUiBusy = true; if (f == null) { f = delegate { CASController.Singleton.SetCurrentState(CASState.Summary); if (ths.ShowRequiredItemsDialogTask()) { ths.AcceptHouseholdCallback(); } else { ths.mUiBusy = false; } }; } Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(f)); } eventArgs.Handled = true; } catch (Exception e) { Common.Exception("OnAcceptHousehold", e); } }
public static void RestartTimers() { if (World.IsEditInGameFromWBMode()) { return; } foreach (AlarmTask task in sTasks) { task.Dispose(); } sTasks.Clear(); if (sTimer != null) { sTimer.Stop(); sTimer = null; } switch (Saver.Settings.SaveStyle) { case SaverSpace.Options.SaveStyle.RealTime: if (Saver.Settings.mRealMinutesBetweenSaves > 0) { sTimer = new AutoSave(Saver.Settings.mRealMinutesBetweenSaves); Simulator.AddObject(sTimer); } break; case SaverSpace.Options.SaveStyle.SimTime: if (Saver.Settings.mSimMinutesBetweenSaves > 0) { sTasks.Add(new AlarmTask(Saver.Settings.mSimMinutesBetweenSaves, TimeUnit.Minutes, OnSimTimer, Saver.Settings.mSimMinutesBetweenSaves, TimeUnit.Minutes)); } break; case SaverSpace.Options.SaveStyle.SimHour: foreach (float hour in Saver.Settings.mSimSaveHour) { sTasks.Add(new AlarmTask(hour, DaysOfTheWeek.All, OnSimTimer)); } break; } if ((sTimer == null) && (sTasks.Count == 0)) { SimpleMessageDialog.Show(Common.Localize("Root:MenuName"), Common.Localize("Unset:Prompt")); Saver.Settings.SaveStyle = SaverSpace.Options.SaveStyle.RealTime; Saver.Settings.mRealMinutesBetweenSaves = 30; RestartTimers(); } }
public static ListenerAction OnClean(Event e) { Sim actor = e.Actor as Sim; if (actor != null) { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTThirst.RemoveMakeup), actor)); } return(ListenerAction.Keep); }
public static ListenerAction OnGotBuff(Event e) { Sim actor = e.Actor as Sim; if (actor != null) { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(EnableSparkle.ProcessBuff), actor)); } return(ListenerAction.Keep); }
protected void RouteTruckToLot() { if (mTruck.mRouteToLot != null) { mTruck.mRouteToLot.Destroy(); } mTruck.mRouteToLot = new OneShotFunction(new Sims3.Gameplay.Function(OneShotRouteToLot)); Simulator.AddObject(mTruck.mRouteToLot); }
public static ListenerAction OnClean(Event e) { Sim target = e.Actor as Sim; if (target != null) { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTBiteMark.RemoveMakeup), target)); } return(ListenerAction.Keep); }
private new void OnSelection(UIBinInfo info) { if (((mFrom != null) && (mFrom != info)) && (info.HouseholdId != ulong.MaxValue)) { mModel.CenterCamera(info.LotId); GameEntryMovingModelEx.MergeHouseholds(EditTownController.Instance, mFrom, info); } else { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(WarnCantMergeHouseholds), info)); } }
protected override bool OnPerform() { if (SelectObjectTask.sSelectObjectTask == null) { return(true); } SelectObjectTask.Shutdown(); SelectObjectTask.sSelectObjectTask = new SelectTask(); Simulator.AddObject(SelectObjectTask.sSelectObjectTask); return(false); }
protected override bool OnPerform() { if (PickObjectTask.sPickObjectTask == null) { return(true); } PickObjectTask.Shutdown(); PickObjectTask.sPickObjectTask = new PickTask(); Simulator.AddObject(PickObjectTask.sPickObjectTask); return(false); }
private static ListenerAction OnGotBuff(Event e) { Sim sim = e.Actor as Sim; if (sim != null) { if (sim.IsHuman) { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(ProcessBuff), sim)); } } return(ListenerAction.Keep); }
public static void OnAcceptSim(WindowBase sender, UIButtonClickEventArgs eventArgs) { try { CASPuck ths = CASPuck.Instance; if (!ths.UiBusy) { ths.UiBusy = true; CASExitLoadScreen.DisableQuit = true; // Custom if (CASLogic.Instance.OutfitCategory == OutfitCategories.Career) { CASLogic.Instance.OutfitCategory = OutfitCategories.Everyday; SpeedTrap.Sleep(); } if (Responder.Instance.CASModel.CASMode == CASMode.CreateABot) { Function f = delegate { CASController.Singleton.SetCurrentState(CASState.BotSummary); if (ths.ShowCABRequiredItemsDialogTask()) { // Custom AcceptSimCallback(ths); } else { ths.UiBusy = false; } }; Simulator.AddObject(new OneShotFunctionTask(f)); } else { // Custom AcceptSimCallback(ths); } } eventArgs.Handled = true; } catch (Exception exception) { Common.Exception("OnAcceptHousehold", exception); } }
public static void OnCloseClick(WindowBase sender, UIButtonClickEventArgs eventArgs) { try { CASPuck ths = CASPuck.gSingleton; if (ths == null) { return; } //Common.DebugNotify(delegate { return "UiBusy: " + ths.mUiBusy + Common.NewLine + "LeaveCAS: " + ths.mLeaveCAS; }); //if (!ths.UiBusy && !ths.mLeaveCAS) { ths.UiBusy = true; Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(delegate { string entryKey = (Responder.Instance.CASModel.CASMode == CASMode.Full) ? "Ui/Caption/CAS/ExitDialog:Prompt" : "Ui/Caption/CAS/ExitDialog:AlternatePrompt"; if (TwoButtonDialog.Show(Common.LocalizeEAString(entryKey), Common.LocalizeEAString("Ui/Caption/Global:Yes"), Common.LocalizeEAString("Ui/Caption/Global:No"))) { CASController singleton = CASController.Singleton; singleton.AllowCameraMovement(false); ICASModel cASModel = Responder.Instance.CASModel; while (cASModel.IsProcessing()) { SpeedTrap.Sleep(); } Sims.CASBase.sWasCanceled = true; sender.Enabled = false; cASModel.RequestClearChangeReport(); singleton.SetCurrentState(CASState.None); } else { ths.UiBusy = false; } })); eventArgs.Handled = true; } } catch (Exception e) { Common.Exception("OnCloseClick", e); } }
private static void OnNavButtonClicked(WindowBase sender, UIButtonClickEventArgs args) { try { CASTattoo ths = CASTattoo.gSingleton; if (!ths.AdvancedMode) { Simulator.AddObject(new OneShotFunctionTask(OnNavButtonClickedHelper)); } args.Handled = true; } catch (Exception e) { Common.Exception("OnNavButtonClicked", e); } }
public ObjectGuid AddToSimulatorSID() { if (IsOpenDGSInstalled) { return(Simulator.AddObject(this)); } else { //NonRandom = true; var objectid = new ObjectGuid(NonOpenDGSIDSID); NonOpenDGSIDSID += 0x10; //CurrentTaskID = objectid; return(Simulator.AddObjectWithId(this, objectid)); } }
public void OnWorldLoadFinished() { try { if (sTask == null) { sTask = new PanelTask(); Simulator.AddObject(sTask); } } catch (Exception exception) { Common.Exception("OnWorldLoadFinished", exception); } }
protected static void OnTimer() { try { if (sTimer != null) { sTimer.Destroy(); sTimer = null; } sTimer = new Adjuster(); Simulator.AddObject(sTimer); } catch (Exception exception) { Common.Exception("OnTimer", exception); } }
public static void HideCurrentTooltip() { if (sLastObjectId == sTipObject && sLastObjectId != 0) { RestartAlarm(); } if (sCurrentTip != null) { sCurrentTip.TooltipWindow.Visible = false; // because...EA sCurrentTip.TooltipWindow.ShadeColor = new Color(sCurrentTip.TooltipWindow.ShadeColor.ARGB & 0xffffff); Simulator.AddObject(new TooltipManager.DisposeTooltipTask(sCurrentTip)); KillAlarm(); sCurrentTip = null; sTipObject = 0L; } }
public static int cleanVampFaces(object obj) { try { foreach (KeyValuePair <Sim, bool> pair in thirstySims) { if (thirstySims[pair.Key]) { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTThirst.runClean), pair.Key)); } } } catch (Exception exception) { SimpleMessageDialog.Show("Vampire Tweaker - Uninstalling Wizard", "An error is ocurred when uninstalling. Check notification bar"); StyledNotification.Show(new StyledNotification.Format("Failed the removal of the sim dictionary (thirstySims) \n" + exception, StyledNotification.NotificationStyle.kDebugAlert)); } return(1); }
public static ListenerAction OnGotBuff(Event e) { Sim actor = e.Actor as Sim; if (actor != null) { if (actor.SimDescription.IsHuman || (actor.SimDescription.IsSupernaturalForm)) { if ((lastTriggered == null) || (lastTriggered != actor)) { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTBiteMark.ProcessBuff), actor)); } } else if (bitedSims.ContainsKey(actor)) { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTBiteMark.RemoveMakeup), actor)); } } return(ListenerAction.Keep); }
public static ListenerAction OnGotBuff(Event e) { Sim actor = e.Actor as Sim; if (actor != null) { if (actor.SimDescription.IsVampire) { if ((lastTriggered == null) || (lastTriggered != actor)) { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTThirst.ProcessBuff), actor)); } } else if (thirstySims.ContainsKey(actor)) { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(VTThirst.RemoveMakeup), actor)); } } return(ListenerAction.Keep); }
private static ListenerAction OnGotBuff(Event e) { Sim actor = e.Actor as Sim; if (actor != null) { if (actor.SimDescription.IsWerewolf) { if ((lastTriggered == null) || (lastTriggered != actor)) { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(WolfFeet.ProcessBuff), actor)); } } else if (transformedSims.ContainsKey(actor)) { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(WolfFeet.RemoveMakeup), actor)); transformedSims.Remove(actor); } } return(ListenerAction.Keep); }
public void OnWorldLoadFinished() { Common.kDisableLotMenu = false; Simulator.AddObject(new RegisterCommandsTask()); new Common.DelayedEventListener(EventTypeId.kInventoryObjectAdded, OnNewObject); new Common.DelayedEventListener(EventTypeId.kObjectStateChanged, OnNewObject); // Corrects for an error in SetGraduatedBoardingSchool.Definition AddInteractions when running in CAW if (BoardingSchool.BoardingSchoolData.sBoardingSchoolDataList == null) { BoardingSchool.BoardingSchoolData.sBoardingSchoolDataList = new PairedListDictionary <BoardingSchool.BoardingSchoolTypes, BoardingSchool.BoardingSchoolData>(); StubXMLRow stubRow = new StubXMLRow(); foreach (BoardingSchool.BoardingSchoolTypes types in Enum.GetValues(typeof(BoardingSchool.BoardingSchoolTypes))) { BoardingSchool.BoardingSchoolData.sBoardingSchoolDataList.Add(types, new BoardingSchool.BoardingSchoolData(stubRow)); } } }
public static void OnCreateSimClick(WindowBase sender, UIButtonClickEventArgs eventArgs) { try { CASPuck ths = CASPuck.gSingleton; Sims3.UI.Function f = null; if (ths.mAttemptingToAdd) { if (f == null) { f = delegate { while (ths.mAttemptingToAdd) { SpeedTrap.Sleep(); } // Custom CallCreateSimCallback((CASPuck.ControlIDs)sender.ID); }; } Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(f)); } else { // Custom CallCreateSimCallback((CASPuck.ControlIDs)sender.ID); } ths.HideEditPopupMenu(); ths.HideAddPopupMenu(); eventArgs.Handled = true; } catch (Exception e) { Common.Exception("OnCreateSimClick", e); } }
private static int OnThrowException(object[] paramenters) { Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(new Sims3.UI.Function(ThrowExceptionFunction))); return(0); }
public static void OnMaterialsSkewerGridMouseDown(WindowBase sender, UIMouseEventArgs eventArgs) { Common.StringBuilder msg = new Common.StringBuilder("OnMaterialsSkewerGridMouseDown"); try { CASCompositorController ths = CASCompositorController.sController; if (ths == null) { return; } if ((ths.mCurrentDesignObject == null) || (ths.mMaterialSkewerSelectedPattern == -1)) { msg += "A"; if (sender.Enabled) { eventArgs.Handled = true; } } else if (ths.mCurrentDesignObject.Processing) { msg += "B"; ths.mMaterialToSelect = ((int)sender.ID) - 0x1300a; Audio.StartSound("ui_tertiary_button"); if (sender.Enabled) { eventArgs.Handled = true; } } else if ((sender as Button).Enabled) { msg += "C"; ths.mClickedWin = sender; ths.mMouseClickPos = sender.WindowToScreen(eventArgs.MousePosition); // Must be after mClickedWin is set above int selection = ((int)ths.mClickedWin.ID) - 0x1300a; bool selected = (selection == ths.MaterialSkewerSelectedPattern); ths.MaterialSelect(selection, true); if (eventArgs.MouseKey == MouseKeys.kMouseLeft) { msg += "D"; ths.mPickupScript = Simulator.AddObject(new Sims3.Gameplay.OneShotFunctionTask(ths.StartMaterialDrag, StopWatch.TickStyles.Seconds, CASCompositorController.kPickupDelay)); UIManager.SetCaptureTarget(InputContext.kICMouse, sender); if ((eventArgs.Modifiers & (Modifiers.kModifierMaskShift | Modifiers.kModifierMaskControl)) != Modifiers.kModifierMaskNone) { Common.FunctionTask.Perform(OnProcessRandomizeColor); } } else if (eventArgs.MouseKey == MouseKeys.kMouseRight) { msg += "E"; if ((selected) && ((eventArgs.Modifiers & (Modifiers.kModifierMaskShift | Modifiers.kModifierMaskControl)) != Modifiers.kModifierMaskNone)) { Common.FunctionTask.Perform(OnProcessRandomizeCategory); } else { Common.FunctionTask.Perform(OnProcessRandomizeMaterial); } } msg += "E"; eventArgs.Handled = true; } } catch (Exception e) { Common.Exception(msg, e); } }
public static void ChangeLotType(UIBinInfo info) { Simulator.AddObject(new OneShotFunctionWithParams(new FunctionWithParam(ChangeLotTypeTask), info)); }
public virtual ObjectGuid AddToSimulator() { return(Simulator.AddObject(this)); }