Beispiel #1
0
 public CreationManager(ServerDirector serverDirector, CreationState initialState)
 {
     currentCreationState = initialState;
     director = serverDirector;
 }
Beispiel #2
0
        /// <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");
            }
        }
Beispiel #3
0
 public MainMenuState(ServerDirector director)
 {
     Director = director;
 }
 public ClientConnectState(ServerDirector serverDirector)
 {
     director = serverDirector;
 }
Beispiel #5
0
 public GenderSelect(ServerDirector serverDirector)
 {
     director = serverDirector;
 }
 public CreateNewCharacter(ServerDirector serverDirector)
 {
     director = serverDirector;
     currentState = CurrentState.InitialWelcome;
 }
 public ClientLoginState(ServerDirector serverDirector)
 {
     director = serverDirector;
     currentState = CurrentState.EnteringName;
 }