public override void Update(float delta) { base.Update(delta); if (Looping) { if (TimeLeft <= 0) { Timeout.Invoke(); Start(); } else { TimeLeft -= delta; } } else { if (TimeLeft > 0) { if (TimeLeft - delta <= 0) { TimeLeft = 0; Timeout.Invoke(); } else { TimeLeft -= delta; } } } }
/// <summary> /// Raises event 'Timeout' /// </summary> protected virtual void OnTimeout() { if (Timeout != null) { Timeout.Invoke(this, System.EventArgs.Empty); } }
void FixedUpdate() { if (isPaused) { return; } currentTime = limitTime - Time.time; if (currentTime <= 0) { currentTime = 0; if (Timeout != null) { Timeout.Invoke(this, new EventArgs()); } } SetValue(currentTime); }
private void Update() { if (startNow) { if (liveTime > 0) { liveTime -= Time.deltaTime; } else { if (Timeout != null) { startNow = false; Timeout.Invoke(); Stop(); } } } }
private void OnTimeout() { RemoveEvents(); Timeout?.Invoke(); }
private void NotifyTimeout(CharacterFighter[] laggers) { Timeout?.Invoke(this, laggers); }
private void OnTimeOut() { _account.Character.Status = CharacterStatus.None; RemoveEvents(); Timeout?.Invoke(); }
private void SocketOnMessageReceived(object sender, MessageReceivedEventArgs messageReceivedEventArgs) { PubSubMessageEventArgs msg; var type = parser.Parse(messageReceivedEventArgs.Message, out msg); // ReSharper disable once BitwiseOperatorOnEnumWithoutFlags (enum is not really using flags) if ((type & PubSubMessageType.Unknown) > 0) { Unknown?.Invoke(this, (UnknownMessageEventArgs)msg); return; } // ReSharper disable once SwitchStatementMissingSomeCases (handled by the if above) switch (type) { case PubSubMessageType.Response: Response?.Invoke(this, (ResponseMessageEventArgs)msg); break; case PubSubMessageType.Pong: pongTimeoutTimer.Stop(); Pong?.Invoke(this, System.EventArgs.Empty); break; case PubSubMessageType.Reconnect: HandleReconnect(); break; case PubSubMessageType.Timeout: Timeout?.Invoke(this, (TimeoutMessageEventArgs)msg); break; case PubSubMessageType.Ban: Ban?.Invoke(this, (BanMessageEventArgs)msg); break; case PubSubMessageType.Unban: Unban?.Invoke(this, (UnbanMessageEventArgs)msg); break; case PubSubMessageType.Host: Host?.Invoke(this, (HostMessageEventArgs)msg); break; case PubSubMessageType.Bits: Bits?.Invoke(this, (BitsMessageEventArgs)msg); break; case PubSubMessageType.StreamStart: StreamStart?.Invoke(this, (StreamStartMessageEventArgs)msg); break; case PubSubMessageType.StreamStop: StreamStop?.Invoke(this, (StreamStopMessageEventArgs)msg); break; case PubSubMessageType.ViewerCount: ViewerCount?.Invoke(this, (ViewerCountMessageEventArgs)msg); break; default: Error?.Invoke(this, new ExceptionEventArgs(new ArgumentOutOfRangeException())); break; } }
public void Complete() { StopCoroutine(_coroutine); _tick = _timeout; Timeout?.Invoke(); }
protected virtual void OnTimeout() { Timeout?.Invoke(this, EventArgs.Empty); }
internal void InvokeTimeout() { Timeout?.Invoke(); }
void OnTimeoutImpl(object sender, ElapsedEventArgs e) { //会话超时意味着什么?如果用户想要恢复,可以重新调用Start End(); Timeout?.Invoke(this); }
/// <summary> /// Runs a delay timer and then executes the event. /// </summary> /// <returns>The coroutine.</returns> private void Fire() { onTimeout?.Invoke(); Timeout?.Invoke(this, EventArgs.Empty); }
private void OnTimeout(Context context, TimeSpan timeout, Task task) => Timeout?.Invoke(GetContext(context));
private void TimeoutTimerElapsed(object sender, ElapsedEventArgs e) { _timeout_timer.Stop(); Timeout?.Invoke(this, new EventArgs()); }
public void OnTimeout() { Timeout?.Invoke(this, EventArgs.Empty); }
private void LoginListener() { while (!Init()) { Thread.Sleep(5000); } while (true) { try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://passport.bilibili.com/qrcode/getLoginInfo"); byte[] data = Encoding.UTF8.GetBytes("oauthKey=" + oauthKey); request.Method = "POST"; request.ContentLength = data.Length; request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; request.CookieContainer = new CookieContainer(); Stream postStream = request.GetRequestStream(); postStream.Write(data, 0, data.Length); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream dataStream = response.GetResponseStream(); StreamReader reader = new StreamReader(dataStream); string result = reader.ReadToEnd(); CookieCollection cookieCollection = response.Cookies; reader.Close(); response.Close(); dataStream.Close(); postStream.Close(); IJson loginInfo = JsonParser.Parse(result); if (loginInfo.GetValue("status").ToBool()) { uint uid = 0; foreach (Cookie cookie in cookieCollection) { if (cookie.Name == "DedeUserID") { uid = uint.Parse(cookie.Value); } } LoggedIn?.Invoke(this, cookieCollection, uid); break; } switch ((int)loginInfo.GetValue("data").ToLong()) { case -2: if (!isTimeout) { isTimeout = true; Timeout?.Invoke(this); Stop(); } break; } Updated?.Invoke(this); } catch (WebException ex) { ConnectionFailed?.Invoke(this, ex); } Thread.Sleep(1000); } }
void OnTimeout() { Interlocked.Exchange(ref isTimeout, 1); Timeout?.Invoke(this, EventArgs.Empty); }
private void Timer_Tick(object sender, EventArgs e) { Timeout?.Invoke(); }
private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { disposeTimer(); Timeout?.Invoke(this, new EventArgs()); }
private void RaiseEvent() { Timeout?.Invoke(this, EventArgs.Empty); }
private void OnTimeout(object sender, ElapsedEventArgs elapsedEventArgs) { Timeout?.Invoke(this); _timeoutTimer.Stop(); }
private void OnElapsed(object sender, ElapsedEventArgs e) { Timeout?.Invoke(); }