Exemple #1
0
 public void End()
 {
     _bankedSeconds  = 0;
     _startTime      = DateTime.MinValue;
     _timer.Elapsed -= _timer_Elapsed;
     TimeUp?.Invoke(this, new CountdownEventArgs(StartDisplayValue, CountdownSeconds));
 }
Exemple #2
0
 private void StopTimer(bool showEvent)
 {
     _thisStop.Stop();
     if (showEvent)
     {
         TimeUp?.Invoke();
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        var timeupProcess = new TimeUp();
        timeupProcess.Start();

        var automatedMessage = new AutomatedEmail();
        automatedMessage.StartProcess();
    }
        private void TestPosterBidderMessage()
        {
            using (var context = new SidejobEntities())
            {
                var cp = (from c in context.ClosedProjects
                          where c.ProjectID == 105
                          select c).FirstOrDefault();

                var t = new TimeUp();
                if (cp != null) t.TestPosterPayFees(105,cp);
            }
        }
 public static void BidderTimeUpUpdate(int projectid, int actionid)
 {
     using (var context = new SidejobEntities())
     {
         var cp = (from c in context.ClosedProjects
                   where c.ProjectID == projectid
                   select c).FirstOrDefault();
         if (cp != null)
         {
             var timeupUpdate = new TimeUp(projectid, actionid, cp);
         }
     }
 }
Exemple #6
0
 private void ReactionTimerTickHandler(object sender, EventArgs e)
 {
     if (reactionTime > stopWatchTimer.Elapsed)
     {
         var step            = reactionTime.TotalSeconds / 100;
         var currentProgress = 100 - (int)(stopWatchTimer.Elapsed.TotalSeconds / step);
         ProgressChanged?.Invoke(currentProgress);
     }
     else
     {
         Stop();
         TimeUp?.Invoke();
     }
 }
Exemple #7
0
    /// <summary>
    /// To know if a timer or chronos have been sent yet
    /// </summary>
    /// <param name="from">not require, but expensive without</param>
    /// <param name="timeUp">timer or chronos you are looking for</param>
    /// <returns>true if exist, false if not</returns>
    public bool Contain(TimeUp timeUp, object from = null)
    {
        bool respond = false;

        if (from != null)
        {
            if (TimeBookGlobal.ContainsKey(from) && TimeBookGlobal[from].Contains(timeUp))
            {
                respond = true;
            }
            if (TimeBookGame.ContainsKey(from) && TimeBookGame[from].Contains(timeUp))
            {
                respond = true;
            }
            if (TimeBookMenu.ContainsKey(from) && TimeBookMenu[from].Contains(timeUp))
            {
                respond = true;
            }
        }
        else
        {
            foreach (KeyValuePair <object, List <TimeUp> > pair in TimeBookGlobal)
            {
                if (pair.Value.Contains(timeUp))
                {
                    return(true);
                }
            }
            foreach (KeyValuePair <object, List <TimeUp> > pair in TimeBookGame)
            {
                if (pair.Value.Contains(timeUp))
                {
                    return(true);
                }
            }
            foreach (KeyValuePair <object, List <TimeUp> > pair in TimeBookMenu)
            {
                if (pair.Value.Contains(timeUp))
                {
                    return(true);
                }
            }
        }

        return(respond);
    }
Exemple #8
0
 private void TimerElapsed(object?sender, ElapsedEventArgs e)
 {
     if (_thisStop.IsRunning == false)
     {
         return;
     }
     if (_thisStop.ElapsedMilliseconds > MaxTime)
     {
         _thisStop.Stop();
         Execute.OnUIThread(() =>
         {
             TimeUp?.Invoke();
         });
         return;
     }
     Progress?.Invoke(MaxTime - _thisStop.ElapsedMilliseconds);
     _timer.Start();
 }
Exemple #9
0
    // Update is called once per frame
    void Update()
    {
        Text   timeT  = GetComponent <Text>();
        TimeUp timeUp = GetComponent <TimeUp>();

        //Battleモード以外では時間を削っていくように表示させる
        if (CardManager.gameMode != 3)
        {
            if (CardManager.gameStatus == 0)
            {
                time -= 1f * Time.deltaTime;

                timeT.text = "TIME " + time.ToString("F2");
            }
            //通常モードではめくり切ったところでクリアが表示される
            else if (CardManager.gameStatus == 1)
            {
                gameClear.SendMessage("GameClear");
            }
            //時間が0になったとき、通常モードではゲームオーバー、タイムアタックモードではタイムアップと表示させる
            if (time < 0.0f)
            {
                timeT.text = "TIME " + "0.00";
                if (CardManager.gameMode == 1)
                {
                    timeUp.GameOver();
                }
                if (CardManager.gameMode == 2)
                {
                    timeUp.Timeup();
                }
            }
        }

        //Battleモードだけは経過時間がわかるように加算していく
        else
        {
            time += 1f * Time.deltaTime;

            timeT.text = "TIME " + time.ToString("F2");
        }
    }
Exemple #10
0
 public void StartCountDown(int second)
 {
     _startTime           = DateTime.Now;
     CountDownSec.Text    = second.ToString();
     CountDown.Visibility = Visibility.Visible;
     Task.Run(() =>
     {
         for (var i = second - 1; i >= 0; i--)
         {
             Task.Delay(1000).Wait();
             this.Dispatcher.Invoke(() =>
             {
                 CountDownSec.Text = i.ToString();
             });
         }
         Task.Delay(100).Wait();
         this.Dispatcher.Invoke(() =>
         {
             TimeUp?.Invoke();
         });
     });
 }
Exemple #11
0
 public void StartCountDown()
 {
     CountDownImage.Source = new BitmapImage(new Uri("3.png", UriKind.Relative));
     Task.Run(() =>
     {
         Task.Delay(1000).Wait();
         this.Dispatcher.Invoke(() =>
         {
             CountDownImage.Source = new BitmapImage(new Uri("2.png", UriKind.Relative));
         });
         Task.Delay(1000).Wait();
         this.Dispatcher.Invoke(() =>
         {
             CountDownImage.Source = new BitmapImage(new Uri("1.png", UriKind.Relative));
         });
         Task.Delay(1000).Wait();
         this.Dispatcher.Invoke(() =>
         {
             TimeUp?.Invoke();
         });
     });
 }
    /// <summary>
    /// Counts the timer down while also updating the graphic and text displays.
    /// </summary>
    /// <param name="fromTime">The time the timer should start from.</param>
    /// <returns></returns>
    private IEnumerator RunTimer(float fromTime)
    {
        float t             = fromTime;
        int   timeDisplayed = (int)fromTime + 1;

        SetLabelText(timeDisplayed.ToString());

        while (t > 0)
        {
            t -= Time.deltaTime;
            timerGraphic.fillAmount = t / fromTime;

            if (timeDisplayed != (int)t + 1)
            {
                timeDisplayed = (int)t + 1;
                SetLabelText(timeDisplayed.ToString());
            }

            yield return(null);
        }

        SetLabelText(0.ToString());
        TimeUp.Invoke();
    }
Exemple #13
0
 private void OnTimeUp()
 {
     TimeUp?.Invoke(this, EventArgs.Empty);
 }
Exemple #14
0
    /// <summary>
    /// Explicit
    /// </summary>
    /// <param name="from"> write just "this" here </param>
    /// <param name="timer"></param>
    /// <param name="timebook">
    /// Choose the timebook :
    /// Global -> Alwayse update
    /// Game -> update only in Game
    /// Menu -> update only in menu
    /// </param>

    public void AddTimer(object from, TimeUp timer, Timebook timebook = Timebook.Global)
    {
        ToAdd.Push(new Utils.Tuple <object, TimeUp, Timebook>(from, timer, timebook));
    }
 public static void CallTimeUp()
 {
     TimeUp?.Invoke();
 }
Exemple #16
0
 private void OnBonusTimer(object sender, EventArgs e)
 {
     Unsubscribe();
     TimeUp.Invoke(this, new EventArgs());
 }