- 最后登录
- 2014-10-23
- 注册时间
- 2011-7-19
- 阅读权限
- 90
- 积分
- 81303
- 纳金币
- -1
- 精华
- 11
|
本程序演示了如何创建多个定时器,并对定时器样式进行定制以及接受定时器到时的通知信息。
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");
}
本文转自:http://www.supersuraccoon-cocos2 ... r-demo-for-unity3d/ |
|