Exemplo n.º 1
0
    /// <summary>
    /// 充值
    /// </summary>
    /// <param name="rechargeID"></param>
    public void DoRecharge(uint rechargeID)
    {
        if (!DataManager.Manager <LoginDataManager>().SDKLoginEnable)
        {
            TipsManager.Instance.ShowTips("当前平台充值不可用");
            return;
        }
        if (!m_bRechargeOpen)
        {
            TipsManager.Instance.ShowTips("充值暂未开放");
            return;
        }
        UIPanelManager    pmgr     = DataManager.Manager <UIPanelManager>();
        WaitPanelShowData waitData = new WaitPanelShowData();

        waitData.type       = WaitPanelType.Waitting;
        waitData.cdTime     = 20;
        waitData.des        = "充值中...";
        waitData.useBoxMask = false;
        waitData.showTimer  = false;
        if (!pmgr.IsShowPanel(PanelID.CommonWaitingPanel))
        {
            pmgr.ShowPanel(PanelID.CommonWaitingPanel, data: waitData);
        }
        RequestRechargeOrder(rechargeID);
    }
Exemplo n.º 2
0
    /// <summary>
    /// 发起挑战
    /// </summary>
    /// <param name="targetID"></param>
    /// <param name="name"></param>
    public void ReqChallengeInvite(uint targetID, string name, uint targetRank, bool onLine)
    {
        // 大v说了武斗场id不变151.
        if (!KHttpDown.Instance().SceneFileExists(151))
        {
            //打开下载界面
            DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel);
            return;
        }

        MainPlayStop();
        IPlayer mainPlayer = ClientGlobal.Instance().MainPlayer;
        stChallengeInviteArenaUserCmd_CS cmd = new stChallengeInviteArenaUserCmd_CS();

        cmd.offensive_id   = mainPlayer.GetID();
        cmd.offensive_name = mainPlayer.GetName();
        cmd.offender_rank  = m_rank;
        cmd.defensive_id   = targetID;
        cmd.defensive_name = name;
        cmd.defendser_rank = targetRank;
        NetService.Instance.Send(cmd);

        if (onLine)  //在线,会弹出等待框
        {
            WaitPanelShowData waitData = new WaitPanelShowData();
            waitData.type       = WaitPanelType.ArenaChallenge;
            waitData.cdTime     = ChallengeRejectTime;
            waitData.des        = "挑战邀请中,请稍后...";
            waitData.timeOutDel = delegate { DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel); };
            waitData.useBoxMask = false;

            DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData);
        }
    }
Exemplo n.º 3
0
    public override void Enter(object param)
    {
        Action           callback = (Action)param;
        LoginDataManager ld       = DataManager.Manager <LoginDataManager>();

        if (ld.IsSDKLogin)
        {
            if (ld.IsLoginStateReady(LoginState.LGState_SDKReady))
            {
                ld.DoLoginStep(LoginSteps.LGS_Platform);
            }
            else
            {
                WaitPanelShowData waitData = new WaitPanelShowData();
                waitData.type       = WaitPanelType.Login;
                waitData.cdTime     = 20;
                waitData.des        = "SDK授权中...";
                waitData.timeOutDel = RequestTimeOut;
                waitData.useBoxMask = false;
                waitData.showTimer  = false;
                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData, panelShowAction: (pb) =>
                {
                    CoroutineMgr.Instance.DelayInvokeMethod(0, () =>
                    {
                        ld.StartAuthorize();
                    }, true);
                });
            }
        }
        else
        {
            ld.DoLoginStep(LoginSteps.None);
        }
    }
Exemplo n.º 4
0
    public void ShowWaitPanel()
    {
        WaitPanelShowData data = new WaitPanelShowData();

        data.type       = WaitPanelType.Reconnect;
        data.cdTime     = (int)m_waitData.WaitPanelCDTime;
        data.des        = "重连中...";
        data.timeOutDel = ShowReconnectTips;
        data.useBoxMask = true;
        DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: data);
    }
Exemplo n.º 5
0
    public override void Enter(object param)
    {
        Debug.Log("enter LoginStateTwoStep  请求ip和端口");
        string text = DataManager.Manager <TextManager>().GetLocalText(LocalTextType.Net_Logining);

        if (param != null)
        {
            text = (string)param;
        }
        LoginDataManager ld = DataManager.Manager <LoginDataManager>();

        ld.KillCheckServerStateTimer();
        m_http.ZoneID = ld.CurSelectZoneID;
        if (!string.IsNullOrEmpty(ld.IpStr))
        {
            if (m_Statemachine.GetCurStateID() != (int)LoginSteps.LGS_GameServer)
            {
                ld.StateMachine.ChangeState((int)LoginSteps.LGS_GameServer, null);
            }
            return;
        }


        WaitPanelShowData waitData = new WaitPanelShowData();

        waitData.type       = WaitPanelType.Login;
        waitData.cdTime     = 20;
        waitData.des        = text;
        waitData.timeOutDel = ConnectTimeOut;
        waitData.useBoxMask = false;
        waitData.showTimer  = false;
        DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData);



        Engine.Utility.Log.Info("SelectZone : {0}", m_http.ZoneID);
        m_http.SelectZone(() =>
        {
            if (m_Statemachine.GetCurStateID() == (int)LoginSteps.LGS_SelectZone)
            {
                if (!string.IsNullOrEmpty(m_http.GatewayUrl))
                {
                    ld.IpStr = m_http.GatewayUrl;
                    Engine.Utility.Log.Info("http SelectZone sucess ");
                    ld.StateMachine.ChangeState((int)LoginSteps.LGS_GameServer, null);
                }
            }
        }, (error) =>
        {
            Engine.Utility.Log.Error("http SendSelectZone error is {0}", error);
        });
    }
