// Use this for initialization void Start() { downloadingScreen = GameObject.Find("Downloading_Screen"); currentLevelButtons = new List <GameObject>(); loadLevelButton.onClick.AddListener(delegate { ShowLoadLevelMenu(); }); browseLevelsButton.onClick.AddListener(ShowCloudDataScreen); cloudDataObject.transform.GetChild(0).transform.GetChild(0).GetComponent <Button>().onClick .AddListener(delegate { FirebaseManager.QueryMyLevels(); if (currentMyCloudLevels != null) { foreach (GameObject obj in currentMyCloudLevels) { Destroy(obj); } currentMyCloudLevels.Clear(); } if (currentUserCloudLevels != null) { foreach (GameObject obj in currentUserCloudLevels) { Destroy(obj); } currentUserCloudLevels.Clear(); } }); cloudDataObject.transform.GetChild(0).transform.GetChild(1).GetComponent <Button>().onClick .AddListener(delegate { FirebaseManager.QueryAllLevels(); if (currentUserCloudLevels != null) { foreach (GameObject obj in currentUserCloudLevels) { Destroy(obj); } currentUserCloudLevels.Clear(); } if (currentMyCloudLevels != null) { foreach (GameObject obj in currentMyCloudLevels) { Destroy(obj); } currentMyCloudLevels.Clear(); } }); ReloadLevels(); randomLevelButton.onClick.AddListener(delegate { mainMenu.SetActive(false); loadingScreen.SetActive(true); LoadLevel(LevelManager.Levels[Random.Range(0, LevelManager.Levels.Count)]); }); quitGame.onClick.AddListener(delegate { Application.Quit(); }); Firebase.Unity.Editor.FirebaseEditorExtensions.SetEditorDatabaseUrl(Firebase.FirebaseApp.DefaultInstance, "https://blockquest-a1e16.firebaseio.com/"); if (!FirebaseManager.filesAreDownloaded) { FirebaseManager.CheckNewLevels(); ShowDownloadScreen(); } else { ShowMainMenu(); } FirebaseManager.onFilesDownloaded += ShowMainMenu; FirebaseManager.onFilesDownloaded += ReloadLevels; LogIn(); FirebaseManager.onMyFilesCached += LoadMyLevels; FirebaseManager.onUserFilesCached += LoadUserLevels; }