예제 #1
0
 private void initGame(
     string i_FirstPlayerName,
     string i_SecondPlayerName,
     int i_BoardHeight,
     int i_BoardWidth,
     GameManager.eGameType i_eGameType)
 {
     m_GameManager = new GameManager(i_BoardWidth, i_BoardHeight, i_FirstPlayerName, i_SecondPlayerName, i_eGameType);
     r_GameSettings.Hide();
     m_GameForm = new GameForm(i_BoardHeight, i_BoardWidth);
     m_GameForm.ExposeButtonListeners += exposeButton;
     m_ObjectArray = new char[(i_BoardHeight * i_BoardWidth) / 2];
     setSigns(m_ObjectArray);
 }
예제 #2
0
        public GameBoard(int i_BoardSize, GameManager.eGameType i_GameType)
        {
            InitializeComponent();
            this.Closing += GameBoard_Closing;
            createRowsAndCols(i_BoardSize);
            r_BoardMatrix = new Button[i_BoardSize, i_BoardSize];
            r_Game        = new GameManager(i_BoardSize, i_GameType, "Player1", "Player2");

            //Creating a board buttons
            for (int y = 0; y < i_BoardSize; y++)
            {
                for (int x = 0; x < i_BoardSize; x++)
                {
                    createButton(x, y);
                }
            }
            PlayTurns();
        }
예제 #3
0
파일: UI.cs 프로젝트: naorpa/MemoryGame
 public void ReadPlayersNames(out string o_FirstPlayerName, out string o_SecondPlayerName, out GameManager.eGameType o_GameType)
 {
     Console.WriteLine("Hello, please enter your name: ");
     checkName(out string name);
     o_FirstPlayerName = name;
     Console.WriteLine(string.Format(
                           "Hi there {0}! please press 1 to play against the Computer, press 2 to play against another player: ",
                           o_FirstPlayerName));
     checkGameType(out int numOfPlayers);
     o_GameType = (GameManager.eGameType)numOfPlayers;
     if (o_GameType == GameManager.eGameType.AgainstPC)
     {
         o_SecondPlayerName = "PC";
     }
     else
     {
         Console.WriteLine("Please enter the second player name: ");
         checkName(out name);
         o_SecondPlayerName = name;
     }
 }
예제 #4
0
 private void RadioButton_Checked(object sender, RoutedEventArgs e)
 {
     m_GameType = GameTypePlayerRadioBtn.IsChecked == true ? GameManager.eGameType.PlayerVsPlayer : GameManager.eGameType.PlayerVsComputer;
 }