コード例 #1
0
    void Awake()
    {
        //if (Instance != null)
        //    Destroy(this);

        //DontDestroyOnLoad(gameObject);
        //Instance = this;

        isReady = false;

        FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
        {
            DependencyStatus dependencyStatus = task.Result;
            if (dependencyStatus == DependencyStatus.Available)
            {
                Debug.Log("Firebase pronto pra uso");

                FirebaseApp app = FirebaseApp.DefaultInstance;
                app.SetEditorDatabaseUrl(uRLFirebase);
                if (app.Options.DatabaseUrl != null)
                {
                    app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
                }

                isReady = true;

                FirebaseMessaging.TokenReceived   += OnTokenReceived;
                FirebaseMessaging.MessageReceived += OnMessageReceived;
            }
            else
            {
                Debug.LogError("Could not resolve all Firebase dependencies: " + dependencyStatus);
            }
        });
    }
コード例 #2
0
    // Handle initialization of the necessary firebase modules:
    protected void InitializeFirebase()
    {
        auth = Firebase.Auth.FirebaseAuth.DefaultInstance;
        auth.StateChanged   += AuthStateChanged;
        auth.IdTokenChanged += IdTokenChanged;
        // Specify valid options to construct a secondary authentication object.
        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) {
            }
        }
        AuthStateChanged(this, null);

        FirebaseApp app = FirebaseApp.DefaultInstance;

        // NOTE: You'll need to replace this url with your Firebase App's database
        // path in order for the database connection to work correctly in editor.
        app.SetEditorDatabaseUrl("https://fir-demo-7d7a0.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
        StartListener();
    }
    // Initialize Firebase (duh)
    protected virtual void InitializeFirebase()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl("https://smemrmg2sf.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
        StartListener();
        isFirebaseInitialized = true;

        FirebaseDatabase.DefaultInstance.GetReference("leaderboard")
        .Child(SceneManager.GetActiveScene().name).OrderByChild("time").GetValueAsync().ContinueWith(task =>
        {
            if (task.IsCompleted)
            {
                DataSnapshot snapshot = task.Result;
                foreach (var child in snapshot.Children)
                {
                    leaderBoard.Add(child.Child("playerName").Value.ToString(), (float)child.Child("time").Value);
                }
            }
            ;
        });
    }
コード例 #4
0
 // Spawns firebase and verifies that it is updated.
 private void Awake()
 {
     dependencyStatus = DependencyStatus.UnavailableOther;
     if (spawned == false)
     {
         spawned = true;
         DontDestroyOnLoad(gameObject);
         FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => {
             dependencyStatus = task.Result;
             if (dependencyStatus == DependencyStatus.Available)
             {
                 FirebaseApp app = FirebaseApp.DefaultInstance;
                 app.SetEditorDatabaseUrl("https://lootbox-b9a5e.firebaseio.com/");
                 if (app.Options.DatabaseUrl != null)
                 {
                     app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
                 }
                 databaseReference = FirebaseDatabase.DefaultInstance.RootReference;
                 isInitialized     = true;
                 InitializeFirebase();
             }
             else
             {
                 Debug.LogError(string.Format(
                                    "Could not resolve all Firebase dependencies: {0}", dependencyStatus));
             }
         });
     }
     else
     {
         DestroyImmediate(gameObject);
     }
 }
コード例 #5
0
    // Initialize the Firebase database:
    protected virtual void InitializeFirebaseDatabase()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl(FIREBASE_DATABASE_URL);
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
    }
コード例 #6
0
    public void Initialize()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl("https://watsinthebox-d368f.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
    }
コード例 #7
0
    //Firebase code
    protected virtual void InitializeFirebase()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl("https://vadd-ef60b.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
    }
コード例 #8
0
 void InitializeFirebase()
 {
     FirebaseApp app = FirebaseApp.DefaultInstance;
     // NOTE: You'll need to replace this url with your Firebase App's database
     // path in order for the database connection to work correctly in editor.
     app.SetEditorDatabaseUrl("https://unitytest-a7eaa.firebaseio.com/");
     if (app.Options.DatabaseUrl != null)
         app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
     StartListener();
 }
