public PrefabType AddPrefs <PrefabType>(PrefsBase prefs) where PrefabType : PrefsGuiBase { var category = this.structs.GetCategory(prefs.GuiHierarchy); var gui = this.creator.GetGui <PrefabType>(prefs, category); return(gui); }
protected override void SetListener(PrefsBase prefs, bool withoutInitialize = true) { base.SetListener(prefs, withoutInitialize); this.OnPressedDefaultButton = withoutInitialize == true ? this.OnPressedDefaultButton : delegate { }; this.OnPressedDefaultButton += () => prefs.ResetDefaultValue(); }
public PrefabType GetGui <PrefabType>(PrefsBase prefs, Category category) where PrefabType : PrefsGuiBase { var gui = Instantiate(this.canvas.prefabs.GetGuiPrefab <PrefabType>(), category.Content); category.Prefs.Add(prefs, gui); return(gui); }
public void RemovePrefs(PrefsBase prefs) { var categories = this.structs.Categories; for (var i = 0; i < categories.Count; i++) { var dic = categories[i].Prefs; if (dic.ContainsKey(prefs) == true) { var gui = dic[prefs].gameObject; dic.Remove(prefs); Destroy(gui); return; } } }
/// <summary> /// Remove registered information. /// </summary> /// <param name="prefs">Prefs member for remove.</param> private static void RemovePrefs(PrefsBase prefs) => PrefsGuis?.RemovePrefs(prefs);
/// <summary> /// Register to create each GUI. /// </summary> /// <typeparam name="PrefabType"></typeparam> /// <param name="prefs">Prefs mamber for register.</param> /// <param name="onCreated">Callback action when created GUI.</param> private static void AddPrefs <PrefabType>(PrefsBase prefs, Action <PrefabType> onCreated) where PrefabType : PrefsGuiBase => Creators[prefs.SaveKey] = canvas => onCreated(canvas.AddPrefs <PrefabType>(prefs));
protected virtual void SetListener(PrefsBase prefs, bool withoutInitialize = true) => this.OnValueChanged = withoutInitialize == true ? this.OnValueChanged : delegate { };