Unity 项目程序需要加密功能
在unity 场景中有点时候项目程序需要加密功能
新建 Jiami.cs 脚本,挂载在场景中。
脚本内容:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Jiami : MonoBehaviour
{
int i = 0;
// Use this for initialization
void Awake()
{
Debug.Log("加密");
i = PlayerPrefs.GetInt("miwen");
if (i > 20)
{
// Application.Quit();
}
i++;
PlayerPrefs.SetInt("miwen", i);
}
// Update is called once per frame
void Update()
{
Debug.Log("加密");
if (System.DateTime.Today.Year>=2019)
{
if (System.DateTime.Today.Month>=11)
{
if (System.DateTime.Today.Day>=13)
{
Application.Quit();
}
}
}
//if (System.DateTime.Today.Year > 2019 && System.DateTime.Today.Month > 11 && System.DateTime.Today.Day > 10)//限制使用日期2018.09.10日
//{
// // Application.Quit();
//}
}
}
点咱关注加收藏哦 博主有实时的更新