public static T CreatePreset <T>(IPresetableType type, string name) where T : Presetable { var preset = (T)Activator.CreateInstance(typeof(T), type, name); AddPreset(preset); return(preset); }
public static IEnumerable <T> GetPresets <T>(IPresetableType type) where T : Presetable { if (!Instance._presets.ContainsKey(typeof(T)) || !Instance._presets[typeof(T)].ContainsKey(type)) { return(new T[] { }); } return(Instance._presets[typeof(T)][type].Values.Cast <T>().ToArray()); }
public static T GetPreset <T>(IPresetableType type, string name) where T : Presetable { if (!Instance._presets.ContainsKey(typeof(T)) || !Instance._presets[typeof(T)].ContainsKey(type) || !Instance._presets[typeof(T)][type].ContainsKey(name)) { return(null); } return((T)Instance._presets[typeof(T)][type][name]); }
public Listing_Preset(IPresetableType type, T selected, T[] fixedPresets, Action onSelect, Action onSave, Action onRevert) { Type = type; Selected = selected; FixedPresets = fixedPresets; OnSelect = onSelect; OnSave = onSave; OnRevert = onRevert; }
public static T GetVoidPreset <T>(IPresetableType type) where T : Presetable => (T)Instance._voidPresets[typeof(T)][type];
public static bool PresetNameExists <T>(IPresetableType type, string name) => Instance._presets.ContainsKey(typeof(T)) && Instance._presets[typeof(T)].ContainsKey(type) && Instance._presets[typeof(T)][type].ContainsKey(name);
public Dialog_PresetName(IPresetableType type, Action <T> onCommit) : this(Lang.Get("Dialog_PresetName.TitleNew")) { _type = type; _onCommit = onCommit; }