Exemplo n.º 6
0
    public override void Enter(object param)
    {
        Debug.Log("enter LoginStateThreeStep  开始连接网关");
        WaitPanelShowData waitData = new WaitPanelShowData();

        waitData.type       = WaitPanelType.ArenaChallenge;
        waitData.cdTime     = 20;
        waitData.des        = DataManager.Manager <TextManager>().GetLocalText(LocalTextType.Net_Connecting);;
        waitData.timeOutDel = delegate() { DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel); };
        waitData.useBoxMask = false;
        waitData.showTimer  = false;
        DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData);
        LoginDataManager ld = DataManager.Manager <LoginDataManager>();

        GVoiceManger.Instance.SetAppInfo(ld.Acount + ld.CurSelectZoneID);
        string[] iport;
        string   gatewayUrl = ld.IpStr;

        if (!string.IsNullOrEmpty(gatewayUrl))
        {
            string tcpgateway = gatewayUrl;
            iport = tcpgateway.Split(':');
        }
        else
        {
            Engine.Utility.Log.Error("gatewayUrl is null");
            return;
        }
        Engine.Utility.Log.Info("帐号验证成功,准备连接到网关");
        UserData.GatewayServerIP = iport[0];
        int severpot = 0;

        if (int.TryParse(iport[1], out severpot))
        {
            try
            {
                if (string.IsNullOrEmpty(gatewayUrl))
                {
                    Engine.Utility.Log.Error("gatewayurltcp is null 无法建立tcp连接");
                    return;
                }
                UserData.GatewayServerPort = severpot;
                Engine.Utility.Log.Error("NetService.Instance.Connect{0}:{1}", UserData.GatewayServerIP, severpot);
                NetService.Instance.Connect(UserData.GatewayServerIP, severpot, ld.onConnectedGameServer);
            }
            catch (System.Exception ex)
            {
                Debug.Log(ex.ToString());
            }
        }
    }
Exemplo n.º 7
0
    protected override void OnShow(object data)
    {
        base.OnShow(data);
        WaitPanelShowData showData = data as WaitPanelShowData;

        if (data == null)
        {
            Engine.Utility.Log.Error("CommonWaitingPanel OnShow Failed:WaitPanelShowData is null!");
            return;
        }
        if (m_WaitShowData != null)
        {
            if (m_WaitShowData.timeOutDel != null)
            {
                m_WaitShowData.timeOutDel = null;
            }
            m_WaitShowData = null;
        }
        m_WaitShowData = showData;
        m_nCountDown   = m_WaitShowData.cdTime;

        m_label_countdown.text = m_WaitShowData.cdTime.ToString();
        m_label_Des.text       = m_WaitShowData.des;

        if (m_label_countdown != null && m_label_countdown.gameObject != null)
        {
            m_label_countdown.gameObject.SetActive(m_WaitShowData.showTimer);
        }

        TimerAxis.Instance().KillTimer(m_uWaitTimerID, this);
        TimerAxis.Instance().SetTimer(m_uWaitTimerID, 1000, this);

        if (m_WaitShowData.useBoxMask == true)
        {
        }
        else
        {
        }

        if (m_WaitShowData.type == WaitPanelType.Reconnect)
        {
            WaitData.ReconnectTime++;
        }
    }
Exemplo n.º 8
0
    void onClick_ConvertBtn_Btn(GameObject caster)
    {
        if (string.IsNullOrEmpty(m_input_keyInput.value))
        {
            TipsManager.Instance.ShowTips("输入框为空");
        }
        else
        {
            NetService.Instance.Send(new GameCmd.stCDKeyExchangeDataUserCmd_CS()
            {
                cd_key = m_input_keyInput.value
            });

            WaitPanelShowData waitData = new WaitPanelShowData();
            waitData.type       = WaitPanelType.CDKey;
            waitData.cdTime     = 5;
            waitData.des        = "请耐心等待...";
            waitData.timeOutDel = delegate { DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel); };
            waitData.useBoxMask = false;
            DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData);
        }
    }
