Exemplo n.º 1
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;
         }
     }
 }
Exemplo n.º 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;
         }
     }
 }
Exemplo n.º 3
0
 void OnApplicationQuit()
 {
     m_Instance = null;
     PlayerPrefs.SetString(m_QuitTimeKey, System.DateTime.Now.ToString());
     PlayerPrefs.SetInt(m_LastPhysicalKey, ConstantData.physical);
 }
Exemplo n.º 4
0
 void OnApplicationQuit()
 {
     m_Instance = null;
     PlayerPrefs.SetString(m_QuitTimeKey, System.DateTime.Now.ToString());
     PlayerPrefs.SetInt(m_LastPhysicalKey, ConstantData.physical);
 }