Esempio n. 1
0
    /// <summary>
    /// 接受好友聊天消息
    /// </summary>
    /// <param name="chatResp"></param>
    public void ReceiveMessage(FriendChatResp chatResp)
    {
        ChatInfo info = new ChatInfo()
        {
            senderId     = chatResp.friendInfo.userId,
            chatWithId   = chatResp.friendInfo.userId == UserInfoModel.userInfo.userId ? curChatInfo.chatWithId : chatResp.friendInfo.userId,
            chatWithName = chatResp.friendInfo.nickname == UserInfoModel.userInfo.nickName ? curChatInfo.chatWithName : chatResp.friendInfo.nickname,
        };

        info.playerBaseInfo.userNickname = chatResp.friendInfo.nickname;
        info.playerBaseInfo.icon         = chatResp.friendInfo.photo;
        info.playerBaseInfo.six          = chatResp.friendInfo.gender == 0 ? Six.boy : Six.girl;
        info.playerBaseInfo.exp          = chatResp.friendInfo.exp;
        info.playerBaseInfo.lv           = chatResp.friendInfo.level;
        info.playerBaseInfo.uid          = chatResp.friendInfo.userId.ToString();
        info.playerBaseInfo.money        = chatResp.friendInfo.sliver;
        //info.playerBaseInfo.vip = chatResp.friendInfo.;
        info.type     = chatResp.content.type;
        info.text     = chatResp.content.content;
        info.chatTime = chatResp.content.date;
        if (onReceiveMessage != null)
        {
            onReceiveMessage(info);
        }
        ChatLog(info);
    }
Esempio n. 2
0
 /// <summary>
 /// 服务器推送最近联系人离线消息列表
 /// </summary>
 public void G2C_RecentContacts(List <FriendOfflineChat> infos)
 {
     for (int i = 0; i < infos.Count; i++)
     {
         for (int j = 0; j < infos[i].chatContent.Count; j++)
         {
             FriendChatResp resp = new FriendChatResp();
             resp.friendInfo = infos[i].friendInfo;
             resp.content    = infos[i].chatContent[j];
             SocialModel.Instance.ReceiveMessage(resp);
         }
     }
 }