Beispiel #1
0
        protected override void OnMouseDown(UIMouseEventParameter p)
        {
            base.OnMouseDown(p);
            EventBusManager.Instance().Publish("closeVehiclePanel", null);

            VehicleHolder.getInstance().setVehicleInfo(vehicleInfo);
        }
        public EventBusRabbitMQ(
            EventBusConfiguration configuration,
            EventBusRabbitMQConfiguration rabbitmqConfiguration,
            EventBusRabbitMQConnection eventBusConnection,
            EventBusRabbitMQRetryConsumerStrategy retryConsumerStrategy,
            EventBusManager manager,
            ILogger <EventBusRabbitMQ> logger)
        {
            _configuration         = configuration ?? throw new ArgumentNullException(nameof(configuration));
            _rabbitmqConfiguration = rabbitmqConfiguration ?? throw new ArgumentNullException(nameof(rabbitmqConfiguration));
            _exchangeName          = rabbitmqConfiguration.ExchangeName;
            _queueName             = rabbitmqConfiguration.QueueName;
            _eventBusConnection    = eventBusConnection ?? throw new ArgumentNullException(nameof(eventBusConnection));
            _manager = manager ?? throw new ArgumentNullException(nameof(manager));
            _retryConsumerStrategy = retryConsumerStrategy ?? throw new ArgumentNullException(nameof(retryConsumerStrategy));
            _logger = logger ?? throw new ArgumentNullException(nameof(logger));

            using (var channel = _eventBusConnection.CreateModel())
            {
                channel.ExchangeDeclare(
                    exchange: _exchangeName,
                    type: ExchangeType.Direct,
                    arguments: new Dictionary <string, object>()
                {
                    { "x-dead-letter-exchange", $"{_exchangeName}{_configuration.FailSuffix}" }
                });
            }
        }
Beispiel #3
0
 public static void Show(string title, string message)
 {
     Application.Current.Dispatcher.Invoke(delegate
     {
         EventBusManager.Send <MessageBoxView, MessageBoxMessage>(new MessageBoxMessage(title, message), 10, true);
     });
 }
Beispiel #4
0
 public static void ActivityOff()
 {
     Application.Current.Dispatcher.Invoke(delegate
     {
         EventBusManager.CloseView <ActivityLoadingView>(10);
     });
 }
Beispiel #5
0
 private void CloseButton_clickedEventHandler(UIComponent component, UIMouseEventParameter eventParam)
 {
     parent.Hide();
     foreach (string closeAction in m_closeActions)
     {
         EventBusManager.Instance().Publish(closeAction, null);
     }
 }
        public ActivityLoadingView()
        {
            this.InitializeComponent();

            this._viewModel = (ActivityLoadingViewModel)this.DataContext;

            EventBusManager.Register <ActivityLoadingView, BaseMessage>(this.BaseMessageEvent);
        }
Beispiel #7
0
        public static void ShowAsk(string title, string message, Action <bool> safeData)
        {
            bool result = false;

            Application.Current.Dispatcher.Invoke(delegate
            {
                EventBusManager.Send <MessageBoxView, AskBoxMessage>(new AskBoxMessage(title, message, safeData), 10, true);
            });
        }
Beispiel #8
0
 private void hideUI()
 {
     if (modPanel != null)
     {
         modPanel.Hide();
     }
     m_isUiShowing = false;
     EventBusManager.Instance().Publish("closeAll", null);
 }
        public DialogView()
        {
            this.InitializeComponent();

            this._viewModel = (DialogViewModel)this.DataContext;

            EventBusManager.Register <DialogView, BaseMessage>(this.BaseMessageEvent);

            this._viewModel.CommandSelectedPathDialogAccept = new ButtonCommandSelectedPathDialogAccept(this._viewModel);
        }
        public MainView()
        {
            this.InitializeComponent();

            this._viewModel = (MainViewModel)this.DataContext;

            EventBusManager.Register <MainView, BaseMessage>(this.BaseMessageEvent);
            this._viewModel.CommandSelectedDistrict    = new ChangedCommandSelectedDistrict(this._viewModel);
            this._viewModel.CommandSortByWeekIncidence = new ButtonCommandSortByWeekIncidence(this._viewModel);
            this._viewModel.CommandSortByDeaths        = new ButtonCommandSortByDeaths(this._viewModel);
        }
        public MenuView()
        {
            this.InitializeComponent();

            this._viewModel = (MenuViewModel)this.DataContext;

            this._viewModel.CommandOpenMain  = new ButtonCommandOpenMain(this._viewModel);
            this._viewModel.CommandOpenSetup = new ButtonCommandOpenSetup(this._viewModel);

            EventBusManager.Register <MenuView, BaseMessage>(this.BaseMessageEvent);
            this._viewModel.ViewOpened = EventBusManager.GetViewOpened(0);
        }
