Пример #1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     swim();
     if (timeleft > 0)
     {
         timeleft       = timeleft - 1.0 / fps;
         labelTime.Text = ((int)timeleft).ToString() + "秒";
         if (dayflg)
         {
             if (daycnt < 10 * fps)
             {
                 daycnt++;
             }
             else
             {
                 dayflg   = false;
                 nightflg = true;
                 iwashi.Sleep();
                 utubo.Sleep();
                 this.BackColor = Color.DarkBlue;
                 daycnt         = 0;
             }
         }
         else if (nightflg)
         {
             if (nightcnt < 5 * fps)
             {
                 nightcnt++;
             }
             else
             {
                 dayflg   = true;
                 nightflg = false;
                 iwashi.Wakeup();
                 utubo.Wakeup();
                 this.BackColor = Color.LightBlue;
                 nightcnt       = 0;
             }
         }
     }
     else
     {
         timer1.Stop();
         MessageBox.Show("時間です。", "終了", MessageBoxButtons.OK, MessageBoxIcon.Information);
         labelTime.Text = "0秒";
         startflg       = false;
         //            buttonStart.Enabled = true;
     }
 }