I have this code, but is not work to send the information to mysql from iphone. There is something here that Ios does not read?
usingUnityEngine;
usingSystem.Collections;
usingUnityEngine.UI;
publicclassLoginSystem : MonoBehaviour {
publicGUISkinskin;
//register
privatestringname = "";
privatestringcomment = "";
privatestringLog;
publicTextureLogTexture;
publicstringsceneMap;
[System.Serializable]
publicclassRegisterParameters{
publicTextUserString;
publicTextEmailString;
}
publicRegisterParametersRP;
publicstaticintscore;
publicstaticstringuserName;
privatestring[] ListStrings;
publicGameObjectRegisM;
publicTextlogText;
voidOnGUI(){
GUI.skin = skin;
}
voidRequestRegister(){
name = RP.UserString.text;
comment = RP.EmailString.text;
if (name.Length < 1) {
Log = "Preencha o campo do Usuário.";
}else{
if(comment.Length < 1){
Log = "Preencha o campo do E-Mail.";
}else{
WWWFormregister = newWWWForm();
register.AddField("user",name);
register.AddField("comment",comment);
WWWw = newWWW("https://nfx.com/register10.php",register);
StartCoroutine(RequestRegisterInformations(w));
}
}
}
IEnumeratorRequestRegisterInformations(WWWw){
yieldreturnw;
if (w.error == null) {
Log = w.text;
if(Log == "Conta criada com sucesso!"){
RP.UserString.text = "";
RP.EmailString.text = "";
Application.LoadLevel(sceneMap);
}
}
}
voidRanking()
{
Application.LoadLevel("Ranking");
}
}
Baste
February 3, 2016, 12:00pm
2
Your formatting is very broken. Where’d the spaces go?
i dont undestand your question?
Baste
February 3, 2016, 12:05pm
4
Look at your first post. It’s not possible to read, as you messed up the pasting.
Baste
February 3, 2016, 12:10pm
6
It’s still not possible to read. There’s a preview button - use that.
Laperen
February 3, 2016, 12:11pm
7
I have no experience with anything outside client side, but what is yieldreturnw?
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class LoginSystem : MonoBehaviour {
public GUISkin skin;
//register
private string name = "";
private string comment = "";
private string Log;
public Texture LogTexture;
public string sceneMap;
[System.Serializable]
public class RegisterParameters{
public Text UserString;
public Text EmailString;
}
public RegisterParameters RP;
public static int score;
public static string userName;
private string[] ListStrings;
public GameObject RegisM;
public Text logText;
void OnGUI(){
GUI.skin = skin;
}
void RequestRegister(){
name = RP.UserString.text;
comment = RP.EmailString.text;
if (name.Length < 1) {
Log = "Preencha o campo do Usuário.";
}else{
if(comment.Length < 1){
Log = "Preencha o campo do E-Mail.";
}else{
WWWForm register = new WWWForm();
register.AddField("user",name);
register.AddField("comment",comment);
WWW w = new WWW("https://nfx3d.com/register10.php",register);
StartCoroutine(RequestRegisterInformations(w));
}
}
}
IEnumerator RequestRegisterInformations(WWW w){
yield return w;
if (w.error == null) {
Log = w.text;
if(Log == "Conta criada com sucesso!"){
RP.UserString.text = "";
RP.EmailString.text = "";
Application.LoadLevel(sceneMap);
}
}
}
void Ranking()
{
Application.LoadLevel("Ranking");
}
}
it does not allow me to send the message to mysql.
here is the original code, this one works fine.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class LoginSystem : MonoBehaviour {
public enum lMode{login,register};
public lMode LoginMode;
public GUISkin skin;
//login
private string user = "";
private string pass = "";
private int boolstatus;
//register
private string name = "";
private string password = "";
private string email = "";
public string[] BadNames;
private string Log;
public Texture LogTexture;
public GameObject Loading;
public string sceneMap;
[System.Serializable]
public class LoginParameters{
public Text LoginString;
public Text PassString;
public Toggle Remember;
public InputField UserRemember;
public InputField PassRemember;
}
[System.Serializable]
public class RegisterParameters{
public Text UserString;
public Text PassString;
public Text EmailString;
}
public LoginParameters LP;
public RegisterParameters RP;
public static int score;
public static string userName;
private string[] ListStrings;
public GameObject LoginM;
public GameObject RegisM;
public Text logText;
public AudioClip Toque;
public AudioSource Source;
void Start () {
boolstatus = PlayerPrefs.GetInt("bs");
if (boolstatus == 1) {
LP.Remember.isOn = true;
print(PlayerPrefs.GetString("login"));
LP.UserRemember.text = PlayerPrefs.GetString ("login");
LP.PassRemember.text = PlayerPrefs.GetString ("pass");
}else{
LP.Remember.isOn = false;
}
}
void Update () {
logText.text = Log;
if (LoginMode == lMode.login) {
LoginM.SetActive(true);
RegisM.SetActive(false);
}else if(LoginMode == lMode.register){
LoginM.SetActive(false);
RegisM.SetActive(true);
}
if (LP.Remember.isOn == true) {
PlayerPrefs.SetString("login",LP.LoginString.text);
PlayerPrefs.SetString("pass",LP.PassString.text);
boolstatus = 1;
PlayerPrefs.SetInt("bs",boolstatus);
}else{
boolstatus = 0;
PlayerPrefs.SetInt("bs",boolstatus);
}
}
void OnGUI(){
GUI.skin = skin;
}
void RequestRegister(){
name = RP.UserString.text;
email = RP.EmailString.text;
password = RP.PassString.text;
if (name.Length < 1)
{
Log = "Preencha o campo do Usuário.";
}else{
if(email.Length < 1){
Log = "Preencha o campo do E-Mail.";
}else{
if(password.Length < 1){
Log = "Preencha o campo da Senha.";
}else{
bool foundBadName = false;
foreach(string BadName in BadNames)
{
if(name == BadName)
{
foundBadName = true;
}
}
if(!foundBadName)
{
WWWForm register = new WWWForm();
register.AddField("user",name);
register.AddField("pass",password);
register.AddField("email",email);
WWW w = new WWW("http://nfx.comuv.com/register.php",register);
StartCoroutine(RequestRegisterInformations(w));
}else{
print ("BadName");
Log = "Linguagem Ofensiva";
}
}
}
}
}
void RequestLogin(){
user = LP.LoginString.text;
pass = LP.PassString.text;
Log = "";
if (user.Length < 1) {
Log = "Preencha o campo do usuario";
}else{
if(pass.Length < 1){
Log = "Preencha o campo da senha";
}else{
WWWForm login = new WWWForm();
login.AddField("user",user);
login.AddField("pass",pass);
WWW w = new WWW("http://nfx.comuv.com/Login.php",login);
StartCoroutine(RequestLoginInformations(w));
}
}
}
IEnumerator RequestLoginInformations(WWW w){
yield return w;
if (w.error == null) {
Log = w.text;
ListStrings = w.text.Split(';');
if(ListStrings[0] == "Bem vindo"){
Log = "Seja " + ListStrings[0] + " " + ListStrings[1] +" ";
userName = ListStrings[1];
}
if(ListStrings[0] == "Bem vindo"){
Source.PlayOneShot(Toque,1.0f);
if(!Loading.GetComponent<Animation>().IsPlaying("barra"))
{
Loading.GetComponent<Animation>().Play("barra");
}
yield return new WaitForSeconds(1);
Application.LoadLevel(sceneMap);
}
}
}
IEnumerator RequestRegisterInformations(WWW w){
yield return w;
if (w.error == null) {
Log = w.text;
if(Log == "Conta criada com sucesso!"){
Source.PlayOneShot(Toque,1.0f);
LP.LoginString.text = RP.UserString.text;
LP.PassString.text = RP.PassString.text;
RP.UserString.text = "";
RP.EmailString.text = "";
RP.PassString.text = "";
LoginMode = lMode.login;
}
}
}
void RegisterMode(){
LoginMode = lMode.register;
}
void LoginMod(){
LoginMode = lMode.login;
}
}
here is the original code, this one works fine.
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class LoginSystem : MonoBehaviour {
public enum lMode{login,register};
public lMode LoginMode;
public GUISkin skin;
//login
private string user = "";
private string pass = "";
private int boolstatus;
//register
private string name = "";
private string password = "";
private string email = "";
public string[] BadNames;
private string Log;
public Texture LogTexture;
public GameObject Loading;
public string sceneMap;
[System.Serializable]
public class LoginParameters{
public Text LoginString;
public Text PassString;
public Toggle Remember;
public InputField UserRemember;
public InputField PassRemember;
}
[System.Serializable]
public class RegisterParameters{
public Text UserString;
public Text PassString;
public Text EmailString;
}
public LoginParameters LP;
public RegisterParameters RP;
public static int score;
public static string userName;
private string[] ListStrings;
public GameObject LoginM;
public GameObject RegisM;
public Text logText;
public AudioClip Toque;
public AudioSource Source;
void Start () {
boolstatus = PlayerPrefs.GetInt("bs");
if (boolstatus == 1) {
LP.Remember.isOn = true;
print(PlayerPrefs.GetString("login"));
LP.UserRemember.text = PlayerPrefs.GetString ("login");
LP.PassRemember.text = PlayerPrefs.GetString ("pass");
}else{
LP.Remember.isOn = false;
}
}
void Update () {
logText.text = Log;
if (LoginMode == lMode.login) {
LoginM.SetActive(true);
RegisM.SetActive(false);
}else if(LoginMode == lMode.register){
LoginM.SetActive(false);
RegisM.SetActive(true);
}
if (LP.Remember.isOn == true) {
PlayerPrefs.SetString("login",LP.LoginString.text);
PlayerPrefs.SetString("pass",LP.PassString.text);
boolstatus = 1;
PlayerPrefs.SetInt("bs",boolstatus);
}else{
boolstatus = 0;
PlayerPrefs.SetInt("bs",boolstatus);
}
}
void OnGUI(){
GUI.skin = skin;
}
void RequestRegister(){
name = RP.UserString.text;
email = RP.EmailString.text;
password = RP.PassString.text;
if (name.Length < 1)
{
Log = "Preencha o campo do Usuário.";
}else{
if(email.Length < 1){
Log = "Preencha o campo do E-Mail.";
}else{
if(password.Length < 1){
Log = "Preencha o campo da Senha.";
}else{
bool foundBadName = false;
foreach(string BadName in BadNames)
{
if(name == BadName)
{
foundBadName = true;
}
}
if(!foundBadName)
{
WWWForm register = new WWWForm();
register.AddField("user",name);
register.AddField("pass",password);
register.AddField("email",email);
WWW w = new WWW("http://nfx.comuv.com/register.php",register);
StartCoroutine(RequestRegisterInformations(w));
}else{
print ("BadName");
Log = "Linguagem Ofensiva";
}
}
}
}
}
void RequestLogin(){
user = LP.LoginString.text;
pass = LP.PassString.text;
Log = "";
if (user.Length < 1) {
Log = "Preencha o campo do usuario";
}else{
if(pass.Length < 1){
Log = "Preencha o campo da senha";
}else{
WWWForm login = new WWWForm();
login.AddField("user",user);
login.AddField("pass",pass);
WWW w = new WWW("http://nfx.comuv.com/Login.php",login);
StartCoroutine(RequestLoginInformations(w));
}
}
}
IEnumerator RequestLoginInformations(WWW w){
yield return w;
if (w.error == null) {
Log = w.text;
ListStrings = w.text.Split(';');
if(ListStrings[0] == "Bem vindo"){
Log = "Seja " + ListStrings[0] + " " + ListStrings[1] +" ";
userName = ListStrings[1];
}
if(ListStrings[0] == "Bem vindo"){
Source.PlayOneShot(Toque,1.0f);
if(!Loading.GetComponent<Animation>().IsPlaying("barra"))
{
Loading.GetComponent<Animation>().Play("barra");
}
yield return new WaitForSeconds(1);
Application.LoadLevel(sceneMap);
}
}
}
IEnumerator RequestRegisterInformations(WWW w){
yield return w;
if (w.error == null) {
Log = w.text;
if(Log == "Conta criada com sucesso!"){
Source.PlayOneShot(Toque,1.0f);
LP.LoginString.text = RP.UserString.text;
LP.PassString.text = RP.PassString.text;
RP.UserString.text = "";
RP.EmailString.text = "";
RP.PassString.text = "";
LoginMode = lMode.login;
}
}
}
void RegisterMode(){
LoginMode = lMode.register;
}
void LoginMod(){
LoginMode = lMode.login;
}
}