Ejemplo n.º 1
0
        public void AuthCharacterCreateButton()
        {
            TecWolf.Video.VideoManager.CutscenePlay = true;

            // if (FirebaseController.SignedIn && !FirebaseController.CreatedIn)
            // {
            string Path         = "/usuarios/" + FirebaseController.UserId + "/personagem/";
            string QuestionPath = "/usuarios/" + FirebaseController.UserId + "/informacao/";

            FirebaseController.WriteDataInt(Path, "sexo", Sexo);
            FirebaseController.WriteDataInt(Path, "cor", Cor);
            FirebaseController.WriteDataInt(Path, "nivel", 0);

            if (Questions[0].QuestionInput.text.Length != 10)
            {
                Questions[0].QuestionInput.text = "";
            }

            foreach (var Go in Questions)
            {
                string Key = FirebaseDatabase.DefaultInstance.GetReference("/usuarios/" + FirebaseController.UserId + "/informacao/").Push().Key;

                FirebaseController.WriteDataString(QuestionPath + Key, "pergunta", Go.QuestionText.text);

                if (Go.QuestionInput.text != "")
                {
                    FirebaseController.WriteDataString(QuestionPath + Key, "resposta", Go.QuestionInput.text);
                }
                else
                {
                    FirebaseController.WriteDataString(QuestionPath + Key, "resposta", "Sem Resposta");
                }
            }

            if (!MainType.isOn)
            {
                for (int i = 0; i < CurrentTyper.Length; i++)
                {
                    if (CurrentTyper[i].isOn)
                    {
                        int    TypeValue = CurrentTyper[i].GetComponent <TypeItem>().MonsterLevel;
                        string Key       = FirebaseDatabase.DefaultInstance.GetReference("/usuarios/" + FirebaseController.UserId + "/tipo/").Push().Key;

                        FirebaseController.WriteDataInt("/usuarios/" + FirebaseController.UserId + "/tipo/", Key, TypeValue);
                    }
                }
            }
            else
            {
                for (int i = 0; i < CurrentTyper.Length; i++)
                {
                    int    TypeValue = CurrentTyper[i].GetComponent <TypeItem>().MonsterLevel;
                    string Key       = FirebaseDatabase.DefaultInstance.GetReference("/usuarios/" + FirebaseController.UserId + "/tipo/").Push().Key;

                    FirebaseController.WriteDataInt("/usuarios/" + FirebaseController.UserId + "/tipo/", Key, TypeValue);
                }
            }

            if (AuthCreateName.text != "")
            {
                FirebaseController.WriteDataString("/usuarios/" + FirebaseController.UserId, "nome", AuthCreateName.text);
            }
            else
            {
                FirebaseController.WriteDataString("/usuarios/" + FirebaseController.UserId, "nome", FirebaseController.UserName);
            }

            FirebaseController.WriteDataInt("/usuarios/" + FirebaseController.UserId, "dificuldade", Difficulty.value);

            FirebaseController.WriteDataBool(Path, "criado", true);

            FirebaseController.AuthVerification();

            // SceneManager.LoadScene(SceneManager.GetActiveScene().name);
            // }
        }