Example #1
0
        private void MoveToANewLocation(Location newLocation)
        {
            currentLocation = newLocation;

            exits.Items.Clear();
            foreach (var item in currentLocation.Exits)
            {
                exits.Items.Add(item.Name);
            }
            exits.SelectedIndex = 0;

            description.Text = currentLocation.Description;

            goThroughTheDoor.Visible = (currentLocation is IHasExteriorDoor);
            if (currentLocation is IHidingPlace)
            {
                check.Visible = true;
                IHidingPlace hidingLocation = currentLocation as IHidingPlace;
                check.Text = "Check " + hidingLocation.HidingPlaceName;
            }
            else
            {
                check.Visible = false;
            }
            totalMoves++;
            description.Text += "The player has moved " + totalMoves.ToString() + " times. ";
        }
Example #2
0
 public void MoveToANewLocation(Location newLocation)
 {
     currentLocation = newLocation;
     exits.Items.Clear();
     for (int i = 0; i < currentLocation.Exits.Length; i++)
     {
         exits.Items.Add(currentLocation.Exits[i].Name);
     }
     exits.SelectedIndex = 0;
     if (currentLocation is IHasExteriorDoor)
     {
         goThroughTheDoor.Visible = true;
     }
     else
     {
         goThroughTheDoor.Visible = false;
     }
     if (currentLocation is IHidingPlace)
     {
         check.Visible = true;
         IHidingPlace temp = currentLocation as IHidingPlace;
         check.Text = "Check" + temp.HidingPlace;
     }
     else
     {
         check.Visible = false;
     }
     description.Text = currentLocation.Description;
 }
Example #3
0
 private void redrawForm()
 {
     comboBoxExits.Items.Clear();
     for (int i = 0; i < currentLocation.Exits.Length; i++)
     {
         comboBoxExits.Items.Add(currentLocation.Exits[i].Name);
     }
     comboBoxExits.SelectedIndex = 0;
     textBoxDescription.Text     = currentLocation.Description + "\r\n\r\n(move #" + Moves + ")";
     if (currentLocation is IHidingPlace)
     {
         IHidingPlace hidingPlace = currentLocation as IHidingPlace;
         buttonCheck.Text    = "Check " + hidingPlace.HidingPlace;
         buttonCheck.Visible = true;
     }
     else
     {
         buttonCheck.Visible = false;
     }
     if (currentLocation is IHasExteriorDoor)
     {
         buttonGoThroughDoor.Visible = true;
     }
     else
     {
         buttonGoThroughDoor.Visible = false;
     }
 }
Example #4
0
        public void MoveToANewLocation(Location location)
        {
            currentLocation = location;
            exits.Items.Clear();
            foreach (Location l in currentLocation.Exits)
            {
                exits.Items.Add(l.Name);
            }
            exits.SelectedIndex = 0;

            description.Text = currentLocation.Description;
            if (location is IHidingPlace)
            {
                IHidingPlace hidingPlace = location as IHidingPlace;
                btnCheck.Visible = true;
                btnCheck.Text    = "check " + hidingPlace.HidingPlace;
            }
            else
            {
                btnCheck.Visible = false;
            }


            if (location is IHasExteriorDoor)
            {
                goThroughTheDoor.Visible = true;
            }
            else
            {
                goThroughTheDoor.Visible = false;
            }
        }
Example #5
0
        private void RedrawForm()
        {
            exits.Items.Clear();
            for (int i = 0; i < currentLocation.Exits.Length; i++)
            {
                exits.Items.Add(currentLocation.Exits[i].Name);
            }
            exits.SelectedIndex = 0;
            description.Text    = currentLocation.Description + "\r\n(step number " + Moves + ")";

            if (currentLocation is IHidingPlace)
            {
                IHidingPlace hidingPlace = currentLocation as IHidingPlace;
                check.Text    = "Check" + hidingPlace.HidingPlace;
                check.Visible = true;
            }
            else
            {
                check.Visible = false;
            }
            if (currentLocation is IHasExteriorDoor)
            {
                goThroughTheDoor.Visible = true;
            }
            else
            {
                goThroughTheDoor.Visible = false;
            }
        }