コード例 #9
0
        internal virtual void initializeFirebase()
        {
            FirebaseApp app = FirebaseApp.DefaultInstance;

            app.SetEditorDatabaseUrl(geoFireUrl);
            if (app.Options.DatabaseUrl != null)
            {
                app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
            }
            geoFire = new GeoFire(FirebaseDatabase.DefaultInstance.GetReference("/geo"));
        }
コード例 #10
0
    void Start()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl("https://djseblak-diamondproduction.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
        startListener();
    }
コード例 #11
0
ファイル: SensorHandler.cs プロジェクト: josacore2017/PlantAR
    protected virtual void InitializeFirebase()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl("https://devise-omniauth-174704.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
        StartListener();
    }
コード例 #12
0
        public void createConnect()
        {
            FirebaseApp app     = FirebaseApp.DefaultInstance;
            string      fireUrl = FireConfig.getInstance().getFirebaseUrl();

            app.SetEditorDatabaseUrl(fireUrl);
            if (app.Options.DatabaseUrl != null)
            {
                app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
            }
        }
コード例 #13
0
        // Initialize the Firebase database:
        protected virtual void InitializeFirebase()
        {
            FirebaseApp app = FirebaseApp.DefaultInstance;

            // NOTE: You'll need to replace this url with your Firebase App's database
            // path in order for the database connection to work correctly in editor.
            app.SetEditorDatabaseUrl("https://malo-za-salo-malo-zares.firebaseio.com/");
            if (app.Options.DatabaseUrl != null)
            {
                app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
            }
        }
コード例 #14
0
    // Initialize the Firebase database:
    protected virtual void InitializeFirebase()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        // NOTE: You'll need to replace this url with your Firebase App's database
        // path in order for the database connection to work correctly in editor

        //This is needed only for the unity editor
        app.SetEditorDatabaseUrl("https://sweetseeds-edcf2.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
        //--------------------------------------
        auth = Firebase.Auth.FirebaseAuth.DefaultInstance;

        auth.CreateUserWithEmailAndPasswordAsync(email, password).ContinueWith(task => {
            if (task.IsCanceled)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync was canceled.");
                return;
            }
            if (task.IsFaulted)
            {
                Debug.LogError("CreateUserWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                return;
            }

            // Firebase user has been created.
            newUser = task.Result;
            Debug.LogFormat("Firebase user created successfully: {0} ({1})",
                            newUser.DisplayName, newUser.UserId);
        });

        auth.SignInWithEmailAndPasswordAsync("*****@*****.**", "strongpassword").ContinueWith(task => {
            if (task.IsCanceled)
            {
                Debug.LogError("SignInWithEmailAndPasswordAsync was canceled.");
                return;
            }
            if (task.IsFaulted)
            {
                Debug.LogError("SignInWithEmailAndPasswordAsync encountered an error: " + task.Exception);
                return;
            }
            newUser = task.Result;
            Debug.LogFormat("User signed in successfully: {0} ({1})",
                            newUser.DisplayName, newUser.UserId);
            //Getting client id for FB using device id
            FirebaseDatabase.DefaultInstance.GetReference("node1").Child("node2").Child("node3")
            .ValueChanged += AuthStateChanged;
        });
    }
コード例 #15
0
    void InitializeFirebase()
    {
        app = FirebaseApp.DefaultInstance;
        app.SetEditorDatabaseUrl("https://match-and-scratch-92345929.firebaseio.com/");

        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }

        InitializeFirebaseConfig();
        InitializeFirebaseScores();
    }
コード例 #16
0
    protected virtual void InitializeFirebase(string dat)
    {
        GetComponent <MyDebug>().Log("Initializ  " + PengembangSebelah.ModelFirebase.DatabaseUrl);
        FirebaseApp app = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl(PengembangSebelah.ModelFirebase.DatabaseUrl);
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
        StartGetDat(dat);
        isFirebaseInitialized = true;
    }
