Пример #1
0
        void DisplayHeader(CGME.Action action, CGME.ActionGroup parent)
        {
            EditorGUILayout.BeginHorizontal();

            if (parent != null)
            {
                EditorGUILayout.LabelField(action.CGType);
            }
            else
            {
                EditorGUILayout.LabelField(action.CGType + " (root)");
            }

            if (action is CGME.ActionGroup && GUILayout.Button("+child " + action.CGType))
            {
                AddChild(action as CGME.ActionGroup, GetAction(action_components[index]));
                //(action as CGME.ActionGroup).AddAction(GetAction (secondary_options[index2]));
            }

            if (parent != null && GUILayout.Button("delete " + action.CGType))
            {
                RemoveChild(parent, action);
                //parent.RemoveAction(action);
            }

            EditorGUILayout.EndHorizontal();
        }
        public ActionEditorNodeGroup(CGME.Action act) : base(act)
        {
            dictionary = CGME.ActionDictionary.GetInstance();

            action_names = dictionary.GetNames();

            add_action_popup = ActionEditorPopupWindow.GetInstance();
        }
Пример #3
0
        public Action AddAction(CGME.Action new_action)
        {
            //DispatchEvent(EngineEvent.AddChild, new_action, null);
            actions.Add(new_action);

            new_action.Parent = this;

            return(new_action);
        }
Пример #4
0
        public ActionEditorNode(CGME.Action act)
        {
            this.rectangle = new Rect();
            this.action    = act;
            //this.id = id.Ivalue;
            this.id = ActionEditorNode.ID++;

            //Debug.Log ("ID: " + this.id);
        }
Пример #5
0
        // GET/SET FUNCIONS -----------------------------------------

        public CGME.Action GetAction(CGME.Action _action)
        {
            foreach (Action action in children)
            {
                if (action == _action)
                {
                    return(action);
                }
            }
            return(null);
        }
Пример #6
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();
 }
Пример #7
0
        void DisplayAction(CGME.Action action, CGME.ActionGroup parent)
        {
            DisplayHeader(action, parent);

            if (action is CGME.ActionSelect)
            {
                DisplayBody(action    as CGME.ActionSelect);
            }

            else if (action is CGME.ActionTransferObject)
            {
                DisplayBody(action        as CGME.ActionTransferObject);
            }

            else if (action is CGME.ActionDestroyObject)
            {
                DisplayBody(action        as CGME.ActionDestroyObject);
            }

            else if (action is CGME.ActionModifyResource)
            {
                DisplayBody(action        as CGME.ActionModifyResource);
            }

            else if (action is CGME.ActionIfThenElse)
            {
                DisplayBody(action        as CGME.ActionIfThenElse);
            }

            else if (action is CGME.ActionConditionIsValid)
            {
                DisplayBody(action        as CGME.ActionConditionIsValid);
            }

            else if (action is CGME.ActionConditionCompareResource)
            {
                DisplayBody(action        as CGME.ActionConditionCompareResource);
            }

            else if (action is CGME.ActionConditionCompareParent)
            {
                DisplayBody(action        as CGME.ActionConditionCompareParent);
            }

            else if (action is CGME.ActionEvent)
            {
                DisplayBody(action        as CGME.ActionEvent);                //
            }
            DisplayFoot(action, parent);

            // STANDARD
        }
Пример #8
0
        CGME.Action InstantiateNodes()
        {
            List <CGME.Action> actions = new List <CGME.Action>();


            //INSTANTIATE
            int i = 0;

            foreach (SerialNode node in serial_nodes)
            {
                CGME.Action act = CGME.CGFactory.CreateCGInstance(node.type_string) as CGME.Action;
                act.Read(node.data);


                actions.Add(act);
            }

            foreach (SerialNode node in serial_nodes)
            {
                if (node.children_indexes.Count > 0)
                {
                    //Debug.Log ("3");

                    if (actions[node.index] is CGME.ActionGroup)
                    {
                        CGME.ActionGroup actiongroup = actions[node.index] as CGME.ActionGroup;

                        foreach (int index in node.children_indexes)
                        {
                            //	Debug.Log ("4");
                            actiongroup.AddAction(actions[index]);
                        }
                    }
                    else if (actions[node.index] is CGME.ActionIfThenElse)
                    {
                        CGME.ActionIfThenElse action_ite = actions[node.index] as CGME.ActionIfThenElse;

                        action_ite.SetIF(actions[node.children_indexes[0]] as CGME.ActionGroup);
                        action_ite.SetTHEN(actions[node.children_indexes[1]] as CGME.ActionGroup);
                        action_ite.SetELSE(actions[node.children_indexes[2]] as CGME.ActionGroup);
                    }
                }
            }


            if (actions.Count > 0)
            {
                return(actions[0]);
            }

            return(null);
        }
Пример #9
0
        public void AddChild(CGME.Action child_action, ref List <Rect> rect_list)
        {
            //Debug.Log ("2");


            //Debug.Log ("3");
            //ActionEditorNode child_node = AddNewNode(child_action,parent_node,x,y);
            ActionEditorNode child_node = InstantiateNode(child_action);

            rect_list.Add(child_node.rectangle);

            children.Add(child_node);
            //Debug.Log ("4");
            child_node.AddChildren(ref rect_list);
        }
