public SingleRoomManager(ServerRoomFactory roomFactory, RoomEventDispatcher dispatcher, bool tokenOnce, IRoomListener roomListener) { _dispatcher = dispatcher; _dispatcher.OnRoomEvent += OnRoomEvent; _playerInfoManager = new PlayerInfoManager(tokenOnce); _roomFactory = roomFactory; roomFactory.TokenGenerator = _playerInfoManager; _roomListener = roomListener; _debugSystem = new ServerDebugInfoSystem(this); }
public override string HandlerRequest() { var debugInfo = ServerDebugInfoSystem.GetDebugInfoOnBlock(); var sb = new StringBuilder(); sb.Append( "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><script src=\"https://code.jquery.com/jquery-1.10.2.js\"></script><link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.datatables.net/1.10.19/css/jquery.dataTables.css\"><script type=\"text/javascript\" charset=\"utf8\" src=\"https://cdn.datatables.net/1.10.19/js/jquery.dataTables.js\"></script><script>$(document).ready( function () {$('#table_id').DataTable({paging: false});});</script></head><body>"); var roomInfo = debugInfo.RoomDebugInfo; if (roomInfo != null) { sb.Append("<p>").Append("Room State:").Append(roomInfo.State).Append("</p>"); sb.Append("<p>").Append("Hall Room Id:").Append(roomInfo.HallRoomId).Append("</p>"); sb.Append("<p>").Append("Room Id:").Append(roomInfo.RoomId).Append("</p>"); sb.Append("<p>").Append("HasHallServer:").Append(roomInfo.HasHallServer).Append("</p>"); } else { sb.Append("<p>").Append("There is no Server Room").Append("</p>"); } var playerInfo = debugInfo.PlayerDebugInfo; if (playerInfo != null) { sb.Append( "<table id=\"table_id\" class=\"display\" width='400px' border='1' align='center' cellpadding='2' cellspacing='1'>"); sb.Append("<thead>"); sb.Append("<td>HasPlayerEntity</td>"); sb.Append("<td>HasPlayerInfo</td>"); sb.Append("<td>IsRobot</td>"); sb.Append("<td>IsLogin</td>"); sb.Append("<td>EntityKey</td>"); sb.Append("<td>EntityId</td>"); sb.Append("<td>PlayerId</td>"); sb.Append("<td>TeamId</td>"); sb.Append("<td>Name</td>"); sb.Append("<td>Token</td>"); sb.Append("<td>CreateTime</td>"); sb.Append("<td>GameStartTime</td>"); sb.Append("</thead>"); foreach (var pinfo in playerInfo) { sb.Append("<tr>"); sb.Append("<td>"); sb.Append(pinfo.HasPlayerEntity); sb.Append("</td>"); sb.Append("<td>"); sb.Append(pinfo.HasPlayerInfo); sb.Append("</td>"); sb.Append("<td>"); sb.Append(pinfo.IsRobot); sb.Append("</td>"); sb.Append("<td>"); sb.Append(pinfo.IsLogin); sb.Append("</td>"); sb.Append("<td>"); sb.Append(pinfo.EntityKey); sb.Append("</td>"); sb.Append("<td>"); sb.Append(pinfo.EntityId); sb.Append("</td>"); sb.Append("<td>"); sb.Append(pinfo.PlayerId); sb.Append("</td>"); sb.Append("<td>"); sb.Append(pinfo.TeamId); sb.Append("</td>"); sb.Append("<td>"); sb.Append(pinfo.Name); sb.Append("</td>"); sb.Append("<td>"); sb.Append(pinfo.Token); sb.Append("</td>"); sb.Append("<td>"); sb.Append(pinfo.CreateTime); sb.Append("</td>"); sb.Append("<td>"); sb.Append(pinfo.GameStartTime); sb.Append("</td>"); sb.Append("</tr>"); } } return(sb.ToString()); }