public override void Paste(InstanceID targetInstanceID, object record, Dictionary <InstanceID, InstanceID> sourceMap) { if (targetInstanceID.Type == InstanceType.NetNode) { ushort nodeID = targetInstanceID.NetNode; var map = new Dictionary <ObjectId, ObjectId>(); foreach (var source in sourceMap) { if (source.Key.Type == InstanceType.NetSegment && source.Value.Type == InstanceType.NetSegment) { map.Add(new ObjectId() { Segment = source.Key.NetSegment }, new ObjectId() { Segment = source.Value.NetSegment }); } } if (record is XElement config) { var markup = MarkupManager.Get(nodeID); markup.FromXml(Mod.Version, config, map); } } }
private void OnSelectNode() { SelectNodeId = HoverNodeId; EditMarkup = MarkupManager.Get(SelectNodeId); ToolMode = Mode.ConnectLine; Panel.SetNode(SelectNodeId); }
public void SetNode(ushort nodeId) { Show(); Caption.text = string.Format(NodeMarkup.Localize.Panel_Caption, nodeId); Markup = MarkupManager.Get(nodeId); TabStrip.selectedIndex = -1; TabStrip.selectedIndex = 0; }
private void Paste(InstanceID targetInstanceID, object record, bool isMirror, Dictionary <InstanceID, InstanceID> sourceMap, Action <Markup, ObjectsMap, Dictionary <InstanceID, InstanceID> > mapFiller) { if (targetInstanceID.Type != InstanceType.NetNode || !(record is XElement config)) { return; } ushort nodeID = targetInstanceID.NetNode; var map = new ObjectsMap(isMirror); var markup = MarkupManager.Get(nodeID); mapFiller(markup, map, sourceMap); markup.FromXml(Mod.Version, config, map); }
public override void OnPrimaryMouseClicked(Event e) { if (IsHoverNode) { var markup = MarkupManager.Get(HoverNodeId); Tool.SetMarkup(markup); if (markup.NeedSetOrder) { var messageBox = MessageBoxBase.ShowModal <YesNoMessageBox>(); messageBox.CaprionText = Localize.Tool_RoadsWasChangedCaption; messageBox.MessageText = Localize.Tool_RoadsWasChangedMessage; messageBox.OnButton1Click = OnYes; messageBox.OnButton2Click = OnNo; } else { OnNo(); } bool OnYes() { BaseOrderToolMode.IntersectionTemplate = markup.Backup; Tool.SetMode(ToolModeType.EditEntersOrder); markup.NeedSetOrder = false; return(true); } bool OnNo() { Tool.SetDefaultMode(); markup.NeedSetOrder = false; return(true); } } }
private void Info() { var position = GetInfoPosition(); if (!UI.Settings.ShowToolTip || (Panel.isVisible && new Rect(Panel.relativePosition, Panel.size).Contains(position))) { cursorInfoLabel.isVisible = false; return; } switch (ToolMode) { case Mode.SelectNode when IsHoverNode: ShowToolInfo(string.Format(Localize.Tool_InfoHoverNode, HoverNodeId), position); break; case Mode.SelectNode: ShowToolInfo(Localize.Tool_InfoNode, position); break; case Mode.ConnectLine when IsSelectPoint && IsHoverPoint: var markup = MarkupManager.Get(SelectNodeId); var pointPair = new MarkupPointPair(SelectPoint, HoverPoint); if (markup.ExistConnection(pointPair)) { ShowToolInfo(pointPair.IsSomeEnter ? Localize.Tool_InfoDeleteStopLine : Localize.Tool_InfoDeleteLine, position); } else { ShowToolInfo(pointPair.IsSomeEnter ? Localize.Tool_InfoCreateStopLine : Localize.Tool_InfoCreateLine, position); } break; case Mode.ConnectLine when IsSelectPoint: ShowToolInfo(Localize.Tool_InfoSelectEndPoint, position); break; case Mode.ConnectLine: ShowToolInfo(Localize.Tool_InfoSelectStartPoint, position); break; case Mode.PanelAction when Panel.GetInfo() is string panelInfo && !string.IsNullOrEmpty(panelInfo): ShowToolInfo(panelInfo, position); break; case Mode.SelectFiller when IsHoverFillerPoint && TempFiller.IsEmpty: ShowToolInfo(Localize.Tool_InfoFillerClickStart, position); break; case Mode.SelectFiller when IsHoverFillerPoint && HoverFillerPoint == TempFiller.First: ShowToolInfo(Localize.Tool_InfoFillerClickEnd, position); break; case Mode.SelectFiller when IsHoverFillerPoint: ShowToolInfo(Localize.Tool_InfoFillerClickNext, position); break; case Mode.SelectFiller when TempFiller.IsEmpty: ShowToolInfo(Localize.Tool_InfoFillerSelectStart, position); break; case Mode.SelectFiller: ShowToolInfo(Localize.Tool_InfoFillerSelectNext, position); break; default: cursorInfoLabel.isVisible = false; break; } }