Пример #10
0
        public bool DrawDeleteButton()
        {
            CGME.Action parent = action.ParentAction;

            if (parent != null && parent is CGME.ActionGroup)
            {
                if (GUI.Button(button_rect, "X", standard_style))
                {
                    (parent as CGME.ActionGroup).RemoveAction(action);
                    return(true);
                }
            }

            return(false);
        }
Пример #11
0
        void DisplayFoot(CGME.Action action, CGME.ActionGroup parent)
        {
            if (action is CGME.ActionGroup)
            {
                CGME.ActionGroup group = (CGME.ActionGroup)action;

                EditorGUI.indentLevel++;
                {
                    for (int i = 0; i < group.Actions_Size; i++)
                    {
                        DisplayAction(group.GetAction(i), group);
                    }
                }
                EditorGUI.indentLevel--;
            }
        }
Пример #12
0
        void Start()
        {
            if (CGME_resource is CGME.ResourceAction)
            {
                CGME.ResourceAction resource_action = (CGME.ResourceAction)CGME_resource;
                resource_action.Value = new CGME.ActionGroup();

                //CGME.Action action = FindObjectOfType<GameManager>().GetChildrenActions()[resource_action.ActionIndex].CGME_ActionRoot;
                CGME.Action action = FindObjectOfType <GameManager>().Actions[resource_action.ActionIndex].CGME_ActionRoot;

                //Debug.Log ("Getting " + action.CGType + " index is " + resource_action.ActionIndex);

                resource_action.Value.CopyFrom(action);
                ;
            }

            CGME_resource.AddListener(this);
        }
Пример #13
0
        public SerialNode AddNode(CGME.Action act, SerialNode parent_node)
        {
            SerialNode serializedNode = new SerialNode();

            serializedNode.data        = act.Write();
            serializedNode.type_string = act.GetType().ToString();
            serializedNode.index       = serial_nodes.Count;

            if (parent_node != null)
            {
                parent_node.children_indexes.Add(serial_nodes.Count);
            }

            serial_nodes.Add(serializedNode);

            return(serializedNode);
            //return serializedNode;
        }
Пример #14
0
        public void DebugComponents()
        {
            for (int rule_index = 0; rule_index < game.Phases_Size; rule_index++)              // FOR EACH PHASE

            {
                CGME.Phase phase = game.GetPhase(rule_index);
                Debug.Log("(ID:" + phase.Id + ") " + " -----PHASE: " + phase.CGType + DebugRes(phase));

                for (int phase_index = 0; phase_index < phase.Actions_Size; phase_index++)                  // FOR EACH ACTION

                {
                    CGME.Action action = phase.GetAction(phase_index);
                    Debug.Log("(ID:" + action.Id + ") " + "-------------ACTION:" + action.CGType);                      // + DebugRes(action));
                }
            }

            for (int game_index = 0; game_index < game.Players_Size; game_index++)              // FOR EACH PLAYER

            {
                CGME.Player player = game.GetPlayer(game_index);
                Debug.Log("(ID:" + player.Id + ") " + "PLAYER: " + player.CGType + DebugRes(player));

                for (int player_index = 0; player_index < player.Decks_Size; player_index++)                  // FOR EACH DECK

                {
                    CGME.Deck deck = player.GetDeck(player_index);
                    Debug.Log("(ID:" + deck.Id + ") " + "------DECK: " + deck.CGType + DebugRes(deck));

                    for (int deck_index = 0; deck_index < deck.Cards_Size; deck_index++)                      // FOR EACH CARD

                    {
                        CGME.Card card = deck.GetCard(deck_index);
                        Debug.Log("(ID:" + card.Id + ") " + "--------------CARD:" + card.CGType + DebugRes(card));
                    }
                }
            }
        }
 public ActionEditorNodeTransfer(CGME.Action act) : base(act)
 {
 }
 public ActionEditorNodeObjectValid(CGME.Action act) : base(act)
 {
 }
Пример #17
0
 void RemoveChild(CGME.ActionGroup parent, CGME.Action child)
 {
     parent.RemoveAction(child);
     Target.SetSerialize(true);
 }
Пример #18
0
 void AddChild(CGME.ActionGroup parent, CGME.Action child)
 {
     parent.AddAction(child);
     Target.SetSerialize(true);
 }
 public ActionEditorNodeModifyResource(CGME.Action act) : base(act)
 {
 }
 public ActionEditorNodeSelect(CGME.Action act) : base(act)
 {
 }
 public ActionEditorNodeCompareResource(CGME.Action act) : base(act)
 {
 }
 public ActionEditorNodeCompareParents(CGME.Action act) : base(act)
 {
 }
Пример #23
0
        // LIST FUNCTIONS ------------------------------------------

        public Action AddAction(CGME.Action action)
        {
            children.Add(action);
            action.ParentAction = this;
            return(action);
        }
Пример #24
0
 public ActionEditorNodeDestroyObject(CGME.Action act) : base(act)
 {
 }
 public ActionEditorNodeComparable(CGME.Action act) : base(act)
 {
 }
 public ActionEditorNodeBufferSize(CGME.Action act) : base(act)
 {
 }
Пример #27
0
 public void RemoveAction(CGME.Action action)
 {
     actions.Remove(action);
 }
Пример #28
0
 public CGME.Action AddAction(CGME.Action act)
 {
     CGME_action_root.AddAction(act);
     return(act);
 }
Пример #29
0
 public void RemoveAction(CGME.Action action)
 {
     children.Remove(action);
 }
Пример #30
0
 public ActionEditorNodeBufferLoad(CGME.Action act) : base(act)
 {
 }