Example #1
0
        public static IIgniteGUIGroup AddInputFieldWithButton(this IIgniteGUIGroup group, string buttonName, Action <string> onButtonClick, Action <string> onValueChanged = null, Action <string> onEndEdit = null, string initialValue = null, string placeHolder = null, InputField.CharacterValidation characterValidation = InputField.CharacterValidation.None, bool readOnly = false, float?width = null)
        {
            var inputField = IgniteInputField.Create(onValueChanged, onEndEdit, initialValue, placeHolder, characterValidation, readOnly, width);
            var button     = IgniteButton.Create(buttonName, () => onButtonClick(inputField.Text));

            return(group.Add(IgniteHorizontalGroup.Create().Add(inputField).Add(button) as IgniteHorizontalGroup));
        }
        public static IIgniteGUIGroup AddVector2Field(this IIgniteGUIGroup group, Action <Vector2> onValueChanged = null, Action <Vector2> onEndEdit = null, Vector2?initialValue = null)
        {
            Vector2 vector2         = initialValue ?? Vector2.zero;
            var     horizontalGroup = IgniteHorizontalGroup.Create();

            horizontalGroup.AddLabel("x").AddInputField(x =>
            {
                float result;
                if (float.TryParse(x, out result))
                {
                    vector2.x = result;
                    onValueChanged?.Invoke(vector2);
                }
            }, x => onEndEdit?.Invoke(vector2), initialValue: vector2.x.ToString(), placeHolder: "x", width: 100);

            horizontalGroup.AddLabel("y").AddInputField(y =>
            {
                float result;
                if (float.TryParse(y, out result))
                {
                    vector2.y = result;
                    onValueChanged?.Invoke(vector2);
                }
            }, y => onEndEdit?.Invoke(vector2), initialValue: vector2.y.ToString(), placeHolder: "y", width: 100);

            return(group.Add(horizontalGroup));
        }
Example #3
0
        // operable monitoring slider, label
        public static IIgniteGUIGroup AddOperableMonitoringSlider(this IIgniteGUIGroup group, Func <float> monitor, Action <float> onValueChanged, string label, float minValue = 0f, float maxValue = 1f)
        {
            var valueChangeEvent = new IgniteSlider.ValueChangeEvent();
            var slider           = IgniteSlider.Create(onValueChanged, minValue, maxValue, valueChangeEvent: valueChangeEvent);

            slider.StartCoroutine(MonitoringCoroutine(valueChangeEvent, monitor));
            return(group.Add(IgniteHorizontalGroup.Create().Add(slider).AddLabel(label) as IgniteHorizontalGroup));
        }
Example #4
0
        // label, monitoring slider
        public static IIgniteGUIGroup AddMonitoringSlider(this IIgniteGUIGroup group, string label, Func <float> monitor, float minValue, float maxValue)
        {
            var valueChangeEvent = new IgniteSlider.ValueChangeEvent();
            var slider           = IgniteSlider.Create(v => { }, minValue, maxValue, valueChangeEvent: valueChangeEvent);

            slider.StartCoroutine(MonitoringCoroutine(valueChangeEvent, monitor));
            return(group.Add(IgniteHorizontalGroup.Create().AddLabel(label).Add(slider) as IgniteHorizontalGroup));
        }
Example #5
0
        public static IIgniteGUIGroup AddToggleWithButton(this IIgniteGUIGroup group, string buttonName, Action <bool> onClick, Action <bool> onValueChanged = null, bool defaultValue = true)
        {
            var toggle = IgniteToggle.Create(onValueChanged ?? delegate { }, defaultValue);

            var horizontalGroup = IgniteHorizontalGroup.Create().Add(toggle).AddButton(buttonName, () => onClick(toggle.IsOn)) as IgniteHorizontalGroup;

            return(group.Add(horizontalGroup));
        }
        public static IIgniteGUIGroup AddHorizontalGroup(this IIgniteGUIGroup group, params IIgniteGUIElement[] elements)
        {
            var horizontal = IgniteHorizontalGroup.Create();

            foreach (var e in elements)
            {
                horizontal.Add(e);
            }

            return(group.Add(horizontal));
        }
Example #7
0
 public static IIgniteGUIGroup AddInputField(this IIgniteGUIGroup group, string label, Action <string> onValueChanged = null, Action <string> onEndEdit = null, string initialValue = null, string placeHolder = null, InputField.CharacterValidation characterValidation = InputField.CharacterValidation.None, bool readOnly = false, float?width = null)
 {
     return(group.Add(IgniteHorizontalGroup.Create().AddLabel(label).AddInputField(onValueChanged, onEndEdit, initialValue, placeHolder, characterValidation, readOnly, width) as IgniteHorizontalGroup));
 }
Example #8
0
 // slider, label
 public static IIgniteGUIGroup AddSlider(this IIgniteGUIGroup group, Action <float> onValueChanged, string label, float minValue = 0f, float maxValue = 1f, bool wholeNumbers = false, UnityEvent <float> valueChangeEvent = null, float initialValue = 0f)
 {
     return(group.Add(IgniteHorizontalGroup.Create().Add(IgniteSlider.Create(onValueChanged, minValue, maxValue, wholeNumbers, valueChangeEvent, initialValue)).AddLabel(label) as IgniteHorizontalGroup));
 }
Example #9
0
 public static IIgniteGUIGroup AddToggle(this IIgniteGUIGroup group, string label, Action <bool> onValueChanged, bool defaultValue = true)
 {
     return(group.Add(IgniteHorizontalGroup.Create().AddToggle(onValueChanged, defaultValue).AddLabel(label) as IgniteHorizontalGroup));
 }
 public static IIgniteGUIGroup AddButton(this IIgniteGUIGroup group, string label, string buttonName, Action onClick)
 {
     return(group.Add(IgniteHorizontalGroup.Create().AddButton(buttonName, onClick).AddLabel(label) as IgniteHorizontalGroup));
 }