コード例 #1
0
    public IEnumerator LoginUser(string user, string password)
    {
        string hash = MD5Test.Md5Sum(user + password + secretKey);

        string get_url = loginURL
                         + "user="******"&password="******"&hash=" + hash;

        WWW hs_get = new WWW(get_url);

        yield return(hs_get);

        if (hs_get.error != null)
        {
            print("There was an error getting the information: " + hs_get.error);
        }
        else
        {
            Debug.Log(hs_get.text);
            if (hs_get.text.Contains("true"))
            {
                GameControl.control.LoadFromCloud(user);
                StartCoroutine(LoadLevelWithRealProgress());
            }
            else
            {
                Debug.Log("no user / wrong password");
            }
        }
    }
コード例 #2
0
    IEnumerator LoginUser(string user, string password)
    {
        gameobject.GetComponent <Text>().text = "Loading Scores";

        string hash = MD5Test.Md5Sum(user + password + secretKey);


        string get_url = loginURL
                         + "user="******"&password="******"&hash=" + hash;

        WWW hs_get = new WWW(get_url);

        yield return(hs_get);

        if (hs_get.error != null)
        {
            print("There was an error getting the information: " + hs_get.error);
        }
        else
        {
            gameobject.GetComponent <Text>().text = hs_get.text;
        }
    }
コード例 #3
0
    IEnumerator RegisterUser(string user, string email, string password, string firstname, string lastname, string birthday, string gender, string country, string native_language, string selected_character)
    {
        string hash = MD5Test.Md5Sum(user + email + password + firstname + country + selected_character + secretKey);

        WWWForm form = new WWWForm();

        form.AddField("user", user);
        form.AddField("email", email);
        form.AddField("password", password);
        form.AddField("firstname", firstname);
        form.AddField("lastname", country);
        form.AddField("birthday", birthday);
        form.AddField("gender", gender);
        form.AddField("country", country);
        form.AddField("native_language", native_language);
        form.AddField("selected_character", selected_character);
        form.AddField("hash", hash);
        WWW www = new WWW(registerURL, form);

        yield return(www);

        if (www.error != null)
        {
            print("There was an error: " + www.error);
        }
        else
        {
            status.text = www.text;
        }
    }
コード例 #4
0
    IEnumerator RegisterUser(string user, string email, string password, string firstname, string lastname, string birthday, string gender, string country, string native_language, string selected_character)
    {
        string hash = MD5Test.Md5Sum(user + email + password + firstname + country + selected_character + secretKey);

        string post_url = registerURL
                          + "user="******"&email=" + WWW.EscapeURL(email)
                          + "&password="******"&firstname=" + WWW.EscapeURL(firstname)
                          + "&lastname=" + WWW.EscapeURL(lastname)
                          + "&birthday=" + WWW.EscapeURL(birthday)
                          + "&gender=" + WWW.EscapeURL(gender)
                          + "&country=" + WWW.EscapeURL(country)
                          + "&native_language=" + WWW.EscapeURL(native_language)
                          + "&selected_character=" + WWW.EscapeURL(selected_character)
                          + "&hash=" + hash;
        WWW hs_post = new WWW(post_url);

        yield return(hs_post);

        if (hs_post.error != null)
        {
            print("There was an error posting the high score: " + hs_post.error);
        }
        else
        {
            gameobject.GetComponent <Text>().text = hs_post.text;
        }
    }
コード例 #5
0
ファイル: GameControl.cs プロジェクト: nappydevelopment/NoRPG
    public IEnumerator LoadDataRoutine(string username)
    {
        string hash = MD5Test.Md5Sum(username + secretKey);

        WWWForm form = new WWWForm();

        form.AddField("username", username);
        form.AddField("hash", hash);
        WWW www = new WWW(loadURL, form);

        yield return(www);

        if (www.error != null)
        {
            Debug.Log("There was an error getting the data from Cloud: " + www.error);
        }
        else
        {
            if (File.Exists(Application.persistentDataPath + "/playerInfo.dat"))
            {
                if (www.text != "")
                {
                    File.WriteAllText(Application.persistentDataPath + "/playerInfo.dat", www.text);
                }
                Debug.Log(www.text);
                LoadFromFile();
                Debug.Log("Load successfull from Cloud");
            }
        }
    }
コード例 #6
0
    private void SendRegister()
    {
        GameControl.control.correctCharacterModel = selected_characterText;
        GameControl.control.Save();

        StartCoroutine(RegisterUser(userText, emailText, MD5Test.Md5Sum(passwordText), firstnameText, lastnameText, birthdayText, genderText, countryText, native_languageText, selected_characterText));
    }
