public void RequestAddFriend(long player_id_)
        {
            CSFriendAddRequest req = new CSFriendAddRequest();

#if !NETWORK_SYNC || UNITY_EDITOR
            this.OnScHalfAsyncRequest(req, player_id_);
#else
            this.OnScRequest(req, player_id_);
#endif
        }
        public override void OnScResponse(object s)
        {
            base.OnScResponse(s);



            if (s is SCFriendResponse)
            {
                var rsp = s as SCFriendResponse;

                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                if (FriendReqType.Added == rsp.Type)
                {
                    FriendDataManager.Instance.Last_apply             = rsp.LastAgree;
                    FriendDataManager.Instance.Is_receive_application = !rsp.AddSwitch;
                }
                else if (FriendReqType.Agreeing == rsp.Type)
                {
                    GameEvents.RedPointEvents.Sys_OnNewApplyReadedEvent.SafeInvoke();
                }
                else if (FriendReqType.Addinfo == rsp.Type)
                {
                    FriendDataManager.Instance.Last_apply = false;
                    GameEvents.RedPointEvents.Sys_OnNewFriendReadedEvent.SafeInvoke();
                }


                if (this.m_friend_list_view.Visible)
                {
                    FriendDataManager.Instance.SetDatas(rsp.Friends, rsp.Type);
                    FriendDataManager.Instance.Max_friend_num     = rsp.Limit;
                    FriendDataManager.Instance.Send_gift_left_num = rsp.GiftCountLeft;

                    this.m_friend_list_view.Refresh((FRIEND_UI_TOGGLE_TYPE)rsp.Type);
                }
            }
            else if (s is SCFriendAddResponse)
            {
                var rsp = s as SCFriendAddResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }



                var raw_req            = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();
                CSFriendAddRequest req = raw_req as CSFriendAddRequest;
                GameEvents.UIEvents.UI_Friend_Event.Tell_add_recommend_firend_ok.SafeInvoke(req.PlayerId);

                EngineCoreEvents.AudioEvents.PlayAudio.SafeInvoke(Audio.AudioType.UISound, GameCustomAudioKey.friend_send.ToString());
            }
            else if (s is SCFriendDelResponse)
            {
                var rsp = s as SCFriendDelResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }



                if (this.m_friend_list_view.Visible)
                {
                    this.m_friend_list_view.Refresh(FRIEND_UI_TOGGLE_TYPE.Added);
                }
            }
            else if (s is SCFriendAgreeResponse)
            {
                var rsp = s as SCFriendAgreeResponse;

                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    if (!(MsgStatusCodeUtil.FRIEND_ADDED == rsp.Status.Code))
                    {
                        return; //添加已存在的好友,需要刷新申请界面
                    }
                }

                //半单机状态,添加好友,要等到服务器新好友提醒消息,才能显示已添加的好友,太慢了。所以在这里主动刷新
                RequestFriendInfos();

                if (this.m_friend_list_view.Visible)
                {
                    this.m_friend_list_view.Refresh(FRIEND_UI_TOGGLE_TYPE.Agreeing);
                }
            }
            else if (s is SCFriendDelApplyResponse)
            {
                var rsp = s as SCFriendDelApplyResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                if (this.m_friend_list_view.Visible)
                {
                    this.m_friend_list_view.Refresh(FRIEND_UI_TOGGLE_TYPE.Agreeing);
                }
            }
            else if (s is SCFriendGiftResponse)
            {
                var rsp = s as SCFriendGiftResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                FriendDataManager.Instance.Receive_gift_max_num  = rsp.Limit;
                FriendDataManager.Instance.Receive_gift_left_num = rsp.Limit - rsp.Count;
                FriendDataManager.Instance.SetGifts(rsp.FriendGiftLists);

                if (m_friend_list_view.Visible)
                {
                    this.m_friend_list_view.Refresh(FRIEND_UI_TOGGLE_TYPE.gift);
                    GameEvents.RedPointEvents.Sys_OnNewFriendReadedEvent.SafeInvoke();
                }
            }
            else if (s is SCFriendGiftSendResponse)
            {
                var rsp = s as SCFriendGiftSendResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }
            }
            else if (s is SCFriendGiftDrawResponse)
            {
                var rsp = s as SCFriendGiftDrawResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                if (m_friend_list_view.Visible)
                {
                    this.m_friend_list_view.Refresh(FRIEND_UI_TOGGLE_TYPE.gift);
                    GameEvents.RedPointEvents.Sys_OnNewFriendReadedEvent.SafeInvoke();
                }

                //if (m_gift_list_view.Visible)
                //{
                //    m_gift_list_view.Refresh();

                //    SCDropResp res = new SCDropResp();

                //    foreach (var item in rsp.PlayerPropMsg)
                //    {
                //        long item_id = item.PropId;
                //        int item_count = item.Count;

                //        DropInfo info = new DropInfo();
                //        info.PropId = item_id;
                //        info.Count = item_count;

                //        res.DropInfos.Add(info);
                //    }

                //    FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_GIFTRESULT);
                //    param.Param = res;
                //    EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);
                //}

                if (m_friend_list_view.Visible)
                {
                    SCDropResp res = new SCDropResp();

                    foreach (var item in rsp.PlayerPropMsg)
                    {
                        long item_id    = item.PropId;
                        int  item_count = item.Count;

                        DropInfo info = new DropInfo();
                        info.PropId = item_id;
                        info.Count  = item_count;

                        res.DropInfos.Add(info);
                    }

                    GameEvents.UIEvents.UI_GameEntry_Event.Listen_OnCombinePropCollected.SafeInvoke();

                    FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_GIFTRESULT);
                    param.Param = res;
                    EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);
                }
            }
            else if (s is SCFriendViewResponse)
            {
                var rsp = s as SCFriendViewResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                if (m_friend_detail_view.Visible)
                {
                    m_friend_detail_view.Refresh(rsp.PlayerFriendMsg, rsp.AchievementMsgs);
                    //m_friend_detail_view.Refresh(rsp.PlayerFriendMsg, new List<long>() { 1, 2, 3, 4, 5 });
                }
            }
            else if (s is SCFriendSwitchResponse)
            {
                var rsp = s as SCFriendSwitchResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }
            }
            else if (s is SCFriendRecommendGetResponse)
            {
                var rsp = s as SCFriendRecommendGetResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                m_friend_detail_view.Refresh(rsp.PlayerFriendMsg, rsp.AchievementMsgs);
                m_friend_detail_view.Visible = true;
            }
            else if (s is SCFriendRecommendListResponse)
            {
                var rsp = s as SCFriendRecommendListResponse;

                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                FriendDataManager.Instance.Recommends.Clear();

                FriendDataManager.Instance.Recommends.AddRange(rsp.Recommend);

                FriendDataManager.Instance.Recommend_expire_date = System.DateTime.Now.AddSeconds(rsp.TimeDown);

                m_recommend_view.Refresh();
            }
            else if (s is SCFriendRecommendApplyResponse)
            {
                var rsp = s as SCFriendRecommendApplyResponse;

                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }

                foreach (var item in rsp.RecommendId)
                {
                    var one_recommend = FriendDataManager.Instance.Recommends.Find((recommend) => recommend.RecommendId == item);
                    one_recommend.Status = (int)ENUM_RECOMMEND_STATUS.E_ADDED;
                    GameEvents.UIEvents.UI_Friend_Event.Tell_add_recommend_firend_ok.SafeInvoke(item);
                }

                var valids = FriendDataManager.Instance.Recommends.FindAll((item) => ENUM_RECOMMEND_STATUS.E_RECOMMEND == (ENUM_RECOMMEND_STATUS)item.Status);

                if (null == valids || 0 == valids.Count)
                {
                    m_recommend_view.Refresh();
                }
            }
            else
            {
                return;
            }

            FriendMsgCodeUtil.OnSuccess(s as IMessage);
        }
        public override void OnPackageRequest(IMessage imsg, params object[] msg_params)
        {
            base.OnPackageRequest(imsg, msg_params);

            if (imsg is CSFriendRequest)
            {
                FriendReqType   r_type = (FriendReqType)(msg_params[0]);
                CSFriendRequest req    = imsg as CSFriendRequest;
                req.Type = r_type;
            }
            else if (imsg is CSFriendAddRequest)
            {
                CSFriendAddRequest req = imsg as CSFriendAddRequest;
                req.PlayerId = (long)(msg_params[0]);
            }
            else if (imsg is CSFriendDelRequest)
            {
                CSFriendDelRequest req = imsg as CSFriendDelRequest;
                req.PlayerId = (long)(msg_params[0]);
            }
            else if (imsg is CSFriendAgreeRequest)
            {
                CSFriendAgreeRequest req = imsg as CSFriendAgreeRequest;
                req.PlayerId = (long)(msg_params[0]);
            }
            else if (imsg is CSFriendDelApplyRequest)
            {
                CSFriendDelApplyRequest req = imsg as CSFriendDelApplyRequest;
                req.FriendId = (long)(msg_params[0]);
            }
            else if (imsg is CSFriendGiftRequest)
            {
                CSFriendGiftRequest req = imsg as CSFriendGiftRequest;
            }
            else if (imsg is CSFriendGiftSendRequest)
            {
                CSFriendGiftSendRequest req = imsg as CSFriendGiftSendRequest;
                req.FriendId = (long)(msg_params[0]);
            }
            else if (imsg is CSFriendGiftDrawRequest)
            {
                CSFriendGiftDrawRequest req = imsg as CSFriendGiftDrawRequest;
                req.GiftId = (long)(msg_params[0]);
            }
            else if (imsg is CSFriendViewRequest)
            {
                CSFriendViewRequest req = imsg as CSFriendViewRequest;
                req.FriendId = (long)(msg_params[0]);
            }
            else if (imsg is CSFriendRecommendListRequest)
            {
            }
            else if (imsg is CSFriendRecommendGetRequest)
            {
                CSFriendRecommendGetRequest req = imsg as CSFriendRecommendGetRequest;
                req.RecommendId = (long)(msg_params[0]);
            }
            else if (imsg is CSFriendRecommendApplyRequest)
            {
                CSFriendRecommendApplyRequest req = imsg as CSFriendRecommendApplyRequest;
                req.RecommendId.AddRange((List <long>)(msg_params[0]));
            }
        }