Exemple #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="hierarchy">Hierarchy of GUI.</param>
        /// <param name="sortOrders">Sort order for GUI hierarchy from root.</param>
        /// <param name="parent">Parent in GUI.</param>
        public GuiHierarchy(string hierarchy, int[] sortOrders, GuiHierarchy parent = null)
        {
            this.parent     = parent;
            this.sortOrders = (sortOrders == null || sortOrders.Length <= 0) ? new int[] { DefaultSortOrder } : sortOrders;

            this.hierarchy = (hierarchy.TrimEnd(HierarchySeparator) + HierarchySeparator).TrimStart(HierarchySeparator);
        }
Exemple #2
0
 public PrefsFloatSlider(string key, float minValue, float maxValue,
                         float defaultValue = default(float), GuiHierarchy hierarchy = null, string guiLabel = "")
     : this(key, defaultValue, hierarchy, guiLabel)
 {
     this.min = minValue;
     this.max = maxValue;
 }
Exemple #3
0
 public PrefsFloatSlider(string key, float minValue, float maxValue,
                         float defaultValue = default(float), GuiHierarchy hierarchy = null, string guiLabel = null,
                         Action <Prefs.PrefsGuiBaseConnector <float, PrefsGuiNumericSliderDecimal> > onCreatedGui = null)
     : this(key, defaultValue, hierarchy, guiLabel, onCreatedGui)
 {
     this.min = minValue;
     this.max = maxValue;
 }
Exemple #4
0
 public PrefsIntSlider(string key, int minValue, int maxValue,
                       int defaultValue = default(int), GuiHierarchy hierarchy = null, string guiLabel = null,
                       Action <Prefs.PrefsGuiBaseConnector <int, PrefsGuiNumericSliderInteger> > onCreatedGui = null)
     : this(key, defaultValue, hierarchy, guiLabel, onCreatedGui)
 {
     this.min = minValue;
     this.max = maxValue;
 }
Exemple #5
0
            public PrefsBase(string key, GuiHierarchy hierarchy = null, string guiLabel = "")
            {
                this.key       = key;
                this.hierarchy = hierarchy;
                this.guiLabel  = string.IsNullOrEmpty(guiLabel) == true?key.ToLabelable() : guiLabel;

                this.Register();
            }
Exemple #6
0
            public PrefsBase(string key, GuiHierarchy hierarchy = null, string guiLabel = null)
            {
                this.key       = key;
                this.hierarchy = hierarchy;
                this.guiLabel  = guiLabel ?? key.ToLabelable();

                this.Unsave = false;
                this.Regist();
            }
Exemple #7
0
        private List <GuiHierarchy> GetParents()
        {
            var parents = new List <GuiHierarchy>();
            var parent  = this.Parent;

            while (parent != null)
            {
                parents.Insert(0, parent);
                parent = parent.Parent;
            }

            return(parents);
        }
Exemple #8
0
        public PrefsEnum(string key, T defaultValue = default(T), GuiHierarchy hierarchy = null, string guiLabel = "")
            : base(key, 0, hierarchy, guiLabel)
        {
            var type = typeof(T);

            if (type.IsEnum == false)
            {
                throw new ArgumentException(nameof(T) + " must be an enumerated type");
            }

            this.enumType     = type;
            this.defaultValue = Convert.ToInt32(defaultValue);
        }
Exemple #9
0
        public PrefsEnum(string key, T defaultValue = default(T), GuiHierarchy hierarchy = null,
                         string guiLabel            = null, Action <Prefs.PrefsGuiBaseConnector <int, PrefsGuiEnum> > onCreatedGui = null)
            : base(key, 0, hierarchy, guiLabel, onCreatedGui)
        {
            var type = typeof(T);

            if (type.IsEnum == false)
            {
                throw new ArgumentException(nameof(T) + " must be an enumerated type");
            }

            this.enumType     = type;
            this.defaultValue = Convert.ToInt32(defaultValue);
        }
