Пример #1
0
 public static void ShowBindRewardView(BindRewardData data_)
 {
     FrameMgr.OpenUIParams param = new FrameMgr.OpenUIParams(UIDefine.UI_BIND)
     {
         Param = data_,
     };
     EngineCoreEvents.UIEvent.ShowUIEventWithParam.SafeInvoke(param);
 }
        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();
                }
            }
        }
Пример #3
0
 public void Refresh(BindRewardData data_)
 {
     m_count_txt.Text = string.Format("x{0}", data_.m_count);
     m_OnQuit         = data_.m_OnOK;
 }