Beispiel #1
0
 private void getStarted() //Check és Checkother azokat a pontokat tartalmazza, amiket már beszíneztek
 {
     check         = new List <string>();
     checkother    = new List <string>();
     currentPlayer = player1;
     actualColor   = colorOfPlayer1;
 }
Beispiel #2
0
 //Eddigi játékosok betöltése az adatbázisból a listába
 private void LoadSavedPlayers()
 {
     foreach (var item in context.Players)
     {
         SavedPlayer player = new SavedPlayer();
         player.age      = item.age;
         player.name     = item.name;
         player.score    = item.score;
         player.password = item.password;
         savedPlayers.Add(player);
     }
 }
Beispiel #3
0
        public Game_Form(SavedPlayer playerFirst, SavedPlayer playerSecond, Color colorOfFirst, Color colorOfSecond)
        {
            InitializeComponent();

            player1        = playerFirst;
            player2        = playerSecond;
            colorOfPlayer1 = colorOfFirst;
            colorOfPlayer2 = colorOfSecond;

            getThePlayers();
            getFormElements();
            getPoints();
            getStarted();
            getFirstMap();
        }
Beispiel #4
0
        // A Go gomb lenyomásakor megnézzük, kapunk-e hibaüzenetet az IsItCorrect függvényre
        // Ha nem, akkor betöltjük a játékosok adatait a játékhoz
        private void Go_Click(object sender, EventArgs e)
        {
            IsItCorrect();

            if (incorrect_message.Visible == false)
            {
                var first = (from c in context.Players
                             where c.name == name1.Text
                             select c).FirstOrDefault();

                SavedPlayer firstplayer = new SavedPlayer();
                firstplayer.name = first.name;

                var second = (from c in context.Players
                              where c.name == name2.Text
                              select c).FirstOrDefault();

                SavedPlayer secondplayer = new SavedPlayer();
                secondplayer.name = second.name;


                // Szín tárolása az adatbázis R G B oszlopai alapján
                var colorf = (from c in context.ChosenColors
                              where c.color_name == color1.Text
                              select c).FirstOrDefault();

                Color colorFirst = Color.FromArgb(colorf.R, colorf.G, colorf.B);

                var colors = (from c in context.ChosenColors
                              where c.color_name == color2.Text
                              select c).FirstOrDefault();

                Color colorSecond = Color.FromArgb(colors.R, colors.G, colors.B);


                // Játék Form indítása
                Form Game_Form = new Game_Form(firstplayer, secondplayer, Color.FromArgb(255, 0, 0, 0), Color.FromArgb(140, 140, 20, 10));
                Game_Form.Show();
            }
            else
            {
                Go.Enabled = false; // Ha hibásak az adatok, nem lehet elindítani
            }
        }
Beispiel #5
0
        private void changeplayer() //Játékos váltás
        {
            if (currentPlayer == player1)
            {
                currentPlayer = player2;
                actualColor   = colorOfPlayer2;
                MessageBox.Show(player1.name + " got " + counterOfPlayer1.Last() + " points! Now it is " + player2.name + "'s round!");
            }

            else
            {
                currentPlayer = player1;
                actualColor   = colorOfPlayer1;
                isFirstGame   = false;
                MessageBox.Show(player2.name + " got " + counterOfPlayer2.Last() + " points! Now it is " + player1.name + "'s round!");
            }

            pen = new Pen(actualColor, 5);
        }