示例#1
0
 private IEnumerator ResponseNetChunk()
 {
     while (true)
     {
         NetChunkData netChunkData = world.WorldGenerator.DataProcessorManager.DeResponseNetChunkData();
         if (netChunkData != null)
         {
             ResponseChunkPackage package = PackageFactory.GetPackage(PackageType.ResponseChunk) as ResponseChunkPackage;
             package.roleId        = netChunkData.roleId;
             package.pos           = netChunkData.worldPos;
             package.isExit        = netChunkData.isExist;
             package.compressType  = (byte)netChunkData.data.compressType;
             package.chunkByteData = netChunkData.data.data;
             NetManager.Instance.client.SendPackage(package);
         }
         yield return(null);
     }
 }
示例#2
0
        public override void ServerDo(ClientConnectionWorker connectionWork)
        {
            ClientPlayer mainPlayer = NetManager.Instance.server.playerManager.mainPlayer;

            if (mainPlayer.id == roleId)
            {
                ResponseChunkPackage package = PackageFactory.GetPackage(PackageType.ResponseChunk) as ResponseChunkPackage;
                package.roleId = roleId;
                package.pos    = pos;
                package.isExit = false;
                ClientChangedChunkData data = NetManager.Instance.server.sceneManager.GetChangedChunkData(pos);
                if (data != null)
                {
                    package.hasChangedData = true;
                    package.changedData    = data;
                }
                mainPlayer.worker.SendPackage(package);
            }
            else
            {
                mainPlayer.worker.SendPackage(this);
            }
        }