Пример #1
0
        public int sendCmd(int cmdCode, long currentTime)
        {
            SendData CmdData = new SendData(1000);

            CmdData.GetDataPackage();
            return(0);
        }
Пример #2
0
    public void OnLoginClicked()
    {
        SendData LoginData = new SendData(-1);

        LoginData.GetDataPackage().AddLoginInfo(AccountInput.text, PasswordInput.text);
        int sendNum = LoginData.Send();

        Debug.Log("Here we send the login data to the server! The send Num is: " + sendNum);



        PackageMetaData LoginRecvPackage = ReceiveData.GetSingleton().GetLatestPackage("Login");

        int times = 0;

        while (true)
        {
            if (times >= 3)
            {
                break;
            }
            if (LoginRecvPackage == null)
            {
                Thread.Sleep(1000);
            }
            else
            {
                break;
            }
            LoginRecvPackage = ReceiveData.GetSingleton().GetLatestPackage("Login");
            times           += 1;
            Debug.Log("Waitting for server login message!");
        }

        if (LoginRecvPackage == null)
        {
            Debug.Log("Please check you internet ,it's seems disconnected!");
            return;
        }

        if (Convert.ToBoolean(LoginRecvPackage.Get("LoginReturn")) == true)
        {
            //if (AccountInput.text == "123456" && PasswordInput.text == "654321")
            //{
            SceneManager.LoadScene("GameScene", LoadSceneMode.Single);
        }
        else
        {
            Debug.Log("密码错误");
        }
    }