コード例 #1
0
        public override void Undo()
        {
            if (CanUndo)
            {
                BTEditorGraphNode createdNode = m_graph.GetNodeByHash(m_createdNodeHash);

                m_parentNodeHash = m_graph.GetNodeHash(createdNode.Parent);
                m_serializedNode = BTUtils.SerializeNode(createdNode.Node);

                createdNode.OnDelete();
                m_createdNodeHash = null;
            }
        }
コード例 #2
0
ファイル: UndoNodeMoved.cs プロジェクト: zhaocy1217/War-Clash
 public UndoNodeMoved(BTEditorGraphNode node)
 {
     m_graph         = node.Graph;
     m_nodeHash      = m_graph.GetNodeHash(node);
     m_startPosition = node.Node.Position;
     m_endPosition   = Vector2.zero;
 }
コード例 #3
0
 public UndoNodeCreated(BTEditorGraphNode node)
 {
     m_graph           = node.Graph;
     m_createdNodeHash = m_graph.GetNodeHash(node);
     m_parentNodeHash  = null;
     m_serializedNode  = null;
     Title             = "Created " + node.Node.Title;
 }
コード例 #4
0
        public UndoNodeDeleted(BTEditorGraphNode node, int childIndex)
        {
            m_graph          = node.Graph;
            m_parentNodeHash = m_graph.GetNodeHash(node.Parent);
            m_serializedNode = BTUtils.SerializeNode(node.Node);
            m_childIndex     = childIndex;
            Title            = "Deleted " + node.Node.Title;

            m_createdNodeHash = null;
        }
コード例 #5
0
        public UndoNodeGroupPop(BTEditorGraphNode node)
        {
            if (!(node.Node is NodeGroup))
            {
                throw new System.ArgumentException("BT graph node is not of type NodeGroup", "node");
            }

            m_graph         = node.Graph;
            m_nodeGroupHash = m_graph.GetNodeHash(node);
            Title           = "Close " + (string.IsNullOrEmpty(node.Node.Name) ? node.Node.Title : node.Node.Name);
        }
コード例 #6
0
        public override void Undo()
        {
            if (CanUndo)
            {
                BehaviourNode node = BTUtils.DeserializeNode(m_serializedNode);
                if (m_childIndex >= 0)
                {
                    var parentNode  = m_graph.GetNodeByHash(m_parentNodeHash);
                    var createdNode = parentNode.OnInsertChild(m_childIndex, node);
                    m_createdNodeHash = m_graph.GetNodeHash(createdNode);
                }
                else
                {
                    var parentNode  = m_graph.GetNodeByHash(m_parentNodeHash);
                    var createdNode = parentNode.OnCreateChild(node);
                    m_createdNodeHash = m_graph.GetNodeHash(createdNode);
                }

                m_parentNodeHash = null;
                m_serializedNode = null;
            }
        }