コード例 #1
0
ファイル: Versus.xaml.cs プロジェクト: v0v4yk/Climball
        void start_Tick(object sender, EventArgs e)
        {
            if ((player1.win == VSmaxwins || player2.win == VSmaxwins) && VSmaxwins != 0)
            {
                Seconds = -2;
                if (player1.win == VSmaxwins)
                {
                    countdownText.Text = "Red won\nthe game!";
                }
                else
                {
                    countdownText.Text = "Blue won\nthe game!";
                }
                //player2.win = player1.win = 0;
                //return;
            }
            if (Seconds > 0)
            {
                countdownText.Text = "" + Seconds.ToString();
            }
            switch (Seconds)
            {
            case 0:
            {
                countdownText.Text   = "Start!";
                leftScore.Text       = rightScore.Text = "0";
                leftScore.Visibility = rightScore.Visibility = Visibility.Visible;
                break;
            }

            case -1:
            {
                //centerborder.Visibility = Visibility.Visible;
                countdownText.Text    = "";     //countdownText.Visibility = Visibility.Hidden;//.Text = "";
                leftborder.Visibility = rightborder.Visibility = Visibility.Visible;
                var timer = (DispatcherTimer)sender;
                timer.Stop();
                VStimer.Start();
                ball.setpos(0, 0);
                ballvelocity = randomvelocity(_const.minvelocity, _const.maxvelocity);

                break;
            }

            case -4:
            {
                Menu menu = new Menu();
                menu.VSmaxscore.Text = VSmaxscore.ToString();
                menu.VSmaxwin.Text   = VSmaxwins.ToString();
                menu.Show();
                Close();
                break;
            }
            }
            Seconds--;
        }
コード例 #2
0
ファイル: Versus.xaml.cs プロジェクト: v0v4yk/Climball
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Menu menu = new Menu();

            menu.VSmaxscore.Text = VSmaxscore.ToString();
            menu.VSmaxwin.Text   = VSmaxwins.ToString();
            menu.Show();
            if (_sensor != null)
            {
                _sensor.Stop();
            }
            Close();
        }