Example #6
0
        private void RedrawForm()
        {
            exitsComboBox.Items.Clear();
            foreach (Location exit in currentLocation.Exits)
            {
                exitsComboBox.Items.Add(exit.Name);
            }
            exitsComboBox.SelectedIndex = 0;

            descriptionTextBox.Text = currentLocation.Description + "\r\nCurrent Move: " + moves + ".";
            if (currentLocation is IHidingPlace)
            {
                IHidingPlace hidingPlace = currentLocation as IHidingPlace;
                checkButton.Text    = "Check " + hidingPlace.HidingPlaceName;
                checkButton.Visible = true;
            }
            else
            {
                checkButton.Visible = false;
            }

            if (currentLocation is IHasExteriorDoor)
            {
                goThroughTheDoorButton.Visible = true;
            }
            else
            {
                goThroughTheDoorButton.Visible = false;
            }
        }
Example #7
0
        void RedrawForm()
        {
            exits.Items.Clear();
            for (int i = 0; i < currentLocation.Exits.Length; i++)
            {
                exits.Items.Add(currentLocation.Exits[i].Name);
            }
            exits.SelectedIndex = 0;
            SetDescription();

            if (currentLocation is IHidingPlace)
            {
                IHidingPlace hidingPlace = currentLocation as IHidingPlace;
                check.Text    = "Check " + hidingPlace.HidingPlaceName;
                check.Visible = true;
            }
            else
            {
                check.Visible = false;
                if (currentLocation is IHasExteriorDoor)
                {
                    goThroughTheDoor.Visible = true;
                }
                else
                {
                    goThroughTheDoor.Visible = false;
                }
            }
        }
Example #8
0
        private void RedrawForm()
        {
            exits.Items.Clear();
            for (int i = 0; i < CurrentLocation.Exits.Length; i++)
            {
                exits.Items.Add(CurrentLocation.Exits[i].Name);
            }

            //foreach (var exitLocation in CurrentLocation.Exits)
            //{
            //    exits.Items.Add(exitLocation.Name);
            //}
            exits.SelectedIndex = 0;
            description.Text    = CurrentLocation.Description + "\r\n(Move number " + Moves + ".)";
            if (CurrentLocation is IHidingPlace)
            {
                IHidingPlace hidingPlace = CurrentLocation as IHidingPlace;
                check.Text    = $"Check {hidingPlace.HidingPlace}";
                check.Visible = true;
            }
            else
            {
                check.Visible = false;
            }
            if (CurrentLocation is IHasExteriorDoor)
            {
                goThroughTheDoor.Visible = true;
            }
            else
            {
                goThroughTheDoor.Visible = false;
            }
        }
Example #9
0
        private void RedrawForm()
        {
            cmbBx_Exits.Items.Clear();

            for (int i = 0; i < currentLocation.Exits.Length; i++)
            {
                cmbBx_Exits.Items.Add(currentLocation.Exits[i].Name);
            }
            cmbBx_Exits.SelectedIndex = 0;
            txtBx_Description.Text    = currentLocation.Description + "\r\n(перемещение #" + Moves + ")";
            if (currentLocation is IHidingPlace)
            {
                IHidingPlace hidingPlace = currentLocation as IHidingPlace;
                btn_Check.Text    = "Смотрим " + hidingPlace.HidingPlaceName;
                btn_Check.Visible = true;
            }
            else
            {
                btn_Check.Visible = false;
            }
            if (currentLocation is IHasExteriorDoor)
            {
                btn_GoThroughTheDoor.Visible = true;
            }
            else
            {
                btn_GoThroughTheDoor.Visible = false;
            }
        }
Example #10
0
        private void RedrawForm()
        {
            exits.Items.Clear();
            for (int i = 0; i < currentLocation.Exits.Length; i++)
            {
                exits.Items.Add(currentLocation.Exits[i].Name);
            }

            exits.SelectedIndex = 0;

            description.Text = $"{currentLocation.Description}\r\n(ruch numer {Moves})";
            if (currentLocation is IHidingPlace)
            {
                IHidingPlace hidingPlace = currentLocation as IHidingPlace;
                check.Text    = $"Sprawdź {hidingPlace.HidingPlaceName}";
                check.Visible = true;
            }
            else
            {
                check.Visible = false;
            }
            if (currentLocation is IHasExteriorDoor)
            {
                goThroughTheDoor.Visible = true;
            }
            else
            {
                goThroughTheDoor.Visible = false;
            }
        }
