public void InitializeChatDB(Firebase.Database.DatabaseReference reference, bool playable) { isPlayable = playable; connector = new FirebaseConnector(reference, !playable); if (playable) { fielder = transform.parent.parent.Find("TextField").GetComponent <TextFielder>(); fielder.CleanInputField("メッセージ", ""); } else { //Debug.Log(connector.MyReference.Key); connector.MyReference.ValueChanged += (object sender, Firebase.Database.ValueChangedEventArgs args) => { if (args.DatabaseError != null) { Debug.LogError(args.DatabaseError.Message); return; } string rawMessage = args.Snapshot.Child(messageKey).Value.ToString(); //SendMessageBox(rawMessage); SendMessageBox2(rawMessage); }; } }
private void removeListeners() { Firebase.Database.DatabaseReference dbRef = database.GetReference(tableName); dbRef.ChildAdded -= OnChildAdded; dbRef.ChildChanged -= OnChildChanged; dbRef.ChildRemoved -= OnChildRemoved; }
public void AddBox(BoxData boxData) { string json = JsonUtility.ToJson(boxData); Firebase.Database.DatabaseReference dbRef = Firebase.Database.FirebaseDatabase.DefaultInstance.RootReference; dbRef.Child("users").Push().SetRawJsonValueAsync(json); }
// Use this for initialization void Start() { FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://storybox-hackmit.firebaseio.com/"); Firebase.Database.DatabaseReference reference = FirebaseDatabase.DefaultInstance.RootReference; // Set a flag here indicating that Firebase is ready to use by your // application. Debug.Log("Firebase is ready to go!"); }
private void Awake() { FirebaseApp.DefaultInstance.SetEditorDatabaseUrl( "YOUR_URL"; fbref = Firebase.Database.FirebaseDatabase.DefaultInstance; fb = Firebase.Database.FirebaseDatabase.DefaultInstance.RootReference; }
// Handle initialization of the necessary firebase modules: public void InitializeFirebase() { auth = Firebase.Auth.FirebaseAuth.DefaultInstance; auth.StateChanged += AuthStateChanged; Debug.Log("Setting up Firebase"); FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://cis4250-rot.firebaseio.com/"); db = FirebaseDatabase.DefaultInstance.GetReference("/users"); }
public void InitializeDB(int playerCount, bool isParent, string[] nameArray, int clientNo, Firebase.Database.DatabaseReference masterReference) { playerCnt = playerCount; this.isParent = isParent; connector = new FirebaseConnector(masterReference, isParent); Debug.Log("connected"); InvitePlayers(nameArray, clientNo); this.clientNo = clientNo; NewPlay(); GameObject.Find(SoundPlayer.objectName).GetComponent <SoundPlayer>().PlayBGM( BGMname.Main); }
public void InitializeDB(int no, bool playable, string name, Firebase.Database.DatabaseReference playerReference) { myNo = no; isPlayable = playable; myName = name; myDB = new FirebaseConnector(playerReference, !playable); nameText.text = name; if (isPlayable) { Debug.Log("playable!"); myDB.AddAsync("Name", myName); myDB.AddAsync(selectDBname, -1); } transform.Find("Chatter").GetComponent <Chatter>().InitializeChatDB( playerReference.Child("Chat"), playable); }
public void LoadData() { string DBPath = ""; if (signedIn) { DBPath = "Highscore/" + user.UserId; } else { DBPath = "Highscore/guest/highscores"; } Debug.Log("LoadData called " + DBPath); table_ref = db_ref.Child("Highscore").Child(user.UserId).Child("highscores"); db_ref.Child("Highscore").Child(user.UserId).Child("highscores").GetValueAsync().ContinueWith(task => { if (task.IsFaulted) { return; } else if (task.IsCompleted) { snapshot = task.Result; isLoaded = true; Debug.Log("Loaded : " + isLoaded); } }); //Event listeners //table_ref.ChildAdded += HandleChildAdded; //table_ref.ChildChanged += HandleChildChanged; //table_ref.ChildRemoved += HandleChildRemoved; //table_ref.ChildMoved += HandleChildMoved; table_ref.ValueChanged += HandleValueChanged; }
void Start() { Application.runInBackground = true; mDatabase = Firebase.Database.FirebaseDatabase.GetInstance(urlDatabase).GetReference("/EscapeRoom"); }
public Firebase.Database.DatabaseReference GetReferenceFromRoot(Firebase.Database.DatabaseReference root) { var objectTypeName = ObjectTypeName; return(root.Child(DBVersion).Child(BasePath) /*.Child(objectTypeName)*/); }
// 데이터 베이스 루트로 부터 저장된 데이터를 가져오는 DbVersion/BasePath/ObjectTypeName // 데이터가 여러개이면 복수 ObjectTypeNames <-- s가 붙는 경로 public Firebase.Database.DatabaseReference GetReferenceFromRoot(Firebase.Database.DatabaseReference root) { var objectTypeName = ObjectTypeName + (IsPlural ? "s" : ""); return(root.Child(DbVersion).Child(BasePath).Child(ObjectTypeName)); }
void Start() { grupoIDs = new List <string> (); mDatabase = Firebase.Database.FirebaseDatabase.GetInstance(urlDatabase).GetReference("/EscapeRoom"); }
void Start() { resultadosFinales = new List <int> (); mDatabase = Firebase.Database.FirebaseDatabase.GetInstance(urlDatabase).GetReference("/EscapeRoom"); }