Ejemplo n.º 1
0
        /// <summary>
        /// 进入场景结果
        /// </summary>
        /// <param name="msgresponse"></param>
        private void OnEnterSceneResponse(object msgResponse)
        {
            SCSceneEnterResponse msg = msgResponse as SCSceneEnterResponse;

            if (!MsgStatusCodeUtil.OnError(msg.ResponseStatus))
            {
                int gameMode = (this.m_sceneData.playMode / 10000) % 10;
                if (this.m_currentScene != null)
                {
                    this.m_currentScene.DestroyScene();
                }

                LoadingProgressManager.Instance.LoadProgressScene();
                BigWorldManager.Instance.ClearBigWorld();
                //预加载音频
#if MP3
                EngineCoreEvents.ResourceEvent.PreloadAssetEvent.SafeInvoke(ConfSound.Get("Game_01").SoundPath, null);
#elif WAV
                //EngineCoreEvents.ResourceEvent.PreloadAssetEvent.SafeInvoke(ConfSound.Get("Game_01").WavPath, null);
#endif
                GameEvents.System_Events.PlayMainBGM(false);

                this.m_currentScene = SceneFactory.Instance.CreateScene((SceneMode)gameMode, (int)this.m_sceneData.id);
                (this.m_currentScene as GameSceneBase).InitScene(this.m_sceneData, (IList <long>)msg.SceneExhibits, (IList <long>)msg.TaskExhibits, (IList <long>)msg.OfficerIds, msg.Seconds);

                if (msg.IsDropScene)
                {
                    (this.m_currentScene as GameSceneBase).InitRandomOutput(msg.TaskExhibits.Count, msg.DropItems);
                }
            }
        }
Ejemplo n.º 2
0
        public override void OnScResponse(object s)
        {
            base.OnScResponse(s);

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

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

                if (false == rsp.Success)
                {
                    PopUpManager.OpenNormalOnePop(LocalizeModule.Instance.GetString("slots_luckTxt"));
                }
                else
                {
                    var raw_req          = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();
                    CSCombineRequest req = raw_req as CSCombineRequest;

                    m_view.RefreshCombinedPropCount(req.CombineId);
                }
            }
        }
        private void OnGameResumeResponse(object msg)
        {
            if (null == m_data)
            {
                DebugUtil.LogError("暂停菜单不知道是哪里调用的暂停");
                return;
            }

            if (ENUM_SEARCH_MODE.E_SEARCH_ROOM == m_data.m_mode)
            {
                SCSceneResumeResponse resumeMsg = msg as SCSceneResumeResponse;

                if (!MsgStatusCodeUtil.OnError(resumeMsg.Result))
                {
                    EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_GAME_MAIN_SETTING);
                    EngineCoreEvents.UIEvent.BlurUIBackground(false);
                    GameEvents.MainGameEvents.OnGameStatusChange.SafeInvoke(SceneBase.GameStatus.GAMING);
                }
            }
            else if (ENUM_SEARCH_MODE.E_JIGSAW == m_data.m_mode)
            {
                SCResumeResponse resumeMsg = msg as SCResumeResponse;
                if (!MsgStatusCodeUtil.OnError(resumeMsg.Result))
                {
                    EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_GAME_MAIN_SETTING);
                }
            }
        }
        private void OnGameQuitResponse(object msg)
        {
            if (null == m_data)
            {
                DebugUtil.LogError("暂停菜单不知道是哪里调用的暂停");
                return;
            }

            if (ENUM_SEARCH_MODE.E_SEARCH_ROOM == m_data.m_mode)
            {
                SCSceneQuitResponse quitGameResp = msg as SCSceneQuitResponse;

                if (!MsgStatusCodeUtil.OnError(quitGameResp.Result))
                {
                    GameEvents.SceneEvents.OnLeaveScene.SafeInvoke();
                    this.CloseFrame();
                    SceneModule.Instance.EnterMainScene();
                }
            }
            else if (ENUM_SEARCH_MODE.E_JIGSAW == m_data.m_mode)
            {
                SCQuitResponse quitGameResp = msg as SCQuitResponse;
                if (!MsgStatusCodeUtil.OnError(quitGameResp.Result))
                {
                    this.CloseFrame();
                }

                GameEvents.UIEvents.UI_GameEntry_Event.OnOpenPanel.SafeInvoke(UIDefine.UI_CITY);
            }
        }
Ejemplo n.º 5
0
        private void OnPushGiftRsp(object s)
        {
            if (s is SCGetPushResponse)
            {
                var rsp = s as SCGetPushResponse;

                List <Push_Info> infos = new List <Push_Info>();

                if (null == rsp.Infos || 0 == rsp.Infos.Count)
                {
                    m_login_push_infos = null;
                    return;
                }

                infos.AddRange(rsp.Infos);

                PushGiftManager.Instance.RefreshLoginPush(infos);
            }
            else if (s is SCBuyPushResponse)
            {
                var rsp = s as SCBuyPushResponse;

                if (!MsgStatusCodeUtil.OnError(rsp.ReponseStatus))
                {
#if UNITY_IOS && PLATFORM_ID
                    GameEvents.IAPEvents.Sys_BuyProductIOSEvent.SafeInvoke(ConfCharge.Get(ConfPush.Get(rsp.PushId).chargeid).chargeSouceId);
#else
                    GameEvents.IAPEvents.Sys_BuyProductEvent.SafeInvoke(ConfCharge.Get(ConfPush.Get(rsp.PushId).chargeid).id);
#endif
                }
            }
        }
Ejemplo n.º 6
0
        void OnScResponse(object 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;
                    FriendDataManager.Instance.Max_friend_num         = rsp.Limit;
                    FriendDataManager.Instance.Send_gift_left_num     = rsp.GiftCountLeft;
                }
                else if (FriendReqType.Addinfo == rsp.Type)
                {
                    FriendDataManager.Instance.Last_apply = false;
                }


                FriendDataManager.Instance.SetDatas(rsp.Friends, rsp.Type);
            }
            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);
            }
            else if (s is SCFriendGiftDrawResponse)
            {
                var rsp = s as SCFriendGiftDrawResponse;
                if (MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    return;
                }


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

                    GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(item_id, item_count);
                }
                GameEvents.PlayerEvents.RequestLatestPlayerInfo.SafeInvoke();
            }
        }
