当前位置: 首页>>代码示例>>C#>>正文


C# Server.ClientSeenChunk方法代码示例

本文整理汇总了C#中Server.ClientSeenChunk方法的典型用法代码示例。如果您正苦于以下问题:C# Server.ClientSeenChunk方法的具体用法?C# Server.ClientSeenChunk怎么用?C# Server.ClientSeenChunk使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server的用法示例。


在下文中一共展示了Server.ClientSeenChunk方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NearestDirty

    void NearestDirty(Server server, int clientid, int playerx, int playery, int playerz, int[] retNearest)
    {
        int nearestdist = intMaxValue;
        retNearest[0] = -1;
        retNearest[1] = -1;
        retNearest[2] = -1;
        int px = (int)(playerx) / Server.chunksize;
        int py = (int)(playery) / Server.chunksize;
        int pz = (int)(playerz) / Server.chunksize;

        int chunksxy = mapAreaSize(server) / Server.chunksize / 2;
        int chunksz = mapAreaSizeZ(server) / Server.chunksize / 2;

        int startx = px - chunksxy;
        int endx = px + chunksxy;
        int starty = py - chunksxy;
        int endy = py + chunksxy;
        int startz = pz - chunksz;
        int endz = pz + chunksz;

        if (startx < 0) { startx = 0; }
        if (starty < 0) { starty = 0; }
        if (startz < 0) { startz = 0; }
        if (endx >= server.mapsizexchunks()) { endx = server.mapsizexchunks() - 1; }
        if (endy >= server.mapsizeychunks()) { endy = server.mapsizeychunks() - 1; }
        if (endz >= server.mapsizezchunks()) { endz = server.mapsizezchunks() - 1; }

        for (int x = startx; x <= endx; x++)
        {
            for (int y = starty; y <= endy; y++)
            {
                for (int z = startz; z <= endz; z++)
                {
                    if (server.ClientSeenChunk(clientid, x, y, z))
                    {
                        continue;
                    }
                    {
                        int dx = px - x;
                        int dy = py - y;
                        int dz = pz - z;
                        int dist = dx * dx + dy * dy + dz * dz;
                        if (dist < nearestdist)
                        {
                            nearestdist = dist;
                            retNearest[0] = x;
                            retNearest[1] = y;
                            retNearest[2] = z;
                        }
                    }
                }
            }
        }
    }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:54,代码来源:NotifyMap.cs

示例2: LoadAndSendChunk

 void LoadAndSendChunk(Server server, int clientid, int vx, int vy, int vz, Stopwatch s)
 {
     //load
     server.LoadChunk(vx, vy, vz);
     //send
     if (!server.ClientSeenChunk(clientid, vx, vy, vz))
     {
         // only send chunks that haven't been sent yet
         SendChunk(server, clientid, new Vector3i(vx * Server.chunksize, vy * Server.chunksize, vz * Server.chunksize), new Vector3i(vx, vy, vz));
     }
 }
开发者ID:MagistrAVSH,项目名称:manicdigger,代码行数:11,代码来源:NotifyMap.cs


注:本文中的Server.ClientSeenChunk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。