protected override void OnMouseDown(UIMouseEventParameter p) { base.OnMouseDown(p); EventBusManager.Instance().Publish("closeVehiclePanel", null); VehicleHolder.getInstance().setVehicleInfo(vehicleInfo); }
private void CloseButton_clickedEventHandler(UIComponent component, UIMouseEventParameter eventParam) { parent.Hide(); foreach (string closeAction in m_closeActions) { EventBusManager.Instance().Publish(closeAction, null); } }
private void hideUI() { if (modPanel != null) { modPanel.Hide(); } m_isUiShowing = false; EventBusManager.Instance().Publish("closeAll", null); }
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); }
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); }
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); }
/// <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(); } } }
/// <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(); }
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); } }
public override void OnLevelUnloading() { VehicleHolder.getInstance().setInactive(); EventBusManager.Instance().Clear(); }
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()); } }
protected override void OnDisable() { base.OnDisable(); EventBusManager.Instance().Publish("closeAll", null); }
protected override void OnMouseDown(UIMouseEventParameter p) { base.OnMouseDown(p); EventBusManager.Instance().Publish("updateroutepaneltext", routePrefix + '/' + routeStr); }
public override void SliderSetValue(float value) { EventBusManager.Instance().Publish("setAngle", value); }
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>(); }