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();
        }
 

	}
}

你可能感兴趣的:(unity学习笔记)