void Start()
 {
     RealtimeDBFactory.get().initDoneCB().add(i => {
         realtimeDB = i;
         realtimeDB.subscribe("geo", s => { onReslut(s); });
     });
 }
        private void init(RealtimeDB rdb)
        {
            string hashPath = getPath(DATA_HASH_PATH);

            Debug.Log("debug:" + dev + " type:" + GetType() + " init:" + rdb + " hashPath:" + hashPath);
            rdb.subscribe(hashPath, onHash);
        }
Exemplo n.º 3
0
        public static RealtimeDB get()
        {
            if (instance == null)
            {
#if !UNITY_WEBGL
                instance = new RealtimeDBOfficial();
#endif
            }
            instance.init(getAuther());
            return(instance);
        }
    private void putAll(RealtimeDB dB)
    {
        IObservable <int>[] ios = new IObservable <int> [1000];
        for (int idx = 0; idx < ios.Length; idx++)
        {
            ios[idx] = Observable.Start(() => {
                // heavy method...
                System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1));
                string msg = "aaaa_" + testI++;
                dB.put("qq/22", msg);
                Debug.Log("putToDB:" + msg);
                return(10);
            });
        }

        Observable.WhenAll(ios)
        .ObserveOnMainThread() // return to main thread
        .Subscribe(xs => {
            Debug.Log("DONE");
        });
    }