Пример #1
0
        public static HRTimer create(TimerType type)
        {

            HRTimer timer = null;

            switch (type)
            {

                case TimerType.DEFAULT:
                    {
                        timer = new DefaultTimer();
                        break;
                    }
                case TimerType.MULTI_MEDIA:
                    {

                        timer = new MultiMediaTimer();
                        break;
                    }
                case TimerType.TIMER_QUEUE:
                    {
                        timer = new TimerQueueTimer();
                        break;
                    }

            }

            return (timer);
        }
Пример #2
0
 public static Timer Add(TimerType timerType, TimerCycles timerCycles, double timerLength)
 {
     string timerID = Guid.NewGuid().ToString();
     Timer timer = Add(timerID, timerType, timerCycles, timerLength);
     timer.TimerID = timerID;
     return timer;
 }
Пример #3
0
		public Timer(float time, float time2)
		{
			Time1 = time;
			Time2 = time2;
			MyType = TimerType.RANDOM_TWO_CONSTANTS;
			Reset();
		}
Пример #4
0
 public Timer CreateTimer(float duration, TimerType type = TimerType.Once, int times = -1)
 {
     ++timerid;
     Timer t = new Timer(duration, timerid, type, times);
     timers.Add(timerid, t);
     return t;
 }
Пример #5
0
 public static Timer Add(string timerID, TimerType timerType, TimerCycles timerCycles, double timerLength)
 {
     Timer timer = new Timer(timerType, timerCycles, HighResTimer.GetCurrentTickCount(), timerLength);
     _timers.Add(timerID, timer);
     timer.TimerID = timerID;
     return timer;
 }
Пример #6
0
        public async Task<IHttpActionResult> PutTimerType(int id, TimerType timerType)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != timerType.TimerTypeID)
            {
                return BadRequest();
            }

            db.Entry(timerType).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TimerTypeExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
Пример #7
0
 public Event(object actor, int delay, TimerType type, string method, object[] arguments)
 {
     Actor = actor;
     Delay = delay;
     Type = type;
     Method = method;
     Arguments = arguments;
 }
Пример #8
0
 public Timer(float duration, int timerId, TimerType type = TimerType.Once, int times = -1)
 {
     countDown = 0.0f;
     this.duration = duration;
     this.timerId = timerId;
     this.type = type;
     state = Phase.NeverStart;
     this.times = times;
 }
Пример #9
0
 internal Timer(TimerType timerType, TimerCycles timerCycles, long startTick, double len)
 {
     Type = timerType;
     Cycles = timerCycles;
     StartTick = startTick;
     LastEventTick = startTick;
     Length = (long)(len * (double)HighResTimer.TicksPerSecond);
     Paused = false;
 }
Пример #10
0
 public static ITimer GetTimer(TimerType timerType)
 {
     switch (timerType)
     {
         case TimerType.Inverted:
             return new FwTimer(1, TimerType.Inverted);
         default:
             return new FwTimer(1, TimerType.Normal);
     }
 }
Пример #11
0
 public Timer(double duration, TimerType timerType, string parameter, bool failContract)
     : base("")
 {
     this.duration = duration;
     this.timerType = timerType;
     this.parameter = parameter;
     this.fakeFailures = !failContract;
     
     disableOnStateChange = false;
 }
Пример #12
0
	public TimerElement (string text, float duration, TimerType type, System.Action onEnd=null) {
		Text = text;
		this.duration = duration
		#if FAST_TIME
		* 0.1f
		#endif
		;
		this.type = type;
		this.onEnd = onEnd;
		Reset ();
	}
Пример #13
0
        public async Task<IHttpActionResult> PostTimerType(TimerType timerType)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.TimerTypes.Add(timerType);
            await db.SaveChangesAsync();

            return CreatedAtRoute("DefaultApi", new { id = timerType.TimerTypeID }, timerType);
        }
