private void processMessage <T>(NetMessage <T> netMessage) { if (typeof(T) == typeof(int)) { if (netMessage.commandType == NetCommand.s_Player_id) { Object o = netMessage.payload; this.id = (int)o; } else if (netMessage.commandType == NetCommand.s_Player_Turn) { Object o = netMessage.payload; currentPlayer = (int)o; if (this.id == currentPlayer) { form.roundStart(); } else { form.roundEnd(); } form.log("Turn for Player id " + currentPlayer); } } else if (typeof(String) == typeof(T)) { if (netMessage.commandType == NetCommand.s_Player_Connected) { form.log("Player " + netMessage.payload + " joined your game!"); } else if (netMessage.commandType == NetCommand.s_Player_NameChange) { Console.Out.WriteLine("Player " + netMessage.payload + " changed the name"); form.log("Player " + netMessage.payload + " changed the name!"); } } else if (typeof(Move) == typeof(T)) { } else if (typeof(Hand) == typeof(T)) { Console.Out.WriteLine("Received Hand"); Object obj = netMessage.payload; Hand h = (Hand)obj; form.refreshHand(h); // h.print(); } else if (typeof(String[]) == typeof(T)) { Object obj = netMessage.payload; String[] s = (String[])obj; foreach (String st in s) { Console.Out.Write(st + " "); } Console.Out.WriteLine(); } else if (typeof(Board) == typeof(T)) { Object obj = netMessage.payload; Board b = (Board)obj; form.refreshBoard(b); Console.Out.WriteLine("Received new Board"); //b.print(); } }