// Handle initialization of the necessary firebase modules: void InitializeFirebase() { DebugLog("Setting up Firebase Auth"); auth = Firebase.Auth.FirebaseAuth.DefaultInstance; auth.StateChanged += AuthStateChanged; auth.IdTokenChanged += IdTokenChanged; // Specify valid options to construct a secondary authentication object. otherAuthOptions = new Firebase.AppOptions { ApiKey = "", AppId = "", ProjectId = "" }; if (otherAuthOptions != null && !(String.IsNullOrEmpty(otherAuthOptions.ApiKey) || String.IsNullOrEmpty(otherAuthOptions.AppId) || String.IsNullOrEmpty(otherAuthOptions.ProjectId))) { try { otherAuth = Firebase.Auth.FirebaseAuth.GetAuth(Firebase.FirebaseApp.Create( otherAuthOptions, "Secondary")); otherAuth.StateChanged += AuthStateChanged; otherAuth.IdTokenChanged += IdTokenChanged; } catch (Exception) { DebugLog("ERROR: Failed to initialize secondary authentication object."); } } AuthStateChanged(this, null); }
// Actually start the game, once we've verified that everything // is working and we have the firebase prerequisites ready to go. void StartGame() { // FirebaseApp is responsible for starting up Crashlytics, when the core app is started. // To ensure that the core of FirebaseApp has started, grab the default instance which // is lazily initialized. FirebaseApp app = FirebaseApp.DefaultInstance; CommonData.prefabs = FindObjectOfType <PrefabList>(); CommonData.mainCamera = FindObjectOfType <CameraController>(); CommonData.mainGame = this; Firebase.AppOptions ops = new Firebase.AppOptions(); CommonData.app = Firebase.FirebaseApp.Create(ops); Screen.orientation = ScreenOrientation.Landscape; musicPlayer = CommonData.mainCamera.GetComponentInChildren <AudioSource>(); CommonData.gameWorld = FindObjectOfType <GameWorld>(); // Set up volume settings. MusicVolume = PlayerPrefs.GetInt(StringConstants.MusicVolume, MaxVolumeValue); // Set the music to ignore the listeners volume, which is used for sound effects. CommonData.mainCamera.GetComponentInChildren <AudioSource>().ignoreListenerVolume = true; SoundFxVolume = PlayerPrefs.GetInt(StringConstants.SoundFxVolume, MaxVolumeValue); stateManager.PushState(new States.Startup()); }
void StartGame() { Firebase.AppOptions ops = new Firebase.AppOptions(); CommonData.app = Firebase.FirebaseApp.Create(ops); auth = Firebase.Auth.FirebaseAuth.DefaultInstance; var user = auth.CurrentUser; #if UNITY_EDITOR CommonData.app.SetEditorDatabaseUrl("https://unityfirebasefootballpredictor.firebaseio.com/"); #endif //// Get fixtures and results from database //database_get_fixtures dgf = new database_get_fixtures(); //dgf.get_fixtures_and_results_from_database(); // Get predictions from database database_caller dgp = new database_caller(); CommonData._loaded_predictions = false; dgp.get_predictions_from_database(); // Get fixtures and results CommonData._loaded_fixtures = false; dgp.get_fixtures_and_results_from_database(); // Get scores from database CommonData._loaded_scores = false; dgp.get_scores_from_database(); // If user is signed in if (user != null) { Debug.Log("user is signed in"); Welcome_Text.text = "Welcome back " + user.DisplayName; CommonData.first_home_view = true; //scene_transition_manager.GetComponent<scene_manager>().load_home_scene(); } // If user is not signed in else { Debug.Log("user is not signed in"); scene_transition_manager.GetComponent <scene_manager>().load_no_user_scene(); } }
// Actually start the game, once we've verified that everything // is working and we have the firebase prerequisites ready to go. void StartGame() { // FirebaseApp is responsible for starting up Crashlytics, when the core app is started. // To ensure that the core of FirebaseApp has started, grab the default instance which // is lazily initialized. FirebaseApp app = FirebaseApp.DefaultInstance; // Remote Config data has been fetched, so this applies it for this play session: Firebase.RemoteConfig.FirebaseRemoteConfig.ActivateFetched(); CommonData.prefabs = FindObjectOfType <PrefabList>(); CommonData.mainCamera = FindObjectOfType <CameraController>(); CommonData.mainGame = this; Firebase.AppOptions ops = new Firebase.AppOptions(); CommonData.app = Firebase.FirebaseApp.Create(ops); // Setup database url when running in the editor #if UNITY_EDITOR if (CommonData.app.Options.DatabaseUrl == null) { CommonData.app.SetEditorDatabaseUrl("https://YOUR-PROJECT-ID.firebaseio.com"); } #endif Screen.orientation = ScreenOrientation.Landscape; musicPlayer = CommonData.mainCamera.GetComponentInChildren <AudioSource>(); CommonData.gameWorld = FindObjectOfType <GameWorld>(); // Set up volume settings. MusicVolume = PlayerPrefs.GetInt(StringConstants.MusicVolume, MaxVolumeValue); // Set the music to ignore the listeners volume, which is used for sound effects. CommonData.mainCamera.GetComponentInChildren <AudioSource>().ignoreListenerVolume = true; SoundFxVolume = PlayerPrefs.GetInt(StringConstants.SoundFxVolume, MaxVolumeValue); stateManager.PushState(new States.Startup()); }
public static FirebaseApp Create(AppOptions options, string name) { return(FirebaseApp.CreateAndTrack(() => FirebaseApp.CreateInternal(options.ConvertToInternal(), name), FirebaseApp.GetInstance(name))); }
public static FirebaseApp Create(AppOptions options) { return(FirebaseApp.CreateAndTrack(() => FirebaseApp.CreateInternal(options.ConvertToInternal()), FirebaseApp.GetInstance(FirebaseApp.DefaultName))); }