-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from marmot-z/master
新增观战模式退出功能
- Loading branch information
Showing
5 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
.../java/org/nico/ratel/landlords/server/event/ServerEventListener_CODE_GAME_WATCH_EXIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.nico.ratel.landlords.server.event; | ||
|
||
import org.nico.ratel.landlords.entity.ClientSide; | ||
import org.nico.ratel.landlords.entity.Room; | ||
import org.nico.ratel.landlords.print.SimplePrinter; | ||
import org.nico.ratel.landlords.server.ServerContains; | ||
|
||
public class ServerEventListener_CODE_GAME_WATCH_EXIT implements ServerEventListener { | ||
|
||
@Override | ||
public void call(ClientSide clientSide, String data) { | ||
Room room = ServerContains.getRoom(clientSide.getRoomId()); | ||
|
||
if (room != null) { | ||
// 房间如果存在,则将观战者从房间观战列表中移除 | ||
clientSide.setRoomId(room.getId()); | ||
boolean successful = room.getWatcherList().remove(clientSide); | ||
if (successful) { | ||
SimplePrinter.serverLog(clientSide.getNickname() + " exit room " + room.getId()); | ||
} | ||
} | ||
} | ||
} |