public void ShowScore() { for (int i = 0; i < ScoreInfo.scoreList.Count; i++) { transform.Find("List").GetChild(i).gameObject.SetActive(true); transform.Find("List").GetChild(i).transform.Find("question").GetComponent <Text>().text = ScoreInfo.scoreList[i].info; transform.Find("List").GetChild(i).transform.Find("score").GetComponent <Text>().text = ScoreInfo.scoreList[i].wrong.ToString(); score += ScoreInfo.scoreList[i].score; } score = ScoreSave.AddScore(SceneManager.GetActiveScene().name, score); transform.Find("score").GetComponent <Text>().text = score.ToString(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.name == "Ball") { Destroy(collision.gameObject); Lose.SetActive(true); Time.timeScale = 0; ScoreSave.InfSaveScore(); gameObject.GetComponent <AudioSource>().PlayOneShot(soundLose); } if (collision.gameObject.tag == "BonusDamage" || collision.gameObject.tag == "BonusLenght" || collision.gameObject.tag == "BonusScore") { Destroy(collision.gameObject); } }
public static void LoadData() { ScoreSave scoreSave = JsonUtility.FromJson <ScoreSave>(File.ReadAllText(jsonSavePath)); score = scoreSave.serializedScore; date = scoreSave.serializedDateTime; //Debug.Log((TimeSpan)(DateTime.UtcNow - DateTime.Parse(lemonSave.serializedDateTime))); //for testing Debug.Log("Score saved at: " + Score.ScoreCount); ScoreSave.loaded = true; }
public void isEndGame() { if (sceneindex == 6) { Invoke("LoadMainMenu", 1f); } else { if (levelComplete < sceneindex) { PlayerPrefs.SetInt("LevelComplete", sceneindex); } LevelCompl(); ScoreSave.SaveScore(); LevelComplete.SetActive(true); Time.timeScale = 0; } }
public static void SaveData() { //reference ScoreSave scoreSave = new ScoreSave(); //lemonade scoreSave.serializedScore = Score.ScoreCount; ScoreSave.score = scoreSave.serializedScore; //Time scoreSave.serializedDateTime = DateTime.UtcNow.ToString("dd MMMM, yyyy"); Debug.Log("Saving Score @: " + Score.ScoreCount); string jsonData = JsonUtility.ToJson(scoreSave, true); File.WriteAllText(jsonSavePath, jsonData); Debug.Log(jsonData); }
//Set score data to panel texts public void SetData(ScoreSave score) { txtName.text = score.playerName; txtScore.text = score.playerScore.ToString(); }
// Use this for initialization void Start () { scoresave = save.GetComponent<ScoreSave>(); }