Ejemplo n.º 7
0
        public override void OnScResponse(object s)
        {
            base.OnScResponse(s);

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

                m_is_started = false;

                if (!MsgStatusCodeUtil.OnError(rsp.Result))
                {
                    this.RefreshCostItemNum();

                    Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                    {
                        { UBSParamKeyName.Success, 1 },
                        { UBSParamKeyName.SceneID, this.m_scene_id },
                        { UBSParamKeyName.ContentID, ConfJigsawScene.Get(this.m_scene_id).sceneInfoId },
                    };
                    UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.Pintu_begin, null, _params);

                    FrameMgr.OpenUIParams ui_param = new FrameMgr.OpenUIParams(UIDefine.UI_JIGSAW);

                    ui_param.Param = new List <long> {
                        this.m_scene_id, ConfJigsawScene.Get(this.m_scene_id).sceneInfoId
                    };

                    EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(ui_param);

                    this.CloseFrame();
                    EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_CHAPTER);
                }
                else
                {
                    //#if UNITY_DEBUG
                    //                    FrameMgr.OpenUIParams ui_param = new FrameMgr.OpenUIParams(UIDefine.UI_JIGSAW);

                    //                    ui_param.Param = new List<long> { this.m_scene_id, ConfJigsawScene.Get(this.m_scene_id).sceneInfoId };

                    //                    EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(ui_param);

                    //                    this.CloseFrame();
                    //                    EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_CHAPTER);
                    //#else

                    Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                    {
                        { UBSParamKeyName.Success, 0 },
                        { UBSParamKeyName.Description, rsp.Result },
                        { UBSParamKeyName.SceneID, this.m_scene_id },
                        { UBSParamKeyName.ContentID, ConfJigsawScene.Get(this.m_scene_id).sceneInfoId },
                    };
                    UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.Pintu_begin, null, _params);
                    //#endif
                }
            }
        }
Ejemplo n.º 8
0
        private void OnReconnectResponse(object messageResponse)
        {
            SCSceneReconnectResponse msg = messageResponse as SCSceneReconnectResponse;

            if (!MsgStatusCodeUtil.OnError(msg.ResponseStatus))
            {
                OnReconnectResponse();
            }
        }
Ejemplo n.º 9
0
        private void OnReconnectResponse(object messageResponse)
        {
            SCSceneReconnectResponse msg = messageResponse as SCSceneReconnectResponse;

            if (!MsgStatusCodeUtil.OnError(msg.ResponseStatus))
            {
                GameEvents.MainGameEvents.OnGameStatusChange.SafeInvoke(SceneBase.GameStatus.GAMING);
            }
        }
Ejemplo n.º 10
0
 private void OnRes(object obj)
 {
     if (obj is SCBuildingUnlockResp)
     {
         SCBuildingUnlockResp res = obj as SCBuildingUnlockResp;
         if (!MsgStatusCodeUtil.OnError(res.ResponseStatus))
         {
             GlobalInfo.MY_PLAYER_INFO.ChangeCash(-m_confBuild.cash);
             GlobalInfo.MY_PLAYER_INFO.ChangeCoin(-m_confBuild.coin);
             GameEvents.BigWorld_Event.OnUnLock.SafeInvoke(m_confBuild.lockResource);
             EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_UNLOCK);
         }
     }
 }
Ejemplo n.º 11
0
        private void OnScResponse(object s)
        {
            if (s is SCSceneEnterResponse)
            {
                SCSceneEnterResponse msg = s as SCSceneEnterResponse;
                if (!MsgStatusCodeUtil.OnError(msg.ResponseStatus))
                {
                    Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                    {
                        { UBSParamKeyName.Success, 1 },
                        { UBSParamKeyName.SceneID, this.Scene_id }
                    };
                    UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.game_begin, null, _params);

                    GameEvents.PlayerEvents.RequestLatestPlayerInfo.SafeInvoke();
                    EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_CHAPTER);

                    m_enter_msg = msg;

                    this.CloseFrame();
                }
                else
                {
                    if (MsgStatusCodeUtil.VIT_OUT == msg.ResponseStatus.Code)
                    {
                        Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                        {
                            { UBSParamKeyName.Success, 0 },
                            { UBSParamKeyName.Description, UBSDescription.NOT_ENOUGH_VIT },
                            { UBSParamKeyName.SceneID, this.Scene_id }
                        };
                        UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.game_begin, null, _params);
                    }
                    else
                    {
                        Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                        {
                            { UBSParamKeyName.Success, 0 },
                            { UBSParamKeyName.Description, msg.ResponseStatus.Code },
                            { UBSParamKeyName.SceneID, this.Scene_id }
                        };
                        UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.game_begin, null, _params);
                    }

                    this.m_action_btn.Enable = true;
                    m_is_action_btn_touched  = false;
                    this.m_action_btn.Enable = true;
                }
            }
        }
Ejemplo n.º 12
0
        private void OnResponse(object obj)
        {
            if (obj is SCAchievementResponse)
            {
                SCAchievementResponse res = (SCAchievementResponse)obj;

                if (!MsgStatusCodeUtil.OnError(res.Status))
                {
                    Data = res;
                }
                else
                {
                    Data = null;
                }
            }
        }
Ejemplo n.º 13
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;
                }
            }
        }
