コード例 #1
0
ファイル: RectField.cs プロジェクト: MartaPanda/ARBuilding
        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);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
0
ファイル: StringField.cs プロジェクト: MartaPanda/ARBuilding
        private bool OnValueSubmitted(BoundInputField source, string input)
        {
            if (m_setterMode == Mode.OnSubmit)
            {
                Value = input;
            }

            return(true);
        }
コード例 #5
0
ファイル: Vector4Field.cs プロジェクト: naseba/ARAnatomyGP
        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);
        }
コード例 #6
0
        private bool OnValueSubmitted(BoundInputField source, string input)
        {
            if (m_setterMode == Mode.OnSubmit)
            {
                Value = input;
            }

            Inspector.RefreshDelayed();
            return(true);
        }
コード例 #7
0
        private bool OnSizeInputBeingChanged(BoundInputField source, string input)
        {
            int value;

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

            return(false);
        }
コード例 #8
0
        private bool OnSizeInputBeingChanged(BoundInputField source, string input)
        {
            int value;

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

            return(false);
        }
コード例 #9
0
        protected virtual bool OnValueChanged(BoundInputField source, string input)
        {
            object value;

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

            return(false);
        }
コード例 #10
0
        private bool OnValueChanged(BoundInputField source, string input)
        {
#if UNITY_2017_2_OR_NEWER
            if (isVector3Int)
            {
                int value;
                if (int.TryParse(input, NumberStyles.Integer, RuntimeInspectorUtils.numberFormat, out value))
                {
                    Vector3Int val = (Vector3Int)Value;
                    if (source == inputX)
                    {
                        val.x = value;
                    }
                    else if (source == inputY)
                    {
                        val.y = value;
                    }
                    else
                    {
                        val.z = value;
                    }

                    Value = val;
                    return(true);
                }
            }
            else
#endif
            {
                float value;
                if (float.TryParse(input, NumberStyles.Float, RuntimeInspectorUtils.numberFormat, 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);
        }
コード例 #11
0
        private bool OnValueChanged(BoundInputField source, string input)
        {
            object value;

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

            return(false);
        }
コード例 #12
0
        protected override bool OnValueChanged(BoundInputField source, string input)
        {
            object value;

            if (numberHandler.TryParse(input, out value))
            {
                float fvalue = numberHandler.ConvertToFloat(value);
                if (fvalue >= slider.BackingField.minValue && fvalue <= slider.BackingField.maxValue)
                {
                    Value = value;
                    return(true);
                }
            }

            return(false);
        }
コード例 #13
0
        private bool OnValueChanged(BoundInputField source, string input)
        {
#if UNITY_2017_2_OR_NEWER
            if (isVector2Int)
            {
                int value;
                if (int.TryParse(input, out value))
                {
                    Vector2Int val = (Vector2Int)Value;
                    if (source == inputX)
                    {
                        val.x = value;
                    }
                    else
                    {
                        val.y = value;
                    }

                    Value = val;
                    return(true);
                }
            }
            else
#endif
            {
                float value;
                if (float.TryParse(input, out value))
                {
                    Vector2 val = (Vector2)Value;
                    if (source == inputX)
                    {
                        val.x = value;
                    }
                    else
                    {
                        val.y = value;
                    }

                    Value = val;
                    return(true);
                }
            }

            return(false);
        }
コード例 #14
0
 private bool OnValueSubmitted(BoundInputField source, string input)
 {
     Inspector.RefreshDelayed();
     return(OnValueChanged(source, input));
 }
コード例 #15
0
        private bool OnValueChanged(BoundInputField source, string input)
        {
#if UNITY_2017_2_OR_NEWER
            if (isRectInt)
            {
                int value;
                if (int.TryParse(input, out value))
                {
                    RectInt val = (RectInt)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);
                }
            }
            else
#endif
            {
                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);
        }
コード例 #16
0
        private bool OnSizeChanged(BoundInputField source, string input)
        {
            int value;

            if (int.TryParse(input, NumberStyles.Integer, RuntimeInspectorUtils.numberFormat, 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;
                    }

                    Inspector.RefreshDelayed();
                }

                return(true);
            }

            return(false);
        }
コード例 #17
0
ファイル: StringField.cs プロジェクト: lai3d/All_About_UGUI
 private bool OnValueChanged(BoundInputField source, string input)
 {
     Value = input;
     return(true);
 }