コード例 #17
0
ファイル: FirebaseUser.cs プロジェクト: jonigata/PatchApp
    // Initialize the Firebase database:
    void InitializeFirebase()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl("https://" + editorDatabaseHostName + ".firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
        root = FirebaseDatabase.DefaultInstance.RootReference;
        Debug.Log("InitializeFirebase");
        a = onInitializeDone.Invoke;
    }
コード例 #18
0
    // Initialize the Firebase database:
    void InitializeFirebase()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl("https://flappy-birds-testing.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }

        leaderBoard = new ArrayList();
        leaderBoard.Add("Firebase Top " + MaxScores.ToString() + " Scores");
        FirebaseDatabase.DefaultInstance.GetReference("Leaders").OrderByChild("score").ValueChanged += (object sender2, ValueChangedEventArgs e2) =>
        {
            if (e2.DatabaseError != null)
            {
                Debug.LogError(e2.DatabaseError.Message);
                return;
            }
            string title = leaderBoard[0].ToString();
            leaderBoard.Clear();
            leaderBoard.Add(title);
            if (e2.Snapshot != null && e2.Snapshot.ChildrenCount > 0)
            {
                foreach (var childSnapshot in e2.Snapshot.Children)
                {
                    if (childSnapshot.Child("score") == null ||
                        childSnapshot.Child("score").Value == null)
                    {
                        Debug.LogError("Bad data in sample.  Did you forget to call SetEditorDatabaseUrl with your project id?");
                        break;
                    }
                    else
                    {
                        Dictionary <string, object> newScoreMap = new Dictionary <string, object>();


                        newScoreMap["score"] = childSnapshot.Child("score").Value;
                        newScoreMap["email"] = childSnapshot.Child("email").Value;

                        leaders_board.Add(newScoreMap);



                        leaderBoard.Insert(1, childSnapshot.Child("score").Value.ToString()
                                           + "  " + childSnapshot.Child("email").Value.ToString());
                    }
                }
            }
        };
    }
コード例 #19
0
    private void InitializeFirebase()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl("https://helloar-cc880.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }

        // Get the root reference location of the database.
        mDatabaseRef = FirebaseDatabase.DefaultInstance.RootReference;
        StartListener();
    }
コード例 #20
0
    // Initialize the Firebase database:
    protected virtual void InitializeFirebase()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        // NOTE: You'll need to replace this url with your Firebase App's database
        // path in order for the database connection to work correctly in editor.
        app.SetEditorDatabaseUrl("https://arnavigation-dd351.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }

        mDatabaseRef = FirebaseDatabase.DefaultInstance.RootReference;
    }
コード例 #21
0
ファイル: ActionStandby.cs プロジェクト: jphacks/TK_1812
        protected override void OnExecute()
        {
            BoardManager.UI.SetActive(false);
            BoardManager.UI.Set(() => OnClick());

            //データベースをセット
            FirebaseApp app = FirebaseApp.DefaultInstance;

            app.SetEditorDatabaseUrl("https://mapboard-5364b.firebaseio.com");
            if (app.Options.DatabaseUrl != null)
            {
                app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
            }
        }
コード例 #22
0
    // Initialize the Firebase database:
    protected virtual void InitializeFirebase()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        // NOTE: You'll need to replace this url with your Firebase App's database
        // path in order for the database connection to work correctly in editor.
        app.SetEditorDatabaseUrl("https://unreal-6279a.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
        Debug.Log("Before Display.");
        Display();
    }
