void Update() { Firebase.Database.FirebaseDatabase.GetInstance(urlDatabase).GetReference("/EscapeRoom").ValueChanged += HandleValueChanged; if (mDataSnapshot != null) { if (sesionOk) { if (numGrupos != 0 && groupsConfirmed < numGrupos) { for (int i = 1; i <= numGrupos; i++) { if (mDataSnapshot.Child("Sesion " + actualSesion).Child("Grupos").Child("Grupo " + i).GetValue(true) != null && !numsConfirmed.Contains(i)) { groupsConfirmed++; numsConfirmed.Add(i); } } } if (numGrupos != 0 && numGrupos == groupsConfirmed && tiempoOk) { mDatabase.Child("Sesion " + actualSesion).Child("All Confirmed").SetValueAsync(true); SceneManager.LoadScene("Questions"); } if (gruposOk) { inputTiempo.gameObject.SetActive(true); buttonTiempo.gameObject.SetActive(true); } if (tiempoOk) { waitingGroups.gameObject.SetActive(true); } } else if (mDataSnapshot.Child("Sesiones").GetValue(true) != null) { int sesionAnterior = int.Parse(mDataSnapshot.Child("Sesiones").GetValue(true).ToString()); actualSesion = sesionAnterior + 1; mDatabase.Child("Sesiones").SetValueAsync(actualSesion); mDatabase.Child("Sesion " + actualSesion).Child("All Confirmed").SetValueAsync(false); //mDatabase.RemoveValueAsync (); numsConfirmed = new List <int> (); mDatabase.Child("Sesion " + actualSesion).Child("All Confirmed").SetValueAsync(false); sesionOk = true; } else { mDatabase.Child("Sesiones").SetValueAsync(0); } } }
void Update() { Firebase.Database.FirebaseDatabase.GetInstance(urlDatabase).GetReference("/EscapeRoom").ValueChanged += HandleValueChanged; if (mDataSnapshot != null) { if (!allTerminados) { int terminados = 0; Debug.Log("Final: " + SendData.grupoIDs.Count); for (int i = 0; i < SendData.grupoIDs.Count; i++) { if (mDataSnapshot.Child("Sesion " + GroupManager.actualSesion).Child(SendData.grupoIDs [i]).Child("Resultado").GetValue(true) != null) { terminados++; } } if (terminados == GroupManager.numGrupos) { allTerminados = true; } } else { Debug.Log("Terminado"); if (!allDone) { CheckResults(); } } } }
void DownloadMyHandDB(Firebase.Database.DataSnapshot handSnap) { int handCnt = (int)handSnap.ChildrenCount; handCards.RemoveAll(x => true); for (int i = 0; i < handCnt; i++) { Firebase.Database.DataSnapshot cardRef = handSnap.Child(Card.dbName + i.ToString()); int markNo = int.Parse(cardRef.Child("markNo").GetRawJsonValue()); int value = int.Parse(cardRef.Child("value").GetRawJsonValue()); //Debug.Log(string.Format("{0}:{1}", markNo, value)); handCards.Add(new Card(markNo, value)); } //handCards.SyncCardObjects(); }
public void CategoryPush() { FirebaseDatabase.DefaultInstance.GetReference("furniture").GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { Debug.Log("failed"); } else if (task.IsCompleted) { Firebase.Database.DataSnapshot snapshot = task.Result; Debug.Log(snapshot.Value.ToString()); Debug.Log(FurnitureText_1.text); FurnitureText_1.text = snapshot.Child("furniture_1").Child("furniture_name").Value.ToString(); Debug.Log(FurnitureText_1.text); /* * foreach (var childSnapshot in snapshot.Children) * { * Debug.Log(FurnitureText_1.text); * * FurnitureText_1.text = childSnapshot.Key.ToString() + "\n color : " + * childSnapshot.Child("color").Value.ToString() + * " texture : " + * childSnapshot.Child("texture").Value.ToString() + * " type : " + * childSnapshot.Child("type").Value.ToString(); * * //FurnitureText_1.GetComponent<Image>.sor * FurnitureText_1.text = childSnapshot.Child("furniture_name").Value.ToString(); * * * Debug.Log(FurnitureText_1.text); * * * }*/ } }); ARPanel.SetActive(false); MenuPanel.SetActive(true); isMenuOpen = true; }
void Update() { Firebase.Database.FirebaseDatabase.GetInstance(urlDatabase).GetReference("/EscapeRoom").ValueChanged += HandleValueChanged; Debug.Log("Normal: " + grupoIDs.Count); if (mDataSnapshot != null) { if (!groupsAdded) { for (int i = 1; i <= GroupManager.numGrupos; i++) { if (mDataSnapshot.Child("Sesion " + GroupManager.actualSesion).Child("Grupos").Child("Grupo " + i).Child("userID").GetValue(true) != null) { grupoIDs.Add(mDataSnapshot.Child("Sesion " + GroupManager.actualSesion).Child("Grupos").Child("Grupo " + i).Child("userID").GetValue(true).ToString()); } } groupsAdded = true; } for (int j = 0; j < questionsButton.Count; j++) { if (ButtonListButton.groupActive != 0) { string questionValue = mDataSnapshot.Child("Sesion " + GroupManager.actualSesion).Child(grupoIDs [ButtonListButton.groupActive - 1]).Child("Questions").Child(questionsButton [j].name).GetValue(true).ToString(); if (mDataSnapshot.Child("Sesion " + GroupManager.actualSesion).Child(grupoIDs [ButtonListButton.groupActive - 1]).Child("Detection").Child(questionsButton [j].name).GetValue(true).ToString() == "True") { if (questionValue == "True") { questionsButton [j].image.color = Color.green; } else { questionsButton [j].image.color = Color.red; } } } } } }