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