public PrefabType AddPrefs <ValType, PrefabType>(Prefs.PrefsValueBase <ValType> prefs) where PrefabType : InputGuiValueBase <ValType> { var category = this.structs.GetCategory(prefs.GuiHierarchy); var gui = this.creator.GetGui <ValType, PrefabType>(prefs, category); return(gui); }
public PrefabType GetGui <ValType, PrefabType>(Prefs.PrefsValueBase <ValType> prefs, Category category) where PrefabType : InputGuiValueBase <ValType> { var gui = Instantiate(this.canvas.prefabs.GetGuiPrefab <PrefabType>(), category.Content); this.SetGuiListeners(prefs, gui); category.Prefs.Add(prefs, gui); return(gui); }
public virtual void SetGuiListeners(Prefs.PrefsValueBase <ValType> prefs, bool withoutInitialize = true) { this.SetListener(prefs, withoutInitialize); this.OnValueChanged += () => prefs.Set(this.GetValue()); }
private void SetGuiListeners <ValType, PrefabType>(Prefs.PrefsValueBase <ValType> prefs, PrefabType gui) where PrefabType : InputGuiValueBase <ValType> { gui.SetGuiListeners(prefs); prefs.OnValueChanged += () => gui.SetValue(prefs.Value); }