コード例 #1
0
        internal static void DeserializeReferences(GraphSerializationContext ctx)
        {
            int count = ctx.reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                var linkID         = ctx.reader.ReadUInt64();
                var startNode      = ctx.DeserializeNodeReference();
                var endNode        = ctx.DeserializeNodeReference();
                var connectedNode1 = ctx.DeserializeNodeReference();
                var connectedNode2 = ctx.DeserializeNodeReference();
                var clamped1       = ctx.DeserializeVector3();
                var clamped2       = ctx.DeserializeVector3();
                var postScanCalled = ctx.reader.ReadBoolean();

                GraphModifier link;
                if (usedIDs.TryGetValue(linkID, out link))
                {
                    var link2 = link as NodeLink2;
                    if (link2 != null)
                    {
                        if (startNode != null)
                        {
                            reference[startNode] = link2;
                        }
                        if (endNode != null)
                        {
                            reference[endNode] = link2;
                        }

                        // If any nodes happened to be registered right now
                        if (link2.startNode != null)
                        {
                            reference.Remove(link2.startNode);
                        }
                        if (link2.endNode != null)
                        {
                            reference.Remove(link2.endNode);
                        }

                        link2.startNode      = startNode as PointNode;
                        link2.endNode        = endNode as PointNode;
                        link2.connectedNode1 = connectedNode1;
                        link2.connectedNode2 = connectedNode2;
                        link2.postScanCalled = postScanCalled;
                        link2.clamped1       = clamped1;
                        link2.clamped2       = clamped2;
                    }
                    else
                    {
                        throw new System.Exception("Tried to deserialize a NodeLink2 reference, but the link was not of the correct type or it has been destroyed.\nIf a NodeLink2 is included in serialized graph data, the same NodeLink2 component must be present in the scene when loading the graph data.");
                    }
                }
                else
                {
                    throw new System.Exception("Tried to deserialize a NodeLink2 reference, but the link could not be found in the scene.\nIf a NodeLink2 is included in serialized graph data, the same NodeLink2 component must be present in the scene when loading the graph data.");
                }
            }
        }
コード例 #2
0
        // Token: 0x060022EB RID: 8939 RVA: 0x001924B8 File Offset: 0x001906B8
        internal static void DeserializeReferences(GraphSerializationContext ctx)
        {
            int num = ctx.reader.ReadInt32();

            for (int i = 0; i < num; i++)
            {
                ulong         key        = ctx.reader.ReadUInt64();
                GraphNode     graphNode  = ctx.DeserializeNodeReference();
                GraphNode     graphNode2 = ctx.DeserializeNodeReference();
                GraphNode     graphNode3 = ctx.DeserializeNodeReference();
                GraphNode     graphNode4 = ctx.DeserializeNodeReference();
                Vector3       vector     = ctx.DeserializeVector3();
                Vector3       vector2    = ctx.DeserializeVector3();
                bool          flag       = ctx.reader.ReadBoolean();
                GraphModifier graphModifier;
                if (!GraphModifier.usedIDs.TryGetValue(key, out graphModifier))
                {
                    throw new Exception("Tried to deserialize a NodeLink2 reference, but the link could not be found in the scene.\nIf a NodeLink2 is included in serialized graph data, the same NodeLink2 component must be present in the scene when loading the graph data.");
                }
                NodeLink2 nodeLink = graphModifier as NodeLink2;
                if (!(nodeLink != null))
                {
                    throw new Exception("Tried to deserialize a NodeLink2 reference, but the link was not of the correct type or it has been destroyed.\nIf a NodeLink2 is included in serialized graph data, the same NodeLink2 component must be present in the scene when loading the graph data.");
                }
                if (graphNode != null)
                {
                    NodeLink2.reference[graphNode] = nodeLink;
                }
                if (graphNode2 != null)
                {
                    NodeLink2.reference[graphNode2] = nodeLink;
                }
                if (nodeLink.startNode != null)
                {
                    NodeLink2.reference.Remove(nodeLink.startNode);
                }
                if (nodeLink.endNode != null)
                {
                    NodeLink2.reference.Remove(nodeLink.endNode);
                }
                nodeLink.startNode      = (graphNode as PointNode);
                nodeLink.endNode        = (graphNode2 as PointNode);
                nodeLink.connectedNode1 = graphNode3;
                nodeLink.connectedNode2 = graphNode4;
                nodeLink.postScanCalled = flag;
                nodeLink.clamped1       = vector;
                nodeLink.clamped2       = vector2;
            }
        }
コード例 #3
0
ファイル: GridNodeBase.cs プロジェクト: liushengchao112/Ember
        public override void DeserializeReferences(GraphSerializationContext ctx)
        {
            // Grid nodes didn't serialize references before 3.8.3
            if (ctx.meta.version < VERSION_3_8_3)
            {
                return;
            }

            int count = ctx.reader.ReadInt32();

            if (count == -1)
            {
                connections     = null;
                connectionCosts = null;
            }
            else
            {
                connections     = new GraphNode[count];
                connectionCosts = new uint[count];

                for (int i = 0; i < count; i++)
                {
                    connections[i]     = ctx.DeserializeNodeReference();
                    connectionCosts[i] = ctx.reader.ReadUInt32();
                }
            }
        }
