unity实现简单的加密使用次数限制时间限制功能

using UnityEngine;  
using System.Collections;  
  
public class jiaMI : MonoBehaviour {  
    public System.DateTime time;  
    int mi = 0;  
    // Use this for initialization  
    void Start () {  
        //限制本地访问exe次数  
        if (PlayerPrefs.GetInt("miwen")>30) {  
            Application.Quit();  
        }  
        mi = PlayerPrefs.GetInt("miwen");  
        mi += 1;  
        PlayerPrefs.SetInt("miwen",mi);  
  
    }  
      
    // Update is called once per frame  
    void Update () {  
        // Debug.Log(System.DateTime.Today.Year);  
        //限制时间  
        if (!(System.DateTime.Today.Year < 2017 && System.DateTime.Today.Month < 5 && System.DateTime.Today.Month < 1))  
        {  
            Application.Quit();  
        }  
   
  
    }  
} 

猜你喜欢

转载自blog.csdn.net/chh19941125/article/details/78695102