コード例 #1
0
 public CreationManager(ServerDirector serverDirector, CreationState initialState)
 {
     currentCreationState = initialState;
     director = serverDirector;
 }
コード例 #2
0
ファイル: Server.cs プロジェクト: ramseur/MudDesigner
        /// <summary>
        /// Starts the server. Once completed, it will listen for incoming connections
        /// </summary>
        /// <param name="maxConnections">Maximum connections this server will allow</param>
        /// <param name="maxQueueSize">Maximum queue size this server will allow</param>
        /// <param name="game">The game that the server will reference.</param>
        public void Start(Int32 maxConnections, Int32 maxQueueSize, IGame game)
        {
            Log.Info(string.Format("Game Server System Starting on port {0}",Port));
            //            Logger.WriteLine("Game Server System Starting on port " + Port.ToString());

            // If the server is already running, abort.
            if (Status != ServerStatus.Stopped)
                return;

            // Set the status to starting
            Status = ServerStatus.Starting;

            // Store our reference to the Game
            Game = game;

            // Instance a new copy of ServerDirector
            ServerDirector = new ServerDirector(this);

            try
            {
                // Setup our network socket.
                Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                IPEndPoint ip = new IPEndPoint(IPAddress.Any, this.Port);

                // Bind to the host and listen for incoming connections
                Socket.Bind(ip);
                Socket.Listen(this.MaxQueuedConnections);

                // Set the status to running
                this.Status = ServerStatus.Running;
                this.Enabled = true;

                // Pass the new client off onto a new thread and allow it to run.
                ServerThread = new Thread(Running);
                ServerThread.Start();
                Log.Info("Server status: Running");
                // Logger.WriteLine("Server status: Running");
            }
            catch
            {

                Log.Fatal("Failed to start the Engines Networking Server!");
                // Logger.WriteLine("Failed to star the Engines Networking Server!");
                this.Status = ServerStatus.Stopped;
                Log.Fatal("Server status: Stopped");
                // Logger.WriteLine("Server status: Stopped");
            }
        }
コード例 #3
0
ファイル: MainMenuState.cs プロジェクト: ramseur/MudDesigner
 public MainMenuState(ServerDirector director)
 {
     Director = director;
 }
コード例 #4
0
 public ClientConnectState(ServerDirector serverDirector)
 {
     director = serverDirector;
 }
コード例 #5
0
ファイル: GenderSelect.cs プロジェクト: ramseur/MudDesigner
 public GenderSelect(ServerDirector serverDirector)
 {
     director = serverDirector;
 }
コード例 #6
0
 public CreateNewCharacter(ServerDirector serverDirector)
 {
     director = serverDirector;
     currentState = CurrentState.InitialWelcome;
 }
コード例 #7
0
 public ClientLoginState(ServerDirector serverDirector)
 {
     director = serverDirector;
     currentState = CurrentState.EnteringName;
 }