Esempio n. 1
0
        private bool OnRGBAChanged(BoundInputField source, string input)
        {
            byte value;

            if (byte.TryParse(input, out value))
            {
                Color32 color = colorWheel.Color;
                if (source == rInput)
                {
                    color.r = value;
                }
                else if (source == gInput)
                {
                    color.g = value;
                }
                else if (source == bInput)
                {
                    color.b = value;
                }
                else
                {
                    color.a           = value;
                    alphaSlider.Value = value / 255f;
                }

                alphaSlider.Color = color;
                colorWheel.PickColor(color);
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        private bool OnValueChanged(BoundInputField source, string input)
        {
            float value;

            if (float.TryParse(input, out value))
            {
                Rect val = (Rect)Value;
                if (source == inputX)
                {
                    val.x = value;
                }
                else if (source == inputY)
                {
                    val.y = value;
                }
                else if (source == inputW)
                {
                    val.width = value;
                }
                else
                {
                    val.height = value;
                }

                Value = val;
                return(true);
            }

            return(false);
        }
Esempio n. 3
0
        private bool OnValueChanged(BoundInputField source, string input)
        {
            float value;

            if (float.TryParse(input, out value))
            {
                Vector3 val = (Vector3)Value;
                if (source == inputX)
                {
                    val.x = value;
                }
                else if (source == inputY)
                {
                    val.y = value;
                }
                else
                {
                    val.z = value;
                }

                Value = val;
                return(true);
            }

            return(false);
        }
        private bool OnValueSubmitted(BoundInputField source, string input)
        {
            if (m_setterMode == Mode.OnSubmit)
            {
                Value = input;
            }

            return(true);
        }
Esempio n. 5
0
        private bool OnValueChanged(BoundInputField source, string input)
        {
            float value;

            if (float.TryParse(input, out value))
            {
                if (isQuaternion)
                {
                    Quaternion val = (Quaternion)Value;
                    if (source == inputX)
                    {
                        val.x = value;
                    }
                    else if (source == inputY)
                    {
                        val.y = value;
                    }
                    else if (source == inputZ)
                    {
                        val.z = value;
                    }
                    else
                    {
                        val.w = value;
                    }

                    Value = val;
                }
                else
                {
                    Vector4 val = (Vector4)Value;
                    if (source == inputX)
                    {
                        val.x = value;
                    }
                    else if (source == inputY)
                    {
                        val.y = value;
                    }
                    else if (source == inputZ)
                    {
                        val.z = value;
                    }
                    else
                    {
                        val.w = value;
                    }

                    Value = val;
                }

                return(true);
            }

            return(false);
        }
Esempio n. 6
0
        private bool OnSizeInputBeingChanged(BoundInputField source, string input)
        {
            int value;

            if (int.TryParse(input, out value) && value >= 0)
            {
                return(true);
            }

            return(false);
        }
        private bool OnValueChanged(BoundInputField source, string input)
        {
            object value;

            if (parser.TryParse(input, out value))
            {
                Value = value;
                return(true);
            }

            return(false);
        }
Esempio n. 8
0
        private bool OnSizeChanged(BoundInputField source, string input)
        {
            int value;

            if (int.TryParse(input, out value) && value >= 0)
            {
                int currLength = Length;
                if (currLength != value)
                {
                    if (isArray)
                    {
                        Array array    = (Array)Value;
                        Array newArray = Array.CreateInstance(BoundVariableType.GetElementType(), value);
                        if (value > currLength)
                        {
                            if (array != null)
                            {
                                Array.ConstrainedCopy(array, 0, newArray, 0, currLength);
                            }

                            for (int i = currLength; i < value; i++)
                            {
                                object template = GetTemplateElement(array);
                                if (template != null)
                                {
                                    newArray.SetValue(template, i);
                                }
                            }
                        }
                        else
                        {
                            Array.ConstrainedCopy(array, 0, newArray, 0, value);
                        }

                        Value = newArray;
                    }
                    else
                    {
                        IList list        = (IList)Value;
                        int   deltaLength = value - currLength;
                        if (deltaLength > 0)
                        {
                            if (list == null)
                            {
                                list = (IList)Activator.CreateInstance(typeof(List <>).MakeGenericType(BoundVariableType.GetGenericArguments()[0]));
                            }

                            for (int i = 0; i < deltaLength; i++)
                            {
                                list.Add(GetTemplateElement(list));
                            }
                        }
                        else
                        {
                            for (int i = 0; i > deltaLength; i--)
                            {
                                list.RemoveAt(list.Count - 1);
                            }
                        }

                        Value = list;
                    }

                    Refresh();
                }

                return(true);
            }

            return(false);
        }