コード例 #1
0
        private void Awake()
        {
            double   lastOADay = BinaryPrefs.GetDouble(LastDayKey);
            DateTime lastDay   = lastOADay == 0.0 ? DateTime.MinValue : DateTime.FromOADate(lastOADay);
            bool     isNextDay = DateTime.Now.Year != lastDay.Year ||
                                 DateTime.Now.Month != lastDay.Month ||
                                 DateTime.Now.Day != lastDay.Day;

            if (lastDay == DateTime.MinValue || isNextDay)
            {
                IncreaseDayCount();
            }
            else
            {
                BinaryPrefs.SetInt(DailySessionCountKey, BinaryPrefs.GetInt(DailySessionCountKey) + 1);
                BinaryPrefs.SetInt(SessionCountKey, BinaryPrefs.GetInt(SessionCountKey) + 1);
            }
        }