public static void UpdateMagicMotiveBar(SimDisplay ths, SimInfo info) { if (((info != null) && (info.OccultInfo != null)) && (IsOccult(info))) { ths.mMagicMotiveBarWindow.Visible = true; OnMotivesChanged(ths, info); } else { ths.mMagicMotiveBarWindow.Visible = false; } }
protected static void OnUpdateMagicBar() { SimDisplay display = SimDisplay.Instance; if (display == null) { return; } if (display.mHudModel == null) { return; } SimInfo currentSimInfo = display.mHudModel.GetCurrentSimInfo(); if (currentSimInfo == null) { return; } SimDisplayEx.UpdateMagicMotiveBar(display, currentSimInfo); }
private static void OnMotivesChanged(SimDisplay ths, SimInfo info) { if ((info != null) && ths.mMagicMotiveBarWindow.Visible) { Sim actor = Sim.ActiveActor; if (actor == null) return; float leftExtent = -1; float rightExtent = 0; bool dual = false; if (actor.Motives != null) { OccultTypes selection; rightExtent = GetMagicLevel(actor, OccultTypes.None, out selection); if (selection != OccultTypes.None) { dual = true; OccultTypes selection2; float value = GetMagicLevel(actor, selection, out selection2); if (selection2 != OccultTypes.None) { leftExtent = rightExtent; rightExtent = value; } else { dual = false; } } } Rect area = ths.mMagicMotiveSizeControlWin.Area; if (sMagicMotiveSizeControlLeft == -1) { sMagicMotiveSizeControlLeft = area.TopLeft.x; } float leftFactor = 0; float rightFactor = (rightExtent + 100f) / 200f; if (dual) { leftFactor = (100 - leftExtent) / 400f; rightFactor /= 2f; rightFactor += 0.5f; } if (Common.kDebugging) { //Common.DebugNotify("Left: " + leftExtent + "\nRight: " + rightExtent + "\nDual: " + dual + "\nLeftFactor: " + leftFactor + "\nRightFactor: " + rightFactor); } area.Set(sMagicMotiveSizeControlLeft + (leftFactor * ths.mMagicMotiveSizeReferenceWin.Area.Width), area.TopLeft.y, sMagicMotiveSizeControlLeft + (rightFactor * ths.mMagicMotiveSizeReferenceWin.Area.Width), area.BottomRight.y); ths.mMagicMotiveSizeControlWin.Area = area; if (ths.mFlashMagicMotiveBar) { ths.mMagicMotiveChangeWindow.Visible = true; Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(ths.OnMagicMotiveChangeFinish, StopWatch.TickStyles.Seconds, 3f)); ths.mFlashMagicMotiveBar = false; } } }
public void OnTemperatureWaveChangedProxy(SimDisplay.WaveTypes waveType) { try { if (TemperatureWaveChanged != null) { TemperatureWaveChanged(waveType); } } catch (Exception e) { Common.Exception("OnTemperatureWaveChangedProxy", e); } }
protected static void LunarUpdate(bool change) { HudModel model = Sims3.UI.Responder.Instance.HudModel as HudModel; LunarCycleManager.LunarPhase[] choices = null; uint result; OptionsModel.GetOptionSetting("EnableLunarPhase", out result); if (result == 0x0) { choices = GetCycle(); if (change) { Overwatch.Settings.mCurrentPhaseIndex++; } if (Overwatch.Settings.mCurrentPhaseIndex >= choices.Length) { Overwatch.Settings.mCurrentPhaseIndex = 0; } World.ForceLunarPhase((int)choices[Overwatch.Settings.mCurrentPhaseIndex]); } LunarCycleManager.LunarPhase phase = (LunarCycleManager.LunarPhase)World.GetLunarPhase(); if (phase != LunarCycleManager.LunarPhase.kFullMoon) { if ((LunarCycleManager.sFullMoonZombies == null) || (LunarCycleManager.sFullMoonZombies.Count == 0)) { foreach (Sim sim in LotManager.Actors) { if (sim.LotHome != null) { continue; } if (sim.BuffManager == null) { continue; } sim.BuffManager.RemoveElement(BuffNames.Zombie); } } OnDewolf(false); } else { new Common.AlarmTask(Common.AlarmTask.TimeTo(World.GetSunriseTime()), TimeUnit.Hours, OnDewolf); } EventTracker.SendEvent(new MoonRiseEvent((uint)World.GetLunarPhase())); if (model.LunarUpdate != null) { model.LunarUpdate((uint)World.GetLunarPhase()); } if (Overwatch.Settings.mDisableFullMoonLighting) { if (LunarCycleManager.mLunarEffectsAlarm != AlarmHandle.kInvalidHandle) { AlarmManager.Global.RemoveAlarm(LunarCycleManager.mLunarEffectsAlarm); LunarCycleManager.mLunarEffectsAlarm = AlarmHandle.kInvalidHandle; } } foreach (MoonDial dial in Sims3.Gameplay.Queries.GetObjects <MoonDial>()) { try { if (dial.mLunarFXLookUp.Length > Overwatch.Settings.mCurrentPhaseIndex) { dial.StartLunarFX(dial.mLunarFXLookUp[Overwatch.Settings.mCurrentPhaseIndex]); } } catch { } } if (choices != null) { SimDisplay display = SimDisplay.Instance; if (display != null) { int numDaysUntilFullMoon = 0; int index = Overwatch.Settings.mCurrentPhaseIndex; while ((choices[index] != LunarCycleManager.LunarPhase.kFullMoon) && (numDaysUntilFullMoon < choices.Length)) { numDaysUntilFullMoon++; index++; if (index >= choices.Length) { index = 0; } } if (display.mLunarCycleIcon != null) { string entryKey = "UI/LunarCycle:MoonString" + ((uint)World.GetLunarPhase() + 0x1); display.mLunarCycleIcon.TooltipText = Common.LocalizeEAString(entryKey); if (numDaysUntilFullMoon > 0x0) { display.mLunarCycleIcon.TooltipText = display.mLunarCycleIcon.TooltipText + "\n"; display.mLunarCycleIcon.TooltipText = display.mLunarCycleIcon.TooltipText + Common.LocalizeEAString(false, "UI/LunarCycle:NextFullMoon", new object[] { numDaysUntilFullMoon }); } } } } }
private static void OnMotivesChanged(SimDisplay ths, SimInfo info) { if ((info != null) && ths.mMagicMotiveBarWindow.Visible) { Sim actor = Sim.ActiveActor; if (actor == null) { return; } float leftExtent = -1; float rightExtent = 0; bool dual = false; if (actor.Motives != null) { OccultTypes selection; rightExtent = GetMagicLevel(actor, OccultTypes.None, out selection); if (selection != OccultTypes.None) { dual = true; OccultTypes selection2; float value = GetMagicLevel(actor, selection, out selection2); if (selection2 != OccultTypes.None) { leftExtent = rightExtent; rightExtent = value; } else { dual = false; } } } Rect area = ths.mMagicMotiveSizeControlWin.Area; if (sMagicMotiveSizeControlLeft == -1) { sMagicMotiveSizeControlLeft = area.TopLeft.x; } float leftFactor = 0; float rightFactor = (rightExtent + 100f) / 200f; if (dual) { leftFactor = (100 - leftExtent) / 400f; rightFactor /= 2f; rightFactor += 0.5f; } if (Common.kDebugging) { //Common.DebugNotify("Left: " + leftExtent + "\nRight: " + rightExtent + "\nDual: " + dual + "\nLeftFactor: " + leftFactor + "\nRightFactor: " + rightFactor); } area.Set(sMagicMotiveSizeControlLeft + (leftFactor * ths.mMagicMotiveSizeReferenceWin.Area.Width), area.TopLeft.y, sMagicMotiveSizeControlLeft + (rightFactor * ths.mMagicMotiveSizeReferenceWin.Area.Width), area.BottomRight.y); ths.mMagicMotiveSizeControlWin.Area = area; if (ths.mFlashMagicMotiveBar) { ths.mMagicMotiveChangeWindow.Visible = true; Simulator.AddObject(new Sims3.UI.OneShotFunctionTask(ths.OnMagicMotiveChangeFinish, StopWatch.TickStyles.Seconds, 3f)); ths.mFlashMagicMotiveBar = false; } } }