Exemple #10
0
 public PrefsColor(string key, Color defaultValue = default(Color), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Exemple #11
0
 public static void RemoveGuiHierarchy(GuiHierarchy hierarchy)
 => PrefsGuis?.RemoveCategory(hierarchy);
Exemple #12
0
 public PrefsIntSlider(string key, int defaultValue = default(int), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Exemple #13
0
 public PrefsExtends(string key, ValType defaultValue = default(ValType), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
     ;
 }
Exemple #14
0
 public PrefsString(string key, string defaultValue = "", GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Exemple #15
0
 public PrefsFloat(string key, float defaultValue = default(float), GuiHierarchy hierarchy = null,
                   string guiLabel = null, Action <Prefs.PrefsGuiBaseConnector <float, PrefsGuiNumericDecimal> > onCreatedGui = null)
     : base(key, defaultValue, hierarchy, guiLabel, onCreatedGui)
 {
 }
Exemple #16
0
 public PrefsVector3(string key, Vector3 defaultValue = default(Vector3), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Exemple #17
0
 public PrefsButton(string key, UnityAction action, GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, action ?? delegate { }, hierarchy, guiLabel)
 {
 }
 public PrefsGuiConnector(string key, ValType defaultValue = default(ValType), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Exemple #19
0
 public PrefsBool(string key, bool defaultValue = default(bool), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Exemple #20
0
 public PrefsInt(string key, int defaultValue = default(int), GuiHierarchy hierarchy = null,
                 string guiLabel = null, Action <Prefs.PrefsGuiBaseConnector <int, PrefsGuiNumericInteger> > onCreatedGui = null)
     : base(key, defaultValue, hierarchy, guiLabel, onCreatedGui)
 {
 }
Exemple #21
0
 public PrefsString(string key, string defaultValue = "", GuiHierarchy hierarchy = null,
                    string guiLabel = null, Action <Prefs.PrefsGuiBaseConnector <string, PrefsGuiString> > onCreatedGui = null)
     : base(key, defaultValue, hierarchy, guiLabel, onCreatedGui)
 {
 }
Exemple #22
0
 public PrefsRect(string key, Rect defaultValue = default(Rect), GuiHierarchy hierarchy = null,
                  string guiLabel = null, Action <Prefs.PrefsGuiBaseConnector <Rect, PrefsGuiRect> > onCreatedGui = null)
     : base(key, defaultValue, hierarchy, guiLabel, onCreatedGui)
 {
 }
Exemple #23
0
 public PrefsValueBase(string key, ValType defaultValue = default(ValType), GuiHierarchy hierarchy = null, string guiLabel = null)
     : base(key, hierarchy, guiLabel)
 {
     this.value        = defaultValue;
     this.defaultValue = defaultValue;
 }
Exemple #24
0
 public PrefsColorSlider(string key, Color defaultValue = default(Color), GuiHierarchy hierarchy = null,
                         string guiLabel = null, Action <Prefs.PrefsGuiBaseConnector <Color, PrefsGuiColorSlider> > onCreatedGui = null)
     : base(key, defaultValue, hierarchy, guiLabel, onCreatedGui)
 {
 }
Exemple #25
0
 public PrefsGuiConnector(string key, ValType defaultValue = default(ValType),
                          GuiHierarchy hierarchy           = null, string guiLabel = null, Action <PrefsGuiBaseConnector <ValType, GuiType> > onCreatedGui = null)
     : base(key, defaultValue, hierarchy, guiLabel, onCreatedGui)
 {
 }
Exemple #26
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="hierarchy">Hierarchy of GUI.</param>
 /// <param name="sortOrder">Sort order for GUI hierarchy</param>
 /// <param name="parent">Parent in GUI.</param>
 public GuiHierarchy(string hierarchy, int sortOrder = DefaultSortOrder, GuiHierarchy parent = null)
     : this(hierarchy, new int[] { sortOrder }, parent)
 {
     ;
 }
Exemple #27
0
 public PrefsFloatSlider(string key, float defaultValue = default(float), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Exemple #28
0
 public PrefsButton(string key, UnityAction action, GuiHierarchy hierarchy = null,
                    string guiLabel = null, Action <Prefs.PrefsGuiBaseConnector <UnityAction, GuiButton> > onCreatedGui = null)
     : base(key, action ?? delegate { }, hierarchy, guiLabel, onCreatedGui)
 {
 }
Exemple #29
0
 public PrefsVector2Int(string key, Vector2Int defaultValue = default(Vector2Int), GuiHierarchy hierarchy = null,
                        string guiLabel = null, Action <Prefs.PrefsGuiBaseConnector <Vector2Int, PrefsGuiVector2Int> > onCreatedGui = null)
     : base(key, defaultValue, hierarchy, guiLabel, onCreatedGui)
 {
 }
Exemple #30
0
 public PrefsLabel(string key, string text, GuiHierarchy hierarchy = null,
                   string guiLabel = null, Action <Prefs.PrefsGuiBaseConnector <string, PrefsGuiLabel> > onCreatedGui = null)
     : base(key, text ?? "", hierarchy, guiLabel, onCreatedGui)
 {
 }