Ejemplo n.º 1
0
        /// <summary>
        /// Allows each attribute item to render thier own GUI
        /// </summary>
        /// <param name="rTarget"></param>
        /// <returns></returns>
        public override bool OnInspectorGUI(BasicAttributes rTarget)
        {
            bool lIsDirty = base.OnInspectorGUI(rTarget);

            if (EditorHelper.IntField("Value", "Value of the Attribute", Value, rTarget))
            {
                lIsDirty = true;
                Value    = EditorHelper.FieldIntValue;
            }

            return(lIsDirty);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Allows each attribute item to render thier own GUI
        /// </summary>
        /// <param name="rTarget"></param>
        /// <returns></returns>
        public override bool OnInspectorGUI(BasicAttributes rTarget)
        {
            bool lIsDirty = base.OnInspectorGUI(rTarget);

            if (EditorHelper.Vector3Field("Value", "Value of the Attribute", Value.eulerAngles, rTarget))
            {
                lIsDirty = true;
                Value    = Quaternion.Euler(EditorHelper.FieldVector3Value);
            }

            return(lIsDirty);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Allows each attribute item to render thier own GUI
        /// </summary>
        /// <param name="rTarget"></param>
        /// <returns></returns>
        public override bool OnInspectorGUI(BasicAttributes rTarget)
        {
            bool lIsDirty = base.OnInspectorGUI(rTarget);

            if (EditorHelper.FloatField("Value", "Value of the Attribute", Value, rTarget))
            {
                lIsDirty = true;
                Value    = EditorHelper.FieldFloatValue;
            }

            // Limits
            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.LabelField(new GUIContent("Min/Max", "Min and max limits to the float."), GUILayout.Width(EditorGUIUtility.labelWidth - 4.5f));

            string lText = (MinValue == float.MinValue ? "" : MinValue.ToString("f3"));

            if (EditorHelper.TextField("", "", lText, rTarget, 20f))
            {
                float lValue = 0f;
                if (EditorHelper.FieldStringValue.Length == 0)
                {
                    lIsDirty = true;
                    MinValue = float.MinValue;
                }
                if (float.TryParse(EditorHelper.FieldStringValue, out lValue))
                {
                    lIsDirty = true;
                    MinValue = lValue;
                }
            }

            lText = (MaxValue == float.MaxValue ? "" : MaxValue.ToString("f3"));
            if (EditorHelper.TextField("", "", lText, rTarget, 20f))
            {
                float lValue = 0f;
                if (EditorHelper.FieldStringValue.Length == 0)
                {
                    lIsDirty = true;
                    MaxValue = float.MaxValue;
                }
                if (float.TryParse(EditorHelper.FieldStringValue, out lValue))
                {
                    lIsDirty = true;
                    MaxValue = lValue;
                }
            }

            EditorGUILayout.EndHorizontal();

            return(lIsDirty);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Allows each attribute item to render thier own GUI
        /// </summary>
        /// <param name="rTarget"></param>
        /// <returns></returns>
        public override bool OnInspectorGUI(BasicAttributes rTarget)
        {
            bool lIsDirty = base.OnInspectorGUI(rTarget);

            bool lNewValue = EditorGUILayout.Toggle("Value", Value);

            if (lNewValue != Value)
            {
                lIsDirty = true;
                Value    = lNewValue;
            }

            return(lIsDirty);
        }
        /// <summary>
        /// Allows each attribute item to render thier own GUI
        /// </summary>
        /// <param name="rTarget"></param>
        /// <returns></returns>
        public override bool OnInspectorGUI(BasicAttributes rTarget)
        {
            bool lIsDirty = base.OnInspectorGUI(rTarget);

            Vector4 lNewValue = EditorGUILayout.Vector4Field(new GUIContent("Value", "Value of the Attribute"), Value);

            if (lNewValue != Value)
            {
                lIsDirty = true;
                Value    = lNewValue;
            }

            return(lIsDirty);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Allows each attribute item to render thier own GUI
        /// </summary>
        /// <param name="rTarget"></param>
        /// <returns></returns>
        public virtual bool OnInspectorGUI(BasicAttributes rTarget)
        {
            bool lIsDirty = false;

            if (EditorHelper.TextField("Name", "Name of the attribute. Used to retrieve the value as well.", ID, rTarget))
            {
                if (!rTarget.AttributeExists(EditorHelper.FieldStringValue))
                {
                    lIsDirty = true;
                    rTarget.RenameAttribute(ID, EditorHelper.FieldStringValue);
                }
            }

            return(lIsDirty);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Allows each attribute item to render thier own GUI
        /// </summary>
        /// <param name="rTarget"></param>
        /// <returns></returns>
        public override bool OnInspectorGUI(BasicAttributes rTarget)
        {
            bool lIsDirty = false;

            EditorHelper.DrawInspectorDescription("GameObjects are saved as paths. If you change the name of the GameObject, reset this value to update the path.", MessageType.None);

            if (EditorHelper.TextField("Name", "Name of the attribute. Used to retrieve the value as well.", ID, rTarget))
            {
                if (!rTarget.AttributeExists(EditorHelper.FieldStringValue))
                {
                    lIsDirty = true;
                    rTarget.RenameAttribute(ID, EditorHelper.FieldStringValue);
                }
            }

            if (EditorHelper.ObjectField <GameObject>("Value", "Value of the Attribute", Value, rTarget))
            {
                lIsDirty = true;
                Value    = EditorHelper.FieldObjectValue as GameObject;
            }

            return(lIsDirty);
        }