コード例 #23
0
    // Initialize the Firebase database:
    protected virtual void InitializeFirebase()
    {
        Debug.Log("COMENZAMOS FIREBASE");
        FirebaseApp app = FirebaseApp.DefaultInstance;

        // NOTE: You'll need to replace this url with your Firebase App's database
        // path in order for the database connection to work correctly in editor.
        app.SetEditorDatabaseUrl("https://devise-omniauth-174704.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
        StartListener();
    }
コード例 #24
0
        // Initialize the Firebase database:
        protected virtual void InitializeFirebase()
        {
            FirebaseApp app = FirebaseApp.DefaultInstance;

            // NOTE: You'll need to replace this url with your Firebase App's database
            // path in order for the database connection to work correctly in editor.
            app.SetEditorDatabaseUrl("https://facultydocs-1b5e4.firebaseio.com/");
            if (app.Options.DatabaseUrl != null)
            {
                app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
            }
            StartListener();
            isFirebaseInitialized = true;
        }
コード例 #25
0
    private void InitializeFirebase()
    {
        Debug.Log("creating DB instance....");
        WaitForSeconds wait = new WaitForSeconds(3f);
        FirebaseApp    app  = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl("https://handyscheduler-b716b.firebaseio.com/"); //need to define later
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }
        Debug.Log("instance created...");
        //StartListener();
    }
コード例 #26
0
ファイル: UIHandler.cs プロジェクト: cen-paris8/unity-tally
        // Initialize the Firebase database:
        protected virtual void InitializeFirebase()
        {
            FirebaseApp app = FirebaseApp.DefaultInstance;

            // NOTE: You'll need to replace this url with your Firebase App's database
            // path in order for the database connection to work correctly in editor.
            app.SetEditorDatabaseUrl("https://tracksgame-29058.firebaseio.com"); // https://unity-test-app-fc4db.firebaseio.com/
            if (app.Options.DatabaseUrl != null)
            {
                app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
            }
            StartListener();
            isFirebaseInitialized = true;
        }
コード例 #27
0
ファイル: PushAndPull.cs プロジェクト: tanweipeng/UNREAL
 // Handle initialization of the necessary firebase modules:
 void InitializeFirebase()
 {
     app = FirebaseApp.DefaultInstance;
     // NOTE: You'll need to replace this url with your Firebase App's database
     // path in order for the database connection to work correctly in editor.
     app.SetEditorDatabaseUrl("https://unreal-6279a.firebaseio.com/");
     if (app.Options.DatabaseUrl != null)
     {
         app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
     }
     //auth.StateChanged += AuthStateChanged;
     //AuthStateChanged(this, null);
     Debug.Log("Initialization of firebase ended.(In SignIn Script.)");
 }
        // Initialize the Firebase database:
        protected virtual void InitializeFirebase()
        {
            FirebaseApp app = FirebaseApp.DefaultInstance;

            // NOTE: You'll need to replace this url with your Firebase App's database
            // path in order for the database connection to work correctly in editor.
            app.SetEditorDatabaseUrl("https://testing-krho.firebaseio.com/");
            if (app.Options.DatabaseUrl != null)
            {
                app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
            }
            FirebaseMessaging.SubscribeAsync("DruzinaVrhovec").ContinueWith(task => {
                LogTaskCompletion(task, "SubscribeAsync");
            });
        }
コード例 #29
0
    // Initialize the Firebase database:
    void InitializeFirebase()
    {
        FirebaseApp app = FirebaseApp.DefaultInstance;

        app.SetEditorDatabaseUrl("https://vr-one-4e3bb.firebaseio.com/");
        if (app.Options.DatabaseUrl != null)
        {
            app.SetEditorDatabaseUrl(app.Options.DatabaseUrl);
        }

        ObjectSpawner     spawner   = GetComponent <ObjectSpawner>();
        DatabaseReference reference = FirebaseDatabase.DefaultInstance.GetReference("Users").Child(spawner.palaceUserID).Child("palace");

        reference.ChildAdded += HandleChildAdded;
    }
コード例 #30
0
 private void SetSettings()
 {
     FirebaseApp.SetEditorDatabaseUrl("https://textquest-test.firebaseio.com/");
     DbRoot = FirebaseDatabase.DefaultInstance.RootReference;
     DbRoot.ValueChanged += OnRootChanges;
     OnInitialized.Invoke();
 }