public GameSettings() { ROWS = 6; COLUMNS = 7; SLOW_DROP_SPEED = 0.1f; NORMAL_DROP_SPEED = 1.5f; HIGH_DROP_SPEED = 3f; STONE_NUMBER = 21; RED_PLAYER = 1; YELLOW_PLAYER = 2; MEDIAPATH = "..\\..\\Content\\"; TITLEPIC = "title.tga"; GAMEPIC = "background_2.tga"; STARTING_PLAYER = RED_PLAYER; AI_STRENGTH = DIFFICULTY.Easy; PLAYER_RED_NAME = "Player 1"; PLAYER_YELLOW_NAME = "Player 2"; IP = "music-pc"; Port = 11000; ballPath = ""; this.GfxSkin = SkinType.Classic; //SetGfxSkin(SkinType.Classic); }
/// <summary> /// Start a new game /// </summary> /// <param name="mode"></param> public Connect4Game(GameSettings.GAMEMODE mode, int startingPlayer, GameSettings.DIFFICULTY difficulty, GameSettings settings) { startTime = DateTime.Now; RED_PLAYER = settings.RED_PLAYER; YELLOW_PLAYER = settings.YELLOW_PLAYER; COLUMNS = settings.COLUMNS; ROWS = settings.ROWS; this.aiStrength = difficulty; this.GameMode = mode; this.STARTING_PLAYER = startingPlayer; this.activePlayer = startingPlayer; map = new int[settings.COLUMNS, settings.ROWS]; switch (GameMode) { case (GameSettings.GAMEMODE.SinglePlayer): { position = new Position(); zuege = new MoveList(); comp = new ComputerPlayer(Position.WHITE, "Machine", true, difficulty); this.GameState = GameSettings.GAMESTATE.S_BeforeGame; break; } case (GameSettings.GAMEMODE.CPUvsCPU): { position = new Position(); zuege = new MoveList(); comp = new ComputerPlayer(Position.WHITE, "Machine1", true, difficulty); if (this.STARTING_PLAYER == RED_PLAYER) { this.GameState = GameSettings.GAMESTATE.S_WaitForCPU; this.HUMAN_PLAYER = RED_PLAYER; } else { this.GameState = GameSettings.GAMESTATE.S_WaitForCPU; this.HUMAN_PLAYER = YELLOW_PLAYER; } break; } case (GameSettings.GAMEMODE.LocalMultiPlayer): { position = new Position(); zuege = new MoveList(); this.GameState = GameSettings.GAMESTATE.S_BeforeGame; break; } case (GameSettings.GAMEMODE.NetworkGame): { position = new Position(); zuege = new MoveList(); /*string line = ""; using (StreamReader sr = new StreamReader("net.txt")) { string tmp; while ((tmp = sr.ReadLine()) != null) { line = tmp; } sr.Close(); } int port = Convert.ToInt32(line.Split(',')[0]); string ip = line.Split(',')[1]; if (Convert.ToInt32(line.Split(',')[2]) == 2) { netStartPlayer = 1; } else { netStartPlayer = 2; } NetGame = new Networking(port, ip);*/ this.GameState = GameSettings.GAMESTATE.S_WaitForConnection; break; } } }