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


C# IMap.GetSurroundingClients方法代码示例

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


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

示例1: AppendNpcSpawn

 public static void AppendNpcSpawn(IMap map, PacketHitList hitlist, int mapNpcSlot)
 {
     MapNpc mapNpc = map.ActiveNpc[mapNpcSlot];
     foreach (Client i in map.GetSurroundingClients(map)) {
         i.Player.SeeNewCharacter(mapNpc);
     }
     hitlist.AddPacketToSurroundingPlayers(map, CreateNpcSpawn(mapNpc));
 }
开发者ID:ScruffyKnight,项目名称:PMU-Server,代码行数:8,代码来源:PacketBuilder.cs

示例2: SendJoinMap

        /*
        public static void SendJoinMap(Client client) {
            // Send all players on current map to client
            foreach (Client i in ClientManager.GetClients()) {
                Player player2 = i.Player;
                if (player2 != null) {
                    if (i.IsPlaying() && i != client && player2.MapID == client.Player.MapID) {
                        TcpPacket packet = TcpPacket.CreatePacket("playerdata",
                                                                  i.ConnectionID.ToString(), player2.Name, player2.GetActiveRecruit().Sprite.ToString(),
                                                                  player2.MapID, player2.X.ToString(), player2.Y.ToString(),
                                                                  ((int)player2.Direction).ToString(), ((int)player2.Access).ToString(),
                                                                  player2.PK.ToIntString(), player2.GuildName, ((int)player2.GuildAccess).ToString(),
                                                                  player2.Status);
                        if (player2.ConfusionStepCounter > 0) {
                            packet.AppendParameter("1");
                        } else {
                            packet.AppendParameter("0");
                        }
                        packet.AppendParameters((int)player2.GetActiveRecruit().StatusAilment, player2.GetActiveRecruit().VolatileStatus.Count);
                        for (int j = 0; j < player2.GetActiveRecruit().VolatileStatus.Count; j++) {
                            packet.AppendParameter(player2.GetActiveRecruit().VolatileStatus[j].Emoticon);
                        }
                        SendDataTo(client, packet);
                    }
                }
            }

            //SendActiveTeamToMap(client, player.mMap);
            // Send client's player data to everyone on the map including himself
            SendPlayerData(client);
        }
        */
        public static void SendLeaveMap(Client client, IMap map, bool shouldUnsee, bool logout)
        {
            if (map != null) {
                // Remove the player ID from the maps player list
                map.PlayersOnMap.Remove(client.Player.CharID);
                //if ((map.MapType == Enums.MapType.RDungeonMap || map.MapType == Enums.MapType.Instanced) && map.PlayersOnMap.Count > 0) {
                //    map.Save();
                //}
                if (logout) {
                    shouldUnsee = true;
                } else {
                    if (map.MapType == Enums.MapType.Instanced || map.MapType == Enums.MapType.RDungeonMap) {
                        client.Player.AddMapToDelete(map.MapID);
                    }
                }
                //remove from everyone's seencharacter list
                if (shouldUnsee) {
                    foreach (Client i in map.GetSurroundingClients(map)) {
                        i.Player.UnseeLeftPlayer(client.Player);
                    }
                    PacketHitList hitlist = null;
                    PacketHitList.MethodStart(ref hitlist);

                    //hitlist.AddPacketToPlayersInSightBut(client, map, TcpPacket.CreatePacket("leftmap", client.ConnectionID.ToString()), client.Player.X, client.Player.Y, 30);
                    hitlist.AddPacketToMap(map, TcpPacket.CreatePacket("leftmap", client.ConnectionID.ToString()));

                    PacketHitList.MethodEnded(ref hitlist);
                    //SendDataToMapBut(client, map.MapID, TcpPacket.CreatePacket("leftmap", client.ConnectionID.ToString()));
                }

            }
        }
开发者ID:pzaps,项目名称:Server,代码行数:64,代码来源:Messenger.cs


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