Пример #14
0
 public FwTimer()
 {
     // to be sure everything is initialized
     _running = false;
     _interval = DEFAULT_INTERVAL;
     _timer = new Timer {AutoReset = false};
     _timer.Elapsed += OnElapse;
     _status = TimerLogStatus.Disabled;
     _type = TimerType.Inverted;
     _startTime = DateTime.Now;
     _endTime = _startTime.AddSeconds(_interval);
 }
Пример #15
0
        public void SetAffect(string name, Mob afflicted, Mob owner, TimerType durationType, int duration, bool tickmethod, bool endmethod)
        {
            Name = name;
            HandlingName = name.ToLower().Trim();
            Duration = duration;
            DurationType = durationType;
            Owner = owner;
            Afflicted = afflicted;
            Level = Owner.Level;

            CanHasTickMethod = tickmethod;
            CanHasEndMethod = endmethod;
        }
Пример #16
0
 public WaitingPeriodState(int stateId, TimerType timerType, int?delayPeriod, DateInterval?dateInterval,
                           RunOn?runOn, TimeSpan?runAt, RunType?runType, DateTime?runOnDate, DateTime?startDate, DateTime?endDate,
                           IEnumerable <DayOfWeek> runOnDays, int workflowId, IWorkflowService workflowService, IPublishSubscribeService pubSubService)
     : base(stateId)
 {
     this.timerType       = timerType;
     this.delayPeriod     = delayPeriod;
     this.dateInterval    = dateInterval;
     this.runOn           = runOn;
     this.runAt           = runAt;
     this.runType         = runType;
     this.runOnDate       = runOnDate;
     this.startDate       = startDate;
     this.endDate         = endDate;
     this.runOnDays       = runOnDays;
     this.workflowId      = workflowId;
     this.pubSubService   = pubSubService;
     this.workflowService = workflowService;
 }
Пример #17
0
        public void DecrementAffects(Mob mob, TimerType type)
        {
            List <Affect> ToRemove = new List <Affect>();

            foreach (Affect affect in mob.Affects)
            {
                if (affect.DurationType == type)
                {
                    if (affect.Decrement() == 0)
                    {
                        ToRemove.Add(affect);
                    }
                }
            }
            foreach (Affect affect in ToRemove)
            {
                mob.Affects.Remove(affect);
            }
        }
Пример #18
0
        public static void RaiseTimerEvents(TimerType timerType, long engineTick)
        {
            List <string> expiredTimers = new List <string>();

            foreach (KeyValuePair <string, Timer> timer in _timers)
            {
                // checking this TimerType? (i.e., PreCycle or PostCycle)
                if (timer.Value.Type == timerType)
                {
                    // "push" time forward for Paused Timer instances
                    if (Paused || timer.Value.Paused)
                    {
                        timer.Value.LastEventTick += (engineTick - timer.Value.LastEventTick);
                        continue;
                    }

                    // check if Timer.Length time has passed
                    while (engineTick - timer.Value.LastEventTick >= timer.Value.Length)
                    {
                        // save the time this event was scheduled to run;
                        // might be different from engineTick, but storing this value
                        // will ensure that a lag in repeating timer events does not
                        // accumulate over time
                        timer.Value.LastEventTick += timer.Value.Length;

                        // raise the event
                        timer.Value.RaiseTick();

                        // check for any expired timers
                        if (timer.Value.Cycles == TimerCycles.Once)
                        {
                            expiredTimers.Add(timer.Key);
                        }
                    }
                }
            }

            // remove any expired timers
            foreach (string expired in expiredTimers)
            {
                _timers.Remove(expired);
            }
        }
Пример #19
0
        public void Start(uint ms, bool repeat)
        {
            // Kill any existing timer
            Stop();

            // Set the timer type flags
            TimerType timerType = TimerType.TIME_CALLBACK_FUNCTION | (repeat ? TimerType.TIME_PERIODIC : TimerType.TIME_ONESHOT);

            lock (lock_)
            {
                timerId_ = timeSetEvent(ms, 0, TimerCallback, UIntPtr.Zero, (uint)timerType);
                if (timerId_ == 0)
                {
                    throw new Exception("timeSetEvent error");
                }

                Debug.WriteLine("MMTimer " + timerId_.ToString() + " started");
            }
        }
