示例#1
0
        //한 토너먼트가 끝나면 idPointer를 0으로 리셋시키고, 새로운 토너먼트 id리스트를 받아와야 한다.
        public void UpdateBattleList(int clickOn)
        {
            battles[idPointer - 1].Winner = battles[idPointer - 1].Foods[clickOn];

            //포인터가 리스트의 값을 넘어서서 한 라운드가 끝나면 다음 라운드로 값을 변경시킨다.
            if (idPointer > battles.Count - 1)
            {
                battles[idPointer - 1].Winner = battles[idPointer - 1].Foods[clickOn];

                gameRound /= 2;

                idPointer = 0;

                //각 라운드의 승자가 저장된 Battle List를 넘겨서 다음 대전 리스트를 만든다.
                List <int> winnerList = RandomIndex.ShuffleIndex(battles.ConvertAll(x => x.Winner));

                if (gameRound > 1)
                {
                    //각 라운드의 짝을 묶은 Battle 객체의 리스트를 받는다
                    battles = Battle.GenerateRounds(winnerList);
                }

                //gameRound가 1이 되면(우승이 결정) WinnerForm 창으로 넘어간다
                if (gameRound == 1)
                {
                    WinnerForm winnerForm = new WinnerForm();
                    winnerForm.WinnerIndex = Battle.getWinnerIndex(battles);
                    this.Owner             = winnerForm;
                    formOnOff.HideForm(this);
                    formOnOff.ShowForm(winnerForm);
                }
            }

            UpdateBattleImage(idPointer);
        }
示例#2
0
        public void CheckColumns(CircularButton[,] gameBoard, GameBoardForm g)
        {
            for (int i = 7; i >= 0; i--)
            {
                if ((gameBoard[0, i].BackColor == Color.Red && gameBoard[1, i].BackColor == Color.Red && gameBoard[2, i].BackColor == Color.Red && gameBoard[3, i].BackColor == Color.Red) ||
                    (gameBoard[1, i].BackColor == Color.Red && gameBoard[2, i].BackColor == Color.Red && gameBoard[3, i].BackColor == Color.Red && gameBoard[4, i].BackColor == Color.Red) ||
                    (gameBoard[2, i].BackColor == Color.Red && gameBoard[3, i].BackColor == Color.Red && gameBoard[4, i].BackColor == Color.Red && gameBoard[5, i].BackColor == Color.Red) ||
                    (gameBoard[3, i].BackColor == Color.Red && gameBoard[4, i].BackColor == Color.Red && gameBoard[5, i].BackColor == Color.Red && gameBoard[6, i].BackColor == Color.Red))
                {
                    win = true;
                    int p = Convert.ToInt32(g.label3.Text);
                    g.label3.Text = p + 1 + "";
                    WinnerForm w = new WinnerForm("Red Wins!!", g);
                    w.Show();
                }

                else if ((gameBoard[0, i].BackColor == Color.Yellow && gameBoard[1, i].BackColor == Color.Yellow && gameBoard[2, i].BackColor == Color.Yellow && gameBoard[3, i].BackColor == Color.Yellow) ||
                         (gameBoard[1, i].BackColor == Color.Yellow && gameBoard[2, i].BackColor == Color.Yellow && gameBoard[3, i].BackColor == Color.Yellow && gameBoard[4, i].BackColor == Color.Yellow) ||
                         (gameBoard[2, i].BackColor == Color.Yellow && gameBoard[3, i].BackColor == Color.Yellow && gameBoard[4, i].BackColor == Color.Yellow && gameBoard[5, i].BackColor == Color.Yellow) ||
                         (gameBoard[3, i].BackColor == Color.Yellow && gameBoard[4, i].BackColor == Color.Yellow && gameBoard[5, i].BackColor == Color.Yellow && gameBoard[6, i].BackColor == Color.Yellow))
                {
                    win = true;
                    int p = Convert.ToInt32(g.label4.Text);
                    g.label4.Text = p + 1 + "";
                    WinnerForm w = new WinnerForm("Yellow Wins", g);
                    w.Show();
                }
            }
        }
示例#3
0
        public void CheckDiagonals(CircularButton[,] gameBoard, GameBoardForm g)
        {
            for (int i = 0; i <= 3; i++)
            {
                for (int j = 0; j <= 4; j++)
                {
                    if ((gameBoard[i, j].BackColor == Color.Red && gameBoard[(i + 1), (j + 1)].BackColor == Color.Red && gameBoard[(i + 2), (j + 2)].BackColor == Color.Red && gameBoard[(i + 3), (j + 3)].BackColor == Color.Red) ||
                        (gameBoard[(i + 3), j].BackColor == Color.Red && gameBoard[(i + 2), (j + 1)].BackColor == Color.Red && gameBoard[(i + 1), (j + 2)].BackColor == Color.Red && gameBoard[(i + 0), (j + 3)].BackColor == Color.Red))
                    {
                        win = true;
                        int p = Convert.ToInt32(g.label3.Text);
                        g.label3.Text = p + 1 + "";
                        WinnerForm w = new WinnerForm("Red Wins", g);
                        w.Show();
                    }

                    else if (gameBoard[i, j].BackColor == Color.Yellow && gameBoard[(i + 1), (j + 1)].BackColor == Color.Yellow && gameBoard[(i + 2), (j + 2)].BackColor == Color.Yellow && gameBoard[(i + 3), (j + 3)].BackColor == Color.Yellow ||
                             (gameBoard[(i + 3), j].BackColor == Color.Yellow && gameBoard[(i + 2), (j + 1)].BackColor == Color.Yellow && gameBoard[(i + 1), (j + 2)].BackColor == Color.Yellow && gameBoard[(i + 0), (j + 3)].BackColor == Color.Yellow))
                    {
                        win = true;
                        int p = Convert.ToInt32(g.label4.Text);
                        g.label4.Text = p + 1 + "";
                        WinnerForm w = new WinnerForm("Yellow Wins", g);
                        w.Show();
                    }
                }
            }
        }
