コード例 #1
0
ファイル: Main.cs プロジェクト: Sanu-samm/callbreak
        /// <summary>
        /// this method is called when ever painting of the board is needed
        /// can be called by Invalidate,Refresh or Update method;
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(PaintEventArgs e)
        {
            Graphics graphics = e.Graphics;

            if (RefreshWholeBoard)
            {
                SpadesGui.refreshBoard(graphics, ref gameData);
            }
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: Sanu-samm/callbreak
 public void redrawForm()
 {
     if (this.InvokeRequired)
     {
         // We're not in the UI thread, so we need to call BeginInvoke
         this.Invoke(new refreshBoard(redrawForm));
         return;
     }
     SpadesGui.Initialize(ref gameData);
     this.Update();
     this.Refresh();
 }
コード例 #3
0
ファイル: GameEngine.cs プロジェクト: Sanu-samm/callbreak
        public bool Initialize(Form mainForm)
        {
            // initialize card,deck,player,card,rounds,graphics

            _mainForm = mainForm;



            // initialize player

            gameStateManager = new GameStateManager(null);
            initializePlayers();

            // initialize graphic class
            SpadesGui.Initialize(ref SpadesPlayer);
            return(true);
        }
コード例 #4
0
ファイル: Main.cs プロジェクト: Sanu-samm/callbreak
        /// <summary>
        /// initialize game and other thigs such as player,graphics animation timer etc
        /// </summary>
        /// <returns></returns>
        public bool Initialize()
        {
            gameDeck = new Deck();

            this.gameStateManager        = new GameStateManager(null);
            this.animationTimer.Tick    += new EventHandler(animationTimer_Tick);
            this.animationTimer.Interval = 5;

            // initialize graphic class
            //initialize score array to null
            // score array

            // for 5 rounds and 4 player
            float[,] score = new float[5, 4];


            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    score[i, j] = 0; // initialize score to null
                }
            }

            gameData.CurrentRound      = 1;
            gameData.ActivePlayerId    = 0;
            gameData.HandCounter       = 0;
            gameData.score             = score;
            gameData.HandWinnerID      = 0;
            gameData.RoundStarter      = 0;
            gameData.GameState         = GameState.INTRO;
            gameData.WastePile         = new Pile();
            gameData.CurrentPlayerList = new List <player>();
            gameData.CurrentPot        = new Pot();
            initializePlayers();
            SpadesGui.Initialize(ref gameData);
            gameData.CurrentPot.PotAdd += new PotAddEventHandler(Pot_PotAdd);
            initializePlayerBoardsPosition();
            return(true);
        }