Пример #1
0
        public GameSocketManager NewGameSocketManager(string socketManagerName, IPAddress ipAddress, ushort port, GameSocketProtocol protocol)
        {
            GameSocketManager gameSocketManager = new GameSocketManager
            {
                Address  = IPAddress.Any,
                Port     = port,
                Protocol = protocol
            };

            GameSocketManagerEventArgs eventArgs = new GameSocketManagerEventArgs(gameSocketManager, socketManagerName);

            OfficalEventFirer.Fire("gamesocket_manager_added:before", eventArgs);
            if (eventArgs.IsCancelled)
            {
                return(null);
            }
            GameSocketManagers.Add(socketManagerName, gameSocketManager);
            OfficalEventFirer.Fire("gamesocket_manager_added:after", eventArgs);

            return(gameSocketManager);
        }
Пример #2
0
        public GameSocketManager NewGameSocketManager(string socketManagerName, IPAddress ipAddress, ushort port, GameSocketProtocol protocol)
        {
            GameSocketManager gameSocketManager = new GameSocketManager
            {
                Address  = IPAddress.Any,
                Port     = port,
                Protocol = protocol
            };

            CancelEventArgs args = new CancelEventArgs();

            OfficalEventFirer.Fire("gamesocketmanager_added", EventPriority.Before, gameSocketManager, args);

            if (args.Cancel)
            {
                return(null);
            }

            GameSocketManagers.Add(socketManagerName, gameSocketManager);
            OfficalEventFirer.Fire("gamesocketmanager_added", EventPriority.Before, gameSocketManager, args);
            return(gameSocketManager);
        }