예제 #1
0
 private void DrawVector3(SerializedProperty Element)
 {
     if (useVector2.boolValue)
     {
         MalbersEditor.DrawLineHelpBox();
         EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseVector2"), new GUIContent("Response V2"));
     }
 }
예제 #2
0
 private void DrawSprite(SerializedProperty Element)
 {
     if (useSprite.boolValue)
     {
         MalbersEditor.DrawLineHelpBox();
         EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseSprite"), new GUIContent("Response Sprite"));
         EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseNull"), new GUIContent("Response NULL"));
     }
 }
예제 #3
0
 private void Draw_Bool(SerializedProperty Element)
 {
     if (useBool.boolValue)
     {
         MalbersEditor.DrawLineHelpBox();
         var useAdvBool = Element.FindPropertyRelative("AdvancedBool");
         // if (!useAdvBool.boolValue)
         {
             EditorGUILayout.PropertyField(Element.FindPropertyRelative("InvertBool"));
             EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseBool"), new GUIContent("Response"));
         }
         useAdvBool.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Use Advanced Bool", "Uses Separated Unity Events for True and False Entries"), useAdvBool.boolValue);
         if (useAdvBool.boolValue)
         {
             EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseBoolTrue"), new GUIContent("On True"));
             EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseBoolFalse"), new GUIContent("On False"));
         }
     }
 }
예제 #4
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            MalbersEditor.DrawDescription("Events Listeners. They Response to the MEvents Assets\nThe MEvents should not repeat on the list");

            EditorGUILayout.BeginVertical(MalbersEditor.StyleGray);
            {
                MalbersEditor.DrawScript(script);

                EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                {
                    list.DoLayoutList();

                    if (list.index != -1)
                    {
                        if (list.index < list.count)
                        {
                            SerializedProperty Element = eventsListeners.GetArrayElementAtIndex(list.index);

                            if (M.Events[list.index].Event != null)
                            {
                                string Descp = M.Events[list.index].Event.Description;

                                if (Descp != string.Empty)
                                {
                                    EditorGUILayout.BeginVertical(MalbersEditor.StyleGreen);
                                    {
                                        EditorGUILayout.HelpBox(M.Events[list.index].Event.Description, MessageType.None);
                                    }
                                    EditorGUILayout.EndVertical();
                                }

                                EditorGUILayout.Space();

                                useFloat     = Element.FindPropertyRelative("useFloat");
                                useBool      = Element.FindPropertyRelative("useBool");
                                useInt       = Element.FindPropertyRelative("useInt");
                                useString    = Element.FindPropertyRelative("useString");
                                useVoid      = Element.FindPropertyRelative("useVoid");
                                useGo        = Element.FindPropertyRelative("useGO");
                                useTransform = Element.FindPropertyRelative("useTransform");
                                useComponent = Element.FindPropertyRelative("useComponent");
                                useVector3   = Element.FindPropertyRelative("useVector3");
                                useVector2   = Element.FindPropertyRelative("useVector2");
                                useSprite    = Element.FindPropertyRelative("useSprite");

                                EditorGUILayout.BeginHorizontal();
                                {
                                    useVoid.boolValue    = GUILayout.Toggle(useVoid.boolValue, new GUIContent("Void", "No Parameters Response"), EditorStyles.toolbarButton);
                                    useBool.boolValue    = GUILayout.Toggle(useBool.boolValue, new GUIContent("Bool", "Bool Response"), EditorStyles.toolbarButton);
                                    useFloat.boolValue   = GUILayout.Toggle(useFloat.boolValue, new GUIContent("Float", "Float Response"), EditorStyles.toolbarButton);
                                    useInt.boolValue     = GUILayout.Toggle(useInt.boolValue, new GUIContent("Int", "Int Response"), EditorStyles.toolbarButton);
                                    useString.boolValue  = GUILayout.Toggle(useString.boolValue, new GUIContent("String", "String Response"), EditorStyles.toolbarButton);
                                    useVector3.boolValue = GUILayout.Toggle(useVector3.boolValue, new GUIContent("V3", "Vector3 Response"), EditorStyles.toolbarButton);
                                    useVector2.boolValue = GUILayout.Toggle(useVector2.boolValue, new GUIContent("V2", "Vector3 Response"), EditorStyles.toolbarButton);
                                }
                                EditorGUILayout.EndHorizontal();

                                EditorGUILayout.BeginHorizontal();
                                {
                                    useGo.boolValue        = GUILayout.Toggle(useGo.boolValue, new GUIContent("GameObject", "Game Object Response"), EditorStyles.toolbarButton);
                                    useTransform.boolValue = GUILayout.Toggle(useTransform.boolValue, new GUIContent("Transform", "Transform Response"), EditorStyles.toolbarButton);
                                    useComponent.boolValue = GUILayout.Toggle(useComponent.boolValue, new GUIContent("Component", "Component Response"), EditorStyles.toolbarButton);
                                    useSprite.boolValue    = GUILayout.Toggle(useSprite.boolValue, new GUIContent("Sprite", "Component Response"), EditorStyles.toolbarButton);
                                }
                                EditorGUILayout.EndHorizontal();

                                if (useVoid.boolValue)
                                {
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("Response"));
                                }

                                if (useBool.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    var useAdvBool = Element.FindPropertyRelative("AdvancedBool");
                                    // if (!useAdvBool.boolValue)
                                    {
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("InvertBool"));
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseBool"), new GUIContent("Response"));
                                    }
                                    useAdvBool.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Use Advanced Bool", "Uses Separated Unity Events for True and False Entries"), useAdvBool.boolValue);
                                    if (useAdvBool.boolValue)
                                    {
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseBoolTrue"), new GUIContent("On True"));
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseBoolFalse"), new GUIContent("On False"));
                                    }
                                }

                                if (useFloat.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseFloat"), new GUIContent("Response"));
                                }

                                if (useInt.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();

                                    var useAdvInteger = Element.FindPropertyRelative("AdvancedInteger");
                                    useAdvInteger.boolValue = EditorGUILayout.ToggleLeft(new GUIContent("Use Advanced Integer Comparer", "Compare the entry value with a default one to make a new Int Response "), useAdvInteger.boolValue);

                                    if (useAdvInteger.boolValue)
                                    {
                                        EditorGUILayout.Space();
                                        EditorGUI.indentLevel++;
                                        EditorGUILayout.BeginVertical(EditorStyles.helpBox);
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("IntEventList"), new GUIContent("Advanced Integer Comparer"), true);
                                        EditorGUILayout.EndVertical();
                                        EditorGUI.indentLevel--;
                                    }
                                    //   else
                                    {
                                        EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseInt"), new GUIContent("Response"));
                                    }
                                }

                                if (useString.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseString"), new GUIContent("Response"));
                                }
                                if (useGo.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseGO"), new GUIContent("Response GO"));
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseNull"), new GUIContent("Response NULL"));
                                }
                                if (useTransform.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseTransform"), new GUIContent("Response T"));
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseNull"), new GUIContent("Response NULL"));
                                }
                                if (useComponent.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseComponent"), new GUIContent("Response C"));
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseNull"), new GUIContent("Response NULL"));
                                }
                                if (useSprite.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseSprite"), new GUIContent("Response Sprite"));
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseNull"), new GUIContent("Response NULL"));
                                }

                                if (useVector3.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseVector3"), new GUIContent("Response V3"));
                                }
                                if (useVector2.boolValue)
                                {
                                    MalbersEditor.DrawLineHelpBox();
                                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseVector2"), new GUIContent("Response V2"));
                                }
                            }
                        }
                    }
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndVertical();
            serializedObject.ApplyModifiedProperties();
        }
