public Game(bool isClient = false ) { if( Scrabble.Game.InitialConfig.dictionary == null ) throw new NullReferenceException("During game initialization is Scrabble.Game.InitialConfig.dictionary == null"); else this.dictionary = Scrabble.Game.InitialConfig.dictionary; this.client = isClient; this.round = 1; this.historyM = new Stack<Scrabble.Lexicon.Move>(20); this.futureM = new Stack<Scrabble.Lexicon.Move>(6); // Initialization of play desk (logic component, not gtk) this.desk = new Scrabble.Lexicon.PlayDesk ( this ); global::Scrabble.Lexicon.SearchAlgorithm.Init( desk.Desk, this.dictionary ); this.players = Scrabble.Game.InitialConfig.players; if( isClient ) { this.morePeople = true; } else { sserver = new scrabbleServer( this ); int k =0; int l =0; foreach( Scrabble.Player.Player p in players ) { if( p.GetType() == typeof( Scrabble.Player.Player ) ) k++; if( p.GetType() == typeof( Scrabble.Player.NetworkPlayer ) ) l++; p.SetGame( this ); p.ReloadRack(); } if( k > 1 ) this.morePeople = true; if( l > 0 ) this.networkPlayers = true; } // Inicialize dialogs from menu (like checkword, about etc.) Scrabble.GUI.StaticWindows.Init( this ); if( this.client ) { this.sclient = new scrabbleClient( this ); this.clientThread = new Thread( this.mainClientLoop ); this.clientThread.Start(); } else { this.sendUpdatViaNetwork( true ); } }
public Game(bool isClient = false) { if (Scrabble.Game.InitialConfig.dictionary == null) { throw new NullReferenceException("During game initialization is Scrabble.Game.InitialConfig.dictionary == null"); } else { this.dictionary = Scrabble.Game.InitialConfig.dictionary; } this.client = isClient; this.round = 1; this.historyM = new Stack <Scrabble.Lexicon.Move>(20); this.futureM = new Stack <Scrabble.Lexicon.Move>(6); // Initialization of play desk (logic component, not gtk) this.desk = new Scrabble.Lexicon.PlayDesk(this); global::Scrabble.Lexicon.SearchAlgorithm.Init(desk.Desk, this.dictionary); this.players = Scrabble.Game.InitialConfig.players; if (isClient) { this.morePeople = true; } else { sserver = new scrabbleServer(this); int k = 0; int l = 0; foreach (Scrabble.Player.Player p in players) { if (p.GetType() == typeof(Scrabble.Player.Player)) { k++; } if (p.GetType() == typeof(Scrabble.Player.NetworkPlayer)) { l++; } p.SetGame(this); p.ReloadRack(); } if (k > 1) { this.morePeople = true; } if (l > 0) { this.networkPlayers = true; } } // Inicialize dialogs from menu (like checkword, about etc.) Scrabble.GUI.StaticWindows.Init(this); if (this.client) { this.sclient = new scrabbleClient(this); this.clientThread = new Thread(this.mainClientLoop); this.clientThread.Start(); } else { this.sendUpdatViaNetwork(true); } }