Example #11
0
 private void RedrawForm()
 {
     exits.Items.Clear();
     for (int i = 0; i < currentLocation.Exits.Length; i++)
     {
         exits.Items.Add(currentLocation.Exits[i].Name);
     }
     exits.SelectedIndex = 0;
     description.Text    = currentLocation.Description + "\r\n(перемещение №" + Moves + ")";
     check.Visible       = true;
     check.Enabled       = false;
     if (currentLocation is IHidingPlace)
     {
         IHidingPlace temp = currentLocation as IHidingPlace;
         check.Text    = "Check: " + temp.HidingPlace;
         check.Enabled = true;
     }
     goThroughTheDoor.Visible = true;
     if (currentLocation is IHasExteriorDoor)
     {
         goThroughTheDoor.Enabled = true;
     }
     else
     {
         goThroughTheDoor.Enabled = false;
     }
 }
Example #12
0
 private void RedrawForm()
 {
     locationSelectionBox.Items.Clear();
     for (int i = 0; i < currentLocation.Exits.Length; i++)
     {
         locationSelectionBox.Items.Add(currentLocation.Exits[i].Name);
     }
     locationSelectionBox.SelectedIndex = 0;
     descriptionBox.Text = currentLocation.Description + "\r\n(move #" + Moves + ")";
     if (currentLocation is IHidingPlace)
     {
         IHidingPlace hidingPlace = currentLocation as IHidingPlace;
         checkButton.Text    = "Check " + hidingPlace.HidingPlace;
         checkButton.Visible = true;
     }
     else
     {
         checkButton.Visible = false;
     }
     if (currentLocation is IHasExteriorDoor)
     {
         doorButton.Visible = true;
     }
     else
     {
         doorButton.Visible = false;
     }
 }
Example #13
0
 private void RedrawForm()
 {
     ex.Items.Clear();
     for (int i = 0; i < currentLocation.Exits.Length; i++)
     {
         ex.Items.Add(currentLocation.Exits[i].Name);
     }
     ex.SelectedIndex = 0;
     Description.Text = currentLocation.Description + "\r\n(ruch nr " + Moves + ")";
     if (currentLocation is IHidingPlace)
     {
         IHidingPlace hidingPlace = currentLocation as IHidingPlace;
         check.Text    = "Sprawdź " + hidingPlace.HidingPlaceName;
         check.Visible = true;
     }
     else
     {
         check.Visible = false;
     }
     if (currentLocation is IHasExteriorDoor)
     {
         button2.Visible = true;
     }
     else
     {
         button2.Visible = false;
     }
 }
Example #14
0
        private void RedrawForm()
        {
            goHere.Visible = true;
            exits.Visible  = true;
            if (currentLocation is IHasExteriorDoor)
            {
                goThroughTheDoor.Visible = true;
            }
            else
            {
                goThroughTheDoor.Visible = false;
            }
            check.Visible     = true;
            description.Text += " Wykonałeś " + moves + " ruchów.";

            if (currentLocation is IHidingPlace)
            {
                IHidingPlace hidingPlace = currentLocation as IHidingPlace;
                check.Text = "Sprawdź " + hidingPlace.HidingPlace;
            }
            else
            {
                check.Text = "----";
            }
        }
Example #15
0
        private void RedrawForm()
        {
            //clear the olde items with
            ExitsComboBox.Items.Clear();

            //initialize the ComboBox list with newlocation's exits.
            for (int i = 0; i < currentLocation.Exits.Length; i++)
            {
                ExitsComboBox.Items.Add(currentLocation.Exits[i].Name);
            }
            //reset the Combo box so it displays the first item in the list.
            ExitsComboBox.SelectedIndex = 0;

            //make the buttons visible or unvisible
            if (Hide_button.Visible)
            {
                Gohere.Visible                 = false;
                ExitsComboBox.Visible          = false;
                check_button.Visible           = false;
                GoThroughTheDoorButton.Visible = false;
                textBox1.Text = null;
            }
            else
            {
                Gohere.Visible        = true;
                ExitsComboBox.Visible = true;
                //check if the current location has a door
                if (currentLocation is IHasExteriorDoor)
                {
                    GoThroughTheDoorButton.Visible = true;
                }
                else
                {
                    GoThroughTheDoorButton.Visible = false;
                }
                if (currentLocation is IHidingPlace)
                {
                    check_button.Visible = true;
                    //put the correct text label on the middle button
                    IHidingPlace myHidingPlace = currentLocation as IHidingPlace;
                    check_button.Text = "Check " + myHidingPlace.HidingPlaceName.ToString() + "\r\n";
                }
                else
                {
                    check_button.Visible = false;
                }
                //update current location's description to the text box.
                //if(currentLocation is RoomWithDoor){
                //    RoomWithDoor myRoomWithADoor = currentLocation as RoomWithDoor;
                //    textBox1.Text = myRoomWithADoor.Description;
                //}
                //else if (currentLocation is OutsideWithDoor)
                //{
                //    OutsideWithDoor myOutsideWithADoor = currentLocation as OutsideWithDoor;
                //    textBox1.Text = myOutsideWithADoor.Description;
                //}
                textBox1.Text = currentLocation.Description;
            }
        }
