示例#1
0
        private static void OnOpenGiftCallback(object obj)
        {
            MessageHandler.UnRegisterMessageHandler(MessageDefine.SCDropResp, OnOpenGiftCallback);
            //MessageHandler.UnRegisterMessageHandler(MessageDefine.SCAutoOpenGiftDropResp, OnOpenGiftCallback);
            if (obj is SCDropResp)
            {
                SCDropResp res = (SCDropResp)obj;

                foreach (var item in res.DropInfos)
                {
                    GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(item.PropId, item.Count);
                }

                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 (obj is SCAutoOpenGiftDropResp)
            //{
            //    SCAutoOpenGiftDropResp res = (SCAutoOpenGiftDropResp)obj;
            //    FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_GIFTRESULT);
            //    param.Param = res;
            //    EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);
            //}
        }
示例#2
0
        public override void OnShow(object param)
        {
            base.OnShow(param);

            GameEvents.UIEvents.UI_Bonus_Pop_View_Event.Tell_OnBlock.SafeInvoke(true);

            if (param == null)
            {
                return;
            }
            m_OK.AddClickCallBack(OnClick);
            m_spine.Visible = false;

            if (param is SCDropResp)
            {
                SCDropResp giftData = (SCDropResp)param;
                OnInitData(new List <DropInfo>(giftData.DropInfos));
                ShowProp();
            }
            else if (param is SCAutoOpenGiftDropResp)
            {
                SCAutoOpenGiftDropResp giftData = (SCAutoOpenGiftDropResp)param;
                OnInitData(new List <DropInfo>(giftData.DropInfos));
                ShowGift();
            }
            else if (param is ResultWindowData)
            {
                ResultWindowData windowData = param as ResultWindowData;
                OnInitResultData(windowData);
                ShowProp();
            }
        }
示例#3
0
        private void OnRes(object obj)
        {
            if (obj is PlayerPropSellResposne)
            {
                PlayerPropSellResposne res = (PlayerPropSellResposne)obj;
                WaveTipHelper.LoadWaveContent("Successful_sale");
                GlobalInfo.MY_PLAYER_INFO.ChangeCoin(m_bagData.prop.prop.price * m_curNum);
                GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(m_bagData.prop.prop.id, m_curNum);
                GameEvents.UIEvents.UI_Bag_Event.OnPropCost.SafeInvoke(m_bagData.prop.prop.id);
                EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_BAGUSE);
            }
            else if (obj is SCDropResp)
            {
                SCDropResp            res   = (SCDropResp)obj;
                FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_GIFTRESULT);
                param.Param = res;
                EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);
                OnSkillFinish(m_bagData.prop.prop.id);

                GameEvents.PlayerEvents.RequestLatestPlayerInfo.SafeInvoke();
            }
        }
示例#4
0
        private void OnResponse(object obj)
        {
            if (obj is SCPlayerCheckInInfoResp)
            {
                SCPlayerCheckInInfoResp res = (SCPlayerCheckInInfoResp)obj;
                if (res == null)
                {
                    EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_SIGNIN);
                    return;
                }
                m_data = res;
                GameEvents.UIEvents.UI_SignIn_Event.OnSignIn.SafeInvoke();
            }
            else if (obj is SCPlayerCheckInResp)
            {
                SCPlayerCheckInResp res = (SCPlayerCheckInResp)obj;
                if (res.Result == 1)
                {
                    SignInItemTable curItem = GetCurrentReward();
                    if (curItem != null)
                    {
                        //放在礼物展示页面,统一加入背包
                        GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(curItem.id, curItem.count);

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

                        SCDropResp dropRes  = new SCDropResp();
                        DropInfo   dropInfo = new DropInfo();
                        dropInfo.PropId = curItem.id;
                        dropInfo.Count  = curItem.count;
                        dropRes.DropInfos.Add(dropInfo);
                        FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_GIFTRESULT);
                        param.Param = dropRes;
                        EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);
                    }
                }
                EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_SIGNIN);
            }
        }
示例#5
0
        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);
        }