public GameRoom(GameConfig config) { m_clients = new List<GameClient>(); Game = new Game(this, config); IsOpen = true; }
public GameAnalyser(Game game) { Game = game; }
public static RoomInfo GetRoomInfo(Game game){ if(game!=null&&game.Config!=null){ RoomInfo info=new RoomInfo(); info.RoomName=game.Config.Name; int i=info.RoomName.LastIndexOf("$"); if(i>=0){ info.RoomName=info.RoomName.Substring(0, i); info.NeedPass =true; }else{ info.NeedPass =false; } info.StartLP=game.Config.StartLp; info.Warring=game.Config.EnablePriority|game.Config.NoCheckDeck|game.Config.NoShuffleDeck; info.Rule=game.Config.Rule; info.Mode=game.Config.Mode; info.Lflist=game.Config.LfList; info.IsStart= (game.State!=GameState.Lobby); if(game.Players!=null){ int len=game.Players.Length; Player[] pls=new Player[len]; info.players=new string[len]; game.Players.CopyTo(pls, 0); for(i=0;i<len;i++){ if(pls[i]!=null){ info.players[i]=pls[i].Name; info.Count++; }else{ info.players[i]=""; } } } if(game.Observers!=null){ Player[] pls=game.Observers.ToArray(); int len=pls.Length; info.observers=new string[len]; for(i=0;i<len;i++){ if(pls[i]!=null){ info.observers[i]=pls[i].Name; }else{ info.observers[i]=""; } } info.Count+=len; } return info; } return null; }