Example #16
0
        public void ResetGame()
        {
            IHidingPlace ihp = opponent.myLocation as IHidingPlace;

            Description.Text = "You found opponent in " +
                               opponent.myLocation.Name + " hiding in " + ihp.HidingPlace +
                               ". You did it in only " + moves + " steps!";
            opponent.myLocation = FrontYard;
            setbuttonVisible(false);
        }
Example #17
0
 private void checkButton_Click(object sender, EventArgs e)
 {
     stepsNeededToFindOpponent++;
     if (hiddenOpponent.Check(currentLocation) && currentLocation is IHidingPlace)
     {
         IHidingPlace hidingPlace = currentLocation as IHidingPlace;
         MessageBox.Show("Odnalazłeś mnie! Byłem schowany w " + currentLocation.Name + " " + hidingPlace.HidingPlace + ". Potrzebowałeś na to " + stepsNeededToFindOpponent + " ruchów");
         ResetGame();
     }
 }
Example #18
0
 private void checkButton_Click(object sender, EventArgs e)
 {
     if (opponent.Check(CurrentLocation))
     {
         string       hidingText  = "You found him in " + Moves + " turns!";
         IHidingPlace hidingPlace = CurrentLocation as IHidingPlace;
         hidingText += " He was hiding " + hidingPlace.HidingPlace + ".";
         MessageBox.Show(hidingText);
         Thread.Sleep(1000);
         ResetGame();
     }
 }
Example #19
0
 private void ResetGame(bool displayMessage)
 {
     if (displayMessage)
     {
         MessageBox.Show("You found me in " + Moves + " moves!");
         IHidingPlace foundLocation = currentLocation as IHidingPlace;
         description.Text = "You found your opponent in " + Moves
                            + " moves! He was hiding " + foundLocation.HidingPlace + ".";
     }
     opponent = new Opponent(frontYard);
     Moves    = 0;
 }
Example #20
0
 private void RedrawForm()
 {
     if (currentLocation is IHidingPlace)
     {
         IHidingPlace hidingPlace = currentLocation as IHidingPlace;
         checkButton.Text = "Sprawdź " + hidingPlace.HidingPlace;
     }
     else
     {
         checkButton.Text = "----";
     }
 }
 private void checkButton_Click(object sender, EventArgs e)//没写完
 {
     if (opponent.Check(currentLocation))
     {
         ResetGame();
     }
     else
     {
         IHidingPlace HidePlace = currentLocation as IHidingPlace;
         description.Text = "There is nobody " + HidePlace.HidingPlaceName;
     }
 }
Example #22
0
        private void resetGame()
        {
            exits.Visible            = false;
            goThroughTheDoor.Visible = false;
            goHere.Visible           = false;
            checkButton.Visible      = false;
            label1.Visible           = false;
            IHidingPlace foundPlace = currentLocation as IHidingPlace;

            description.Font = new Font(description.Font.FontFamily, 20);
            description.Text = "Ukryłem się w " + foundPlace.HidingPlace + ". Znalazłaś mnie w " + moves + " ruchach.\r\n\r\n Rewanżyk ???";
            button2.Visible  = true;
        }
