예제 #1
0
        /// <summary>
        /// 好友或黑名单数据变化
        /// </summary>
        /// <param name="buf">协议内容</param>
        private void OnSyncFriend(KProtoBuf buf)
        {
            S2C_SYNC_FRIEND msg   = buf as S2C_SYNC_FRIEND;
            FriendProxy     proxy = GameFacade.Instance.RetrieveProxy(ProxyName.FriendProxy) as FriendProxy;
            FriendInfoVO    data  = CreateFriendInfo(msg.friend_syc);

            if (msg.friend_syc.flag == 0)
            {
                proxy.AddFriend(data);
            }
            else
            {
                proxy.AddBlack(data);
            }
            GameFacade.Instance.SendNotification(NotificationName.MSG_FRIEND_LIST_CHANGED, data);
            //Debugger.LogError("OnSyncFriend 1 >" + data.UID + "." + data.Name);
        }
예제 #2
0
        /// <summary>
        /// 获取好友列表
        /// </summary>
        /// <param name="buf"></param>
        private void OnFriendList(KProtoBuf buf)
        {
            S2C_SYNC_FRIENDLIST msg   = buf as S2C_SYNC_FRIENDLIST;
            FriendProxy         proxy = GameFacade.Instance.RetrieveProxy(ProxyName.FriendProxy) as FriendProxy;

            for (int i = 0; i < msg.friendlist.Count; i++)
            {
                FriendInfoVO data = CreateFriendInfo(msg.friendlist[i]);
                if (msg.friendlist[i].flag == 0)
                {
                    proxy.AddFriend(data);
                }
                else
                {
                    proxy.AddBlack(data);
                }
            }
            GameFacade.Instance.SendNotification(NotificationName.MSG_FRIEND_LIST_CHANGED);
            //Debugger.LogError("OnSyncFriend 1 >" + data.UID + "." + data.Name);
        }
예제 #3
0
        /// <summary>
        /// 添加黑名单
        /// </summary>
        /// <param name="buf">协议内容</param>
        private void OnAddBlackBack(KProtoBuf buf)
        {
            S2C_ADD_BLACK_BACK msg = buf as S2C_ADD_BLACK_BACK;

            FriendProxy proxy = GameFacade.Instance.RetrieveProxy(ProxyName.FriendProxy) as FriendProxy;

            if (msg.code == 1)
            {
                FriendInfoVO data = CreateFriendInfo(msg.friend_black);
                proxy.DelFriend(data.UID);
                proxy.DelBlack(data.UID);
                if (msg.friend_black.flag == 0)
                {
                    proxy.AddFriend(data);
                }
                else
                {
                    proxy.AddBlack(data);
                }
                GameFacade.Instance.SendNotification(NotificationName.MSG_FRIEND_LIST_CHANGED, data);
                //Debugger.LogError("add black");
            }
            //Debugger.LogError("OnAddBlackBack ");
        }