예제 #5
0
        private void Draw_Integer(SerializedProperty Element)
        {
            if (useInt.boolValue)
            {
                MalbersEditor.DrawLineHelpBox();

                var useAdvInteger = Element.FindPropertyRelative("AdvancedInteger");
                useAdvInteger.boolValue = GUILayout.Toggle(useAdvInteger.boolValue, new GUIContent("Use Integer Comparer",
                                                                                                   "Compare the Event entry value with a new  one to make a new Int Response"), EditorStyles.foldoutHeader);

                if (useAdvInteger.boolValue)
                {
                    var             compare = Element.FindPropertyRelative("IntEventList");
                    ReorderableList Reo_AbilityList;

                    string listKey = Element.propertyPath;

                    if (innerListDict.ContainsKey(listKey))
                    {
                        // fetch the reorderable list in dict
                        Reo_AbilityList = innerListDict[listKey];
                    }
                    else
                    {
                        Reo_AbilityList = new ReorderableList(serializedObject, compare, true, true, true, true)
                        {
                            drawElementCallback = (Rect rect, int index, bool isActive, bool isFocused) =>
                            {
                                var element = compare.GetArrayElementAtIndex(index);

                                var name     = element.FindPropertyRelative("name");
                                var comparer = element.FindPropertyRelative("comparer");
                                var Value    = element.FindPropertyRelative("Value");

                                rect.y += 1;
                                var height = UnityEditor.EditorGUIUtility.singleLineHeight;
                                var split  = rect.width / 3;
                                var p      = 5;



                                var rectName     = new Rect(rect.x, rect.y, (split + p - 2) * 1.2f, height);
                                var rectComparer = new Rect(rect.x + (split + p) * 1.2f, rect.y, (split - p) * 0.75f, height);
                                var rectValue    = new Rect(rect.x + split * 2 + p + 15, rect.y, split - p - 10, height);


                                EditorGUI.PropertyField(rectName, name, GUIContent.none);
                                EditorGUI.PropertyField(rectComparer, comparer, GUIContent.none);
                                EditorGUI.PropertyField(rectValue, Value, GUIContent.none);
                            },

                            drawHeaderCallback = (Rect rect) =>
                            {
                                rect.y += 1;
                                var height       = UnityEditor.EditorGUIUtility.singleLineHeight;
                                var split        = rect.width / 3;
                                var p            = (split * 0.3f);
                                var rectName     = new Rect(rect.x, rect.y, split + p - 2, height);
                                var rectComparer = new Rect(rect.x + split + p, rect.y, split - p + 15, height);
                                var rectValue    = new Rect(rect.x + split * 2 + p + 5, rect.y, split - p, height);
                                var DebugRect    = new Rect(rect.width, rect.y - 1, 25, height + 2);

                                EditorGUI.LabelField(rectName, "    Name");
                                EditorGUI.LabelField(rectComparer, " Compare");
                                EditorGUI.LabelField(rectValue, " Value");
                            },
                        };


                        innerListDict.Add(listKey, Reo_AbilityList);  //Store it on the Editor
                    }
                    Reo_AbilityList.DoLayoutList();


                    int SelectedAbility = Reo_AbilityList.index;


                    if (SelectedAbility != -1)
                    {
                        var element = compare.GetArrayElementAtIndex(SelectedAbility);
                        if (element != null)
                        {
                            var Response = element.FindPropertyRelative("Response");
                            var name     = element.FindPropertyRelative("name").stringValue;
                            UnityEditor.EditorGUILayout.PropertyField(Response, new GUIContent("Response: [" + name + "]   "));
                        }
                    }
                }
                //   else
                {
                    MalbersEditor.DrawLineHelpBox();
                    EditorGUILayout.PropertyField(Element.FindPropertyRelative("ResponseInt"), new GUIContent("Response"));
                }
            }
        }