Esempio n. 1
0
 // Proxy method for filtering out which buttons to display depending on their string labels.
 static void ToggleableIcon_Proxy(WidgetRow instance, ref bool toggleable, Texture2D tex, string label, SoundDef mouseoverSound = null, string tutorTag = null)
 {
     if (!Dict.ContainsKey(label) || (Dict.ContainsKey(label) && ToggleManager.IsActive(Format(Dict.TryGetValue(label)))))
     {
         instance.ToggleableIcon(ref toggleable, tex, label.Translate(), SoundDefOf.Mouseover_ButtonToggle, null);
     }
 }
Esempio n. 2
0
 // Stops incident from happening if setting is inactive.
 static bool Prefix(ref IncidentWorker __instance, ref bool __result)
 {
     if (!ToggleManager.IsActive(Format(__instance.def)))
     {
         __result = false;
         return(false);
     }
     return(true);
 }
Esempio n. 3
0
        // Replaces the texture of images with empty if the corresponding setting is inactive.
        static bool Prefix(Rect position, ref Texture image)
        {
            if (Current.ProgramState == ProgramState.Entry)
            {
                if (Elements.Contains(image.name))
                {
                    if (!ToggleManager.IsActive(Format(image.name)))
                    {
                        image = Constants.TexEmpty;
                    }
                }
            }

            return(true);
        }
Esempio n. 4
0
        // Checks if alert to be read out is active in settings.
        // If not, the alert is removed from games' available alerts and the list of active alerts. Otherwise readded.
        static void Postfix(ref List <Alert> ___AllAlerts, ref List <Alert> ___activeAlerts)
        {
            foreach (Alert alert in Alerts)
            {
                string label = Format(alert);

                if (SleepingAlerts.ContainsKey(label))
                {
                    if (Find.TickManager.TicksGame - SleepingAlerts[label] < GenDate.TicksPerHour * hourMultiplier)
                    {
                        //___AllAlerts.RemoveAll(x => x.GetType().Name.Equals(label));
                        //___activeAlerts.RemoveAll(x => x.GetType().Name.Equals(label));
                        RemoveAlert(ref ___AllAlerts, ref ___activeAlerts, label);
                    }
                    else
                    {
                        //if (!___AllAlerts.Exists(x => x.GetType().Name.Equals(label)))
                        //    ___AllAlerts.Add((Alert)Activator.CreateInstance(alert.GetType()));
                        //SleepingAlerts.Remove(label);
                        AddAlert(ref ___AllAlerts, ref ___activeAlerts, alert);
                    }
                }
                else if (!ToggleManager.IsActive(label))
                {
                    RemoveAlert(ref ___AllAlerts, ref ___activeAlerts, label);
                    //___AllAlerts.RemoveAll(x => x.GetType().Name.Equals(label));
                    //___activeAlerts.RemoveAll(x => x.GetType().Name.Equals(label));
                }
                else
                {
                    AddAlert(ref ___AllAlerts, ref ___activeAlerts, alert);
                    //if (!___AllAlerts.Exists(x => x.GetType().Name.Equals(label)))
                    //    ___AllAlerts.Add((Alert)Activator.CreateInstance(alert.GetType()));
                }
            }
        }
Esempio n. 5
0
 // Stops the button from being drawn if setting is inactive.
 static bool Prefix(ListableOption __instance) => ToggleManager.IsActive(Format(__instance.label, Current.ProgramState));
Esempio n. 6
0
 // Stops the different overlays, like fallout and fog, from being drawn if setting is inactive.
 static bool Prefix(ref SkyOverlay __instance) =>
 ToggleManager.IsActive(Format(__instance.GetType()));
Esempio n. 7
0
 // Stops the version control readout from being drawn if setting is inactive.
 static bool Prefix() => ToggleManager.IsActive(Format(Label, Current.ProgramState));