Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System;
- public class TimeSystem : MonoBehaviour
- {
- #region Singleton
- public static TimeSystem Instance { get; private set; }
- private void InitSingleton()
- {
- Instance = this;
- }
- #endregion
- private void Awake()
- {
- InitSingleton();
- CheckOffline();
- }
- private void CheckOffline()
- {
- TimeSpan ts;
- if (PlayerPrefs.HasKey("LastSession"))
- {
- ts = DateTime.Now - DateTime.Parse(PlayerPrefs.GetString("LastSession"));
- print(String.Format("Вы отсутствовали: {0} Дней, {1} часов, {2} минут, {3} секунд", ts.Days, ts.Hours, ts.Minutes, ts.Seconds));
- }
- PlayerPrefs.SetString("LastSession", DateTime.Now.ToString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement