示例#1
0
        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;
                    }
                }
            }
        }
示例#2
0
 /// <summary>
 /// Raises event 'Timeout'
 /// </summary>
 protected virtual void OnTimeout()
 {
     if (Timeout != null)
     {
         Timeout.Invoke(this, System.EventArgs.Empty);
     }
 }
示例#3
0
        void FixedUpdate()
        {
            if (isPaused)
            {
                return;
            }

            currentTime = limitTime - Time.time;

            if (currentTime <= 0)
            {
                currentTime = 0;
                if (Timeout != null)
                {
                    Timeout.Invoke(this, new EventArgs());
                }
            }
            SetValue(currentTime);
        }
示例#4
0
 private void Update()
 {
     if (startNow)
     {
         if (liveTime > 0)
         {
             liveTime -= Time.deltaTime;
         }
         else
         {
             if (Timeout != null)
             {
                 startNow = false;
                 Timeout.Invoke();
                 Stop();
             }
         }
     }
 }
示例#5
0
        private void OnTimeout()
        {
            RemoveEvents();

            Timeout?.Invoke();
        }
示例#6
0
 private void NotifyTimeout(CharacterFighter[] laggers)
 {
     Timeout?.Invoke(this, laggers);
 }
示例#7
0
 private void OnTimeOut()
 {
     _account.Character.Status = CharacterStatus.None;
     RemoveEvents();
     Timeout?.Invoke();
 }
示例#8
0
        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;
            }
        }
示例#9
0
 public void Complete()
 {
     StopCoroutine(_coroutine);
     _tick = _timeout;
     Timeout?.Invoke();
 }
示例#10
0
 protected virtual void OnTimeout()
 {
     Timeout?.Invoke(this, EventArgs.Empty);
 }
示例#11
0
 internal void InvokeTimeout()
 {
     Timeout?.Invoke();
 }
 void OnTimeoutImpl(object sender, ElapsedEventArgs e)
 {
     //会话超时意味着什么?如果用户想要恢复,可以重新调用Start
     End();
     Timeout?.Invoke(this);
 }
示例#13
0
 /// <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);
 }
示例#14
0
 private void OnTimeout(Context context, TimeSpan timeout, Task task)
 => Timeout?.Invoke(GetContext(context));
示例#15
0
 private void TimeoutTimerElapsed(object sender, ElapsedEventArgs e)
 {
     _timeout_timer.Stop();
     Timeout?.Invoke(this, new EventArgs());
 }
示例#16
0
 public void OnTimeout()
 {
     Timeout?.Invoke(this, EventArgs.Empty);
 }
示例#17
0
        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);
            }
        }
示例#18
0
        void OnTimeout()
        {
            Interlocked.Exchange(ref isTimeout, 1);

            Timeout?.Invoke(this, EventArgs.Empty);
        }
示例#19
0
 private void Timer_Tick(object sender, EventArgs e)
 {
     Timeout?.Invoke();
 }
示例#20
0
 private void _timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     disposeTimer();
     Timeout?.Invoke(this, new EventArgs());
 }
示例#21
0
 private void RaiseEvent()
 {
     Timeout?.Invoke(this, EventArgs.Empty);
 }
示例#22
0
 private void OnTimeout(object sender, ElapsedEventArgs elapsedEventArgs)
 {
     Timeout?.Invoke(this);
     _timeoutTimer.Stop();
 }
示例#23
0
 private void OnElapsed(object sender, ElapsedEventArgs e)
 {
     Timeout?.Invoke();
 }