纳金网

标题: Unity3D定时器演示程序 [打印本页]

作者: 晃晃    时间: 2011-9-23 15:17
标题: Unity3D定时器演示程序
本程序演示了如何创建多个定时器,并对定时器样式进行定制以及接受定时器到时的通知信息。
1.创建定时器:
TimerManager m_timerManager1 = gameObject.AddComponent("TimerManager") as TimerManager;
2.自定义定时器
本程序演示了如何创建多个定时器,并对定时器样式进行定制以及接受定时器到时的通知信息。
1.创建定时器:
TimerManager m_timerManager1 = gameObject.AddComponent("TimerManager") as TimerManager;
2.自定义定时器
//void initTimer(int timerID, int countDownVal, Rect timerRect, GameObject timerHandler, GUIStyle timerStyle)
m_timerManager1.initTimer(1, 11, new Rect(100, 100, 100, 100), gameObject, mySkin.customStyles[0]);
3.控制定时器
m_timerManager1.startTimer();
m_timerManager1.pauseTimer();
m_timerManager1.resumeTimer();
m_timerManager1.stopTimer();
4.监听定时器通知信息
void TimeUpMessage(int timerID)
{      
    UnityEditor.EditorUtility.DisplayDialog("TimeUpMessage", "Timer ID: " + timerID.ToString(), "OK");
}






















作者: Asen    时间: 2011-9-23 15:18
V5 啊  
作者: 彬彬    时间: 2011-10-7 11:43

作者: tc    时间: 2012-2-12 23:27
很经典,很实用,学习了!

作者: C.R.CAN    时间: 2012-2-19 23:29
我就看看,我不说话

作者: 菜刀吻电线    时间: 2012-4-11 23:32
其实楼主所说的这些,俺支很少用!

作者: markq    时间: 2012-4-12 22:47
不错 非常经典 实用
作者: 晃晃    时间: 2012-4-25 23:20
赞一个,哈哈

作者: C.R.CAN    时间: 2012-6-10 23:22
凡系斑竹滴话要听;凡系朋友滴帖要顶

作者: 菜刀吻电线    时间: 2012-8-5 00:08
真不错,全存下来了.

作者: C.R.CAN    时间: 2012-8-24 00:10
都闪开,介个帖子,偶来顶

作者: tc    时间: 2012-8-30 00:52
既来之,则看之!

作者: tc    时间: 2012-11-12 23:40
我是老实人,我来也!





欢迎光临 纳金网 (http://wwww.narkii.com/club/) Powered by Discuz! X2.5