Ejemplo n.º 1
0
 private void startGame()
 {
     DisplayManager.print("Game starting\t: ", DisplayManager.BLUE, false);
     DisplayManager.print("Room " + id, DisplayManager.WHITE, true);
     createTeams();
     game.run();
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 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);
 }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
 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();
 }