Beispiel #12
0
 private void deleteSignBtn_eventClick(UIComponent component, UIMouseEventParameter eventParam)
 {
     mSignDeletionTool.isDynamic = false;
     if (ToolsModifierControl.toolController.CurrentTool != mSignDeletionTool)
     {
         ToolsModifierControl.toolController.CurrentTool = mSignDeletionTool;
         ToolsModifierControl.SetTool <SignDeletionTool>();
     }
     else
     {
         ToolsModifierControl.toolController.CurrentTool = ToolsModifierControl.GetTool <DefaultTool>();
         ToolsModifierControl.SetTool <DefaultTool>();
     }
     EventBusManager.Instance().Publish("closeAll", null);
 }
Beispiel #13
0
 private void addDynamicSignBtn_eventClick(UIComponent component, UIMouseEventParameter eventParam)
 {
     mRoadSelectTool.isDynamic   = true;
     mRoadSelectTool.angleDialog = angleDialog;
     if (ToolsModifierControl.toolController.CurrentTool != mRoadSelectTool)
     {
         ToolsModifierControl.toolController.CurrentTool = mRoadSelectTool;
         ToolsModifierControl.SetTool <RoadSelectorTool>();
     }
     else
     {
         ToolsModifierControl.toolController.CurrentTool = ToolsModifierControl.GetTool <DefaultTool>();
         ToolsModifierControl.SetTool <DefaultTool>();
     }
     EventBusManager.Instance().Publish("closeAll", null);
 }
Beispiel #14
0
        public UIMainPanel()
        {
            UIView uiView = UIView.GetAView();

            vehicleSelectorBtn = (UIButton)uiView.AddUIComponent(typeof(UIButton));

            mVehicleInfoListObject            = new GameObject("RoadNamePanel");
            mVehicleInfoList                  = mVehicleInfoListObject.AddComponent <VehicleInfoList>();
            mVehicleInfoList.transform.parent = uiView.transform;
            mVehicleInfoList.Hide();

            vehicleSelectorBtn.text              = "Vehicle Selector";
            vehicleSelectorBtn.width             = 150;
            vehicleSelectorBtn.height            = 30;
            vehicleSelectorBtn.normalBgSprite    = "ButtonMenu";
            vehicleSelectorBtn.disabledBgSprite  = "ButtonMenuDisabled";
            vehicleSelectorBtn.hoveredBgSprite   = "ButtonMenuHovered";
            vehicleSelectorBtn.focusedBgSprite   = "ButtonMenuFocused";
            vehicleSelectorBtn.pressedBgSprite   = "ButtonMenuPressed";
            vehicleSelectorBtn.textColor         = new Color32(255, 255, 255, 255);
            vehicleSelectorBtn.disabledTextColor = new Color32(7, 7, 7, 255);
            vehicleSelectorBtn.hoveredTextColor  = new Color32(7, 132, 255, 255);
            vehicleSelectorBtn.focusedTextColor  = new Color32(255, 255, 255, 255);
            vehicleSelectorBtn.pressedTextColor  = new Color32(30, 30, 44, 255);
            vehicleSelectorBtn.eventClick       += VehicleSelectorBtn_eventClick;
            vehicleSelectorBtn.relativePosition  = new Vector3(330f, 20f);

            spawnMeshBtn                   = (UIButton)uiView.AddUIComponent(typeof(UIButton));
            spawnMeshBtn.text              = "Spawn Vehicle";
            spawnMeshBtn.width             = 150;
            spawnMeshBtn.height            = 30;
            spawnMeshBtn.normalBgSprite    = "ButtonMenu";
            spawnMeshBtn.disabledBgSprite  = "ButtonMenuDisabled";
            spawnMeshBtn.hoveredBgSprite   = "ButtonMenuHovered";
            spawnMeshBtn.focusedBgSprite   = "ButtonMenuFocused";
            spawnMeshBtn.textColor         = new Color32(255, 255, 255, 255);
            spawnMeshBtn.disabledTextColor = new Color32(7, 7, 7, 255);
            spawnMeshBtn.hoveredTextColor  = new Color32(7, 132, 255, 255);
            spawnMeshBtn.focusedTextColor  = new Color32(255, 255, 255, 255);
            spawnMeshBtn.eventClick       += SpawnMeshBtn_eventClick;
            spawnMeshBtn.relativePosition  = new Vector3(330f, 60f);

            EventBusManager.Instance().Subscribe("closeVehiclePanel", mVehicleInfoList);
            EventBusManager.Instance().Subscribe("closeAll", mVehicleInfoList);
        }
        public async static Task ProcessEvent(this EventBusManager manager, BasicDeliverEventArgs eventArgs, ILogger logger)
        {
            var eventName   = eventArgs.RoutingKey;
            var messageBody = Encoding.UTF8.GetString(eventArgs.Body);

            logger.LogTrace($"Processing RabbitMQ event: {eventName}", eventName);

            if (manager.HasSubscription(eventName))
            {
                var subscription = manager.GetSubscription(eventName);
                var message      = (EventBusMessage)JsonConvert.DeserializeObject(messageBody, subscription.MessageType);
                await subscription.OnMessage(message, eventArgs.BasicProperties.GetExceptionStack().OfType <string>().ToArray());
            }
            else
            {
                logger.LogWarning($"No subscription for RabbitMQ event: {eventName}");
            }
        }
