コード例 #1
0
ファイル: TimeDriver.cs プロジェクト: shineTeam7/home3
        /** 添加timeEx */
        private int addTimeEx(TimeExecuteData tData)
        {
            int index = _timeExIndexMaker.get();

            tData.index = index;

            _timeExDic.put(index, tData);

            return(index);
        }
コード例 #2
0
ファイル: TimeDriver.cs プロジェクト: shineTeam7/home3
        /// <summary>
        /// 暂停时间ex
        /// </summary>
        public void pauseTimeEx(int index, bool value)
        {
            TimeExecuteData tData = _timeExDic.get(index);

            if (tData == null)
            {
                return;
            }

            tData.pause = value;
        }
コード例 #3
0
ファイル: TimeDriver.cs プロジェクト: shineTeam7/home3
        /// <summary>
        /// 重置timeEx
        /// </summary>
        public void resetTimeEx(int index, int delay)
        {
            TimeExecuteData tData = _timeExDic.get(index);

            if (tData == null)
            {
                return;
            }

            tData.time    = 0;
            tData.timeMax = delay;
        }
コード例 #4
0
ファイル: TimeDriver.cs プロジェクト: shineTeam7/home3
        /// <summary>
        /// 立即结束timeOut
        /// </summary>
        public void finishTimeOut(int index)
        {
            TimeExecuteData tData = _timeExDic.get(index);

            if (tData == null)
            {
                return;
            }

            clearTimeOut(index);

            executeTimeExFunc(tData);
        }
コード例 #5
0
ファイル: TimeDriver.cs プロジェクト: shineTeam7/home3
        /// <summary>
        /// 延迟delay毫秒,执行方法
        /// </summary>
        public int setTimeOut(Action func, int delay)
        {
            if (delay <= 0)
            {
                Ctrl.throwError("传入的时间间隔<=0", delay);
                return(-1);
            }

            TimeExecuteData tData = new TimeExecuteData();

            tData.func    = func;
            tData.timeMax = delay;
            tData.isGoOn  = false;

            return(addTimeEx(tData));
        }
コード例 #6
0
ファイル: TimeDriver.cs プロジェクト: shineTeam7/home3
        /// <summary>
        /// 间隔delay毫秒,执行方法(如掉帧,只回调一次)
        /// </summary>
        public int setInterval(Action <int> func, int delay)
        {
            if (delay <= 0)
            {
                Ctrl.throwError("传入的时间间隔<=0", delay);
                return(-1);
            }

            TimeExecuteData tData = new TimeExecuteData();

            tData.intFunc = func;
            tData.timeMax = delay;
            tData.isGoOn  = true;
            tData.isCut   = true;

            return(addTimeEx(tData));
        }
コード例 #7
0
ファイル: TimeDriver.cs プロジェクト: shineTeam7/home3
 private void executeTimeExFunc(TimeExecuteData tData)
 {
     try
     {
         if (tData.isCut)
         {
             tData.intFunc(tData.intArg);
         }
         else
         {
             tData.func();
         }
     }
     catch (Exception e)
     {
         Ctrl.errorLog(e);
     }
 }
コード例 #8
0
ファイル: TimeDriver.cs プロジェクト: shineTeam7/home3
        /** 移除timeEx */
        private void removeTimeEx(int index)
        {
            if (index <= 0)
            {
                Ctrl.throwError("timeIndex不能<=0");

                return;
            }

            TimeExecuteData tData = _timeExDic.get(index);

            if (tData == null)
            {
                return;
            }

            _timeExDic.remove(index);
        }