IEnumerator RegisterUserPass() { if (gameinHeader.userdata == "63") { var msg = "{" + "\"ver\":1" + ",\"user_data\":63" + ",\"device\":" + deviceId + ",\"user\":" + username + ",\"pass\":" + password + "}"; Debug.Log("sending: " + msg); byte[] authencode = System.Text.Encoding.ASCII.GetBytes(gameinHeader.access); byte[] endata = AuthenService.Encrypt(System.Text.Encoding.ASCII.GetBytes(msg), finalKey); byte[] finalmsg = new byte[authencode.Length + endata.Length]; System.Buffer.BlockCopy(authencode, 0, finalmsg, 0, authencode.Length); System.Buffer.BlockCopy(endata, 0, finalmsg, authencode.Length, endata.Length); var ws = new WWW(serverAddress + uriUserPassRegister, finalmsg); yield return(ws); Debug.Log("received: " + ws.text); } }
IEnumerator LoginWithDevice() { if (gameinHeader.userdata == "63") { var msg = "{" + "\"ver\":1" + ",\"game\":" + gameKey + ",\"device\":" + deviceId + "}"; Debug.Log("sending: " + msg); byte[] authencode = System.Text.Encoding.ASCII.GetBytes(gameinHeader.access); byte[] endata = AuthenService.Encrypt(System.Text.Encoding.ASCII.GetBytes(msg), finalKey); var ws = PostWWW(serverAddress + uriDevice, gameinHeader.userdata, gameinHeader.access, endata); yield return(ws); gameinHeader = GetHeader(ws); Debug.Log("received: " + ws.text); } }