public override void OnToolGUI(Event e) { // handle delete if (KeybindSettingsBase.RestoreDefaultsKey.KeyDown(e)) { ref NetNode node = ref SelectedNodeId.ToNode(); ExtSegmentManager extSegmentManager = ExtSegmentManager.Instance; for (int i = 0; i < 8; ++i) { ushort segmentId = node.GetSegment(i); if (segmentId != 0) { // TODO: #568 provide unified delete key for all managers. bool startNode = (bool)extSegmentManager.IsStartNode(segmentId, SelectedNodeId); JunctionRestrictionsManager.Instance.ClearSegmentEnd(segmentId, startNode); } } }
public static IRecordable FixPrioritySigns( PrioritySignsTool.PrioritySignsMassEditMode massEditMode, List <ushort> segmentList) { if (segmentList == null || segmentList.Count == 0) { return(null); } IRecordable record = RecordRoad(segmentList); var primaryPrioType = PriorityType.None; var secondaryPrioType = PriorityType.None; switch (massEditMode) { case PrioritySignsTool.PrioritySignsMassEditMode.MainYield: { primaryPrioType = PriorityType.Main; secondaryPrioType = PriorityType.Yield; break; } case PrioritySignsTool.PrioritySignsMassEditMode.MainStop: { primaryPrioType = PriorityType.Main; secondaryPrioType = PriorityType.Stop; break; } case PrioritySignsTool.PrioritySignsMassEditMode.YieldMain: { primaryPrioType = PriorityType.Yield; secondaryPrioType = PriorityType.Main; break; } case PrioritySignsTool.PrioritySignsMassEditMode.StopMain: { primaryPrioType = PriorityType.Stop; secondaryPrioType = PriorityType.Main; break; } } IExtSegmentEndManager segEndMan = Constants.ManagerFactory.ExtSegmentEndManager; void ApplyPrioritySigns(ushort segmentId, bool startNode) { ref NetSegment netSegment = ref segmentId.ToSegment(); ushort nodeId = startNode ? netSegment.m_startNode : netSegment.m_endNode; TrafficPriorityManager.Instance.SetPrioritySign( segmentId, startNode, primaryPrioType); ExtSegmentManager extSegmentManager = ExtSegmentManager.Instance; for (int i = 0; i < 8; ++i) { ushort otherSegmentId = nodeId.ToNode().GetSegment(i); if (otherSegmentId == 0 || otherSegmentId == segmentId || segmentList.Contains(otherSegmentId)) { continue; } TrafficPriorityManager.Instance.SetPrioritySign( otherSegmentId, (bool)extSegmentManager.IsStartNode(otherSegmentId, nodeId), secondaryPrioType); } }