Пример #1
0
 private void CreateAndBindGameLogic()
 {
     if (CreateGameLogic != null)
     {
         this.GameLogic = CreateGameLogic();
         var glc = new GameLogicComponent(this)
         {
             GameLogic = this.GameLogic
         };
         Components.Add(glc);
     }
 }
Пример #2
0
        public FormGameBoard(GameLogicComponent i_GameLogicComponent, GameBoardDimensions i_CurrentGameBoardDimensions)
        {
            this.m_GameLogicComponent         = i_GameLogicComponent;
            this.m_CurrentGameBoardDimensions = i_CurrentGameBoardDimensions;
            this.m_IndexPictureBoxesMatrix    = new IndexPictureBox[i_CurrentGameBoardDimensions.Height, i_CurrentGameBoardDimensions.Width];
            this.m_ImageGetterFromWeb         = new PictureBox();
            this.m_CardsRevealTimer           = new System.Windows.Forms.Timer();
            this.m_CardsRevealTimer.Interval  = 100;
            this.m_CardsRevealTimer.Tick     += m_CardsRevealTimer_Tick;
            if (!this.m_GameLogicComponent.PlayerTwo.IsHuman)
            {
                this.m_MachineTurnTimer          = new System.Windows.Forms.Timer();
                this.m_MachineTurnTimer.Interval = 1000;
                this.m_MachineTurnTimer.Tick    += m_MachineTurnTimer_Tick;
            }

            InitializeComponent();
            addMemoryCardsToGameBoard();
            setSuitableFormSize();
            setTextInLables();
        }
        private FormGameBoard getFormGameBoard()
        {
            FormGameBoard formGameBoard = null;

            if (checkIfEnteredNamesAreValid(textBoxFirstPlayerName.Text, textBoxSecondPlayerName.Text))
            {
                Player playerOne = new Player(textBoxFirstPlayerName.Text, true, Color.FromArgb(0, 192, 0));
                Player playerTwo;

                if (textBoxSecondPlayerName.Enabled)
                {
                    playerTwo = new Player(textBoxSecondPlayerName.Text, true, Color.FromArgb(148, 0, 211));
                }
                else
                {
                    playerTwo = new Player("Computer", false, Color.FromArgb(148, 0, 211));
                }

                this.m_GameLogicComponent = new GameLogicComponent(m_CurrentGameBoardDimensions, playerOne, playerTwo);
                formGameBoard             = new FormGameBoard(this.m_GameLogicComponent, this.m_CurrentGameBoardDimensions);
            }

            return(formGameBoard);
        }
 private void buttonBoardSize_Click(object sender, EventArgs e)
 {
     this.m_CurrentGameBoardDimensions = GameLogicComponent.GetNextGameBoardDimensions();
     this.buttonBoardSize.Text         = m_CurrentGameBoardDimensions.ToString();
 }
Пример #5
0
 public void Setup()
 {
     configuration      = GameMasterConfiguration.GetDefault();
     gameMaster         = new GameMaster.GameMaster(configuration);
     gameLogicComponent = gameMaster.GameLogic;
 }