Exemplo n.º 9
0
    public override void Enter(object param)
    {
        LoginDataManager ld = DataManager.Manager <LoginDataManager>();

        WaitPanelShowData waitData = new WaitPanelShowData();

        waitData.type       = WaitPanelType.Waitting;
        waitData.cdTime     = 20;
        waitData.des        = "获取区服配置中...";
        waitData.timeOutDel = RequestTimeOut;
        waitData.useBoxMask = false;
        waitData.showTimer  = false;

        Action <bool, string> fetchCallback = (success, errorMsg) =>
        {
            DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel);
            if (success)
            {
                //成功开始登陆平台
                ld.DoLoginPlatform();
            }
            else
            {
                TipsManager.Instance.ShowTips("获取区服配置数据失败");
                if (!string.IsNullOrEmpty(errorMsg))
                {
                    Debug.LogError("LoginStepFetchASFilterData failed error:" + errorMsg);
                }
                //失败,重试
                RetryFetchAreaSeverFilterData();
            }
        };

        DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData, panelShowAction: (pb) =>
        {
            ld.FetchAreaSeverFilterData(fetchCallback);
        });
    }
Exemplo n.º 10
0
    public override void Enter(object param)
    {
        Debug.Log("enter LoginStateOneStep  请求区服列表");

        WaitPanelShowData waitData = new WaitPanelShowData();

        waitData.type       = WaitPanelType.ArenaChallenge;
        waitData.cdTime     = 20;
        waitData.des        = DataManager.Manager <TextManager>().GetLocalText(LocalTextType.Net_RequestZoneList);;
        waitData.timeOutDel = RequestTimeOut;
        waitData.useBoxMask = false;
        waitData.showTimer  = false;
//        DataManager.Manager<UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData);


        Action           callback = (Action)param;
        LoginDataManager ld       = DataManager.Manager <LoginDataManager>();

        if (m_http != null)
        {
            m_http.Login((sucess) =>//1-1连接 登录服务器成功
            {
                if (sucess.platinfo == null)
                {
                    ld.OnLogout(true);
                    Debug.LogError("Platform LoginData error,platinfo null");
                    return;
                }
                CommonSDKPlaform.Instance.SetLoginSuccessData(sucess.platinfo.account, sucess.platinfo.sign, sucess.platinfo.extdata);
                Engine.Utility.Log.Error("http login sucess is {0}", sucess);

                m_http.RequestLoginUserInfo((userInfo) =>
                {
                    ld.UserZoneInfoList = userInfo.userzoneinfo;
                    if (userInfo != null)
                    {
                        if (userInfo.userzoneinfo != null)
                        {
                            if (userInfo.userzoneinfo.Count > 0)
                            {
                                Engine.Utility.Log.Error("user info is {0}", userInfo.userzoneinfo[0].zoneinfo.gamename);
                            }
                        }
                    }
                });
                //sort   根据id排序,越靠后越新
                m_http.RequestZoneList((retZoneData) =>
                {
                    ld.BestZone = retZoneData.bestzoneid;
                    List <Pmd.ZoneInfo> tempList = retZoneData.zonelist;
                    tempList.Sort(
                        delegate(Pmd.ZoneInfo a, Pmd.ZoneInfo b)
                    {
                        if (a.zoneid > b.zoneid)
                        {
                            return(-1);
                        }
                        else if (a.zoneid < b.zoneid)
                        {
                            return(1);
                        }
                        return(0);
                    });
                    ld.ZoneList = tempList;

                    Engine.Utility.Log.Error("http GetZoneList sucess is {0}", retZoneData);
                    ld.SetLoginState(LoginState.LGState_PlatformReady);
                    if (m_Statemachine.GetCurStateID() == (int)LoginSteps.LGS_Platform)
                    {
                        if (callback != null)
                        {
                            callback();
                        }
                        else
                        {
                            //DataManager.Manager<UIPanelManager>().ShowPanel(PanelID.CommonWaitingPanel, data: waitData);
                        }
                        // 隐藏等待窗体
                        DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel);
                        Action act = null;
                        if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.ChooseServerPanel))
                        {
                            act = () =>
                            {
                                DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.ChooseServerPanel);
                            };
                        }


                        ld.GotoLogin(LoginPanel.ShowUIEnum.StartGame, act);
                    }
                    else
                    {
                        TipsManager.Instance.ShowTips("请求超时请重试!!");
                    }
                },
                                       (error) =>
                {
                    Engine.Utility.Log.Error("http GetZoneList error is {0}", error);
                });
            },
                         (error) =>
            {
                ld.OnLogout(true);
                DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel);
            });
        }
        else
        {
            ld.OnLogout(true);
            DataManager.Manager <UIPanelManager>().HidePanel(PanelID.CommonWaitingPanel);
        }
    }
Exemplo n.º 11
0
 //-------------------------------------------------------------------------------------------------------
 protected override void OnHide()
 {
     m_WaitShowData = null;
     TimerAxis.Instance().KillTimer(m_uWaitTimerID, this);
     base.OnHide();
 }