예제 #1
0
        public GatewayServer(string appId, int clientListeningPort, string broadcastRange, int listeningPort, string serverId, ServerType type)
        {
            GatewayServerConfig config = new GatewayServerConfig();
            config.AppId = appId;
            config.BroadcastRange = broadcastRange;
            config.ClientListeningPort = clientListeningPort;
            config.ListeningPort = listeningPort;
            config.Serializer = ObjectFactory.CreateISerializeInstance();
            config.ServerId = serverId;
            config.ServerType = type;

            NetworkManager = new GatewayNetworkManager2(config);
        }
예제 #2
0
        public GatewayNetworkManager2(GatewayServerConfig config)
            : base(config)
        {
            ClientListeningPort = config.ClientListeningPort;
            NetworkAdapter.AddServerInterface(ObjectFactory.CreateIServerNetworkInterfaceInstance(AppId, ClientListeningPort, this));
            ExternalOutgoingMessageQueue = ObjectFactory.CreateIMessageQueueInstance<OutgoingMessage>();
            PlayerConnectionTracker = new ConnectionTracker();
            GameMessageHandlers = new List<IMessageHandler<GameMessageType>>();
            LoadGameMessageHandlers();

            ServerInfo = new ServerInfo();
            ServerInfo.ServerId = ServerId;
            ServerInfo.Type = ServerType.GatewayServer;

            base.CreateHiveNode(ServerInfo);
        }