12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- using System.Collections.Generic;
- using UnityEngine;
- using SimpleFirebaseUnity;
- public class FirebaseAuthenticationManager : Singleton<FirebaseAuthenticationManager>
- {
- protected override void Awake()
- {
- base.Awake();
- DontDestroyOnLoad(this);
- // InitFireBase();
- EnableEvents();
- }
- private void EnableEvents()
- {
- /* auth.OnSignInWithPasswordSuccess += OnSignInWithPasswordSuccess;
- auth.OnSignInWithPasswordFailed += OnSignInWithPasswordFailed;
- auth.OnSignUpWithPasswordSuccess += OnSignUpWithPasswordSuccess;
- auth.OnSignUpWithPasswordFailed += OnSignUpWithPasswordFailed;
- auth.OnSignInOrUpWithCredentialSuccess += OnSignInOrUpWithCredentialSuccess;
- auth.OnSignInOrUpWithCredentialFailed += OnSignInOrUpWithCredentialFailed;*/
- }
- private void OnSignInWithPasswordSuccess(FirebaseAuthentication sender, DataSnapshot snapshot)
- {
- // Debug.Log("[OK] Raw Json: " + snapshot.RawJson);
- // Dictionary<string, object> dict = snapshot.Value<Dictionary<string, object>>();
- List<string> keys = snapshot.Keys;
- if (keys != null)
- foreach (string key in keys)
- {
- // Debug.Log(key + " = " + dict[key].ToString());
- }
- }
- private void OnSignInWithPasswordFailed(FirebaseAuthentication sender, FirebaseError err)
- {
- // Debug.Log("[ERR] Login : " + err.Message + " (" + (int)err.Status + ")");
- }
- private void OnSignUpWithPasswordSuccess(FirebaseAuthentication sender, DataSnapshot snapshot)
- {
- // Debug.Log("[OK] Raw Json: " + snapshot.RawJson);
- // Dictionary<string, object> dict = snapshot.Value<Dictionary<string, object>>();
- List<string> keys = snapshot.Keys;
- if (keys != null)
- foreach (string key in keys)
- {
- // Debug.Log(key + " = " + dict[key].ToString());
- }
- }
- private void OnSignUpWithPasswordFailed(FirebaseAuthentication sender, FirebaseError err)
- {
- // Debug.Log("[ERR] Login : " + err.Message + " (" + (int)err.Status + ")");
- }
- private void OnSignInOrUpWithCredentialSuccess(FirebaseAuthentication sender, DataSnapshot snapshot)
- {
- // Debug.Log("[OK] Raw Json: " + snapshot.RawJson);
- // Dictionary<string, object> dict = snapshot.Value<Dictionary<string, object>>();
- List<string> keys = snapshot.Keys;
- if (keys != null)
- foreach (string key in keys)
- {
- // Debug.Log(key + " = " + dict[key].ToString());
- }
- }
- private void OnSignInOrUpWithCredentialFailed(FirebaseAuthentication sender, FirebaseError err)
- {
- // Debug.Log("[ERR] Login : " + err.Message + " (" + (int)err.Status + ")");
- }
- }
|