Exemple #1
0
        public override void OnLoad(AddonManager manager, Addon owner)
        {
            _owner  = owner;
            _pulses = new List <HapticPulse>();

            BridgeHandler.RegisterGlobalLink("VRUB_Core_Haptics", HapticAPI.Instance);
        }
Exemple #2
0
    public Sprite getBattleBase(int currentTag)
    {
        float  time       = System.DateTime.Now.Hour + ((float)System.DateTime.Now.Minute / 60f);
        string timeString = "";

        if (time >= 20 || time < 3.5f)
        { //night
            timeString = "Night";
        }
        else if (time >= 17.5f)
        { //eve
            timeString = "Eve";
        }

        Environment check       = (currentTag == 3) ? environment2 : environment;
        string      checkString = check.ToString();

        if (currentTag == 2)
        {
            checkString = "Water";
        }


        //Check for bridge at player						        //0.5f to adjust for stair height
        //cast a ray directly downwards from the player		        //1f to check in line with player's head
        RaycastHit[]  hitColliders = Physics.RaycastAll(PlayerMovement.player.transform.position + new Vector3(0, 1.5f, 0), Vector3.down);
        BridgeHandler bridge       = null;

        //cycle through each of the collisions
        if (hitColliders.Length > 0)
        {
            //if bridge has not been found yet
            for (int i = 0; i < hitColliders.Length && bridge == null; i++)
            {
                //if a collision's gameObject has a BridgeHandler, it is a bridge.
                if (hitColliders[i].collider.gameObject.GetComponent <BridgeHandler>() != null)
                {
                    bridge = hitColliders[i].collider.gameObject.GetComponent <BridgeHandler>();
                    i      = hitColliders.Length; //stop iterating after bridge found
                }
            }
        }
        if (bridge != null)
        {
            check       = bridge.bridgeEnvironment;
            checkString = check.ToString();
        }

        //if outdoor environment
        if (check == Environment.Field || check == Environment.Mountain ||
            check == Environment.Forest || check == Environment.Snow)
        {
            //return with timestring attached
            return(Resources.Load <Sprite>("BattleBackgrounds/Bases/" + checkString + timeString));
        }

        //else return without timestring
        return(Resources.Load <Sprite>("BattleBackgrounds/Bases/" + checkString));
    }
Exemple #3
0
        protected override IMessageHandler CreateProducerMessageHandler(IProducerDestination destination, IProducerOptions producerProperties, IMessageChannel errorChannel)
        {
            var handler = new BridgeHandler(ApplicationContext)
            {
                OutputChannel = ((SpringIntegrationProducerDestination)destination).Channel
            };

            return(handler);
        }
        public IDisposable Adapt(IMessageChannel streamListenerResult, IMessageChannel bindingTarget)
        {
            var handler = new BridgeHandler(_context);

            handler.OutputChannel = bindingTarget;

            ((ISubscribableChannel)streamListenerResult).Subscribe(handler);

            return(new NoOpDisposable());
        }
Exemple #5
0
        public BridgeHandlerTest()
        {
            var services = new ServiceCollection();

            services.AddSingleton <IDestinationRegistry, DefaultDestinationRegistry>();
            services.AddSingleton <IDestinationResolver <IMessageChannel>, DefaultMessageChannelDestinationResolver>();
            services.AddSingleton <IMessageBuilderFactory, DefaultMessageBuilderFactory>();
            services.AddSingleton <IIntegrationServices, IntegrationServices>();
            provider = services.BuildServiceProvider();
            handler  = new BridgeHandler(provider);
        }
Exemple #6
0
        public BridgeHandlerTest()
        {
            var services = new ServiceCollection();
            var config   = new ConfigurationBuilder().Build();

            services.AddSingleton <IConfiguration>(config);
            services.AddSingleton <IApplicationContext, GenericApplicationContext>();
            services.AddSingleton <IDestinationResolver <IMessageChannel>, DefaultMessageChannelDestinationResolver>();
            services.AddSingleton <IMessageBuilderFactory, DefaultMessageBuilderFactory>();
            services.AddSingleton <IIntegrationServices, IntegrationServices>();
            provider = services.BuildServiceProvider();
            handler  = new BridgeHandler(provider.GetService <IApplicationContext>());
        }
