feat(): 完成将Manager从Gameplay转移到Core,实现循环次数持久化,实现设置面板

This commit is contained in:
2025-10-26 09:32:28 +08:00
parent c1f7418ffa
commit 95616f8c10
20 changed files with 6630 additions and 5767 deletions

View File

@@ -0,0 +1,27 @@
using Core;
using Script.Gameplay.Input;
using UnityEngine;
namespace Script.Gameplay.Global
{
public class GameDataManager : MonoSingleton<GameDataManager>
{
private const string LoopCountKey = "TotalLoopCount";
public int TotalLoopCount { get; private set; }
private void Start()
{
GameManager.Instance.OnGameStart += AddLoop;
// 读取已保存的循环次数
TotalLoopCount = PlayerPrefs.GetInt(LoopCountKey, 0);
Debug.Log("目前循环次数:" + TotalLoopCount);
}
public void AddLoop()
{
TotalLoopCount++;
PlayerPrefs.SetInt(LoopCountKey, TotalLoopCount);
PlayerPrefs.Save();
}
}
}