public Timer(DateTime dateTime, string formatting = DefaultFormat) { format = formatting; expires = dateTime; OnTick?.Invoke((expires - DateTime.UtcNow).ToString(format)); Manager.OnTick += Tick; }
void IPlayable.Stop() { _timer.Stop(); Stop(); Source = null; OnTick?.Invoke(this, new PlayerEventArgs(PercentProgress, Duration, Position)); }
/// <summary> /// Used to run in a loop. Invokes the OnTick event /// </summary> public void Tick() { if (CanTick()) { OnTick?.Invoke(); } }
protected override void ThreadTick() { ProcessNewlyConnectedClients(); ProcessNewlyDisconnectedClients(); // Grab all incoming packets and push them to the players ProcessAllIncomingPackets(); OnTick?.Invoke(); if (gatewaySocket != null && hasConnectedToGateway == true) { FlushAllOutgoingPackets(); } else { ClearAllOutgoingPackets(); ConnectToGateway(); } profileServer.Tick(); frameId++; var milliSec = startTime.ElapsedMilliseconds; if (milliSec - snapShotTime > 1000) { snapShotTime = milliSec; #if DEBUG_FRAMES Console.Write("frame# {0}, ms elapsed {1}, ms per frame {2}\n", frameId, milliSec, (float)milliSec / (float)frameId); #endif } SendFrameTickToAllConnectedClients(); }
internal static void Tick() { if (OnTick != null) { OnTick.Invoke(); } }
private void InvokeOnTick() { if (OnTick != null) { OnTick.Invoke(); } }
public void Tick(float time) { if (IsProgramPaused) { return; } if (!IsDone && !IsPaused) { //Debug.Log(ElapsedTime + " -- " + Time + " -- " + Callback); ElapsedTime += time; IsDone = ElapsedTime >= Time; if (IsDone) { ElapsedTime = Time; //Debug.Log("CALLING CALLBACK"); Callback?.Invoke(); } else { OnTick?.Invoke(this); } } else { } }
public void HandleTick(object sender, ElapsedEventArgs args) { foreach (var trader in _traders) { try { if (trader.PanicCondition) { trader.Panic(); } } catch (Exception ex) { Log.Warn(ex.Message); } } try { OnTick?.Invoke(sender, args); } catch (Exception ex) { Log.Warn(ex.Message); } }
private void handleImageGrabbed(object sender, EventArgs args) { PreTick(); try { Mat = new Mat(); if (Capture.Retrieve(Mat)) { if (Mat.IsEmpty) { return; } using (var vector = new VectorOfByte()) { CvInvoke.Imencode(getStringfromEncodingFormat(format), Mat, vector, encodingParams?.ToArray()); data = vector.ToArray(); } } OnTick?.Invoke(); } catch (CvException e) { logger.Add($@"{e.Status} {e.Message}", osu.Framework.Logging.LogLevel.Verbose, e); } }
public void Update() { Application.DoEvents(); OnTick?.Invoke(); GameForm.Update(); }
public static void Tick(GameModel gameModel) { if (gameModel.IsRunning) { OnTick.Invoke(gameModel); } }
/// <summary> /// Called when a physics tick occurs. /// </summary> /// <param name="world"></param> /// <param name="timeStep"></param> public void PhysicsTick(DynamicsWorld world, float timeStep) { int framesPassed = BPhysicsWorld.Get().frameCount - lastFrameCount; OnTick.Invoke(world, timeStep, framesPassed); lastFrameCount += framesPassed; }
public void StartLoop() { lastFrame = glfw.GetTimerValue(); long step = 0; while (!glfw.WindowShouldClose(window)) { glfw.PollEvents(); currentFrame = glfw.GetTimerValue(); deltaTime = (currentFrame - lastFrame) / glfw.GetTimerFrequency(); lastFrame = currentFrame; //Console.WriteLine($"FPS: {1f / deltaTime}"); if (deltaTime > (1f / 30f)) { deltaTime = 1f / 30f; } if (OnTick == null) { break; } OnTick.Invoke(new Time(deltaTime, glfw.GetTime(), step)); step++; } glfw.Terminate(); }
/// <summary> /// Internal tick process /// </summary> private void _TickThreadProc() { while (true) { OnTick?.Invoke(); Sleep(Interval); } }
private void Tick(object o) { if (Interlocked.CompareExchange(ref timerBusy, 1, 0) == 0) { OnTick?.Invoke(); timerBusy = 0; } }
private static IEnumerator Tick() { for (; IsRunning;) { yield return(new WaitForSeconds(0.25f)); OnTick?.Invoke(); } }
public void Tick() { TimePayed++; OnTick?.Invoke(this); if (TimePayed == TimeCost && !_isCompleted) { CompleteResearch(); } }
private void SetTimePassedThisMonth(float _timePassedThisMonth) { if (_timePassedThisMonth >= 0 && timePassedThisMonth != _timePassedThisMonth) { timePassedThisMonth = _timePassedThisMonth; OnTick?.Invoke(); } }
public void TickUp(float speed) { if (value >= maxValue && !IsZeroOrBelow) { return; } value += Time.deltaTime * speed; OnTick?.Invoke(value / maxValue); }
private void DispatcherTimer_Tick(object sender, EventArgs e) { OnTick?.Invoke(); foreach (var student in Students.Where(x => x.RemoteId != null)) { //if(Students.Any(x => OnTick == x.UpTime)) InitializeRating(student.RemoteId); } }
public Timer() { new System.Timers.Timer { Interval = 1000 }.Elapsed += (sender, args) => { OnTick?.Invoke(this, new TimeEventArgs(args.SignalTime)); }; }
private void Count() { while (true) { Thread.Sleep(intInterval); AddPoints(); OnTick?.Invoke(points); } }
public void Tick(int time) { _deliveryTasks.ForEach(deliveryTask => deliveryTask.Setup()); _deliveryTasks.RemoveAll(deliveryTask => deliveryTask.IsCompleted); OnTick?.Invoke(time); _deliveryTasks.ForEach(deliveryTask => deliveryTask.Setup(time)); _deliveryTasks.RemoveAll(deliveryTask => deliveryTask.IsCompleted); }
private void HandleTicking() { if (_mainMusicSource.time < _tickTime) { return; } _tickTime = currentConfiguration.GetNextTickTime(); OnTick?.Invoke(); }
private void T_Tick(object sender, EventArgs e) { _loopNo++; OnTick?.Invoke(this); if (_loopNo >= LoopCount) { T.Stop(); OnFinished?.Invoke(this); } }
/// <summary> /// Called by PlayerLoopSystem before each update /// </summary> void Tick() { #if UNITY_EDITOR if (!Application.isPlaying) { return; } #endif OnTick?.Invoke(Time.deltaTime); }
private void Timer_Elapsed(object sender, ElapsedEventArgs e) { _TimeLeft--; if (_TimeLeft <= 0) { _Timer.Stop(); OnFinished?.Invoke(); } OnTick?.Invoke(); }
public void Update() { deltaTime += clock.ElapsedTime.AsSeconds(); clock.Restart(); if (deltaTime >= timeUntilTick) { OnTick?.Invoke(); deltaTime = 0; } }
private void Tick() { if (elapsedTime > durationBetweenTicks) { elapsedTime = 0f; OnTick?.Invoke(); EndTick?.Invoke(); } elapsedTime += Time.deltaTime * _speed; ratio = Mathf.Clamp01(elapsedTime / durationBetweenTicks); }
static Rhythm() { timer = new Timer(); timer.Interval = Interval; timer.Elapsed += (object sender, ElapsedEventArgs args) => { if (Running) { Tick++; OnTick.Invoke(BeatInTick); } }; timer.Start(); }