Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        protected override void SetListener(PrefsBase prefs, bool withoutInitialize = true)
        {
            base.SetListener(prefs, withoutInitialize);

            this.OnPressedDefaultButton  = withoutInitialize == true ? this.OnPressedDefaultButton : delegate { };
            this.OnPressedDefaultButton += () => prefs.ResetDefaultValue();
        }
Exemplo n.º 3
0
            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);
            }
Exemplo n.º 4
0
        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;
                }
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Remove registered information.
 /// </summary>
 /// <param name="prefs">Prefs member for remove.</param>
 private static void RemovePrefs(PrefsBase prefs)
 => PrefsGuis?.RemovePrefs(prefs);
Exemplo n.º 6
0
 /// <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));
Exemplo n.º 7
0
 protected virtual void SetListener(PrefsBase prefs, bool withoutInitialize = true)
 => this.OnValueChanged = withoutInitialize == true ? this.OnValueChanged : delegate { };