Ejemplo n.º 1
0
 private void ReceiveCheck(WWW www, CheckMessageDelegate callback)
 {
     if (string.IsNullOrEmpty(www.error))
     {
         string message = www.text;
         Debug.Log("ServerRequesr receive message: " + message);
         //if success, the message is empty, or else show the details.
         callback(string.IsNullOrEmpty(message), message);
     }
     else
     {
         Debug.Log(www.error);
         callback(string.IsNullOrEmpty(www.error), "Request Failure!");
     }
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Just made the function on register.
    /// </summary>
    /// <param name="accountNumber"></param>
    /// <param name="callback"></param>
    /// <returns></returns>
    public IEnumerator SendAccountNumber(string accountNumber, CheckMessageDelegate callback)
    {
        Debug.Log("ServerRequest - SendAccountNumber");

        WWWForm form = new WWWForm();

        form.AddField(PARAMS_TYPE, ACCOUNT_NUMBER_ONLY);
        form.AddField(ACCOUNT_NUMBER, accountNumber);

        WWW www = new WWW(URL, form);

        yield return(www);

        ReceiveCheck(www, callback);

        //StopCoroutine(SendAccountNumber(accountNumber, callback));
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Login function, send account number and password to server.
    /// </summary>
    /// <param name="accountNumber"></param>
    /// <param name="password"></param>
    /// <param name="callback"></param>
    /// <returns></returns>
    public IEnumerator SendLogin(string accountNumber, string password, CheckMessageDelegate callback)
    {
        Debug.Log("ServerRequest - Send Login");

        WWWForm form = new WWWForm();

        form.AddField(PARAMS_TYPE, ACCOUNT_LOGIN);
        form.AddField(ACCOUNT_NUMBER, accountNumber);
        form.AddField(ACCOUNT_PASSWORD, password);

        WWW www = new WWW(URL, form);

        yield return(www);

        ReceiveCheck(www, callback);

        //StopCoroutine(SendLogin(accountNumber, password, callback));
    }