Ejemplo n.º 14
0
        private void OnResponse(object obj)
        {
            if (obj is SCCartoonEnterResponse)
            {
                SCCartoonEnterResponse res = obj as SCCartoonEnterResponse;
                if (!MsgStatusCodeUtil.OnError(res.Result))
                {
                    Dictionary <UBSParamKeyName, object> enterSceneFromChapterMapDict = new Dictionary <UBSParamKeyName, object>();
                    enterSceneFromChapterMapDict.Add(UBSParamKeyName.EnterSceneFromChapter, this.ContextId);
                    UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.carton_star, null, enterSceneFromChapterMapDict);

                    FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_COMICS_1);
                    param.Param = ConfCartoonScene.Get(ContextId).sceneInfoIds[0];
                    EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);
                }
            }
        }
Ejemplo n.º 15
0
        public override void OnScResponse(object s)
        {
            base.OnScResponse(s);

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

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


                m_reward_vit_num = rsp.Vit;
            }
        }
Ejemplo n.º 16
0
        void OnInfoChanged(long player_id_, ENUM_INFO_CONTROL val_)
        {
            if (ENUM_INFO_CONTROL.E_DEL == val_)
            {
                FriendDataManager.Instance.RemoveData(player_id_, FriendReqType.Added);
#if TEST
                this.m_friend_list_view.Refresh(FriendReqType.Added);
#else
                RequestDelFriend(player_id_);
#endif
            }
            else if (ENUM_INFO_CONTROL.E_DETAIL == val_)
            {
#if TEST
                this.SwitchUI(ENUM_FRIEND_VIEW_TYPE.E_FRIEND_DETAIL);
                this.m_friend_detail_view.Refresh(FriendDataManager.Instance.GetData(player_id_, FriendReqType.Addinfo));
#else
                this.SwitchUI(ENUM_FRIEND_VIEW_TYPE.E_FRIEND_DETAIL);
                RequestDetail(player_id_);
#endif
            }
            else if (ENUM_INFO_CONTROL.E_GIFT == val_)
            {
                if (FriendDataManager.Instance.Send_gift_left_num > 0)
                {
                    FriendDataManager.Instance.GetData(player_id_, FriendReqType.Added).Gift = false;
#if !TEST
                    RequestSendGift(player_id_);
#endif
                }
                else
                {
                    if (this.m_friend_list_view.Visible)
                    {
                        this.m_friend_list_view.Refresh(FRIEND_UI_TOGGLE_TYPE.Added);
                    }

                    ResponseStatus status = new ResponseStatus();
                    status.Code = MsgStatusCodeUtil.FRIEND_GIFT_LIMIT;

                    MsgStatusCodeUtil.OnError(status);
                }
            }
        }
Ejemplo n.º 17
0
        protected override void OnBuyPropResponse(object buyResultMsg)
        {
            MessageHandler.UnRegisterMessageHandler(MessageDefine.MarkeBuyResponse, OnBuyPropResponse);
            MarkeBuyResponse resp = buyResultMsg as MarkeBuyResponse;

            if (!MsgStatusCodeUtil.OnError(resp.ResponseStatus))
            {
                if (resp.Props != null || resp.Props.Count > 0)
                {
                    long itemID = resp.Props.PropId;
                    //int itemNum = resp.Props.Count;

                    //GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(itemID, itemNum);

                    (LogicHandler as ShopEnergyUILogic).RefreshItemCount(itemID, 0);
                }
            }
            Visible = false;
        }
        private void OnBuyPropResponse(object res)
        {
            MessageHandler.UnRegisterMessageHandler(MessageDefine.MarkeBuyResponse, OnBuyPropResponse);
            MarkeBuyResponse marketItem = (MarkeBuyResponse)res;

            if (!MsgStatusCodeUtil.OnError(marketItem.ResponseStatus))
            {
                if (this.m_itemRes.MarketItems.CostType == CostType.CostCash)
                {
                    GlobalInfo.MY_PLAYER_INFO.ChangeCash(-this.m_itemRes.MarketItems.Cost);
                }
                else if (this.m_itemRes.MarketItems.CostType == CostType.CostCoin)
                {
                    GlobalInfo.MY_PLAYER_INFO.ChangeCoin(-this.m_itemRes.MarketItems.Cost);
                }
                GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(4, 1);

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

                OnUseProp();
            }
        }
        /// <summary>
        /// 局内道具购买回调
        /// </summary>
        /// <param name="buyResultMsg"></param>
        protected virtual void OnBuyPropResponse(object buyResultMsg)
        {
            MessageHandler.UnRegisterMessageHandler(MessageDefine.MarkeBuyResponse, OnBuyPropResponse);
            MarkeBuyResponse resp = buyResultMsg as MarkeBuyResponse;

            if (!MsgStatusCodeUtil.OnError(resp.ResponseStatus))
            {
                if (resp.Props != null || resp.Props.Count > 0)
                {
                    long itemID  = resp.Props.PropId;
                    int  itemNum = resp.Props.Count;

                    GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(itemID, itemNum);

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

                    (LogicHandler as GameMainUILogic).RefreshPlayerPropItems();
                    (LogicHandler as GameMainUILogic).UseItemAfterBuy(itemID);

                    {
                        Dictionary <UBSParamKeyName, object> internalBuyItemKeypoint = new Dictionary <UBSParamKeyName, object>();
                        internalBuyItemKeypoint.Add(UBSParamKeyName.Description, UBSDescription.PROPBUY);
                        internalBuyItemKeypoint.Add(UBSParamKeyName.PropItem_ID, itemID);
                        internalBuyItemKeypoint.Add(UBSParamKeyName.PropItem_Num, itemNum);
                        UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.game_propbuy, itemNum, internalBuyItemKeypoint);
                    }

                    if (4 == itemID)
                    {
                        ((GameMainUILogic)LogicHandler).Buy_time_prop_count += itemNum;
                    }
                }
            }
            GameEvents.UIEvents.UI_Pause_Event.OnClosePauseFrame.SafeInvoke();
            if (CachedVisible)
            {
                Visible = false;
            }
        }
