Exemple #1
0
        /// <summary>
        /// 启动计时器
        /// </summary>
        /// <param name="interval">计时器间隔</param>
        /// <param name="count">执行次数</param>
        /// <param name="key">计时器标志</param>
        /// <param name="func">回调函数</param>
        public static bool Start(float interval, int count, string key, TimerCallBackHandle func)
        {
            Clock ck = new Clock();

            if (!mapClock.ContainsKey(key))
            {
                mapClock.Add(key, ck);
                ck.Start(interval, count, func);
            }
            else
            {
                return(false);
            }

            return(true);
        }
		/// <summary>
		/// 启动计时器
		/// </summary>
		/// <param name="interval">计时器间隔</param>
		/// <param name="count">执行次数</param>
		/// <param name="key">计时器标志</param>
		/// <param name="func">回调函数</param>
		public static bool Start(float interval, int count, string key, TimerCallBackHandle func)
		{
			Clock ck = new Clock();
			
			if (!mapClock.ContainsKey(key))
			{
				mapClock.Add(key, ck);
				ck.Start(interval, count, func);
			}
			else
			{
				return false;
			}

			return true;
		}