Exemple #7
0
        public void BridgedChannel()
        {
            var services = new ServiceCollection();

            services.AddSingleton <IIntegrationServices, IntegrationServices>();
            var provider             = services.BuildServiceProvider();
            var noSubscribersChannel = new DirectChannel(provider);
            var subscribedChannel    = new DirectChannel(provider);
            var bridgeHandler        = new BridgeHandler(provider);

            bridgeHandler.OutputChannel = noSubscribersChannel;
            subscribedChannel.Subscribe(bridgeHandler);
            try
            {
                subscribedChannel.Send(new GenericMessage <string>("Hello, world!"));
                throw new Exception("Exception expected");
            }
            catch (MessagingException e)
            {
                Assert.Contains("Dispatcher has no subscribers", e.Message);
            }
        }
        private ISubscribableChannel RegisterErrorInfrastructure(IProducerDestination destination)
        {
            var errorChannelName = GetErrorsBaseName(destination);
            ISubscribableChannel errorChannel;
            var errorChannelObject = _destinationRegistry.Lookup(errorChannelName);

            if (errorChannelObject != null)
            {
                if (!(errorChannelObject is ISubscribableChannel))
                {
                    throw new InvalidOperationException("Error channel '" + errorChannelName + "' must be a ISubscribableChannel");
                }

                errorChannel = (ISubscribableChannel)errorChannelObject;
            }
            else
            {
                errorChannel = new PublishSubscribeChannel(ServiceProvider);
                _destinationRegistry.Register(errorChannelName, errorChannel);
            }

            var defaultErrorChannel = (IMessageChannel)_destinationRegistry.Lookup(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME);

            if (defaultErrorChannel != null)
            {
                var errorBridge = new BridgeHandler(ServiceProvider)
                {
                    OutputChannel = defaultErrorChannel
                };
                errorChannel.Subscribe(errorBridge);
                var errorBridgeHandlerName = GetErrorBridgeName(destination);
                _destinationRegistry.Register(errorBridgeHandlerName, errorBridge);
            }

            return(errorChannel);
        }
 public Bridge(BridgeHandler handler, WebBrowser browser)
 {
     this.handler = handler;
     this.browser = browser;
 }
        protected virtual ErrorInfrastructure RegisterErrorInfrastructure(IConsumerDestination destination, string group, IConsumerOptions consumerOptions, bool polled)
        {
            var errorMessageStrategy = GetErrorMessageStrategy();

            var errorChannelName = GetErrorsBaseName(destination, group, consumerOptions);
            ISubscribableChannel errorChannel;
            var errorChannelObject = _destinationRegistry.Lookup(errorChannelName);

            if (errorChannelObject != null)
            {
                if (!(errorChannelObject is ISubscribableChannel))
                {
                    throw new ArgumentException("Error channel '" + errorChannelName + "' must be a ISubscribableChannel");
                }

                errorChannel = (ISubscribableChannel)errorChannelObject;
            }
            else
            {
                errorChannel = new BinderErrorChannel(ServiceProvider, errorChannelName);
                _destinationRegistry.Register(errorChannelName, errorChannel);
            }

            ErrorMessageSendingRecoverer recoverer;

            if (errorMessageStrategy == null)
            {
                recoverer = new ErrorMessageSendingRecoverer(ServiceProvider, errorChannel);
            }
            else
            {
                recoverer = new ErrorMessageSendingRecoverer(ServiceProvider, errorChannel, errorMessageStrategy);
            }

            var recovererBeanName = GetErrorRecovererName(destination, group, consumerOptions);

            _destinationRegistry.Register(recovererBeanName, recoverer);

            IMessageHandler handler;

            if (polled)
            {
                handler = GetPolledConsumerErrorMessageHandler(destination, group, consumerOptions);
            }
            else
            {
                handler = GetErrorMessageHandler(destination, group, consumerOptions);
            }

            var defaultErrorChannel = (IMessageChannel)_destinationRegistry.Lookup(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME);

            if (handler == null && errorChannel is ILastSubscriberAwareChannel)
            {
                handler = GetDefaultErrorMessageHandler((ILastSubscriberAwareChannel)errorChannel, defaultErrorChannel != null);
            }

            var errorMessageHandlerName = GetErrorMessageHandlerName(destination, group, consumerOptions);

            if (handler != null)
            {
                if (IsSubscribable(errorChannel))
                {
                    var errorHandler = handler;
                    _destinationRegistry.Register(errorMessageHandlerName, errorHandler);
                    errorChannel.Subscribe(handler);
                }
                else
                {
                    // this.logger.warn("The provided errorChannel '" + errorChannelName
                    //        + "' is an instance of DirectChannel, "
                    //        + "so no more subscribers could be added which may affect DLQ processing. "
                    //        + "Resolution: Configure your own errorChannel as "
                    //        + "an instance of PublishSubscribeChannel");
                }
            }

            if (defaultErrorChannel != null)
            {
                if (IsSubscribable(errorChannel))
                {
                    var errorBridge = new BridgeHandler(ServiceProvider)
                    {
                        OutputChannel = defaultErrorChannel
                    };
                    errorChannel.Subscribe(errorBridge);

                    var errorBridgeHandlerName = GetErrorBridgeName(destination, group, consumerOptions);
                    _destinationRegistry.Register(errorBridgeHandlerName, errorBridge);
                }
                else
                {
                    // this.logger.warn("The provided errorChannel '" + errorChannelName
                    //        + "' is an instance of DirectChannel, "
                    //        + "so no more subscribers could be added and no error messages will be sent to global error channel. "
                    //        + "Resolution: Configure your own errorChannel as "
                    //        + "an instance of PublishSubscribeChannel");
                }
            }

            return(new ErrorInfrastructure(errorChannel, recoverer, handler));
        }
