コード例 #1
0
    private IEnumerator _AddOwnership()
    {
        User currentUser = UserService.user;
        int  groupId     = GroupsService.group._id;
        bool isAdmin     = true;

        WWW createRequest = GroupsService.AddMember(currentUser.email, groupId, isAdmin);

        while (!createRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        AlertsService.removeLoadingAlert();
        Debug.Log("Header: " + createRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + createRequest.text);

        if (createRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            LoadView("Groups");
        }
        else
        {
            AlertsService.makeAlert("Erro", "Falha em sua conexão. Tente novamente mais tarde.", "");
            yield return(new WaitForSeconds(3f));

            LoadView("Groups");
        }

        yield return(null);
    }
コード例 #2
0
    private IEnumerator _GetGroups()
    {
        AlertsService.makeLoadingAlert("Recebendo grupos");
        User currentUser   = UserService.user;
        WWW  groupsRequest = GroupsService.GetUserGroups(currentUser._id);

        while (!groupsRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + groupsRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + groupsRequest.text);

        if (groupsRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            GroupsService.UpdateCurrentGroups(groupsRequest.text);
            CreateGroupsCards();
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Tente novamente mais tarde.", "");
            yield return(new WaitForSeconds(3f));

            LoadView("Home");
        }

        yield return(null);
    }
コード例 #3
0
    private IEnumerator _CreateGroup()
    {
        if (!CheckFields())
        {
            AlertsService.makeAlert("Campos inválidos", "Preencha os campos corretamente.", "OK");
            yield break;
        }

        AlertsService.makeLoadingAlert("Criando grupo");

        string groupName        = newGroupName.text,
               groupDescription = newGroupDescription.text;

        WWW createRequest = GroupsService.CreateGroup(groupName, groupDescription);

        while (!createRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + createRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + createRequest.text);

        if (createRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            GroupsService.UpdateCurrentGroup(createRequest.text);
            yield return(StartCoroutine(_AddOwnership()));
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Tente novamente mais tarde.", "Entendi");
        }

        yield return(null);
    }
コード例 #4
0
    private IEnumerator _RemoveGroup()
    {
        AlertsService.makeLoadingAlert("Removendo");
        int groupId = GroupsService.group._id;

        WWW removeRequest = GroupsService.RemoveGroup(groupId);

        while (!removeRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        AlertsService.removeLoadingAlert();
        Debug.Log("Header: " + removeRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + removeRequest.text);

        if (removeRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            LoadView("Groups");
        }
        else
        {
            AlertsService.makeAlert("Falha ao remover", "Verifique sua conexão com a internet e tente novamente mais tarde.", "Entendi");
        }

        yield return(null);
    }
コード例 #5
0
    private IEnumerator _GetGroupMembers()
    {
        int groupId        = GroupsService.group._id;
        WWW membersRequest = GroupsService.GetMembers(groupId);

        while (!membersRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + membersRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + membersRequest.text);

        if (membersRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            GroupsService.UpdateGroupMembers(membersRequest.text);
            CreateMembersCards();
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Tente novamente mais tarde.", "Entendi");
            LoadView("Home");
        }

        yield return(null);
    }
コード例 #6
0
    private IEnumerator _AddMember()
    {
        AlertsService.makeLoadingAlert("Adicionando");

        string userEmail = newMemberEmail.text;
        int    groupId   = GroupsService.group._id;
        bool   isAdmin   = false;

        WWW createRequest = GroupsService.AddMember(userEmail, groupId, isAdmin);

        while (!createRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        AlertsService.removeLoadingAlert();
        Debug.Log("Header: " + createRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + createRequest.text);

        if (createRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            AlertsService.makeAlert("Sucesso", "O usuário foi adicionado com sucesso em seu grupo.", "");
            yield return(new WaitForSeconds(3f));

            LoadView("Group");
            yield return(null);
        }
        else
        {
            AlertsService.makeAlert("Falha ao adicionar", "Verifique se inseriu o endereço de e-mail do usuário corretamente.", "Entendi");
        }

        yield return(null);
    }
コード例 #7
0
    private IEnumerator _SendNewPost()
    {
        AlertsService.makeLoadingAlert("Enviando");

        int    userId      = UserService.user._id;
        string imageBase64 = camService.photoBase64,
               message     = newMessageField.text;

        WWW postForm = TimelineService.NewPost(userId, imageBase64, message);

        while (!postForm.isDone)
        {
            yield return(new WaitForSeconds(1f));
        }

        AlertsService.removeLoadingAlert();
        Debug.Log("Header: " + postForm.responseHeaders["STATUS"]);
        Debug.Log("Text: " + postForm.text);

        if (postForm.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            ReloadView();
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Ocorreu um problema ao enviar sua publicação. Tente novamente.", "Entendi");
        }

        yield return(null);
    }
コード例 #8
0
    private IEnumerator _RemoveMember()
    {
        AlertsService.makeLoadingAlert("Removendo");
        WWW removeRequest = GroupsService.RemoveMember(member._id);

        while (!removeRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + removeRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + removeRequest.text);
        AlertsService.removeLoadingAlert();

        if (removeRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            if (isCurrentUser)
            {
                SceneManager.LoadScene("Groups");
            }
            else
            {
                Destroy(this.gameObject);
            }

            yield return(null);
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Tente novamente mais tarde.", "Entendi");
        }

        yield return(null);
    }
コード例 #9
0
    private IEnumerator _GetPlantTypes()
    {
        AlertsService.makeLoadingAlert("Recebendo plantas");
        WWW typesRequest = PlantsService.GetPlantTypes();

        while (!typesRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + typesRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + typesRequest.text);

        if (typesRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            PlantsService.UpdateLocalPlantTypes(typesRequest.text);

            foreach (PlantType plant in PlantsService.types)
            {
                Debug.Log("Locais: " + plant._places[0].name);
            }

            yield return(StartCoroutine(_GetPlants()));
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Tente novamente mais tarde.", "");
            yield return(new WaitForSeconds(3f));

            LoadView("Home");
        }

        yield return(null);
    }
コード例 #10
0
    private IEnumerator _GetPlants()
    {
        WWW plantsRequest = PlantsService.GetUserPlants(UserService.user._id);

        while (!plantsRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + plantsRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + plantsRequest.text);
        AlertsService.removeLoadingAlert();

        if (plantsRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            PlantsService.UpdateLocalPlants(plantsRequest.text);
            CreatePlantsCard();
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Tente novamente mais tarde.", "");
            yield return(new WaitForSeconds(3f));

            LoadView("Home");
        }

        yield return(null);
    }
コード例 #11
0
    private IEnumerator _GetQuizzes()
    {
        User currentUser = UserService.user;

        AlertsService.makeLoadingAlert("Recebendo quizzes");
        WWW quizzesRequest = QuizzesService.GetQuizzes(currentUser._id);

        while (!quizzesRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        AlertsService.removeLoadingAlert();
        Debug.Log("Header: " + quizzesRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + quizzesRequest.text);

        if (quizzesRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            QuizzesService.UpdateQuizzes(quizzesRequest.text);
            CreateQuizzesCards();
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Tente novamente mais tarde.", "");
            yield return(new WaitForSeconds(3f));

            LoadView("Activities");
        }

        yield return(null);
    }
コード例 #12
0
    private IEnumerator _ExitGroup()
    {
        AlertsService.makeLoadingAlert("Saindo");
        WWW exitRequest = GroupsService.RemoveMember(UserService.user._id);

        while (!exitRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + exitRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + exitRequest.text);
        AlertsService.removeLoadingAlert();

        if (exitRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            AlertsService.makeAlert("Sucesso", "Você saiu do grupo.", "");
            yield return(new WaitForSeconds(2f));

            SceneManager.LoadScene("Groups");
            yield return(null);
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Tente novamente mais tarde.", "Entendi");
            SceneManager.LoadScene("Home");
        }

        yield return(null);
    }
コード例 #13
0
    private IEnumerator _UpdateGroupInfo()
    {
        Group currentGroup  = GroupsService.group;
        WWW   updateRequest = GroupsService.UpdateGroup(currentGroup);

        while (!updateRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        AlertsService.removeLoadingAlert();
        Debug.Log("Header: " + updateRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + updateRequest.text);

        if (updateRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            UpdateFields();
        }
        else
        {
            AlertsService.makeAlert("Falha ao atualizar", "Houve uma falha em sua conexão. Tente novamente mais tarde.", "Entendi");
        }

        yield return(null);
    }
コード例 #14
0
    private IEnumerator _SaveChanges(User aux)
    {
        string photoBase64 = camService.photoBase64;

        WWW updateResponse = UserService.Update(aux, photoBase64);

        while (!updateResponse.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + updateResponse.responseHeaders["STATUS"]);
        Debug.Log("Text: " + updateResponse.text);
        AlertsService.removeLoadingAlert();

        if (updateResponse.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            AlertsService.makeAlert("PERFIL ATUALIZADO", "Suas informações foram atualizadas com sucesso.", "");
            UserService.UpdateLocalUser(aux);
            yield return(new WaitForSeconds(3f));

            ReloadView();
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Verifique sua conexão e tente novamente mais tarde.", "Entendi");
        }

        yield return(null);
    }
コード例 #15
0
    private IEnumerator _GetUserEvents()
    {
        AlertsService.makeLoadingAlert("Recebendo eventos");
        WWW eventsRequest = EventsService.GetUserEvents(UserService.user._id);

        while (!eventsRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + eventsRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + eventsRequest.text);
        AlertsService.removeLoadingAlert();

        if (eventsRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            EventsService.UpdateUserEvents(eventsRequest.text);
        }
        else
        {
            AlertsService.makeAlert("Alerta", "Por conta de um erro em sua conexão, novos pedidos de participação em eventos serão negados por enquanto.", "Entendi");
        }

        yield return(null);
    }
コード例 #16
0
    private IEnumerator _GetEvents()
    {
        AlertsService.makeLoadingAlert("Recebendo eventos");
        WWW eventsRequest = EventsService.GetEvents();

        while (!eventsRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + eventsRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + eventsRequest.text);
        AlertsService.removeLoadingAlert();

        if (eventsRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            StartCoroutine(_GetUserEvents());
            EventsService.UpdateLocalEvents(eventsRequest.text);
            CreateEventCards();
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Tente novamente mais tarde.", "");
            yield return(new WaitForSeconds(3f));

            LoadView("Home");
        }

        yield return(null);
    }
コード例 #17
0
    private IEnumerator _GetTimelinePosts()
    {
        AlertsService.makeLoadingAlert("Recebendo postagens");
        WWW postsRequest = TimelineService.GetTimelinePosts();

        while (!postsRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + postsRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + postsRequest.text);

        if (postsRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            TimelineService.UpdateLocalPosts(postsRequest.text);

            START_POST_INDEX = 0;
            END_POST_INDEX   = (TimelineService.posts.Length < 5) ? TimelineService.posts.Length : 5;

            CreatePostsCards();
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Tente novamente mais tarde.", "");
            yield return(new WaitForSeconds(3f));

            LoadView("Home");
        }

        yield return(null);
    }
コード例 #18
0
    private IEnumerator _SendResponse()
    {
        AlertsService.makeLoadingAlert("Enviando resposta");

        int currentUserId = UserService.user._id,
            missionId     = MissionsService.mission._id,
            groupId       = GetSelectedGroupId(senderTypeDropdown.captionText.text);

        WWW responseRequest = MissionsService.SendResponse(currentUserId, missionId, groupId);

        while (!responseRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + responseRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + responseRequest.text);
        AlertsService.removeLoadingAlert();

        if (responseRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            Mission currentMission = MissionsService.mission;

            if (currentMission.end_message != null && currentMission.end_message.Length > 0)
            {
                OpenModal("Final");
            }
            else
            {
                AlertsService.makeAlert("Resposta enviada", "", "");
                //AlertsService.makeAlert("Resposta enviada", "Boa! Sua resposta foi enviada com sucesso. Você será redirecionado(a) para as missões.", "");
                yield return(new WaitForSeconds(5f));

                LoadView("Missions");
            }
        }
        else
        {
            if (responseRequest.responseHeaders["STATUS"] == HTML.HTTP_400)
            {
                AlertsService.makeAlert("Senha incorreta", "Por favor, verifique se inseriu corretamente o e-mail e senha.", "OK");
            }
            else if (responseRequest.responseHeaders["STATUS"] == HTML.HTTP_404 || responseRequest.responseHeaders["STATUS"] == HTML.HTTP_401)
            {
                AlertsService.makeAlert("Usuário não encontrado", "Por favor, verifique se inseriu corretamente o e-mail e senha.", "OK");
            }
            else
            {
                AlertsService.makeAlert("Falha na conexão", "Tente novamente mais tarde.", "Entendi");
            }
        }

        yield return(null);
    }
コード例 #19
0
    public void LikePost()
    {
        if (UserService.user.points <= 0)
        {
            AlertsService.makeAlert("Sem pontos", "Você não tem pontos para dar. Participe de missões ou faça postagens para ganhar mais.", "OK");
            return;
        }

        bool UPDATE_USER_POINTS = true;

        StartCoroutine(_ChangePostPoints(1, UPDATE_USER_POINTS));
    }
コード例 #20
0
ファイル: PostCard.cs プロジェクト: CompCult/i9edu-mobile
    public void LikePost()
    {
        if (UserService.user.points <= 0)
        {
            AlertsService.makeAlert("Sem Inoves", "Você não tem inoves para dar. Realize atividades para conseguir mais.", "OK");
            return;
        }

        bool UPDATE_USER_POINTS = true;

        StartCoroutine(_ChangePostPoints(1, UPDATE_USER_POINTS));
    }
コード例 #21
0
    private IEnumerator _Register()
    {
        if (!CheckFields())
        {
            AlertsService.makeAlert("Campos inválidos", "Preencha todos os campos corretamente antes de registrar-se.", "Entendi");
            yield break;
        }

        AlertsService.makeLoadingAlert("Registrando");
        User newUser = new User();

        newUser.name     = nameField.text;
        newUser.email    = emailField.text;
        newUser.password = passwordField.text;
        newUser.type     = userTypeDropdown.captionText.text;
        if (institutionFieldObj.activeSelf)
        {
            newUser.institution = institutionField.text;
        }

        WWW registerForm = UserService.Register(newUser);

        while (!registerForm.isDone)
        {
            yield return(new WaitForSeconds(1f));
        }

        AlertsService.removeLoadingAlert();
        Debug.Log("Header: " + registerForm.responseHeaders["STATUS"]);
        Debug.Log("Text: " + registerForm.text);

        if (registerForm.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            UserService.UpdateLocalUser(registerForm.text);
            yield return(StartCoroutine(_GetUserPhoto()));
        }
        else
        {
            if (registerForm.responseHeaders["STATUS"] == HTML.HTTP_400)
            {
                AlertsService.makeAlert("E-mail em uso", "O endereço de e-mail inserido está em uso, tente um diferente.", "Entendi");
            }
            else
            {
                AlertsService.makeAlert("Falha na conexão", "Ocorreu um erro inesperado. Tente novamente mais tarde.", "Entendi");
            }
        }

        yield return(null);
    }
コード例 #22
0
        #pragma warning disable 0618
    public static void ToggleRecord()
    {
        if (!hasMicrophone())
        {
            AlertsService.makeAlert("Sem microfone", "Nenhum microfone foi encontrado em seu dispositivo.", "Entendi");
            return;
        }

        ConfigureMicrophone();

        if (isRecording())         //Recording is in progress, then stop it.
        {
            SavWav.instance.Init();
            var fileName = GetAudioFileName();
            var position = Microphone.GetPosition(micName);

            Microphone.End(micName);             //Stop the audio recording

            var soundData = new float[audioSource.clip.samples * audioSource.clip.channels];
            audioSource.clip.GetData(soundData, 0);

            //Create shortened array for the data that was used for recording
            var newData = new float[position * audioSource.clip.channels];

            //Copy the used samples to a new array
            for (int i = 0; i < newData.Length; i++)
            {
                newData[i] = soundData[i];
            }

            //Creates a newClip with the correct length
            var newClip = AudioClip.Create(fileName,
                                           position,
                                           audioSource.clip.channels,
                                           audioSource.clip.frequency,
                                           true, false);

            newClip.SetData(newData, 0);              //Give it the data from the old clip

            //Replace the old clip
            AudioClip.Destroy(audioSource.clip);
            audioSource.clip = newClip;

            SavWav.instance.Save(fileName, audioSource.clip);
        }
        else         // Starts the recording
        {
            audioSource.clip = Microphone.Start(micName, true, 600, maxFreq);
        }
    }
コード例 #23
0
    public void LikePost()
    {
        if (UserService.user.points <= 0)
        {
            string title   = string.Format("Sem {0}(s)", ENV.POINT),
                   message = string.Format("Você não tem {0}(s) para dar. Realize os Atos e participe no aplicativo para ganhar mais.", ENV.POINT);

            AlertsService.makeAlert(title, message, "OK");
            return;
        }

        bool UPDATE_USER_POINTS = true;

        StartCoroutine(_ChangePostPoints(1, UPDATE_USER_POINTS));
    }
コード例 #24
0
    public void CheckQuantity()
    {
        if (quantityField.text.Length >= 1)
        {
            int quantity     = int.Parse(quantityField.text),
                requestLimit = UserService.user.request_limit;

            if (quantity > requestLimit)
            {
                string message = "Seu limite de mudas por pedido é de " + requestLimit + " mudas. Realize ações no aplicativo ou entre em contato com a SESUMA para aumentar seu limite.";

                AlertsService.makeAlert("Pedido grande", message, "Entendi");
                quantityField.text = requestLimit.ToString();
            }
        }
    }
コード例 #25
0
	public static void CheckParentalAlert ()
	{
		if (UserService.user.type.ToLower().Contains("estudante"))
			return;

		int userId = UserService.user._id;
		string hash = "CompGirls:Parental:" + 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);
		}
	}
コード例 #26
0
    private IEnumerator _SendResponse()
    {
        AlertsService.makeLoadingAlert("Enviando");

        Quiz   currentQuiz = QuizzesService.quiz;
        User   currentUser = UserService.user;
        string answer      = this.alternative;

        WWW responseRequest = QuizzesService.SendResponse(currentQuiz._id, currentUser._id, answer);

        while (!responseRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        Debug.Log("Header: " + responseRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + responseRequest.text);
        AlertsService.removeLoadingAlert();

        if (responseRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            string message;

            if (currentQuiz.HasCorrectAnswer())
            {
                message = string.Format("Se você marcou a alternativa correta, será recompensado(a) com {0}s em breve!", ENV.POINT);
            }
            else
            {
                message = string.Format("Sua resposta será analisada o(a) recompensaremos com {0}s se a resposta for válida.", ENV.POINT);
            }

            AlertsService.makeAlert("Resposta enviada", message, "");

            yield return(new WaitForSeconds(4f));

            SceneManager.LoadScene("Quizzes");
            yield return(null);
        }
        else
        {
            AlertsService.makeAlert("Falha na conexão", "Tente novamente mais tarde.", "Entendi");
            SceneManager.LoadScene("Home");
        }

        yield return(null);
    }
コード例 #27
0
    private IEnumerator _CheckMaintenance()
    {
        WWW   checkRequest = SystemService.CheckMaintenance();
        float timeLoading  = 0f;

        while (!checkRequest.isDone)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        if (timeLoading < 3.0f)
        {
            float remainingTime = 3.0f - timeLoading;
            yield return(new WaitForSeconds(remainingTime));
        }

        Debug.Log("Header: " + checkRequest.responseHeaders["STATUS"]);
        Debug.Log("Text: " + checkRequest.text);

        if (checkRequest.responseHeaders["STATUS"] == HTML.HTTP_200)
        {
            if (checkRequest.text == IN_MAINTENANCE)
            {
                string message = string.Format("O {0} está em manutenção no momento. Por favor, tente novamente mais tarde.", ENV.GAME);

                loadingHolder.SetActive(false);
                AlertsService.makeAlert("EM MANUTENÇÃO", message, "Entendi");
                reloadButton.gameObject.SetActive(true);
            }
            else
            {
                LoadView("Login");
            }
        }
        else
        {
            string message = string.Format("Houve uma falha na conexão com o {0}. Por favor, tente novamente mais tarde.", ENV.GAME);

            loadingHolder.SetActive(false);
            AlertsService.makeAlert("FALHA NA CONEXÃO", message, "OK");
            reloadButton.gameObject.SetActive(true);
        }

        yield return(null);
    }
コード例 #28
0
    public void SendResponse()
    {
        string message = null;

        if (currentAnswer != null)
        {
            if (currentMission.has_image && currentAnswer.image == null)
            {
                message = "Você precisa registrar uma foto antes de enviar essa resposta.";
            }

            if (currentMission.has_audio && currentAnswer.audio == null)
            {
                message = "Você precisa capturar um áudio antes de enviar essa resposta.";
            }

            if (currentMission.has_video && currentAnswer.video == null)
            {
                message = "Você precisa registrar um vídeo antes de enviar essa resposta.";
            }

            if (currentMission.has_text && currentAnswer.text_msg == null)
            {
                message = "Você precisa escrever um texto antes de enviar essa resposta.";
            }

            if (currentMission.has_geolocation && (currentAnswer.location_lat == null || currentAnswer.location_lng == null))
            {
                message = "Você precisa registrar sua geolocalização antes de enviar essa resposta.";
            }
        }
        else
        {
            message = "Você precisa enviar os dados solicitados pela missão antes de enviar uma resposta.";
        }

        if (message == null)
        {
            StartCoroutine(_SendResponse());
        }
        else
        {
            AlertsService.makeAlert("Aviso", message, "Entendi");
        }
    }
コード例 #29
0
 public static void ToggleAudio()
 {
     if (audioSource.clip == null)
     {
         AlertsService.makeAlert("Sem gravações", "Você ainda não gravou nenhum áudio para poder reproduzir.", "Entendi");
     }
     else if (isRecorded())
     {
         if (audioSource.isPlaying)
         {
             audioSource.Stop();
         }
         else
         {
             audioSource.Play();
         }
     }
 }
コード例 #30
0
    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);
        }
    }