public void Awake() { Instance = this; MainContainer = GetComponent <UIComponent>(); m_uiHelperNeighbors = new UIHelperExtension(MainContainer); ((UIPanel)m_uiHelperNeighbors.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)m_uiHelperNeighbors.Self).wrapLayout = true; ((UIPanel)m_uiHelperNeighbors.Self).autoLayout = true; UILabel titleLabel = m_uiHelperNeighbors.AddLabel(""); titleLabel.autoSize = true; titleLabel.textAlignment = UIHorizontalAlignment.Center; titleLabel.wordWrap = false; titleLabel.minimumSize = new Vector2(MainContainer.width - 10, 0); KlyteMonoUtils.LimitWidth(titleLabel, MainContainer.width); titleLabel.localeID = "K45_TLM_PER_HOUR_BUDGET_TITLE"; m_uiHelperNeighbors.AddSpace(5); KlyteMonoUtils.CreateElement(out m_clockChart, m_uiHelperNeighbors.Self.transform, "DailyClock"); m_showAbsoluteCheckbox = m_uiHelperNeighbors.AddCheckboxLocale("K45_TLM_SHOW_ABSOLUTE_VALUE", false, (x) => { RebuildList(UVMPublicTransportWorldInfoPanel.GetLineID()); }); KlyteMonoUtils.LimitWidthAndBox(m_showAbsoluteCheckbox.label, m_uiHelperNeighbors.Self.width - 40f); KlyteMonoUtils.CreateElement(out m_titleContainer, m_uiHelperNeighbors.Self.transform, "Title"); PopulateTitlePanel(m_titleContainer); KlyteMonoUtils.CreateScrollPanel(m_uiHelperNeighbors.Self, out m_entryListContainer, out _, m_uiHelperNeighbors.Self.width - 20f, m_uiHelperNeighbors.Self.height - 150, Vector3.zero); }
public static UIDropDown CloneBasicDropDownLocalized(string text, string[] options, OnDropdownSelectionChanged eventCallback, int defaultSelection, UIComponent parent, out UILabel label, out UIPanel container, bool limitLabelByPanelWidth = false) { if (eventCallback != null && !string.IsNullOrEmpty(text)) { container = parent.AttachUIComponent(UITemplateManager.GetAsGameObject(kDropdownTemplate)) as UIPanel; label = container.Find <UILabel>("Label"); label.localeID = text; label.isLocalized = true; if (limitLabelByPanelWidth) { KlyteMonoUtils.LimitWidth(label, (uint)container.width); } UIDropDown uIDropDown = container.Find <UIDropDown>("Dropdown"); uIDropDown.items = options; uIDropDown.selectedIndex = defaultSelection; uIDropDown.eventSelectedIndexChanged += delegate(UIComponent c, int sel) { eventCallback(sel); }; return(uIDropDown); } DebugOutputPanel.AddMessage(PluginManager.MessageType.Warning, "Cannot create dropdown with no name or no event"); label = null; container = null; return(null); }
public void Awake() { MainContainer = GetComponent <UIComponent>(); m_uiHelperNeighbors = new UIHelperExtension(MainContainer); ((UIScrollablePanel)m_uiHelperNeighbors.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)m_uiHelperNeighbors.Self).wrapLayout = true; ((UIScrollablePanel)m_uiHelperNeighbors.Self).width = 370; m_neighborFileSelect = m_uiHelperNeighbors.AddDropdownLocalized("K45_ADR_REGION_CITIES_FILE", new string[0], -1, OnChangeSelectedNeighborFile); m_neighborFileSelect.width = 370; m_uiHelperNeighbors.AddSpace(1); KlyteMonoUtils.LimitWidth((UIButton)m_uiHelperNeighbors.AddButton(Locale.Get("K45_ADR_ROAD_NAME_FILES_RELOAD"), ReloadOptionsFilesNeighbor), 380); m_uiHelperNeighbors.AddSpace(10); UILabel titleLabel = m_uiHelperNeighbors.AddLabel(""); titleLabel.autoSize = true; titleLabel.textAlignment = UIHorizontalAlignment.Center; titleLabel.minimumSize = new Vector2(370, 0); KlyteMonoUtils.LimitWidth(titleLabel, 370); titleLabel.localeID = "K45_ADR_AZIMUTH_EDITOR_TITLE"; m_uiHelperNeighbors.AddSpace(5); KlyteMonoUtils.CreateElement(out m_borderChart, m_uiHelperNeighbors.Self.transform, "NeighborArea"); m_uiHelperNeighbors.AddSpace(30); KlyteMonoUtils.CreateElement <AdrAzimuthTitleLineNeighbor>(m_uiHelperNeighbors.Self.transform); m_uiHelperNeighbors.AddSpace(5); ReloadOptionsFilesNeighbor(); }
private void Awake() { m_instance = this; controlContainer = GetComponent <UIPanel>(); controlContainer.name = "VWConfigFilesPanel"; controlContainer.autoLayout = true; controlContainer.autoLayoutDirection = LayoutDirection.Vertical; controlContainer.clipChildren = true; var group1 = new UIHelperExtension(controlContainer); UILabel lblTitle = group1.AddLabel(Locale.Get("K45_VW_IMPORT_EXPORT_TITLE")); lblTitle.autoSize = true; lblTitle.minimumSize = Vector2.zero; lblTitle.maximumSize = Vector2.zero; lblTitle.wordWrap = false; KlyteMonoUtils.LimitWidth(lblTitle, (uint)(controlContainer.width - 10)); KlyteMonoUtils.LimitWidth((UIButton)group1.AddButton(Locale.Get("K45_VW_OPEN_FOLDER_IMPORT_EXPORT"), () => { ColossalFramework.Utils.OpenInFileBrowser(FileUtils.EnsureFolderCreation(VehicleWealthizerMod.ImportExportWealthFolder).FullName); }), (uint)(controlContainer.width - 10)); KlyteMonoUtils.LimitWidth((UIButton)group1.AddButton(Locale.Get("K45_VW_RELOAD_IMPORT_FILES"), ReloadImportFiles), (uint)(controlContainer.width - 10)); m_ddImport = group1.AddDropdown(Locale.Get("K45_VW_SELECT_FILE_IMPORT"), new string[0], "", (x) => { m_btnImport.isEnabled = (x >= 0); }); ConfigComponentPanel(m_ddImport); m_btnImport = (UIButton)group1.AddButton(Locale.Get("K45_VW_IMPORT_SELECTED"), Import); KlyteMonoUtils.LimitWidth(m_btnImport, (uint)(controlContainer.width - 10)); KlyteMonoUtils.LimitWidth((UIButton)group1.AddButton(Locale.Get("K45_VW_EXPORT_CURRENT"), Export), (uint)(controlContainer.width - 10)); ReloadImportFiles(); m_btnImport.isEnabled = (m_ddImport.items.Length > 0); }
public void Awake() { m_bg = component as UIPanel; m_bg.autoLayout = true; m_bg.autoLayoutDirection = LayoutDirection.Vertical; m_bg.clipChildren = true; var uiHelper = new UIHelperExtension(m_bg); UILabel titleLabel = uiHelper.AddLabel(""); titleLabel.autoSize = true; titleLabel.textAlignment = UIHorizontalAlignment.Center; titleLabel.minimumSize = new Vector2(m_bg.width, 0); KlyteMonoUtils.LimitWidth(titleLabel, m_bg.width); titleLabel.localeID = TitleLocaleID; KlyteMonoUtils.CreateUIElement(out UIPanel listTitle, m_bg.transform, "LT"); L titleList = listTitle.gameObject.AddComponent <L>(); titleList.AsTitle(); KlyteMonoUtils.CreateUIElement(out UIPanel reportLinesContainer, m_bg.transform, "listContainer", new Vector4(0, 0, m_bg.width, m_bg.height - titleLabel.height - listTitle.height - 35)); reportLinesContainer.autoLayout = true; reportLinesContainer.autoLayoutDirection = LayoutDirection.Horizontal; KlyteMonoUtils.CreateScrollPanel(reportLinesContainer, out UIScrollablePanel reportLines, out _, reportLinesContainer.width - 10, reportLinesContainer.height, Vector3.zero); for (int i = 0; i < m_reportLines.Length; i++) { KlyteMonoUtils.CreateUIElement(out UIPanel line, reportLines.transform, $"L{i}"); m_reportLines[i] = line.gameObject.AddComponent <L>(); } KlyteMonoUtils.CreateUIElement(out UIPanel aggregateLine, m_bg.transform, $"L_AGG"); m_aggregateLine = aggregateLine.gameObject.AddComponent <L>(); }
public void Awake() { Instance = this; MainContainer = GetComponent <UIComponent>(); m_uiHelper = new UIHelperExtension(MainContainer); ((UIPanel)m_uiHelper.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)m_uiHelper.Self).wrapLayout = true; ((UIPanel)m_uiHelper.Self).autoLayout = true; UILabel titleLabel = m_uiHelper.AddLabel(""); titleLabel.autoSize = true; titleLabel.textAlignment = UIHorizontalAlignment.Center; titleLabel.wordWrap = false; titleLabel.minimumSize = new Vector2(MainContainer.width - 10, 0); KlyteMonoUtils.LimitWidth(titleLabel, MainContainer.width); titleLabel.localeID = "K45_TLM_PER_HOUR_TICKET_PRICE_TITLE"; m_uiHelper.AddSpace(5); KlyteMonoUtils.CreateElement(out m_clockChart, m_uiHelper.Self.transform, "DailyClock"); m_uiHelper.AddSpace(20); KlyteMonoUtils.CreateElement(out m_titleContainer, m_uiHelper.Self.transform, "Title"); PopulateTitlePanel(m_titleContainer); KlyteMonoUtils.CreateScrollPanel(m_uiHelper.Self, out m_entryListContainer, out _, m_uiHelper.Self.width - 20f, m_uiHelper.Self.height - 150, Vector3.zero); }
private void CreateGroupFileSelect(string i18n, OnDropdownSelectionChanged onChanged, OnButtonClicked onReload, out UIDropDown dropDown) { dropDown = m_uiHelperDistrict.AddDropdownLocalized(i18n, new string[0], -1, onChanged); dropDown.width = DefaultWidth; m_uiHelperDistrict.AddSpace(1); KlyteMonoUtils.LimitWidth((UIButton)m_uiHelperDistrict.AddButton(Locale.Get(i18n + "S_RELOAD"), onReload), 380); m_uiHelperDistrict.AddSpace(20); onReload.Invoke(); }
public void Awake() { MainContainer = GetComponent <UIPanel>(); MainContainer.autoLayout = true; MainContainer.autoLayoutDirection = LayoutDirection.Vertical; MainContainer.autoLayoutPadding = new RectOffset(5, 5, 5, 5); var m_uiHelperHS = new UIHelperExtension(MainContainer); m_buttonTool = (UIButton)m_uiHelperHS.AddButton(Locale.Get("K45_ADR_PICK_A_SEGMENT"), EnablePickTool); KlyteMonoUtils.LimitWidth(m_buttonTool, (m_uiHelperHS.Self.width - 20), true); AddLabel("", m_uiHelperHS, out m_labelSelectionDescription, out m_topContainerBar, false); m_labelSelectionDescription.prefix = Locale.Get("K45_ADR_CURRENTSELECTION") + ": "; m_labelSelectionDescription.padding.top = 8; AddButtonInEditorRow(m_labelSelectionDescription, Commons.UI.SpriteNames.CommonsSpriteNames.K45_PaintBucket, EnterPaintBucketMode, "K45_ADR_PAINTSEED", true, 30); AddButtonInEditorRow(m_labelSelectionDescription, Commons.UI.SpriteNames.CommonsSpriteNames.K45_Reload, OnSegmentNewSeed, "K45_ADR_CHANGESEED_INTERCROSS", true, 30); KlyteMonoUtils.LimitWidthAndBox(m_labelSelectionDescription, (m_labelSelectionDescription.width), true); KlyteMonoUtils.CreateUIElement(out m_editingContainer, MainContainer.transform, "SecContainer", new Vector4(0, 0, MainContainer.width, MainContainer.height - 10 - m_topContainerBar.height)); m_editingContainer.autoLayout = true; m_editingContainer.autoLayoutDirection = LayoutDirection.Vertical; m_editingContainer.autoLayoutPadding = new RectOffset(0, 0, 5, 5); var m_editingHelper = new UIHelperExtension(m_editingContainer); AddFilterableInput(Locale.Get("K45_ADR_HIGHWAYITEM_TYPE"), m_editingHelper, out m_hwType, out _, OnFilterHwTypes, OnSetHwType); AddTextField(Locale.Get("K45_ADR_HIGHWAYITEM_ID"), out m_hwId, m_editingHelper, OnSetHwId); AddTextField(Locale.Get("K45_ADR_HIGHWAYITEM_FORCEDNAME"), out m_hwName, m_editingHelper, OnSetHwForcedName); AddIntField(Locale.Get("K45_ADR_HIGHWAYITEM_MILEAGEOFFSET"), out m_hwMileageOffset, m_editingHelper, OnSetMileageOffset, false); AddCheckboxLocale("K45_ADR_HIGHWAYITEM_INVERTMILEAGE", out m_hwInvertMileage, m_editingHelper, OnSetMileageInvert); AddColorField(m_editingHelper, Locale.Get("K45_ADR_HIGHWAYITEM_COLOR"), out m_hwColor, OnSetHwColor); m_hwMileageOffset.width = 120; MainContainer.eventVisibilityChanged += (x, y) => { if (y) { eraseSeedBuffer = -1; DoEraseSeed(); } else { if (ToolsModifierControl.toolController.CurrentTool is RoadSegmentTool) { ToolsModifierControl.SetTool <DefaultTool>(); } OnSegmentSet(0); } }; OnSegmentSet(0); }
private static void AddFolderButton(string filePath, UIHelperExtension helper, string localeId) { FileInfo fileInfo = FileUtils.EnsureFolderCreation(filePath); helper.AddLabel(Locale.Get(localeId) + ":"); UIButton namesFilesButton = ((UIButton)helper.AddButton("/", () => ColossalFramework.Utils.OpenInFileBrowser(fileInfo.FullName))); namesFilesButton.textColor = Color.yellow; KlyteMonoUtils.LimitWidth(namesFilesButton, 710); namesFilesButton.text = fileInfo.FullName + Path.DirectorySeparatorChar; }
private void Awake() { parent = GetComponentInParent <UIComponent>(); var group6 = new UIHelperExtension(parent.GetComponentInChildren <UIScrollablePanel>()); ((UIScrollablePanel)group6.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)group6.Self).wrapLayout = true; ((UIScrollablePanel)group6.Self).width = 730; group6.AddLabel(Locale.Get("K45_TLM_CUSTOM_PALETTE_CONFIG")); group6.AddSpace(15); FileInfo fiPalette = FileUtils.EnsureFolderCreation(TLMController.palettesFolder); group6.AddLabel(Locale.Get("K45_TLM_PALETTE_FOLDER_LABEL") + ":"); var namesFilesButton = ((UIButton)group6.AddButton("/", () => ColossalFramework.Utils.OpenInFileBrowser(fiPalette.FullName))); namesFilesButton.textColor = Color.yellow; KlyteMonoUtils.LimitWidth(namesFilesButton, 710); namesFilesButton.text = fiPalette.FullName + Path.DirectorySeparatorChar; ((UIButton)group6.AddButton(Locale.Get("K45_TLM_RELOAD_PALETTES"), delegate() { TLMAutoColorPalettes.Reload(); string idxSel = editorSelector.selectedValue; editorSelector.items = TLMAutoColorPalettes.paletteListForEditing; editorSelector.selectedIndex = TLMAutoColorPalettes.paletteListForEditing.ToList().IndexOf(idxSel); TLMConfigOptions.instance.updateDropDowns(); onPaletteReloaded?.Invoke(); })).width = 710; NumberedColorList colorList = null; editorSelector = group6.AddDropdown(Locale.Get("K45_TLM_PALETTE_VIEW"), TLMAutoColorPalettes.paletteListForEditing, 0, delegate(int sel) { if (sel <= 0 || sel >= TLMAutoColorPalettes.paletteListForEditing.Length) { colorList.Disable(); } else { colorList.ColorList = TLMAutoColorPalettes.getColors(TLMAutoColorPalettes.paletteListForEditing[sel]); colorList.Enable(); } }) as UIDropDown; editorSelector.GetComponentInParent <UIPanel>().width = 710; editorSelector.width = 710; colorList = group6.AddNumberedColorList(null, new List <Color32>(), (c) => { }, null, null); colorList.m_spriteName = KlyteResourceLoader.GetDefaultSpriteNameFor(LineIconSpriteNames.K45_SquareIcon, true); colorList.Size = new Vector2(750, colorList.Size.y); }
private void ConfigComponentPanel(UIComponent reference) { reference.GetComponentInParent <UIPanel>().autoFitChildrenVertically = true; KlyteMonoUtils.CreateElement(out UIPanel labelContainer, reference.parent.transform); labelContainer.size = new Vector2(240, reference.height); labelContainer.zOrder = 0; UILabel lbl = reference.parent.GetComponentInChildren <UILabel>(); lbl.transform.SetParent(labelContainer.transform); lbl.textAlignment = UIHorizontalAlignment.Center; lbl.minimumSize = new Vector2(240, reference.height); KlyteMonoUtils.LimitWidth(lbl, 240); lbl.verticalAlignment = UIVerticalAlignment.Middle; lbl.pivot = UIPivotPoint.TopCenter; lbl.relativePosition = new Vector3(0, lbl.relativePosition.y); reference.width = controlContainer.width - 10; }
public void Awake() { MainPanel = GetComponent <UIPanel>(); MainPanel.relativePosition = new Vector3(510f, 0.0f); MainPanel.width = 350; MainPanel.height = GetComponentInParent <UIComponent>().height; MainPanel.zOrder = 50; MainPanel.color = new Color32(255, 255, 255, 255); MainPanel.name = "AssetSelectorWindow"; MainPanel.autoLayoutPadding = new RectOffset(5, 5, 10, 10); MainPanel.autoLayout = true; MainPanel.autoLayoutDirection = LayoutDirection.Vertical; KlyteMonoUtils.CreateUIElement(out m_title, MainPanel.transform); m_title.textAlignment = UIHorizontalAlignment.Center; m_title.autoSize = false; m_title.autoHeight = true; m_title.width = MainPanel.width - 30f; m_title.relativePosition = new Vector3(5, 5); m_title.textScale = 0.9f; m_title.localeID = "K45_TLM_ASSETS_FOR_PREFIX"; m_helper = new UIHelperExtension(MainPanel); TLMUtils.doLog("Name"); m_prefixName = CreateMiniTextField("K45_TLM_PREFIX_NAME", OnPrefixNameChange); TLMUtils.doLog("ColorForModel"); m_useColorForModel = m_helper.AddCheckboxLocale("K45_TLM_USE_PREFIX_COLOR_FOR_VEHICLE", false, OnUseColorVehicleChange); KlyteMonoUtils.LimitWidth(m_useColorForModel.label, 340, true); m_useColorForModel.label.textScale = 1; TLMUtils.doLog("ColorSel"); CreateColorSelector(); TLMUtils.doLog("Palette"); m_paletteDD = CreateMiniDropdown("K45_TLM_PALETTE", SetPalettePrefix, new string[1]); ReloadPalettes(); TLMPaletteOptionsTab.onPaletteReloaded += ReloadPalettes; TLMUtils.doLog("Format"); m_formatDD = CreateMiniDropdown("K45_TLM_ICON", SetFormatPrefix, TLMLineIconExtension.getDropDownOptions(Locale.Get("K45_TLM_LINE_ICON_ENUM_TT_DEFAULT"))); }
private void CreateColorSelector() { m_prefixColor = m_helper.AddColorPicker("A", Color.clear, OnChangePrefixColor, out UILabel lbl, out UIPanel container); KlyteMonoUtils.LimitWidthAndBox(lbl, 260, true); lbl.isLocalized = true; lbl.localeID = "K45_TLM_PREFIX_COLOR_LABEL"; lbl.verticalAlignment = UIVerticalAlignment.Middle; lbl.font = UIHelperExtension.defaultFontCheckbox; lbl.textScale = 1; KlyteMonoUtils.CreateUIElement(out UIButton resetColor, container.transform, "PrefixColorReset", new Vector4(290, 0, 0, 0)); KlyteMonoUtils.InitButton(resetColor, false, "ButtonMenu"); KlyteMonoUtils.LimitWidth(resetColor, 80, true); resetColor.textPadding = new RectOffset(5, 5, 5, 2); resetColor.autoSize = true; resetColor.localeID = "K45_TLM_RESET_COLOR"; resetColor.eventClick += OnResetColor; }
public void Awake() { m_parent = GetComponentInParent <UIComponent>(); var group72 = new UIHelperExtension(m_parent.GetComponentInChildren <UIScrollablePanel>()); ((UIScrollablePanel)group72.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)group72.Self).wrapLayout = true; ((UIScrollablePanel)group72.Self).width = 730; group72.AddLabel(Locale.Get("K45_TLM_DEFAULT_COST_PER_PASSENGER")); group72.AddSpace(15); foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.configurableTicketTransportCategories) { UITextField textField = TLMConfigOptions.instance.generateNumberFieldConfig(group72, TLMConfigWarehouse.getNameForTransportType(ci), TLMConfigWarehouse.ConfigIndex.DEFAULT_COST_PER_PASSENGER_CAPACITY | ci); UIPanel textFieldPanel = textField.GetComponentInParent <UIPanel>(); textFieldPanel.autoLayoutDirection = LayoutDirection.Horizontal; textFieldPanel.autoFitChildrenVertically = true; UILabel label = textFieldPanel.GetComponentInChildren <UILabel>(); label.minimumSize = new Vector2(420, 0); KlyteMonoUtils.LimitWidth(label); if (TLMConfigWarehouse.IsCityLoaded) { label.eventVisibilityChanged += (x, y) => { if (y) { float defaultCost = TLMConfigWarehouse.GetTransportSystemDefinitionForConfigTransport(ci).GetDefaultPassengerCapacityCost(); if (defaultCost >= 0) { label.suffix = $" ({(defaultCost).ToString("C3", LocaleManager.cultureInfo)})"; } else { label.suffix = $" (N/A)"; textField.isVisible = false; } } }; } group72.AddSpace(2); } }
private void CreateTitleLabel(UIPanel container, out UILabel label, string name, string text, uint width) { KlyteMonoUtils.CreateUIElement(out UIPanel nameContainer, container.transform, "GenNameContainer"); nameContainer.autoSize = false; nameContainer.width = width; nameContainer.height = 30; nameContainer.autoLayout = true; nameContainer.autoLayoutDirection = LayoutDirection.Horizontal; KlyteMonoUtils.CreateUIElement(out label, nameContainer.transform, name); KlyteMonoUtils.LimitWidth(label, width); label.autoSize = true; label.height = 30; label.padding = new RectOffset(3, 3, 4, 3); label.textAlignment = UIHorizontalAlignment.Center; label.text = text; label.verticalAlignment = UIVerticalAlignment.Middle; label.minimumSize = new Vector2(width, 0); }
private void Awake() { CreateMainPanel(); CreateScrollPanel(); SetPreviewWindow(); BindParentChanges(); CreateRemoveUndesiredModelsButton(); PopulateCheckboxes(); ServiceSystemDefinition ssd = SingletonLite <T> .instance.GetSSD(); bool allowColorChange = ssd.AllowColorChanging(); if (allowColorChange) { KlyteMonoUtils.CreateUIElement(out UILabel lbl, m_mainPanel.transform, "DistrictColorLabel", new Vector4(5, m_mainPanel.height - 30, 120, 40)); KlyteMonoUtils.LimitWidth(lbl, 120); lbl.autoSize = true; lbl.localeID = "K45_VMC_COLOR_LABEL"; m_color = KlyteMonoUtils.CreateColorField(m_mainPanel); m_color.eventSelectedColorChanged += onChangeColor; KlyteMonoUtils.CreateUIElement(out UIButton resetColor, m_mainPanel.transform, "DistrictColorReset", new Vector4(m_mainPanel.width - 110, m_mainPanel.height - 35, 0, 0)); KlyteMonoUtils.InitButton(resetColor, false, "ButtonMenu"); KlyteMonoUtils.LimitWidth(resetColor, 100); resetColor.textPadding = new RectOffset(5, 5, 5, 2); resetColor.autoSize = true; resetColor.localeID = "K45_VMC_RESET_COLOR"; resetColor.eventClick += onResetColor; } else { m_mainPanel.height -= 40; } }
public void Awake() { MainContainer = GetComponent <UIComponent>(); m_uiHelperDistrict = new UIHelperExtension(MainContainer); ((UIScrollablePanel)m_uiHelperDistrict.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)m_uiHelperDistrict.Self).wrapLayout = true; ((UIScrollablePanel)m_uiHelperDistrict.Self).width = DefaultWidth; m_cachedDistricts = DistrictUtils.GetValidDistricts(); m_selectDistrict = m_uiHelperDistrict.AddDropdownLocalized("K45_ADR_DISTRICT_TITLE", m_cachedDistricts.Keys.OrderBy(x => x).ToArray(), 0, OnDistrictSelect); m_selectDistrict.width = DefaultWidth; m_uiHelperDistrict.AddSpace(30); m_roadNameFile = m_uiHelperDistrict.AddDropdownLocalized("K45_ADR_DISTRICT_NAME_FILE", new string[0], -1, OnChangeSelectedRoadName); m_roadNameFile.width = DefaultWidth; m_uiHelperDistrict.AddSpace(1); KlyteMonoUtils.LimitWidth((UIButton)m_uiHelperDistrict.AddButton(Locale.Get("K45_ADR_ROAD_NAME_FILES_RELOAD"), ReloadOptionsRoad), 380); m_uiHelperDistrict.AddSpace(20); m_prefixesFile = m_uiHelperDistrict.AddDropdownLocalized("K45_ADR_STREETS_PREFIXES_NAME_FILE", new string[0], -1, OnChangeSelectedRoadPrefix); m_prefixesFile.width = DefaultWidth; m_uiHelperDistrict.AddSpace(1); KlyteMonoUtils.LimitWidth((UIButton)m_uiHelperDistrict.AddButton(Locale.Get("K45_ADR_STREETS_PREFIXES_FILES_RELOAD"), ReloadOptionsRoadPrefix), 380); m_uiHelperDistrict.AddSpace(40); m_prefixPostalCodeDistrict = m_uiHelperDistrict.AddTextField(Locale.Get("K45_ADR_DISTRICT_POSTAL_CODE"), null, "", OnChangePostalCodePrefixDistrict); m_prefixPostalCodeDistrict.numericalOnly = true; m_prefixPostalCodeDistrict.maxLength = 3; m_colorDistrict = m_uiHelperDistrict.AddColorPicker(Locale.Get("K45_ADR_DISTRICT_COLOR"), Color.white, OnChangeDistrictColor, out UILabel title); m_colorDistrict.width = 20; m_colorDistrict.height = 20; KlyteMonoUtils.LimitWidth(title, 350); DistrictManagerOverrides.EventOnDistrictChanged += ReloadDistricts; ReloadDistricts(); }
private void Awake() { VMCTabPanel.eventOnDistrictSelectionChanged += onDistrictChanged; mainPanel = GetComponentInChildren <UIScrollablePanel>(); mainPanel.autoLayout = false; m_uiHelper = new UIHelperExtension(mainPanel); KlyteMonoUtils.CreateUIElement(out UILabel lbl, mainPanel.transform, "DistrictColorLabel", new Vector4(5, 5, 250, 40)); allowColorChange = SingletonLite <T> .instance.GetSSD().AllowColorChanging(); if (allowColorChange) { KlyteMonoUtils.LimitWidth(lbl, 250); lbl.autoSize = true; lbl.localeID = "K45_VMC_DISTRICT_COLOR_LABEL"; m_districtColor = KlyteMonoUtils.CreateColorField(mainPanel); m_districtColor.eventSelectedColorChanged += onChangeDistrictColor; KlyteMonoUtils.CreateUIElement(out UIButton resetColor, mainPanel.transform, "DistrictColorReset", new Vector4(290, 0, 0, 0)); KlyteMonoUtils.InitButton(resetColor, false, "ButtonMenu"); KlyteMonoUtils.LimitWidth(resetColor, 200); resetColor.textPadding = new RectOffset(5, 5, 5, 2); resetColor.autoSize = true; resetColor.localeID = "K45_VMC_RESET_COLOR"; resetColor.eventClick += onResetColor; } ServiceSystemDefinition ssd = SingletonLite <T> .instance.GetSSD(); IVMCDistrictExtension extension = SingletonLite <T> .instance.GetExtensionDistrict(); KlyteMonoUtils.CreateElement(out m_assetSelectorWindow, mainPanel.transform); m_assetSelectorWindow.setTabContent(this); }
public void Awake() { m_bg = component as UIPanel; m_bg.autoLayout = true; m_bg.autoLayoutDirection = LayoutDirection.Vertical; m_bg.clipChildren = true; var uiHelper = new UIHelperExtension(m_bg); float heightCheck = 0f; if (!TLMController.IsRealTimeEnabled) { UICheckBox m_checkChangeDateLabel = uiHelper.AddCheckboxLocale("K45_TLM_SHOW_DAYTIME_INSTEAD_DATE", false, (x) => m_showDayTime = x && SimulationManager.instance.m_enableDayNight); KlyteMonoUtils.LimitWidth(m_checkChangeDateLabel.label, m_bg.width - 50); heightCheck = m_checkChangeDateLabel.height; } KlyteMonoUtils.CreateTabsComponent(out m_reportTabstrip, out _, m_bg.transform, "LineConfig", new Vector4(0, 0, m_bg.width, 30), new Vector4(0, 30, m_bg.width, m_bg.height - heightCheck - 30)); m_childControls.Add("FinanceReport", TabCommons.CreateTab <TLMLineFinanceReportTab>(m_reportTabstrip, "InfoPanelIconCurrency", "K45_TLM_WIP_FINANCE_REPORT_TAB", "FinanceReport", false)); m_childControls.Add("PassengerAgeReport", TabCommons.CreateTab <TLMLinePassengerAgeReportTab>(m_reportTabstrip, "InfoIconAge", "K45_TLM_WIP_PASSENGER_AGE_REPORT_TAB", "PassengerAgeReport", false)); m_childControls.Add("PassengerStudentTouristReport", TabCommons.CreateTab <TLMLinePassengerStudentTouristsReportTab>(m_reportTabstrip, "InfoIconTourism", "K45_TLM_WIP_PASSENGER_REPORT_TAB", "PassengerStudentTouristReport", false)); m_childControls.Add("PassengerWealthReport", TabCommons.CreateTab <TLMLinePassengerWealthReportTab>(m_reportTabstrip, "InfoIconLandValue", "K45_TLM_WIP_PASSENGER_WEALTH_REPORT_TAB", "PassengerWealthReport", false)); m_childControls.Add("PassengerGenderReport", TabCommons.CreateTab <TLMLinePassengerGenderReportTab>(m_reportTabstrip, "InfoIconPopulation", "K45_TLM_WIP_PASSENGER_GENDER_REPORT_TAB", "PassengerGenderReport", false)); }
public void Awake() { m_container = transform.gameObject.AddComponent <UIPanel>(); m_container.width = transform.parent.gameObject.GetComponent <UIComponent>().width; m_container.height = 30; m_container.autoLayout = true; m_container.autoLayoutDirection = LayoutDirection.Horizontal; m_container.autoLayoutPadding = new RectOffset(2, 2, 2, 2); m_container.wrapLayout = false; m_container.name = "AzimuthInputLine"; KlyteMonoUtils.CreateUIElement(out m_cityId, m_container.transform, "CityId"); m_cityId.autoSize = false; m_cityId.relativePosition = new Vector3(0, 0); m_cityId.backgroundSprite = "EmptySprite"; m_cityId.width = 30; m_cityId.height = 30; m_cityId.textScale = 1.3f; m_cityId.padding = new RectOffset(3, 3, 4, 3); m_cityId.useOutline = true; m_cityId.textAlignment = UIHorizontalAlignment.Center; KlyteMonoUtils.CreateUIElement(out m_azimuthInput, m_container.transform, "StartAzimuth"); KlyteMonoUtils.UiTextFieldDefaults(m_azimuthInput); m_azimuthInput.normalBgSprite = "OptionsDropboxListbox"; m_azimuthInput.width = 50; m_azimuthInput.height = 28; m_azimuthInput.textScale = 1.6f; m_azimuthInput.maxLength = 3; m_azimuthInput.numericalOnly = true; m_azimuthInput.text = "0"; m_azimuthInput.eventTextChanged += SendText; KlyteMonoUtils.CreateUIElement(out m_direction, m_container.transform, "Direction"); m_direction.autoSize = false; m_direction.width = 60; m_direction.height = 30; m_direction.textScale = 1.125f; m_direction.textAlignment = UIHorizontalAlignment.Center; m_direction.padding = new RectOffset(3, 3, 5, 3); KlyteMonoUtils.CreateUIElement(out UIPanel nameContainer, m_container.transform, "GenNameContainer"); nameContainer.autoSize = false; nameContainer.width = 150; nameContainer.height = 30; nameContainer.autoLayout = true; nameContainer.autoLayoutDirection = LayoutDirection.Horizontal; KlyteMonoUtils.CreateUIElement(out m_generatedName, nameContainer.transform, "GenName"); m_generatedName.autoSize = true; m_generatedName.height = 30; m_generatedName.textScale = 1.125f; m_generatedName.padding = new RectOffset(3, 3, 5, 3); m_generatedName.text = "???"; m_generatedName.textAlignment = UIHorizontalAlignment.Center; m_generatedName.minimumSize = new Vector2(150, 0); KlyteMonoUtils.LimitWidth(m_generatedName, 150); KlyteMonoUtils.CreateUIElement(out m_regenerateName, m_container.transform, "RegenName"); m_regenerateName.textScale = 1f; m_regenerateName.width = 30; m_regenerateName.height = 30; m_regenerateName.tooltip = Locale.Get("K45_ADR_REGENERATE_NAME"); KlyteMonoUtils.InitButton(m_regenerateName, true, "ButtonMenu"); m_regenerateName.isVisible = true; m_regenerateName.text = "R"; m_regenerateName.eventClick += (component, eventParam) => { AdrNeighborhoodExtension.SetSeed(m_id, new Randomizer(new System.Random().Next()).UInt32(0xFEFFFFFF)); OnRegenerate?.Invoke(); }; KlyteMonoUtils.CreateUIElement(out m_die, m_container.transform, "Delete"); m_die.textScale = 1f; m_die.width = 30; m_die.height = 30; m_die.tooltip = Locale.Get("K45_ADR_DELETE_STOP_NEIGHBOR"); KlyteMonoUtils.InitButton(m_die, true, "ButtonMenu"); m_die.isVisible = true; m_die.text = "X"; m_die.eventClick += (component, eventParam) => { AdrNeighborhoodExtension.SafeCleanEntry(m_id); OnDie?.Invoke(); }; }
public void Awake() { LogUtils.DoLog("AWAKE UVMBudgetTimeChart!"); UIPanel panel = transform.gameObject.AddComponent <UIPanel>(); panel.width = 370; panel.height = 70; panel.autoLayout = false; panel.useCenter = true; panel.wrapLayout = false; panel.tooltipLocaleID = "K45_TLM_BUDGET_CLOCK"; KlyteMonoUtils.CreateUIElement(out m_container, transform, "ClockContainer"); m_container.relativePosition = new Vector3((panel.width / 2f) - 70, 0); m_container.width = 140; m_container.height = 70; m_container.autoLayout = false; m_container.useCenter = true; m_container.wrapLayout = false; m_container.tooltipLocaleID = "K45_TLM_BUDGET_CLOCK"; KlyteMonoUtils.CreateUIElement(out m_clock, m_container.transform, "Clock"); m_clock.spriteName = "K45_24hClock"; m_clock.relativePosition = new Vector3(0, 0); m_clock.width = 70; m_clock.height = 70; KlyteMonoUtils.CreateUIElement(out m_minutePointer, m_container.transform, "Minute"); m_minutePointer.width = 2; m_minutePointer.height = 27; m_minutePointer.pivot = UIPivotPoint.TopCenter; m_minutePointer.relativePosition = new Vector3(35, 35); m_minutePointer.spriteName = "EmptySprite"; m_minutePointer.color = new Color32(35, 35, 35, 255); KlyteMonoUtils.CreateUIElement(out m_hourPointer, m_container.transform, "Hour"); m_hourPointer.width = 3; m_hourPointer.height = 14; m_hourPointer.pivot = UIPivotPoint.TopCenter; m_hourPointer.relativePosition = new Vector3(35, 35); m_hourPointer.spriteName = "EmptySprite"; m_hourPointer.color = new Color32(5, 5, 5, 255); KlyteMonoUtils.CreateUIElement(out UILabel titleEffective, m_container.transform, "TitleEffective"); titleEffective.width = 70; titleEffective.height = 30; KlyteMonoUtils.LimitWidth(titleEffective, 70, true); titleEffective.relativePosition = new Vector3(70, 0); titleEffective.textScale = 0.8f; titleEffective.color = Color.white; titleEffective.isLocalized = true; titleEffective.localeID = "K45_TLM_EFFECTIVE_BUDGET_NOW"; titleEffective.textAlignment = UIHorizontalAlignment.Center; KlyteMonoUtils.CreateUIElement(out UIPanel effectiveContainer, m_container.transform, "ValueEffectiveContainer"); effectiveContainer.width = 70; effectiveContainer.height = 40; effectiveContainer.relativePosition = new Vector3(70, 30); effectiveContainer.color = Color.white; effectiveContainer.autoLayout = false; KlyteMonoUtils.CreateUIElement(out m_effectiveSprite, effectiveContainer.transform, "BarBg"); m_effectiveSprite.width = 70; m_effectiveSprite.height = 40; m_effectiveSprite.relativePosition = new Vector3(0, 0); m_effectiveSprite.backgroundSprite = "PlainWhite"; m_effectiveSprite.progressSprite = "PlainWhite"; m_effectiveSprite.color = Color.cyan; m_effectiveSprite.progressColor = Color.red; m_effectiveSprite.value = 0.5f; KlyteMonoUtils.CreateUIElement(out m_effectiveLabel, effectiveContainer.transform, "BarLabel"); m_effectiveLabel.width = 70; m_effectiveLabel.height = 40; m_effectiveLabel.relativePosition = new Vector3(0, 0); m_effectiveLabel.color = Color.white; m_effectiveLabel.isLocalized = false; m_effectiveLabel.text = "%\n"; m_effectiveLabel.textAlignment = UIHorizontalAlignment.Center; m_effectiveLabel.verticalAlignment = UIVerticalAlignment.Middle; m_effectiveLabel.useOutline = true; m_effectiveLabel.padding.top = 3; KlyteMonoUtils.LimitWidth(m_effectiveLabel, 70, true); AwakeActionButtons(); }
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; } } }
public void Awake() { MainContainer = GetComponent <UIComponent>(); m_uiHelperGlobal = new UIHelperExtension(MainContainer); ((UIScrollablePanel)m_uiHelperGlobal.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)m_uiHelperGlobal.Self).wrapLayout = true; ((UIScrollablePanel)m_uiHelperGlobal.Self).width = 370; m_districtPrefixGenFile = m_uiHelperGlobal.AddDropdownLocalized("K45_ADR_DISTRICT_GEN_PREFIX_FILE", new string[0], -1, OnChangeSelectedDistrictPrefix); m_districtPrefixGenFile.width = 370; m_uiHelperGlobal.AddSpace(1); KlyteMonoUtils.LimitWidth((UIButton)m_uiHelperGlobal.AddButton(Locale.Get("K45_ADR_DISTRICT_GEN_PREFIX_FILES_RELOAD"), ReloadDistrictPrefixesFiles), 380); m_uiHelperGlobal.AddSpace(20); m_districtNameGenFile = m_uiHelperGlobal.AddDropdownLocalized("K45_ADR_DISTRICT_GEN_NAME_FILE", new string[0], -1, OnChangeSelectedDistrictName); m_districtNameGenFile.width = 370; m_uiHelperGlobal.AddSpace(1); KlyteMonoUtils.LimitWidth((UIButton)m_uiHelperGlobal.AddButton(Locale.Get("K45_ADR_DISTRICT_GEN_NAME_FILES_RELOAD"), ReloadDistrictNamesFiles), 380); m_uiHelperGlobal.AddSpace(20); ReloadDistrictPrefixesFiles(); ReloadDistrictNamesFiles(); m_prefixPostalCodeCity = m_uiHelperGlobal.AddTextField(Locale.Get("K45_ADR_CITY_POSTAL_CODE"), null, AdrController.CurrentConfig.GlobalConfig.AddressingConfig.ZipcodeCityPrefix.ToString("D3"), OnChangePostalCodePrefixCity); m_prefixPostalCodeCity.numericalOnly = true; m_prefixPostalCodeCity.maxLength = 3; m_postalCodeFormat = m_uiHelperGlobal.AddTextField(Locale.Get("K45_ADR_POSTAL_CODE_FORMAT"), null, AdrController.CurrentConfig.GlobalConfig.AddressingConfig.ZipcodeFormat, OnChangePostalCodeFormat); m_prefixPostalCodeCity.maxLength = 3; string[] formatExplain = new string[12]; for (int i = 0; i < formatExplain.Length; i++) { formatExplain[i] = Locale.Get("K45_ADR_POSTAL_CODE_FORMAT_LEGEND", i); } KlyteMonoUtils.CreateUIElement(out UILabel formatExplanation, m_uiHelperGlobal.Self.transform, "FormatText"); formatExplanation.wordWrap = true; formatExplanation.textScale = 0.65f; formatExplanation.textColor = Color.yellow; formatExplanation.autoSize = false; formatExplanation.autoHeight = true; formatExplanation.width = 370; string[] obs = new string[2]; for (int i = 0; i < obs.Length; i++) { obs[i] = Locale.Get("K45_ADR_POSTAL_CODE_FORMAT_OBSERVATION", i); } KlyteMonoUtils.CreateUIElement(out UILabel obsExplanation, m_uiHelperGlobal.Self.transform, "ObsText"); obsExplanation.wordWrap = true; obsExplanation.textScale = 0.65f; obsExplanation.textColor = Color.gray; obsExplanation.autoSize = false; obsExplanation.autoHeight = true; obsExplanation.width = 370; formatExplanation.text = "∙ " + string.Join(Environment.NewLine + "∙ ", formatExplain); obsExplanation.text = string.Join(Environment.NewLine, obs); m_uiHelperGlobal.AddSpace(20); m_uiHelperGlobal.AddLabel(Locale.Get("K45_ADR_ADDRESS_LINES")); m_addressLine1Format = m_uiHelperGlobal.AddTextField(Locale.Get("K45_ADR_ADDRESS_LINE1"), null, AdrController.CurrentConfig.GlobalConfig.AddressingConfig.AddressLine1, OnChangeAddressLine1); m_addressLine2Format = m_uiHelperGlobal.AddTextField(Locale.Get("K45_ADR_ADDRESS_LINE2"), null, AdrController.CurrentConfig.GlobalConfig.AddressingConfig.AddressLine2, OnChangeAddressLine2); m_addressLine3Format = m_uiHelperGlobal.AddTextField(Locale.Get("K45_ADR_ADDRESS_LINE3"), null, AdrController.CurrentConfig.GlobalConfig.AddressingConfig.AddressLine3, OnChangeAddressLine3); string[] formatExplainAddress = new string[6]; for (int i = 0; i < formatExplainAddress.Length; i++) { formatExplainAddress[i] = Locale.Get("K45_ADR_ADDRESS_FORMAT_LEGEND", i); } KlyteMonoUtils.CreateUIElement(out UILabel formatExplainAddressLabel, m_uiHelperGlobal.Self.transform, "FormatText"); formatExplainAddressLabel.wordWrap = true; formatExplainAddressLabel.textScale = 0.65f; formatExplainAddressLabel.textColor = Color.yellow; formatExplainAddressLabel.autoSize = false; formatExplainAddressLabel.autoHeight = true; formatExplainAddressLabel.width = 370; formatExplainAddressLabel.text = "∙ " + string.Join(Environment.NewLine + "∙ ", formatExplainAddress); m_uiHelperGlobal.AddSpace(20); m_uiHelperGlobal.AddLabel(Locale.Get("K45_ADR_BUILDING_CONFIGURATIONS")); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_AUTONAME_TRAIN_STATIONS", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.TrainsPassenger, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.TrainsPassenger = x; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_AUTONAME_MONORAIL_STATIONS", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.Monorail, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.Monorail = x; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_AUTONAME_METRO_STATIONS", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.Metro, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.Metro = x; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_AUTONAME_CABLE_CAR_STATIONS", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.CableCar, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.CableCar = x; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_AUTONAME_FERRY_STATIONS", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.Ferry, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.Ferry = x; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_AUTONAME_SHIP_STATIONS", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.ShipPassenger, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.ShipPassenger = x; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_AUTONAME_BLIMP_STATIONS", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.Blimp, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.Blimp = x; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_AUTONAME_AIRPLANE_STATIONS", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.AirplanePassenger, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.AirplanePassenger = x; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_ENABLE_CUSTOM_NAMING_CARGO_SHIP", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.ShipCargo, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.ShipCargo = x; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_ENABLE_CUSTOM_NAMING_CARGO_TRAIN", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.TrainsCargo, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.TrainsCargo = x; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_ENABLE_CUSTOM_NAMING_CARGO_AIRPLANE", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.AirplaneCargo, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig.AirplaneCargo = x; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_ENABLE_ADDRESS_NAMING_RES", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.RicoNamesGenerationConfig.Residence == GenerationMethod.ADDRESS, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.RicoNamesGenerationConfig.Residence = x ? GenerationMethod.ADDRESS : GenerationMethod.NONE; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_ENABLE_ADDRESS_NAMING_IND", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.RicoNamesGenerationConfig.Industry == GenerationMethod.ADDRESS, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.RicoNamesGenerationConfig.Industry = x ? GenerationMethod.ADDRESS : GenerationMethod.NONE; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_ENABLE_ADDRESS_NAMING_COM", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.RicoNamesGenerationConfig.Commerce == GenerationMethod.ADDRESS, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.RicoNamesGenerationConfig.Commerce = x ? GenerationMethod.ADDRESS : GenerationMethod.NONE; AdrEvents.TriggerBuildingNameStrategyChanged(); }); m_uiHelperGlobal.AddCheckboxLocale("K45_ADR_ENABLE_ADDRESS_NAMING_OFF", AdrController.CurrentConfig.GlobalConfig.BuildingConfig.RicoNamesGenerationConfig.Office == GenerationMethod.ADDRESS, (x) => { AdrController.CurrentConfig.GlobalConfig.BuildingConfig.RicoNamesGenerationConfig.Office = x ? GenerationMethod.ADDRESS : GenerationMethod.NONE; AdrEvents.TriggerBuildingNameStrategyChanged(); }); }
public void OnSetTarget(Type source) { if (source == GetType()) { return; } TransportSystemDefinition tsd = TransportSystem; if (!tsd.HasVehicles()) { MainPanel.isVisible = false; return; } m_isLoading = true; var lineId = GetLineID(); List <ushort> cityDepotList = TLMDepotUtils.GetAllDepotsFromCity(ref tsd); Interfaces.IBasicExtension config = TLMLineUtils.GetEffectiveExtensionForLine(lineId); List <ushort> targetDepotList = config.GetAllowedDepots(ref tsd, lineId); UIPanel[] depotChecks = m_checkboxTemplateList.SetItemCount(cityDepotList.Count); LogUtils.DoLog($"depotChecks = {depotChecks.Length}"); for (int idx = 0; idx < cityDepotList.Count; idx++) { ushort buildingID = cityDepotList[idx]; UICheckBox uiCheck = depotChecks[idx].GetComponentInChildren <UICheckBox>(); uiCheck.objectUserData = buildingID; uiCheck.isChecked = targetDepotList.Contains(buildingID); UILabel uilabel = uiCheck.label; uilabel.prefix = BuildingUtils.GetBuildingName(buildingID, out _, out _); ref Building depotBuilding = ref BuildingManager.instance.m_buildings.m_buffer[buildingID]; Vector3 sidewalk = depotBuilding.CalculateSidewalkPosition(); SegmentUtils.GetAddressStreetAndNumber(sidewalk, depotBuilding.m_position, out int number, out string streetName); byte districtId = DistrictManager.instance.GetDistrict(sidewalk); uilabel.text = $"\n<color gray>{streetName}, {number} - {(districtId == 0 ? SimulationManager.instance.m_metaData.m_CityName : DistrictManager.instance.GetDistrictName(districtId))}</color>"; if (uilabel.objectUserData == null) { uiCheck.eventCheckChanged += (x, y) => { if (!m_isLoading) { if (y) { TLMLineUtils.GetEffectiveExtensionForLine(UVMPublicTransportWorldInfoPanel.GetLineID()).AddDepotForLine(UVMPublicTransportWorldInfoPanel.GetLineID(), (ushort)x.objectUserData); } else { TLMLineUtils.GetEffectiveExtensionForLine(UVMPublicTransportWorldInfoPanel.GetLineID()).RemoveDepotForLine(UVMPublicTransportWorldInfoPanel.GetLineID(), (ushort)x.objectUserData); } } }; KlyteMonoUtils.LimitWidth(uiCheck.label, 280, true); UIButton gotoButton = depotChecks[idx].Find <UIButton>("GoTo"); gotoButton.eventClick += delegate(UIComponent c, UIMouseEventParameter r) { ushort buildingId = (ushort)uiCheck.objectUserData; if (buildingId != 0) { Vector3 position = BuildingManager.instance.m_buildings.m_buffer[buildingId].m_position; ToolsModifierControl.cameraController.SetTarget(new InstanceID() { Building = buildingId }, position, true); } }; uilabel.objectUserData = true; } }