Ejemplo n.º 20
0
 private void OnResponse(object obj)
 {
     if (obj is SCPlayerRenewIconResp && cartoonType == GuidStartCartoonType.HEAD)
     {
         SCPlayerRenewIconResp res = (SCPlayerRenewIconResp)obj;
         if (res.Result == 1)
         {
             //GameEvents.UI_Guid_Event.OnStartGuidCartoonNext.SafeInvoke();
         }
         else
         {
             Debug.LogError("change head icon error");
         }
     }
     else if (obj is SCRenameResponse)
     {
         SCRenameResponse res = (SCRenameResponse)obj;
         if (res.Result == 3 || !MsgStatusCodeUtil.OnError(res.Result))
         {
             GlobalInfo.MY_PLAYER_INFO.PlayerNickName = res.NewName;
             PlayerInfoManager.OnPlayerInfoUpdatedEvent(GlobalInfo.MY_PLAYER_INFO);
         }
     }
 }
Ejemplo n.º 21
0
        private void DoRspVerifyTransaction(object msg_)
        {
            if (msg_ is SCGooglePayChargeResponse)
            {
                var rsp = msg_ as SCGooglePayChargeResponse;

                if (!MsgStatusCodeUtil.OnError(rsp.ResponseStatus))
                {
                    Debugger.Log("UNITY IAP purchase rsp product id = " + rsp.ProductId);

                    EngineCoreEvents.AudioEvents.PlayAudio.SafeInvoke(Audio.AudioType.UISound, GameCustomAudioKey.buy_cash_success.ToString());

                    ConfCharge good = (!string.IsNullOrEmpty(rsp.ProductId) && !string.IsNullOrWhiteSpace(rsp.ProductId)) ? IAPTools.GetGoodsByPlatformID(rsp.ProductId) : null;

                    long charge_id = null != good ? good.id : 0L;

                    if (0 == charge_id)
                    {
                        TransactionTips(LocalizeModule.Instance.GetString("submit_ok"), false);
                        return;
                    }

                    Debugger.Log("UNITY IAP purchase rsp charge id = " + charge_id);
                    IAPTools.instance.RspVerifyTransaction(charge_id);

                    string good_desc = LocalizeModule.Instance.GetString(good.desc);

                    Debugger.Log("UNITY IAP in transction done charge_id = " + charge_id);

                    GameEvents.NetWorkEvents.SendAsyncMsg.SafeInvoke(new CSPlayerInfoRequest());

                    TransactionTips(good_desc, true);

                    GameEvents.IAPEvents.OnTransactionDone.SafeInvoke(charge_id);

                    long giftID = CommonHelper.GetGiftID(charge_id);
                    if (giftID > 0)
                    {
                        //CommonHelper.OpenGift(giftID, 1);
                    }
                }
                else
                {
                    Debugger.LogError("UNITY IAP error transction done product id = " + rsp.ProductId);

                    ConfCharge good = (!string.IsNullOrEmpty(rsp.ProductId) && !string.IsNullOrWhiteSpace(rsp.ProductId)) ? IAPTools.GetGoodsByPlatformID(rsp.ProductId) : null;

                    if (null != good)
                    {
                        string good_desc = LocalizeModule.Instance.GetString(good.desc);

                        TransactionTips(good_desc, false);

                        IAPTools.instance.RspVerifyTransaction(good.id);
                    }
                    else
                    {
                        var pair_req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();

                        if (pair_req is CSGooglePayChargeRequest)
                        {
                            CSGooglePayChargeRequest req_wrapper = pair_req as CSGooglePayChargeRequest;
                            string charge_id = req_wrapper.ProductId;

                            good = ConfCharge.Get(long.Parse(charge_id));

                            if (null != good)
                            {
                                string good_desc = LocalizeModule.Instance.GetString(good.desc);

                                TransactionTips(good_desc, false);

                                IAPTools.instance.RspVerifyTransaction(good.id);
                            }
                        }
                    }
                }
            }
            else if (msg_ is SCIOSPayChargeResponse)
            {
                var rsp = msg_ as SCIOSPayChargeResponse;

                Debugger.Log("UNITY IAP purchase rsp platform id = " + rsp.ProductId);


                if (!MsgStatusCodeUtil.OnError(rsp.ResponseStatus))
                {
                    EngineCoreEvents.AudioEvents.PlayAudio.SafeInvoke(Audio.AudioType.UISound, GameCustomAudioKey.buy_cash_success.ToString());

                    ConfCharge good = (!string.IsNullOrEmpty(rsp.ProductId) && !string.IsNullOrWhiteSpace(rsp.ProductId)) ? IAPTools.GetGoodsByPlatformID(rsp.ProductId) : null;

                    long charge_id = null != good ? good.id : 0L;

                    if (0 == charge_id)
                    {
                        TransactionTips(LocalizeModule.Instance.GetString("submit_ok"), false);
                        return;
                    }

                    Debugger.Log("UNITY IAP purchase rsp charge id = " + charge_id);
                    IAPTools.instance.RspVerifyTransaction(charge_id);

                    string good_desc = LocalizeModule.Instance.GetString(good.desc);


                    Debugger.Log("in transction done charge_id = " + charge_id);

                    GameEvents.NetWorkEvents.SendAsyncMsg.SafeInvoke(new CSPlayerInfoRequest());

                    TransactionTips(good_desc, true);

                    GameEvents.IAPEvents.OnTransactionDone.SafeInvoke(charge_id);

                    //long giftID = CommonHelper.GetGiftID(charge_id);
                    //if (giftID > 0)
                    //{
                    //    var gifts = PushGiftManager.Instance.GetPushInfosByTurnOnType(ENUM_PUSH_GIFT_BLOCK_TYPE.E_LOGIN);

                    //    if( null != gifts && gifts.Count > 0)
                    //    {
                    //        foreach( var gift in gifts)
                    //        {
                    //            if( giftID ==  gift.PushId )
                    //            {
                    //                gift.Buyed = true;
                    //            }

                    //        }
                    //    }
                    //    //CommonHelper.OpenGift(giftID, 1);
                    //}
                }
                else
                {
                    Debugger.LogError("UNITY IAP error transction done product id = " + rsp.ProductId);


                    ConfCharge good = (!string.IsNullOrEmpty(rsp.ProductId) && !string.IsNullOrWhiteSpace(rsp.ProductId)) ? IAPTools.GetGoodsByPlatformID(rsp.ProductId) : null;

                    if (null != good)
                    {
                        string good_desc = LocalizeModule.Instance.GetString(good.desc);

                        TransactionTips(good_desc, false);

                        IAPTools.instance.RspVerifyTransaction(good.id);
                    }
                    else
                    {
                        var pair_req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();

                        if (pair_req is CSIOSPayChargeRequest)
                        {
                            CSIOSPayChargeRequest req_wrapper = pair_req as CSIOSPayChargeRequest;
#if UNITY_IOS && PLATFROM_ID
                            string platform_unique_id = req_wrapper.ProductId;
                            Debug.Log("失败交易商品 platform unique id " + platform_unique_id);
                            good = IAPTools.GetGoodsByPlatformID(platform_unique_id);
#else
                            string charge_id = req_wrapper.ProductId;
                            Debug.Log("失败交易商品 charge id " + charge_id);
                            good = ConfCharge.Get(long.Parse(charge_id));
#endif
                            if (null != good)
                            {
                                string good_desc = LocalizeModule.Instance.GetString(good.desc);

                                Debug.Log("失败交易商品 " + good_desc);

                                TransactionTips(good_desc, false);

                                IAPTools.instance.RspVerifyTransaction(good.id);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 22
0
        private void OnSCGameCurrencyResponse(object msgResponse)
        {
            Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
            {
                { UBSParamKeyName.TotalTime, ((GameSceneBase)CurrentScene).GetElapseTime() },
                { UBSParamKeyName.Error_Times, ((GameSceneBase)CurrentScene).TotalErrorTimes },
                { UBSParamKeyName.Punish_Times, ((GameSceneBase)CurrentScene).GetPunishTime() },
            };

            UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.game_time, null, _params);


            SCSceneRewardResponse _msg = msgResponse as SCSceneRewardResponse;

            TimeModule.Instance.SetTimeout(() =>
            {
                if (!MsgStatusCodeUtil.OnError(_msg.ResponseStatus))
                {
                    if (0 == _msg.UpLevelRewards.Count)
                    {
                        WinFailData data = new WinFailData(ENUM_SEARCH_MODE.E_SEARCH_ROOM, _msg);

                        FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_WIN);

                        param.Param = data;

                        EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);

                        Dictionary <UBSParamKeyName, object> _param = new Dictionary <UBSParamKeyName, object>();
                        _param.Add(UBSParamKeyName.Success, _msg.SceneId > 0 ? 1 : 0);
                        _param.Add(UBSParamKeyName.SceneID, SceneModule.Instance.SceneData.id);
                        UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.game_finish, _msg.SceneId > 0 ? 1 : 0, _param);

                        if (_msg.SceneId < 0)
                        {
                            //PushGiftManager.Instance.TurnOn(ENUM_PUSH_GIFT_BLOCK_TYPE.E_SEEK);
                        }
                    }
                    else
                    {
                        SceneLevelUpData data = new SceneLevelUpData()
                        {
                            msg         = _msg,
                            m_click_act = null,
                        };

                        FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_SCENE_LEVEL_UP);
                        param.Param = data;

                        EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);
                    }
                }
                else
                {
                    SCSceneRewardResponse rsp = new SCSceneRewardResponse();
                    rsp.SceneId                 = -1;
                    WinFailData data            = new WinFailData(ENUM_SEARCH_MODE.E_SEARCH_ROOM, rsp);
                    FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_WIN);
                    param.Param                 = data;
                    EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);

                    Dictionary <UBSParamKeyName, object> _param = new Dictionary <UBSParamKeyName, object>();
                    _param.Add(UBSParamKeyName.Success, 0);
                    _param.Add(UBSParamKeyName.Description, _msg.ResponseStatus.Code);
                    _param.Add(UBSParamKeyName.SceneID, SceneModule.Instance.SceneData.id);
                    UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.game_finish, null, _param);

                    //PushGiftManager.Instance.TurnOn(ENUM_PUSH_GIFT_BLOCK_TYPE.E_SEEK);
                }
            }, 2.5f);
        }
