之前公司的项目要拿给别人演示,所以要加一个月的使用时间。意思就是,一个月后程序的某些功能就不能用了。
说下大致思路:就是获取本地现在的时间比如2016年8月8日8点8分,然后设定一个月后的时间也就是2016年9月8日8点8分。
然后做一个判断,判断俩时间是不是一样,一样就是到期了。然后执行你的某些防止程序运行的代码就行。
我加的是到期后到重要功能页面就是不跳转,怎么都不会进入下一页面,就在这个页面卡着,只能退出程序。
using UnityEngine;
using System.Collections;
//using System.d
public class ToSecondScene : MonoBehaviour {
private bool m_bpress; //是否点击
public UILabel main_label;//label
public GameObject mianban;//警告框面板
public GameObject StandByScene;
// public GameObject StartScene;
public GameObject ThirdScene;
public play myplay;
//取得现在的时间
System.DateTime now = System.DateTime.Now;
//得到任意时间的DateTime(年月日时分秒)
System.DateTime date = new System.DateTime(2016, 9, 8, 12, 0, 0, System.DateTimeKind.Local);
//判断是否超时
private bool overtime;
void OnClick() {
print("into second scene");
if (overtime == true)
{
StandByScene.SetActive(true);