예제 #1
0
 private void LoginNetReconnectCallBack(object param)
 {
     if (HallMain.ConnectLoginServer())
     {
         LoginNetReconnectTimer.SetDeleteFlag(true);
     }
 }
예제 #2
0
    /// <summary>
    /// 发送验证码请求登陆
    /// nState = 1登陆 2绑定 3解绑
    /// </summary>
    public void SendCodeApplyLogin(uint ncode, byte nState)
    {
        if (!NetWorkClient.GetInstance().IsSocketConnected)
        {
            HallMain.ConnectLoginServer();
        }

        UMessage           LoginMsg  = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_CHECKINDENTIFYING);
        CheckCodeLogin_Msg msg_Check = new CheckCodeLogin_Msg();

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            msg_Check.nPlatform = 1;
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
            msg_Check.nPlatform = 2;
        }
        else
        {
            msg_Check.nPlatform = 0;
        }

        msg_Check.nBindOrLogin = nState;
        msg_Check.nCode        = ncode;
        msg_Check.smachinecode = SystemInfo.deviceUniqueIdentifier;

        msg_Check.SetSendData(LoginMsg);

        NetWorkClient.GetInstance().SendMsg(LoginMsg);
    }
예제 #3
0
    /// <summary>
    /// 获取验证码
    /// </summary>
    void OnBtn_GetCode(EventTriggerType eventtype, object button, PointerEventData eventData)
    {
        if (eventtype == EventTriggerType.PointerClick)
        {
            CustomAudio.GetInstance().PlayCustomAudio(1002);

            if (CanvasObj == null)
            {
                CanvasObj = GameObject.Find("Canvas/Root");
            }

            InputField PhonePanel = CanvasObj.transform.Find("Login").Find("Panel_PhoneLogin")
                                    .Find("InputField_PhoneNum").gameObject.GetComponent <InputField>();

            long phonenum = 0;
            if (!long.TryParse(PhonePanel.text, out phonenum))
            {
                CCustomDialog.OpenCustomConfirmUI(1003);
                return;
            }

            if (!GameCommon.CheckPhoneIsAble(PhonePanel.text))
            {
                CCustomDialog.OpenCustomConfirmUI(1003);
                return;
            }

            if (phonenum > 0)
            {
                if (!NetWorkClient.GetInstance().IsSocketConnected)
                {
                    HallMain.ConnectLoginServer();
                }
                SendApplyGetCode(phonenum, 1);

                //if(MobileCodeTimer == null)
                MobileCodeTimer = new CTimerPersecondCall(60f, UpdataGetCodeBtnText);
                xTimeManger.Instance.RegisterTimer(MobileCodeTimer);

                GameObject PhoneLogin = CanvasObj.transform.Find("Login").Find("Panel_PhoneLogin").gameObject;
                if (null != PhoneLogin)
                {
                    Button btn    = PhoneLogin.transform.Find("Button_GetCode").gameObject.GetComponent <Button>();
                    Image  btnimg = PhoneLogin.transform.Find("Button_GetCode").gameObject.GetComponent <Image>();
                    btn.interactable     = false;
                    btnimg.raycastTarget = false;

                    Text strCode = PhoneLogin.transform.Find("Button_GetCode").Find("Text_GetCode").gameObject.GetComponent <Text>();
                    strCode.text = "60S可重新获取";
                }
            }
        }
    }
예제 #4
0
    /// <summary>
    /// 请求发送验证码
    /// </summary>
    public void SendApplyGetCode(long nPhoneNum, byte nState)
    {
        if (!NetWorkClient.GetInstance().IsSocketConnected)
        {
            HallMain.ConnectLoginServer();
        }

        UMessage        LoginMsg  = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_MOBILELOGIN);
        MobileLogin_Msg msg_login = new MobileLogin_Msg();

        msg_login.nState     = nState;
        msg_login.nMobileNum = nPhoneNum;
        msg_login.SetSendData(LoginMsg);

        NetWorkClient.GetInstance().SendMsg(LoginMsg);
    }
예제 #5
0
    /// <summary>
    /// unionid码登陆
    /// </summary>
    /// <param name="unionid"></param>
    private void UnionIdLogin(string unionid)
    {
        if (!NetWorkClient.GetInstance().IsSocketConnected)
        {
            HallMain.ConnectLoginServer();
        }
        CCustomDialog.OpenCustomWaitUI(1008);

        UMessage unionLoginMsg = new UMessage((uint)GameCity.EMSG_ENUM.CrazyCityMsg_PLAYERLOGIN);

        MessageLogin ml_ = new MessageLogin();

        ml_.smachinecode = SystemInfo.deviceUniqueIdentifier;
        ml_.sVersion     = GameMain.Instance.GetAppVersion();

        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            ml_.nPlatform = 1;
        }
        else if (Application.platform == RuntimePlatform.Android)
        {
            ml_.nPlatform = 2;
        }
        else
        {
            ml_.nPlatform = 0;
        }
        unionLoginMsg.Add((int)0);
        unionLoginMsg.Add(ml_.smachinecode);
        unionLoginMsg.Add(ml_.sVersion);
        unionLoginMsg.Add(ml_.nPlatform);
        unionLoginMsg.Add((byte)1);
        unionLoginMsg.Add(unionid);
        //unionLoginMsg.Add();
        //unionLoginMsg.Add(CWechatUserAuth.GetInstance().GetUserNickname());

        NetWorkClient.GetInstance().SendMsg(unionLoginMsg);
    }
예제 #6
0
    /// <summary>
    /// 请求登陆
    /// </summary>
    public void RequestLogin(LoginType logintype = LoginType.LoginType_Guest)
    {
        if (logintype != LoginType.LoginType_LastOne)
        {
            enLoginType = logintype;
        }

        CCustomDialog.OpenCustomWaitUI(1008);
        if (!NetWorkClient.GetInstance().IsSocketConnected)
        {
            if (!HallMain.ConnectLoginServer())
            {
                if (LoginNetReconnectTimer == null)
                {
                    LoginNetReconnectTimer = new CTimerCirculateCall(3.0f, LoginNetReconnectCallBack);
                }
                xTimeManger.Instance.RegisterTimer(LoginNetReconnectTimer);
                return;
            }
        }

        if (bHavedGetGateServr)
        {
            if (enLoginType == LoginType.LoginType_Guest)
            {
                GuestLogin();
            }
            else if (enLoginType == LoginType.LoginType_Wechat)
            {
                WeChatAuthLogin();
            }
            else if (enLoginType == LoginType.LoginTyee_WechatQRCode)
            {
                WeChatAuthLogin();
            }
        }
    }