- 最后登录
- 2024-3-11
- 注册时间
- 2013-9-17
- 阅读权限
- 90
- 积分
- 40625
- 纳金币
- 26224
- 精华
- 17
|
- using UnityEngine;
-
- namespace Liulala.Project
-
- {
-
- public class Data
-
- {
-
- public System.Action<int, int> OnDateChange;
-
- public int Date1 { get; private set; }
-
- public int Date2 { get; private set; }
-
- public void SetData(int date)
-
- {
-
- Date1 = date;
-
- Date2 = _dateStart + date;
-
- PlayerPrefs.SetInt(NewDate, Date2);
-
- OnDateChange(Date1, Date2);
-
- }
-
- public Data()
-
- {
-
- Date2 = PlayerPrefs.GetInt(NewDate);
-
- _dateStart = Date2;
-
- Date1 = 0;
-
- OnDateChange += (date1, date2) => { };
-
- }
-
- private int _dateStart;
-
- private static readonly string NewDate = “Date2”;
-
- }
-
- }
复制代码- using Liulala.Project;
-
- using UnityEngine;
-
- public class Game : MonoBehaviour
-
- {
-
- private void Start()
-
- {
-
- _Data = new Data();
-
- _Data.OnDateChange += ChangeView();
-
- }
-
- private void ChangeView()
-
- {
-
- }
-
- private Data _Data;
-
- }
复制代码 |
|