public static void OverrideStart(PublicTransportWorldInfoPanel __instance) { m_obj.origInstance = __instance; __instance.component.width = 800; BindComponents(__instance); SetNameFieldProperties(); KlyteMonoUtils.CreateTabsComponent(out m_obj.m_lineConfigTabs, out _, __instance.transform, "LineConfig", new Vector4(15, 45, 365, 30), new Vector4(15, 80, 380, 445)); m_obj.m_childControls.Add("Default", TabCommons.CreateTab <UVMMainWIPTab>(m_obj.m_lineConfigTabs, "ThumbStatistics", "K45_TLM_WIP_STATS_TAB", "Default", false)); m_obj.m_childControls.Add("Reports", TabCommons.CreateTab <TLMReportsTab>(m_obj.m_lineConfigTabs, "IconMessage", "K45_TLM_WIP_REPORT_TAB", "Reports", false)); m_obj.m_childControls.Add("Budget", TabCommons.CreateTab <UVMBudgetConfigTab>(m_obj.m_lineConfigTabs, "InfoPanelIconCurrency", "K45_TLM_WIP_BUDGET_CONFIGURATION_TAB", "Budget", false)); m_obj.m_childControls.Add("Ticket", TabCommons.CreateTab <TLMTicketConfigTab>(m_obj.m_lineConfigTabs, "FootballTicketIcon", "K45_TLM_WIP_TICKET_CONFIGURATION_TAB", "Ticket", false)); m_obj.m_childControls.Add("AssetSelection", TabCommons.CreateTab <TLMAssetSelectorTab>(m_obj.m_lineConfigTabs, "IconPolicyFreePublicTransport", "K45_TLM_WIP_ASSET_SELECTION_TAB", "AssetSelection", false)); m_obj.m_childControls.Add("DepotSelection", TabCommons.CreateTab <TLMDepotSelectorTab>(m_obj.m_lineConfigTabs, "UIFilterBigBuildings", "K45_TLM_WIP_DEPOT_SELECTION_TAB", "DepotSelection", false)); m_obj.m_childControls.Add("PrefixConfig", TabCommons.CreateTab <TLMPrefixOptionsTab>(m_obj.m_lineConfigTabs, "InfoIconLevel", "K45_TLM_WIP_PREFIX_CONFIG_TAB", "PrefixConfig", false)); m_obj.m_childControls.Add("StopsPanel", __instance.Find <UIPanel>("StopsPanel").parent.gameObject.AddComponent <UVMTransportLineLinearMap>()); DestroyNotUsed(__instance); m_obj.m_specificConfig = UIHelperExtension.AddCheckboxLocale(__instance.component, "K45_TLM_USE_SPECIFIC_CONFIG", false, (x) => { TLMTransportLineExtension.Instance.SetUseCustomConfig(GetLineID(), x); MarkDirty(typeof(UVMPublicTransportWorldInfoPanel)); }); m_obj.m_specificConfig.relativePosition = new Vector3(10, 530); m_obj.m_specificConfig.isInteractive = false; KlyteMonoUtils.LimitWidthAndBox(m_obj.m_specificConfig.label, 400); }
public void Show(Vector3 worldMousePosition, InstanceID instanceID) { this.m_WorldMousePosition = worldMousePosition; this.m_InstanceID = instanceID; if (InstanceManager.IsValid(this.m_InstanceID)) { WorldInfoPanel.HideAllWorldInfoPanels(); NetManager instance = Singleton <NetManager> .instance; ushort transportLine = instance.m_nodes.m_buffer[(int)this.m_InstanceID.NetNode].m_transportLine; this.m_VehicleType.spriteName = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(Singleton <TransportManager> .instance.m_lines.m_buffer[(int)transportLine].Info.m_transportType); this.m_StopIndex = TransportLineMod.GetStopIndex(transportLine, this.m_InstanceID.NetNode); this.m_StopName.text = Singleton <InstanceManager> .instance.GetName(this.m_InstanceID) ?? string.Format(Localization.Get("STOP_LIST_BOX_ROW_STOP"), (object)(this.m_StopIndex + 1)); this.m_SuggestedNames.ClearItems(); this.m_SuggestedNames.AddItems(this.FindBuildings(instance.m_nodes.m_buffer[(int)this.m_InstanceID.NetNode].m_position), new Func <ushort, string>(this.IDToName)); this.m_Line.text = Singleton <TransportManager> .instance.GetLineName(transportLine); this.Show(); this.LateUpdate(); } else { this.Hide(); } }
public void Awake() { m_bg = component as UIScrollablePanel; PublicTransportWorldInfoPanel ptwip = UVMPublicTransportWorldInfoPanel.m_obj.origInstance; AddNewStopTemplate(); ptwip.component.width = 800; BindComponents(ptwip); AdjustLineStopsPanel(ptwip); KlyteMonoUtils.CreateUIElement(out m_panelModeSelector, m_bg.parent.transform); m_panelModeSelector.autoFitChildrenHorizontally = true; m_panelModeSelector.autoFitChildrenVertically = true; m_panelModeSelector.autoLayout = true; m_panelModeSelector.autoLayoutDirection = LayoutDirection.Horizontal; m_mapModeDropDown = UIHelperExtension.CloneBasicDropDownNoLabel(Enum.GetNames(typeof(MapMode)).Select(x => Locale.Get("K45_TLM_LINEAR_MAP_VIEW_MODE", x)).ToArray(), (int idx) => { m_currentMode = (MapMode)idx; RefreshVehicleButtons(GetLineID()); }, m_panelModeSelector); m_mapModeDropDown.textScale = 0.75f; m_mapModeDropDown.size = new Vector2(200, 25); m_mapModeDropDown.itemHeight = 16; UICheckBox unscaledCheck = UIHelperExtension.AddCheckboxLocale(m_panelModeSelector, "K45_TLM_LINEAR_MAP_SHOW_UNSCALED", m_unscaledMode, (val) => m_unscaledMode = val); KlyteMonoUtils.LimitWidthAndBox(unscaledCheck.label, 165); InstanceManagerOverrides.EventOnBuildingRenamed += (x) => m_dirtyNames = true; }
protected override void Handle(TransportLineChangeSliderCommand command) { IgnoreHelper.StartIgnore(); TransportLine[] lines = TransportManager.instance.m_lines.m_buffer; if (command.IsTicketPrice) { lines[command.LineId].m_ticketPrice = (ushort)command.Value; } else { lines[command.LineId].m_budget = (ushort)command.Value; } // Update info panel if open: PublicTransportWorldInfoPanel panel = UIView.library.Get <PublicTransportWorldInfoPanel>(typeof(PublicTransportWorldInfoPanel).Name); ushort lineId = ReflectionHelper.Call <ushort>(panel, "GetLineID"); if (lineId == command.LineId) { UISlider slider = ReflectionHelper.GetAttr <UISlider>(panel, command.IsTicketPrice ? "m_ticketPriceSlider" : "m_vehicleCountModifier"); if (slider != null) { SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(() => { slider.value = command.Value; }); } } IgnoreHelper.EndIgnore(); }
public void Awake() { m_bg = component as UIPanel; m_bg.autoLayout = false; PublicTransportWorldInfoPanel ptwip = UVMPublicTransportWorldInfoPanel.m_obj.origInstance; BindFields(ptwip); m_lineColorContainer.relativePosition = new Vector3(170, 10); m_lineLengthLabel.relativePosition = new Vector3(10, 45); m_passengersContainer.relativePosition = new Vector3(10, 70); m_ageChartContainer.relativePosition = new Vector3(10, 90); m_tripSavedContainer.relativePosition = new Vector3(10, 220); m_pullValuePanel.relativePosition = new Vector3(10, 220); SetColorPickerEvents(); SetColorButtonEvents(); SetLegendColors(ptwip); SetDemographicGraphicColors(ptwip); CreatePrefixAndLineNumberEditor(); CreateFirstStopSelector(); CreateActionButtonsRow(); }
public void openDepotInfo(ushort buildingID) { isLoading = true; WorldInfoPanel.HideAllWorldInfoPanels(); m_buildingIdSelecionado = default(InstanceID); m_buildingIdSelecionado.Building = buildingID; DepotAI depotAI = Singleton <BuildingManager> .instance.m_buildings.m_buffer[buildingID].Info.GetAI() as DepotAI; if (depotAI == null) { return; } depotNameField.text = Singleton <BuildingManager> .instance.GetBuildingName(buildingID, default(InstanceID)); lineTransportIconTypeLabel.relativePosition = new Vector3(10f, 12f); lineTransportIconTypeLabel.height = 20; lineTransportIconTypeLabel.backgroundSprite = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(depotAI.m_transportInfo.m_transportType); Show(); m_controller.defaultListingLinesPanel.Hide(); updateCheckboxes(); isLoading = false; }
private static void BindComponents(PublicTransportWorldInfoPanel __instance) { //PARENT m_obj.m_nameField = __instance.Find <UITextField>("LineName"); m_obj.m_vehicleType = __instance.Find <UISprite>("VehicleType"); m_obj.m_vehicleType.size = new Vector2(32, 22); }
private void SetLegendColors(PublicTransportWorldInfoPanel __instance) { m_childLegend.color = __instance.m_ChildColor; m_teenLegend.color = __instance.m_TeenColor; m_youngLegend.color = __instance.m_YoungColor; m_adultLegend.color = __instance.m_AdultColor; m_seniorLegend.color = __instance.m_SeniorColor; }
private void initNearLinesOnWorldInfoPanel() { if (!initializedWIP) { UIPanel parent = GameObject.Find("UIView").transform.GetComponentInChildren <CityServiceWorldInfoPanel>().gameObject.GetComponent <UIPanel>(); if (parent == null) { return; } parent.eventVisibilityChanged += (component, value) => { updateNearLines(TransportLinesManagerMod.savedShowNearLinesInCityServicesWorldInfoPanel.value ? parent : null, true); updateDepotEditShortcutButton(parent); }; parent.eventPositionChanged += (component, value) => { updateNearLines(TransportLinesManagerMod.savedShowNearLinesInCityServicesWorldInfoPanel.value ? parent : null, true); updateDepotEditShortcutButton(parent); }; UIPanel parent2 = GameObject.Find("UIView").transform.GetComponentInChildren <ZonedBuildingWorldInfoPanel>().gameObject.GetComponent <UIPanel>(); if (parent2 == null) { return; } parent2.eventVisibilityChanged += (component, value) => { updateNearLines(TransportLinesManagerMod.savedShowNearLinesInZonedBuildingWorldInfoPanel.value ? parent2 : null, true); updateDepotEditShortcutButton(parent2); }; parent2.eventPositionChanged += (component, value) => { updateNearLines(TransportLinesManagerMod.savedShowNearLinesInZonedBuildingWorldInfoPanel.value ? parent2 : null, true); updateDepotEditShortcutButton(parent2); }; UIPanel parent3 = GameObject.Find("UIView").transform.GetComponentInChildren <PublicTransportWorldInfoPanel>().gameObject.GetComponent <UIPanel>(); if (parent3 == null) { return; } parent3.eventVisibilityChanged += (component, value) => { if (TransportLinesManagerMod.overrideWorldInfoPanelLine && value) { PublicTransportWorldInfoPanel ptwip = parent3.gameObject.GetComponent <PublicTransportWorldInfoPanel>(); ptwip.StartCoroutine(OpenLineInfo(ptwip)); ptwip.Hide(); } }; initializedWIP = true; } }
public void openDepotInfo(ushort buildingID, bool secondary) { isLoading = true; WorldInfoPanel.HideAllWorldInfoPanels(); m_buildingIdSelecionado = default(InstanceID); m_buildingIdSelecionado.Building = buildingID; DepotAI depotAI = Singleton <BuildingManager> .instance.m_buildings.m_buffer[buildingID].Info.GetAI() as DepotAI; if (depotAI == null) { return; } depotNameField.text = Singleton <BuildingManager> .instance.GetBuildingName(buildingID, default(InstanceID)); bool hasPrimary = depotAI.m_transportInfo != null && depotAI.m_maxVehicleCount > 0; bool hasSecondary = depotAI.m_secondaryTransportInfo != null && depotAI.m_maxVehicleCount2 > 0; if (!hasPrimary && !hasSecondary) { closeDepotInfo(null, null); return; } m_secondary = !hasPrimary || (secondary && hasSecondary); TransportInfo currentTransportInfo = m_secondary ? depotAI.m_secondaryTransportInfo : depotAI.m_transportInfo; TransportInfo otherInfo = !m_secondary && depotAI.m_secondaryTransportInfo != null ? depotAI.m_secondaryTransportInfo : depotAI.m_transportInfo; var tsd = TransportSystemDefinition.from(currentTransportInfo); depotInfoPanel.color = Color.Lerp(TLMCW.getColorForTransportType(tsd.toConfigIndex()), Color.white, 0.5f); lineTransportIconTypeLabel.relativePosition = new Vector3(10f, 12f); lineTransportIconTypeLabel.height = 20; lineTransportIconTypeLabel.normalBgSprite = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(currentTransportInfo.m_transportType); lineTransportIconTypeLabel.disabledBgSprite = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(currentTransportInfo.m_transportType); lineTransportIconTypeLabel.focusedBgSprite = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(currentTransportInfo.m_transportType); lineTransportIconTypeLabel.hoveredBgSprite = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(otherInfo.m_transportType); if (depotAI.m_secondaryTransportInfo != null) { lineTransportIconTypeLabel.tooltip = string.Format(Locale.Get("TLM_SEE_OTHER_DEPOT"), TLMConfigWarehouse.getNameForTransportType(TransportSystemDefinition.from(otherInfo).toConfigIndex())); } else { lineTransportIconTypeLabel.tooltip = ""; } Show(); m_controller.defaultListingLinesPanel.Hide(); updateCheckboxes(); isLoading = false; }
public override void Awake() { base.Awake(); Description = AddUIComponent <UILabel>(); ColorField = GameObject.Instantiate(PublicTransportWorldInfoPanel.FindObjectOfType <UIColorField>().gameObject).GetComponent <UIColorField>();//AddUIComponent<UIColorField>(); this.AttachUIComponent(ColorField.gameObject); this.height = 40; this.width = 400; }
private IEnumerator OpenLineInfo(PublicTransportWorldInfoPanel ptwip) { yield return(0); ushort lineId = 0; while (lineId == 0) { lineId = (ushort)(typeof(PublicTransportWorldInfoPanel).GetMethod("GetLineID", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).Invoke(ptwip, new object[0])); } TLMController.instance.lineInfoPanel.openLineInfo(lineId); }
private void CreateTabButton(TransportInfo.TransportType transportType) { UIPanel uiPanel = this._containerPanel.AddUIComponent <UIPanel>(); uiPanel.transform.localPosition = Vector3.zero; double num1 = 70.0; uiPanel.width = (float)num1; double num2 = 30.0; uiPanel.height = (float)num2; int num3 = 0; uiPanel.autoLayoutDirection = (LayoutDirection)num3; int num4 = 0; uiPanel.autoLayoutStart = (LayoutStart)num4; RectOffset rectOffset = new RectOffset(8, 0, 4, 4); uiPanel.autoLayoutPadding = rectOffset; int num5 = 1; uiPanel.autoLayout = num5 != 0; Color32 transportColor = (Color32)Singleton <TransportManager> .instance.m_properties.m_transportColors[(int)transportType]; uiPanel.color = transportColor; string str1 = "InfoviewPanel"; uiPanel.backgroundSprite = str1; string vehicleTypeIcon = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(transportType); UIButton uiButton = uiPanel.AddUIComponent <UIButton>(); double num6 = 32.0; uiButton.width = (float)num6; double num7 = 22.0; uiButton.height = (float)num7; string str2 = vehicleTypeIcon; uiButton.normalBgSprite = str2; string str3 = vehicleTypeIcon + "Focused"; uiButton.hoveredBgSprite = str3; Vector3 vector3 = new Vector3(278f, 4f); uiButton.relativePosition = vector3; MouseEventHandler mouseEventHandler = (MouseEventHandler)((c, p) => this.SetTransportType(transportType, (VehicleInfo)null)); uiButton.eventClick += mouseEventHandler; }
private void initNearLinesOnWorldInfoPanel() { if (!initializedWIP) { BuildingWorldInfoPanel[] panelList = GameObject.Find("UIView").GetComponentsInChildren <BuildingWorldInfoPanel>(); TLMUtils.doLog("WIP LIST: [{0}]", string.Join(", ", panelList.Select(x => x.name).ToArray())); foreach (BuildingWorldInfoPanel wip in panelList) { TLMUtils.doLog("LOADING WIP HOOK FOR: {0}", wip.name); UIComponent parent2 = wip.GetComponent <UIComponent>(); if (parent2 == null) { continue; } parent2.eventVisibilityChanged += (component, value) => { updateNearLines(TLMSingleton.savedShowNearLinesInZonedBuildingWorldInfoPanel.value ? parent2 : null, true); updateDepotEditShortcutButton(parent2); }; parent2.eventPositionChanged += (component, value) => { updateNearLines(TLMSingleton.savedShowNearLinesInZonedBuildingWorldInfoPanel.value ? parent2 : null, true); updateDepotEditShortcutButton(parent2); }; UIPanel parent3 = GameObject.Find("UIView").transform.GetComponentInChildren <PublicTransportWorldInfoPanel>().gameObject.GetComponent <UIPanel>(); if (parent3 == null) { return; } parent3.eventVisibilityChanged += (component, value) => { if (TLMSingleton.overrideWorldInfoPanelLine && value) { PublicTransportWorldInfoPanel ptwip = parent3.gameObject.GetComponent <PublicTransportWorldInfoPanel>(); ptwip.StartCoroutine(OpenLineInfo(ptwip)); ptwip.Hide(); } }; } initializedWIP = true; } }
private static void DestroyNotUsed(PublicTransportWorldInfoPanel __instance) { FakeDestroy(__instance.Find("ActivityPanel")); FakeDestroy(__instance.Find <UIPanel>("LineModelSelectorContainer")); FakeDestroy(__instance.Find <UILabel>("ModelLabel")); FakeDestroy(__instance.Find <UILabel>("LabelPassengers")); FakeDestroy(__instance.Find <UISlider>("SliderModifyVehicleCount")); FakeDestroy(__instance.Find <UILabel>("VehicleCountPercent")); FakeDestroy(__instance.Find <UILabel>("VehicleAmount")); FakeDestroy(__instance.Find <UIPanel>("PanelVehicleCount")); FakeDestroy(__instance.Find <UISlider>("SliderTicketPrice")); FakeDestroy(__instance.Find <UILabel>("LabelTicketPrice")); FakeDestroy(__instance.Find <UIPanel>("TicketPriceSection")); }
private void BindFields(PublicTransportWorldInfoPanel ptwip) { LogUtils.DoLog("COLOR"); UIComponent parentToDestroy = ptwip.Find <UILabel>("Color").parent.parent; m_lineColorContainer = RebindUI(ptwip.Find <UILabel>("Color").parent); m_colorField = component.Find <UIColorField>("ColorField"); m_colorFieldButton = m_colorField.Find <UIButton>("Button"); LogUtils.DoLog("CHART"); m_ageChart = (ptwip.Find <UIRadialChart>("AgeChart")); m_childLegend = (ptwip.Find <UILabel>("ChildAmount")); m_teenLegend = (ptwip.Find <UILabel>("TeenAmount")); m_youngLegend = (ptwip.Find <UILabel>("YoungAmount")); m_adultLegend = (ptwip.Find <UILabel>("AdultAmount")); m_seniorLegend = (ptwip.Find <UILabel>("SeniorAmount")); UIComponent parentToDestroy2 = m_ageChart.parent.parent; m_ageChartContainer = RebindUI(m_ageChart.parent); LogUtils.DoLog("TRIP"); m_tripSaved = (ptwip.Find <UILabel>("TripSaved")); m_tripSavedContainer = RebindUI(m_tripSaved.parent); LogUtils.DoLog("TYPE"); m_type = (ptwip.Find <UILabel>("Type")); m_typeContainer = RebindUI(m_type.parent); LogUtils.DoLog("PASSENGERS"); m_passengers = (ptwip.Find <UILabel>("Passengers")); m_passengersContainer = RebindUI(m_passengers.parent); LogUtils.DoLog("LENGTH"); m_lineLengthLabel = RebindUI(ptwip.Find <UILabel>("LineLengthLabel")); LogUtils.DoLog("WALKING"); m_pullValuePanel = RebindUI(ptwip.Find <UIPanel>("WalkingTourPullValuePanel")); m_pullValue = (component.Find <UILabel>("PullValue")); m_warningTooLongText = (component.Find <UILabel>("WarningTooLongText")); m_warningTooLongIcon = (component.Find <UISprite>("WarningTooLongIcon")); LogUtils.DoLog("DESTROY"); UVMPublicTransportWorldInfoPanel.FakeDestroy(parentToDestroy); UVMPublicTransportWorldInfoPanel.FakeDestroy(parentToDestroy2); }
private void OnMouseDown(UIComponent component, UIMouseEventParameter eventParam) { ushort objectUserData = (ushort)(component as UIButton).objectUserData; InstanceID empty = InstanceID.Empty; empty.Vehicle = objectUserData; Vector3 position; Quaternion rotation; Vector3 size; InstanceManager.GetPosition(empty, out position, out rotation, out size); if ((Object)PublicTransportVehicleButton.cameraController != (Object)null) { //begin mod: zoom on shift pressed PublicTransportVehicleButton.cameraController.SetTarget(empty, position, Input.GetKey(KeyCode.LeftShift) | Input.GetKey(KeyCode.RightShift)); //end mod } PublicTransportWorldInfoPanel.ResetScrollPosition(); UIView.SetFocus((UIComponent)null); }
public string GetTransportTypeIcon() { return(TransportType switch { TransportInfo.TransportType.EvacuationBus => "SubBarFireDepartmentDisaster", TransportInfo.TransportType.Pedestrian => "SubBarPublicTransportWalkingTours", TransportInfo.TransportType.TouristBus => "SubBarPublicTransportTours", TransportInfo.TransportType.HotAirBalloon => "IconBalloonTours", TransportInfo.TransportType.Post => "SubBarPublicTransportPost", TransportInfo.TransportType.CableCar => PublicTransportWorldInfoPanel.GetVehicleTypeIcon(TransportInfo.TransportType.EvacuationBus), //case TransportInfo.TransportType.Ship: //case TransportInfo.TransportType.Airplane: //case TransportInfo.TransportType.Bus: //case TransportInfo.TransportType.Metro: //case TransportInfo.TransportType.Train: //case TransportInfo.TransportType.Taxi: //case TransportInfo.TransportType.Tram: //case TransportInfo.TransportType.Monorail: _ => PublicTransportWorldInfoPanel.GetVehicleTypeIcon(TransportType), });
private void OnMouseDown(UIComponent component, UIMouseEventParameter eventParam) { ushort objectUserData = (ushort)(component as UIButton).objectUserData; Vector3 position = Singleton <NetManager> .instance.m_nodes.m_buffer[(int)objectUserData].m_position; InstanceID empty = InstanceID.Empty; empty.NetNode = objectUserData; if ((Object)PublicTransportStopButton.cameraController != (Object)null) { //begin mod: zoom on shift pressed ToolsModifierControl.cameraController.SetTarget(empty, position, Input.GetKey(KeyCode.LeftShift) | Input.GetKey(KeyCode.RightShift)); } //end mod PublicTransportWorldInfoPanel.ResetScrollPosition(); UIView.SetFocus((UIComponent)null); //begin mod: show PublicTransportStopWorldInfoPanel PublicTransportStopWorldInfoPanel.instance.Show(position, empty); //end mod }
public static void Prefix(float value, PublicTransportWorldInfoPanel __instance) { if (IgnoreHelper.IsIgnored()) { return; } ushort lineId = ReflectionHelper.Call <ushort>(__instance, "GetLineID"); if ((ushort)value == TransportManager.instance.m_lines.m_buffer[lineId].m_ticketPrice) { return; } Command.SendToAll(new TransportLineChangeSliderCommand() { LineId = lineId, Value = value, IsTicketPrice = true }); }
private void BindComponents(PublicTransportWorldInfoPanel __instance) { //STOPS m_stopsContainer = __instance.Find <UIPanel>("StopsPanel"); m_stopButtons = new UITemplateList <UIPanel>(m_stopsContainer, "StopButtonPanel"); m_vehicleButtons = new UITemplateList <UIButton>(m_stopsContainer, "VehicleButton"); m_stopsLineSprite = __instance.Find <UISprite>("StopsLineSprite"); m_lineEnd = __instance.Find <UISprite>("LineEnd"); m_stopsLabel = __instance.Find <UILabel>("StopsLabel"); m_vehiclesLabel = __instance.Find <UILabel>("VehiclesLabel"); m_labelLineIncomplete = __instance.Find <UILabel>("LabelLineIncomplete"); UISprite lineStart = __instance.Find <UISprite>("LineStart"); lineStart.relativePosition = new Vector3(4, -8); m_vehiclesLabel.relativePosition = new Vector3(100, 12); m_stopsLineSprite.spriteName = "PlainWhite"; m_stopsLineSprite.width = 25; m_connectionLabel = Instantiate(m_vehiclesLabel); m_connectionLabel.transform.SetParent(m_vehiclesLabel.transform.parent); m_connectionLabel.absolutePosition = m_vehiclesLabel.absolutePosition; m_connectionLabel.localeID = "K45_TLM_CONNECTIONS"; m_lineStringLabel = Instantiate(m_vehiclesLabel); m_lineStringLabel.transform.SetParent(m_vehiclesLabel.transform.parent); m_lineStringLabel.autoSize = false; m_lineStringLabel.size = new Vector2(36, 36); m_lineStringLabel.name = "LineStringLabel"; m_lineStringLabel.isLocalized = false; m_lineStringLabel.text = "<k45Symbol K45_TriangleIcon,FF8822,36>"; m_lineStringLabel.textScale = 1; m_lineStringLabel.processMarkup = true; m_lineStringLabel.relativePosition = new Vector3(168, 10); }
private void SetDemographicGraphicColors(PublicTransportWorldInfoPanel __instance) { UIRadialChart.SliceSettings slice = m_ageChart.GetSlice(0); Color32 color = __instance.m_ChildColor; m_ageChart.GetSlice(0).outterColor = color; slice.innerColor = color; UIRadialChart.SliceSettings slice2 = m_ageChart.GetSlice(1); color = __instance.m_TeenColor; m_ageChart.GetSlice(1).outterColor = color; slice2.innerColor = color; UIRadialChart.SliceSettings slice3 = m_ageChart.GetSlice(2); color = __instance.m_YoungColor; m_ageChart.GetSlice(2).outterColor = color; slice3.innerColor = color; UIRadialChart.SliceSettings slice4 = m_ageChart.GetSlice(3); color = __instance.m_AdultColor; m_ageChart.GetSlice(3).outterColor = color; slice4.innerColor = color; UIRadialChart.SliceSettings slice5 = m_ageChart.GetSlice(4); color = __instance.m_SeniorColor; m_ageChart.GetSlice(4).outterColor = color; slice5.innerColor = color; }
public String getTransportTypeIcon() { return(PublicTransportWorldInfoPanel.GetVehicleTypeIcon(transportType)); }
private void AdjustLineStopsPanel(PublicTransportWorldInfoPanel __instance) { m_scrollPanel = __instance.Find <UIScrollablePanel>("ScrollablePanel"); m_scrollPanel.eventGotFocus += OnGotFocusBind; }
public void openLineInfo(ushort lineID) { if (lineID <= 0) { return; } WorldInfoPanel.HideAllWorldInfoPanels(); linePrefixDropDown.eventSelectedIndexChanged -= saveLineNumber; lineNumberLabel.eventLostFocus -= saveLineNumber; m_lineIdSelecionado = default(InstanceID); m_lineIdSelecionado.TransportLine = lineID; TransportLine t = m_controller.tm.m_lines.m_buffer[(int)lineID]; ushort lineNumber = t.m_lineNumber; TLMCW.ConfigIndex transportType = TLMCW.getDefinitionForLine(lineID).toConfigIndex(); ModoNomenclatura mnPrefixo = (ModoNomenclatura)TLMCW.getCurrentConfigInt(TLMConfigWarehouse.ConfigIndex.PREFIX | transportType); if (mnPrefixo != ModoNomenclatura.Nenhum) { lineNumberLabel.text = (lineNumber % 1000).ToString(); lineNumberLabel.relativePosition = new Vector3(110f, 3f); lineNumberLabel.width = 55; linePrefixDropDown.enabled = false; var temp = TLMUtils.getStringOptionsForPrefix(mnPrefixo); for (uint i = 0; i < temp.Length; i++) { string prefixName = TLMUtils.getTransportSystemPrefixName(transportType, i); if (prefixName != null && prefixName != string.Empty) { temp[(int)i] += " (" + prefixName + ")"; } } linePrefixDropDown.items = temp; linePrefixDropDown.selectedIndex = lineNumber / 1000; linePrefixDropDown.enabled = true; lineNumberLabel.maxLength = 3; } else { lineNumberLabel.text = (lineNumber).ToString(); lineNumberLabel.relativePosition = new Vector3(80f, 3f); lineNumberLabel.width = 75; lineNumberLabel.maxLength = 4; linePrefixDropDown.enabled = false; } lineNumberLabel.color = m_controller.tm.GetLineColor(lineID); lineNameField.text = m_controller.tm.GetLineName(lineID); lineTransportIconTypeLabel.relativePosition = new Vector3(10f, 12f); lineTransportIconTypeLabel.height = 20; lineTransportIconTypeLabel.atlas = linePrefixDropDown.atlas; lineTransportIconTypeLabel.backgroundSprite = PublicTransportWorldInfoPanel.GetVehicleTypeIcon(t.Info.m_transportType); lineColorPicker.selectedColor = m_controller.tm.GetLineColor(lineID); bool day, night, zeroed; TLMLineUtils.getLineActive(ref t, out day, out night, out zeroed); if (day && night) { lineTime.selectedIndex = 0; } else if (day) { lineTime.selectedIndex = 1; } else if (night) { lineTime.selectedIndex = 2; } else { lineTime.selectedIndex = 3; } m_linearMap.redrawLine(); Show(); m_controller.defaultListingLinesPanel.Hide(); m_autoNameLabel.text = m_linearMap.autoName; vehicleQuantitySet.text = TLMVehiclesLineManager.instance[this.lineIdSelecionado.TransportLine].ToString(); vehicleQuantitySet.area = new Vector4(150, 150, 50, 20); vehicleQuantitySet.color = Color.gray; linePrefixDropDown.eventSelectedIndexChanged += saveLineNumber; lineNumberLabel.eventLostFocus += saveLineNumber; }
private void createInfoView() { //line info painel TLMUtils.createUIElement <UIPanel>(ref lineInfoPanel, m_controller.mainRef.transform); lineInfoPanel.Hide(); lineInfoPanel.relativePosition = new Vector3(394.0f, 0.0f); lineInfoPanel.width = 650; lineInfoPanel.height = 290; lineInfoPanel.zOrder = 50; lineInfoPanel.color = new Color32(255, 255, 255, 255); lineInfoPanel.backgroundSprite = "MenuPanel2"; lineInfoPanel.name = "LineInfoPanel"; lineInfoPanel.autoLayoutPadding = new RectOffset(5, 5, 10, 10); lineInfoPanel.autoLayout = false; lineInfoPanel.useCenter = true; lineInfoPanel.wrapLayout = false; lineInfoPanel.canFocus = true; TLMUtils.createDragHandle(lineInfoPanel, lineInfoPanel, 35f); lineInfoPanel.eventVisibilityChanged += (component, value) => { if (m_linearMap != null) { m_linearMap.isVisible = value; } }; TLMUtils.createUIElement <UILabel>(ref lineTransportIconTypeLabel, lineInfoPanel.transform); lineTransportIconTypeLabel.autoSize = false; lineTransportIconTypeLabel.relativePosition = new Vector3(10f, 12f); lineTransportIconTypeLabel.width = 30; lineTransportIconTypeLabel.height = 20; lineTransportIconTypeLabel.name = "LineTransportIcon"; lineTransportIconTypeLabel.clipChildren = true; TLMUtils.createDragHandle(lineTransportIconTypeLabel, lineInfoPanel); GameObject lpddgo = GameObject.Instantiate(UITemplateManager.GetAsGameObject(UIHelperExtension.kDropdownTemplate).GetComponent <UIPanel>().Find <UIDropDown>("Dropdown").gameObject); linePrefixDropDown = lpddgo.GetComponent <UIDropDown>(); lineInfoPanel.AttachUIComponent(linePrefixDropDown.gameObject); linePrefixDropDown.isLocalized = false; linePrefixDropDown.autoSize = false; linePrefixDropDown.horizontalAlignment = UIHorizontalAlignment.Center; linePrefixDropDown.text = ""; linePrefixDropDown.width = 40; linePrefixDropDown.height = 35; linePrefixDropDown.name = "LinePrefixDropDown"; linePrefixDropDown.textScale = 1.6f; linePrefixDropDown.itemHeight = 35; linePrefixDropDown.itemPadding = new RectOffset(2, 2, 2, 2); linePrefixDropDown.textFieldPadding = new RectOffset(2, 2, 2, 2); linePrefixDropDown.eventSelectedIndexChanged += saveLineNumber; linePrefixDropDown.relativePosition = new Vector3(70f, 3f); TLMUtils.createUIElement <UITextField>(ref lineNumberLabel, lineInfoPanel.transform); lineNumberLabel.autoSize = false; lineNumberLabel.relativePosition = new Vector3(80f, 3f); lineNumberLabel.horizontalAlignment = UIHorizontalAlignment.Center; lineNumberLabel.text = ""; lineNumberLabel.width = 75; lineNumberLabel.height = 35; lineNumberLabel.name = "LineNumberLabel"; lineNumberLabel.normalBgSprite = "EmptySprite"; lineNumberLabel.textScale = 1.6f; lineNumberLabel.padding = new RectOffset(5, 5, 5, 5); lineNumberLabel.color = new Color(0, 0, 0, 1); TLMUtils.uiTextFieldDefaults(lineNumberLabel); lineNumberLabel.numericalOnly = true; lineNumberLabel.maxLength = 4; lineNumberLabel.eventLostFocus += saveLineNumber; lineNumberLabel.zOrder = 10; TLMUtils.createUIElement <UITextField>(ref lineNameField, lineInfoPanel.transform); lineNameField.autoSize = false; lineNameField.relativePosition = new Vector3(190f, 10f); lineNameField.horizontalAlignment = UIHorizontalAlignment.Center; lineNameField.text = "NOME"; lineNameField.width = 450; lineNameField.height = 25; lineNameField.name = "LineNameLabel"; lineNameField.maxLength = 256; lineNameField.textScale = 1.5f; TLMUtils.uiTextFieldDefaults(lineNameField); lineNameField.eventGotFocus += (component, eventParam) => { lastLineName = lineNameField.text; }; lineNameField.eventLostFocus += (component, eventParam) => { if (lastLineName != lineNameField.text) { saveLineName(lineNameField); } lineNameField.text = m_controller.tm.GetLineName(m_lineIdSelecionado.TransportLine); }; TLMUtils.createUIElement <UILabel>(ref lineLenghtLabel, lineInfoPanel.transform); lineLenghtLabel.autoSize = false; lineLenghtLabel.relativePosition = new Vector3(10f, 60f); lineLenghtLabel.textAlignment = UIHorizontalAlignment.Left; lineLenghtLabel.text = ""; lineLenghtLabel.width = 550; lineLenghtLabel.height = 25; lineLenghtLabel.prefix = ""; lineLenghtLabel.suffix = ""; lineLenghtLabel.name = "LineLenghtLabel"; lineLenghtLabel.textScale = 0.8f; TLMUtils.createUIElement <UILabel>(ref detailedStatsLabel, lineInfoPanel.transform); detailedStatsLabel.autoSize = false; detailedStatsLabel.relativePosition = new Vector3(10f, 75f); detailedStatsLabel.textAlignment = UIHorizontalAlignment.Left; detailedStatsLabel.width = 550; detailedStatsLabel.height = 25; detailedStatsLabel.name = "ExtraInfoLabel"; detailedStatsLabel.textScale = 0.8f; detailedStatsLabel.prefix = Locale.Get("TLM_LINE_EFFECTIVE_BUDGET") + ": "; TLMUtils.createUIElement <UILabel>(ref veiculosLinhaLabel, lineInfoPanel.transform); veiculosLinhaLabel.autoSize = false; veiculosLinhaLabel.relativePosition = new Vector3(10f, 90); veiculosLinhaLabel.textAlignment = UIHorizontalAlignment.Left; veiculosLinhaLabel.text = ""; veiculosLinhaLabel.width = 550; veiculosLinhaLabel.height = 25; veiculosLinhaLabel.name = "VehiclesLineLabel"; veiculosLinhaLabel.textScale = 0.8f; TLMUtils.createUIElement <UILabel>(ref viagensEvitadasLabel, lineInfoPanel.transform); viagensEvitadasLabel.autoSize = false; viagensEvitadasLabel.relativePosition = new Vector3(10f, 105); viagensEvitadasLabel.textAlignment = UIHorizontalAlignment.Left; viagensEvitadasLabel.text = ""; viagensEvitadasLabel.width = 250; viagensEvitadasLabel.height = 25; viagensEvitadasLabel.name = "AvoidedTravelsLabel"; viagensEvitadasLabel.textScale = 0.8f; TLMUtils.createUIElement <UILabel>(ref passageirosEturistasLabel, lineInfoPanel.transform); passageirosEturistasLabel.autoSize = false; passageirosEturistasLabel.relativePosition = new Vector3(10f, 120f); passageirosEturistasLabel.textAlignment = UIHorizontalAlignment.Left; passageirosEturistasLabel.text = ""; passageirosEturistasLabel.width = 350; passageirosEturistasLabel.height = 25; passageirosEturistasLabel.name = "TouristAndPassagersLabel"; passageirosEturistasLabel.textScale = 0.8f; //TLMUtils.createUIElement<UILabel>(ref generalDebugLabel, lineInfoPanel.transform); //generalDebugLabel.autoSize = false; //generalDebugLabel.relativePosition = new Vector3(10f, 185f); //generalDebugLabel.textAlignment = UIHorizontalAlignment.Left; //generalDebugLabel.prefix = "DEBUG: DATA AVAIL = "; //generalDebugLabel.width = 350; //generalDebugLabel.height = 100; //generalDebugLabel.name = "CustosLabel"; //generalDebugLabel.textScale = 0.8f; //generalDebugLabel.wordWrap = true; //generalDebugLabel.clipChildren = false; //generalDebugLabel.enabled = false && TransportLinesManagerMod.debugMode.value; TLMUtils.createUIElement <UILabel>(ref vehicleQuantitySetLabel, lineInfoPanel.transform); vehicleQuantitySetLabel.autoSize = false; vehicleQuantitySetLabel.relativePosition = new Vector3(10f, 135f); vehicleQuantitySetLabel.textAlignment = UIHorizontalAlignment.Left; vehicleQuantitySetLabel.localeID = "TLM_SET_FIXED_VEHICLE_NUMBER_LINE"; vehicleQuantitySetLabel.isLocalized = true; vehicleQuantitySetLabel.width = 300; vehicleQuantitySetLabel.height = 40; vehicleQuantitySetLabel.name = "FixedVehiclesLabel"; vehicleQuantitySetLabel.textScale = 0.8f; vehicleQuantitySetLabel.clipChildren = false; vehicleQuantitySetLabel.zOrder = 0; vehicleQuantitySet = UITextField.Instantiate(lineNumberLabel); vehicleQuantitySet.transform.SetParent(lineInfoPanel.transform); vehicleQuantitySet.relativePosition = new Vector3(120f, 165f); vehicleQuantitySet.size = new Vector2(50, 30); vehicleQuantitySet.padding = new RectOffset(0, 0, 0, 0); vehicleQuantitySet.textScale = 0.8f; vehicleQuantitySet.numericalOnly = true; vehicleQuantitySet.eventLostFocus += (x, y) => { TLMVehiclesLineManager.instance[this.lineIdSelecionado.TransportLine] = int.Parse(vehicleQuantitySet.text); }; TLMUtils.createUIElement <UILabel>(ref m_autoNameLabel, lineInfoPanel.transform); m_autoNameLabel.autoSize = false; m_autoNameLabel.relativePosition = new Vector3(10f, 180f); m_autoNameLabel.textAlignment = UIHorizontalAlignment.Left; m_autoNameLabel.prefix = Locale.Get("TLM_GENERATED_AUTO_NAME") + ": "; m_autoNameLabel.width = 350; m_autoNameLabel.height = 100; m_autoNameLabel.name = "AutoNameLabel"; m_autoNameLabel.textScale = 0.8f; m_autoNameLabel.wordWrap = true; m_autoNameLabel.clipChildren = false; lineColorPicker = GameObject.Instantiate(PublicTransportWorldInfoPanel.FindObjectOfType <UIColorField>().gameObject).GetComponent <UIColorField>(); // lineInfoPanel.AttachUIComponent(lineColorPicker.gameObject); lineColorPicker.name = "LineColorPicker"; lineColorPicker.relativePosition = new Vector3(50f, 10f); lineColorPicker.enabled = true; lineColorPicker.anchor = UIAnchorStyle.Top & UIAnchorStyle.Left; lineColorPicker.eventSelectedColorChanged += (UIComponent component, Color value) => { TLMUtils.setLineColor(m_lineIdSelecionado.TransportLine, value); updateLineUI(value); }; lineTime = UIHelperExtension.CloneBasicDropDown(Locale.Get("TRANSPORT_LINE_ACTIVITY"), new string[] { Locale.Get("TRANSPORT_LINE_DAYNNIGHT"), Locale.Get("TRANSPORT_LINE_DAY"), Locale.Get("TRANSPORT_LINE_NIGHT"), Locale.Get("TLM_TRANSPORT_LINE_DISABLED") }, changeLineTime, lineInfoPanel, out lineTimeTitle); lineTime.parent.relativePosition = new Vector3(120f, 220f); UIButton deleteLine = null; TLMUtils.createUIElement <UIButton>(ref deleteLine, lineInfoPanel.transform); deleteLine.relativePosition = new Vector3(10f, lineInfoPanel.height - 40f); deleteLine.localeID = "LINE_DELETE"; deleteLine.isLocalized = true; deleteLine.autoSize = true; deleteLine.textPadding = new RectOffset(3, 3, 3, 3); TLMUtils.initButton(deleteLine, true, "ButtonMenu"); deleteLine.name = "DeleteLineButton"; deleteLine.color = new Color(1, 0, 0, 1); deleteLine.eventClick += (UIComponent component, UIMouseEventParameter eventParam) => { Singleton <SimulationManager> .instance.AddAction(delegate { Singleton <TransportManager> .instance.ReleaseLine(m_lineIdSelecionado.TransportLine); }); closeLineInfo(component, eventParam); }; UIButton voltarButton2 = null; TLMUtils.createUIElement <UIButton>(ref voltarButton2, lineInfoPanel.transform); voltarButton2.relativePosition = new Vector3(lineInfoPanel.width - 250f, lineInfoPanel.height - 40f); voltarButton2.localeID = "CLOSE"; voltarButton2.isLocalized = true; voltarButton2.width = 240; voltarButton2.height = 30; TLMUtils.initButton(voltarButton2, true, "ButtonMenu"); voltarButton2.name = "LineInfoCloseButton"; voltarButton2.eventClick += closeLineInfo; UIButton autoName = null; TLMUtils.createUIElement <UIButton>(ref autoName, lineInfoPanel.transform); autoName.relativePosition = new Vector3(lineInfoPanel.width - 250f, lineInfoPanel.height - 80f); autoName.localeID = "TLM_USE_AUTO_NAME"; autoName.isLocalized = true; autoName.width = 240; autoName.height = 30; TLMUtils.initButton(autoName, true, "ButtonMenu"); autoName.name = "AutoNameButton"; autoName.eventClick += (component, eventParam) => { lineNameField.text = m_linearMap.autoName; saveLineName(lineNameField); }; UIButton autoColor = null; TLMUtils.createUIElement <UIButton>(ref autoColor, lineInfoPanel.transform); autoColor.relativePosition = new Vector3(lineInfoPanel.width - 250f, lineInfoPanel.height - 120f); autoColor.localeID = "TLM_PICK_COLOR_FROM_PALETTE"; autoColor.isLocalized = true; autoColor.tooltipLocaleID = "TLM_PICK_COLOR_FROM_PALETTE_TOOLTIP"; autoColor.width = 240; autoColor.height = 30; TLMUtils.initButton(autoColor, true, "ButtonMenu"); autoColor.name = "AutoNameButton"; autoColor.eventMouseUp += (component, eventParam) => { lineColorPicker.selectedColor = m_controller.AutoColor(m_lineIdSelecionado.TransportLine); updateLineUI(lineColorPicker.selectedColor); }; agesPanel = new TLMAgesChartPanel(this); m_linearMap = new TLMLinearMap(this); }