Ejemplo n.º 23
0
        private void OnScResponse(object s)
        {
            if (s is SCRegGuestResponse)
            {
                DebugUtil.Log("receive SCRegGuestResponse");

                var rsp = s as SCRegGuestResponse;

                if (!MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    RecordGuestIdytifier(rsp.GuestIdentify);
                    DebugUtil.Log("GuestIdentify:" + rsp.GuestIdentify);
                    LoginUtil.RequestCheckToken(rsp.GuestIdentify);
                }
                else
                {
                    OccurEror();
                }
            }
            else if (s is SCIdentifyCheckMuiltyMessage)
            {
                var rsp = s as SCIdentifyCheckMuiltyMessage;

                if (!MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    for (int i = 0; i < rsp.Contents.Count; ++i)
                    {
                        IdentifyCheckResponseContent pingResponseContent = rsp.Contents[i];
                        byte[] messageContentBytes = Convert.FromBase64String(pingResponseContent.Data);

                        IMessage message = EngineCore.MessageParser.Parse(pingResponseContent.MsgId, messageContentBytes);

                        MessageHandler.Call(pingResponseContent.MsgId, message);
                    }
                }
                else
                {
                    OccurEror();
                }
            }
            else if (s is SCIdentifyCheckRepsonse)
            {
                var rsp = s as SCIdentifyCheckRepsonse;

                is_token_checked = true;
                if (!MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    Debug.Log("access token = " + rsp.AccessToken);
                    LoginUtil.RecordToken(rsp.AccessToken);

                    //RequestPlayerInfo();
                }
                else
                {
                    OccurEror();
                }
            }
            else if (s is SCPlayerInfoResponse)
            {
                if (is_token_checked)
                {
                    var rsp = s as SCPlayerInfoResponse;


                    GameEvents.UI_Guid_Event.OnClearGuid.SafeInvoke();
                    CommonBonusPopViewMgr.Instance.ClearBonus();

                    GlobalInfo.MY_PLAYER_ID = rsp.PlayerId;
#if UNITY_EDITOR || UNITY_DEBUG
                    UBSBaseData.m_player_id = "fotoable " + GlobalInfo.MY_PLAYER_ID.ToString();
#else
                    UBSBaseData.m_player_id = GlobalInfo.MY_PLAYER_ID.ToString();
#endif

#if OFFICER_SYS
                    PoliceDispatchManager.Instance.Load();
#endif

                    DebugUtil.Log("PlayerId:" + rsp.PlayerId);

                    PlayerInfo info = new PlayerInfo(rsp.PlayerId);

                    info.SetCash(rsp.Cash).SetCoin(rsp.Coin).SetExp(rsp.Exp).SetExpMultiple(rsp.ExpMultiple)
                    .SetIcon(rsp.PlayerIcon).SetLaborUnionn(rsp.LaborUnion)
                    .SetLevel(rsp.Level).SetUpgradeExp(rsp.UpgradeExp).SetVit(rsp.Vit);

                    info.PlayerNickName = rsp.PlayerName;
                    info.HasRenamed     = rsp.HasRenamed > 1;

                    PlayerInfoManager.Instance.AddPlayerInfo(rsp.PlayerId, info);
                    CommonData.MillisRecoverOneVit = (rsp.MillisRecoverOneVit / 1000) + 1;
                    VitManager.Instance.SetLastAddVitTime(rsp.LastAddVitTime);
                    VitManager.Instance.ReflashInfiniteVitTime(rsp.InfiniteVitRestTime);
                    DebugUtil.Log("个人信息下载完成");

                    //请求新手引导数据
                    //CSPlayerGuildRequest guidReq = new CSPlayerGuildRequest();
                    //GameEvents.NetWorkEvents.SendAsyncMsg.SafeInvoke(guidReq);
                }

                PlayerInfoManager.Instance.Sync();
            }
            else if (s is SCPlayerGuildResponse)
            {
                SCPlayerGuildResponse res = (SCPlayerGuildResponse)s;
                SeekerGame.NewGuid.GuidNewManager.Instance.SyncProgress(int.Parse(res.Guild));
            }
            else if (s is SCGetPushResponse)
            {
                var rsp = s as SCGetPushResponse;

                if (rsp.Infos.Count > 0)
                {
                    PushGiftManager.Instance.Cache(ENUM_PUSH_GIFT_BLOCK_TYPE.E_LOGIN);
                    GameEvents.UIEvents.UI_Bonus_Pop_View_Event.Tell_OnCache.SafeInvoke(EUNM_BONUS_POP_VIEW_TYPE.E_PUSH_GIFT);
                }

                CommonHelper.ShowLoading(false);
                GameRoot.instance.GameFSM.GotoState((int)ClientFSM.ClientState.NORMAL);
            }
            else if (s is SCFBLoginResponse)
            {
                DebugUtil.Log("receive SCFBLoginResponse");

                var rsp = s as SCFBLoginResponse;

                if (!MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    LoginUtil.UseThirdAccount(rsp.Identify);
                }
                else
                {
                    TokenError(rsp.Status);
                    OccurEror();
                }
            }
            else if (s is SCFBBindResponse)
            {
                DebugUtil.Log("receive SCFBBindResponse");
                OccurOK();

                var rsp = s as SCFBBindResponse;

                if (!MsgStatusCodeUtil.OnError(rsp.Status))
                {
                    if (rsp.HasBeenBinded)
                    {
                        BindPromoptData data = new BindPromoptData();
                        data.m_icon_name = rsp.Icon;
                        data.m_lvl       = rsp.Level;
                        data.m_name      = rsp.Name;
                        data.m_user_id   = rsp.Id;
                        data.m_identify  = rsp.Identify;
                        data.m_OnOK      = () => { CommonHelper.ShowLoading(true); m_is_start_timer = true; LoginUtil.UseThirdAccount(rsp.Identify); };

                        BindHelper.ShowBindPromoptView(data);
                    }
                    else
                    {
                        BindRewardData data = new BindRewardData();
                        data.m_count = rsp.CashCount;
                        data.m_OnOK  = () => { CommonHelper.ShowLoading(true); m_is_start_timer = true; LoginUtil.UseThirdAccount(rsp.Identify); };

                        BindHelper.ShowBindRewardView(data);
                    }

                    UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.user_account);
                }
                else
                {
                    TokenError(rsp.Status);
                    OccurEror();
                }
            }
        }
