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() { parent = GetComponentInParent <UIComponent>(); var group15 = new UIHelperExtension(parent.GetComponentInChildren <UIScrollablePanel>()); ((UIScrollablePanel)group15.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)group15.Self).wrapLayout = true; ((UIScrollablePanel)group15.Self).width = 730; group15.AddLabel(Locale.Get("K45_TLM_AUTO_NAME_SETTINGS_PUBLIC_AREAS")); group15.AddSpace(1); group15.AddLabel(Locale.Get("K45_TLM_AUTO_NAME_SETTINGS_PUBLIC_TRANSPORT_DESC")); group15.AddSpace(15); foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.extraAutoNameCategories) { UICheckBox checkbox = TLMConfigOptions.instance.generateCheckboxConfig(group15, TLMConfigWarehouse.GetNameForServiceType(ci), TLMConfigWarehouse.ConfigIndex.USE_FOR_AUTO_NAMING_REF | ci, 200); UIPanel textFieldPanel = TLMConfigOptions.instance.generateTextFieldConfig(group15, Locale.Get("K45_TLM_PREFIX_OPTIONAL"), TLMConfigWarehouse.ConfigIndex.AUTO_NAMING_REF_TEXT | ci).GetComponentInParent <UIPanel>(); textFieldPanel.autoLayoutDirection = LayoutDirection.Horizontal; textFieldPanel.autoFitChildrenVertically = true; UILabel title = textFieldPanel.GetComponentInChildren <UILabel>(); title.textAlignment = UIHorizontalAlignment.Center; KlyteMonoUtils.LimitWidthAndBox(title, 220, true); textFieldPanel.AttachUIComponent(checkbox.gameObject); checkbox.eventVisibilityChanged += (x, y) => { if (x) { checkbox.zOrder = 0; } }; group15.AddSpace(2); } }
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);; 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 Awake() { parent = GetComponentInParent <UIComponent>(); UIHelperExtension group7 = new UIHelperExtension(parent.GetComponentInChildren <UIScrollablePanel>()); ((UIScrollablePanel)group7.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)group7.Self).wrapLayout = true; ((UIScrollablePanel)group7.Self).width = 730; group7.AddLabel(Locale.Get("K45_TLM_AUTOMATION_CONFIG")); group7.AddSpace(15); AddCheckboxLocale("K45_TLM_AUTO_COLOR_ENABLED", out m_autoColor, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.UseAutoColor = x); AddCheckboxLocale("K45_TLM_AUTO_NAME_ENABLED", out m_autoName, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.UseAutoName = x); AddCheckboxLocale("K45_TLM_USE_CIRCULAR_AUTO_NAME", out m_circular, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.CircularIfSingleDistrictLine = x); AddCheckboxLocale("K45_TLM_ADD_LINE_NUMBER_AUTO_NAME", out m_addLineCode, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.AddLineCodeInAutoname = x); group7.AddSpace(15); AddCheckboxLocale("K45_TLM_ENABLE_EXPRESS_BUSES", out m_expressBuses, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.ExpressBusesEnabled = x); m_expressBuses.tooltipLocaleID = "K45_TLM_ENABLE_EXPRESS_BUSES_DESC"; AddCheckboxLocale("K45_TLM_ENABLE_EXPRESS_TRAMS", out m_expressTrams, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.ExpressTramsEnabled = x); m_expressTrams.tooltipLocaleID = "K45_TLM_ENABLE_EXPRESS_TRAMS_DESC"; AddCheckboxLocale("K45_TLM_ENABLE_EXPRESS_TROLLEYS", out m_expressTrolleys, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.ExpressTrolleybusesEnabled = x); m_expressTrolleys.tooltipLocaleID = "K45_TLM_ENABLE_EXPRESS_TROLLEYS_DESC"; group7.AddSpace(15); AddCheckboxLocale("K45_TLM_USEGAMECLOCKIFDAYNIGHTDISABLED", out m_clockSwap, group7, (x) => TransportLinesManagerMod.UseGameClockAsReferenceIfNoDayNight = x); }
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(); }
private void Awake() { parent = GetComponentInParent <UIComponent>(); UIHelperExtension group7 = new UIHelperExtension(parent.GetComponentInChildren <UIScrollablePanel>()); ((UIScrollablePanel)group7.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)group7.Self).wrapLayout = true; ((UIScrollablePanel)group7.Self).width = 730; group7.AddLabel(Locale.Get("K45_TLM_NEAR_LINES_CONFIG")); group7.AddSpace(15); group7.AddCheckbox(Locale.Get("K45_TLM_NEAR_LINES_SHOW_IN_SERVICES_BUILDINGS"), TransportLinesManagerMod.showNearLinesPlop, toggleShowNearLinesInCityServicesWorldInfoPanel); group7.AddCheckbox(Locale.Get("K45_TLM_NEAR_LINES_SHOW_IN_ZONED_BUILDINGS"), TransportLinesManagerMod.showNearLinesGrow, toggleShowNearLinesInZonedBuildingWorldInfoPanel); group7.AddSpace(20); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_BUS"), TLMConfigWarehouse.ConfigIndex.BUS_SHOW_IN_LINEAR_MAP); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_METRO"), TLMConfigWarehouse.ConfigIndex.METRO_SHOW_IN_LINEAR_MAP); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_TRAIN"), TLMConfigWarehouse.ConfigIndex.TRAIN_SHOW_IN_LINEAR_MAP); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_SHIP"), TLMConfigWarehouse.ConfigIndex.SHIP_SHOW_IN_LINEAR_MAP); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_PLANE"), TLMConfigWarehouse.ConfigIndex.PLANE_SHOW_IN_LINEAR_MAP); if (LoadingManager.instance.m_currentlyLoading || Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.AfterDark)) { TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_TAXI"), TLMConfigWarehouse.ConfigIndex.TAXI_SHOW_IN_LINEAR_MAP); } if (LoadingManager.instance.m_currentlyLoading || Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.Snowfall)) { TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_TRAM"), TLMConfigWarehouse.ConfigIndex.TRAM_SHOW_IN_LINEAR_MAP); } if (LoadingManager.instance.m_currentlyLoading || Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.NaturalDisasters)) { TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_EVAC_BUS"), TLMConfigWarehouse.ConfigIndex.EVAC_BUS_SHOW_IN_LINEAR_MAP); } if (LoadingManager.instance.m_currentlyLoading || Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.InMotion)) { TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_FERRY"), TLMConfigWarehouse.ConfigIndex.FERRY_SHOW_IN_LINEAR_MAP); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_BLIMP"), TLMConfigWarehouse.ConfigIndex.BLIMP_SHOW_IN_LINEAR_MAP); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_MONORAIL"), TLMConfigWarehouse.ConfigIndex.MONORAIL_SHOW_IN_LINEAR_MAP); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_CABLE_CAR"), TLMConfigWarehouse.ConfigIndex.CABLE_CAR_SHOW_IN_LINEAR_MAP); } if (LoadingManager.instance.m_currentlyLoading || Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.Parks)) { TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_TOUR_BUS"), TLMConfigWarehouse.ConfigIndex.TOUR_BUS_CONFIG_SHOW_IN_LINEAR_MAP); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_TOUR_PED"), TLMConfigWarehouse.ConfigIndex.TOUR_PED_CONFIG_SHOW_IN_LINEAR_MAP); } if (LoadingManager.instance.m_currentlyLoading || Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.Urban)) { TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_TROLLEY"), TLMConfigWarehouse.ConfigIndex.TROLLEY_CONFIG_SHOW_IN_LINEAR_MAP); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_NEAR_LINES_SHOW_PASSENGER_HELICOPTER"), TLMConfigWarehouse.ConfigIndex.HELICOPTER_CONFIG_SHOW_IN_LINEAR_MAP); } }
public override void Group9SettingsUI(UIHelperExtension group9) { group9.AddButton(Locale.Get("K45_TLM_DRAW_CITY_MAP"), TLMMapDrawer.DrawCityMap); group9.AddButton("Open generated map folder", () => ColossalFramework.Utils.OpenInFileBrowser(TLMController.ExportedMapsFolder)); group9.AddSpace(2); group9.AddButton(Locale.Get("K45_TLM_RELOAD_DEFAULT_CONFIGURATION"), () => { TLMBaseConfigXML.ReloadGlobalFile(); TLMConfigOptions.instance.ReloadData(); }); if (IsCityLoaded) { group9.AddButton(Locale.Get("K45_TLM_SAVE_CURRENT_CITY_CONFIG_AS_DEFAULT"), () => { TLMBaseConfigXML.Instance.ExportAsGlobalConfig(); TLMConfigWarehouse.GetConfig(null, null).ReloadFromDisk(); TLMConfigOptions.instance.ReloadData(); }); group9.AddButton(Locale.Get("K45_TLM_LOAD_DEFAULT_AS_CURRENT_CITY_CONFIG"), () => { TLMBaseConfigXML.Instance.LoadFromGlobal(); TLMConfigOptions.instance.ReloadData(); }); } else { group9.AddButton(Locale.Get("K45_TLM_SAVE_CURRENT_CITY_CONFIG_AS_DEFAULT"), TLMBaseConfigXML.GlobalFile.ExportAsGlobalConfig); } TLMConfigOptions.instance.ReloadData(); base.Group9SettingsUI(group9); }
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); 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 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 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.LimitWidthAndBox(namesFilesButton, 710); namesFilesButton.text = fiPalette.FullName + Path.DirectorySeparatorChar; ((UIButton)group6.AddButton(Locale.Get("K45_TLM_RELOAD_PALETTES"), delegate() { TLMAutoColorPaletteContainer.Reload(); ReloadData(); OnPaletteReloaded?.Invoke(); })).width = 710; UIPanel m_listColorContainer = null; m_paletteSelect = group6.AddDropdown(Locale.Get("K45_TLM_PALETTE_VIEW"), TLMAutoColorPaletteContainer.PaletteListForEditing, 0, delegate(int sel) { if (sel <= 0 || sel >= TLMAutoColorPaletteContainer.PaletteListForEditing.Length) { m_listColorContainer?.Disable(); m_colorFieldTemplateListColors?.SetItemCount(0); } else { m_listColorContainer?.Enable(); UpdateColorList(TLMAutoColorPaletteContainer.GetColors(TLMAutoColorPaletteContainer.PaletteListForEditing[sel])); } }) as UIDropDown; m_paletteSelect.GetComponentInParent <UIPanel>().width = 720; m_paletteSelect.GetComponentInParent <UIPanel>().autoLayoutDirection = LayoutDirection.Horizontal; m_paletteSelect.GetComponentInParent <UIPanel>().wrapLayout = true; m_paletteSelect.width = 710; KlyteMonoUtils.CreateUIElement(out m_listColorContainer, group6.Self.transform, "listColors", new UnityEngine.Vector4(0, 0, group6.Self.width, group6.Self.height - 250)); KlyteMonoUtils.CreateScrollPanel(m_listColorContainer, out m_colorListScroll, out _, m_listColorContainer.width - 20, m_listColorContainer.height); m_colorListScroll.backgroundSprite = "OptionsScrollbarTrack"; m_colorListScroll.autoLayout = true; m_colorListScroll.autoLayoutDirection = LayoutDirection.Horizontal; m_colorListScroll.wrapLayout = true; }
private void Awake() { parent = GetComponentInParent <UIComponent>(); UIHelperExtension group72 = new UIHelperExtension(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_PRICE")); group72.AddSpace(15); foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.configurableTicketTransportCategories) { var textField = TLMConfigOptions.instance.generateNumberFieldConfig(group72, TLMConfigWarehouse.getNameForTransportType(ci), TLMConfigWarehouse.ConfigIndex.DEFAULT_TICKET_PRICE | ci); var textFieldPanel = textField.GetComponentInParent <UIPanel>(); textFieldPanel.autoLayoutDirection = LayoutDirection.Horizontal; textFieldPanel.autoFitChildrenVertically = true; textFieldPanel.GetComponentInChildren <UILabel>().minimumSize = new Vector2(420, 0); group72.AddSpace(2); } }
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() { 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 Awake() { parent = GetComponentInParent <UIComponent>(); var group15 = new UIHelperExtension(parent.GetComponentInChildren <UIScrollablePanel>()); ((UIScrollablePanel)group15.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)group15.Self).wrapLayout = true; ((UIScrollablePanel)group15.Self).width = parent.width; group15.AddLabel(Locale.Get("K45_TLM_AUTO_NAME_SETTINGS_PUBLIC_AREAS")); group15.AddSpace(1); group15.AddLabel(Locale.Get("K45_TLM_AUTO_NAME_SETTINGS_PUBLIC_TRANSPORT_DESC")); group15.AddSpace(15); foreach (var service in Enum.GetValues(typeof(TLMSpecialNamingClass)).OfType <TLMSpecialNamingClass>().Where(x => x != TLMSpecialNamingClass.None)) { AddCheckbox(service.GetLocalizedName(), out UICheckBox check, group15, (x) => TLMBaseConfigXML.Instance.GetAutoNameData(service).UseInAutoName = x); AddTextField(Locale.Get("K45_TLM_PREFIX_BUILDING_NAMES"), out UITextField textField, group15, (x) => TLMBaseConfigXML.Instance.GetAutoNameData(service).NamingPrefix = x); m_checks[service] = check; m_textFields[service] = textField; group15.AddSpace(5); } }
public override void Group9SettingsUI(UIHelperExtension group9) { TLMConfigOptions.instance.generateNumberFieldConfig(group9, Locale.Get("K45_TLM_MAXIMUM_VEHICLE_COUNT_FOR_SPECIFIC_LINE_CONFIG"), TLMConfigWarehouse.ConfigIndex.MAX_VEHICLES_SPECIFIC_CONFIG).maxLength = 3; group9.AddButton(Locale.Get("K45_TLM_DRAW_CITY_MAP"), TLMMapDrawer.drawCityMap); group9.AddButton("Open generated map folder", () => ColossalFramework.Utils.OpenInFileBrowser(TLMController.exportedMapsFolder)); group9.AddSpace(2); group9.AddButton(Locale.Get("K45_TLM_RELOAD_DEFAULT_CONFIGURATION"), () => { TLMConfigWarehouse.GetConfig(null, null).ReloadFromDisk(); TLMConfigOptions.instance.ReloadData(); }); if (IsCityLoaded) { group9.AddButton(Locale.Get("K45_TLM_EXPORT_CITY_CONFIG"), () => { string path = TLMConfigOptions.instance.currentLoadedCityConfig.Export(); ConfirmPanel.ShowModal(Name, string.Format(Locale.Get("K45_TLM_FILE_EXPORTED_TO_TEMPLATE"), path), (x, y) => { if (y == 1) { ColossalFramework.Utils.OpenInFileBrowser(path); } }); }); group9.AddButton(Locale.Get("K45_TLM_IMPORT_CITY_CONFIG"), () => { ConfirmPanel.ShowModal(Name, string.Format(Locale.Get("K45_TLM_FILE_WILL_BE_IMPORTED_TEMPLATE"), TLMConfigOptions.instance.currentLoadedCityConfig.ThisPath), (x, y) => { if (y == 1) { TLMConfigOptions.instance.currentLoadedCityConfig.ReloadFromDisk(); TLMConfigOptions.instance.ReloadData(); } }); }); group9.AddButton(Locale.Get("K45_TLM_SAVE_CURRENT_CITY_CONFIG_AS_DEFAULT"), () => { TLMConfigOptions.instance.currentLoadedCityConfig.SaveAsDefault(); TLMConfigWarehouse.GetConfig(null, null).ReloadFromDisk(); TLMConfigOptions.instance.ReloadData(); }); group9.AddButton(Locale.Get("K45_TLM_LOAD_DEFAULT_AS_CURRENT_CITY_CONFIG"), () => { TLMConfigOptions.instance.currentLoadedCityConfig.LoadFromDefault(); TLMConfigWarehouse.GetConfig(null, null).ReloadFromDisk(); TLMConfigOptions.instance.ReloadData(); }); } }
private void Awake() { parent = GetComponentInParent <UIComponent>(); var group14 = new UIHelperExtension(parent.GetComponentInChildren <UIScrollablePanel>()); ((UIScrollablePanel)group14.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)group14.Self).wrapLayout = true; ((UIScrollablePanel)group14.Self).width = 730; group14.AddLabel(Locale.Get("K45_TLM_AUTO_NAME_SETTINGS_OTHER")); group14.AddSpace(1); group14.AddLabel(Locale.Get("K45_TLM_AUTO_NAME_SETTINGS_PUBLIC_TRANSPORT_DESC")); group14.AddSpace(15); foreach (var service in TLMStationUtils.GetUsableServiceInAutoName()) { AddCheckbox(service.ToString(), out UICheckBox check, group14, (x) => TLMBaseConfigXML.Instance.GetAutoNameData(service).UseInAutoName = x); AddTextField(Locale.Get("K45_TLM_PREFIX_BUILDING_NAMES"), out UITextField textField, group14, (x) => TLMBaseConfigXML.Instance.GetAutoNameData(service).NamingPrefix = x); m_checks[service] = check; m_textFields[service] = textField; group14.AddSpace(5); } }
private void Awake() { parent = GetComponentInParent <UIComponent>(); UIHelperExtension group7 = new UIHelperExtension(parent.GetComponentInChildren <UIScrollablePanel>()); ((UIScrollablePanel)group7.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)group7.Self).wrapLayout = true; ((UIScrollablePanel)group7.Self).width = 730; group7.AddLabel(Locale.Get("K45_TLM_NEAR_LINES_CONFIG")); group7.AddSpace(15); group7.AddCheckbox(Locale.Get("K45_TLM_NEAR_LINES_SHOW_IN_SERVICES_BUILDINGS"), TransportLinesManagerMod.ShowNearLinesPlop, toggleShowNearLinesInCityServicesWorldInfoPanel); group7.AddCheckbox(Locale.Get("K45_TLM_NEAR_LINES_SHOW_IN_ZONED_BUILDINGS"), TransportLinesManagerMod.ShowNearLinesGrow, toggleShowNearLinesInZonedBuildingWorldInfoPanel); }
private void Awake() { parent = GetComponentInParent <UIComponent>(); UIHelperExtension group7 = new UIHelperExtension(parent.GetComponentInChildren <UIScrollablePanel>()); ((UIScrollablePanel)group7.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIScrollablePanel)group7.Self).wrapLayout = true; ((UIScrollablePanel)group7.Self).width = 730; group7.AddLabel(Locale.Get("K45_TLM_AUTOMATION_CONFIG")); group7.AddSpace(15); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_AUTO_COLOR_ENABLED"), TLMConfigWarehouse.ConfigIndex.AUTO_COLOR_ENABLED); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_AUTO_NAME_ENABLED"), TLMConfigWarehouse.ConfigIndex.AUTO_NAME_ENABLED); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_USE_CIRCULAR_AUTO_NAME"), TLMConfigWarehouse.ConfigIndex.CIRCULAR_IN_SINGLE_DISTRICT_LINE); TLMConfigOptions.instance.generateCheckboxConfig(group7, Locale.Get("K45_TLM_ADD_LINE_NUMBER_AUTO_NAME"), TLMConfigWarehouse.ConfigIndex.ADD_LINE_NUMBER_IN_AUTONAME); }
private void Awake() { instance = this; mainPanel = GetComponent <UIPanel>(); mainPanel.autoLayout = true; mainPanel.autoLayoutDirection = LayoutDirection.Vertical; m_uiHelper = new UIHelperExtension(mainPanel); var transportType = m_tsd.ToConfigIndex(); m_uiHelper.AddLabel(string.Format(Locale.Get("K45_TLM_CONFIGS_FOR"), TLMConfigWarehouse.getNameForTransportType(transportType))); UIPanel panel = m_uiHelper.Self.GetComponentInParent <UIPanel>(); ((UIPanel)m_uiHelper.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)m_uiHelper.Self).backgroundSprite = KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_MenuPanel_color); ((UIPanel)m_uiHelper.Self).wrapLayout = true; ((UIPanel)m_uiHelper.Self).padding = new RectOffset(10, 10, 10, 15); ((UIPanel)m_uiHelper.Self).color = TLMConfigWarehouse.getColorForTransportType(transportType); ((UIPanel)m_uiHelper.Self).width = 730; m_uiHelper.AddSpace(30); prefixDD = m_tlmCo.generateDropdownConfig(m_uiHelper, Locale.Get("K45_TLM_PREFIX"), m_tlmCo.namingOptionsPrefixo, transportType | TLMConfigWarehouse.ConfigIndex.PREFIX); separatorContainer = m_tlmCo.generateDropdownConfig(m_uiHelper, Locale.Get("K45_TLM_SEPARATOR"), m_tlmCo.namingOptionsSeparador, transportType | TLMConfigWarehouse.ConfigIndex.SEPARATOR).transform.parent.GetComponent <UIPanel>(); suffixDD = m_tlmCo.generateDropdownConfig(m_uiHelper, Locale.Get("K45_TLM_SUFFIX"), m_tlmCo.namingOptionsSufixo, transportType | TLMConfigWarehouse.ConfigIndex.SUFFIX); suffixDDContainer = suffixDD.transform.parent.GetComponent <UIPanel>(); nonPrefixDD = m_tlmCo.generateDropdownConfig(m_uiHelper, Locale.Get("K45_TLM_IDENTIFIER_NON_PREFIXED"), m_tlmCo.namingOptionsSufixo, transportType | TLMConfigWarehouse.ConfigIndex.NON_PREFIX); paletteContainer = m_tlmCo.generateDropdownStringValueConfig(m_uiHelper, Locale.Get("K45_TLM_PALETTE"), TLMAutoColorPalettes.paletteList, transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_MAIN).transform.parent.GetComponent <UIPanel>(); m_tlmCo.generateDropdownEnumStringValueConfig <LineIconSpriteNames>(m_uiHelper, Locale.Get("K45_TLM_ICON"), TLMLineIconExtension.getDropDownOptions(), transportType | TLMConfigWarehouse.ConfigIndex.TRANSPORT_ICON_TLM); zerosContainer = m_tlmCo.generateCheckboxConfig(m_uiHelper, Locale.Get("K45_TLM_LEADING_ZEROS_SUFFIX"), transportType | TLMConfigWarehouse.ConfigIndex.LEADING_ZEROS); prefixAsSuffixContainer = m_tlmCo.generateCheckboxConfig(m_uiHelper, Locale.Get("K45_TLM_INVERT_PREFIX_SUFFIX_ORDER"), transportType | TLMConfigWarehouse.ConfigIndex.INVERT_PREFIX_SUFFIX); m_tlmCo.generateCheckboxConfig(m_uiHelper, Locale.Get("K45_TLM_RANDOM_ON_PALETTE_OVERFLOW"), transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_RANDOM_ON_OVERFLOW); autoColorBasedContainer = m_tlmCo.generateCheckboxConfig(m_uiHelper, Locale.Get("K45_TLM_AUTO_COLOR_BASED_ON_PREFIX"), transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_PREFIX_BASED); prefixIncrement = m_tlmCo.generateCheckboxConfig(m_uiHelper, Locale.Get("K45_TLM_LINENUMBERING_BASED_IN_PREFIX"), transportType | TLMConfigWarehouse.ConfigIndex.PREFIX_INCREMENT); prefixDD.eventSelectedIndexChanged += OnPrefixOptionChange; suffixDD.eventSelectedIndexChanged += OnSuffixOptionChange; OnPrefixOptionChange(prefixDD, prefixDD.selectedIndex); }
public void Awake() { isLoading = true; MainContainer = GetComponent <UIPanel>(); MainContainer.autoLayout = true; MainContainer.autoLayoutDirection = LayoutDirection.Vertical; MainContainer.autoLayoutPadding = new RectOffset(0, 0, 2, 2); m_uiHelperDistrict = new UIHelperExtension(MainContainer); m_cachedDistricts = DistrictUtils.GetValidDistricts(); AddDropdown(Locale.Get("K45_ADR_DISTRICT_TITLE"), out m_selectDistrict, m_uiHelperDistrict, m_cachedDistricts.Keys.OrderBy(x => x).ToArray(), OnDistrictSelect); m_uiHelperDistrict.AddSpace(30); AddDropdown(Locale.Get("K45_ADR_DISTRICT_NAME_FILE"), out m_roadNameFile, m_uiHelperDistrict, new string[0], OnChangeSelectedRoadName); AddButtonInEditorRow(m_roadNameFile, Commons.UI.SpriteNames.CommonsSpriteNames.K45_Reload, ReloadOptionsRoad, "K45_ADR_ROAD_NAME_FILES_RELOAD"); AddDropdown(Locale.Get("K45_ADR_STREETS_PREFIXES_NAME_FILE"), out m_prefixesFile, m_uiHelperDistrict, new string[0], OnChangeSelectedRoadPrefix); AddButtonInEditorRow(m_prefixesFile, Commons.UI.SpriteNames.CommonsSpriteNames.K45_Reload, ReloadOptionsRoadPrefix, "K45_ADR_STREETS_PREFIXES_FILES_RELOAD"); AddIntField(Locale.Get("K45_ADR_DISTRICT_POSTAL_CODE"), out m_prefixPostalCodeDistrict, m_uiHelperDistrict, OnChangePostalCodePrefixDistrict, false); AddButtonInEditorRow(m_prefixPostalCodeDistrict, Commons.UI.SpriteNames.CommonsSpriteNames.K45_Delete, ResetPostalCode, "K45_ADR_RESET_POSTAL_CODE", false, 30); m_prefixPostalCodeDistrict.maxLength = 3; AddColorField(m_uiHelperDistrict, Locale.Get("K45_ADR_DISTRICT_COLOR"), out m_colorDistrict, (y) => OnChangeDistrictColor(y)); m_colorDistrict.width = 30; m_colorDistrict.height = 30; ReloadDistricts(); }
internal void LoadSettingsUI(UIHelperExtension helper) { try { foreach (Transform child in helper.self.transform) { GameObject.Destroy(child.gameObject); } } catch { } if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("Loading Options"); } loadTLMLocale(false); string[] namingOptionsSufixo = new string[] { Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 0)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 1)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 2)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 3)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 4)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 5)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 6)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 14)) }; string[] namingOptionsPrefixo = new string[] { Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 0)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 1)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 2)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 3)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 4)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 5)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 6)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 7)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 8)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 9)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 10)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 11)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 12)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 13)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 14)) }; string[] namingOptionsSeparador = new string[] { Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 0)), Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 1)), Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 2)), Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 3)), Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 4)), Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 5)), }; helper.self.eventVisibilityChanged += delegate(UIComponent component, bool b) { if (b) { showVersionInfoPopup(); } }; overrideWorldInfoPanelLineOption = (UICheckBox)helper.AddCheckboxLocale("TLM_OVERRIDE_DEFAULT_LINE_INFO", m_savedOverrideDefaultLineInfoPanel.value, toggleOverrideDefaultLineInfoPanel); helper.AddSpace(10); configSelector = (UIDropDown)helper.AddDropdownLocalized("TLM_SHOW_CONFIG_FOR", optionsForLoadConfig, 0, reloadData); if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("Loading Group 1"); } foreach (TLMConfigWarehouse.ConfigIndex transportType in new TLMConfigWarehouse.ConfigIndex[] { TLMConfigWarehouse.ConfigIndex.PLANE_CONFIG, TLMConfigWarehouse.ConfigIndex.BLIMP_CONFIG, TLMConfigWarehouse.ConfigIndex.SHIP_CONFIG, TLMConfigWarehouse.ConfigIndex.FERRY_CONFIG, TLMConfigWarehouse.ConfigIndex.BUS_CONFIG, TLMConfigWarehouse.ConfigIndex.TRAM_CONFIG, TLMConfigWarehouse.ConfigIndex.MONORAIL_CONFIG, TLMConfigWarehouse.ConfigIndex.METRO_CONFIG, TLMConfigWarehouse.ConfigIndex.TRAIN_CONFIG, TLMConfigWarehouse.ConfigIndex.TOUR_PED_CONFIG, TLMConfigWarehouse.ConfigIndex.TOUR_BUS_CONFIG }) { UIHelperExtension group1 = helper.AddGroupExtended(string.Format(Locale.Get("TLM_CONFIGS_FOR"), TLMConfigWarehouse.getNameForTransportType(transportType))); lineTypesPanels[transportType] = group1.self.GetComponentInParent <UIPanel>(); ((UIPanel)group1.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)group1.self).backgroundSprite = "EmptySprite"; ((UIPanel)group1.self).wrapLayout = true; var systemColor = TLMConfigWarehouse.getColorForTransportType(transportType); ((UIPanel)group1.self).color = new Color32((byte)(systemColor.r * 0.7f), (byte)(systemColor.g * 0.7f), (byte)(systemColor.b * 0.7f), 0xff); ((UIPanel)group1.self).width = 730; group1.AddSpace(30); UIDropDown prefixDD = generateDropdownConfig(group1, Locale.Get("TLM_PREFIX"), namingOptionsPrefixo, transportType | TLMConfigWarehouse.ConfigIndex.PREFIX); var separatorContainer = generateDropdownConfig(group1, Locale.Get("TLM_SEPARATOR"), namingOptionsSeparador, transportType | TLMConfigWarehouse.ConfigIndex.SEPARATOR).transform.parent.GetComponent <UIPanel>(); UIDropDown suffixDD = generateDropdownConfig(group1, Locale.Get("TLM_SUFFIX"), namingOptionsSufixo, transportType | TLMConfigWarehouse.ConfigIndex.SUFFIX); var suffixDDContainer = suffixDD.transform.parent.GetComponent <UIPanel>(); UIDropDown nonPrefixDD = generateDropdownConfig(group1, Locale.Get("TLM_IDENTIFIER_NON_PREFIXED"), namingOptionsSufixo, transportType | TLMConfigWarehouse.ConfigIndex.NON_PREFIX); var prefixedPaletteContainer = generateDropdownStringValueConfig(group1, Locale.Get("TLM_PALETTE_PREFIXED"), TLMAutoColorPalettes.paletteList, transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_MAIN).transform.parent.GetComponent <UIPanel>(); var paletteLabel = generateDropdownStringValueConfig(group1, Locale.Get("TLM_PALETTE_UNPREFIXED"), TLMAutoColorPalettes.paletteList, transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_SUBLINE).transform.parent.GetComponentInChildren <UILabel>(); var zerosContainer = generateCheckboxConfig(group1, Locale.Get("TLM_LEADING_ZEROS_SUFFIX"), transportType | TLMConfigWarehouse.ConfigIndex.LEADING_ZEROS); var prefixAsSuffixContainer = generateCheckboxConfig(group1, Locale.Get("TLM_INVERT_PREFIX_SUFFIX_ORDER"), transportType | TLMConfigWarehouse.ConfigIndex.INVERT_PREFIX_SUFFIX); generateCheckboxConfig(group1, Locale.Get("TLM_RANDOM_ON_PALETTE_OVERFLOW"), transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_RANDOM_ON_OVERFLOW); var autoColorBasedContainer = generateCheckboxConfig(group1, Locale.Get("TLM_AUTO_COLOR_BASED_ON_PREFIX"), transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_PREFIX_BASED); var prefixIncrement = generateCheckboxConfig(group1, Locale.Get("TLM_LINENUMBERING_BASED_IN_PREFIX"), transportType | TLMConfigWarehouse.ConfigIndex.PREFIX_INCREMENT); PropertyChangedEventHandler <int> updateFunction = delegate(UIComponent c, int sel) { bool isPrefixed = (ModoNomenclatura)sel != ModoNomenclatura.Nenhum; separatorContainer.isVisible = isPrefixed; prefixedPaletteContainer.isVisible = isPrefixed; prefixIncrement.isVisible = isPrefixed; suffixDDContainer.isVisible = isPrefixed; zerosContainer.isVisible = isPrefixed && (ModoNomenclatura)suffixDD.selectedIndex == ModoNomenclatura.Numero; prefixAsSuffixContainer.isVisible = isPrefixed && (ModoNomenclatura)suffixDD.selectedIndex == ModoNomenclatura.Numero && (ModoNomenclatura)prefixDD.selectedIndex != ModoNomenclatura.Numero; autoColorBasedContainer.isVisible = isPrefixed; paletteLabel.text = isPrefixed ? Locale.Get("TLM_PALETTE_UNPREFIXED") : Locale.Get("TLM_PALETTE"); }; prefixDD.eventSelectedIndexChanged += updateFunction; suffixDD.eventSelectedIndexChanged += delegate(UIComponent c, int sel) { bool isPrefixed = (ModoNomenclatura)prefixDD.selectedIndex != ModoNomenclatura.Nenhum; zerosContainer.isVisible = isPrefixed && (ModoNomenclatura)sel == ModoNomenclatura.Numero; prefixAsSuffixContainer.isVisible = isPrefixed && (ModoNomenclatura)sel == ModoNomenclatura.Numero && (ModoNomenclatura)prefixDD.selectedIndex != ModoNomenclatura.Numero; }; updateFunction.Invoke(null, prefixDD.selectedIndex); } UIHelperExtension group72 = helper.AddGroupExtended(Locale.Get("TLM_DEFAULT_PRICE")); ((UIPanel)group72.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)group72.self).wrapLayout = true; ((UIPanel)group72.self).width = 730; foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.configurableTicketTransportCategories) { var textField = generateNumberFieldConfig(group72, TLMConfigWarehouse.getNameForTransportType(ci), TLMConfigWarehouse.ConfigIndex.DEFAULT_TICKET_PRICE | ci); var textFieldPanel = textField.GetComponentInParent <UIPanel>(); textFieldPanel.autoLayoutDirection = LayoutDirection.Horizontal; textFieldPanel.autoFitChildrenVertically = true; textFieldPanel.GetComponentInChildren <UILabel>().minimumSize = new Vector2(420, 0); group72.AddSpace(2); } if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("Loading Group 2"); } UIHelperExtension group7 = helper.AddGroupExtended(Locale.Get("TLM_NEAR_LINES_CONFIG")); group7.AddCheckbox(Locale.Get("TLM_NEAR_LINES_SHOW_IN_SERVICES_BUILDINGS"), m_savedShowNearLinesInCityServicesWorldInfoPanel.value, toggleShowNearLinesInCityServicesWorldInfoPanel); group7.AddCheckbox(Locale.Get("TLM_NEAR_LINES_SHOW_IN_ZONED_BUILDINGS"), m_savedShowNearLinesInZonedBuildingWorldInfoPanel.value, toggleShowNearLinesInZonedBuildingWorldInfoPanel); group7.AddSpace(20); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_BUS"), TLMConfigWarehouse.ConfigIndex.BUS_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_METRO"), TLMConfigWarehouse.ConfigIndex.METRO_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TRAIN"), TLMConfigWarehouse.ConfigIndex.TRAIN_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_SHIP"), TLMConfigWarehouse.ConfigIndex.SHIP_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_PLANE"), TLMConfigWarehouse.ConfigIndex.PLANE_SHOW_IN_LINEAR_MAP); if (Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.AfterDark)) { generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TAXI"), TLMConfigWarehouse.ConfigIndex.TAXI_SHOW_IN_LINEAR_MAP); } if (Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.Snowfall)) { generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TRAM"), TLMConfigWarehouse.ConfigIndex.TRAM_SHOW_IN_LINEAR_MAP); } if (Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.NaturalDisasters)) { generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_EVAC_BUS"), TLMConfigWarehouse.ConfigIndex.EVAC_BUS_SHOW_IN_LINEAR_MAP); } if (Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.InMotion)) { generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_FERRY"), TLMConfigWarehouse.ConfigIndex.FERRY_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_BLIMP"), TLMConfigWarehouse.ConfigIndex.BLIMP_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_MONORAIL"), TLMConfigWarehouse.ConfigIndex.MONORAIL_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_CABLE_CAR"), TLMConfigWarehouse.ConfigIndex.CABLE_CAR_SHOW_IN_LINEAR_MAP); } if (Singleton <LoadingManager> .instance.SupportsExpansion(ICities.Expansion.Parks)) { generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TOUR_BUS"), TLMConfigWarehouse.ConfigIndex.TOUR_BUS_CONFIG_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TOUR_PED"), TLMConfigWarehouse.ConfigIndex.TOUR_PED_CONFIG_SHOW_IN_LINEAR_MAP); } UIHelperExtension group8 = helper.AddGroupExtended(Locale.Get("TLM_AUTOMATION_CONFIG")); generateCheckboxConfig(group8, Locale.Get("TLM_AUTO_COLOR_ENABLED"), TLMConfigWarehouse.ConfigIndex.AUTO_COLOR_ENABLED); generateCheckboxConfig(group8, Locale.Get("TLM_AUTO_NAME_ENABLED"), TLMConfigWarehouse.ConfigIndex.AUTO_NAME_ENABLED); generateCheckboxConfig(group8, Locale.Get("TLM_USE_CIRCULAR_AUTO_NAME"), TLMConfigWarehouse.ConfigIndex.CIRCULAR_IN_SINGLE_DISTRICT_LINE); generateCheckboxConfig(group8, Locale.Get("TLM_ADD_LINE_NUMBER_AUTO_NAME"), TLMConfigWarehouse.ConfigIndex.ADD_LINE_NUMBER_IN_AUTONAME); UIHelperExtension group13 = helper.AddGroupExtended(Locale.Get("TLM_AUTO_NAME_SETTINGS_PUBLIC_TRANSPORT")); ((UIPanel)group13.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)group13.self).wrapLayout = true; ((UIPanel)group13.self).width = 730; group13.AddSpace(1); group13.AddLabel(Locale.Get("TLM_AUTO_NAME_SETTINGS_PUBLIC_TRANSPORT_DESC")); group13.AddSpace(1); foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.configurableAutoNameTransportCategories) { generateCheckboxConfig(group13, TLMConfigWarehouse.getNameForTransportType(ci), TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_USE_FOR_AUTO_NAMING_REF | ci).width = 300; var textFieldPanel = generateTextFieldConfig(group13, Locale.Get("TLM_PREFIX_OPTIONAL"), TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_AUTO_NAMING_REF_TEXT | ci).GetComponentInParent <UIPanel>(); textFieldPanel.autoLayoutDirection = LayoutDirection.Horizontal; textFieldPanel.autoFitChildrenVertically = true; group13.AddSpace(1); } UIHelperExtension group14 = helper.AddGroupExtended(Locale.Get("TLM_AUTO_NAME_SETTINGS_OTHER")); ((UIPanel)group14.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)group14.self).wrapLayout = true; ((UIPanel)group14.self).width = 730; foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.configurableAutoNameCategories) { generateCheckboxConfig(group14, TLMConfigWarehouse.getNameForServiceType(ci), TLMConfigWarehouse.ConfigIndex.USE_FOR_AUTO_NAMING_REF | ci).width = 300; var textFieldPanel = generateTextFieldConfig(group14, Locale.Get("TLM_PREFIX_OPTIONAL"), TLMConfigWarehouse.ConfigIndex.AUTO_NAMING_REF_TEXT | ci).GetComponentInParent <UIPanel>(); textFieldPanel.autoLayoutDirection = LayoutDirection.Horizontal; textFieldPanel.autoFitChildrenVertically = true; group14.AddSpace(2); } UIHelperExtension group15 = helper.AddGroupExtended(Locale.Get("TLM_AUTO_NAME_SETTINGS_PUBLIC_AREAS")); ((UIPanel)group15.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)group15.self).wrapLayout = true; ((UIPanel)group15.self).width = 730; foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.extraAutoNameCategories) { generateCheckboxConfig(group15, TLMConfigWarehouse.getNameForServiceType(ci), TLMConfigWarehouse.ConfigIndex.USE_FOR_AUTO_NAMING_REF | ci).width = 300; var textFieldPanel = generateTextFieldConfig(group15, Locale.Get("TLM_PREFIX_OPTIONAL"), TLMConfigWarehouse.ConfigIndex.AUTO_NAMING_REF_TEXT | ci).GetComponentInParent <UIPanel>(); textFieldPanel.autoLayoutDirection = LayoutDirection.Horizontal; textFieldPanel.autoFitChildrenVertically = true; group15.AddSpace(2); } TLMUtils.doLog("Loading Group 3"); var fiPalette = TLMUtils.EnsureFolderCreation(TLMSingleton.palettesFolder); UIHelperExtension group6 = helper.AddGroupExtended(Locale.Get("TLM_CUSTOM_PALETTE_CONFIG")); ((group6.self) as UIPanel).autoLayoutDirection = LayoutDirection.Horizontal; ((group6.self) as UIPanel).wrapLayout = true; group6.AddLabel(Locale.Get("TLM_PALETTE_FOLDER_LABEL") + ":"); var namesFilesButton = ((UIButton)group6.AddButton("/", () => { ColossalFramework.Utils.OpenInFileBrowser(fiPalette.FullName); })); namesFilesButton.textColor = Color.yellow; TLMUtils.LimitWidth(namesFilesButton, 710); namesFilesButton.text = fiPalette.FullName + Path.DirectorySeparatorChar; ((UIButton)group6.AddButton(Locale.Get("TLM_RELOAD_PALETTES"), delegate() { TLMAutoColorPalettes.Reload(); updateDropDowns(); })).width = 710; NumberedColorList colorList = null; editorSelector = group6.AddDropdown(Locale.Get("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_atlasToUse = TLMController.taLineNumber; colorList.m_spriteName = "SubwayIcon"; if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("Loading Group 4"); } UIHelperExtension group9 = helper.AddGroupExtended(Locale.Get("TLM_BETAS_EXTRA_INFO")); group9.AddDropdownLocalized("TLM_MOD_LANG", TLMLocaleUtils.getLanguageIndex(), currentLanguageId.value, delegate(int idx) { currentLanguageId.value = idx; loadTLMLocale(true); }); group9.AddButton(Locale.Get("TLM_DRAW_CITY_MAP"), TLMMapDrawer.drawCityMap); group9.AddCheckbox(Locale.Get("TLM_DEBUG_MODE"), m_debugMode.value, delegate(bool val) { m_debugMode.value = val; }); group9.AddLabel("Version: " + version + " rev" + typeof(TLMSingleton).Assembly.GetName().Version.Revision); group9.AddLabel(Locale.Get("TLM_ORIGINAL_KC_VERSION") + " " + string.Join(".", TLMResourceLoader.instance.loadResourceString("TLMVersion.txt").Split(".".ToCharArray()).Take(3).ToArray())); group9.AddButton(Locale.Get("TLM_RELEASE_NOTES"), delegate() { showVersionInfoPopup(true); }); if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("End Loading Options"); } }
public void Awake() { MainContainer = GetComponent <UIPanel>(); MainContainer.autoLayout = true; MainContainer.autoLayoutDirection = LayoutDirection.Horizontal; MainContainer.padding = new RectOffset(8, 8, 8, 8); KlyteMonoUtils.CreateUIElement(out m_previewPanel, MainContainer.transform, "previewPanel", new UnityEngine.Vector4(0, 0, 0, 300)); m_previewPanel.autoLayout = true; m_previewPanel.disabledColor = Color.black; KlyteMonoUtils.CreateUIElement(out UIPanel subPreviewPanel, m_previewPanel.transform, "previewSubPanel", new UnityEngine.Vector4(0, 0, MainContainer.width - 66, m_previewPanel.height)); subPreviewPanel.backgroundSprite = "GenericPanel"; subPreviewPanel.autoLayout = true; subPreviewPanel.disabledColor = Color.black; KlyteMonoUtils.CreateUIElement(out m_preview, subPreviewPanel.transform, "preview", new UnityEngine.Vector4(0, 0, subPreviewPanel.width, subPreviewPanel.height)); KlyteMonoUtils.CreateElement(out m_previewRenderer, MainContainer.transform); m_previewRenderer.Size = m_preview.size * 2f; m_preview.texture = m_previewRenderer.Texture; m_preview.eventMouseWheel += ChangeViewZoom; m_preview.eventMouseMove += OnMouseMove; m_previewRenderer.Zoom = TargetZoom; m_preview.disabledColor = Color.black; KlyteMonoUtils.CreateUIElement(out UIPanel overrideSpriteContainer, MainContainer.transform, "overrideSpriteContainer", new UnityEngine.Vector4(0, 0, MainContainer.width - 66, 300)); overrideSpriteContainer.autoLayout = true; overrideSpriteContainer.autoLayoutDirection = LayoutDirection.Horizontal; KlyteMonoUtils.CreateUIElement(out UIPanel overrideSpriteSubContainer, overrideSpriteContainer.transform, "overrideSpriteSubContainer", new UnityEngine.Vector4(0, 0, overrideSpriteContainer.width, overrideSpriteContainer.height)); overrideSpriteSubContainer.backgroundSprite = KlyteResourceLoader.GetDefaultSpriteNameFor(LineIconSpriteNames.K45_SquareIcon, true); overrideSpriteSubContainer.autoLayout = true; overrideSpriteSubContainer.autoLayoutDirection = LayoutDirection.Horizontal; OverrideSprite = overrideSpriteSubContainer.AddUIComponent <UISprite>(); OverrideSprite.size = overrideSpriteContainer.size; overrideSpriteSubContainer.isVisible = false; KlyteMonoUtils.CreateUIElement(out m_previewControls, MainContainer.transform, "controls", new UnityEngine.Vector4(0, 0, 50, 300)); m_previewControls.padding = new RectOffset(5, 5, 5, 5); m_previewControls.autoLayout = true; m_previewControls.autoLayoutDirection = LayoutDirection.Vertical; KlyteMonoUtils.InitCircledButton(m_previewControls, out m_lockToSelection, CommonsSpriteNames.K45_Unlock, (x, y) => ToggleLock(), "K45_WTS_LOCK_UNLOCK_TO_CURRENT_ITEM"); m_lockToSelection.focusedBgSprite = null; m_viewLocked = true; ToggleLock(); KlyteMonoUtils.InitCircledButton(m_previewControls, out UIButton resetView, CommonsSpriteNames.K45_Reload, (x, y) => ResetCamera(), "K45_WTS_RESET_VIEW"); UIHelperExtension.AddSpace(m_previewControls, 10); KlyteMonoUtils.InitCircledButton(m_previewControls, out UIButton useCurrentText, CommonsSpriteNames.K45_FontIcon, (x, y) => m_overrideText = null, "K45_WTS_USE_CURRENT_TEXT"); KlyteMonoUtils.InitCircledButtonText(m_previewControls, out UIButton use1lText, "x1", (x, y) => m_overrideText = "1", Locale.Get("K45_WTS_USE_1LENGHT_TEXT")); KlyteMonoUtils.InitCircledButtonText(m_previewControls, out UIButton use10lText, "x10", (x, y) => m_overrideText = "Á" + new string('X', 8) + "j", Locale.Get("K45_WTS_USE_10LENGHT_TEXT")); KlyteMonoUtils.InitCircledButtonText(m_previewControls, out UIButton use50lText, "x50", (x, y) => m_overrideText = "Á" + new string('L', 48) + "j", Locale.Get("K45_WTS_USE_50LENGHT_TEXT")); KlyteMonoUtils.InitCircledButtonText(m_previewControls, out UIButton use100lText, "x200", (x, y) => m_overrideText = "Á" + new string('C', 198) + "j", Locale.Get("K45_WTS_USE_200LENGHT_TEXT")); WTSPropLayoutEditor.Instance.CurrentTabChanged += (x) => ResetCamera(); }
public void Awake() { MainContainer = GetComponent <UIPanel>(); MainContainer.autoLayout = true; MainContainer.clipChildren = true; MainContainer.autoLayoutDirection = LayoutDirection.Vertical; MainContainer.autoLayoutPadding = new RectOffset(0, 0, 4, 4); KlyteMonoUtils.CreateTabsComponent(out m_tabstrip, out UITabContainer m_tabContainer, MainContainer.transform, "TextEditor", new Vector4(0, 0, MainContainer.width, 40), new Vector4(0, 0, MainContainer.width, MainContainer.height - 40)); UIPanel m_tabSettings = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Settings), "K45_ACE_BASICTAB_BASIC_SETTINGS", "RcSettings"); UIPanel m_tabAppearence = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoColorIcon), "K45_ACE_BASICTAB_APPEARANCE_SETTINGS", "RcAppearence"); UIPanel m_tabLib = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Load), "K45_ACE_BASICTAB_LIB_SETTINGS", "RcLib"); var helperSettings = new UIHelperExtension(m_tabSettings, LayoutDirection.Vertical); var helperAppearence = new UIHelperExtension(m_tabAppearence, LayoutDirection.Vertical); var helperLib = new UIHelperExtension(m_tabLib, LayoutDirection.Vertical); AddTextField(Locale.Get("K45_ACE_BASICTAB_NAME"), out m_name, helperSettings, OnSetName); helperSettings.AddSpace(5); AddDropdown(Locale.Get("K45_ACE_BASICTAB_RULEFILTER"), out m_ruleFilter, helperSettings, Enum.GetNames(typeof(RuleCheckTypeVehicle)).Select(x => Locale.Get("K45_ACE_RULECHECKTYPE", x)).ToArray(), OnChangeRuleCheckType); AddButtonInEditorRow(m_ruleFilter, CommonsSpriteNames.K45_QuestionMark, Help_RuleFilter); AddDropdown(Locale.Get("K45_ACE_BASICTAB_SERVICEFILTER"), out m_service, helperSettings, (Enum.GetValues(typeof(ItemClass.Service)) as ItemClass.Service[]).OrderBy(x => (int)x).Select(x => x == 0 ? Locale.Get("K45_ACE_ANYSERVICE_OPTION") : $"{x}").ToArray(), OnChangeServiceFilter); AddDropdown(Locale.Get("K45_ACE_BASICTAB_SUBSERVICEFILTER"), out m_subService, helperSettings, Enum.GetNames(typeof(ItemClass.SubService)).Select(x => $"{x}").ToArray(), OnChangeSubServiceFilter); AddDropdown(Locale.Get("K45_ACE_BASICTAB_LEVELFILTER"), out m_level, helperSettings, (Enum.GetValues(typeof(ItemClass.Level)) as ItemClass.Level[]).OrderBy(x => (int)x).Select(x => $"{x}").ToArray(), OnChangeLevelFilter); AddDropdown(Locale.Get("K45_ACE_BASICTAB_CLASSFILTER"), out m_class, helperSettings, new string[0], OnChangeClassFilter); AddTextField(Locale.Get("K45_ACE_VEHICLERULES_ASSETSELECTSELF"), out m_assetFilterSelf, helperSettings, null); KlyteMonoUtils.UiTextFieldDefaultsForm(m_assetFilterSelf); m_popupSelf = ConfigureListSelectionPopupForUITextField(m_assetFilterSelf, (text) => AssetColorExpanderMod.Controller?.AssetsCache.FilterVehiclesByText(text), OnAssetSelectedSelfChanged); m_popupSelf.height = 290; m_popupSelf.width -= 20; AddTextField(Locale.Get("K45_ACE_VEHICLERULES_ASSETSELECTOWNER"), out m_assetFilterOwner, helperSettings, null); KlyteMonoUtils.UiTextFieldDefaultsForm(m_assetFilterOwner); m_popupOwner = ConfigureListSelectionPopupForUITextField(m_assetFilterOwner, (text) => AssetColorExpanderMod.Controller?.AssetsCache.FilterBuildingsByText(text), OnAssetSelectedOwnerChanged); m_popupOwner.height = 290; m_popupOwner.width -= 20; ACECommonsUI.GenerateExportButtons(helperSettings, "Vehicle", out m_exportButtonContainer, out m_exportButton, OnExport, out m_exportButtonContainerLocal, out m_exportButtonLocal, OnExportLocal); AddLibBox <ACEVehcileRuleLib, VehicleCityDataRuleXml>(helperLib, out m_copySettings, OnCopyRule, out m_pasteSettings, OnPasteRule, out _, null, OnLoadRule, GetRuleSerialized); AddCheckboxLocale("K45_ACE_VEHICLERULES_ALLOWWAGONWITHDIFFERENTCOLORS", out m_allowWagonDifferentColors, helperAppearence, OnAllowWagonDifferentColors); AddCheckboxLocale("K45_ACE_VEHICLERULES_OVERRIDELINEPREFIXCOLOR", out m_overrideLineColor, helperAppearence, OnOverrideLineColorChange); AddDropdown(Locale.Get("K45_ACE_COLORMODE"), out m_colorMode, helperAppearence, Enum.GetNames(typeof(ColoringMode)).Select(x => Locale.Get("K45_ACE_COLORINGMODE", x)).ToArray(), OnChangeColoringMode); AddButtonInEditorRow(m_colorMode, CommonsSpriteNames.K45_QuestionMark, Help_ColorMode); AddCheckboxLocale("K45_ACE_COLORMODE_ALLOWREDTONES", out m_allowRed, helperAppearence, OnAllowRedChanged); AddCheckboxLocale("K45_ACE_COLORMODE_ALLOWGREENTONES", out m_allowGreen, helperAppearence, OnAllowGreenChanged); AddCheckboxLocale("K45_ACE_COLORMODE_ALLOWBLUETONES", out m_allowBlues, helperAppearence, OnAllowBlueChanged); AddCheckboxLocale("K45_ACE_COLORMODE_ALLOWNEUTRALTONES", out m_allowNeutral, helperAppearence, OnAllowNeutralChanged); KlyteMonoUtils.CreateUIElement(out m_listColorContainer, helperAppearence.Self.transform, "listColors", new UnityEngine.Vector4(0, 0, helperAppearence.Self.width, helperAppearence.Self.height - 120)); KlyteMonoUtils.CreateScrollPanel(m_listColorContainer, out m_colorListScroll, out _, m_listColorContainer.width - 20, m_listColorContainer.height); m_colorListScroll.backgroundSprite = "OptionsScrollbarTrack"; m_colorListScroll.autoLayout = true; m_colorListScroll.autoLayoutDirection = LayoutDirection.Horizontal; m_colorListScroll.wrapLayout = true; CreateTemplateColorItem(); m_colorFieldTemplateListColors = new UITemplateList <UIPanel>(m_colorListScroll, COLOR_SELECTOR_TEMPLATE); KlyteMonoUtils.InitCircledButton(m_colorListScroll, out m_addColor, CommonsSpriteNames.K45_Plus, (x, y) => AddColor(), "", 36); MainContainer.isVisible = false; m_pasteSettings.isVisible = false; }
internal void LoadSettingsUI(UIHelperExtension helper) { try { foreach (Transform child in helper.self.transform) { GameObject.Destroy(child.gameObject); } } catch { } if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("Loading Options"); } loadTLMLocale(false); string[] namingOptionsSufixo = new string[] { Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 0)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 1)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 2)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 3)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 4)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 5)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 6)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 14)) }; string[] namingOptionsPrefixo = new string[] { Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 0)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 1)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 2)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 3)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 4)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 5)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 6)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 7)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 8)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 9)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 10)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 11)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 12)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 13)), Locale.Get("TLM_MODO_NOMENCLATURA", Enum.GetName(typeof(ModoNomenclatura), 14)) }; string[] namingOptionsSeparador = new string[] { Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 0)), Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 1)), Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 2)), Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 3)), Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 4)), Locale.Get("TLM_SEPARATOR", Enum.GetName(typeof(Separador), 5)), }; helper.self.eventVisibilityChanged += delegate(UIComponent component, bool b) { if (b) { showVersionInfoPopup(); } }; overrideWorldInfoPanelLineOption = (UICheckBox)helper.AddCheckboxLocale("TLM_OVERRIDE_DEFAULT_LINE_INFO", m_savedOverrideDefaultLineInfoPanel.value, toggleOverrideDefaultLineInfoPanel); helper.AddSpace(10); configSelector = (UIDropDown)helper.AddDropdownLocalized("TLM_SHOW_CONFIG_FOR", optionsForLoadConfig, 0, reloadData); if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("Loading Group 1"); } foreach (TLMConfigWarehouse.ConfigIndex transportType in new TLMConfigWarehouse.ConfigIndex[] { TLMConfigWarehouse.ConfigIndex.PLANE_CONFIG, TLMConfigWarehouse.ConfigIndex.BLIMP_CONFIG, TLMConfigWarehouse.ConfigIndex.SHIP_CONFIG, TLMConfigWarehouse.ConfigIndex.FERRY_CONFIG, TLMConfigWarehouse.ConfigIndex.BUS_CONFIG, TLMConfigWarehouse.ConfigIndex.TRAM_CONFIG, TLMConfigWarehouse.ConfigIndex.MONORAIL_CONFIG, TLMConfigWarehouse.ConfigIndex.METRO_CONFIG, TLMConfigWarehouse.ConfigIndex.TRAIN_CONFIG }) { UIHelperExtension group1 = helper.AddGroupExtended(string.Format(Locale.Get("TLM_CONFIGS_FOR"), TLMConfigWarehouse.getNameForTransportType(transportType))); lineTypesPanels[transportType] = group1.self.GetComponentInParent <UIPanel>(); ((UIPanel)group1.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)group1.self).backgroundSprite = "EmptySprite"; ((UIPanel)group1.self).wrapLayout = true; var systemColor = TLMConfigWarehouse.getColorForTransportType(transportType); ((UIPanel)group1.self).color = new Color32((byte)(systemColor.r * 0.7f), (byte)(systemColor.g * 0.7f), (byte)(systemColor.b * 0.7f), 0xff); ((UIPanel)group1.self).width = 730; group1.AddSpace(30); UIDropDown prefixDD = generateDropdownConfig(group1, Locale.Get("TLM_PREFIX"), namingOptionsPrefixo, transportType | TLMConfigWarehouse.ConfigIndex.PREFIX); var separatorContainer = generateDropdownConfig(group1, Locale.Get("TLM_SEPARATOR"), namingOptionsSeparador, transportType | TLMConfigWarehouse.ConfigIndex.SEPARATOR).transform.parent.GetComponent <UIPanel>(); UIDropDown suffixDD = generateDropdownConfig(group1, Locale.Get("TLM_SUFFIX"), namingOptionsSufixo, transportType | TLMConfigWarehouse.ConfigIndex.SUFFIX); var suffixDDContainer = suffixDD.transform.parent.GetComponent <UIPanel>(); UIDropDown nonPrefixDD = generateDropdownConfig(group1, Locale.Get("TLM_IDENTIFIER_NON_PREFIXED"), namingOptionsSufixo, transportType | TLMConfigWarehouse.ConfigIndex.NON_PREFIX); var prefixedPaletteContainer = generateDropdownStringValueConfig(group1, Locale.Get("TLM_PALETTE_PREFIXED"), TLMAutoColorPalettes.paletteList, transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_MAIN).transform.parent.GetComponent <UIPanel>(); var paletteLabel = generateDropdownStringValueConfig(group1, Locale.Get("TLM_PALETTE_UNPREFIXED"), TLMAutoColorPalettes.paletteList, transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_SUBLINE).transform.parent.GetComponentInChildren <UILabel>(); var zerosContainer = generateCheckboxConfig(group1, Locale.Get("TLM_LEADING_ZEROS_SUFFIX"), transportType | TLMConfigWarehouse.ConfigIndex.LEADING_ZEROS); var prefixAsSuffixContainer = generateCheckboxConfig(group1, Locale.Get("TLM_INVERT_PREFIX_SUFFIX_ORDER"), transportType | TLMConfigWarehouse.ConfigIndex.INVERT_PREFIX_SUFFIX); generateCheckboxConfig(group1, Locale.Get("TLM_RANDOM_ON_PALETTE_OVERFLOW"), transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_RANDOM_ON_OVERFLOW); var autoColorBasedContainer = generateCheckboxConfig(group1, Locale.Get("TLM_AUTO_COLOR_BASED_ON_PREFIX"), transportType | TLMConfigWarehouse.ConfigIndex.PALETTE_PREFIX_BASED); var prefixIncrement = generateCheckboxConfig(group1, Locale.Get("TLM_LINENUMBERING_BASED_IN_PREFIX"), transportType | TLMConfigWarehouse.ConfigIndex.PREFIX_INCREMENT); PropertyChangedEventHandler <int> updateFunction = delegate(UIComponent c, int sel) { bool isPrefixed = (ModoNomenclatura)sel != ModoNomenclatura.Nenhum; separatorContainer.isVisible = isPrefixed; prefixedPaletteContainer.isVisible = isPrefixed; prefixIncrement.isVisible = isPrefixed; suffixDDContainer.isVisible = isPrefixed; zerosContainer.isVisible = isPrefixed && (ModoNomenclatura)suffixDD.selectedIndex == ModoNomenclatura.Numero; prefixAsSuffixContainer.isVisible = isPrefixed && (ModoNomenclatura)suffixDD.selectedIndex == ModoNomenclatura.Numero && (ModoNomenclatura)prefixDD.selectedIndex != ModoNomenclatura.Numero; autoColorBasedContainer.isVisible = isPrefixed; paletteLabel.text = isPrefixed ? Locale.Get("TLM_PALETTE_UNPREFIXED") : Locale.Get("TLM_PALETTE"); if (TLMPublicTransportDetailPanel.instance != null && TLMPublicTransportDetailPanel.instance.prefixEditor.m_systemTypeDropDown != null) { TLMPublicTransportDetailPanel.instance.prefixEditor.m_systemTypeDropDown.selectedIndex = 0; } }; prefixDD.eventSelectedIndexChanged += updateFunction; suffixDD.eventSelectedIndexChanged += delegate(UIComponent c, int sel) { bool isPrefixed = (ModoNomenclatura)prefixDD.selectedIndex != ModoNomenclatura.Nenhum; zerosContainer.isVisible = isPrefixed && (ModoNomenclatura)sel == ModoNomenclatura.Numero; prefixAsSuffixContainer.isVisible = isPrefixed && (ModoNomenclatura)sel == ModoNomenclatura.Numero && (ModoNomenclatura)prefixDD.selectedIndex != ModoNomenclatura.Numero; }; updateFunction.Invoke(null, prefixDD.selectedIndex); } if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("Loading Group 2"); } UIHelperExtension group7 = helper.AddGroupExtended(Locale.Get("TLM_NEAR_LINES_CONFIG")); group7.AddCheckbox(Locale.Get("TLM_NEAR_LINES_SHOW_IN_SERVICES_BUILDINGS"), m_savedShowNearLinesInCityServicesWorldInfoPanel.value, toggleShowNearLinesInCityServicesWorldInfoPanel); group7.AddCheckbox(Locale.Get("TLM_NEAR_LINES_SHOW_IN_ZONED_BUILDINGS"), m_savedShowNearLinesInZonedBuildingWorldInfoPanel.value, toggleShowNearLinesInZonedBuildingWorldInfoPanel); group7.AddSpace(20); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_BUS"), TLMConfigWarehouse.ConfigIndex.BUS_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TRAM"), TLMConfigWarehouse.ConfigIndex.TRAM_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_METRO"), TLMConfigWarehouse.ConfigIndex.METRO_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TRAIN"), TLMConfigWarehouse.ConfigIndex.TRAIN_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_SHIP"), TLMConfigWarehouse.ConfigIndex.SHIP_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_PLANE"), TLMConfigWarehouse.ConfigIndex.PLANE_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_FERRY"), TLMConfigWarehouse.ConfigIndex.FERRY_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_BLIMP"), TLMConfigWarehouse.ConfigIndex.BLIMP_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_TAXI"), TLMConfigWarehouse.ConfigIndex.TAXI_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_MONORAIL"), TLMConfigWarehouse.ConfigIndex.MONORAIL_SHOW_IN_LINEAR_MAP); generateCheckboxConfig(group7, Locale.Get("TLM_NEAR_LINES_SHOW_CABLE_CAR"), TLMConfigWarehouse.ConfigIndex.CABLE_CAR_SHOW_IN_LINEAR_MAP); UIHelperExtension group8 = helper.AddGroupExtended(Locale.Get("TLM_AUTOMATION_CONFIG")); generateCheckboxConfig(group8, Locale.Get("TLM_AUTO_COLOR_ENABLED"), TLMConfigWarehouse.ConfigIndex.AUTO_COLOR_ENABLED); generateCheckboxConfig(group8, Locale.Get("TLM_AUTO_NAME_ENABLED"), TLMConfigWarehouse.ConfigIndex.AUTO_NAME_ENABLED); generateCheckboxConfig(group8, Locale.Get("TLM_USE_CIRCULAR_AUTO_NAME"), TLMConfigWarehouse.ConfigIndex.CIRCULAR_IN_SINGLE_DISTRICT_LINE); generateCheckboxConfig(group8, Locale.Get("TLM_ADD_LINE_NUMBER_AUTO_NAME"), TLMConfigWarehouse.ConfigIndex.ADD_LINE_NUMBER_IN_AUTONAME); UIHelperExtension group13 = helper.AddGroupExtended(Locale.Get("TLM_AUTO_NAME_SETTINGS_PUBLIC_TRANSPORT")); ((UIPanel)group13.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)group13.self).wrapLayout = true; ((UIPanel)group13.self).width = 730; group13.AddSpace(1); group13.AddLabel(Locale.Get("TLM_AUTO_NAME_SETTINGS_PUBLIC_TRANSPORT_DESC")); group13.AddSpace(1); foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.configurableAutoNameTransportCategories) { generateCheckboxConfig(group13, TLMConfigWarehouse.getNameForTransportType(ci), TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_USE_FOR_AUTO_NAMING_REF | ci).width = 300; var textFieldPanel = generateTextFieldConfig(group13, Locale.Get("TLM_PREFIX_OPTIONAL"), TLMConfigWarehouse.ConfigIndex.PUBLICTRANSPORT_AUTO_NAMING_REF_TEXT | ci).GetComponentInParent <UIPanel>(); textFieldPanel.autoLayoutDirection = LayoutDirection.Horizontal; textFieldPanel.autoFitChildrenVertically = true; group13.AddSpace(1); } UIHelperExtension group14 = helper.AddGroupExtended(Locale.Get("TLM_AUTO_NAME_SETTINGS_OTHER")); ((UIPanel)group14.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)group14.self).wrapLayout = true; ((UIPanel)group14.self).width = 730; foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.configurableAutoNameCategories) { generateCheckboxConfig(group14, TLMConfigWarehouse.getNameForServiceType(ci), TLMConfigWarehouse.ConfigIndex.USE_FOR_AUTO_NAMING_REF | ci).width = 300; var textFieldPanel = generateTextFieldConfig(group14, Locale.Get("TLM_PREFIX_OPTIONAL"), TLMConfigWarehouse.ConfigIndex.AUTO_NAMING_REF_TEXT | ci).GetComponentInParent <UIPanel>(); textFieldPanel.autoLayoutDirection = LayoutDirection.Horizontal; textFieldPanel.autoFitChildrenVertically = true; group14.AddSpace(2); } if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("Loading Group 3"); } UIHelperExtension group6 = helper.AddGroupExtended(Locale.Get("TLM_CUSTOM_PALETTE_CONFIG") + " [" + UIHelperExtension.version + "]"); ((group6.self) as UIPanel).autoLayoutDirection = LayoutDirection.Horizontal; ((group6.self) as UIPanel).wrapLayout = true; UITextField paletteName = null; DropDownColorSelector colorEditor = null; NumberedColorList colorList = null; editorSelector = group6.AddDropdown(Locale.Get("TLM_PALETTE_SELECT"), TLMAutoColorPalettes.paletteListForEditing, 0, delegate(int sel) { if (sel <= 0 || sel >= TLMAutoColorPalettes.paletteListForEditing.Length) { paletteName.enabled = false; colorEditor.Disable(); colorList.Disable(); } else { paletteName.enabled = true; colorEditor.Disable(); colorList.colorList = TLMAutoColorPalettes.getColors(TLMAutoColorPalettes.paletteListForEditing[sel]); colorList.Enable(); paletteName.text = TLMAutoColorPalettes.paletteListForEditing[sel]; } }) as UIDropDown; group6.AddButton(Locale.Get("CREATE"), delegate() { string newName = TLMAutoColorPalettes.addPalette(); updateDropDowns("", ""); editorSelector.selectedValue = newName; }); group6.AddButton(Locale.Get("TLM_DELETE"), delegate() { TLMAutoColorPalettes.removePalette(editorSelector.selectedValue); updateDropDowns("", ""); }); paletteName = group6.AddTextField(Locale.Get("TLM_PALETTE_NAME"), delegate(string val) { }, "", (string value) => { string oldName = editorSelector.selectedValue; paletteName.text = TLMAutoColorPalettes.renamePalette(oldName, value); updateDropDowns(oldName, value); }); paletteName.parent.width = 500; colorEditor = group6.AddColorField(Locale.Get("TLM_COLORS"), Color.black, delegate(Color c) { TLMAutoColorPalettes.setColor(colorEditor.id, editorSelector.selectedValue, c); colorList.colorList = TLMAutoColorPalettes.getColors(editorSelector.selectedValue); }, delegate { TLMAutoColorPalettes.removeColor(editorSelector.selectedValue, colorEditor.id); colorList.colorList = TLMAutoColorPalettes.getColors(editorSelector.selectedValue); }); colorList = group6.AddNumberedColorList(null, new List <Color32>(), delegate(int c) { colorEditor.id = c; colorEditor.selectedColor = TLMAutoColorPalettes.getColor(c, editorSelector.selectedValue, false); colorEditor.title = c.ToString(); colorEditor.Enable(); }, colorEditor.parent.GetComponentInChildren <UILabel>(), delegate() { TLMAutoColorPalettes.addColor(editorSelector.selectedValue); }); if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("Loading Group 3½"); } paletteName.enabled = false; colorEditor.Disable(); colorList.Disable(); if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("Loading Group 4"); } UIHelperExtension group9 = helper.AddGroupExtended(Locale.Get("TLM_BETAS_EXTRA_INFO")); group9.AddDropdownLocalized("TLM_MOD_LANG", TLMLocaleUtils.getLanguageIndex(), currentLanguageId.value, delegate(int idx) { currentLanguageId.value = idx; loadTLMLocale(true); }); group9.AddButton(Locale.Get("TLM_DRAW_CITY_MAP"), TLMMapDrawer.drawCityMap); group9.AddCheckbox(Locale.Get("TLM_DEBUG_MODE"), m_debugMode.value, delegate(bool val) { m_debugMode.value = val; }); group9.AddLabel("Version: " + version + " rev" + typeof(TLMSingleton).Assembly.GetName().Version.Revision); group9.AddLabel(Locale.Get("TLM_ORIGINAL_KC_VERSION") + " " + string.Join(".", ResourceLoader.loadResourceString("TLMVersion.txt").Split(".".ToCharArray()).Take(3).ToArray())); group9.AddButton(Locale.Get("TLM_RELEASE_NOTES"), delegate() { showVersionInfoPopup(true); }); if (TLMSingleton.instance != null && TLMSingleton.debugMode) { TLMUtils.doLog("End Loading Options"); } }
public void Awake() { MainContainer = GetComponent <UIPanel>(); MainContainer.autoLayout = true; MainContainer.autoLayoutDirection = LayoutDirection.Vertical; MainContainer.autoLayoutPadding = new RectOffset(0, 0, 2, 2); m_uiHelperGlobal = new UIHelperExtension(MainContainer); CreateGroupFileSelect("K45_ADR_DISTRICT_GEN_PREFIX_FILE", OnChangeSelectedDistrictPrefix, ReloadDistrictPrefixesFiles, out m_districtPrefixGenFile); CreateGroupFileSelect("K45_ADR_DISTRICT_GEN_NAME_FILE", OnChangeSelectedDistrictName, ReloadDistrictNamesFiles, out m_districtNameGenFile); isLoading = true; AddIntField(Locale.Get("K45_ADR_DISTRICT_POSTAL_CODE"), out m_prefixPostalCodeCity, m_uiHelperGlobal, OnChangePostalCodePrefixCity, false); m_prefixPostalCodeCity.maxLength = 3; AddTextField(Locale.Get("K45_ADR_POSTAL_CODE_FORMAT_2"), out m_postalCodeFormat, m_uiHelperGlobal, OnChangePostalCodeFormat, AdrController.CurrentConfig.GlobalConfig.AddressingConfig.PostalCodeFormat); AddButtonInEditorRow(m_postalCodeFormat, CommonsSpriteNames.K45_QuestionMark, () => K45DialogControl.ShowModal(new K45DialogControl.BindProperties { showButton1 = true, textButton1 = Locale.Get("EXCEPTION_OK"), title = Locale.Get("K45_ADR_POSTAL_CODE_FORMAT_LEGEND_TITLE"), message = GetPostalCodeLegendText() }, (x) => true), null, true, 30); AddLabel(Locale.Get("K45_ADR_ADDRESS_LINES"), m_uiHelperGlobal, out _, out _); AddTextField(Locale.Get("K45_ADR_ADDRESS_LINE1"), out m_addressLine1Format, m_uiHelperGlobal, OnChangeAddressLine1, AdrController.CurrentConfig.GlobalConfig.AddressingConfig.AddressLine1); AddTextField(Locale.Get("K45_ADR_ADDRESS_LINE2"), out m_addressLine2Format, m_uiHelperGlobal, OnChangeAddressLine2, AdrController.CurrentConfig.GlobalConfig.AddressingConfig.AddressLine2); AddTextField(Locale.Get("K45_ADR_ADDRESS_LINE3"), out m_addressLine3Format, m_uiHelperGlobal, OnChangeAddressLine3, AdrController.CurrentConfig.GlobalConfig.AddressingConfig.AddressLine3); var commonPopupConfigHelpAddress = new K45DialogControl.BindProperties { showButton1 = true, textButton1 = Locale.Get("EXCEPTION_OK"), title = Locale.Get("K45_ADR_ADDRESS_LINES_FORMAT_LEGEND_TITLE"), message = GetAddressLegendText() }; AddButtonInEditorRow(m_addressLine1Format, CommonsSpriteNames.K45_QuestionMark, () => K45DialogControl.ShowModal(commonPopupConfigHelpAddress, (x) => true), null, true, 30); AddButtonInEditorRow(m_addressLine2Format, CommonsSpriteNames.K45_QuestionMark, () => K45DialogControl.ShowModal(commonPopupConfigHelpAddress, (x) => true), null, true, 30); AddButtonInEditorRow(m_addressLine3Format, CommonsSpriteNames.K45_QuestionMark, () => K45DialogControl.ShowModal(commonPopupConfigHelpAddress, (x) => true), null, true, 30); m_uiHelperGlobal.AddSpace(15); var nameGenConfig = AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig; AdrStationNamesGenerationConfig getGenConfig() => AdrController.CurrentConfig.GlobalConfig.BuildingConfig.StationsNameGenerationConfig; AdrRicoNamesGenerationConfig getRicoGenConfig() => AdrController.CurrentConfig.GlobalConfig.BuildingConfig.RicoNamesGenerationConfig; KlyteMonoUtils.CreateUIElement(out UIPanel buildingTogglePanel, m_uiHelperGlobal.Self.transform); buildingTogglePanel.width = MainContainer.width; buildingTogglePanel.autoLayout = true; buildingTogglePanel.autoLayoutPadding = new RectOffset(2, 2, 2, 2); buildingTogglePanel.autoLayoutDirection = LayoutDirection.Horizontal; buildingTogglePanel.autoFitChildrenVertically = true; buildingTogglePanel.wrapLayout = true; var buildingTogglePanelHelper = new UIHelperExtension(buildingTogglePanel); void AddBuildingCheckbox(string icon, string locale, Action <bool> onChange, Func <bool> getCurrentVal) => AddIconCheckbox(icon, locale, out _, buildingTogglePanelHelper, (x) => { onChange(x); AdrFacade.TriggerBuildingNameStrategyChanged(); }, new Vector2(45, 30), getCurrentVal()); AddLabel(Locale.Get("K45_ADR_BUILDING_PASSENGERS"), buildingTogglePanelHelper, out UILabel lbl, out _); lbl.padding.top = 5; lbl.padding.bottom = 5; KlyteMonoUtils.LimitWidthAndBox(lbl, 200, out UIPanel panel); panel.maximumSize = new Vector2(210, 0); panel.minimumSize = new Vector2(210, 0); AddBuildingCheckbox("SubBarPublicTransportBus", "K45_ADR_AUTONAME_BUS_STATIONS", x => getGenConfig().Bus = x, () => getGenConfig().Bus); AddBuildingCheckbox("IconPolicyFreePublicTransport", "K45_ADR_AUTONAME_INTERCITYBUS_STATIONS", x => getGenConfig().IntercityBus = x, () => getGenConfig().IntercityBus); AddBuildingCheckbox("SubBarPublicTransportTrolleybus", "K45_ADR_AUTONAME_TROLLEYBUS_STATIONS", x => getGenConfig().Trolleybus = x, () => getGenConfig().Trolleybus); AddBuildingCheckbox("SubBarPublicTransportTram", "K45_ADR_AUTONAME_TRAM_STATIONS", x => getGenConfig().Tram = x, () => getGenConfig().Tram); AddBuildingCheckbox("SubBarPublicTransportTrain", "K45_ADR_AUTONAME_TRAIN_STATIONS", x => getGenConfig().TrainsPassenger = x, () => getGenConfig().TrainsPassenger); AddBuildingCheckbox("SubBarPublicTransportMonorail", "K45_ADR_AUTONAME_MONORAIL_STATIONS", x => getGenConfig().Monorail = x, () => getGenConfig().Monorail); AddBuildingCheckbox("SubBarPublicTransportMetro", "K45_ADR_AUTONAME_METRO_STATIONS", x => getGenConfig().Metro = x, () => getGenConfig().Metro); AddBuildingCheckbox("SubBarPublicTransportCableCar", "K45_ADR_AUTONAME_CABLE_CAR_STATIONS", x => getGenConfig().CableCar = x, () => getGenConfig().CableCar); AddBuildingCheckbox("FeatureFerry", "K45_ADR_AUTONAME_FERRY_STATIONS", x => getGenConfig().Ferry = x, () => getGenConfig().Ferry); AddBuildingCheckbox("SubBarPublicTransportShip", "K45_ADR_AUTONAME_SHIP_STATIONS", x => getGenConfig().ShipPassenger = x, () => getGenConfig().ShipPassenger); AddBuildingCheckbox("IconPolicyHelicopterPriority", "K45_ADR_AUTONAME_HELICOPTER_STATIONS", x => getGenConfig().Helicopter = x, () => getGenConfig().Helicopter); AddBuildingCheckbox("FeatureBlimp", "K45_ADR_AUTONAME_BLIMP_STATIONS", x => getGenConfig().Blimp = x, () => getGenConfig().Blimp); AddBuildingCheckbox("SubBarPublicTransportPlane", "K45_ADR_AUTONAME_AIRPLANE_STATIONS", x => getGenConfig().AirplanePassenger = x, () => getGenConfig().AirplanePassenger); buildingTogglePanelHelper.AddSpace(5); AddLabel(Locale.Get("K45_ADR_BUILDING_CARGO"), buildingTogglePanelHelper, out lbl, out _); lbl.padding.top = 5; lbl.padding.bottom = 5; KlyteMonoUtils.LimitWidthAndBox(lbl, 260, out panel); panel.maximumSize = new Vector2(270, 0); panel.minimumSize = new Vector2(270, 0); AddBuildingCheckbox("SubBarPublicTransportShip", "K45_ADR_ENABLE_CUSTOM_NAMING_CARGO_SHIP", x => getGenConfig().ShipCargo = x, () => getGenConfig().ShipCargo); AddBuildingCheckbox("SubBarPublicTransportTrain", "K45_ADR_ENABLE_CUSTOM_NAMING_CARGO_TRAIN", x => getGenConfig().TrainsCargo = x, () => getGenConfig().TrainsCargo); AddBuildingCheckbox("SubBarPublicTransportPlane", "K45_ADR_ENABLE_CUSTOM_NAMING_CARGO_AIRPLANE", x => getGenConfig().AirplaneCargo = x, () => getGenConfig().AirplaneCargo); buildingTogglePanelHelper.AddSpace(5); AddLabel(Locale.Get("K45_ADR_BUILDING_USE_ADDRESS"), buildingTogglePanelHelper, out lbl, out _); lbl.padding.top = 5; lbl.padding.bottom = 5; KlyteMonoUtils.LimitWidthAndBox(lbl, 260, out panel); panel.maximumSize = new Vector2(270, 0); panel.minimumSize = new Vector2(270, 0); AddBuildingCheckbox("SubBarDistrictSpecializationResidential", "K45_ADR_ENABLE_ADDRESS_NAMING_RES", x => getRicoGenConfig().Residence = x ? GenerationMethod.ADDRESS : GenerationMethod.NONE, () => getRicoGenConfig().Residence == GenerationMethod.ADDRESS); AddBuildingCheckbox("SubBarDistrictSpecializationIndustrial", "K45_ADR_ENABLE_ADDRESS_NAMING_IND", x => getRicoGenConfig().Industry = x ? GenerationMethod.ADDRESS : GenerationMethod.NONE, () => getRicoGenConfig().Industry == GenerationMethod.ADDRESS); AddBuildingCheckbox("SubBarDistrictSpecializationCommercial", "K45_ADR_ENABLE_ADDRESS_NAMING_COM", x => getRicoGenConfig().Commerce = x ? GenerationMethod.ADDRESS : GenerationMethod.NONE, () => getRicoGenConfig().Commerce == GenerationMethod.ADDRESS); AddBuildingCheckbox("SubBarDistrictSpecializationOffice", "K45_ADR_ENABLE_ADDRESS_NAMING_OFF", x => getRicoGenConfig().Office = x ? GenerationMethod.ADDRESS : GenerationMethod.NONE, () => getRicoGenConfig().Office == GenerationMethod.ADDRESS); isLoading = false; ReloadDistrictPrefixesFiles(); ReloadDistrictNamesFiles(); }
public void Awake() { MainContainer = GetComponent <UIPanel>(); MainContainer.autoLayout = true; MainContainer.autoLayoutDirection = LayoutDirection.Vertical; MainContainer.padding = new RectOffset(5, 5, 5, 5); MainContainer.autoLayoutPadding = new RectOffset(0, 0, 3, 3); KlyteMonoUtils.CreateTabsComponent(out m_tabstrip, out m_tabContainer, MainContainer.transform, "TextEditor", new Vector4(0, 0, MainContainer.width, 40), new Vector4(0, 0, MainContainer.width, 315)); m_tabSettings = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Settings), "K45_WTS_GENERAL_SETTINGS", "TxtSettings"); m_tabSize = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_MoveCross), "K45_WTS_TEXT_SIZE_ATTRIBUTES", "TxtSize"); m_tabAppearence = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoColorIcon), "K45_WTS_TEXT_APPEARANCE_ATTRIBUTES", "TxtApp"); m_tabFrame = TabCommons.CreateScrollableTabLocalized(m_tabstrip, "frame", "K45_WTS_TEXT_CONTAINERFRAME_ATTRIBUTES", "TxtFrm"); m_tabIllumination = TabCommons.CreateScrollableTabLocalized(m_tabstrip, "SubBarPropsCommonLights", "K45_WTS_TEXT_ILLUMINATION_ATTRIBUTES", "TxtIll"); m_tabConfig = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoNameIcon), "K45_WTS_TEXT_CONFIGURATION_ATTRIBUTES", "TxtCnf"); var helperSettings = new UIHelperExtension(m_tabSettings, LayoutDirection.Vertical); var helperSize = new UIHelperExtension(m_tabSize, LayoutDirection.Vertical); var helperAppearance = new UIHelperExtension(m_tabAppearence, LayoutDirection.Vertical); var helperFrame = new UIHelperExtension(m_tabFrame, LayoutDirection.Vertical); var helperIllumination = new UIHelperExtension(m_tabIllumination, LayoutDirection.Vertical); var helperConfig = new UIHelperExtension(m_tabConfig, LayoutDirection.Vertical); AddTextField(Locale.Get("K45_WTS_TEXT_TAB_TITLE"), out m_tabName, helperSettings, OnTabNameChanged); AddVector3Field(Locale.Get("K45_WTS_RELATIVE_POS"), out m_arrayCoord, helperSize, OnPositionChange); AddVector3Field(Locale.Get("K45_WTS_RELATIVE_ROT"), out m_arrayRotation, helperSize, OnRotationChange); AddFloatField(Locale.Get("K45_WTS_TEXT_SCALE"), out m_textScale, helperSize, OnScaleSubmit, false); AddFloatField(Locale.Get("K45_WTS_MAX_WIDTH_METERS"), out m_maxWidth, helperSize, OnMaxWidthChange, false); AddCheckboxLocale("K45_WTS_RESIZE_Y_TEXT_OVERFLOW", out m_applyScaleOnY, helperSize, OnChangeApplyRescaleOnY); AddCheckboxLocale("K45_WTS_CREATE_CLONE_180DEG", out m_create180degSimmetricClone, helperSize, OnChangeCreateSimmetricClone); AddCheckboxLocale("K45_WTS_CLONE_180DEG_INVERT_TEXT_HOR_ALIGN", out m_invertTextHorizontalAlignClone, helperSize, OnChangeInvertCloneTextHorizontalAlignment); AddVector2Field(Locale.Get("K45_WTS_TEXTBACKGROUNDSIZEGENERATED"), out m_bgSize, helperAppearance, OnBgSizeChanged); m_bgSize.ForEach(x => x.allowNegative = false); AddColorField(helperAppearance, Locale.Get("K45_WTS_BG_COLOR"), out m_bgColor, OnBgColorChanged); helperAppearance.AddSpace(5); AddColorField(helperAppearance, Locale.Get("K45_WTS_TEXT_COLOR"), out m_textFixedColor, OnFixedColorChanged); AddCheckboxLocale("K45_WTS_USE_CONTRAST_COLOR", out m_useContrastColor, helperAppearance, OnContrastColorChange); helperAppearance.AddSpace(5); AddSlider(Locale.Get("K45_WTS_TEXT_DEPTH"), out m_sliderDepth, helperAppearance, OnChangeDepth, -1, 1, 0.025f, (x) => $"{x.ToString("P1")}"); AddDropdown(Locale.Get("K45_WTS_TEXT_ALIGN_HOR"), out m_dropdownTextAlignHorizontal, helperAppearance, ColossalUIExtensions.GetDropdownOptions <UIHorizontalAlignment>("K45_ALIGNMENT"), OnSetTextAlignmentHorizontal); AddCheckboxLocale("K45_WTS_TEXT_USEFRAME", out m_useFrame, helperFrame, OnUseFrameChange); AddCheckboxLocale("K45_WTS_TEXT_CONTAINERUSEVEHICLECOLOR", out m_frameUseVehicleColor, helperFrame, OnFrameUseVehicleColorChange); AddColorField(helperFrame, Locale.Get("K45_WTS_TEXT_CONTAINEROUTERCOLOR"), out m_frameColor, OnFrameColorChanged); AddSlider(Locale.Get("K45_WTS_TEXT_CONTAINEROUTERSPECULARITY"), out m_frameOuterSpecularLevel, helperFrame, OnFrameOuterSpecularLevelChanged, 0, 1, 0.01f, (x) => (x * 100).ToString("F0") + "%"); AddVector2Field(Locale.Get("K45_WTS_TEXT_CONTAINERBACKSIZE"), out m_frameBackSize, helperFrame, OnFrameBackSizeChanged, true, false, false); AddVector2Field(Locale.Get("K45_WTS_TEXT_CONTAINERBACKOFFSET"), out m_frameBackOffset, helperFrame, OnFrameBackOffsetChanged); AddVector2Field(Locale.Get("K45_WTS_TEXT_CONTAINERDEPTHFRONTBACK"), out m_frameDepths, helperFrame, OnFrameDepthsChanged, true, false, false); AddFloatField(Locale.Get("K45_WTS_TEXT_CONTAINERFRONTBORDERTHICKNESS"), out m_frameFrontBorder, helperFrame, OnFrameBorderThicknessChanged, false); AddColorField(helperFrame, Locale.Get("K45_WTS_TEXT_CONTAINERGLASSCOLOR"), out m_frameGlassColor, OnFrameGlassColorChanged); AddSlider(Locale.Get("K45_WTS_TEXT_CONTAINERGLASSTRANSPARENCY"), out m_frameGlassTransparency, helperFrame, OnFrameGlassTransparencyChanged, 0, 1, 0.01f, (x) => (x * 100).ToString("F0") + "%"); AddSlider(Locale.Get("K45_WTS_TEXT_CONTAINERGLASSSPECULARITY"), out m_frameGlassSpecularLevel, helperFrame, OnFrameGlassSpecularLevelChanged, 0, 1, 0.01f, (x) => (x * 100).ToString("F0") + "%"); AddDropdown(Locale.Get("K45_WTS_TEXT_MATERIALTYPE"), out m_dropdownMaterialType, helperIllumination, ColossalUIExtensions.GetDropdownOptions <MaterialType>("K45_WTS_TEXTMATERIALTYPE"), OnSetMaterialType); AddSlider(Locale.Get("K45_WTS_TEXT_ILLUMINATIONSTRENGTH"), out m_sliderIllumination, helperIllumination, OnChangeIlluminationStrength, 0, 10, 0.025f, (x) => $"{x.ToString("P1")}"); AddDropdown(Locale.Get("K45_WTS_TEXT_BLINKTYPE"), out m_dropdownBlinkType, helperIllumination, ColossalUIExtensions.GetDropdownOptions <BlinkType>("K45_WTS_BLINKTYPE"), OnSetBlinkType); AddVector4Field(Locale.Get("K45_WTS_TEXT_CUSTOMBLINKPARAMS"), out m_arrayCustomBlink, helperIllumination, OnCustomBlinkChange); m_flagsState = new Dictionary <Vehicle.Flags, UIMultiStateButton>(); var flagsCheck = helperIllumination.AddGroupExtended(Locale.Get("K45_WTS_FLAGSREQUREDFORBIDDEN")); m_flagsContainer = flagsCheck.Self.parent; ((UIPanel)flagsCheck.Self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)flagsCheck.Self).wrapLayout = true; (Enum.GetValues(typeof(Vehicle.Flags)) as Vehicle.Flags[]).ForEach(f => { AddMultistateButton(f.ToString(), flagsCheck.Self, out UIMultiStateButton button, out _, out _, flagsCheck.Self.width / 4.1f, new string[] { "AchievementCheckedFalse", "AchievementCheckedTrue", "AchievementCheckedTrueNegative", }, (x, y) => OnSetStateFlag(f, y), new Vector2(20, 20)); m_flagsState[f] = button; }); AddDropdown(Locale.Get("K45_WTS_TEXT_CONTENT"), out m_dropdownTextContent, helperConfig, WTSDynamicTextRenderingRules.ALLOWED_TYPES_VEHICLE.GetDropdownOptions("K45_WTS_BOARD_TEXT_TYPE_DESC_VEHICLE"), OnSetTextOwnNameContent); AddTextField(Locale.Get("K45_WTS_CUSTOM_TEXT"), out m_customText, helperConfig, OnSetTextCustom); IEnumerator OnFilter(string x, Wrapper <string[]> result) { yield return(result.Value = OnFilterSprites(WTSVehicleLayoutEditor.Instance.Preview.OverrideSprite, x)); } AddFilterableInput(Locale.Get("K45_WTS_SPRITE_NAME"), helperConfig, out m_spriteFilter, out UIListBox lb2, OnFilter, OnSpriteNameChanged); lb2.size = new Vector2(MainContainer.width - 20, 220); lb2.processMarkup = true; m_spriteFilter.eventGotFocus += (x, y) => { var text = ((UITextField)x).text; if (text.StartsWith(WTSAtlasesLibrary.PROTOCOL_IMAGE_ASSET) || text.StartsWith(WTSAtlasesLibrary.PROTOCOL_IMAGE)) { WTSVehicleLayoutEditor.Instance.Preview.OverrideSprite.spriteName = ((UITextField)x).text.Split('/').Last().Trim(); } }; lb2.eventItemMouseHover += (x, y) => { if (y >= 0 && y < lb2.items.Length) { WTSVehicleLayoutEditor.Instance.Preview.OverrideSprite.spriteName = lb2.items[y].Split('/').Last().Trim(); } }; lb2.eventVisibilityChanged += (x, y) => WTSVehicleLayoutEditor.Instance.Preview.OverrideSprite.parent.isVisible = y; WTSVehicleLayoutEditor.Instance.Preview.OverrideSprite.parent.isVisible = false; helperConfig.AddSpace(5); AddEmptyDropdown(Locale.Get("K45_WTS_OVERRIDE_FONT"), out m_overrideFontSelect, helperConfig, OnSetOverrideFont); AddDropdown(Locale.Get("K45_WTS_CLASS_FONT"), out m_fontClassSelect, helperConfig, ColossalUIExtensions.GetDropdownOptions <FontClass>("K45_WTS_FONTCLASS"), OnSetFontClass); AddTextField(Locale.Get("K45_WTS_PREFIX"), out m_textPrefix, helperConfig, OnSetPrefix); AddTextField(Locale.Get("K45_WTS_SUFFIX"), out m_textSuffix, helperConfig, OnSetSuffix); AddCheckboxLocale("K45_WTS_TEXT_ALL_CAPS", out m_allCaps, helperConfig, OnSetAllCaps); AddCheckboxLocale("K45_WTS_TEXT_APPLYABBREVIATIONS", out m_applyAbbreviations, helperConfig, OnSetApplyAbbreviations); WTSUtils.ReloadFontsOf(m_overrideFontSelect, null, true, true); WTSVehicleLayoutEditor.Instance.CurrentTabChanged += (newVal) => { int targetTab = newVal - 1; SafeObtain(OnSetData, targetTab); }; m_isEditing = false; AddLibBox <WTSLibVehicleTextItem, BoardTextDescriptorGeneralXml>(helperSettings, out UIButton m_copyButtonText, DoCopyText, out m_pasteButtonText, DoPasteText, out UIButton m_deleteButtonText, DoDeleteText, (loadedItem) => SafeObtain((ref BoardTextDescriptorGeneralXml x) => { string name = x.SaveName; x = XmlUtils.DefaultXmlDeserialize <BoardTextDescriptorGeneralXml>(loadedItem); x.SaveName = name; OnSetData(ref x); x.SaveName = name; }), () => XmlUtils.DefaultXmlSerialize(WTSVehicleLayoutEditor.Instance.EditingInstance.TextDescriptors[Math.Max(0, TabToEdit)])); }
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 Awake() { MainContainer = GetComponent <UIPanel>(); MainContainer.autoLayout = true; MainContainer.clipChildren = true; MainContainer.autoLayoutDirection = LayoutDirection.Vertical; MainContainer.autoLayoutPadding = new RectOffset(0, 0, 4, 4); KlyteMonoUtils.CreateTabsComponent(out m_tabstrip, out UITabContainer m_tabContainer, MainContainer.transform, "TextEditor", new Vector4(0, 0, MainContainer.width, 40), new Vector4(0, 0, MainContainer.width, MainContainer.height - 40)); UIPanel m_tabSettings = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Settings), "K45_WTS_ROADCORNER_BASIC_SETTINGS", "RcSettings"); UIPanel m_tabRoads = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, "ToolbarIconRoads", "K45_WTS_ROADCORNER_ALLOWTITLE", "RcRoad"); UIPanel m_tabSpawning = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Reload), "K45_WTS_ROADCORNER_SPAWNING_SETTINGS", "RcSpawning"); UIPanel m_tabAppearence = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoColorIcon), "K45_WTS_ROADCORNER_APPEARANCE_SETTINGS", "RcAppearence"); UIPanel m_tabDistricts = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, "ToolbarIconDistrict", "K45_WTS_ROADCORNER_DISTRICT_SETTINGS", "RcDistricts"); var helperSettings = new UIHelperExtension(m_tabSettings, LayoutDirection.Vertical); var helperSpawning = new UIHelperExtension(m_tabSpawning, LayoutDirection.Vertical); var helperAppearence = new UIHelperExtension(m_tabAppearence, LayoutDirection.Vertical); var helperDistricts = new UIHelperExtension(m_tabDistricts, LayoutDirection.Vertical); var helperRoads = new UIHelperExtension(m_tabRoads, LayoutDirection.Vertical); AddTextField(Locale.Get("K45_WTS_ROADCORNER_NAME"), out m_name, helperSettings, OnSetName); helperSettings.AddSpace(5); AddFilterableInput(Locale.Get("K45_WTS_ROADCORNER_PROPLAYOUT"), helperSettings, out m_propLayoutSelect, out _, OnFilterLayouts, OnPropLayoutChange); AddVector3Field(Locale.Get("K45_WTS_ROADCORNER_POSITION"), out m_position, helperSettings, OnPositionChanged); AddVector3Field(Locale.Get("K45_WTS_ROADCORNER_ROTATION"), out m_rotation, helperSettings, OnRotationChanged); AddVector3Field(Locale.Get("K45_WTS_ROADCORNER_SCALE"), out m_scale, helperSettings, OnScaleChanged); AddLibBox <WTSLibRoadCornerRule, BoardInstanceRoadNodeXml>(helperSettings, out m_copySettings, OnCopyRule, out m_pasteSettings, OnPasteRule, out _, null, OnLoadRule, GetRuleSerialized); AddCheckboxLocale("K45_WTS_ROADCORNER_ALLOW_DIRTROADS", out m_allowDirty, helperRoads, (x) => ToggleAllow(Level.Level1, x)); AddCheckboxLocale("K45_WTS_ROADCORNER_ALLOW_ALLEYS", out m_allowAlleys, helperRoads, (x) => ToggleAllow((Level)5, x)); AddCheckboxLocale("K45_WTS_ROADCORNER_ALLOW_SMALLROADS", out m_allowSmallRoads, helperRoads, (x) => ToggleAllow(Level.Level2, x)); AddCheckboxLocale("K45_WTS_ROADCORNER_ALLOW_MEDIUMROADS", out m_allowMediumRoads, helperRoads, (x) => ToggleAllow(Level.Level3, x)); AddCheckboxLocale("K45_WTS_ROADCORNER_ALLOW_LARGEROADS", out m_allowLargeRoads, helperRoads, (x) => ToggleAllow(Level.Level4, x)); AddCheckboxLocale("K45_WTS_ROADCORNER_ALLOW_HIGHWAYS", out m_allowHighways, helperRoads, (x) => ToggleAllow(Level.Level5, x)); AddSlider(Locale.Get("K45_WTS_ROADCORNER_SPAWN_CHANCE"), out m_spawnChance, helperSpawning, OnChangeSpawnChance, 0, 255, 1, (x) => (x / 255).ToString("P0")); AddVector2Field(Locale.Get("K45_WTS_ROADCORNER_MINMAXHALFWIDTH"), out m_minMaxHalfWidth, helperSpawning, OnSetMinMaxHalfWidth); AddCheckboxLocale("K45_WTS_ROADCORNER_IGNOREEMPTYNAMES", out m_ignoreEmpty, helperSpawning, OnChangeIgnoreEmpty); KlyteMonoUtils.CreateUIElement(out m_spawnInCornerOptions, m_tabSpawning.transform, "spawnInCorner", new Vector4(0, 0, 620, 0)); var helperSpawningCorner = new UIHelperExtension(m_spawnInCornerOptions, LayoutDirection.Vertical); helperSpawningCorner.Self.width = 620; AddCheckboxLocale("K45_WTS_ROADCORNER_PLACEALSOONDISTRICTBORDER", out m_placeDistrictBorder, helperSpawningCorner, OnChangeSpawnOnDistrictBorder); AddCheckboxLocale("K45_WTS_ROADCORNER_PLACEONTUNNELBRIDGESTART", out m_placeRoadTransition, helperSpawningCorner, OnChangePlaceRoadTransition); AddCheckboxLocale("K45_WTS_ROADCORNER_USEDISTRICTCOLOR", out m_useDistrictColor, helperAppearence, OnChangeUseDistrictColor); AddCheckboxLocale("K45_WTS_ROADCORNER_DISTRICTSELECTIONASWHITELIST", out m_districtWhiteList, helperDistricts, OnSetDistrictsAsWhitelist); AddCheckboxLocale("K45_WTS_ROADCORNER_DISTRICTSELECTIONASBLACKLIST", out m_districtBlackList, helperDistricts, OnSetDistrictsAsBlacklist); AddDropdown(Locale.Get("K45_WTS_ROADCORNER_DISTRICTRESTRICTIONSOLVEORDER"), out m_districtResolutionOrder, helperDistricts, ColossalUIExtensions.GetDropdownOptions <DistrictRestrictionOrder>("K45_WTS_DISTRICTRESTRICTIONORDER"), OnChangeDistrictRestrictionOrder); KlyteMonoUtils.CreateUIElement(out m_listContainer, helperDistricts.Self.transform, "previewPanel", new UnityEngine.Vector4(0, 0, helperDistricts.Self.width, helperDistricts.Self.height - 160)); KlyteMonoUtils.CreateScrollPanel(m_listContainer, out m_districtList, out _, m_listContainer.width - 20, m_listContainer.height); m_districtList.backgroundSprite = "OptionsScrollbarTrack"; m_districtList.autoLayout = true; m_districtList.autoLayoutDirection = LayoutDirection.Vertical; CreateTemplateDistrict(); m_checkboxTemplateList = new UITemplateList <UIPanel>(m_districtList, DISTRICT_SELECTOR_TEMPLATE); WTSRoadCornerEditor.Instance.RuleList.EventSelectionChanged += OnChangeTab; MainContainer.isVisible = false; m_pasteSettings.isVisible = false; }
private void InitAssetSelectionTab() { UIHelperExtension assetSelectionTabContainer = createNewAsteriskTab(Locale.Get("TLM_CITY_ASSETS_SELECTION")); m_defaultAssets = assetSelectionTabContainer.AddTextList(Locale.Get("TLM_DEFAULT_ASSETS"), new Dictionary <string, string>(), delegate(string idx) { }, 340, 250); m_prefixAssets = assetSelectionTabContainer.AddTextList(Locale.Get("TLM_ASSETS_FOR_PREFIX"), new Dictionary <string, string>(), delegate(string idx) { }, 340, 250); foreach (Transform t in ((UIPanel)assetSelectionTabContainer.self).transform) { var panel = t.gameObject.GetComponent <UIPanel>(); if (panel) { panel.width = 340; } } m_prefixAssets.root.backgroundSprite = "EmptySprite"; m_prefixAssets.root.color = Color.white; m_prefixAssets.root.width = 340; m_defaultAssets.root.backgroundSprite = "EmptySprite"; m_defaultAssets.root.width = 340; assetSelectionTabContainer.AddSpace(10); m_prefixAssets.EventOnSelect += M_defaultAssets_eventOnSelect; m_defaultAssets.EventOnSelect += M_defaultAssets_eventOnSelect; OnButtonClicked reload = delegate { reloadAssetsList(m_prefixSelection.selectedIndex); }; assetSelectionTabContainer.AddButton(Locale.Get("TLM_ADD"), delegate { if (m_defaultAssets.unselected) { return; } var selected = m_defaultAssets.selectedItem; if (selected == null || selected.Equals(default(string))) { return; } addAssetToPrefixDropDownSelection(m_systemTypeDropDown.selectedIndex, (uint)(m_prefixSelection.selectedIndex - 1), selected); reload(); }); assetSelectionTabContainer.AddButton(Locale.Get("TLM_REMOVE"), delegate { if (m_prefixAssets.unselected) { return; } var selected = m_prefixAssets.selectedItem; if (selected == null || selected.Equals(default(string))) { return; } removeAssetFromPrefixDropDownSelection(m_systemTypeDropDown.selectedIndex, (uint)(m_prefixSelection.selectedIndex - 1), selected); reload(); }); assetSelectionTabContainer.AddButton(Locale.Get("TLM_REMOVE_ALL"), delegate { removeAllAssetsFromPrefixDropDownSelection(m_systemTypeDropDown.selectedIndex, (uint)(m_prefixSelection.selectedIndex - 1)); reload(); }); assetSelectionTabContainer.AddButton(Locale.Get("TLM_RELOAD"), delegate { reload(); }); assetSelectionTabContainer.AddSpace(5); setPreviewWindow(assetSelectionTabContainer); }
public void Awake() { m_isLoading = true; if (!(Instance is null)) { Destroy(Instance); } Instance = this; MainContainer = GetComponent <UIPanel>(); MainContainer.autoLayout = true; MainContainer.autoLayoutDirection = LayoutDirection.Vertical; MainContainer.clipChildren = true; m_uiHelperNeighbors = new UIHelperExtension(MainContainer); AddDropdown(Locale.Get("K45_ADR_REGION_CITIES_FILE"), out m_neighborFileSelect, m_uiHelperNeighbors, new string[0], OnChangeSelectedNeighborFile); AddButtonInEditorRow(m_neighborFileSelect, Commons.UI.SpriteNames.CommonsSpriteNames.K45_Reload, ReloadOptionsFilesNeighbor, "K45_ADR_ROAD_NAME_FILES_RELOAD"); m_uiHelperNeighbors.AddSpace(10); KlyteMonoUtils.CreateUIElement(out UIPanel parentContainer, transform, "ParentContainer"); parentContainer.width = MainContainer.width - MainContainer.padding.left - MainContainer.padding.right; parentContainer.height = MainContainer.height - 70f; parentContainer.autoLayoutDirection = LayoutDirection.Horizontal; parentContainer.autoLayout = true; KlyteMonoUtils.CreateUIElement(out m_borderChartContainer, parentContainer.transform, "NeighborhoodContainer"); m_borderChartContainer.width = (parentContainer.width / 2f); m_borderChartContainer.height = parentContainer.height; m_borderChartContainer.autoLayout = false; m_borderChartContainer.useCenter = true; m_borderChartContainer.wrapLayout = false; m_borderChartContainer.tooltipLocaleID = "K45_ADR_CITY_NEIGHBORHOOD"; m_borderChart = m_borderChartContainer.gameObject.AddComponent <AdrMapBordersChart>(); //UILabel titleLabel = m_uiHelperNeighbors.AddLabel(""); //titleLabel.autoSize = true; //titleLabel.textAlignment = UIHorizontalAlignment.Center; //titleLabel.minimumSize = new Vector2(DefaultWidth, 0); //KlyteMonoUtils.LimitWidth(titleLabel, DefaultWidth); //titleLabel.localeID = "K45_ADR_AZIMUTH_EDITOR_TITLE"; KlyteMonoUtils.CreateUIElement(out UIPanel m_neighborEntryListPanel, parentContainer.transform, "NeighborhoodContainer"); m_neighborEntryListPanel.width = (parentContainer.width / 2f); m_neighborEntryListPanel.height = parentContainer.height; m_neighborEntryListPanel.autoLayout = true; m_neighborEntryListPanel.autoLayoutDirection = LayoutDirection.Vertical; KlyteMonoUtils.CreateUIElement(out UIPanel titleItem, m_neighborEntryListPanel.transform, "NeighborhoodContainer"); titleItem.gameObject.AddComponent <AdrAzimuthTitleLineNeighbor>(); UIHelperExtension.AddSpace(m_neighborEntryListPanel, 5); KlyteMonoUtils.CreateUIElement(out UIPanel listContainer, m_neighborEntryListPanel.transform, "listContainer"); listContainer.autoLayout = true; listContainer.autoLayoutDirection = LayoutDirection.Horizontal; listContainer.width = m_neighborEntryListPanel.width; listContainer.height = m_neighborEntryListPanel.height - 35; KlyteMonoUtils.CreateScrollPanel(listContainer, out m_neighborsList, out _, listContainer.width - 17.5f, listContainer.height); m_isLoading = false; ReloadOptionsFilesNeighbor(); }