コード例 #7
0
    // remember to use StartCoroutine when calling this function!
    void PostScores(string position_x, string position_y, long score)
    {
        //This connects to a server side php script that will add the name and score to a MySQL DB.
        // Supply it with a string representing the players name and the players score.
        string hash     = MD5Test.Md5Sum(position_x + position_y + score.ToString() + secretKey);
        string post_url = addScoreURL + "position_x=" + WWW.EscapeURL(position_x) + "&position_y=" + WWW.EscapeURL(position_y) + "&score=" + score + "&hash=" + hash;

        // Post the URL to the site and create a download object to get the result.
        WWW hs_post = new WWW(post_url);

        while (true)
        {
            if (hs_post.isDone)
            {
                break;
            }
        }

        if (hs_post.error != null)
        {
            print("There was an error posting the high score: " + hs_post.error);
        }
        else
        {
            Debug.Log("post url = {" + post_url + "}");
            Debug.Log("post returned = {" + hs_post.text + "}");
        }
    }
コード例 #8
0
    IEnumerator salvarPontuacao(string nome, int pontos)
    {
        string hash = MD5Test.Md5Sum(nome + pontos + secretKey);

        string caminho = salvarPontuacaoURL + "nome=" + WWW.EscapeURL(nome) + "&pontos=" + pontos + "&hash=" + hash;
        WWW    conexao = new WWW(caminho);

        yield return(conexao);

        if (conexao.error != null)
        {
            print("Não foi possível salvar a pontuação: " + conexao.error); // exibe o erro no console
        }
    }
コード例 #9
0
    // remember to use StartCoroutine when calling this function!
    IEnumerator PostScores(string name, int score)
    {
        //This connects to a server side php script that will add the name and score to a MySQL DB.
        // Supply it with a string representing the players name and the players score.
        string hash = MD5Test.Md5Sum(name + score + secretKey);

        string post_url = addScoreURL + "name=" + WWW.EscapeURL(name) + "&score=" + score + "&hash=" + hash;

        // Post the URL to the site and create a download object to get the result.
        WWW hs_post = new WWW(post_url);

        yield return(hs_post); // Wait until the download is done

        if (hs_post.error != null)
        {
            print("There was an error posting the high score: " + hs_post.error);
        }
    }
コード例 #10
0
    public IEnumerator PostScores(string name, int score)
    {
        if (!sentScores)
        {
            sentScores = true;
            string hash = MD5Test.Md5Sum(name + score + secretKey);

            string post_url = addScoreURL + "name=" + WWW.EscapeURL(name) + "&score=" + score + "&hash=" + hash;

            WWW hs_post = new WWW(post_url);
            yield return(hs_post);

            if (hs_post.error != null)
            {
                print("Error: " + hs_post.error);
            }
        }
    }
コード例 #11
0
    private IEnumerator CheckUsername(string username)
    {
        if (!startCheck)
        {
            startCheck = true;
            string hash = MD5Test.Md5Sum(username + secretKey);

            WWWForm form = new WWWForm();
            form.AddField("username", username);
            form.AddField("hash", hash);
            WWW www = new WWW(loginURL, form);

            yield return(www);

            if (www.error != null)
            {
                print("There was an error: " + www.error);
            }
            else
            {
                Debug.Log(www.text);
                if (www.text.Contains("true"))
                {
                    validUsername = true;
                    WrongUsernameImage.gameObject.SetActive(false);
                }
                else
                {
                    validUsername = false;
                    WrongUsernameImage.gameObject.SetActive(true);
                }
                startCheck = false;
            }
        }
        else
        {
            yield return(new WaitForSeconds(4));
        }
    }
コード例 #12
0
ファイル: GameControl.cs プロジェクト: nappydevelopment/NoRPG
    public IEnumerator SaveDataRoutine(string u)
    {
        string data = File.ReadAllText(Application.persistentDataPath + "/playerInfo.dat");
        string hash = MD5Test.Md5Sum(u + data + secretKey);

        WWWForm form = new WWWForm();

        form.AddField("username", u);
        form.AddField("data", data);
        form.AddField("hash", hash);
        WWW www = new WWW(saveURL, form);

        yield return(www);

        if (www.error != null)
        {
            Debug.Log("There was an error saving on Cloud: " + www.error);
        }
        else
        {
            Debug.Log(www.text);
        }
    }
コード例 #13
0
    public void StartGameAtLastPosition()
    {
        progressCircle.gameObject.SetActive(true);

        StartCoroutine(LoginUser(username.text, MD5Test.Md5Sum(password.text)));
    }