Beispiel #1
0
    private IEnumerator _GetUserPhoto()
    {
        string photoUrl = UserService.user.picture,
               param    = UtilsService.GetParam("Email");

        Texture2D texture;

        if (photoUrl == null || photoUrl.Length < 1)
        {
            texture = UtilsService.GetDefaultProfilePhoto();
        }
        else
        {
            var www = new WWW(photoUrl);
            yield return(www);

            texture = www.texture;
        }

        if (texture != null)
        {
            UserService.user.profilePicture = texture;
        }

        UserService.user.profilePicture = texture;
        PlayerPrefs.SetString(param, emailField.text);
        LoadView("Home");
    }
    private static string GetHash(string stepName)
    {
        int    userId = UserService.user._id;
        string param  = UtilsService.GetParam("Tutorial"),
               hash   = string.Format("{0}:{1}:{2}", param, userId, stepName);

        return(hash);
    }
    public void Logout()
    {
        string param = UtilsService.GetParam("Email");

        PlayerPrefs.DeleteKey(param);

        LoadView("Login");
    }
    private void CheckAuthenticatedUser()
    {
        string param = UtilsService.GetParam("Email");

        if (PlayerPrefs.HasKey(param))
        {
            emailField.text = PlayerPrefs.GetString(param);
        }
    }
	public static void CheckParentalAlert ()
	{
		if (UserService.user.type.ToLower().Contains("estudante"))
			return;

		int userId = UserService.user._id;
		string param = UtilsService.GetParam("Parental"),
					 hash = string.Format("{0}:{1}", param, userId);

		if (!PlayerPrefs.HasKey(hash))
		{
			PlaySound();

			AlertsService.makeAlert("Aviso", "Essa página é focada para estudantes do município. A maior parte do conteúdo aqui presente foi apresentado por tutores ou professores previamente em sala.", "Entendi");
			PlayerPrefs.SetString(hash, STATUS_DONE);
		}
	}
    public static void CheckParentalAlert()
    {
        if (UserService.user.type.ToLower().Contains("estudante"))
        {
            return;
        }

        int    userId = UserService.user._id;
        string param  = UtilsService.GetParam("Parental"),
               hash   = string.Format("{0}:{1}", param, userId);

        if (!PlayerPrefs.HasKey(hash))
        {
            PlaySound();

            AlertsService.makeAlert("Aviso", "Essa página é focada em Responder Missões e Escolhas relevantes para a sociedade.", "Entendi");
            PlayerPrefs.SetString(hash, STATUS_DONE);
        }
    }
Beispiel #7
0
    public static WWW Login(string email, string password)
    {
        WWWForm loginForm = new WWWForm();

        loginForm.AddField("email", email);
        loginForm.AddField("password", password);

        string paramConnect  = UtilsService.GetParam("Conectar"),
               paramEmail    = UtilsService.GetParam("Email"),
               paramPassword = UtilsService.GetParam("Senha");

        if (PlayerPrefs.HasKey(paramConnect))
        {
            PlayerPrefs.SetString(paramEmail, email);
            PlayerPrefs.SetString(paramPassword, password);
        }

        WebService.route  = ENV.USERS_ROUTE;
        WebService.action = ENV.AUTH_ACTION;

        return(WebService.Post(loginForm));
    }
    private void SaveUser(string data)
    {
        string param = UtilsService.GetParam("Email");

        PlayerPrefs.SetString(param, emailField.text);
    }