unity实现“使用次数限制时间限制”功能

呆呆萌萌哒LOVE 2019-02-25 02:23:40
int count = 0;
void Start()
{
//限制本地访问exe次数
if (PlayerPrefs.GetInt("count") > 30)
{
Application.Quit();
}
count= PlayerPrefs.GetInt("count");
count+= 1;
PlayerPrefs.SetInt("count", count);
}
void Update()
{
//限制时间
if (System.DateTime.Today.Year > 2019)
{
Application.Quit();
}
else
{
if (System.DateTime.Today.Month > 3)
{
Application.Quit();
}
else
{
if (System.DateTime.Today.Day > 31)
{
Application.Quit();
}
}
}
}
...全文
540 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
wantolive7 2019-02-28
  • 打赏
  • 举报
回复
你想实现的是什么效果?

2,535

社区成员

发帖
与我相关
我的任务
社区描述
Unity3D相关内容讨论专区
游戏unity 技术论坛(原bbs)
社区管理员
  • Unity3D
  • 芝麻粒儿
  • 「已注销」
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

Unity3D社区公告:

  1. 社区致力于解决各种Unity3D相关的“疑难杂症”。
  2. 社区不允许发布与Unity3D或相关技术无关内容。
  3. 社区版主邀请各位一道为打造优秀社区不懈努力。

试试用AI创作助手写篇文章吧