void Awake()
 {
     if (m_Instance)
         Destroy(gameObject);
     else
     {
         m_Instance = this;
         DontDestroyOnLoad(gameObject);
         if (PlayerPrefs.HasKey(m_LastPhysicalKey))
         {
             ConstantData.physical = PlayerPrefs.GetInt(m_LastPhysicalKey);
         }
         if (PlayerPrefs.HasKey(m_QuitTimeKey))
         {
             DTime time = DTime.Parse(PlayerPrefs.GetString(m_QuitTimeKey));
             DTime now = DTime.Now;
             DSpan span = now - time;
             int ap = span.Minutes / 30;
             ConstantData.physical += ap;
         }
     }
 }
示例#2
0
 void Awake()
 {
     if (m_Instance)
     {
         Destroy(gameObject);
     }
     else
     {
         m_Instance = this;
         DontDestroyOnLoad(gameObject);
         if (PlayerPrefs.HasKey(m_LastPhysicalKey))
         {
             ConstantData.physical = PlayerPrefs.GetInt(m_LastPhysicalKey);
         }
         if (PlayerPrefs.HasKey(m_QuitTimeKey))
         {
             DTime time = DTime.Parse(PlayerPrefs.GetString(m_QuitTimeKey));
             DTime now  = DTime.Now;
             DSpan span = now - time;
             int   ap   = span.Minutes / 30;
             ConstantData.physical += ap;
         }
     }
 }
 void OnApplicationQuit()
 {
     m_Instance = null;
     PlayerPrefs.SetString(m_QuitTimeKey, System.DateTime.Now.ToString());
     PlayerPrefs.SetInt(m_LastPhysicalKey, ConstantData.physical);
 }
示例#4
0
 void OnApplicationQuit()
 {
     m_Instance = null;
     PlayerPrefs.SetString(m_QuitTimeKey, System.DateTime.Now.ToString());
     PlayerPrefs.SetInt(m_LastPhysicalKey, ConstantData.physical);
 }