void Start()
    {
        canvas         = transform.parent.gameObject;
        menuController = transform.parent.gameObject;

        DbFire dbFire = new DbFire();

        dbFire.GetLevels(
            delegate(Firebase sender, DataSnapshot snapshot) {
            Dictionary <string, object> dict = snapshot.Value <Dictionary <string, object> >();
            List <string> levels             = snapshot.Keys;
            List <LevelFire> levelsFire      = new List <LevelFire>();

            if (levels != null)
            {
                foreach (string level in levels)
                {
                    Debug.Log(level + " = " + Json.Serialize(dict[level]));
                    LevelFire levelFire = new LevelFire(Json.Serialize(dict[level]), level);
                    if (!levelFire.Disabled)
                    {
                        levelsFire.Add(levelFire);
                    }
                }
            }
            addDinamicallyButtons(levelsFire);
        },
            delegate(Firebase sender, FirebaseError error)
        {
            Debug.Log(error.Message);
        }
            );
    }
Exemple #2
0
    private void firebaseLogin(string email, string password)
    {
        DbFire dbFire = new DbFire();

        this.error.SetActive(false);
        StartCoroutine(dbFire.IsUserValid(
                           email, password,
                           delegate(string uid) {
            Debug.Log(uid);
            GameObject parentUI = transform.parent.gameObject;
            MenuController menuControllerScript = parentUI.GetComponent <MenuController>();
            dbFire.GetUserFire(
                delegate(UserFire u)
            {
                menuControllerScript.GoToMainMenu(u);
            },
                delegate(Firebase sender, FirebaseError error)
            {
                Debug.Log(error.Message);
            }, uid
                );
        },
                           delegate(string error) {
            Debug.Log(error);
            this.error.SetActive(true);
        }

                           ));
    }
Exemple #3
0
        public void End(bool solved)
        {
            gameFire.Solved = solved;
            var jsonGamePlayed = gameFire.ToJson();

            Debug.Log(jsonGamePlayed);
            var dbFire = new DbFire();

            dbFire.InsertGamePlayed(
                delegate(SimpleFirebaseUnity.Firebase f, DataSnapshot d)
            {
                Debug.Log("Push success");
            },
                delegate(SimpleFirebaseUnity.Firebase f, FirebaseError e)
            {
                Debug.Log("Push error");
            },
                jsonGamePlayed
                );
            // TODO: if the json is ok then push into firebase
        }