Exemplo n.º 1
0
        public override bool OnGUI()
        {
            if (callMethod.manualUI)
            {
                return(DrawDefaultInspector());
            }

            EditField("behaviour");
            FsmEditorGUILayout.ReadonlyTextField(cachedTypeName);

            CheckCache();

            EditorGUILayout.BeginHorizontal();
            FsmEditorGUILayout.PrefixLabel("Method");
            var buttonRect = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.popup);
            var methodName = callMethod.methodName != null ? callMethod.methodName.Value : "";

            if (GUI.Button(buttonRect, methodName, EditorStyles.popup))
            {
                TypeHelpers.GenerateMethodMenu(cachedType, SelectMethod).DropDown(buttonRect);
            }
            EditorGUILayout.EndHorizontal();

            FsmEditorGUILayout.ReadonlyTextField(cachedMethodSignature);


            //EditorGUI.indentLevel++;

            if (cachedParameters != null && cachedParameters.Length > 0)
            {
                GUILayout.Label("Parameters", EditorStyles.boldLabel);

                for (int i = 0; i < cachedParameters.Length; i++)
                {
                    //GUILayout.Label(callMethod.parameters[i].RealType.ToString());

                    callMethod.parameters[i] = FsmEditor.ActionEditor.EditFsmVar(cachedParameterLabels[i],
                                                                                 callMethod.parameters[i], parameterAttributes);
                }
            }

            if (cachedMethod != null && cachedMethod.ReturnType != typeof(void))
            {
                GUILayout.Label("Return", EditorStyles.boldLabel);

                callMethod.storeResult = FsmEditor.ActionEditor.EditFsmVar(cachedReturnLabel, callMethod.storeResult, returnAttributes);
            }

            //EditorGUI.indentLevel--;

            FsmEditorGUILayout.LightDivider();

            EditField("everyFrame");

            FsmEditorGUILayout.LightDivider();

            EditField("manualUI");

            if (GUI.changed)
            {
                UpdateCache();
            }

            return(GUI.changed);
        }
Exemplo n.º 2
0
 public static GenericMenu GenerateStaticMethodMenu(Type type, GenericMenu.MenuFunction2 selectionFunction)
 {
     return(TypeHelpers.GenerateMethodMenu(type, selectionFunction, 24));
 }