Ejemplo n.º 24
0
        public override void OnScResponse(object s)
        {
            base.OnScResponse(s);



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

                if (!MsgStatusCodeUtil.OnError(rsp.ResponseStatus))
                {
                    this.CloseFrame();

                    if (!MsgStatusCodeUtil.OnError(rsp.ResponseStatus))
                    {
                        WinFailData data = new WinFailData(ENUM_SEARCH_MODE.E_EVENTGAME, rsp);


                        FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_WIN);


                        param.Param = data;

                        EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);


                        Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                        {
                            { UBSParamKeyName.ContentID, EventGameManager.Instance.Event_id },
                            { UBSParamKeyName.Success, rsp.Valuation },
                        };
                        UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.event_finish, null, _params);

                        if (0 == rsp.Valuation)
                        {
                            //PushGiftManager.Instance.TurnOn(ENUM_PUSH_GIFT_BLOCK_TYPE.E_EVENT);
                        }
                    }
                    else
                    {
                        rsp.Valuation = 0;
                        rsp.Rewards.Clear();

                        WinFailData           data  = new WinFailData(ENUM_SEARCH_MODE.E_EVENTGAME, rsp);
                        FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_WIN);
                        param.Param = data;

                        EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);


                        Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                        {
                            { UBSParamKeyName.ContentID, EventGameManager.Instance.Event_id },
                            { UBSParamKeyName.Success, 0 },
                            { UBSParamKeyName.Description, rsp.ResponseStatus.Code }
                        };
                        UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.event_finish, null, _params);

                        //PushGiftManager.Instance.TurnOn(ENUM_PUSH_GIFT_BLOCK_TYPE.E_EVENT);
                    }
                }
            }
        }
