private void M_Login_Error_SignUp(string str) { labelStatus.Visible = true; labelStatus.BringToFront(); labelStatus.Text = str; AuxFunctions.WaitNSeconds(2); labelStatus.Visible = false; }
private void M_Game_GameSaved() { LabelTurn.ForeColor = Color.Green; LabelTurn.Text = "Game Saved!"; AuxFunctions.WaitNSeconds(4); Program.V_SelectGameMode.Visible = true; Close(); }
private void M_Profile_SuccessChanges() { LabelStatus.Visible = true; LabelStatus.BringToFront(); LabelStatus.ForeColor = Color.Green; LabelStatus.Text = "Data changed successfully!"; AuxFunctions.WaitNSeconds(3); LabelStatus.Visible = false; }
private void Board_JumpMustBeTaken(Point p) { PlaceToPlayBox.Visible = true; PlaceToPlayBox.Location = PointLocationMatrix[p.X, p.Y]; LabelTurn.ForeColor = Color.Red; LabelTurn.Text = "Jump must be taken!"; AuxFunctions.WaitNSeconds(2); PlaceToPlayBox.Visible = false; M_Game_TurnDecided(); }
private void M_Game_ErrorLoadingGame() { Point p = new Point(227, 596); LabelErrorLoading.Location = p; LabelErrorLoading.Text = "Error Loading Game: You Must Load A Game That Is Yours!"; LabelErrorLoading.Visible = true; LabelErrorLoading.ForeColor = Color.Red; AuxFunctions.WaitNSeconds(4); LabelErrorLoading.Visible = false; }
private void M_Login_SignUp_Successful() { labelStatus.Visible = true; labelStatus.BringToFront(); labelStatus.ForeColor = Color.Green; labelStatus.Text = "Sign Up Successful!"; AuxFunctions.WaitNSeconds(3); labelStatus.Visible = false; Program.V_Login.Visible = true; Close(); }
private void M_Game_SucessLoadingGame() { Point p = new Point(351, 596); LabelErrorLoading.Location = p; LabelErrorLoading.Text = "Game Loaded With Sucess!"; LabelErrorLoading.ForeColor = Color.Green; LabelErrorLoading.Visible = true; AuxFunctions.WaitNSeconds(4); LabelErrorLoading.Visible = false; Visible = false; Program.V_Game.ShowDialog(); }
private void M_Login_Login_Successful(string str1, string str2) { PanelLogin.Visible = false; //transicao.HideSync(PanelLogin); labelWelcome.BackColor = Color.Transparent; labelWelcome.ForeColor = Color.White; labelWelcome.BringToFront(); labelWelcome.Font = new Font("Segoe UI", 30); labelWelcome.AutoSize = true; labelWelcome.TextAlign = ContentAlignment.MiddleCenter; labelWelcome.Text = "Welcome Back " + str1 + " " + str2 + "!"; labelWelcome.Location = AuxFunctions.GetPosition(labelWelcome, Height, Width); labelWelcome.Visible = true; System.Threading.Thread.Sleep(1500); BackPanel.Controls.Add(labelWelcome); timerEnter.Enabled = true; }
public void SignUp_Request(string str1, string str2, string str3, string str4, string str5, string str6, string str7, string str8, string str9) { // str1 --> Username // str2 --> First Name // str3 --> Last Name // str4 --> Profile Pic Path // str5 --> Password // str6 --> Password Re-Enter // str7 --> Email // str8 --> Email Re-Enter // str9 --> Country if (string.IsNullOrWhiteSpace(str1) || string.IsNullOrWhiteSpace(str2) || string.IsNullOrWhiteSpace(str3) || string.IsNullOrWhiteSpace(str4) || string.IsNullOrWhiteSpace(str5) || string.IsNullOrWhiteSpace(str6) || string.IsNullOrWhiteSpace(str7) || string.IsNullOrWhiteSpace(str8) || string.IsNullOrWhiteSpace(str9)) { Error_SignUp?.Invoke("Error: Missing information!"); return; } if (!str5.Equals(str6)) { Error_SignUp?.Invoke("Error: Passwords do not match!"); return; } if (!AuxFunctions.IsValidEmail(str7)) { Error_SignUp?.Invoke("Error: Email format not valid!"); return; } if (!str7.Equals(str8)) { Error_SignUp?.Invoke("Error: Emails do not match!"); return; } if (AddUserDB(str1, str2, str3, str4, str5, str7, str9)) { SignUp_Successful?.Invoke(); return; } }
public void PC_Move() { bool extra_movement = false; if (GetPlayerPlaying() is VirtualPlayer) { AuxFunctions.WaitNSeconds(3); if (Game.MakeAIMove(ref extra_movement)) { if (!extra_movement) { Game.SwitchTurn(); TurnDecided?.Invoke(); } else { PC_Move(); } } } }
public bool CanBeEaten(Point origin, Point destination, ref int x, ref int y) { int[] XCoord = new[] { origin.X, destination.X }; int[] YCoord = new[] { origin.Y, destination.Y }; int highX = AuxFunctions.Highest(XCoord); int lowX = AuxFunctions.Lowest(XCoord); int highY = AuxFunctions.Highest(YCoord); int lowY = AuxFunctions.Lowest(YCoord); foreach (Piece piece in Pieces) { x = piece.Position.X; y = piece.Position.Y; if (AuxFunctions.IsBetween(lowX, highX, x) && AuxFunctions.IsBetween(lowY, highY, y)) { return(true); } } return(false); }
private void M_Game_GameOver(bool tie) { if (!Program.M_Game.Game.IsGameOver) { return; } if (tie) { LabelTurn.Text = "The game was tied!"; } else { LabelTurn.Text = Program.M_Game.Game.Winner.Username + " has won the game!"; } LabelTurn.ForeColor = Color.LightSkyBlue; LabelTurn.Font = new Font("Segoe UI", 45); AuxFunctions.WaitNSeconds(5); Program.V_SelectGameMode.Visible = true; Close(); }
public bool CheckMoveBlue(Point origin, Point destination) { Move currentMove = new Move(new Piece(origin), new Piece(destination)); int[] xValues = { origin.X, destination.X }; int[] yValues = { origin.Y, destination.Y }; List <Move> jumpMoves = CheckJumps("B"); if (jumpMoves.Count > 0) { bool invalid = true; foreach (Move move in jumpMoves) { if (currentMove.Equals(move)) { invalid = false; } } if (invalid) { JumpMustBeTaken?.Invoke(jumpMoves[0].destination.Position); return(false); } EatPiece?.Invoke(new Point(AuxFunctions.Highest(xValues) - 1, AuxFunctions.Highest(yValues) - 1)); return(true); } if (Program.M_Game.Game.FindPiece(origin).Color == Color.Blue) { if (Program.M_Game.Game.FindPiece(origin).IsQueen) { if (currentMove.isAdjacent("Q") && BoardMatrix[destination.X, destination.Y] == EMPTY) { return(true); } Piece middlePiece = currentMove.checkJump("Q"); if (middlePiece != null && BoardMatrix[destination.X, destination.Y] == EMPTY) { EatPiece?.Invoke(new Point(AuxFunctions.Highest(xValues) - 1, AuxFunctions.Highest(yValues) - 1)); return(true); } } else { if ((currentMove.isAdjacent("B")) && BoardMatrix[destination.X, destination.Y] == EMPTY) { return(true); } Piece midPiece = currentMove.checkJump("B"); if (midPiece != null && BoardMatrix[destination.X, destination.Y] == EMPTY) { EatPiece?.Invoke(new Point(AuxFunctions.Highest(xValues) - 1, AuxFunctions.Highest(yValues) - 1)); return(true); } } } return(false); }
public void SetUpPieces() { // 0 -> Player 1 gets white // 1 -> Player 2 gets white if (AuxFunctions.GetRandomNumber(0, 1) == 0) { Game.Players[0].IsTurn = true; Game.Players[0].Pieces.Add(new Piece(new Point(1, 5), Color.White)); Game.Players[0].Pieces.Add(new Piece(new Point(3, 5), Color.White)); Game.Players[0].Pieces.Add(new Piece(new Point(5, 5), Color.White)); Game.Players[0].Pieces.Add(new Piece(new Point(7, 5), Color.White)); Game.Players[0].Pieces.Add(new Piece(new Point(0, 6), Color.White)); Game.Players[0].Pieces.Add(new Piece(new Point(2, 6), Color.White)); Game.Players[0].Pieces.Add(new Piece(new Point(4, 6), Color.White)); Game.Players[0].Pieces.Add(new Piece(new Point(6, 6), Color.White)); Game.Players[0].Pieces.Add(new Piece(new Point(1, 7), Color.White)); Game.Players[0].Pieces.Add(new Piece(new Point(3, 7), Color.White)); Game.Players[0].Pieces.Add(new Piece(new Point(5, 7), Color.White)); Game.Players[0].Pieces.Add(new Piece(new Point(7, 7), Color.White)); Game.Players[1].Pieces.Add(new Piece(new Point(0, 0), Color.Blue)); Game.Players[1].Pieces.Add(new Piece(new Point(2, 0), Color.Blue)); Game.Players[1].Pieces.Add(new Piece(new Point(4, 0), Color.Blue)); Game.Players[1].Pieces.Add(new Piece(new Point(6, 0), Color.Blue)); Game.Players[1].Pieces.Add(new Piece(new Point(1, 1), Color.Blue)); Game.Players[1].Pieces.Add(new Piece(new Point(3, 1), Color.Blue)); Game.Players[1].Pieces.Add(new Piece(new Point(5, 1), Color.Blue)); Game.Players[1].Pieces.Add(new Piece(new Point(7, 1), Color.Blue)); Game.Players[1].Pieces.Add(new Piece(new Point(0, 2), Color.Blue)); Game.Players[1].Pieces.Add(new Piece(new Point(2, 2), Color.Blue)); Game.Players[1].Pieces.Add(new Piece(new Point(4, 2), Color.Blue)); Game.Players[1].Pieces.Add(new Piece(new Point(6, 2), Color.Blue)); } else { Game.Players[1].IsTurn = true; Game.Players[1].Pieces.Add(new Piece(new Point(1, 5), Color.White)); Game.Players[1].Pieces.Add(new Piece(new Point(3, 5), Color.White)); Game.Players[1].Pieces.Add(new Piece(new Point(5, 5), Color.White)); Game.Players[1].Pieces.Add(new Piece(new Point(7, 5), Color.White)); Game.Players[1].Pieces.Add(new Piece(new Point(0, 6), Color.White)); Game.Players[1].Pieces.Add(new Piece(new Point(2, 6), Color.White)); Game.Players[1].Pieces.Add(new Piece(new Point(4, 6), Color.White)); Game.Players[1].Pieces.Add(new Piece(new Point(6, 6), Color.White)); Game.Players[1].Pieces.Add(new Piece(new Point(1, 7), Color.White)); Game.Players[1].Pieces.Add(new Piece(new Point(3, 7), Color.White)); Game.Players[1].Pieces.Add(new Piece(new Point(5, 7), Color.White)); Game.Players[1].Pieces.Add(new Piece(new Point(7, 7), Color.White)); Game.Players[0].Pieces.Add(new Piece(new Point(0, 0), Color.Blue)); Game.Players[0].Pieces.Add(new Piece(new Point(2, 0), Color.Blue)); Game.Players[0].Pieces.Add(new Piece(new Point(4, 0), Color.Blue)); Game.Players[0].Pieces.Add(new Piece(new Point(6, 0), Color.Blue)); Game.Players[0].Pieces.Add(new Piece(new Point(1, 1), Color.Blue)); Game.Players[0].Pieces.Add(new Piece(new Point(3, 1), Color.Blue)); Game.Players[0].Pieces.Add(new Piece(new Point(5, 1), Color.Blue)); Game.Players[0].Pieces.Add(new Piece(new Point(7, 1), Color.Blue)); Game.Players[0].Pieces.Add(new Piece(new Point(0, 2), Color.Blue)); Game.Players[0].Pieces.Add(new Piece(new Point(2, 2), Color.Blue)); Game.Players[0].Pieces.Add(new Piece(new Point(4, 2), Color.Blue)); Game.Players[0].Pieces.Add(new Piece(new Point(6, 2), Color.Blue)); } TurnDecided?.Invoke(); }