public override void OnInspectorGUI() { base.OnInspectorGUI(); GUILayout.Space(15); GUILayout.BeginHorizontal(); if (GUILayout.Button("Save as JSON", GUILayout.Height(30))) { string path = EditorUtility.SaveFilePanel("Save Firebase Configuration", "", "FirebaseConfig.json", "json"); if (!string.IsNullOrEmpty(path)) { FirebaseSettings.SaveToJson(path); } } if (GUILayout.Button("Load from JSON", GUILayout.Height(30))) { string path = EditorUtility.OpenFilePanel("Open Firebase Configuration", "", "json"); if (!string.IsNullOrEmpty(path)) { FirebaseSettings.LoadFromJson(path); } } GUILayout.EndHorizontal(); }
/// <summary> /// Pushes a list to firebase with a single line, instead of making a new instance /// and all that jazz /// </summary> /// <param name="settings">The settings (location) to push to</param> /// <param name="obj">The list</param> /// <param name="callback">The callback to call after pushing</param> public static void PushList <T>(FirebaseSettings settings, List <T> obj, System.Action <Firebase, DataSnapshot> callback = null) { //Make a new arcade game var game = new ArcadeGame(settings); //And just call push game.logger.pushList <T>(obj, callback); }
/// <summary> /// Initializes a new instance of the <see cref="ArcadeGame"/> class. /// </summary> public ArcadeGame(FirebaseSettings settings) { //Set up settings this.settings = settings; //Set up logger logger = new FirebaseLogger(settings); }
/// <summary> /// Initializes a new instance of the <see cref="FirebaseLogger"/> class. /// </summary> /// <param name="settings">Settings.</param> public FirebaseLogger(FirebaseSettings settings) { //Set up settings this.settings = settings; //Sets up the firebase instance setupFirebaseInstance(); }
/// <summary> /// Initializes a new instance of the <see cref="ArcadeGame"/> class. /// </summary> /// <param name="url">URL.</param> /// <param name="apiKey">API key.</param> public ArcadeGame(string url, string apiKey) { //Make some new settings var settings = new FirebaseSettings(url, apiKey); //Set up settings for this instance this.settings = settings; //Set up logger logger = new FirebaseLogger(settings); }
public FirebaseService(IOptions <FirebaseSettings> firebaseSettings, IHostEnvironment hostEnvironment) { _hostEnvironment = hostEnvironment; string contentRootPath = _hostEnvironment.ContentRootPath; string pathCredential = Path.Combine(contentRootPath, @"App_Data\YOUR-KEY"); Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", pathCredential); _firebaseSettings = firebaseSettings.Value; _fireStoreDb = FirestoreDb.Create(_firebaseSettings.DatabaseName); }