|
资源信息 Tutorial Information
教程名称: | Unity3D 显示系统时间 教程(发帖教程) |
适用引擎: | (适用引擎,为空默认为Unity) |
教程语种: | 中文 |
教程等级: | 1 |
教程格式: | 图文(请用IE9以上浏览器访问本版块) |
教程作者: | 转载自互联网 (如有问题请短消息联系作者或发表回复) |
下载地址: | 无 (兑换积分) |
简单的Demo,获取系统的时间,供菜鸟一看,老鸟勿喷{:soso_e100:}
[code=javascript]var gSkin:GUISkin;
var str="";
var Months:String[]=["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"];
var Days:String[]= ["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20",
"21","22","23","24","25","26","27","28","29","30","31"];
var dNow:System.DateTime;
var i=0;
function OnGUI()
{if(gSkin)GUI.skin=gSkin;
GUILayout.Box("本地日期时间:"+System.DateTime.Now);//本地时间,12小时制的
GUILayout.Box("军事日期时间:"+System.DateTime.Now.ToString("yyyyMMddHHmmss"));
GUILayout.Box("UTC日期时间:"+System.DateTime.UtcNow);//UTC时间
GUILayout.SelectionGrid(System.DateTime.Now.Month-1,Months,3);
GUILayout.SelectionGrid(System.DateTime.Now.Day-1,Days,10);
GUILayout.Box(str+dNow.Now.Year+"年"+dNow.Now.Month+"月"+dNow.Now.Day+" 日"+" "+dNow.Now.Hour+"时"+dNow.Now.Minute+"分"+dNow.Now.Second+"秒");
}
[/code]
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
×
|