public static void drawCityMap() { TLMController controller = TLMController.instance; Dictionary <TransportInfo.TransportType, List <ushort> > linesByType = new Dictionary <TransportInfo.TransportType, List <ushort> >(); foreach (var type in Enum.GetValues(typeof(TransportInfo.TransportType))) { linesByType[(TransportInfo.TransportType)type] = new List <ushort>(); } // List<int> usedX = new List<int> (); // List<int> usedY = new List<int> (); int nextStationId = 1; for (ushort lineId = 0; lineId < controller.tm.m_lines.m_size; lineId++) { TransportLine t = controller.tm.m_lines.m_buffer[(int)lineId]; if (t.m_lineNumber > 0 && (t.m_flags & TransportLine.Flags.Complete) != TransportLine.Flags.None) { linesByType[t.Info.m_transportType].Add(lineId); } } CalculateCoords calc = TLMUtils.gridPosition81Tiles; NetManager nm = NetManager.instance; float invPrecision = 32; //Restart: Dictionary <int, List <int> > positions = new Dictionary <int, List <int> >(); List <Station> stations = new List <Station>(); Dictionary <ushort, MapTransportLine> transportLines = new Dictionary <ushort, MapTransportLine>(); foreach (TransportInfo.TransportType tt in linesByType.Keys) { if (!linesByType.ContainsKey(tt)) { continue; } foreach (ushort lineId in linesByType[tt]) { TransportLine t = controller.tm.m_lines.m_buffer[(int)lineId]; float range = 75f; switch (tt) { case TransportInfo.TransportType.Ship: range = 150f; break; case TransportInfo.TransportType.Metro: case TransportInfo.TransportType.Monorail: case TransportInfo.TransportType.Train: case TransportInfo.TransportType.CableCar: range = 100f; break; } int stopsCount = t.CountStops(lineId); if (stopsCount == 0) { continue; } Color color = t.m_color; Vector2 ultPos = Vector2.zero; t.GetActive(out bool day, out bool night); transportLines[lineId] = new MapTransportLine(color, day, night, lineId); int startStop = 0; int finalStop = stopsCount; for (int j = startStop; j < finalStop; j++) { // Debug.Log ("ULT POS:" + ultPos); ushort nextStop = t.GetStop(j % stopsCount); string name = TLMLineUtils.getStationName(nextStop, lineId, t.Info.m_stationSubService, out ItemClass.Service service, out ItemClass.SubService nil2, out string prefix, out ushort buildingId, out NamingType namingType); Vector3 worldPos = TLMLineUtils.getStationBuildingPosition(nextStop, t.Info.m_stationSubService); Vector2 pos2D = calc(worldPos, invPrecision); Vector2 gridAdd = Vector2.zero; var idx = stations.FirstOrDefault(x => x.stopsWithWorldPos.ContainsKey(nextStop) || x.centralPos == pos2D); if (idx != null) { transportLines[lineId].addStation(ref idx); } else { //if (positions.containskey((int)pos2d.x) && positions[(int)pos2d.x].contains((int)pos2d.y)) //{ // float exp = (float)(math.log(invprecision) / math.log(2)) - 1; // invprecision = (float)math.pow(2, exp); // goto restart; //} Dictionary <ushort, Vector3> nearStops = new Dictionary <ushort, Vector3>(); TLMLineUtils.GetNearStopPoints(worldPos, range, ref nearStops, new ItemClass.SubService[] { ItemClass.SubService.PublicTransportShip, ItemClass.SubService.PublicTransportPlane }, 10); TLMLineUtils.GetNearStopPoints(worldPos, range, ref nearStops, new ItemClass.SubService[] { ItemClass.SubService.PublicTransportTrain, ItemClass.SubService.PublicTransportMonorail, ItemClass.SubService.PublicTransportCableCar, ItemClass.SubService.PublicTransportMetro }, 10); TLMLineUtils.GetNearStopPoints(worldPos, range, ref nearStops, new ItemClass.SubService[] { ItemClass.SubService.PublicTransportTram, ItemClass.SubService.PublicTransportBus }, 10); TLMUtils.doLog("Station: ${0}; nearStops: ${1}", name, string.Join(",", nearStops.Select(x => x.ToString()).ToArray())); Station thisStation = new Station(name, pos2D, worldPos, nearStops, nextStationId++, service, nextStop); stations.Add(thisStation); transportLines[lineId].addStation(ref thisStation); } if (!positions.ContainsKey((int)pos2D.x)) { positions[(int)pos2D.x] = new List <int>(); } positions[(int)pos2D.x].Add((int)pos2D.y); // Debug.Log ("POS:" + pos); ultPos = pos2D; } } } printToSVG(stations, transportLines, Singleton <SimulationManager> .instance.m_metaData.m_CityName + "_" + Singleton <SimulationManager> .instance.m_currentGameTime.ToString("yyyy.MM.dd")); printToJson(stations, transportLines, Singleton <SimulationManager> .instance.m_metaData.m_CityName + "_" + Singleton <SimulationManager> .instance.m_currentGameTime.ToString("yyyy.MM.dd")); }
private float addStationToLinearMap(string stationPrefix, string stationName, Vector3 location, float offsetX, List <ushort> intersections, string airport, string harbor, string taxi, string regionalTrainStation, string cableCarStation, ushort stationNodeId, ItemClass.SubService ss, Color lineColor, bool simple)//, out float intersectionPanelHeight) { ushort lineID = parent.CurrentSelectedId; TransportLine t = TLMController.instance.tm.m_lines.m_buffer[(int)lineID]; TransportManager tm = Singleton <TransportManager> .instance; if (stationName == null) { stationName = "???"; } TLMUtils.createUIElement(out UIButton stationButton, lineStationsPanel.transform); stationButton.relativePosition = new Vector3(offsetX - 13, 15f); stationButton.width = 20; stationButton.height = 20; stationButton.color = lineColor; stationButton.name = "Station [" + stationName + "]"; stationButton.atlas = TLMController.taLineNumber; stationButton.tooltip = stationName + "(id:" + stationNodeId + ")"; TLMUtils.initButton(stationButton, true, "LinearStation"); TLMUtils.createUIElement(out DroppableStationInfo dsi, stationButton.transform); dsi.nodeId = stationNodeId; dsi.name = "DSI Station [" + stationName + "] - " + stationNodeId; TLMUtils.createUIElement(out UITextField stationLabel, stationButton.transform); stationLabel.autoSize = true; stationLabel.width = 220; stationLabel.height = 20; stationLabel.useOutline = true; stationLabel.pivot = UIPivotPoint.MiddleLeft; stationLabel.horizontalAlignment = UIHorizontalAlignment.Left; stationLabel.verticalAlignment = UIVerticalAlignment.Middle; stationLabel.name = "Station [" + stationName + "] Name"; stationLabel.relativePosition = new Vector3(23f, -13f); stationLabel.text = (!string.IsNullOrEmpty(stationPrefix) ? stationPrefix.Trim() + " " : "") + stationName.Trim(); stationLabel.textScale = Math.Max(0.5f, Math.Min(1, 24f / stationLabel.text.Length)); TLMUtils.uiTextFieldDefaults(stationLabel); stationLabel.color = new Color(0.3f, 0.3f, 0.3f, 1); stationLabel.textColor = Color.white; stationLabel.cursorWidth = 2; stationLabel.cursorBlinkTime = 100; stationLabel.eventGotFocus += (x, y) => { stationLabel.text = TLMLineUtils.getStationName(stationNodeId, lineID, ss); }; stationLabel.eventTextSubmitted += (x, y) => { TLMLineUtils.setStopName(y, stationNodeId, lineID, () => { stationLabel.text = TLMLineUtils.getFullStationName(stationNodeId, lineID, ss); m_autoName = TLMLineUtils.calculateAutoName(lineID, true); parent.OnRenameStationAction(autoName); }); }; stationButton.gameObject.transform.localPosition = new Vector3(0, 0, 0); stationButton.gameObject.transform.localEulerAngles = new Vector3(0, 0, 45); stationButton.eventClick += (component, eventParam) => { GameObject gameObject = GameObject.FindGameObjectWithTag("MainCamera"); if (gameObject != null) { var cameraController = gameObject.GetComponent <CameraController>(); InstanceID x = default(InstanceID); x.TransportLine = parent.CurrentSelectedId; cameraController.SetTarget(x, location, false); cameraController.ClearTarget(); } }; if (!simple) { if (!stationOffsetX.ContainsKey(stationNodeId)) { stationOffsetX.Add(stationNodeId, offsetX); } if (showIntersections) { var otherLinesIntersections = TLMLineUtils.SortLines(intersections, t); UILabel distance = null; int intersectionCount = otherLinesIntersections.Count + (airport != string.Empty ? 1 : 0) + (taxi != string.Empty ? 1 : 0) + (harbor != string.Empty ? 1 : 0) + (regionalTrainStation != string.Empty ? 1 : 0) + (cableCarStation != string.Empty ? 1 : 0); if ((TLMSingleton.showDistanceInLinearMap || parent.ForceShowStopsDistances) && offsetX > 0) { NetSegment seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment0]; if (seg.m_endNode != stationNodeId) { seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment1]; } if (seg.m_endNode != stationNodeId) { seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment2]; } if (seg.m_endNode != stationNodeId) { seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment3]; } if (seg.m_endNode != stationNodeId) { seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment4]; } if (seg.m_endNode != stationNodeId) { seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment5]; } if (seg.m_endNode != stationNodeId) { seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment6]; } if (seg.m_endNode != stationNodeId) { seg = Singleton <NetManager> .instance.m_segments.m_buffer[Singleton <NetManager> .instance.m_nodes.m_buffer[stationNodeId].m_segment7]; } if (seg.m_endNode != stationNodeId) { seg = default(NetSegment); } TLMUtils.createUIElement(out UIPanel distContainer, stationButton.transform); distContainer.size = new Vector2(0, 0); distContainer.relativePosition = new Vector3(0, 0, 0); TLMUtils.createUIElement(out distance, distContainer.transform); distance.autoSize = false; distance.useOutline = true; if (seg.Equals(default(NetSegment))) { distance.text = "???"; distance.color = Color.red; } else { distance.text = (int)seg.m_averageLength + "m"; } distance.textScale = 0.7f; distance.textAlignment = UIHorizontalAlignment.Center; distance.verticalAlignment = UIVerticalAlignment.Middle; distance.name = "dist."; distance.font = UIHelperExtension.defaultFontCheckbox; distance.width = 50f; distance.height = 50; distance.relativePosition = new Vector3(-42, 0); distance.transform.localEulerAngles = new Vector3(0, 0, 45); distance.isInteractive = false; } if (intersectionCount > 0) { TLMUtils.createUIElement(out UIPanel intersectionsPanel, stationButton.transform); intersectionsPanel.autoSize = false; intersectionsPanel.autoLayout = false; intersectionsPanel.autoLayoutStart = LayoutStart.TopLeft; intersectionsPanel.autoLayoutDirection = LayoutDirection.Horizontal; intersectionsPanel.relativePosition = new Vector3(-20, 10); intersectionsPanel.wrapLayout = false; intersectionsPanel.autoFitChildrenVertically = true; TLMLineUtils.PrintIntersections(airport, harbor, taxi, regionalTrainStation, cableCarStation, intersectionsPanel, otherLinesIntersections); intersectionsPanel.autoLayout = true; intersectionsPanel.wrapLayout = true; intersectionsPanel.width = 55; // return(42f); } else { TLMUtils.initButton(stationButton, true, "LinearHalfStation"); if (offsetX == 0) { stationButton.relativePosition = new Vector3(offsetX - 13, 15f); return(31f); } else if (distance == null) { stationButton.relativePosition = new Vector3(offsetX - 23, 15f); return(21f); } else { return(42f); } } } else if (showExtraStopInfo) { float normalWidth = 42.5f; NetNode stopNode = Singleton <NetManager> .instance.m_nodes.m_buffer[(int)stationNodeId]; TLMLineUtils.GetQuantityPassengerWaiting(stationNodeId, out int residents, out int tourists, out int ttb); TLMUtils.createUIElement(out UIPanel stationInfoStatsPanel, stationButton.transform); stationInfoStatsPanel.autoSize = false; stationInfoStatsPanel.autoLayout = false; stationInfoStatsPanel.autoFitChildrenVertically = true; stationInfoStatsPanel.autoLayoutStart = LayoutStart.TopLeft; stationInfoStatsPanel.autoLayoutDirection = LayoutDirection.Horizontal; stationInfoStatsPanel.relativePosition = new Vector3(-20, 10); stationInfoStatsPanel.autoLayout = true; stationInfoStatsPanel.wrapLayout = true; stationInfoStatsPanel.width = normalWidth; TLMUtils.createUIElement(out UILabel residentsWaiting, stationInfoStatsPanel.transform); residentsWaiting.autoSize = false; residentsWaiting.useOutline = true; residentsWaiting.text = residents.ToString(); residentsWaiting.tooltipLocaleID = "TLM_RESIDENTS_WAITING"; residentsWaiting.backgroundSprite = "EmptySprite"; residentsWaiting.color = new Color32(0x12, 0x68, 0x34, 255); residentsWaiting.width = normalWidth; residentsWaiting.padding = new RectOffset(0, 0, 4, 2); residentsWaiting.height = 20; residentsWaiting.textScale = 0.7f; residentsWaiting.textAlignment = UIHorizontalAlignment.Center; residentCounters[stationNodeId] = residentsWaiting; TLMUtils.createUIElement(out UILabel touristsWaiting, stationInfoStatsPanel.transform); touristsWaiting.autoSize = false; touristsWaiting.text = tourists.ToString(); touristsWaiting.tooltipLocaleID = "TLM_TOURISTS_WAITING"; touristsWaiting.useOutline = true; touristsWaiting.width = normalWidth; touristsWaiting.height = 20; touristsWaiting.padding = new RectOffset(0, 0, 4, 2); touristsWaiting.textScale = 0.7f; touristsWaiting.backgroundSprite = "EmptySprite"; touristsWaiting.color = new Color32(0x1f, 0x25, 0x68, 255); touristsWaiting.textAlignment = UIHorizontalAlignment.Center; touristCounters[stationNodeId] = touristsWaiting; TLMUtils.createUIElement(out UILabel timeTilBored, stationInfoStatsPanel.transform); timeTilBored.autoSize = false; timeTilBored.text = tourists.ToString(); timeTilBored.tooltipLocaleID = "TLM_TIME_TIL_BORED"; timeTilBored.useOutline = true; timeTilBored.width = normalWidth; timeTilBored.height = 20; timeTilBored.padding = new RectOffset(0, 0, 4, 2); timeTilBored.textScale = 0.7f; timeTilBored.backgroundSprite = "EmptySprite"; timeTilBored.color = new Color32(0x1f, 0x25, 0x68, 255); timeTilBored.textAlignment = UIHorizontalAlignment.Center; ttbTimers[stationNodeId] = timeTilBored; // return(normalWidth); } else { return(30f); } } else { return(30f); } }
Vector3 getStation(ushort lineId, ushort stopId, ItemClass.SubService ss, out string stationName, out List <ushort> linhas, out string airport, out string harbor, out string taxiStand, out string regionalTrainStation, out string cableCarStation, out string prefix) { NetManager nm = Singleton <NetManager> .instance; BuildingManager bm = Singleton <BuildingManager> .instance; NetNode nn = nm.m_nodes.m_buffer[(int)stopId]; stationName = TLMLineUtils.getStationName(stopId, lineId, ss, out ItemClass.Service servFound, out ItemClass.SubService subServFound, out prefix, out ushort buildingId); //paradas proximas (metro e trem) TransportManager tm = Singleton <TransportManager> .instance; TransportInfo thisLineInfo = tm.m_lines.m_buffer[(int)nn.m_transportLine].Info; TransportLine thisLine = tm.m_lines.m_buffer[(int)nn.m_transportLine]; linhas = new List <ushort>(); Vector3 location = nn.m_position; if (buildingId > 0 && ss == subServFound) { location = Singleton <BuildingManager> .instance.m_buildings.m_buffer[buildingId].CalculateSidewalkPosition(); } TLMLineUtils.GetNearLines(location, 120f, ref linhas); airport = String.Empty; taxiStand = String.Empty; harbor = String.Empty; regionalTrainStation = String.Empty; cableCarStation = string.Empty; if (TLMCW.getCurrentConfigBool(TLMCW.ConfigIndex.TRAIN_SHOW_IN_LINEAR_MAP)) { ushort trainStation = TLMUtils.FindBuilding(location != Vector3.zero ? location : nn.m_position, 120f, ItemClass.Service.PublicTransport, ItemClass.SubService.PublicTransportTrain, null, Building.Flags.None, Building.Flags.Untouchable | Building.Flags.Downgrading); if (trainStation > 0) { InstanceID iid = default(InstanceID); iid.Building = trainStation; regionalTrainStation = bm.GetBuildingName(trainStation, iid); } } if (TLMCW.getCurrentConfigBool(TLMCW.ConfigIndex.PLANE_SHOW_IN_LINEAR_MAP)) { ushort airportId = TLMUtils.FindBuilding(location != Vector3.zero ? location : nn.m_position, 120f, ItemClass.Service.PublicTransport, ItemClass.SubService.PublicTransportPlane, new TransferManager.TransferReason[] { TransferManager.TransferReason.PassengerPlane }, Building.Flags.None, Building.Flags.Untouchable); if (airportId > 0) { InstanceID iid = default(InstanceID); iid.Building = airportId; airport = bm.GetBuildingName(airportId, iid); } } if (TLMCW.getCurrentConfigBool(TLMCW.ConfigIndex.SHIP_SHOW_IN_LINEAR_MAP)) { ushort harborId = TLMUtils.FindBuilding(location != Vector3.zero ? location : nn.m_position, 120f, ItemClass.Service.PublicTransport, ItemClass.SubService.PublicTransportShip, new TransferManager.TransferReason[] { TransferManager.TransferReason.PassengerShip }, Building.Flags.None, Building.Flags.Untouchable); if (harborId > 0) { InstanceID iid = default(InstanceID); iid.Building = harborId; harbor = bm.GetBuildingName(harborId, iid); } } if (TLMCW.getCurrentConfigBool(TLMCW.ConfigIndex.TAXI_SHOW_IN_LINEAR_MAP)) { ushort taxiId = TLMUtils.FindBuilding(location != Vector3.zero ? location : nn.m_position, 50f, ItemClass.Service.PublicTransport, ItemClass.SubService.PublicTransportTaxi, null, Building.Flags.None, Building.Flags.Untouchable); if (taxiId > 0) { InstanceID iid = default(InstanceID); iid.Building = taxiId; taxiStand = bm.GetBuildingName(taxiId, iid); } } if (TLMCW.getCurrentConfigBool(TLMCW.ConfigIndex.CABLE_CAR_SHOW_IN_LINEAR_MAP)) { ushort cableCarId = TLMUtils.FindBuilding(location != Vector3.zero ? location : nn.m_position, 120f, ItemClass.Service.PublicTransport, ItemClass.SubService.PublicTransportCableCar, null, Building.Flags.None, Building.Flags.Untouchable); if (cableCarId > 0) { InstanceID iid = default(InstanceID); iid.Building = cableCarId; cableCarStation = bm.GetBuildingName(cableCarId, iid); } } return(location); }
public void OnSetTarget(Type source) { if (source == GetType()) { return; } ushort lineID = GetLineID(); if (lineID != 0) { LineType lineType = GetLineType(lineID); bool isTour = (lineType == LineType.WalkingTour); m_mapModeDropDown.isVisible = !isTour; m_vehiclesLabel.isVisible = !isTour && m_currentMode != MapMode.CONNECTIONS; m_connectionLabel.isVisible = !isTour || m_currentMode == MapMode.CONNECTIONS; if (isTour) { m_currentMode = MapMode.CONNECTIONS; m_stopsLabel.relativePosition = new Vector3(215f, 12f, 0f); m_stopsLineSprite.relativePosition = m_kLineSSpritePositionForWalkingTours; m_actualStopsX = m_kstopsXForWalkingTours; } else { m_stopsLabel.relativePosition = new Vector3(215f, 12f, 0f); m_stopsLineSprite.relativePosition = m_kLineSSpritePosition; m_actualStopsX = m_kstopsX; } m_lineStringLabel.text = TLMLineUtils.GetIconString(lineID); m_stopsLineSprite.color = Singleton <TransportManager> .instance.GetLineColor(lineID); NetManager instance = Singleton <NetManager> .instance; int stopsCount = Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].CountStops(lineID); float[] stopPositions = new float[stopsCount]; m_cachedStopOrder = new ushort[stopsCount]; float minDistance = float.MaxValue; float lineLength = 0f; UIPanel[] stopsButtons = m_stopButtons.SetItemCount(stopsCount); ushort firstStop = Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_stops; ushort currentStop = firstStop; int idx = 0; while (currentStop != 0 && idx < stopsButtons.Length) { stopsButtons[idx].GetComponentInChildren <UIButton>().objectUserData = currentStop; m_cachedStopOrder[idx] = currentStop; UILabel uilabel = stopsButtons[idx].Find <UILabel>("PassengerCount"); uilabel.prefix = TLMLineUtils.getFullStationName(currentStop, lineID, TransportSystemDefinition.GetDefinitionForLine(lineID).SubService); uilabel.text = ""; UILabel dist = stopsButtons[idx].Find <UILabel>("Distance"); dist.text = "(???)"; KlyteMonoUtils.LimitWidth(uilabel, 180, true); CreateConnectionPanel(instance, stopsButtons[idx], currentStop); UIButton button = stopsButtons[idx].GetComponentInChildren <UIButton>(); if (uilabel.objectUserData == null) { UITextField stopNameField = stopsButtons[idx].Find <UITextField>("StopNameField"); uilabel.eventMouseEnter += (c, r) => uilabel.backgroundSprite = "TextFieldPanelHovered"; uilabel.eventMouseLeave += (c, r) => uilabel.backgroundSprite = string.Empty; uilabel.eventClick += (c, r) => { uilabel.Hide(); stopNameField.Show(); stopNameField.text = TLMLineUtils.getStationName((ushort)button.objectUserData, GetLineID(), TransportSystemDefinition.GetDefinitionForLine(GetLineID()).SubService); stopNameField.Focus(); }; stopNameField.eventLeaveFocus += delegate(UIComponent c, UIFocusEventParameter r) { stopNameField.Hide(); uilabel.Show(); }; stopNameField.eventTextSubmitted += (x, y) => TLMLineUtils.setStopName(y.Trim(), (ushort)button.objectUserData, GetLineID(), () => uilabel.prefix = $"<color white>{TLMLineUtils.getFullStationName((ushort)button.GetComponentInChildren<UIButton>().objectUserData, GetLineID(), TransportSystemDefinition.GetDefinitionForLine(GetLineID()).SubService)}</color>"); uilabel.objectUserData = true; } for (int i = 0; i < 8; i++) { ushort segmentId = instance.m_nodes.m_buffer[currentStop].GetSegment(i); if (segmentId != 0 && instance.m_segments.m_buffer[segmentId].m_startNode == currentStop) { currentStop = instance.m_segments.m_buffer[segmentId].m_endNode; dist.text = (instance.m_segments.m_buffer[segmentId].m_averageLength).ToString("0"); float segmentSize = m_unscaledMode ? m_kminStopDistance : instance.m_segments.m_buffer[segmentId].m_averageLength; if (segmentSize == 0f) { CODebugBase <LogChannel> .Error(LogChannel.Core, "Two transport line stops have zero distance"); segmentSize = 100f; } stopPositions[idx] = segmentSize; if (segmentSize < minDistance) { minDistance = segmentSize; } lineLength += stopPositions[idx]; break; } } if (stopsCount > 2 && currentStop == firstStop) { break; } if (stopsCount == 2 && idx > 0) { break; } if (stopsCount == 1) { break; } if (++idx >= 32768) { CODebugBase <LogChannel> .Error(LogChannel.Core, "Invalid list detected!\n" + Environment.StackTrace); break; } } float stopDistanceFactor = m_kminStopDistance / minDistance; m_uILineLength = stopDistanceFactor * lineLength; if (m_uILineLength < m_kminUILineLength) { m_uILineLength = m_kminUILineLength; stopDistanceFactor = m_uILineLength / lineLength; } else if (m_uILineLength > m_kmaxUILineLength) { m_uILineLength = m_kmaxUILineLength; stopDistanceFactor = m_uILineLength / lineLength; } if (stopsCount <= 2) { m_uILineOffset = (stopDistanceFactor * stopPositions[stopPositions.Length - 1]) - 30f; } if (m_uILineOffset < 20f || stopsCount > 2) { m_uILineOffset = stopDistanceFactor * stopPositions[stopPositions.Length - 1] / 2f; } m_uILineLength += 20; m_stopsLineSprite.height = m_uILineLength; m_stopsContainer.height = m_uILineLength + m_kvehicleButtonHeight; Vector3 relativePosition = m_lineEnd.relativePosition; relativePosition.y = m_uILineLength + 13f; relativePosition.x = m_stopsLineSprite.relativePosition.x + 4f; m_lineEnd.relativePosition = relativePosition; float num8 = 0f; for (int j = 0; j < stopsCount; j++) { Vector3 relativePosition2 = m_stopButtons.items[j].relativePosition; relativePosition2.x = m_actualStopsX; relativePosition2.y = ShiftVerticalPosition(num8); m_stopButtons.items[j].relativePosition = relativePosition2; num8 += stopPositions[j] * stopDistanceFactor; } RefreshVehicleButtons(lineID); if ((Singleton <TransportManager> .instance.m_lines.m_buffer[lineID].m_flags & TransportLine.Flags.Complete) != TransportLine.Flags.None) { m_labelLineIncomplete.isVisible = false; m_stopsContainer.isVisible = true; } else { m_labelLineIncomplete.isVisible = true; m_stopsContainer.isVisible = false; } } }