Ejemplo n.º 25
0
        void OnScResponse(object s)
        {
            if (s is SCCombineInfoResponse)
            {
                var rsp = s as SCCombineInfoResponse;

                m_dict.Clear();

                var combine_ids = from id in rsp.CombineId
                                  select id;
                var combine_ids_list = combine_ids.ToList();

                var cur_counts = from count in rsp.Count
                                 select count;
                var cur_counts_list = cur_counts.ToList();

                for (int i = 0; i < combine_ids_list.Count() && i < cur_counts_list.Count(); ++i)
                {
                    m_dict.Add(combine_ids_list[i], cur_counts_list[i]);
                }
            }
            else if (s is SCCombineResponse)
            {
                var rsp = s as SCCombineResponse;

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

                if (false == rsp.Success)
                {
                    return;
                }

                var raw_req          = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();
                CSCombineRequest req = raw_req as CSCombineRequest;

                if (0 != ConfCombineFormula.Get(req.CombineId).mixLimit)
                {
                    AddCurCount(req.CombineId);
                }

                var combine = ConfCombineFormula.Get(req.CombineId);
                GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(combine.outputId, combine.outputCount);

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

                //扣除合成消耗的材料
                GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.propId1);
                GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.propId2);
                GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.propId3);
                GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.propId4);
                GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.propId5);

                GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.specialPropId1, combine.special1Count);
                GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.specialPropId2, combine.special2Count);
                GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.specialPropId3, combine.special3Count);
                GlobalInfo.MY_PLAYER_INFO.ReducePropForBag(combine.specialPropId4, combine.special4Count);


                //if (ENUM_COMBINE_TYPE.POLICE == (ENUM_COMBINE_TYPE)combine.type)
                //{
                //    //出勤卡,进背包
                //}
                //else if (ENUM_COMBINE_TYPE.OTHER == (ENUM_COMBINE_TYPE)combine.type)
                //{
                //    //道具,进背包
                //    GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(combine.outputId, combine.outputCount);
                //}
                //else if (ENUM_COMBINE_TYPE.COLLECTION == (ENUM_COMBINE_TYPE)combine.type)
                //{
                //    //物件,进储藏室

                //}
            }
        }
Ejemplo n.º 26
0
 private void OnServerError(int errorCode, string errorContent)
 {
     MsgStatusCodeUtil.OnError(errorCode);
 }
Ejemplo n.º 27
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);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 交任务相应
        /// </summary>
        /// <param name="message"></param>
        private void OnCommitTask(object message)
        {
            SCTaskCommitResponse msg = message as SCTaskCommitResponse;

            if (!MsgStatusCodeUtil.OnError(msg.Result))
            {
                TaskBase commitTaskInfo = this.m_playerTaskSet.GetTaskById(msg.TaskId);
                if (commitTaskInfo == null)
                {
                    Debug.LogError($"commit task :{msg.TaskId} not found");
                }
                GameEvents.TaskEvents.OnReceiveTask.SafeInvoke(commitTaskInfo);

                GameEvents.PlayerEvents.OnExpChanged.SafeInvoke(null, msg.Exp);

                commitTaskInfo.TaskCurrentStatus = TaskStatus.REWARDED;
                commitTaskInfo.TaskSyncStatus    = TaskSyncStatus.SYNCED;

                if (this.m_currentTaskList.Contains(commitTaskInfo))
                {
                    this.m_currentTaskList.Remove(commitTaskInfo);
                }

                //同步玩家最新信息
                GameEvents.PlayerEvents.RequestLatestPlayerInfo.SafeInvoke();

                //同步背包
                //GlobalInfo.MY_PLAYER_INFO.SyncPlayerBag();
                NormalTask taskInfo = commitTaskInfo as NormalTask;
                for (int i = 0; i < taskInfo.RewardList.Count; ++i)
                {
                    TaskRewardBase taskReward     = taskInfo.RewardList[i];
                    TaskRewardMode taskRewardType = (taskReward.GetType().GetCustomAttributes(typeof(TaskRewardAttribute), true)[0] as TaskRewardAttribute).RewardMode;

                    if (TaskRewardMode.ITEM == taskRewardType)
                    {
                        TaskRewardItem     rewardItem     = taskReward as TaskRewardItem;
                        RewardItemDataWrap rewardItemData = rewardItem.RewardData;

                        if (RewardItemType.ITEM == rewardItemData.ItemType)
                        {
                            GlobalInfo.MY_PLAYER_INFO.AddSingleBagInfo(rewardItemData.ItemID, rewardItemData.ItemNum);
                        }
                    }
                }

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

                BigWorldManager.Instance.EnterBigWorld();
                GameEvents.TaskEvents.OnCompletedTask.SafeInvoke(msg.Result, commitTaskInfo);

                HttpPingModule.Instance.SendPing();

                //TODO : 放在主界面onshow
                //if (C_FIRST_TASK_ID == commitTaskInfo.TaskConfID)
                //{
                //    SignInManager sm = new SignInManager();
                //}
            }
            else
            {
                GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(1);
            }
        }
