private static bool OnEnable(OptionBehaviour opt) { CustomOption customOption = Options.FirstOrDefault(option => option.GameSetting == opt); if (customOption == null) { return(true); } customOption.OnGameOptionCreated(opt); return(false); }
public static bool Prefix(StringOption __instance) { CustomOption option = Options.FirstOrDefault(option => option.GameSetting == __instance); if (option is CustomStringOption str) { str.Increase(); //EssentialsPlugin.Logger.LogInfo($"Option \"{str.Name}\" was \"{str.GetText(str.GetOldValue())}\" now \"{str.GetText()}\""); return(false); } return(true); }
public static bool Prefix(NumberOption __instance) { CustomOption option = Options.FirstOrDefault(option => option.GameSetting == __instance); // Works but may need to change to gameObject.name check if (option is CustomNumberOption number) { number.Decrease(); //EssentialsPlugin.Logger.LogInfo($"Option \"{number.Name}\" was {number.GetOldValue()} now {number.GetValue()}"); return(false); } return(true); }
private static (string, CustomOptionType, object) OptionToData(CustomOption option) { return(option.ID, option.Type, option.GetValue <object>()); }
public Data(CustomOption option) { Options = new[] { OptionToData(option) }; }