protected override void OnInspectorGUI()
        {
            if (state.state == null)
            {
                return;
            }
            GUILayout.BeginVertical("box");
            foreach (var item in state.ToArrowLines)
            {
                MachineStateGUI fromState = MachineStateGUIDataControl.GetMachineStateGUI(item.transitions[0].fromState);
                MachineStateGUI toState   = MachineStateGUIDataControl.GetMachineStateGUI(item.transitions[0].toState);
                GUILayout.Label(fromState.name + " -> " + toState.name, "box");
            }
            GUILayout.EndVertical();
            GUILayout.Space(5);
            for (int i = 0; i < state.state.stateBaseBehaviours.Count; i++)
            {
                StateBaseBehaviour item      = state.state.stateBaseBehaviours[i];
                object             eInstance = null;
                if (!editorInstance.ContainsKey(item) || editorInstance[item] == null)
                {
                    eInstance = EditorExtendAttributeUtils.GetEditorExtend(typeof(StateBehaviourGUIBase), item.GetType());
                    editorInstance.Add(item, eInstance);
                }
                else
                {
                    eInstance = editorInstance[item];
                }
                GUILayout.BeginVertical("IN GameObjectHeader");
                GUIContent cc = EditorGUIUtility.IconContent("cs Script Icon");
                cc.text = item.GetType().Name;
                GUILayout.Label(cc);
                GUILayout.EndVertical();
                GUILayout.Space(7);
                if (eInstance == null)
                {
                    item = (StateBaseBehaviour)EditorDrawGUIUtil.DrawClassData("", item);
                }
                else
                {
                    StateBehaviourGUIBase temp = (StateBehaviourGUIBase)eInstance;
                    temp.target   = item;
                    temp.stateGUI = state;

                    temp.OnInspectorGUI();
                }
            }
        }
示例#2
0
        void OnGUI()
        {
            if (componetNameArr.Length == 0)
            {
                return;
            }
            GUILayout.Space(15);
            GUILayout.BeginHorizontal();

            selectInt0 = EditorGUILayout.Popup(logicComponetType.ToString(), selectInt0, componetNameArr);

            GUILayout.EndHorizontal();
            GUILayout.Space(15);

            ComponentNameAttribute tn = CompontNameAttributeUtils.GetCompontNameAttribute(logicComponetType, componetNameArr[selectInt0]);

            value = (LogicComponentBase)GetInstance(tn.className, value);
            Type extendEditorType = EditorExtendAttributeUtils.GetEditorExtendType(typeof(EditorExtendBase), value.GetType());// GetEditorExtendType(value.GetType());

            if (extendEditorType != null)
            {
                if (editorExtendClassNameValue == null || editorExtendClassNameValue.GetType() != extendEditorType)
                {
                    if (editorExtendClassNameValue != null)
                    {
                        editorExtendClassNameValue.OnClose();
                    }
                    editorExtendClassNameValue        = (EditorExtendBase)Activator.CreateInstance(extendEditorType);
                    editorExtendClassNameValue.target = value;
                    editorExtendClassNameValue.OnAwak();
                }
                editorExtendClassNameValue.EditorOverrideClassGUI();
            }
            else
            {
                if (editorExtendClassNameValue != null)
                {
                    editorExtendClassNameValue.OnClose();
                }

                LogicSystemAttributeEditorGUI.DrawInternalVariableGUI(value);
            }
            GUILayout.Space(15);
            if (value != null)
            {
                //Debug.Log(" ValueType  :" + value.GetType() + "  baseType:" + value.GetType().BaseType);
                GUILayout.Label(((LogicComponentBase)value).ToExplain());
            }
            GUILayout.Space(15);

            GUILayout.BeginHorizontal();
            if (GUILayout.Button("确定", GUILayout.Width(120)))
            {
                if (isNew)
                {
                    components.GetLogicComs().Add(value);
                }
                components.SaveComponentDataToClassValue();
                Close();
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("取消", GUILayout.Width(120)))
            {
                Close();
            }

            GUILayout.EndHorizontal();
        }