Beispiel #1
0
        private void ShowDeviceList()
        {
            EditorGUI.BeginChangeCheck();

            if (string.IsNullOrEmpty(m_ipAddress))
            {
                m_ipAddress = "Type ID Address";
            }

            var address = EditorGUI.DelayedTextFieldDropDown(
                GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.textFieldDropDownText), new GUIContent(""),
                m_ipAddress, m_ipHistory);


            if (!string.IsNullOrEmpty(address) && VerifyIPAddress(address))
            {
                m_ipAddress = address;
            }

            if (EditorGUI.EndChangeCheck())
            {
                UpdateRemoteMachineHistory();
            }
        }
Beispiel #2
0
        private void DrawConditionsElement(Rect rect, int index, bool selected, bool focused)
        {
            SerializedProperty    arrayElementAtIndex = this.m_Conditions.GetArrayElementAtIndex(index);
            AnimatorConditionMode intValue            = (AnimatorConditionMode)arrayElementAtIndex.FindPropertyRelative("m_ConditionMode").intValue;
            int  num      = 3;
            Rect rect2    = new Rect(rect.x, rect.y + 2f, rect.width, rect.height - 5f);
            Rect position = rect2;

            position.xMax -= (rect2.width / 2f) + num;
            Rect rect4 = rect2;

            rect4.xMin += (rect2.width / 2f) + num;
            Rect rect5 = rect4;

            rect5.xMax -= (rect4.width / 2f) + num;
            Rect rect6 = rect4;

            rect6.xMin += (rect4.width / 2f) + num;
            string        stringValue = arrayElementAtIndex.FindPropertyRelative("m_ConditionEvent").stringValue;
            int           num2        = (this.m_Controller == null) ? -1 : this.m_Controller.IndexOfParameter(stringValue);
            bool          flag        = false;
            List <string> list        = new List <string>();

            UnityEngine.AnimatorControllerParameter[] parameters = null;
            if (this.m_Controller != null)
            {
                parameters = this.m_Controller.parameters;
                for (int i = 0; i < parameters.Length; i++)
                {
                    list.Add(parameters[i].name);
                }
            }
            string name = EditorGUI.DelayedTextFieldDropDown(position, stringValue, list.ToArray());

            if (stringValue != name)
            {
                num2 = this.m_Controller.IndexOfParameter(name);
                arrayElementAtIndex.FindPropertyRelative("m_ConditionEvent").stringValue = name;
                intValue = AnimatorConditionMode.Greater;
                arrayElementAtIndex.FindPropertyRelative("m_ConditionMode").intValue = (int)intValue;
                flag = true;
            }
            UnityEngine.AnimatorControllerParameterType type = (num2 == -1) ? ((UnityEngine.AnimatorControllerParameterType)(-1)) : parameters[num2].type;
            if ((num2 != -1) && ((type == UnityEngine.AnimatorControllerParameterType.Float) || (type == UnityEngine.AnimatorControllerParameterType.Int)))
            {
                List <AnimatorConditionMode> list2 = (type != UnityEngine.AnimatorControllerParameterType.Float) ? m_intModes : m_floatModes;
                string[] displayedOptions          = new string[list2.Count];
                for (int j = 0; j < displayedOptions.Length; j++)
                {
                    displayedOptions[j] = list2[j].ToString();
                }
                int selectedIndex = -1;
                for (int k = 0; k < displayedOptions.Length; k++)
                {
                    if (intValue.ToString() == displayedOptions[k])
                    {
                        selectedIndex = k;
                    }
                }
                if (selectedIndex == -1)
                {
                    Vector2 vector = GUI.skin.label.CalcSize(s_Styles.errorIcon);
                    Rect    rect7  = rect5;
                    rect7.xMax  = rect7.xMin + vector.x;
                    rect5.xMin += vector.x;
                    GUI.Label(rect7, s_Styles.errorIcon);
                }
                EditorGUI.BeginChangeCheck();
                selectedIndex = EditorGUI.Popup(rect5, selectedIndex, displayedOptions);
                if (EditorGUI.EndChangeCheck() || flag)
                {
                    arrayElementAtIndex.FindPropertyRelative("m_ConditionMode").intValue = list2[selectedIndex];
                }
                EditorGUI.BeginChangeCheck();
                float floatValue = arrayElementAtIndex.FindPropertyRelative("m_EventTreshold").floatValue;
                if (type == UnityEngine.AnimatorControllerParameterType.Float)
                {
                    floatValue = EditorGUI.FloatField(rect6, floatValue);
                }
                else
                {
                    floatValue = EditorGUI.IntField(rect6, Mathf.FloorToInt(floatValue));
                }
                if (EditorGUI.EndChangeCheck() || flag)
                {
                    arrayElementAtIndex.FindPropertyRelative("m_EventTreshold").floatValue = floatValue;
                }
            }
            else if ((num2 != -1) && (type == UnityEngine.AnimatorControllerParameterType.Bool))
            {
                string[] strArray2 = new string[] { "true", "false" };
                int      num8      = (intValue != AnimatorConditionMode.IfNot) ? 0 : 1;
                EditorGUI.BeginChangeCheck();
                num8 = EditorGUI.Popup(rect4, num8, strArray2);
                if (EditorGUI.EndChangeCheck() || flag)
                {
                    arrayElementAtIndex.FindPropertyRelative("m_ConditionMode").intValue = (num8 != 0) ? 2 : 1;
                }
            }
            else if (type == UnityEngine.AnimatorControllerParameterType.Trigger)
            {
                if (flag)
                {
                    arrayElementAtIndex.FindPropertyRelative("m_ConditionMode").intValue = 1;
                }
            }
            else
            {
                EditorGUI.LabelField(rect4, "Parameter does not exist in Controller");
            }
        }
        private void DrawConditionsElement(Rect rect, int index, bool selected, bool focused)
        {
            SerializedProperty    arrayElementAtIndex   = this.m_Conditions.GetArrayElementAtIndex(index);
            AnimatorConditionMode animatorConditionMode = (AnimatorConditionMode)arrayElementAtIndex.FindPropertyRelative("m_ConditionMode").intValue;
            int  num      = 3;
            Rect rect2    = new Rect(rect.x, rect.y + 2f, rect.width, rect.height - 5f);
            Rect position = rect2;

            position.xMax -= rect2.width / 2f + (float)num;
            Rect rect3 = rect2;

            rect3.xMin += rect2.width / 2f + (float)num;
            Rect rect4 = rect3;

            rect4.xMax -= rect3.width / 2f + (float)num;
            Rect position2 = rect3;

            position2.xMin += rect3.width / 2f + (float)num;
            string        stringValue = arrayElementAtIndex.FindPropertyRelative("m_ConditionEvent").stringValue;
            int           num2        = (!this.m_Controller) ? -1 : this.m_Controller.IndexOfParameter(stringValue);
            bool          flag        = false;
            List <string> list        = new List <string>();

            UnityEngine.AnimatorControllerParameter[] array = null;
            if (this.m_Controller)
            {
                array = this.m_Controller.parameters;
                for (int i = 0; i < array.Length; i++)
                {
                    list.Add(array[i].name);
                }
            }
            string text = EditorGUI.DelayedTextFieldDropDown(position, stringValue, list.ToArray());

            if (stringValue != text)
            {
                num2 = this.m_Controller.IndexOfParameter(text);
                arrayElementAtIndex.FindPropertyRelative("m_ConditionEvent").stringValue = text;
                animatorConditionMode = AnimatorConditionMode.Greater;
                arrayElementAtIndex.FindPropertyRelative("m_ConditionMode").intValue = (int)animatorConditionMode;
                flag = true;
            }
            UnityEngine.AnimatorControllerParameterType animatorControllerParameterType = (num2 == -1) ? ((UnityEngine.AnimatorControllerParameterType)(-1)) : array[num2].type;
            if (num2 != -1 && (animatorControllerParameterType == UnityEngine.AnimatorControllerParameterType.Float || animatorControllerParameterType == UnityEngine.AnimatorControllerParameterType.Int))
            {
                List <AnimatorConditionMode> list2 = (animatorControllerParameterType != UnityEngine.AnimatorControllerParameterType.Float) ? AnimatorTransitionInspectorBase.m_intModes : AnimatorTransitionInspectorBase.m_floatModes;
                string[] array2 = new string[list2.Count];
                for (int j = 0; j < array2.Length; j++)
                {
                    array2[j] = list2[j].ToString();
                }
                int num3 = -1;
                for (int k = 0; k < array2.Length; k++)
                {
                    if (animatorConditionMode.ToString() == array2[k])
                    {
                        num3 = k;
                    }
                }
                if (num3 == -1)
                {
                    Vector2 vector    = GUI.skin.label.CalcSize(AnimatorTransitionInspectorBase.s_Styles.errorIcon);
                    Rect    position3 = rect4;
                    position3.xMax = position3.xMin + vector.x;
                    rect4.xMin    += vector.x;
                    GUI.Label(position3, AnimatorTransitionInspectorBase.s_Styles.errorIcon);
                }
                EditorGUI.BeginChangeCheck();
                num3 = EditorGUI.Popup(rect4, num3, array2);
                if (EditorGUI.EndChangeCheck() || flag)
                {
                    arrayElementAtIndex.FindPropertyRelative("m_ConditionMode").intValue = (int)list2[num3];
                }
                EditorGUI.BeginChangeCheck();
                float num4 = arrayElementAtIndex.FindPropertyRelative("m_EventTreshold").floatValue;
                if (animatorControllerParameterType == UnityEngine.AnimatorControllerParameterType.Float)
                {
                    num4 = EditorGUI.FloatField(position2, num4);
                }
                else
                {
                    num4 = (float)EditorGUI.IntField(position2, Mathf.FloorToInt(num4));
                }
                if (EditorGUI.EndChangeCheck() || flag)
                {
                    arrayElementAtIndex.FindPropertyRelative("m_EventTreshold").floatValue = num4;
                }
            }
            else if (num2 != -1 && animatorControllerParameterType == UnityEngine.AnimatorControllerParameterType.Bool)
            {
                string[] displayedOptions = new string[]
                {
                    "true",
                    "false"
                };
                int num5 = (animatorConditionMode != AnimatorConditionMode.IfNot) ? 0 : 1;
                EditorGUI.BeginChangeCheck();
                num5 = EditorGUI.Popup(rect3, num5, displayedOptions);
                if (EditorGUI.EndChangeCheck() || flag)
                {
                    arrayElementAtIndex.FindPropertyRelative("m_ConditionMode").intValue = ((num5 != 0) ? 2 : 1);
                }
            }
            else if (animatorControllerParameterType == UnityEngine.AnimatorControllerParameterType.Trigger)
            {
                if (flag)
                {
                    arrayElementAtIndex.FindPropertyRelative("m_ConditionMode").intValue = 1;
                }
            }
            else
            {
                EditorGUI.LabelField(rect3, "Parameter does not exist in Controller");
            }
        }