Example #23
0
 private void ResetGame(bool isWon)
 {
     if (isWon == false)
     {
         IHidingPlace currentHiding = currentLocation as IHidingPlace;
         MessageBox.Show("He's not in " + currentHiding.HidingPlace);
         return;
     }
     MessageBox.Show("Found him after " + count + " checking times!");
     count = 0;
     MoveToANewLocation(livingRoom);
     RedrawForm(false);
 }
Example #24
0
        private void ResetGame()
        {
            MessageBox.Show("You found me in " + totalMoves + " moves!");
            IHidingPlace foundLocation = currentLocation as IHidingPlace;

            description.Text         = "The opponent was hiding " + currentLocation.Name + " in " + totalMoves.ToString() + " moves. ";
            opponent                 = new Opponent(frontYard);
            hide.Visible             = true;
            check.Visible            = false;
            goHere.Visible           = false;
            exits.Visible            = false;
            goThroughTheDoor.Visible = false;
            totalMoves               = 0;
        }
Example #25
0
 void ResetGame(bool displayMessage)
 {
     if (displayMessage)
     {
         MessageBox.Show("You found your opponent in " + moves + " moves!");
         IHidingPlace foundLocation = currentLocation as IHidingPlace;
         description.Text = "You found your opponent in " + moves + " moves! He wa hiding " + foundLocation.HidingPlaceName + ".";
     }
     moves                    = 0;
     goHere.Visible           = false;
     goThroughTheDoor.Visible = false;
     check.Visible            = false;
     exits.Visible            = false;
 }
        private void ResetGame()
        {
            MessageBox.Show("You found me in " + Moves.ToString() + " moves!");
            IHidingPlace HidePlace = currentLocation as IHidingPlace;

            description.Text = "You found your opponent " + HidePlace.HidingPlaceName + " in " + Moves.ToString() + " moves!";

            Moves                          = 0;
            exits.Visible                  = false;
            goHereButton.Visible           = false;
            goThroughTheDoorButton.Visible = false;
            checkButton.Visible            = false;
            hideButton.Visible             = true;
        }
Example #27
0
 private void ResetGame(bool displayMessage)
 {
     if (displayMessage)
     {
         MessageBox.Show("You found me after" + Moves + "moves");
         IHidingPlace foundLocation = currentLocation as IHidingPlace;
         description.Text = "You found enemy after " + Moves + "moves, he was " + foundLocation.HidingPlace + ".";
     }
     Moves                    = 0;
     hide.Visible             = true;
     goHere.Visible           = false;
     check.Visible            = false;
     goThroughTheDoor.Visible = false;
     exits.Visible            = false;
 }
Example #28
0
 private void ResetGame(bool displayMessage)
 {
     if (displayMessage)
     {
         MessageBox.Show("Odnalazłeś mnie w " + Moves + " ruchach!");
         IHidingPlace foundLocation = currentLocation as IHidingPlace;
         description.Text = "Znalazłeś przeciwnika w " + Moves + " ruchach! Ukrywał się " + foundLocation.HidingPlaceName + ".";
     }
     Moves                    = 0;
     hide.Visible             = true;
     goHere.Visible           = false;
     check.Visible            = false;
     goThroughTheDoor.Visible = false;
     exits.Visible            = false;
 }
Example #29
0
 private void ResetGame(bool displayMessage)
 {
     if (displayMessage)
     {
         MessageBox.Show("You found me in " + Moves + " moves!");
         IHidingPlace foundLocation = currentLocation as IHidingPlace;
         description.Text = "You found your opponent in " + Moves + " moves! He was hiding " + foundLocation.HidingPlace + " .";
     }
     Moves                    = 0;
     hide.Visible             = true;
     button1.Visible          = false;
     check.Visible            = false;
     goThroughTheDoor.Visible = false;
     exists.Visible           = false;
 }
Example #30
0
 private void ResetGame(bool displayMessage)
 {
     if (displayMessage)
     {
         MessageBox.Show("You found me in " + Moves + " moves!");
         IHidingPlace foundLocation = currentLocation as IHidingPlace;
         textBoxDescription.Text = "You found your opponent in " + Moves + " moves! He was hiding " + foundLocation.HidingPlace + ".";
     }
     Moves = 0;
     buttonHide.Visible          = true;
     buttonGoHere.Visible        = false;
     buttonCheck.Visible         = false;
     buttonGoThroughDoor.Visible = false;
     comboBoxExits.Visible       = false;
 }