コード例 #1
0
            public override void HandleRequest(Session.Receive request)
            {
                var session = request.ReadUInt32();
                var ids     = StaticChunkPool.Id;

                Reply.Send(request.Session, session, ids);
            }
コード例 #2
0
            public override void HandleRequest(Session.Receive stream)
            {
                var request = stream.ReadUInt32();
                var world   = ChunkService.Worlds.Get(stream.ReadUInt32());
                var ret     = new Dictionary <string, string> {
                    { "name", world.Name }
                };

                Reply.Send(stream.Session, request, ret);
            }
コード例 #3
0
            public override void HandleRequest(Session.Receive request)
            {
                var req      = request.Read <int[]>();
                var chunkPos = new Int3(req[1], req[2], req[3]);
                var world    = ChunkService.Worlds.Get((uint)req[0]);

                ChunkService.TaskDispatcher.Add(
                    new World.World.ResetChunkTask(RequestExtractChunkContent(request, chunkPos, world))
                    );
            }
コード例 #4
0
            private static Chunk RequestExtractChunkContent(Session.Receive request, Int3 chunkPos, World.World world)
            {
                var cow = request.ReadUInt32();

                if (cow != uint.MaxValue)
                {
                    return(new Chunk(chunkPos, world, cow));
                }
                var data = GetCache();

                request.Read(data, 0, data.Length);
                return(DeserializeChunk(chunkPos, world, data));
            }
コード例 #5
0
            public override void HandleRequest(Session.Receive stream)
            {
                var request = stream.Read <int[]>();
                var chunk   = GetChunk((uint)request[0], new Int3(request[1], request[2], request[3]));

                using (var message = stream.Session.CreateMessage(Id))
                {
                    message.WriteObject(request);
                    var cow = chunk.CopyOnWrite;
                    message.Write(cow);
                    if (cow == uint.MaxValue)
                    {
                        var chunkData = Get(chunk);
                        message.Write(chunkData, 0, chunkData.Length);
                    }
                }
            }
コード例 #6
0
            public override void HandleRequest(Session.Receive request)
            {
                var session = request.ReadUInt32();

                Reply.Send(request.Session, session, new uint[] { 0 });
            }