Ejemplo n.º 29
0
        private void OnRes(object obj)
        {
            if (obj is SCChatFinishResponse)
            {
                SCChatFinishResponse res = (SCChatFinishResponse)obj;
                if (res.Status == null)
                {
                    var req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();
                    CSChatFinishRequest req_msg = req as CSChatFinishRequest;
                    long chat_id = req_msg.ChatId;

                    foreach (var task in m_currentTaskList)
                    {
                        NormalTask taskInfo = task as NormalTask;

                        if (taskInfo.CompleteConditionList.Count > 1 || 0 == taskInfo.CompleteConditionList.Count)
                        {
                            continue;
                        }

                        TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0];
                        TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute;

                        if (TaskCompleteMode.CompletedByDialog != taskCompleteAttribute.CompleteMode)
                        {
                            continue;
                        }

                        long task_dialog_id = (long)taskCompleteCondition.TaskCompleteData;

                        if (chat_id != task_dialog_id)
                        {
                            continue;
                        }

                        taskInfo.TaskCurrentStatus = TaskStatus.COMPLETED;
                    }

                    GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(this.m_currentTaskList.Count);
                }
            }
            else if (obj is SCCombineResponse)
            {
                SCCombineResponse res = (SCCombineResponse)obj;
                if (res.Success)
                {
                    var req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();
                    CSCombineRequest req_msg      = req as CSCombineRequest;
                    long             combine_id   = req_msg.CombineId;
                    long             prop_id      = ConfCombineFormula.Get(combine_id).outputId;
                    bool             tsk_finished = false;
                    foreach (var task in m_currentTaskList)
                    {
                        NormalTask taskInfo = task as NormalTask;

                        if (taskInfo.CompleteConditionList.Count > 1 || 0 == taskInfo.CompleteConditionList.Count)
                        {
                            continue;
                        }

                        TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0];
                        TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute;

                        if (TaskCompleteMode.CompleteByCombinePropID != taskCompleteAttribute.CompleteMode)
                        {
                            continue;
                        }
                        long[] all_tsk_combine_prop_id = (long[])taskCompleteCondition.TaskCompleteData;

                        if (0 == all_tsk_combine_prop_id.Length)
                        {
                            Debug.LogError($"合成任务{taskInfo.TaskConfID}没有配置完成物件");
                            continue;
                        }

                        long task_combine_prop_id = all_tsk_combine_prop_id[0];

                        if (prop_id != task_combine_prop_id)
                        {
                            continue;
                        }

                        tsk_finished = true;
                        taskInfo.TaskCurrentStatus = TaskStatus.COMPLETED;
                    }
                    if (tsk_finished)
                    {
                        GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(this.m_currentTaskList.Count);
                        EngineCoreEvents.UIEvent.HideUIEvent.SafeInvoke(UIDefine.UI_COMBINE);
                    }
                }
            }
            else if (obj is SCCartoonEnterResponse)
            {
                SCCartoonEnterResponse res = obj as SCCartoonEnterResponse;
                if (!MsgStatusCodeUtil.OnError(res.Result))
                {
                    var req = EngineCoreEvents.SystemEvents.GetRspPairReq.SafeInvoke();
                    CSCartoonEnterRequest req_msg = req as CSCartoonEnterRequest;
                    long cur_scene_id             = req_msg.SceneId;

                    foreach (var task in m_currentTaskList)
                    {
                        NormalTask taskInfo = task as NormalTask;

                        if (taskInfo.CompleteConditionList.Count > 1 || 0 == taskInfo.CompleteConditionList.Count)
                        {
                            continue;
                        }

                        TaskCompleteCondition taskCompleteCondition = taskInfo.CompleteConditionList[0];
                        TaskCompleteAttribute taskCompleteAttribute = taskCompleteCondition.GetType().GetCustomAttributes(typeof(TaskCompleteAttribute), true)[0] as TaskCompleteAttribute;

                        if (TaskCompleteMode.CompletedBySceneID != taskCompleteAttribute.CompleteMode)
                        {
                            continue;
                        }

                        long scene_id = (long)taskCompleteCondition.TaskCompleteData;

                        if (CommonData.C_CARTOON_SCENE_START_ID != scene_id / CommonData.C_SCENE_TYPE_ID)
                        {
                            continue;
                        }

                        if (cur_scene_id != scene_id)
                        {
                            continue;
                        }

                        taskInfo.TaskCurrentStatus = TaskStatus.COMPLETED;
                    }
                }
            }
            else if (obj is SCCartoonRewardReqsponse)
            {
                GameEvents.TaskEvents.OnSyncedTaskList.SafeInvoke(this.m_currentTaskList.Count);
            }
        }
Ejemplo n.º 30
0
        public override void OnScResponse(object s)
        {
            base.OnScResponse(s);



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

                if (!MsgStatusCodeUtil.OnError(rsp.ResponseStatus))
                {
                    EventGamePlayData data = new EventGamePlayData()
                    {
                        EventID = m_event_id,
                        Msg     = rsp,
                    };

                    FrameMgr.OpenUIParams open_data = new FrameMgr.OpenUIParams(UIDefine.UI_EVENT_INGAME_PLAY);
                    open_data.Param = data;

                    EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(open_data);

                    this.CloseFrame();
                }
            }
            else if (s is SCEventEnterResponse)
            {
                var rsp = s as SCEventEnterResponse;

                if (!MsgStatusCodeUtil.OnError(rsp.Result))
                {
                    RequestStartPhase();

                    {
                        Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                        {
                            { UBSParamKeyName.Success, 1 },
                            { UBSParamKeyName.ContentID, m_event_id }
                        };
                        UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.event_begin, null, _params);
                    }
                }
                else
                {
                    if (MsgStatusCodeUtil.VIT_OUT == rsp.Result)
                    {
                        Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                        {
                            { UBSParamKeyName.Success, 0 },
                            { UBSParamKeyName.Description, UBSDescription.NOT_ENOUGH_VIT },
                            { UBSParamKeyName.ContentID, m_event_id }
                        };
                        UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.event_begin, null, _params);
                    }
                    else
                    {
                        Dictionary <UBSParamKeyName, object> _params = new Dictionary <UBSParamKeyName, object>()
                        {
                            { UBSParamKeyName.Success, 0 },
                            { UBSParamKeyName.Description, rsp.Result },
                            { UBSParamKeyName.ContentID, m_event_id }
                        };
                        UserBehaviorStatisticsModules.Instance.LogEvent(UBSEventKeyName.event_begin, null, _params);
                    }
                }
            }
        }