public static void CompleteTutorial(TutorialData tutData, int seeTime = 1) { if (!HasSeenTutorial(tutData)) { if (!data.finishedTutorials.ContainsKey(tutData.Id)) { data.finishedTutorials.Add(tutData.Id, 0); } data.finishedTutorials[tutData.Id] += 1; if (!cacheHasSeenTutorial.ContainsKey(tutData.Id)) { cacheHasSeenTutorial.Add(tutData.Id, 0); } cacheHasSeenTutorial[tutData.Id] = data.finishedTutorials[tutData.Id]; TutorialManager.activeTutorials.Remove(tutData.Id); if (tutData.saveOnDone) { TutorialManager.Save(); } isShowing = false; onCompleteTutorial?.Invoke(tutData); FirebaseManager.LogEvent($"Tutorial_Done_{tutData.Id}"); } }
private void OnDestroy() { FirebaseManager manager = GetComponent <FirebaseManager>(); manager.OnSignIn -= OnSignedIn; manager.OnRetrieveData -= OnGetDatabaseData; }
private void SetupFirebase() { _firebaseManager = new FirebaseManager(); _firebaseManager.Init(() => { _invites = new Invites(); }); }
public void SubmitNewPlayerScore(int newScore) { // If newScore is greater than playerProgress.highestScore, update playerProgress with the new value and call SavePlayerProgress() if (newScore > playerProgress.highestScore) { playerProgress.highestScore = newScore; FirebaseManager.getInstance().getGameData((result, msg) => { if (result == null) { print("Get avatar shop state from database failed!"); } else { result.multiPlayerPoints = newScore; // also saving high score to firebase DataManager.getInstance().updateGameData(result, (resultBool, message) => { if (resultBool) { Debug.Log("Update high score SUCCESS"); } else { Debug.LogWarning("Update high score failed from database! " + message); } }); } }); SavePlayerProgress(); } }
void Start() { // ---------Initialization of the variables -------------- objects = new GameObject[columnLength * rowLength]; qObjects = new Queue <GameObject> [columnLength]; newInColumn = new int[columnLength]; visited = new bool[columnLength * rowLength]; spawnLocation = new Vector3[columnLength]; objectCurrentPosition = new Dictionary <GameObject, Vector3>(); objectNewPosition = new Dictionary <GameObject, Vector3>(); height = Camera.main.orthographicSize * 2; width = height * Screen.width / Screen.height; // basically height * screen aspect ratio for (int i = 0; i < qObjects.Length; ++i) { qObjects[i] = new Queue <GameObject>(); } firebaseManager = FindObjectOfType <FirebaseManager>(); // ----- End of Initialization -------- SetUpMaterialsArray(); // Initial cloning of the prefabs. Init(); }
/// <summary> /// saving changes to app data to firebase database /// </summary> /// <param name="newAppData">app data (optional)</param> /// <param name="callback">callback to notify caller when task is finished (optional)</param> public void updateGameData(AppData newAppData = null, Action <bool, string> callback = null) { // save default to firebase when avatar is null if (newAppData != null) { this.data = newAppData; } if (data == null) { if (callback != null) { callback(false, "no default data to be saved"); } return; } var fbMgr = FirebaseManager.getInstance(); fbMgr.saveGameData(this.data, (result, msg) => { Debug.Log("dataMgr.saveAvatarData: " + result + ", " + msg); if (callback != null) { callback(result, msg); } }); }
// End challenge and upload score public void EndChallenge() { questionDisplay.SetActive(false); roundEndDisplay.SetActive(true); finalScoreDisplayText.text = "Score: " + playerScore.ToString(); FirebaseManager.getInstance().getGameData((result, msg) => { if (result == null) { print("Get user data from database failed!"); } else { result.challengePoints = playerScore; DataManager.getInstance().updateGameData(result, (resultBool, message) => { if (resultBool) { Debug.Log("Update high score challenge mode SUCCESS"); } else { Debug.LogWarning("Update high score challenge mode failed from database! " + message); } }); } }); }
// This function will be called when user clicks login void doLogin() { string email = inputAcc.text; string password = inputPass.text; FirebaseManager fbMgr = FirebaseManager.getInstance(); fbMgr.doLogin(email, password, (result, msg) => { Debug.Log("doLogin: "******", " + msg); if (result == false) { mytext.text = msg; popupNoUserRecord.SetActive(true); } if (result == true) { Debug.Log("login sucess, check user role"); // TODO: decide student or teacher menu doCheckUserRole(); } // show error message }); }
void Awake() { instance = this; connected = false; //Check that all of the necessary dependencies for Firebase are present on the system FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => { dependencyStatus = task.Result; if (dependencyStatus == DependencyStatus.Available) { //If they are avalible Initialize Firebase InitializeFirebase(); } else { Debug.LogError("Could not resolve all Firebase dependencies: " + dependencyStatus); } }); var obj = FindObjectsOfType <FirebaseManager>(); if (obj.Length == 1) { DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } }
void Start() { // Get firebase manager instance firebase = new FirebaseManager(); // Get necessary GameObjects and Scripts foods = GameObject.FindGameObjectsWithTag("Food"); qaHandler = FindObjectOfType <QAHandler>(); arOrigin = FindObjectOfType <ARSessionOrigin>(); // Initialization placed = false; validPlacementPose = false; wonGame = false; // TODO: Remove healthbar code HealthBar.fillAmount = startHealth; health = startHealth; // Hide all 3d objects in scene ShowFood(false); pet.SetActive(false); petPlane.SetActive(false); // Show Scanning text timerText.SetText("Scanning..."); // Hide View Question Button QuestionButton.gameObject.SetActive(false); // Load Class Data loadClassData(); }
/// <summary> /// an interface for all pages to access user's app data /// </summary> /// <param name="callback">callback to notify caller when task is finished (optional</param> /// <param name="forceReload">to indicate force reload is needed</param> public void getGameData(Action <AppData, string> callback = null, bool forceReload = false) { if (data != null && !forceReload) { if (callback != null) { callback(data, "load from memory"); } return; } // call firebase manager to load data data = null; loading = true; var fbMgr = FirebaseManager.getInstance(); fbMgr.getGameData((newData, msg) => { // firebase return data, update game data loading = false; if (newData != null) { this.data = newData; } // if newData == null => it means error has happended // relay data back to requester via callback if (callback != null) { callback(this.data, msg); } }); }
public void Update() { //Just add a jump if up is pressed if (ArcadeKeymap.player1.up.isDown) { jumps.Add(new Jump { time = Time.time, randNum = Random.value }); } //If the user has pressed the a key, then push data //to firebase if (ArcadeKeymap.player1.A.isDown) { //Just push the data FirebaseManager.PushList <Jump>(firebaseSettings, jumps, (firebase, snapshot) => { //Log the response Debug.Log("<b>response:</b> " + snapshot.RawJson); }); } //Has escape been pressed? If so.. then exit if (ArcadeKeymap.player1.buttonExit.isDown) { ArcadeGame.exit(); } }
void Start() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } //Debug.Log( "CheckAndFixDependenciesAsync", gameObject ); FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => { var dependencyStatus = task.Result; if (dependencyStatus == DependencyStatus.Available) { FirebaseApp.DefaultInstance.SetEditorDatabaseUrl("https://bitflow-a5e50.firebaseio.com/"); Ref = FirebaseDatabase.DefaultInstance.GetReference(""); Initialized = true; } else { Debug.LogError($"Could not resolve all Firebase dependencies: {dependencyStatus}"); } }); }
private void Awake() { FirebaseManager manager = GetComponent <FirebaseManager>(); manager.OnSignIn += OnSignedIn; manager.OnRetrieveData += OnGetDatabaseData; }
private void Start() { isPushMode = true; isTeamColorMode = false; slider_Factor.value = factor; text_Factor.text = $"x{factor:F1}"; DOTween.Init(); RefreshUserInfoUI(); SoundManager.instance.PlayBGM(Global.E_SOUND.BGM_LOBBY); FirebaseManager.Get().LogEvent("Login"); if (UserInfoManager.Get().GetUserInfo().needSeasonReset) { ShowMessageBox(LocalizationManager.GetLangDesc("Seasonpass_Endseason"), LocalizationManager.GetLangDesc("Seasonpass_Endseason"), seasonEndPopup.Initialize); } // TDataShopProductList data; // if (TableManager.Get().ShopProductList.GetData(pd => pd.isShow == true, out data)) // { // Debug.Log(data.googleProductId + ", " + data.appleProductId); // } HideAnotherPanel(); canvasWidth = ((RectTransform)transform).sizeDelta.x; ((RectTransform)arrPanels[0].transform).offsetMin = new Vector2(-canvasWidth * 2, ((RectTransform)arrPanels[0].transform).offsetMin.y); ((RectTransform)arrPanels[0].transform).offsetMax = new Vector2(-canvasWidth * 2, ((RectTransform)arrPanels[0].transform).offsetMin.y); canvasWidth = ((RectTransform)transform).sizeDelta.x; ((RectTransform)arrPanels[1].transform).offsetMin = new Vector2(-canvasWidth, ((RectTransform)arrPanels[1].transform).offsetMin.y); ((RectTransform)arrPanels[1].transform).offsetMax = new Vector2(-canvasWidth, ((RectTransform)arrPanels[1].transform).offsetMin.y); canvasWidth = ((RectTransform)transform).sizeDelta.x; ((RectTransform)arrPanels[3].transform).offsetMin = new Vector2(canvasWidth, ((RectTransform)arrPanels[3].transform).offsetMin.y); ((RectTransform)arrPanels[3].transform).offsetMax = new Vector2(canvasWidth, ((RectTransform)arrPanels[3].transform).offsetMin.y); canvasWidth = ((RectTransform)transform).sizeDelta.x; ((RectTransform)arrPanels[4].transform).offsetMin = new Vector2(canvasWidth * 2, ((RectTransform)arrPanels[4].transform).offsetMin.y); ((RectTransform)arrPanels[4].transform).offsetMax = new Vector2(canvasWidth * 2, ((RectTransform)arrPanels[4].transform).offsetMin.y); mainPagePosX = new float[] { canvasWidth * 2, canvasWidth, 0, -canvasWidth, -canvasWidth * 2 }; Click_MainButton(2); if (listADReward.Count > 0) { AddReward(listADReward.ToArray(), btn_PlayBattle.transform.position); listADReward.Clear(); } }
/// <summary> /// Initializes this class /// </summary> private void Awake() { // Allows this instance to behave like a singleton Instance = this; navManager = GameObject.Find("Managers").GetComponent <NavManager>(); firebaseManager = GameObject.Find("Managers").GetComponent <FirebaseManager>(); }
public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason) { // A product purchase attempt did not succeed. Check failureReason for more detail. Consider sharing // this reason with the user to guide their troubleshooting actions. Debug.Log(string.Format("OnPurchaseFailed: FAIL. Product: '{0}', PurchaseFailureReason: {1}", product.definition.storeSpecificId, failureReason)); FirebaseManager.LogCrashlytics(failureReason.ToString()); FirebaseManager.LogException(new Exception("IAP Purchase Failed")); }
IEnumerator LoadLoginAsyn() { while (!FirebaseManager.Instance().newUserSet) { yield return(new WaitForSeconds(0.5f)); } SceneManager.LoadScene("Login"); }
// Initializes everything needed for the script. private void Start() { firebaseManager = FindObjectOfType <FirebaseManager>(); if (!firebaseManager) { Debug.LogError(gameObject + " couldn't find FirebaseManager"); } }
IEnumerator sc() { while (!FirebaseManager.Instance().writeUserComplete) { yield return(new WaitForSeconds(0.1f)); } SceneManager.LoadScene("ChatingScene"); }
// UI button actions public void Approve() { if (cq == null) { return; } FirebaseManager.getInstance().doApproveQuestion(cq, true, callback); }
public static void ShowError(string msg, string placementName) { string text = string.Format("There was a problem displaying this ads. {0}. Please try again later.", msg); //Manager.Add(PopupController.POPUP_SCENE_NAME, new PopupData(PopupType.OK, text)); Manager.Add(PopupWithImageController.POPUP_SCENE_NAME, new PopupWithImageData(PopupType.OK, text).SetImagePath(Const.DIALOG_ICON_OPPS_PATH)); FirebaseManager.LogEvent($"AdsError_{placementName}", "message", msg); }
//method to save created report to database public void savejReport(jReport report) { //save generated report to the database FirebaseManager.getInstance().saveReport(report, (result, msg) => { Debug.Log(msg); }); }
public void IncreaseLevel(Text text, FirebaseManager firebaseManager) { User.user.Level += 1; User.user.LootBoxes += 1; User.user.ExperienceToNext = User.user.Level * 100; User.user.Experience = User.user.ExperienceToNext - User.user.Experience; text.text = User.user.Level.ToString(); firebaseManager.UpdateDatabaseValues(); }
public void OnNewAccount() { FirebaseManager.CreateNewPlayer( email.text, username.text, pwd.text, this ); }
// Use this for initialization void Start() { if (!isServer) { return; } manager = GetComponent <FirebaseManager>(); rb = GetComponent <Rigidbody>(); }
public void ShowMenuWinner() { menuWinner.SetActive(true); chronometer.Pause(); textTime.text = chronometer.Time.ToString(); buttonPause.SetActive(false); FirebaseManager.SaveMissionStats( new MissionStats(chronometer.Time, CompletionType.Completed, 10)); }
// This function will request to reset the password of the user void doResetPassword() { mytext = inputAcc.text; FirebaseManager fbMgr = FirebaseManager.getInstance(); fbMgr.forgetPassword(mytext); popupforgetpassword.SetActive(false); popup.SetActive(true); }
private void OnDestory() { _auth = null; _app = null; if (_instance == this) { _instance = null; } }
/// <summary> /// getter method to retrieve singlton instance of firebase manager /// </summary> /// <returns>firebase manager instance</returns> static public FirebaseManager getInstance() { if (instance == null) { instance = new FirebaseManager(); } return(instance); }