Example #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);
        }
Example #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;
 }
Example #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;
 }
Example #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;
 }
Example #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();
            }
Example #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();
            }
Example #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);
        }
Example #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);
        }
Example #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);
        }
Example #10
0
 public PrefsColor(string key, Color defaultValue = default(Color), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Example #11
0
 public static void RemoveGuiHierarchy(GuiHierarchy hierarchy)
 => PrefsGuis?.RemoveCategory(hierarchy);
Example #12
0
 public PrefsIntSlider(string key, int defaultValue = default(int), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Example #13
0
 public PrefsExtends(string key, ValType defaultValue = default(ValType), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
     ;
 }
Example #14
0
 public PrefsString(string key, string defaultValue = "", GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Example #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)
 {
 }
Example #16
0
 public PrefsVector3(string key, Vector3 defaultValue = default(Vector3), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Example #17
0
 public PrefsButton(string key, UnityAction action, GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, action ?? delegate { }, hierarchy, guiLabel)
 {
 }
Example #18
0
 public PrefsGuiConnector(string key, ValType defaultValue = default(ValType), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Example #19
0
 public PrefsBool(string key, bool defaultValue = default(bool), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Example #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)
 {
 }
Example #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)
 {
 }
Example #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)
 {
 }
Example #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;
 }
Example #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)
 {
 }
Example #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)
 {
 }
Example #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)
 {
     ;
 }
Example #27
0
 public PrefsFloatSlider(string key, float defaultValue = default(float), GuiHierarchy hierarchy = null, string guiLabel = "")
     : base(key, defaultValue, hierarchy, guiLabel)
 {
 }
Example #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)
 {
 }
Example #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)
 {
 }
Example #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)
 {
 }