/// <summary> /// Applied after OnKeyDown runs. /// </summary> internal static void Postfix(KButtonEvent e) { if (inGameSettings != null && !e.Consumed && e.TryConsume(inGameSettings. GetKAction())) { POptions.ShowNow(typeof(ToastControlOptions), onClose: (_) => ToastControlPopups.ReloadOptions()); } }
public static void OnLoad() { PUtil.InitLibrary(); PLocalization.Register(); LocString.CreateLocStringKeys(typeof(ToastControlStrings.UI)); POptions.RegisterOptions(typeof(ToastControlOptions)); PUtil.RegisterPatchClass(typeof(ToastControlPopups)); ToastControlPopups.ReloadOptions(); // No default key bind inGameSettings = PAction.Register(ToastControlStrings.ACTION_KEY, ToastControlStrings.ACTION_TITLE); }
public override void OnLoad(Harmony harmony) { base.OnLoad(harmony); PUtil.InitLibrary(); new PLocalization().Register(); LocString.CreateLocStringKeys(typeof(ToastControlStrings.UI)); new POptions().RegisterOptions(this, typeof(ToastControlOptions)); new PPatchManager(harmony).RegisterPatchClass(typeof(ToastControlPopups)); ToastControlPopups.ReloadOptions(); // No default key bind inGameSettings = new PActionManager().CreateAction(ToastControlStrings.ACTION_KEY, ToastControlStrings.ACTION_TITLE); new PVersionCheck().Register(this, new SteamVersionChecker()); }
/// <summary> /// Common transpiled target method for each use of PopFXManager.SpawnFX. /// </summary> private static PopFX SpawnFXShort(PopFXManager instance, Sprite icon, string text, Transform targetTransform, float lifetime, bool track_target, object source) { PopFX popup = null; bool show = true; try { // Parameter count cannot be reduced - in order to conform with Klei method show = ToastControlPopups.ShowPopup(source, text); } catch (Exception e) { // Sometimes this gets executed on a background thread and unhandled exceptions // cause a CTD PUtil.LogException(e); } if (show) { popup = instance.SpawnFX(icon, text, targetTransform, lifetime, track_target); } return(popup); }