public void OnPressButtonAccept() { speakersSubcriptions = new SpeakersSubcriptions(arrayToggles[0].isOn, arrayToggles[1].isOn, arrayToggles[2].isOn ); UpdateBase(); }
public void OnPressButtonRegister() { switch (idSpeaker) { case 0: { boolArray[0] = true; } break; case 1: { boolArray[1] = true; } break; case 2: { boolArray[2] = true; } break; default: break; } speakersSubcriptions = new SpeakersSubcriptions(boolArray[0], boolArray[1], boolArray[2]); UpdateBase(); }
private void OnEnable() { FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://tomaelcontrol-830dd.firebaseio.com/"); FirebaseDatabase.DefaultInstance.GetReference("SpeakersSubcriptions/" + Session.auth.CurrentUser.UserId).GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { //panelLoading.SetActive(false); AggregateException exception = task.Exception as AggregateException; if (exception != null) { FirebaseException fireBaseException = null; foreach (Exception e in exception.InnerExceptions) { //panelLoading.SetActive(false); fireBaseException = e as FirebaseException; if (fireBaseException != null) { break; } } if (fireBaseException != null) { Debug.LogError("FirebaseDatabase defaultInstance getReference encountered an error: " + fireBaseException.Message); textLogError.text = fireBaseException.Message; } } return; } if (task.IsCanceled) { AggregateException exception = task.Exception as AggregateException; if (exception != null) { FirebaseException fireBaseException = null; foreach (Exception e in exception.InnerExceptions) { fireBaseException = e as FirebaseException; if (fireBaseException != null) { break; } } if (fireBaseException != null) { Debug.LogError("FirebaseDatabase defaultInstance getReference encountered an error: " + fireBaseException.Message); textLogError.text = fireBaseException.Message; } } return; } if (task.IsCompleted) { DataSnapshot snapshot = task.Result; speakersSubcriptions = JsonUtility.FromJson <SpeakersSubcriptions>(snapshot.GetRawJsonValue()); arrayToggles[0].isOn = speakersSubcriptions.one; arrayToggles[1].isOn = speakersSubcriptions.two; arrayToggles[2].isOn = speakersSubcriptions.three; } }); }
private void CreateSpeakerSection() { // Set up the Editor before calling into the realtime database. FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://tomaelcontrol-830dd.firebaseio.com/");//Here you should change for you base data link!!!! // Get the root reference location of the database. DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference; SpeakersSubcriptions speakersSubcriptions = new SpeakersSubcriptions(false, false, false); string json = JsonUtility.ToJson(speakersSubcriptions); reference.Child("SpeakersSubcriptions").Child(Session.auth.CurrentUser.UserId).SetRawJsonValueAsync(json).ContinueWith(task => { if (task.IsCanceled) { panelLoading.SetActive(false); Debug.LogError("SetRawJsonValueAsync was canceled."); AggregateException exception = task.Exception as AggregateException; if (exception != null) { FirebaseException fireBaseException = null; foreach (Exception e in exception.InnerExceptions) { fireBaseException = e as FirebaseException; if (fireBaseException != null) { break; } } if (fireBaseException != null) { Debug.LogError("SetRawJsonValueAsync encountered an error: " + fireBaseException.Message); textLogError.text = fireBaseException.Message; } } return; } if (task.IsFaulted) { panelLoading.SetActive(false); Debug.LogError("SetRawJsonValueAsync was faulted."); AggregateException exception = task.Exception as AggregateException; if (exception != null) { FirebaseException fireBaseException = null; foreach (Exception e in exception.InnerExceptions) { fireBaseException = e as FirebaseException; if (fireBaseException != null) { break; } } if (fireBaseException != null) { Debug.LogError("SetRawJsonValueAsync encountered an error: " + fireBaseException.Message); textLogError.text = fireBaseException.Message; } } return; } if (task.IsCompleted) { CreateWorkShops(); } }); }
private void OnEnable() { buttonDoQuestion.SetActive(false); buttonRegister.SetActive(false); panelLoading.SetActive(true); FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://tomaelcontrol-830dd.firebaseio.com/"); FirebaseDatabase.DefaultInstance.GetReference("SpeakersSubcriptions").Child(Session.auth.CurrentUser.UserId).GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { AggregateException exception = task.Exception as AggregateException; if (exception != null) { FirebaseException fireBaseException = null; foreach (Exception e in exception.InnerExceptions) { fireBaseException = e as FirebaseException; if (fireBaseException != null) { break; } } if (fireBaseException != null) { Debug.LogError("FirebaseDatabase defaultInstance getReference encountered an error: " + fireBaseException.Message); textLogError.text = fireBaseException.Message; } } return; } if (task.IsCanceled) { AggregateException exception = task.Exception as AggregateException; if (exception != null) { FirebaseException fireBaseException = null; foreach (Exception e in exception.InnerExceptions) { fireBaseException = e as FirebaseException; if (fireBaseException != null) { break; } } if (fireBaseException != null) { Debug.LogError("FirebaseDatabase defaultInstance getReference encountered an error: " + fireBaseException.Message); textLogError.text = fireBaseException.Message; } } return; } if (task.IsCompleted) { DataSnapshot snapshot = task.Result; speakersSubcriptions = JsonUtility.FromJson <SpeakersSubcriptions>(snapshot.GetRawJsonValue()); /* En el one or two or tree son true y es igual a cualquiera de estos que est en verdarero cambiar el boton*/ boolArray[0] = speakersSubcriptions.one; boolArray[1] = speakersSubcriptions.two; boolArray[2] = speakersSubcriptions.three; switch (idSpeaker) { case 0: { buttonRegister.SetActive(!boolArray[0]); buttonDoQuestion.SetActive(boolArray[0]); } break; case 1: { buttonRegister.SetActive(!boolArray[1]); buttonDoQuestion.SetActive(boolArray[1]); } break; case 2: { buttonRegister.SetActive(!boolArray[2]); buttonDoQuestion.SetActive(boolArray[2]); } break; } panelLoading.SetActive(false); } }); }