示例#1
0
    public async static void ChunksEnterLeaveViewReq(List <Vector2Int> enterViewChunks, List <Vector2Int> leaveViewChunks = null)
    {
        List <NBTChunk> chunks = new List <NBTChunk>();

        foreach (Vector2Int chunkPos in enterViewChunks)
        {
            NBTChunk chunk = await NBTHelper.LoadChunkAsync(chunkPos.x, chunkPos.y);

            chunks.Add(chunk);
        }
        ChunkRefresher.Add(chunks);
        ChunkChecker.FinishRefresh();

        if (leaveViewChunks != null)
        {
            foreach (Vector2Int chunk in leaveViewChunks)
            {
                UnloadChunk(chunk.x, chunk.y);
            }
        }
    }