Exemplo n.º 1
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            TimerCountDown.Stop();

            try
            {
                timeTick.setTimeInt(textBoxHour.Text, textBoxMin.Text, textBoxSec.Text);
                numRepeat          = int.Parse(textBoxRepeat.Text);
                timeTick.totalTime = 0;
                countDownCurrent   = timeTick.hour * 3600 + timeTick.min * 60 + timeTick.sec;

                if (timeTick.hour * 3600 + timeTick.min * 60 + timeTick.sec > 0 && timeTick.min <= 60 && timeTick.sec <= 60)
                {
                    memory.addHistoryList(textBoxHour.Text, textBoxMin.Text, textBoxSec.Text, textBoxRepeat.Text);
                    memory.updateListView(listViewHistory, "history");


                    TimerCountDown.Interval = 1000;
                    TimerCountDown.Start();
                    toggleAvaliabilityTextbox(false);
                }

                else
                {
                    MessageBox.Show("Please enter a valid value", "Error", MessageBoxButtons.OK);
                    initialise("countdown");
                }
            }

            catch
            {
                MessageBox.Show("Please enter positive integers to all textBoxes", "Error", MessageBoxButtons.OK);
                initialise("countdown");
            }
        }
Exemplo n.º 2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            TimerCountDown.Stop();

            if (txtBxAnswer.Text.ToLower() == aQuestion.Answer.ToLower())
            {
                this.ReturnBool   = true;
                this.ReturnPoint  = aQuestion.Point;
                this.DialogResult = DialogResult.OK;
                string message = "Correct";
                string title   = "Congratulation";
                MessageBox.Show(message, title);
                this.Close();
            }
            else
            {
                this.ReturnBool   = false;
                this.ReturnPoint  = aQuestion.Point * -1;
                this.DialogResult = DialogResult.OK;
                string message = $"Oops!!! The correct answer is {aQuestion.Answer}";
                string title   = "Oops";
                MessageBox.Show(message, title);
                this.Close();
            }
        }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     poison     = FindObjectOfType <RaiseLair>();
     timer      = FindObjectOfType <TimerCountDown>();
     round      = FindObjectOfType <Round>();
     data       = FindObjectOfType <VariableData>();
     healthpack = FindObjectOfType <HealthPackSpawn>();
     floorFall  = FindObjectOfType <FallFloor>();
     doorsFall  = FindObjectsOfType <Fall>();
 }
Exemplo n.º 4
0
 // Update is called once per frame
 void Update()
 {
     if (TimerCountDown.IsCounting())
     {
         myLight.color = Color.Lerp(myLight.color, Color.red * 3, Time.deltaTime);
     }
     else
     {
         myLight.color = Color.white;
     }
 }
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
     }
 }
Exemplo n.º 6
0
 private void ButtonStopBackup_Click(object sender, EventArgs e)
 {
     if (ButtonStopBackup.Text == "停止備份")
     {
         ButtonStopBackup.Text = "繼續備份";
         TimerFreq.Stop();
         TimerCountDown.Stop();
     }
     else
     {
         ButtonStopBackup.Text = "停止備份";
         TimerFreq.Start();
         TimerCountDown.Start();
     }
 }
Exemplo n.º 7
0
        private void Finished()
        {
            TimerFreq.Enabled  = true;
            TimerFreq.Interval = Frequency;
            TimerFreq.Start();
            TimerCountDown.Enabled  = true;
            TimerCountDown.Interval = 1000;
            TimerCountDown.Start();

            ButtonStopBackup.Enabled = true;
            sFrequency = Frequency / 1000;
            FromPath   = TextBoxFrom.Text;
            ToPath     = TextBoxTo.Text;
            MessageBox.Show("已完成設定,目前會以「" + ComboBoxFreq.SelectedItem + "」的頻率備份。", "完成");
        }//Run this after backup setup
    public void SetIsDead(bool dead)
    {
        isDead = dead;
        if (dead)
        {
            if (alertedBefore)
            {
                TimerCountDown.DecrementEnemiesAlerted();
            }
            DestroyEnemyPhysics();

            Score.IncreaseScore(ScoreValues.enemyKill);
        }
        animator.SetBool("isDead", dead);
    }
Exemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     poison        = FindObjectOfType <RaiseLair>();
     timer         = FindObjectOfType <TimerCountDown>();
     round         = FindObjectOfType <Round>();
     data          = FindObjectOfType <VariableData>();
     healthpack    = FindObjectOfType <HealthPackSpawn>();
     floorFall     = FindObjectOfType <FallFloor>();
     doorsFall     = FindObjectsOfType <Fall>();
     mouseSettings = FindObjectOfType <MouseSettings>();
     doorOpen      = FindObjectOfType <Door_Open>();
     for (int i = 0; i < doorTexts.Length; i++)
     {
         doorTexts[i].text = "You need: " + data.GetDeurToll() + " coins to open the door";
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// Timercountdown , not sure if you want the question to be closed or the player still have chance to answer after that
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void TimerCountDown_Tick(object sender, EventArgs e)
 {
     if (quick > 0)
     {
         // by updating the Time Left label.
         quick--;
         lblTimer.Text = quick / 60 + ":" + ((quick % 60) >= 10 ? (quick % 60).ToString() : "0" + (quick % 60));
     }
     else
     {
         // If the user ran out of time, stop the timer, show
         // a MessageBox, and fill in the answers.
         TimerCountDown.Stop();
         string message = $"Time's up!!!\nThe correct answer is \"{aQuestion.Answer}\"";
         string title   = "Oops! Time's up.";
         MessageBox.Show(message, title);
         this.Close();// Im not sure if you want to close the form
     }
 }
Exemplo n.º 11
0
        private void checkTiming_Tick(object sender, EventArgs e)
        {
            timeTick.updateTime(countDownCurrent);
            Console.WriteLine(countDownCurrent);
            updateTextBoxes();

            if (countDownCurrent > 0)
            {
                countDownCurrent--;
            }

            if (countDownCurrent == 0)
            {
                if (numRepeat == 1)
                {
                    TimerCountDown.Stop();
                    toggleAvaliabilityTextbox(true);
                    MessageBox.Show(memory.listHistory.Last() + " has elapsed", "Timing has Ended", MessageBoxButtons.OK);
                    timeTick.totalTime = 0;
                }


                if (numRepeat > 1)
                {
                    numRepeat--;
                    countDownCurrent = timeTick.totalTime;


                    setTextBoxes(memory.getSplittedTime(memory.listHistory.Count() - 1, "history"));
                    timeTick.setTimeList(memory.getSplittedTime(memory.listHistory.Count() - 1, "history"));
                    TimerCountDown.Stop();

                    if (MessageBox.Show(memory.listHistory.Last() + " has elapsed. " + "Repeating " + numRepeat.ToString() + " more times", "Timing has Ended", MessageBoxButtons.OK) == DialogResult.OK)
                    {
                        TimerCountDown.Interval = 1000;
                        TimerCountDown.Start();
                    }
                }
            }
        }
Exemplo n.º 12
0
        private void initialise(string mode)
        {
            switch (mode)
            {
            case "countdown":
                textBoxHour.Text = "00";
                textBoxMin.Text  = "00";
                textBoxSec.Text  = "00";
                countDownCurrent = 0;
                timeTick.hour    = 0;
                timeTick.min     = 0;
                timeTick.sec     = 0;
                TimerCountDown.Stop();
                toggleAvaliabilityTextbox(true);
                break;

            case "stopwatch":
                SWTextBoxHr.Text  = "00";
                SWTextBoxMin.Text = "00";
                SWTextBoxSec.Text = "00";
                break;
            }
        }
Exemplo n.º 13
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     TimerCountDown.Stop();
     updateTextBoxes();
 }
Exemplo n.º 14
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.collider.gameObject.layer == LayerMask.NameToLayer("PlayerBullet") && !TimerCountDown.IsCounting())
     {
         doors.OpenDoors();
     }
 }
Exemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     countdown     = GetComponent <TimerCountDown>();
     timeText.text = "Time: " + countdown.currentTime;
 }
Exemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     timer = FindObjectOfType <TimerCountDown>();
 }
Exemplo n.º 17
0
 private void Alert()
 {
     TimerCountDown.IncrementEnemiesAlerted();
     alertedBefore = true;
     audioSource.Play();
 }
Exemplo n.º 18
0
 private void FrmAandQ_FormClosing(object sender, FormClosingEventArgs e)
 {
     TimerCountDown.Stop();
 }
Exemplo n.º 19
0
 private static void ResetTimer()
 {
     instance.StopAllCoroutines();
     Time.timeScale = 1f;
     TimerCountDown.ResetEnemiesAlerted();
 }