예제 #1
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());
            }
        }
예제 #2
0
 public void setVehicleInfo(VehicleInfo vehicleInfo)
 {
     mVehicleInfo = vehicleInfo;
     LoggerUtils.LogToConsole(string.Format("Vehicle Info set:{0}", vehicleInfo.name));
 }