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(); }
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); }
/// <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); }