public void OnPressButtonRegister() { switch (idWorkShops) { case 0: { boolArray[0] = true; } break; case 1: { boolArray[1] = true; } break; case 2: { boolArray[2] = true; } break; default: break; } workShopsSubcriptions = new WorkShopsSubcriptions(boolArray[0], boolArray[1], boolArray[2]); UpdateBase(); }
private void OnEnable() { FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://tomaelcontrol-830dd.firebaseio.com/"); FirebaseDatabase.DefaultInstance.GetReference("WorkShopsSubcriptions/" + 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; workShopsSubcriptions = JsonUtility.FromJson <WorkShopsSubcriptions>(snapshot.GetRawJsonValue()); arrayToggles[0].isOn = workShopsSubcriptions.one; arrayToggles[1].isOn = workShopsSubcriptions.two; arrayToggles[2].isOn = workShopsSubcriptions.three; } }); }
public void OnPressButtonAccept() { workShopsSubcriptions = new WorkShopsSubcriptions(arrayToggles[0].isOn, arrayToggles[1].isOn, arrayToggles[2]); UpdateBase(); }
public void CreateWorkShops() { 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; WorkShopsSubcriptions workShopsSubcriptions = new WorkShopsSubcriptions(false, false, false); string json = JsonUtility.ToJson(workShopsSubcriptions); reference.Child("WorkShopsSubcriptions").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 System.AggregateException; if (exception != null) { FirebaseException fireBaseException = null; foreach (System.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) { panelLoading.SetActive(false); textLogError.text = "We send to you an email for verify your account..."; inputFieldNickName.text = ""; inputFieldEmail.text = ""; inputFieldPassword.text = ""; inputFieldConfirmPassword.text = ""; } }); }
private void OnEnable() { buttonDoQuestion.SetActive(false); buttonRegister.SetActive(false); panelLoading.SetActive(true); FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://tomaelcontrol-830dd.firebaseio.com/"); FirebaseDatabase.DefaultInstance.GetReference("WorkShopsSubcriptions").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; workShopsSubcriptions = JsonUtility.FromJson <WorkShopsSubcriptions>(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] = workShopsSubcriptions.one; boolArray[1] = workShopsSubcriptions.two; boolArray[2] = workShopsSubcriptions.three; switch (idWorkShops) { 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); } }); }