示例#4
0
        public void CheckRows(CircularButton[,] gameBoard, GameBoardForm g)
        {
            for (int i = 6; i >= 0; i--)
            {
                if ((gameBoard[i, 0].BackColor == Color.Red && gameBoard[i, 1].BackColor == Color.Red && gameBoard[i, 2].BackColor == Color.Red && gameBoard[i, 3].BackColor == Color.Red) ||
                    (gameBoard[i, 1].BackColor == Color.Red && gameBoard[i, 2].BackColor == Color.Red && gameBoard[i, 3].BackColor == Color.Red && gameBoard[i, 4].BackColor == Color.Red) ||
                    (gameBoard[i, 2].BackColor == Color.Red && gameBoard[i, 3].BackColor == Color.Red && gameBoard[i, 4].BackColor == Color.Red && gameBoard[i, 5].BackColor == Color.Red) ||
                    (gameBoard[i, 3].BackColor == Color.Red && gameBoard[i, 4].BackColor == Color.Red && gameBoard[i, 5].BackColor == Color.Red && gameBoard[i, 6].BackColor == Color.Red) ||
                    (gameBoard[i, 4].BackColor == Color.Red && gameBoard[i, 5].BackColor == Color.Red && gameBoard[i, 6].BackColor == Color.Red && gameBoard[i, 7].BackColor == Color.Red))
                {
                    win = true;
                    int p = Convert.ToInt32(g.label3.Text);
                    g.label3.Text = p + 1 + "";
                    WinnerForm w = new WinnerForm("Red Wins!!", g);
                    w.Show();
                }

                else if ((gameBoard[i, 0].BackColor == Color.Yellow && gameBoard[i, 1].BackColor == Color.Yellow && gameBoard[i, 2].BackColor == Color.Yellow && gameBoard[i, 3].BackColor == Color.Yellow) ||
                         (gameBoard[i, 1].BackColor == Color.Yellow && gameBoard[i, 2].BackColor == Color.Yellow && gameBoard[i, 3].BackColor == Color.Yellow && gameBoard[i, 4].BackColor == Color.Yellow) ||
                         (gameBoard[i, 2].BackColor == Color.Yellow && gameBoard[i, 3].BackColor == Color.Yellow && gameBoard[i, 4].BackColor == Color.Yellow && gameBoard[i, 5].BackColor == Color.Yellow) ||
                         (gameBoard[i, 3].BackColor == Color.Yellow && gameBoard[i, 4].BackColor == Color.Yellow && gameBoard[i, 5].BackColor == Color.Yellow && gameBoard[i, 6].BackColor == Color.Yellow) ||
                         (gameBoard[i, 4].BackColor == Color.Yellow && gameBoard[i, 5].BackColor == Color.Yellow && gameBoard[i, 6].BackColor == Color.Yellow && gameBoard[i, 7].BackColor == Color.Yellow))
                {
                    win = true;
                    int p = Convert.ToInt32(g.label4.Text);
                    g.label4.Text = p + 1 + "";
                    WinnerForm w = new WinnerForm("Yellow Wins", g);
                    w.Show();
                }
            }
        }
示例#5
0
 public Winner(Tuple <string, string> answer, WinnerForm winnerForm)
 {
     this.winnerForm = winnerForm;
     InitializeComponent();
     nameLBL.Text = answer.Item1;
     sswLBL.Text  = answer.Item2;
 }
示例#6
0
        public void Move(IGame game)
        {
            var winnerForm = new WinnerForm();

            winnerForm.ShowDialog();
            game.Reset();
        }
示例#7
0
 public void CheckTie(CircularButton[,] gameBoard, GameBoardForm g)
 {
     if (gameBoard[0, 0].BackColor != Color.White && gameBoard[0, 1].BackColor != Color.White && gameBoard[0, 2].BackColor != Color.White &&
         gameBoard[0, 3].BackColor != Color.White && gameBoard[0, 4].BackColor != Color.White && gameBoard[0, 5].BackColor != Color.White &&
         gameBoard[0, 6].BackColor != Color.White && gameBoard[0, 7].BackColor != Color.White && win == false)
     {
         WinnerForm w = new WinnerForm("It's a Tie!", g);
         w.Show();
     }
 }
示例#8
0
        public void ShowWinnerScreen(Player winner)
        {
            SoundPlayer.PlayWinSound();
            var winForm     = new WinnerForm();
            var winnerImage = libManager.GetWinnerImage();

            winForm.BackgroundImage = winnerImage?.Image;
            winForm.WinnerAvatar.BackgroundImage       = winner.Avatar;
            winForm.WinnerAvatar.BackgroundImageLayout = ImageLayout.Stretch;
            winForm.ShowDialog();
        }
示例#9
0
        private async void OnGameOver()
        {
            Context.GameOver = true;
            Context.Database.SetWinPersons(Context.CurrentPrize.Id, Context.WinPersons.Values.ToList());
            Context.StopWorld = true;

            await Task.Delay(1000);

            BeginInvoke(new Action(() =>
            {
                WinnerForm.Show(
                    Context.CurrentPrize,
                    Context.WinPersons.Values.ToList());
                Context.CurrentPrize = null;
                CameraY = 0;
                ResetStage(DefaultStage);
            }));
        }