好吧。我只收到一次包,但是它的块被发射了两次。例如:
我有一个这样的街区:
if (object instanceof InitTheGame) {
System.out.println("STARTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT");
awaitOpponent.dismiss();
isInQueue = false;
matchRunning = true; // handles the while loop inside the thread that sends data to the server
isInMatch = true; // handles view (checks for this if we exit the app)
// new GamePacketSender().start();
casualGameHolder.gameLoop.start();
new Sensor(act, casualGameHolder.gameLoop);
touchListener = new TouchListener(casualGameHolder.gameLoop);
this_layout.setOnTouchListener(touchListener);
act.runOnUiThread(new Runnable() {
public void run() {
GameStartCountdown countdown = new GameStartCountdown(4000,1000);
countdown.start();
countdownDialog = new Dialog(act);
countdownDialog.show();
countdownDialog.setCancelable(false);
}
});
}在控制台(LOG_TRACE)中,我可以看到数据包被接收了一次,但是"STARTTTTTTTTTTTTTTTTT“System.out显示了两次,倒计时显示了两次等等。
我不想发布整个代码,因为它是巨大和难以理解的。这可能是由于服务器上的缓冲区溢出造成的,或者可能是因为我在一个设备上同时打开了两个连接?如果Kryonet公司有经验丰富的人,我将非常感谢您的帮助。
发布于 2015-11-06 23:18:17
由注册多个侦听器引起(游戏完成后应为null )。
https://stackoverflow.com/questions/33467312
复制相似问题