private void startGame() { DisplayManager.print("Game starting\t: ", DisplayManager.BLUE, false); DisplayManager.print("Room " + id, DisplayManager.WHITE, true); createTeams(); game.run(); }
public override void HandlerAdded(IChannelHandlerContext context) { var channel = context.Channel; DisplayManager.print("New Player\t\t: ", DisplayManager.GREEN, false); DisplayManager.print(channel.ToString(), DisplayManager.WHITE, true); PlayerManager.instance.addPlayer(channel); }
private void endGame() { room.writeToTeam(1, winningTeam() == 1 ? "You won" : "You lost", true, false); room.writeToTeam(2, winningTeam() == 2 ? "You won" : "You lost", true, false); room.writeToRoom("Thanks for playing, leaving game soon...", true, true); PlayerManager.instance.removeRoom(room); DisplayManager.print("Game ended\t: ", DisplayManager.BLUE, false); DisplayManager.print("Room " + room.id, DisplayManager.WHITE, true); }
public override void HandlerRemoved(IChannelHandlerContext context) { var channel = context.Channel; var player = PlayerManager.instance.findPlayer(channel); PlayerManager.instance.findRoom(channel).writeToRoomBut(player, "Player " + player.name + " from Team " + player.team + "has left the game\nGame will restart when a new player is back", true, true); DisplayManager.print("Player left\t\t: ", DisplayManager.RED, false); DisplayManager.print(channel.ToString(), DisplayManager.WHITE, true); PlayerManager.instance.removePlayer(channel); }
public override void ExceptionCaught(IChannelHandlerContext context, Exception exception) { DisplayManager.print("Error\t\t\t: ", DisplayManager.BLACK, false); DisplayManager.print(exception.GetBaseException().Message, DisplayManager.WHITE, true); context.CloseAsync(); }