Exemplo n.º 1
0
    public void Delete()
    {
        if (sended)
        {
            return;
        }

        sended = true;

        TrainingData.Training activeQuestion = Data.Instance.trainingData.activeQuestion;
        Data.Instance.firebaseAuthManager.DeleteTraining(activeQuestion.key);

        Back();
    }
Exemplo n.º 2
0
    public void OnSubmit()
    {
        string tooltipText = "No puede estar vacío este campo";

        if (IsEmpty(pregunta))
        {
            Events.OnTooltip(tooltipText, pregunta.transform);
        }
        else if (IsEmpty(respuesta_bien))
        {
            Events.OnTooltip(tooltipText, respuesta_bien.transform);
        }
        else if (IsEmpty(respuesta_1))
        {
            Events.OnTooltip(tooltipText, respuesta_1.transform);
        }
        else if (IsEmpty(respuesta_2))
        {
            Events.OnTooltip(tooltipText, respuesta_2.transform);
        }
        else
        {
            if (sended)
            {
                return;
            }

            sended = true;

            TrainingData.Question question = new TrainingData.Question();
            question.pregunta        = pregunta.text;
            question.respuesta_bien  = respuesta_bien.text;
            question.respuesta_mal_1 = respuesta_1.text;
            question.respuesta_mal_2 = respuesta_2.text;
            TrainingData.Training activeQuestion = Data.Instance.trainingData.activeQuestion;

            if (activeQuestion != null && activeQuestion.key != null)
            {
                Data.Instance.firebaseAuthManager.SaveTraining(question, activeQuestion.key);
            }
            else
            {
                Data.Instance.firebaseAuthManager.SaveTraining(question);
            }

            Events.OnRefreshTrainingData();

            Invoke("Back", 1);
        }
    }