Пример #20
0
        public static int GetColumnCountForTimerType(TimerType timerType)
        {
            switch (timerType)
            {
            case TimerType.CHECKIN:
                return(5);

            case TimerType.ARRIVAL:
                return(3);

            case TimerType.VOTING_BOOTH:
            case TimerType.BALLOT_SCANNING:
            case TimerType.THROUGHPUT:
                return(4);

            case TimerType.BMD:
            default:
                return(5);
            }
        }
Пример #21
0
        public static string GenerateUpdateTimeRecordSQL(TimerType data, TimeSpan elapsed)
        {
            StringBuilder sqlStatement = new StringBuilder();

            try
            {
                string currentDateTime = DateToDBDateTime(DateTime.Now);

                sqlStatement.AppendLine("UPDATE time_sheet SET ");
                sqlStatement.AppendLine(string.Format("work_end_time = '{0}'", currentDateTime));
                sqlStatement.AppendLine(string.Format(",mins_accrued = '{0}'", elapsed.TotalMinutes));
                sqlStatement.AppendLine(string.Format("WHERE work_id = '{0}'", data.db_id));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(sqlStatement.ToString());
        }
Пример #22
0
        /// <summary>
        /// Creates a new timer object and adds it to the corresponding database.
        /// </summary>
        /// <param name="JSON">JSON-formatted string-string Dictionary codifying the parameters to pass to <paramref name="ClassName"/>.<paramref name="MethodName"/>()</param>
        /// <param name="ClassName">The name of the class containing <paramref name="MethodName"/>.</param>
        /// <param name="MethodName">The name of the method to call when the event is triggered.</param>
        /// <param name="SecondsTillExpiration">Time until the event expires (Expire) or triggers (Interval).</param>
        /// <param name="TimerType">Whether the timer is a single-trigger timer (Expire) or triggers every set number of <paramref name="SecondsTillExpiration"/> (Interval).</param>
        /// <returns>A <c>Task</c> object, which can be awaited until this method completes successfully.</returns>

        public async Task <string> AddTimer(string JSON, string ClassName, string MethodName, int SecondsTillExpiration, TimerType TimerType)
        {
            string Token = CreateToken();

            EventTimer Timer = new () {
                Token              = Token,
                ExpirationLength   = SecondsTillExpiration,
                CallbackClass      = ClassName,
                CallbackMethod     = MethodName,
                CallbackParameters = JSON,
                ExpirationTime     = DateTimeOffset.UtcNow.ToUnixTimeSeconds() + (TimerType != TimerType.Interval ? SecondsTillExpiration : 0),
                TimerType          = TimerType
            };

            EventTimersDB.EventTimers.Add(Timer);

            await EventTimersDB.SaveChangesAsync();

            return(Timer.Token);
        }
Пример #23
0
        /// <summary>
        ///
        ///     this.timerTimer = new System.Threading.Timer(new TimerCallback(this.EvTimer));
        /// </summary>
        /// <param name="codeMemberMethod"></param>
        /// <param name="timer"></param>
        private void WriteInitializeTimer(CodeMemberMethod codeMemberMethod, TimerType timer)
        {
            // this.timerRedTimer = new Timer();
            //codeMemberMethod.Statements.Add(
            //           new CodeAssignStatement(
            //               new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), GetTimerFieldName(timer)),
            //               new CodeObjectCreateExpression("System.Timers.Timer")));

            // new TimerCallback(this.EvTimer)
            var delegateTimerCallback = new CodeDelegateCreateExpression(
                new CodeTypeReference("TimerCallback"),
                new CodeThisReferenceExpression(), timer.id);

            //this.timerTimer = new System.Threading.Timer(new TimerCallback(this.EvTimer));
            codeMemberMethod.Statements.Add(
                new CodeAssignStatement(
                    new CodeFieldReferenceExpression(new CodeThisReferenceExpression(), GetTimerFieldName(timer)),
                    new CodeObjectCreateExpression("System.Threading.Timer",
                                                   new CodeExpression[] {
                delegateTimerCallback,
                new CodePrimitiveExpression(null),
                new CodeVariableReferenceExpression("Timeout.Infinite"),
                new CodeVariableReferenceExpression("Timeout.Infinite")
            })));

            // this.timerRedTimer.Elapsed += new ElapsedEventHandler(this.EvTimerRed);
            //CodeDelegateCreateExpression timerDelegate = new CodeDelegateCreateExpression(
            //                                                 new CodeTypeReference("ElapsedEventHandler"),
            //                                                 new CodeThisReferenceExpression(), timer.id);
            //CodeAttachEventStatement attachStatement = new CodeAttachEventStatement(new CodeFieldReferenceExpression(
            //                      new CodeThisReferenceExpression(), GetTimerFieldName(timer)), "Elapsed", timerDelegate);
            //codeMemberMethod.Statements.Add(attachStatement);

            // this.timerRedTimer.AutoReset = false;
            //codeMemberMethod.Statements.Add(
            //           new CodeAssignStatement(
            //               new CodeFieldReferenceExpression(
            //                   new CodeFieldReferenceExpression(
            //                       new CodeThisReferenceExpression(), GetTimerFieldName(timer)), "AutoReset"),
            //               new CodePrimitiveExpression(false)));
        }
Пример #24
0
        public void Start()
        {
            // Kill any existing timer
            Stop();

            // Set the timer type flags
            TimerType timerType = TimerType.TIME_CALLBACK_FUNCTION |
                                  TimerType.TIME_KILL_SYNCHRONOUS |
                                  (IsPeriodic ? TimerType.TIME_PERIODIC : TimerType.TIME_ONESHOT);

            lock (lock_)
            {
                timerId_ = timeSetEvent((uint)Interval, (uint)Resolution, callback_, UIntPtr.Zero, (uint)timerType);
                if (timerId_ == 0)
                {
                    throw new Exception("timeSetEvent error");
                }

                Debug.WriteLine("MMTimer " + timerId_.ToString() + " started");
            }
        }
Пример #25
0
        public async void timerType_insert_and_delete()
        {
            var context         = new JobTimerDbContext();
            var timerTypeAccess = new TimerTypeAccess(context);

            var timerType = new TimerType {
                ID = 99999, Type = _fixture.Create <string>()
            };

            await timerTypeAccess.SaveAsync(timerType);

            timerType.ID.Should().NotBe(0);

            var timerTypeLoaded = await timerTypeAccess.LoadAsync(timerType.ID);

            timerTypeLoaded.Type.Should().Be(timerType.Type);

            var deletedCount = await timerTypeAccess.DeleteAsync(timerTypeLoaded);

            deletedCount.Should().BeGreaterOrEqualTo(1);
        }
Пример #26
0
        public void EditTaskRunParam(Guid id, TimerType timerType, int interval, DateTime?startTime, bool runOnStart)
        {
            if (!tasks.ContainsKey(id))
            {
                throw new TaskNotExistException();
            }
            if (tasks[id].Status != TaskStatus.Stop)
            {
                throw new TaskNotStopException();
            }
            var t       = tasks[id];
            var configs = LoadTaskRunParam(t.AssemblyId);
            var config  = configs[t.TypeName];

            config.interval   = interval;
            config.timerType  = timerType;
            config.startTime  = startTime;
            config.runOnStart = runOnStart;
            t.runParam        = config;
            SaveTaskRunParam(t.AssemblyId, configs.Values);
        }
Пример #27
0
        public Timer(TimerType type, int startInMiliSeconds, int MiliSeconds, int repeatCount, int repeatInterval, OnTimeout PassedDelegate)
        {
            // nix mit Verarschen hier
            if (startInMiliSeconds < 0)
            {
                startInMiliSeconds = -startInMiliSeconds;
            }
            if (MiliSeconds < 0)
            {
                MiliSeconds = -MiliSeconds;
            }

            Type = type;
            StartInMiliSeconds = startInMiliSeconds;
            MiliSecondsLeft    = MiliSeconds;
            Handler           += PassedDelegate;
            RepeatInterval     = repeatInterval;
            RepeatCount        = repeatCount;
            Active             = true;
            TimerManager.Timers.Add(this);
        }
Пример #28
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="interval">时间间隔</param>
 /// <param name="action">事件</param>
 /// <param name="loop">loop为0表示永远执行,loop大于0表示次数</param>
 public TimerInfo(float interval, int loop, LuaFunction func)
 {
     this.interval = interval;
     this.func     = func;
     this.action   = delegate() {
         if (func != null)
         {
             func.Call();
         }
     };
     this.loop  = loop;
     timerState = TimerState.Run;
     if (this.loop > 0)
     {
         timerType = TimerType.Numeral;
     }
     else
     {
         timerType = TimerType.Forever;
     }
 }
Пример #29
0
        private void Form1_Load(object sender, EventArgs e)
        {
            TimerType initialTimerType = Properties.Settings.Default.TimerType;

            timerTypeListBox.BindEnumToListBox(initialTimerType);

            ColorType initialColorType = Properties.Settings.Default.ColorType;

            colorChoiceListBox.BindEnumToListBox(initialColorType);

            int  buildRate       = Properties.Settings.Default.BuildRate;
            int  decayRate       = Properties.Settings.Default.DecayRate;
            int  maxValue        = Properties.Settings.Default.MaxValue;
            bool keepLEDsLitCold = Properties.Settings.Default.KeepLEDsLitCold;
            bool scaleBrightness = Properties.Settings.Default.ScaleBrightness;

            this.buildRateTextBox.Text           = $"{buildRate}";
            this.decayRateTextBox.Text           = $"{decayRate}";
            this.maxHeatValueTextBox.Text        = $"{maxValue}";
            this.coldOFFCheckBox.Checked         = keepLEDsLitCold;
            this.scaleBrightnessCheckbox.Checked = scaleBrightness;
        }
Пример #30
0
        public int TimeLeft(int historyId, TimerType timerType)
        {
            switch (timerType)
            {
            case TimerType.Realtime:
                if (ModuleTimers.TryGetValue(historyId, out TimerAssociates realtimeTimerAssociates))
                {
                    return(Convert.ToInt32((realtimeTimerAssociates.ModuleFinish - DateTime.UtcNow).TotalSeconds));
                }
                return(0);

            case TimerType.Individual:
                if (IndividualQuizTimers.TryGetValue(historyId, out TimerAssociates indivdualTimerAssociates))
                {
                    return(Convert.ToInt32((indivdualTimerAssociates.ModuleFinish - DateTime.UtcNow).TotalMilliseconds));
                }
                else
                {
                    int timeLeft = Convert.ToInt32(Math.Round(TimeSpan.FromMinutes((from q in _context.Questions
                                                                                    join iq in _context.IndividualQuizPasseds on q.LectureId equals iq.LectureId
                                                                                    where iq.Id == historyId
                                                                                    select q).Count()).TotalMilliseconds / 2));
                    return(timeLeft);
                }

            case TimerType.Cumulative:
                if (CumulativeQuizTimers.TryGetValue(historyId, out TimerAssociates cumulativeTimerAssociates))
                {
                    return(Convert.ToInt32((cumulativeTimerAssociates.ModuleFinish - DateTime.UtcNow).TotalMilliseconds));
                }
                else
                {
                    int timeLeft = Convert.ToInt32(Math.Round(TimeSpan.FromMinutes(20).TotalMilliseconds / 2));
                    return(timeLeft);
                }
            }
            return(0);
        }
Пример #31
0
        private void ReadConfig()
        {
            if (!Directory.Exists(MC.SaveDirectory))
            {
                Directory.CreateDirectory(MC.SaveDirectory);
            }

            try
            {
                XmlDocument xml = new XmlDocument();
                xml.Load(MC.ConfigFileName);

                XmlElement node = xml["MegaSpawnerSystemConfig"];

                try{ timerTypeSwitch = (TimerType)int.Parse(GetInnerText(node["TimerSetting"])); }
                catch (Exception ex) { totalErrors++; AddToErrorLog(ex); }

                try{ staffTriggerEventSwitch = bool.Parse(GetInnerText(node["StaffTriggerEvent"])); }
                catch (Exception ex) { totalErrors++; AddToErrorLog(ex); }
            }
            catch
            {
                DefaultConfigCreate();

                MessagesTitle = "Mega Spawner System Configuration";
                Messages      = "Configuration file not found, creating default configuration...";
            }

            SetConfigList();

            ConfigRead = true;

            if (totalErrors > 0)
            {
                MessagesTitle = "Mega Spawner System Configuration";
                Messages      = String.Format("{0} error{1} been detected.\nError Log:\n {2}", totalErrors, totalErrors == 1 ? " has" : "s have", ErrorLog);
            }
        }
Пример #32
0
        /// <summary>
        /// Setup the timer
        /// </summary>
        /// <param name="container">TMPro object that will contain the timer</param>
        /// <param name="timerType">What type of timer will it be (Countdown, Stopwatch, Clock)</param>
        /// <param name="countdownTime">The time that will have in case it is a countdown timer</param>
        /// <returns></returns>
        public static Timer SetupTimer(this TMP_Text container, TimerType timerType, TimerUpdate timerUpdate, float countdownTime = 60f)
        {
            Timer    t           = container.gameObject.AddComponent <Timer>();
            float    elapsedTime = 0f;
            string   text        = string.Empty;
            TimeSpan timePlaying = TimeSpan.Zero;

            switch (timerType)
            {
            case TimerType.Countdown:
                elapsedTime = countdownTime;
                timePlaying = TimeSpan.FromSeconds(elapsedTime);
                text        = timePlaying.ToString("m':'ss'.'ff");
                break;

            case TimerType.Clock:
                text = DateTime.Now.ToString("HH:mm:ss");
                break;
            }
            t.Setup(elapsedTime, true, timePlaying, container, timerType, timerUpdate, text);

            return(t);
        }
Пример #33
0
    /// <summary>
    /// Update this instance.
    /// </summary>
    public virtual void Update()
    {
        days = ( playTime / 86400);
        hours = (playTime / 3600) % 24;
        minutes = (playTime / 60) % 60;
        seconds = (playTime % 60);
        fractions = (playTime * 1000 ) % 1000;

        switch( currentTimer )
        {
            case TimerType.Playtime:
                playTime = Time.time - startTime - continueTime + addToTime;
                break;
            case TimerType.FromLoad:
                playTime = Time.timeSinceLevelLoad + addToTime;
                break;
            case TimerType.Countdown:
                playTime = countdownDelay - Time.time + countdownAmount;

                if( playTime < 0 )
                {
                    currentTimer = TimerType.Inactive;
                }
                break;
            case TimerType.Realtime:
                playTime = Time.realtimeSinceStartup + addToTime;
                break;
            default:
                break;
        }

        if( playTime > delayTime )
        {
            delayTime = playTime + delayRate;
        }
    }
Пример #34
0
 /// <summary>
 /// Stops the timer.
 /// </summary>
 public void StopTimer()
 {
     stopTime = playTime;
     addToTime = 0;
     currentTimer = TimerType.Inactive;
 }
Пример #35
0
 /// <summary>
 /// Starts the time as Play Time..
 /// </summary>
 public void StartTimer()
 {
     startTime = Time.time;
     addToTime = 0f;
     continueTime = 0f;
     currentTimer = TimerType.Playtime;
 }
Пример #36
0
 public TimerComponent(TimerType type = TimerType.Flag)
 {
     Type        = type;
     CurrentTime = new GameTime();
     TargetTimeSpanMilliseconds = CurrentTime.TotalGameTime.TotalMilliseconds - 1;
 }
 public void SetTimerType(TimerType type) => timerType = type;
Пример #38
0
		static public void StopTimer (TimerType which)
		{
			timers [(int) which] += DateTime.Now - timer_start [(int) which];
			++timer_counters [(int) which];
		}
 public int GetTimer(TimerType whichTimer)
 {
     return(timers[(int)whichTimer]);
 }
Пример #40
0
		public void Start (TimerType type)
		{
			if (timers != null) {
				var sw = new Stopwatch ();
				timers[(int) type] = sw;
				sw.Start ();
			}
		}
Пример #41
0
		private void SetHoldThumbAreaTimer ()
		{
			timer.Enabled = false;
			timer.Interval = 200;
			timer_type = TimerType.HoldThumbArea;
			timer.Enabled = true;
		}
Пример #42
0
    		private void SetHoldButtonClickTimer ()
		{
			timer.Enabled = false;
			timer.Interval = 200;
			timer_type = TimerType.HoldButton;
			timer.Enabled = true;
		}
 public void SetTimer(TimerType whichTimer, int newTimerValue)
 {
     timers[(int)whichTimer]      = newTimerValue;
     timersEnded[(int)whichTimer] = false;
 }
Пример #44
0
 protected string GetTimerStopName(TimerType timer)
 {
     return("TimerStop" + timer.name);
 }
Пример #45
0
 public TimerComponent(TimerType type, GameTime currentTime, double targetLifespanInMilliseconds = 0)
 {
     Type        = type;
     CurrentTime = currentTime;
     TargetTimeSpanMilliseconds = currentTime.TotalGameTime.TotalMilliseconds + targetLifespanInMilliseconds;
 }
Пример #46
0
 protected string GetTimerFieldName(TimerType timer)
 {
     return("timer" + timer.name);
 }
Пример #47
0
		public void Stop (TimerType type)
		{
			if (timers != null) {
				timers[(int) type].Stop ();
			}
		}
Пример #48
0
 static public void StopTimer(TimerType which)
 {
     timers [(int)which] += DateTime.Now - timer_start [(int)which];
     ++timer_counters [(int)which];
 }
Пример #49
0
		private void SetRepeatButtonTimer ()
		{
			timer.Enabled = false;
			timer.Interval = 50;
			timer_type = TimerType.RepeatButton;
			timer.Enabled = true;
		}
Пример #50
0
 public void CountUp()
 {
     _timerType = TimerType.CountUp;
 }
Пример #51
0
		private void SetRepeatThumbAreaTimer ()
		{
			timer.Enabled = false;
			timer.Interval = 50;
			timer_type = TimerType.RepeatThumbArea;
			timer.Enabled = true;
		}
Пример #52
0
 public void CountDown()
 {
     _timerType = TimerType.CountDown;
 }
Пример #53
0
		public void Stop (TimerType type)
		{
			if (timers != null) {
				timers[(int) type].Stop ();
			}
		}
Пример #54
0
 /// <summary>
 /// Starts the counter using realtime.
 /// </summary>
 public void RealTime()
 {
     realTime = Time.realtimeSinceStartup;
     startTime = 0f;
     addToTime = 0f;
     currentTimer = TimerType.Realtime;
 }
Пример #55
0
		static public void StartTimer (TimerType which)
		{
			timer_start [(int) which] = DateTime.Now;
		}
Пример #56
0
 /// <summary>
 /// Reset the timer.
 /// </summary>
 public void Reset()
 {
     stopTime = 0f;
     playTime = 0f;
     continueTime = 0f;
     addToTime = 0f;
     currentTimer = TimerType.Inactive;
 }
Пример #57
0
		static public void ShowTimer (TimerType which, string msg)
		{
			Console.WriteLine (
				"[{0:00}:{1:000}] {2} (used {3} times)",
				(int) timers [(int) which].TotalSeconds,
				timers [(int) which].Milliseconds, msg,
				timer_counters [(int) which]);
		}
Пример #58
0
 /// <summary>
 /// Resumes the timer.
 /// </summary>
 public void Resume()
 {
     continueTime = Time.time - playTime;
     startTime = 0f;
     addToTime = 0f;
     currentTimer = TimerType.Playtime;
 }
Пример #59
0
 static public void StartTimer(TimerType which)
 {
     timer_start [(int)which] = DateTime.Now;
 }
 public bool HasTimerEnded(TimerType whichTimer)
 {
     return(timersEnded[(int)whichTimer]);
 }