Пример #1
0
        ///----------------------------------------------------------------------------------------------

        //...
        public GraphSource()
        {
            zoomFactor      = 1f;
            nodes           = new List <Node>();
            canvasGroups    = new List <CanvasGroup>();
            localBlackboard = new BlackboardSource();
        }
Пример #2
0
        //Construct
        public GraphSerializationData(Graph graph)
        {
            this.version         = SerializationVersion;
            this.type            = graph.GetType();
            this.name            = graph.name;
            this.comments        = graph.graphComments;
            this.translation     = graph.translation;
            this.zoomFactor      = graph.zoomFactor;
            this.nodes           = graph.allNodes;
            this.canvasGroups    = graph.canvasGroups;
            this.localBlackboard = graph.localBlackboard;

            var structConnections = new List <Connection>();

            for (var i = 0; i < nodes.Count; i++)
            {
                if (nodes[i] is ISerializationCallbackReceiver)
                {
                    (nodes[i] as ISerializationCallbackReceiver).OnBeforeSerialize();
                }

                for (var j = 0; j < nodes[i].outConnections.Count; j++)
                {
                    structConnections.Add(nodes[i].outConnections[j]);
                }
            }

            this.connections = structConnections;
            this.primeNode   = graph.primeNode;
        }
Пример #3
0
        //Construct
        public GraphSerializationData(Graph graph)
        {
            this.version         = FRAMEWORK_VERSION;
            this.type            = graph.GetType();
            this.category        = graph.category;
            this.comments        = graph.comments;
            this.translation     = graph.translation;
            this.zoomFactor      = graph.zoomFactor;
            this.nodes           = graph.allNodes;
            this.canvasGroups    = graph.canvasGroups;
            this.localBlackboard = graph.localBlackboard;

            //connections are serialized seperately and not part of their parent node
            var structConnections = new List <Connection>();

            for (var i = 0; i < nodes.Count; i++)
            {
                for (var j = 0; j < nodes[i].outConnections.Count; j++)
                {
                    structConnections.Add(nodes[i].outConnections[j]);
                }
            }

            this.connections = structConnections;

            //serialize derived data
            this.derivedData = graph.OnDerivedDataSerialization();
        }