Exemplo n.º 1
0
 //[MenuItem("CGM/Action Editor")]
 public static void Init(CGME.Action act)
 {
     window_instance = (WindowActionEditor )EditorWindow.GetWindow(typeof(WindowActionEditor));
     window_instance.wantsMouseMove = true;
     //window.title = GetWindowTitle();
     //window_instance.selected_action = window_instance.GetSelectedAction();
     window_instance.root_action = act;
     window_instance.name        = act.CGType;
     ActionEditorNode.SetStyles();
     ActionEditorPopupWindow.SetStyle();
     window_instance.CreateNodes();
 }
Exemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            //Target.TEST_ACTION = EditorGUILayout.ObjectField


            Target = (CGM.Action)target;

            Target.CGME_ActionRoot.CGType = EditorGUILayout.TextField("Name: ", Target.CGME_ActionRoot.CGType);
            Target.gameObject.name        = Target.CGME_ActionRoot.CGType;

            Target.CGME_ActionRoot.Persistent = Display.Toggle(Target, "Persistent", Target.CGME_ActionRoot.Persistent);

            index = EditorGUILayout.Popup("Component to Add: ", index, action_components);

            if (GUILayout.Button("Action Editor Window"))
            {
                WindowActionEditor.Init(Target.CGME_ActionRoot);
            }

            //EditorGUILayout.EndHorizontal();


            DisplayAction(Target.CGME_ActionRoot, null);
        }
Exemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            Target.GameInstance = (CGM.Game)EditorGUILayout.ObjectField(Target.GameInstance, typeof(CGM.Game), true);

            EditorGUILayout.BeginHorizontal();
            {
                res_choice = EditorGUILayout.Popup("Type", res_choice, Display.ResourceTypes);
                res_type   = Display.ResourceTypes[res_choice];

                if (GUILayout.Button("Add " + res_type + " Resource"))
                {
                    switch (res_choice)
                    {
                    case 0: Target.CGME_Lib.resourceLibrary.Add(new CGME.ResourceAction()); break;

                    case 1: Target.CGME_Lib.resourceLibrary.Add(new CGME.ResourceBool()); break;

                    case 2: Target.CGME_Lib.resourceLibrary.Add(new CGME.ResourceNumber()); break;

                    case 3: Target.CGME_Lib.resourceLibrary.Add(new CGME.ResourceText()); break;
                    }
                }
            }
            EditorGUILayout.EndHorizontal();

            foreach (CGME.Resource res in Target.CGME_Lib.resourceLibrary)
            {
                if (DisplayResource(res) == true)
                {
                    break;
                }
            }

            EditorGUILayout.LabelField("Actions");

            if (Target.Actions == null)
            {
                Debug.Log("WTF");
            }

            if (GUILayout.Button("add action") == true)
            {
                //Target.Actions.Add (new CGM.ActionWrapper());
                Target.Actions.Add(CreateInstance <CGM.ActionWrapper>());
            }

            int i = 0;

            if (GUILayout.Button("clear"))
            {
                Target.Actions.Clear();
            }
            foreach (CGM.ActionWrapper act in Target.Actions)
            {
                EditorGUILayout.BeginHorizontal();

                act.CGME_ActionRoot.CGType = EditorGUILayout.TextField(act.CGME_ActionRoot.CGType);
                if (GUILayout.Button("Action Editor Window"))
                {
                    WindowActionEditor.Init(act.CGME_ActionRoot);
                }
                if (GUILayout.Button("X"))
                {
                    Target.Actions.RemoveAt(i);
                    break;
                }
                i++;
                EditorGUILayout.EndHorizontal();
            }

            //if (Target.Actions.Count > 0)
            //	Target.Actions[0] = (CGM.ActionWrapper)EditorGUILayout.ObjectField(Target.Actions[0] ,typeof(CGM.ActionWrapper),false);
        }