コード例 #4
0
ファイル: GridNodeBase.cs プロジェクト: looki666/Green-Hell
        public override void DeserializeReferences(GraphSerializationContext ctx)
        {
            if (ctx.meta.version < GridNodeBase.VERSION_3_8_3)
            {
                return;
            }
            int num = ctx.reader.ReadInt32();

            if (num == -1)
            {
                this.connections = null;
            }
            else
            {
                this.connections = new Connection[num];
                for (int i = 0; i < num; i++)
                {
                    this.connections[i] = new Connection
                    {
                        node = ctx.DeserializeNodeReference(),
                        cost = ctx.reader.ReadUInt32()
                    };
                }
            }
        }
コード例 #5
0
ファイル: PointNode.cs プロジェクト: howelllucas/Project
		public override void DeserializeReferences (GraphSerializationContext ctx) {
			int count = ctx.reader.ReadInt32();

			if (count == -1) {
				connections = null;
			} else {
				connections = new Connection[count];

				for (int i = 0; i < count; i++) {
					connections[i] = new Connection(ctx.DeserializeNodeReference(), ctx.reader.ReadUInt32());
				}
			}
		}
コード例 #6
0
        // Token: 0x060025E5 RID: 9701 RVA: 0x001A655C File Offset: 0x001A475C
        public override void DeserializeReferences(GraphSerializationContext ctx)
        {
            int num = ctx.reader.ReadInt32();

            if (num == -1)
            {
                this.connections = null;
                return;
            }
            this.connections = new Connection[num];
            for (int i = 0; i < num; i++)
            {
                this.connections[i] = new Connection(ctx.DeserializeNodeReference(), ctx.reader.ReadUInt32(), byte.MaxValue);
            }
        }
コード例 #7
0
        // Token: 0x060023D7 RID: 9175 RVA: 0x0019A91C File Offset: 0x00198B1C
        public override void DeserializeReferences(GraphSerializationContext ctx)
        {
            int num = ctx.reader.ReadInt32();

            if (num == -1)
            {
                this.connections = null;
                return;
            }
            this.connections = ArrayPool <Connection> .ClaimWithExactLength(num);

            for (int i = 0; i < num; i++)
            {
                this.connections[i] = new Connection(ctx.DeserializeNodeReference(), ctx.reader.ReadUInt32(), (ctx.meta.version < AstarSerializer.V4_1_0) ? byte.MaxValue : ctx.reader.ReadByte());
            }
        }
コード例 #8
0
        public override void DeserializeReferences(GraphSerializationContext ctx)
        {
            int num = ctx.reader.ReadInt32();

            if (num == -1)
            {
                this.connections     = null;
                this.connectionCosts = null;
            }
            else
            {
                this.connections     = new GraphNode[num];
                this.connectionCosts = new uint[num];
                for (int i = 0; i < num; i++)
                {
                    this.connections[i]     = ctx.DeserializeNodeReference();
                    this.connectionCosts[i] = ctx.reader.ReadUInt32();
                }
            }
        }
コード例 #9
0
        public override void DeserializeReferences(GraphSerializationContext ctx)
        {
            int num = ctx.reader.ReadInt32();

            if (num == -1)
            {
                this.connections = null;
                return;
            }
            this.connections = ArrayPool <Connection> .ClaimWithExactLength(num);

            for (int i = 0; i < num; i++)
            {
                this.connections[i] = new Connection
                {
                    node = ctx.DeserializeNodeReference(),
                    cost = ctx.reader.ReadUInt32()
                };
            }
        }
コード例 #10
0
        public override void DeserializeReferences(GraphSerializationContext ctx)
        {
            int count = ctx.reader.ReadInt32();

            if (count == -1)
            {
                connections = null;
            }
            else
            {
                connections = ArrayPool <Connection> .ClaimWithExactLength(count);

                for (int i = 0; i < count; i++)
                {
                    connections[i] = new Connection {
                        node = ctx.DeserializeNodeReference(),
                        cost = ctx.reader.ReadUInt32()
                    };
                }
            }
        }
コード例 #11
0
ファイル: GraphNode.cs プロジェクト: CrescentLua/Game_Jam
        public override void DeserializeReferences(GraphSerializationContext ctx)
        {
            int count = ctx.reader.ReadInt32();

            if (count == -1)
            {
                connections = null;
            }
            else
            {
                connections = ArrayPool <Connection> .ClaimWithExactLength(count);

                for (int i = 0; i < count; i++)
                {
                    connections[i] = new Connection(
                        ctx.DeserializeNodeReference(),
                        ctx.reader.ReadUInt32(),
                        ctx.meta.version < AstarSerializer.V4_1_0 ? (byte)0xFF : ctx.reader.ReadByte()
                        );
                }
            }
        }