Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
    /// <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);
    }
Exemplo n.º 3
0
    /// <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);
    }
Exemplo n.º 4
0
    /// <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();
    }
Exemplo n.º 5
0
    /// <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);
    }
Exemplo n.º 6
0
        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);
        }