/// <summary> /// Новая игра /// </summary> public void NewGame() { gametype = GameType.LocalGame; this.player1 = CreateUser(view.GetUserName(Side.White), Side.White, player1); this.player2 = CreateUser(view.GetUserName(Side.Black), Side.Black, player2); //this.player1 = new Player("", Side.White); //this.player2 = new Player("", Side.Black); state = GameState.WaitWhite; Field = new ChessField(player1, player2); view.ClearLog(); view.ShowgbChessField(true); view.ShowrtbLog(true); view.EnableDefeat(true); view.EnableSave(true); view.EnableUndo(true); view.EnableNewGame(false); view.EnableNewLanGame(false); view.EnableLoad(false); view.ShowgbHUD(true); field.SetPawnSuperiousListener(PawnSuperiorityHandler); field.SetKingShahListener(KingShahHandler); field.SetKingStalemateListener(KingStalemateHandler); view.DrawField(); view.SetWhiteName(player1.Name); view.SetBlackName(player2.Name); view.WhiteCount(player1.GetCount()); view.BlackCount(player2.GetCount()); view.SetTurnText(); }
public void ClientGameView() { view.ShowgbChessField(true); view.ShowrtbLog(true); view.EnableDefeat(true); view.EnableSave(true); view.EnableUndo(true); view.EnableNewGame(false); view.EnableNewLanGame(false); view.EnableLoad(false); view.ShowgbHUD(true); view.DrawField(); view.SetWhiteName(player1.Name); view.SetBlackName(player2.Name); view.WhiteCount(player1.GetCount()); view.BlackCount(player2.GetCount()); view.SetTurnText(); }
public void NewServerGame() { gametype = GameType.ServerGame; this.player1 = CreateUser(view.GetUserName(Side.White), Side.White, player1); this.player2 = new Player("", Side.Black); //this.player1 = new Player("", Side.White); //this.player2 = new Player("", Side.Black); state = GameState.WaitWhite; Field = new ChessField(player1, player2); field.SetPawnSuperiousListener(PawnSuperiorityHandler); field.SetKingShahListener(KingShahHandler); field.SetKingStalemateListener(KingStalemateHandler); view.ClearLog(); server = new ServerThread(view, this); Thread thread = new Thread(server.Run); thread.Start(); thread.IsBackground = true; DialogResult dialogresult = view.ShowServerBanner(); if (dialogresult == DialogResult.Abort) { server.listener.Stop(); thread.Abort(); return; } //thread.Join(); view.ShowgbChessField(true); view.ShowrtbLog(true); view.EnableDefeat(true); view.EnableSave(true); view.EnableUndo(true); view.EnableNewGame(false); view.EnableNewLanGame(false); view.EnableLoad(false); view.ShowgbHUD(true); view.DrawField(); view.SetWhiteName(player1.Name); view.SetBlackName(player2.Name); view.WhiteCount(player1.GetCount()); view.BlackCount(player2.GetCount()); view.SetTurnText(); }
public void NewServerGame() { gametype = GameType.ServerGame; this.player1 = CreateUser(view.GetUserName(Side.White), Side.White, player1); this.player2 = new Player("", Side.Black); //this.player1 = new Player("", Side.White); //this.player2 = new Player("", Side.Black); state = GameState.WaitWhite; Field = new ChessField(player1, player2); field.SetPawnSuperiousListener(PawnSuperiorityHandler); field.SetKingShahListener(KingShahHandler); field.SetKingStalemateListener(KingStalemateHandler); view.ClearLog(); server = new ServerThread(view, this); Thread thread = new Thread(server.Run); thread.Start(); thread.IsBackground = true; DialogResult dialogresult = view.ShowServerBanner(); if (dialogresult == DialogResult.Abort) { server.listener.Stop(); thread.Abort(); return; } //thread.Join(); view.ShowgbChessField(true); view.ShowrtbLog(true); view.EnableDefeat(true); view.EnableSave(true); view.EnableUndo(true); view.EnableNewGame(false); view.EnableNewLanGame(false); view.EnableLoad(false); view.ShowgbHUD(true); view.DrawField(); view.SetWhiteName(player1.Name); view.SetBlackName(player2.Name); view.WhiteCount(player1.GetCount()); view.BlackCount(player2.GetCount()); view.SetTurnText(); }
/// <summary> /// Новая игра /// </summary> public void NewGame() { gametype = GameType.LocalGame; this.player1 = CreateUser(view.GetUserName(Side.White), Side.White, player1); this.player2 = CreateUser(view.GetUserName(Side.Black), Side.Black, player2); //this.player1 = new Player("", Side.White); //this.player2 = new Player("", Side.Black); state = GameState.WaitWhite; Field = new ChessField(player1, player2); view.ClearLog(); view.ShowgbChessField(true); view.ShowrtbLog(true); view.EnableDefeat(true); view.EnableSave(true); view.EnableUndo(true); view.EnableNewGame(false); view.EnableNewLanGame(false); view.EnableLoad(false); view.ShowgbHUD(true); field.SetPawnSuperiousListener(PawnSuperiorityHandler); field.SetKingShahListener(KingShahHandler); field.SetKingStalemateListener(KingStalemateHandler); view.DrawField(); view.SetWhiteName(player1.Name); view.SetBlackName(player2.Name); view.WhiteCount(player1.GetCount()); view.BlackCount(player2.GetCount()); view.SetTurnText(); }