Exemple #11
0
 public Overlay(Addon addon)
 {
     Bridge = new BridgeHandler(this);
     Bridge.RegisterLink("VRUB_Core_PermissionManager", addon.Interops["permissions"]);
     _addon = addon;
 }
        protected virtual ErrorInfrastructure RegisterErrorInfrastructure(IConsumerDestination destination, string group, IConsumerOptions consumerOptions, bool polled, ILogger logger)
        {
            var errorMessageStrategy = GetErrorMessageStrategy();

            var errorChannelName = GetErrorsBaseName(destination, group, consumerOptions);

            var errorChannel = GetErrorChannel(logger, errorChannelName);

            var recoverer = new ErrorMessageSendingRecoverer(ApplicationContext, errorChannel, errorMessageStrategy);

            var recovererBeanName = GetErrorRecovererName(destination, group, consumerOptions);

            ApplicationContext.Register(recovererBeanName, recoverer);

            IMessageHandler handler;

            if (polled)
            {
                handler = GetPolledConsumerErrorMessageHandler(destination, group, consumerOptions);
            }
            else
            {
                handler = GetErrorMessageHandler(destination, group, consumerOptions);
            }

            var defaultErrorChannel = ApplicationContext.GetService <IMessageChannel>(IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME);

            if (handler == null && errorChannel is ILastSubscriberAwareChannel channel)
            {
                handler = GetDefaultErrorMessageHandler(channel, defaultErrorChannel != null);
            }

            var errorMessageHandlerName = GetErrorMessageHandlerName(destination, group, consumerOptions);

            if (handler != null)
            {
                handler.ServiceName = errorMessageHandlerName;
                if (IsSubscribable(errorChannel))
                {
                    var errorHandler = handler;
                    ApplicationContext.Register(errorMessageHandlerName, errorHandler);
                    errorChannel.Subscribe(handler);
                }
                else
                {
                    _logger?.LogWarning("The provided errorChannel '" + errorChannelName
                                        + "' is an instance of DirectChannel, "
                                        + "so no more subscribers could be added which may affect DLQ processing. "
                                        + "Resolution: Configure your own errorChannel as "
                                        + "an instance of PublishSubscribeChannel");
                }
            }

            if (defaultErrorChannel != null)
            {
                if (IsSubscribable(errorChannel))
                {
                    var errorBridge = new BridgeHandler(ApplicationContext)
                    {
                        OutputChannel = defaultErrorChannel
                    };
                    errorChannel.Subscribe(errorBridge);

                    var errorBridgeHandlerName = GetErrorBridgeName(destination, group, consumerOptions);
                    errorBridge.ServiceName = errorBridgeHandlerName;
                    ApplicationContext.Register(errorBridgeHandlerName, errorBridge);
                }
                else
                {
                    _logger?.LogWarning("The provided errorChannel '" + errorChannelName
                                        + "' is an instance of DirectChannel, "
                                        + "so no more subscribers could be added and no error messages will be sent to global error channel. "
                                        + "Resolution: Configure your own errorChannel as "
                                        + "an instance of PublishSubscribeChannel");
                }
            }

            return(new ErrorInfrastructure(errorChannel, recoverer, handler));
        }
Exemple #13
0
 public Bridge(BridgeHandler handler, WebBrowser browser)
 {
     this.handler = handler;
     this.browser = browser;
 }
Exemple #14
0
        public override void OnLoad(AddonManager manager, Addon owner)
        {
            _owner = owner;

            BridgeHandler.RegisterGlobalLink("VRUB_Core_AddonManagement", AddonManagementAPI.Instance);
        }