void Start() { starMap.GameOverHandler.AddListener(OnGameOverHandler); NewGame(); historyList = JsonReadFileTool.JsonToClasses <int[]>(PlayerPrefs.GetString("history")).ToList(); if (historyList != null && historyList.Count > 0) { uiPanel.HistoryPoint.text = "历史最高:" + historyList[0]; } else { historyList = new List <int>() { 0 }; } }
// 每帧更新 private void Update() { if (Input.GetKeyDown(KeyCode.Q)) { Debug.Log("调试用, 输出所有星星内容"); GameManager.Instance.starMap.PrintStarList(); } // 查看 历史最高纪录 if (Input.GetKeyDown(KeyCode.W)) { Debug.LogWarning("查看 历史最高纪录"); var historyList = JsonReadFileTool.JsonToClasses <int[]>(PlayerPrefs.GetString("history")).ToList(); if (historyList != null && historyList.Count > 0) { for (int i = 0; i < historyList.Count; i++) { Debug.Log("" + (i + 1) + ": " + historyList[i]); } } } }