示例#1
0
        public override bool TakeAction()
        {
            List <Player> resPlayers;

            if (m_RequestPacket.HasDisplayId)
            {
                resPlayers = PlayerLogic.FindUserByUUID(m_RequestPacket.DisplayId);
            }
            else
            {
                resPlayers = PlayerLogic.FindUsersByName(m_RequestPacket.Input);
            }

            PlayerFriendsLogic pf = new PlayerFriendsLogic();

            pf.SetUser(m_UserId);
            var friends = pf.GetFriends();

            foreach (var player in resPlayers)
            {
                if (player == null)
                {
                    continue;
                }
                m_ResponsePacket.Players.Add(new PBPlayerInfo()
                {
                    Id               = player.Id,
                    Name             = player.Name,
                    Level            = player.Level,
                    VipLevel         = player.VIPLevel,
                    LastLoginInTicks = player.LastLoginTime
                });
                if (friends.ContainsKey(player.Id))
                {
                    m_ResponsePacket.IsMyFriend.Add(true);
                }
                else
                {
                    m_ResponsePacket.IsMyFriend.Add(false);
                }
            }
            return(true);
        }