Beispiel #16
0
        /// <summary>
        /// Gets the colour from the panel and sets it to be rendered/saved
        /// </summary>
        private void SetRoadData()
        {
            if (m_netSegmentId != 0)
            {
                string routeStr         = m_routeStrField.text;
                bool   validOldRouteStr = m_initialRouteStr != null && m_initialRoutePrefix != null;
                string oldRouteStr      = validOldRouteStr ? m_initialRoutePrefix + '/' + m_initialRouteStr : null;
                if (routeStr != null)
                {
                    RenderingManager roadRenderingManager = RenderingManager.instance;
                    RouteManager.Instance().SetRoute(m_netSegmentId, m_routeTypeDropdown.selectedValue, routeStr, oldRouteStr);

                    Hide();
                    EventBusManager.Instance().Publish("closeUsedNamePanel", null);
                    EventBusManager.Instance().Publish("forceupdateroadnames", null);
                    roadRenderingManager.ForceUpdate();
                }
            }
        }
Beispiel #17
0
 /// <summary>
 /// Gets the colour from the panel and sets it to be rendered/saved
 /// </summary>
 private void SetRoadData()
 {
     if (String.IsNullOrEmpty(m_routeStrField.text))
     {
         mSignPlacementTool.routeStr    = null;
         mSignPlacementTool.routePrefix = null;
     }
     else
     {
         mSignPlacementTool.routeStr    = m_routeStrField.text;
         mSignPlacementTool.routePrefix = m_routeTypeDropdown.selectedValue;
     }
     mSignPlacementTool.destination = m_destinationField[0].text + '\n' + m_destinationField[1].text;
     mSignPlacementTool.angleDialog = angleDialog;
     mSignPlacementTool.SetPropInfo(m_propTypeDropDown.selectedValue);
     ToolsModifierControl.toolController.CurrentTool = mSignPlacementTool;
     ToolsModifierControl.SetTool <StaticSignPlacementTool>();
     EventBusManager.Instance().Publish("closeAll", null);
     angleDialog.Show();
 }
Beispiel #18
0
        protected override void OnToolUpdate()
        {
            PropInfo propInfo = this.m_propInfo;

            if (propInfo == null)
            {
                return;
            }

            if (Input.GetKeyDown(KeyCode.LeftArrow))
            {
                this.m_angle = (this.m_angle + 15f) % 360f;
                EventBusManager.Instance().Publish("setAngle", this.m_angle);
            }
            else if (Input.GetKeyDown(KeyCode.RightArrow))
            {
                this.m_angle = (this.m_angle - 15f) % 360f;
                EventBusManager.Instance().Publish("setAngle", this.m_angle);
            }
        }
