Beispiel #1
0
    public void SaveGameData()
    {
        DatabaseReference reference      = FirebaseDatabase.DefaultInstance.GetReference("GalaticRangers");
        DatabaseReference gameReference  = reference.Child("Games").Push();
        GameLogger        gameLogger     = GameLogger.GetInstance();
        string            JSONGameLogger = JsonUtility.ToJson(gameLogger);

        Debug.Log("Json: " + JSONGameLogger);

        gameReference.SetRawJsonValueAsync(JSONGameLogger).ContinueWithOnMainThread(task =>
        {
            if (task.Exception != null)
            {
                Debug.Log("failed: Couldn't save the data to the database.");
            }
            else if (task.IsCompleted)
            {
                Debug.Log("saving completed.");
            }
        });

        //HighscoreModel model = new HighscoreModel("Ultimate_Gamer", 9999, gameReference.Key);
        //HighscoreService.GetInstance().SaveOverAllHighscore(model);

        Debug.Log("Logging Stopped");
        isLoggingStarted = false;
        gameLogger.Reset();
    }
    /*
     * PREPARE THE GAMESCREEN
     * Enable/Disable elements
     * finaly start loading AUDIO ASSET
     */

    void OnPrepareEvent()
    {
        listIndex    = 0;
        nextShowTime = 0;
        nextHitTime  = 0;
        foreach (ClickAreaCtrl c in clickAreas)
        {
            c.gameObject.SetActive(true);
        }
        gameElements.SetActive(true);
        gameUI.SetActive(true);
        ScoreCtrl.ResetScore();
        clicksCount = 0;
        StartCoroutine(LoadAudioAsset());

        GameLogger.Reset();
    }