Exemplo n.º 1
0
        private NFriendInfo GetFriendInfo(TFriend tfriend)
        {

            Character friend;
            NFriendInfo nFriendInfo = new NFriendInfo();
            nFriendInfo.Id = tfriend.Id;
            if (!CharacterManager.Instance.GetCharacter(tfriend.FriendID, out friend))
            { //好友不在线
                nFriendInfo.friendInfo = new NMessageCharInfo()
                {
                    Id = tfriend.FriendID,
                    Name = tfriend.FriendName,
                    Level = tfriend.FriendLevel,
                    Class = tfriend.FriendClass,

                };
                nFriendInfo.Status = 0;
            }
            else
            {//好友在线
                nFriendInfo.friendInfo = new NMessageCharInfo()
                {
                    Id = friend.Id,
                    Name = friend.Data.Name,
                    Level = friend.Data.Level,
                    Class = friend.Data.Class,
                };
                nFriendInfo.Status = 1;
                friend.friendManager.UpdateFriendInfo(Owner.Info, 1);
            }
            return nFriendInfo;
        }
Exemplo n.º 2
0
        public NFriendInfo GetFriendInfo(TCharacterFriend friend)
        {
            NFriendInfo friendInfo = new NFriendInfo();
            var         character  = CharacterManager.Instance.GetCharacter(friend.FriendID);

            friendInfo.friendInfo = new NCharacterInfo();
            friendInfo.Id         = friend.Id;
            if (character == null)
            {
                friendInfo.friendInfo.Id    = friend.FriendID;
                friendInfo.friendInfo.Name  = friend.FriendName;
                friendInfo.friendInfo.Class = (CharacterClass)friend.Class;
                friendInfo.friendInfo.Level = friend.Level;
                friendInfo.Status           = 0;
            }
            else
            {
                friendInfo.friendInfo       = character.GetBasicInfo();
                friendInfo.friendInfo.Name  = character.Info.Name;
                friendInfo.friendInfo.Class = character.Info.Class;
                friendInfo.friendInfo.Level = character.Info.Level;
                if (friend.Level != character.Info.Level)
                {
                    friend.Level = character.Info.Level;
                }
                character.FriendManager.UpdateFriendInfo(this.Owner.Info, 1);
                friendInfo.Status = 1;
            }
            Log.InfoFormat(" {0} :{1} GetFriendInfo:{2} Status:{3}", this.Owner.Id, this.Owner.Info.Name, friendInfo.friendInfo.Id, friendInfo.Status);
            return(friendInfo);
        }
Exemplo n.º 3
0
 public void SetFriendInfo(NFriendInfo item)
 {
     this.info = item;
     if (this.nickname != null)
     {
         this.nickname.text = this.info.friendInfo.Name;
     }
     if (this.@class != null)
     {
         [email protected] = this.info.friendInfo.Class.ToString();
     }
     if (this.level != null)
     {
         this.level.text = this.info.friendInfo.Level.ToString();
     }
     if (this.status != null)
     {
         this.status.text = this.info.Status == 1?"在线":"离线";
     }
 }
Exemplo n.º 4
0
        public NFriendInfo GetFriendInfo(TCharacterFriend friend)
        {
            NFriendInfo friendInfo = new NFriendInfo();
            Character   character  = CharacterManager.Instance.GetCharacter(friend.FriendID);

            friendInfo.friendInfo = new NCharacterInfo();
            friendInfo.Id         = friend.Id;
            if (character == null)//角色管理器里没有
            {
                friendInfo.friendInfo.Id    = friend.FriendID;
                friendInfo.friendInfo.Name  = friend.FriendName;
                friendInfo.friendInfo.Class = (CharacterClass)friend.Class;
                friendInfo.friendInfo.Level = friend.Level;
                friendInfo.Status           = 0;//不在线
            }
            else
            {
                friendInfo.friendInfo       = character.GetBasicInfo();
                friendInfo.friendInfo.Name  = character.Info.Name;
                friendInfo.friendInfo.Class = character.Info.Class;
                friendInfo.friendInfo.Level = character.Info.Level;
                if (friend.Level != character.Info.Level)
                {
                    friend.Level = character.Info.Level;
                }
                character.FriendManager.UpdateFrindInfo(this.Owner.Info, 1);//更新好友的好友列表里本玩家的在线状态
                friendInfo.Status = 1;
            }
            //通知好友自己上线
            //var friendSession = SessionManager.Instance.GetSession(friend.FriendID);
            //if (friendSession!=null)
            //{
            //    friendSession.Session.Character.FriendManager.UpdateFrindInfo(friendSession.Session.Character.Info, 1);
            //}
            Log.InfoFormat("{0}:{1} GetFriendInfo:{2}:{3} Status:{4}", this.Owner.Info.Name, friendInfo.friendInfo.Name, Owner.Info.Id, friendInfo.friendInfo.Id, friendInfo.Status);
            return(friendInfo);
        }