Beispiel #19
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     // Start the main view
     EventBusManager.OpenView <MainView>(0);
     EventBusManager.Send <MainView, BaseMessage>(new BaseMessage(BaseMessageOptions.LoadActualData), 0);
 }
Beispiel #20
0
 public override void OnLevelUnloading()
 {
     VehicleHolder.getInstance().setInactive();
     EventBusManager.Instance().Clear();
 }
Beispiel #21
0
        protected override void OnToolUpdate()
        {
            if (m_toolController != null && !m_toolController.IsInsideUI && Cursor.visible)
            {
                RaycastOutput raycastOutput;

                if (RaycastRoad(out raycastOutput))
                {
                    ushort netSegmentId = raycastOutput.m_netSegment;
                    ushort nodeId       = raycastOutput.m_netNode;
                    if (netSegmentId != 0)
                    {
                        NetManager netManager = NetManager.instance;
                        NetSegment netSegment = netManager.m_segments.m_buffer[(int)netSegmentId];

                        if (netSegment.m_flags.IsFlagSet(NetSegment.Flags.Created))
                        {
                            if (Event.current.type == EventType.MouseDown /*&& Event.current.button == (int)UIMouseButton.Left*/)
                            {
                                //unset tool
                                ShowToolInfo(false, null, new Vector3());

                                if (m_namingPanel != null)
                                {
#if DEBUG
                                    NetNode startNode = netManager.m_nodes.m_buffer[netSegment.m_startNode]; //Not used yet, but there just incase. This isn't final
                                    Vector3 rotation  = netSegment.GetDirection(netSegment.m_startNode);
                                    LoggerUtils.LogToConsole(rotation.ToString());
#endif
                                    if (!isDynamic)
                                    {
                                        m_namingPanel.m_initialRouteStr    = RouteManager.Instance().GetRouteStr(netSegmentId);
                                        m_namingPanel.m_initialRoutePrefix = RouteManager.Instance().GetRouteType(netSegmentId);
                                        m_namingPanel.UpdateTextField();

                                        m_namingPanel.m_netSegmentId   = netSegmentId;
                                        m_namingPanel.m_netSegmentName = netSegment.Info.name.Replace(" ", "");
                                        m_namingPanel.Show();
                                        m_usedRoutesPanel.RefreshList();
                                        m_usedRoutesPanel.Show();
                                    }
                                    else
                                    {
                                        m_dynamicSignPlacementTool.segmentId            = netSegmentId;
                                        m_dynamicSignPlacementTool.routeStr             = RouteManager.Instance().GetRouteStr(netSegmentId);
                                        m_dynamicSignPlacementTool.routePrefix          = RouteManager.Instance().GetRouteType(netSegmentId);
                                        m_dynamicSignPlacementTool.angleDialog          = angleDialog;
                                        ToolsModifierControl.toolController.CurrentTool = m_dynamicSignPlacementTool;
                                        ToolsModifierControl.SetTool <DynamicSignPlacementTool>();
                                        EventBusManager.Instance().Publish("closeAll", null);
                                        angleDialog.Show();
                                    }
                                }
                            }
                            else
                            {
                                if (!isDynamic)
                                {
                                    ShowToolInfo(true, "Mark this route", netSegment.m_bounds.center);
                                }
                                else
                                {
                                    ShowToolInfo(true, "Add a traffic sign here", netSegment.m_bounds.center);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                ShowToolInfo(false, null, new Vector3());
            }
        }
Beispiel #22
0
 protected override void OnDisable()
 {
     base.OnDisable();
     EventBusManager.Instance().Publish("closeAll", null);
 }
Beispiel #23
0
 protected override void OnMouseDown(UIMouseEventParameter p)
 {
     base.OnMouseDown(p);
     EventBusManager.Instance().Publish("updateroutepaneltext", routePrefix + '/' + routeStr);
 }
 public static EventBus GetRemoteEventBus(this EventBusManager man)
 {
     return(man.GetOrCreateBus(_remoteEventBusName));
 }
Beispiel #25
0
 public void Execute(object parameter)
 {
     EventBusManager.CloseView <DialogContentView>(2);
     EventBusManager.CloseView <DialogView>(10);
 }
Beispiel #26
0
        public ModPanel()
        {
            UIView uiView  = UIView.GetAView();
            int    yCursor = PADDING;

            this.backgroundSprite = "GenericPanel";
            color = new Color32(75, 75, 135, 255);
            width = WIDTH;

            markRouteBtn         = getButton(yCursor, "Mark Road Segment", markRouteBtn_eventClick);
            yCursor             += (30 + PADDING);
            addSignBtn           = getButton(yCursor, "Add a Sign", addSignBtn_eventClick);
            yCursor             += (30 + PADDING);
            deleteSignBtn        = getButton(yCursor, "Delete a Sign", deleteSignBtn_eventClick);
            yCursor             += (30 + PADDING);
            addDynamicSignBtn    = getButton(yCursor, "Add a dynamic Sign", addDynamicSignBtn_eventClick);
            yCursor             += (30 + PADDING);
            deleteDynamicSignBtn = getButton(yCursor, "Delete a dynamic Sign", deleteDynamicSignBtn_eventClick);

            this.height = deleteDynamicSignBtn.relativePosition.y + deleteDynamicSignBtn.height + PADDING * 2;

            m_propAngleDialogObject      = new GameObject("AnglePanel");
            angleDialog                  = m_propAngleDialogObject.AddComponent <AngleDialog>();
            angleDialog.transform.parent = uiView.transform;
            angleDialog.Hide();

            m_namingPanelObject            = new GameObject("RouteNamePanel");
            m_namingPanel                  = m_namingPanelObject.AddComponent <RouteNamePanel>();
            m_namingPanel.transform.parent = uiView.transform;
            m_namingPanel.Hide();

            m_usedRoutesPanelObject            = new GameObject("UsedRoutesPanel");
            m_usedRoutesPanel                  = m_usedRoutesPanelObject.AddComponent <UsedRoutesPanel>();
            m_usedRoutesPanel.transform.parent = uiView.transform;
            m_usedRoutesPanel.Hide();

            m_addSignPanelObject            = new GameObject("AddSignsPanel");
            m_addSignPanel                  = m_addSignPanelObject.AddComponent <AddSignPanel>();
            m_addSignPanel.transform.parent = uiView.transform;
            m_addSignPanel.angleDialog      = angleDialog;
            m_addSignPanel.Hide();

            mDynamicSignPlacementTool = ToolsModifierControl.toolController.gameObject.AddComponent <DynamicSignPlacementTool>();
            mSignDeletionTool         = ToolsModifierControl.toolController.gameObject.AddComponent <SignDeletionTool>();

            mSignPlacementTool = ToolsModifierControl.toolController.gameObject.AddComponent <StaticSignPlacementTool>();
            m_addSignPanel.mSignPlacementTool = mSignPlacementTool;

            mRoadSelectTool = ToolsModifierControl.toolController.gameObject.AddComponent <RoadSelectorTool>();
            mRoadSelectTool.m_namingPanel              = m_namingPanel;
            mRoadSelectTool.m_usedRoutesPanel          = m_usedRoutesPanel;
            mRoadSelectTool.m_dynamicSignPlacementTool = mDynamicSignPlacementTool;
            mRoadSelectTool.angleDialog = angleDialog;

            EventBusManager.Instance().Subscribe("forceupdateroutes", m_usedRoutesPanel);
            EventBusManager.Instance().Subscribe("closeUsedNamePanel", m_usedRoutesPanel);
            EventBusManager.Instance().Subscribe("closeAll", m_usedRoutesPanel);
            EventBusManager.Instance().Subscribe("closeAll", m_namingPanel);
            EventBusManager.Instance().Subscribe("closeAll", m_addSignPanel);
            EventBusManager.Instance().Subscribe("updateroutepaneltext", m_addSignPanel);
            EventBusManager.Instance().Subscribe("updateroutepaneltext", m_namingPanel);
            EventBusManager.Instance().Subscribe("setAngle", mSignPlacementTool);
            EventBusManager.Instance().Subscribe("setAngle", mDynamicSignPlacementTool);
            EventBusManager.Instance().Subscribe("setAngle", angleDialog);

            ToolsModifierControl.toolController.CurrentTool = ToolsModifierControl.GetTool <DefaultTool>();
            ToolsModifierControl.SetTool <DefaultTool>();
        }
Beispiel #27
0
 public override void SliderSetValue(float value)
 {
     EventBusManager.Instance().Publish("setAngle", value);
 }