private void Awake() { m_instance = this; controlContainer = GetComponent <UIPanel>(); controlContainer.name = "VWConfigFilesPanel"; controlContainer.autoLayout = true; controlContainer.autoLayoutDirection = LayoutDirection.Vertical; controlContainer.clipChildren = true; var group1 = new UIHelperExtension(controlContainer); UILabel lblTitle = group1.AddLabel(Locale.Get("K45_VW_IMPORT_EXPORT_TITLE")); lblTitle.autoSize = true; lblTitle.minimumSize = Vector2.zero; lblTitle.maximumSize = Vector2.zero; lblTitle.wordWrap = false; KlyteMonoUtils.LimitWidth(lblTitle, (uint)(controlContainer.width - 10)); KlyteMonoUtils.LimitWidth((UIButton)group1.AddButton(Locale.Get("K45_VW_OPEN_FOLDER_IMPORT_EXPORT"), () => { ColossalFramework.Utils.OpenInFileBrowser(FileUtils.EnsureFolderCreation(VehicleWealthizerMod.ImportExportWealthFolder).FullName); }), (uint)(controlContainer.width - 10)); KlyteMonoUtils.LimitWidth((UIButton)group1.AddButton(Locale.Get("K45_VW_RELOAD_IMPORT_FILES"), ReloadImportFiles), (uint)(controlContainer.width - 10)); m_ddImport = group1.AddDropdown(Locale.Get("K45_VW_SELECT_FILE_IMPORT"), new string[0], "", (x) => { m_btnImport.isEnabled = (x >= 0); }); ConfigComponentPanel(m_ddImport); m_btnImport = (UIButton)group1.AddButton(Locale.Get("K45_VW_IMPORT_SELECTED"), Import); KlyteMonoUtils.LimitWidth(m_btnImport, (uint)(controlContainer.width - 10)); KlyteMonoUtils.LimitWidth((UIButton)group1.AddButton(Locale.Get("K45_VW_EXPORT_CURRENT"), Export), (uint)(controlContainer.width - 10)); ReloadImportFiles(); m_btnImport.isEnabled = (m_ddImport.items.Length > 0); }
public override void TopSettingsUI(UIHelperExtension helper) { UIHelperExtension group8 = helper.AddGroupExtended(Locale.Get("K45_WTS_GENERAL_INFO")); AddFolderButton(WTSController.DefaultBuildingsConfigurationFolder, group8, "K45_WTS_DEFAULT_BUILDINGS_CONFIG_PATH_TITLE"); AddFolderButton(WTSController.DefaultVehiclesConfigurationFolder, group8, "K45_WTS_DEFAULT_VEHICLES_CONFIG_PATH_TITLE"); AddFolderButton(WTSController.DefaultPropsLayoutConfigurationFolder, group8, "K45_WTS_DEFAULT_PROP_LAYOUTS_PATH_TITLE"); AddFolderButton(WTSController.DefaultHwShieldsConfigurationFolder, group8, "K45_WTS_DEFAULT_HWSHIELDS_CONFIG_PATH_TITLE"); AddFolderButton(WTSController.AbbreviationFilesPath, group8, "K45_WTS_ABBREVIATION_FILES_PATH_TITLE"); AddFolderButton(WTSController.FontFilesPath, group8, "K45_WTS_FONT_FILES_PATH_TITLE"); AddFolderButton(WTSController.ExtraSpritesFolder, group8, "K45_WTS_EXTRA_SPRITES_PATH_TITLE"); group8.AddLabel(Locale.Get("K45_WTS_GET_FILES_GITHUB")); group8.AddButton(Locale.Get("K45_WTS_GO_TO_GITHUB"), () => Application.OpenURL("https://github.com/klyte45/WriteTheSignsFiles")); group8.AddButton(Locale.Get("K45_WTS_GO_TO_WIKI"), () => Application.OpenURL("https://github.com/klyte45/WriteTheSigns/wiki")); group8.AddButton(Locale.Get("K45_WTS_GO_TO_WTSWORKSHOP"), () => Application.OpenURL("https://github.com/klyte45/WriteTheSigns/wiki")); reloadImages = (UIButton)group8.AddButton(Locale.Get("K45_WTS_REFRESH_IMAGES_FOLDER"), () => Controller?.AtlasesLibrary.LoadImagesFromLocalFolders()); reloadImages.eventVisibilityChanged += (k, x) => { if (x) { if (Controller is null) { k.Disable(); } else { k.Enable(); } } }; UIHelperExtension group4 = helper.AddGroupExtended(Locale.Get("K45_WTS_GENERATED_TEXT_OPTIONS")); (group4.AddDropdownLocalized("K45_WTS_INITIAL_TEXTURE_SIZE_FONT", new string[] { "512", "1024", "2048", "4096 (!)", "8192 (!!!)", "16384 (WTF??)" }, StartTextureSizeFont, (x) => StartTextureSizeFont.value = x).parent as UIPanel).autoFitChildrenVertically = true; (group4.AddDropdownLocalized("K45_WTS_FONT_QUALITY", new string[] { "50%", "75%", "100%", "125%", "150% (!)", "200% (!!!)", "400% (BEWARE!)", "800% (You don't need this!)" }, FontQuality, (x) => { FontQuality.value = x; FontServer.instance.SetQualityMultiplier(m_qualityArray[x]); WTSController.ReloadFontsFromPath(); }).parent as UIPanel).autoFitChildrenVertically = true; FontServer.instance.SetQualityMultiplier(m_qualityArray[FontQuality]); (group4.AddDropdownLocalized("K45_WTS_MAX_PARALLEL_WORD_PROCESSES", new string[] { "1", "2", "4", "8", "16", "32", "64", "128 (!)", "256 (!!)", "512 (Your game may freeze)", "1024 (Your game WILL freeze)" }, Convert.ToString(FontSystem.MaxCoroutines, 2).Length - 1, (x) => FontSystem.MaxCoroutines.value = 1 << x).parent as UIPanel).autoFitChildrenVertically = true; UIHelperExtension group5 = helper.AddGroupExtended(Locale.Get("K45_WTS_GENERATED_CLOCK_OPTIONS")); (group5.AddDropdownLocalized("K45_WTS_CLOCK_MINUTES_PRECISION", new string[] { "30", "20", "15 (DEFAULT)", "12", "10", "7.5", "6", "5", "4", "3 (!)", "2 (!!)", "1 (!!!!)" }, Array.IndexOf(m_clockPrecision, ClockPrecision), (x) => { ClockPrecision.value = m_clockPrecision[x]; }).parent as UIPanel).autoFitChildrenVertically = true; group5.AddCheckboxLocale("K45_WTS_CLOCK_SHOW_LEADING_ZERO", ClockShowLeadingZero, (x) => ClockShowLeadingZero.value = x); group5.AddCheckboxLocale("K45_WTS_CLOCK_12H_CLOCK", Clock12hFormat, (x) => Clock12hFormat.value = x); UIHelperExtension group6 = helper.AddGroupExtended(Locale.Get("K45_WTS_CACHE_INFO")); UIButton calcMeshSize = null; var calcMeshLbl = "Calculate text meshes cache size"; calcMeshSize = (UIButton)group6.AddButton(calcMeshLbl, () => calcMeshSize.text = $"{calcMeshLbl}: {FontServer.instance?.GetAllFontsCacheSize().ToString("#,##0") ?? "N/A " }bytes"); }
protected void CreateGroup9(UIHelperExtension helper) { UIHelperExtension group9 = helper.AddGroupExtended(Locale.Get("K45_BETAS_EXTRA_INFO")); Group9SettingsUI(group9); group9.AddCheckbox(Locale.Get("K45_DEBUG_MODE"), DebugMode.value, delegate(bool val) { DebugMode.value = val; }); group9.AddLabel(string.Format(Locale.Get("K45_VERSION_SHOW"), FullVersion)); group9.AddButton(Locale.Get("K45_RELEASE_NOTES"), delegate() { ShowVersionInfoPopup(true); }); group9.AddButton("Report-a-bug helper", () => K45DialogControl.ShowModal(new K45DialogControl.BindProperties() { icon = IconName, title = "Report-a-bug helper", message = "If you find any problem with this mod, please send me the output_log.txt (or player.log on Mac/Linux) in the mod Workshop page. If applies, a printscreen can help too to make a better guess about what is happening wrong here...\n\n" + "There's a link for a Workshop guide by <color #008800>aubergine18</color> explaining how to find your log file, depending of OS you're using.\nFeel free to create a topic at Workshop or just leave a comment linking your files.", showButton1 = true, textButton1 = "Okay...", showButton2 = true, textButton2 = "Go to the guide", showButton3 = true, textButton3 = "Go to mod page" }, (x) => { if (x == 2) { ColossalFramework.Utils.OpenUrlThreaded("https://steamcommunity.com/sharedfiles/filedetails/?id=463645931"); return(false); } if (x == 3) { ColossalFramework.Utils.OpenUrlThreaded("https://steamcommunity.com/sharedfiles/filedetails/?id=" + ModId); return(false); } return(true); })); if (m_showLangDropDown) { UIDropDown dd = null; dd = group9.AddDropdownLocalized("K45_MOD_LANG", (new string[] { "K45_GAME_DEFAULT_LANGUAGE" }.Concat(KlyteLocaleManager.locales.Select(x => $"K45_LANG_{x}")).Select(x => Locale.Get(x))).ToArray(), KlyteLocaleManager.GetLoadedLanguage(), delegate(int idx) { KlyteLocaleManager.SaveLoadedLanguage(idx); KlyteLocaleManager.ReloadLanguage(); KlyteLocaleManager.RedrawUIComponents(); }); } else { group9.AddLabel(string.Format(Locale.Get("K45_LANG_CTRL_MOD_INFO"), Locale.Get("K45_MOD_CONTROLLING_LOCALE"))); } }
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; }
public override void TopSettingsUI(UIHelperExtension ext) { if (!m_alreadyLoadedTranslations) { ScanTranslations(); } ScanImagesForTextureAtlas(); ext.AddButton("Go to GitHub page!", () => Application.OpenURL("https://github.com/klyte45/KlyteFramework")); ext.AddButton("Reload translation files", ScanTranslations); ext.AddButton("Reload images files", ScanImagesForTextureAtlas); ext.AddButton("Export game images", ExportGameImages); }
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, MainContainer.height - 40)); m_tabSettings = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Settings), "K45_WTS_GENERAL_SETTINGS", "PrpSettings"); m_tabLib = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Load), "K45_WTS_PROP_ITEM_LIB_TITLE", "PrpLib"); m_tabSettings.clipChildren = true; m_tabLib.clipChildren = true; var helperSettings = new UIHelperExtension(m_tabSettings, LayoutDirection.Vertical); var helperLib = new UIHelperExtension(m_tabLib, LayoutDirection.Vertical); AddFilterableInput(Locale.Get("K45_WTS_PROP_MODEL_SELECT"), helperSettings, out m_propFilter, out _, PropIndexes.instance.BasicInputFiltering, OnSetProp); AddTextField(Locale.Get("K45_WTS_PROP_TAB_TITLE"), out m_name, helperSettings, OnSetName); AddColorField(helperSettings, Locale.Get("K45_WTS_PROP_COLOR"), out m_fixedColor, OnSetPropColor); AddEmptyDropdown(Locale.Get("K45_WTS_OVERRIDE_FONT"), out m_fontSelect, helperSettings, OnSetFont); AddDropdown(Locale.Get("K45_WTS_TEXT_AVAILABILITY"), out m_dropdownTextContent, helperSettings, ddOrder.GetDropdownOptions("K45_WTS_BOARD_TEXT_AVAILABILITY_DESC"), OnSetTextOwnNameContent); WTSPropLayoutEditor.Instance.CurrentTabChanged += (x) => { ReloadInfo(x); }; AddLibBox <WTSLibPropSettings, BoardDescriptorGeneralXml>(helperLib, out UIButton m_copyButtonText, DoCopyText, out m_pasteButton, DoPasteText, out _, null, LoadIntoCurrentConfig, () => XmlUtils.DefaultXmlSerialize(WTSPropLayoutEditor.Instance.EditingInstance)); m_pasteButton.isVisible = m_clipboard != null; m_exportAsGlobal = (UIButton)helperLib.AddButton(Locale.Get("K45_WTS_PROPEDIT_EXPORTGLOBAL"), OnExportAsGlobal); m_exportAsAsset = (UIButton)helperLib.AddButton(Locale.Get("K45_WTS_PROPEDIT_EXPORTASSET"), OnExportAsAsset); helperLib.Self.clipChildren = false; }
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); }
public override void TopSettingsUI(UIHelperExtension helper) { UIHelperExtension group8 = helper.AddGroupExtended(Locale.Get("K45_VCE_GENERAL_INFO")); AddFolderButton(DefaultBuildingsConfigurationFolder, group8, "K45_VCE_DEFAULT_BUILDINGS_CONFIG_PATH_TITLE"); helper.AddButton(Locale.Get("K45_VCE_RELOAD_FILES"), ReloadFiles); }
public override void TopSettingsUI(UIHelperExtension ext) { base.TopSettingsUI(ext); UIHelperExtension grpPatch = ext.AddGroupExtended("Patching information"); ColossalFramework.UI.UILabel lblPatch = grpPatch.AddLabel("!!!"); if (!ElectricRoadsOverrides.GetAssembliesDebugString().IsNullOrWhiteSpace()) { lblPatch.text = ShowPatchingInfo(); } grpPatch.AddButton("Details", () => lblPatch.text = ShowPatchingInfo(true)); var dontShowUI = grpPatch.AddCheckbox("Don't display any UI ingame", m_dontShowUI, (x) => m_dontShowUI = x) as UICheckBox; if (SimulationManager.instance.m_metaData != null) { dontShowUI.Disable(); dontShowUI.text += " (Reload the game to change this option!)"; } else { dontShowUI.tooltip = "Selecting this option, the mod will not display any UI ingame"; } ext.Self.eventVisibilityChanged += (x, y) => { if (y && m_mustUpdateOnOpenPanel) { lblPatch.text = ShowPatchingInfo(false, true); } }; }
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 CreateGroupFileSelect(string i18n, OnDropdownSelectionChanged onChanged, OnButtonClicked onReload, out UIDropDown dropDown) { dropDown = m_uiHelperDistrict.AddDropdownLocalized(i18n, new string[0], -1, onChanged); dropDown.width = DefaultWidth; m_uiHelperDistrict.AddSpace(1); KlyteMonoUtils.LimitWidth((UIButton)m_uiHelperDistrict.AddButton(Locale.Get(i18n + "S_RELOAD"), onReload), 380); m_uiHelperDistrict.AddSpace(20); onReload.Invoke(); }
public void Awake() { MainContainer = GetComponent <UIPanel>(); MainContainer.autoLayout = true; MainContainer.autoLayoutDirection = LayoutDirection.Vertical; MainContainer.autoLayoutPadding = new RectOffset(5, 5, 5, 5); var m_uiHelperHS = new UIHelperExtension(MainContainer); m_buttonTool = (UIButton)m_uiHelperHS.AddButton(Locale.Get("K45_ADR_PICK_A_SEGMENT"), EnablePickTool); KlyteMonoUtils.LimitWidth(m_buttonTool, (m_uiHelperHS.Self.width - 20), true); AddLabel("", m_uiHelperHS, out m_labelSelectionDescription, out m_topContainerBar, false); m_labelSelectionDescription.prefix = Locale.Get("K45_ADR_CURRENTSELECTION") + ": "; m_labelSelectionDescription.padding.top = 8; AddButtonInEditorRow(m_labelSelectionDescription, Commons.UI.SpriteNames.CommonsSpriteNames.K45_PaintBucket, EnterPaintBucketMode, "K45_ADR_PAINTSEED", true, 30); AddButtonInEditorRow(m_labelSelectionDescription, Commons.UI.SpriteNames.CommonsSpriteNames.K45_Reload, OnSegmentNewSeed, "K45_ADR_CHANGESEED_INTERCROSS", true, 30); KlyteMonoUtils.LimitWidthAndBox(m_labelSelectionDescription, (m_labelSelectionDescription.width), true); KlyteMonoUtils.CreateUIElement(out m_editingContainer, MainContainer.transform, "SecContainer", new Vector4(0, 0, MainContainer.width, MainContainer.height - 10 - m_topContainerBar.height)); m_editingContainer.autoLayout = true; m_editingContainer.autoLayoutDirection = LayoutDirection.Vertical; m_editingContainer.autoLayoutPadding = new RectOffset(0, 0, 5, 5); var m_editingHelper = new UIHelperExtension(m_editingContainer); AddFilterableInput(Locale.Get("K45_ADR_HIGHWAYITEM_TYPE"), m_editingHelper, out m_hwType, out _, OnFilterHwTypes, OnSetHwType); AddTextField(Locale.Get("K45_ADR_HIGHWAYITEM_ID"), out m_hwId, m_editingHelper, OnSetHwId); AddTextField(Locale.Get("K45_ADR_HIGHWAYITEM_FORCEDNAME"), out m_hwName, m_editingHelper, OnSetHwForcedName); AddIntField(Locale.Get("K45_ADR_HIGHWAYITEM_MILEAGEOFFSET"), out m_hwMileageOffset, m_editingHelper, OnSetMileageOffset, false); AddCheckboxLocale("K45_ADR_HIGHWAYITEM_INVERTMILEAGE", out m_hwInvertMileage, m_editingHelper, OnSetMileageInvert); AddColorField(m_editingHelper, Locale.Get("K45_ADR_HIGHWAYITEM_COLOR"), out m_hwColor, OnSetHwColor); m_hwMileageOffset.width = 120; MainContainer.eventVisibilityChanged += (x, y) => { if (y) { eraseSeedBuffer = -1; DoEraseSeed(); } else { if (ToolsModifierControl.toolController.CurrentTool is RoadSegmentTool) { ToolsModifierControl.SetTool <DefaultTool>(); } OnSegmentSet(0); } }; OnSegmentSet(0); }
private static void AddFolderButton(string filePath, UIHelperExtension helper, string localeId) { FileInfo fileInfo = FileUtils.EnsureFolderCreation(filePath); helper.AddLabel(Locale.Get(localeId) + ":"); UIButton namesFilesButton = ((UIButton)helper.AddButton("/", () => ColossalFramework.Utils.OpenInFileBrowser(fileInfo.FullName))); namesFilesButton.textColor = Color.yellow; KlyteMonoUtils.LimitWidth(namesFilesButton, 710); namesFilesButton.text = fileInfo.FullName + Path.DirectorySeparatorChar; }
public void OnSettingsUI(UIHelperBase helperDefault) { UIHelperExtension helper = new UIHelperExtension((UIHelper)helperDefault); void ev() { foreach (Transform child in helper.self.transform) { GameObject.Destroy(child?.gameObject); } helper.self.eventVisibilityChanged += delegate(UIComponent component, bool b) { if (b) { showVersionInfoPopup(); } }; UIHelperExtension group9 = helper.AddGroupExtended(Locale.Get("SVM_BETAS_EXTRA_INFO")); group9.AddDropdownLocalized("SVM_MOD_LANG", SVMLocaleUtils.getLanguageIndex(), currentLanguageId.value, delegate(int idx) { currentLanguageId.value = idx; loadSVMLocale(true); }); group9.AddCheckbox(Locale.Get("SVM_DEBUG_MODE"), m_debugMode.value, delegate(bool val) { m_debugMode.value = val; }); group9.AddLabel("Version: " + fullVersion); group9.AddLabel(Locale.Get("SVM_ORIGINAL_TLM_VERSION") + " " + string.Join(".", ResourceLoader.loadResourceString("TLMVersion.txt").Split(".".ToCharArray()).Take(3).ToArray())); group9.AddButton(Locale.Get("SVM_RELEASE_NOTES"), delegate() { showVersionInfoPopup(true); }); //string testString = ""; //for (int i = 0; i < 360; i++) //{ // var angle = Vector2.zero.GetAngleToPoint(new Vector2(Mathf.Sin(i * Mathf.Deg2Rad), Mathf.Cos(i * Mathf.Deg2Rad))); // testString += $"{i:n0}° => {angle:n1} ({Mathf.Sin(i * Mathf.Deg2Rad):n3}, {Mathf.Cos(i * Mathf.Deg2Rad):n3})\n"; //} //group9.AddLabel("TST:\n" + testString); SVMUtils.doLog("End Loading Options"); } if (IsKlyteCommonsEnabled()) { loadSVMLocale(false); ev(); } else { eventOnLoadLocaleEnd = null; eventOnLoadLocaleEnd += ev; } }
public override void TopSettingsUI(UIHelperExtension helper) { UIHelperExtension group8 = helper.AddGroupExtended(Locale.Get("K45_ADR_GENERAL_INFO")); AddFolderButton(RoadPath, group8, "K45_ADR_ROAD_NAME_FILES_PATH_TITLE"); AddFolderButton(RoadPrefixPath, group8, "K45_ADR_ROAD_PREFIX_NAME_FILES_PATH_TITLE"); AddFolderButton(NeigborsPath, group8, "K45_ADR_NEIGHBOR_CITIES_NAME_FILES_PATH_TITLE"); AddFolderButton(DistrictPrefixPath, group8, "K45_ADR_DISTRICT_PREFIXES_FILES_PATH_TITLE"); AddFolderButton(DistrictNamePath, group8, "K45_ADR_DISTRICT_NAME_FILES_PATH_TITLE"); AddFolderButton(CitizenFirstNameMascPath, group8, "K45_ADR_CITIZEN_FIRST_NAME_MASC_FILES_PATH_TITLE"); AddFolderButton(CitizenFirstNameFemPath, group8, "K45_ADR_CITIZEN_FIRST_NAME_FEM_FILES_PATH_TITLE"); AddFolderButton(CitizenLastNamePath, group8, "K45_ADR_CITIZEN_LAST_NAME_FILES_PATH_TITLE"); AddFolderButton(HighwayConfigurationFolder, group8, "K45_ADR_HIGHWAY_CONFIGS_FILES_PATH_TITLE"); AdrController.ReloadAllFiles(); UIHelperExtension group7 = helper.AddGroupExtended(Locale.Get("K45_ADR_ADDITIONAL_FILES_SOURCE")); group7.AddLabel(Locale.Get("K45_ADR_GET_FILES_GITHUB")); group7.AddButton(Locale.Get("K45_ADR_GO_TO_GITHUB"), () => Application.OpenURL("https://github.com/klyte45/AddressesFiles")); //group7.AddButton("TST", () => K45DialogControl.ShowModalPromptText(new K45DialogControl.BindProperties //{ // message = "TESTE" //}, (x, format) => //{ // var or = format; // format = format.Replace("\\]", "\0"); // if (Regex.IsMatch(format, @"(?<=\[)(?<!\\\[).+?(?<!\\\])(?=\])")) // { // format = Regex.Matches(format, @"(?<=\[)(?<!\\\[).+?(?<!\\\])(?=\])")[0].Groups[0].Value; // } // else // { // format = Regex.Replace(format ?? "", "(?!\\{)(\\w+|\\.)(?!\\})", ""); // } // format = Regex.Replace(format, @"(?<!\\)(\[|\])", ""); // format = Regex.Replace(format, @"(\\)(\[|\])", "$2"); // format = Regex.Replace(format, @"\\\\", "\\"); // format = format.Replace("\0", "]"); // var formatFull = Regex.Replace(or, @"(?<!\\)(\[|\])", ""); // formatFull = Regex.Replace(formatFull, @"(\\)(\[|\])", "$2"); // formatFull = Regex.Replace(formatFull, @"\\\\", "\\"); // formatFull = formatFull.Replace("\0", "]"); // K45DialogControl.ShowModal(new K45DialogControl.BindProperties // { // message = $"\"{or}\"\nPRE: {format}\nFULL: {formatFull}" // }, (k) => true); // return true; //})); }
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() { 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(); }
public override void Group9SettingsUI(UIHelperExtension group9) { base.Group9SettingsUI(group9); group9.AddButton("Reset <K> Button position", () => { ButtonPosX.value = 5; ButtonPosY.value = 60; if (m_bg) { m_bg.absolutePosition = new Vector3(5, 60); } }); }
public static void GenerateExportButtons(UIHelperExtension helperSettings, string assetKind, out UIPanel m_exportButtonContainer, out UIButton m_exportButton, OnButtonClicked OnExport, out UIPanel m_exportButtonContainerLocal, out UIButton m_exportButtonLocal, OnButtonClicked OnExportLocal) { KlyteMonoUtils.CreateUIElement(out m_exportButtonContainer, helperSettings.Self.transform, $"ExportContainer{assetKind}", new Vector4(0, 0, helperSettings.Self.width, 45)); m_exportButtonContainer.autoLayout = true; m_exportButtonContainer.autoLayoutPadding = new RectOffset(0, 6, 0, 0); m_exportButton = UIHelperExtension.AddButton(m_exportButtonContainer, Locale.Get($"K45_ACE_EXPORTDATA_TOASSET{assetKind.ToUpper()}"), OnExport); KlyteMonoUtils.LimitWidthAndBox(m_exportButton, m_exportButtonContainer.width * 0.7f); KlyteMonoUtils.CreateUIElement(out m_exportButtonContainerLocal, helperSettings.Self.transform, $"ExportContainerLocal{assetKind}", new Vector4(0, 0, helperSettings.Self.width, 45)); m_exportButtonContainerLocal.autoLayout = true; m_exportButtonContainerLocal.autoLayoutPadding = new RectOffset(0, 6, 0, 0); m_exportButtonLocal = UIHelperExtension.AddButton(m_exportButtonContainerLocal, Locale.Get($"K45_ACE_EXPORTDATA_TOLOCAL{assetKind.ToUpper()}"), OnExportLocal); KlyteMonoUtils.LimitWidthAndBox(m_exportButtonLocal, m_exportButtonContainerLocal.width * 0.7f); }
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(); }); } }
protected void CreateGroup9(UIHelperExtension helper) { UIHelperExtension group9 = helper.AddGroupExtended(Locale.Get("SS_BETAS_EXTRA_INFO")); Group9SettingsUI(group9); group9.AddCheckbox(Locale.Get("SS_DEBUG_MODE"), m_debugMode.value, delegate(bool val) { m_debugMode.value = val; }); group9.AddLabel(String.Format(Locale.Get("SS_VERSION_SHOW"), fullVersion)); if (typeof(R) != typeof(SSResourceLoader)) { group9.AddLabel(Locale.Get("SS_ORIGINAL_TLM_VERSION") + " " + string.Join(".", Singleton <R> .instance.loadResourceString("TLMVersion.txt").Split(".".ToCharArray()).Take(3).ToArray())); } group9.AddButton(Locale.Get("SS_RELEASE_NOTES"), delegate() { showVersionInfoPopup(true); }); }
public override void TopSettingsUI(UIHelperExtension helper) { UIHelperExtension group8 = helper.AddGroupExtended(Locale.Get("K45_ADR_GENERAL_INFO")); AddFolderButton(RoadPath, group8, "K45_ADR_ROAD_NAME_FILES_PATH_TITLE"); AddFolderButton(RoadPrefixPath, group8, "K45_ADR_ROAD_PREFIX_NAME_FILES_PATH_TITLE"); AddFolderButton(NeigborsPath, group8, "K45_ADR_NEIGHBOR_CITIES_NAME_FILES_PATH_TITLE"); AddFolderButton(DistrictPrefixPath, group8, "K45_ADR_DISTRICT_PREFIXES_FILES_PATH_TITLE"); AddFolderButton(DistrictNamePath, group8, "K45_ADR_DISTRICT_NAME_FILES_PATH_TITLE"); AddFolderButton(CitizenFirstNameMascPath, group8, "K45_ADR_CITIZEN_FIRST_NAME_MASC_FILES_PATH_TITLE"); AddFolderButton(CitizenFirstNameFemPath, group8, "K45_ADR_CITIZEN_FIRST_NAME_FEM_FILES_PATH_TITLE"); AddFolderButton(CitizenLastNamePath, group8, "K45_ADR_CITIZEN_LAST_NAME_FILES_PATH_TITLE"); UIHelperExtension group7 = helper.AddGroupExtended(Locale.Get("K45_ADR_ADDITIONAL_FILES_SOURCE")); group7.AddLabel(Locale.Get("K45_ADR_GET_FILES_GITHUB")); group7.AddButton(Locale.Get("K45_ADR_GO_TO_GITHUB"), () => Application.OpenURL("https://github.com/klyte45/AddressesFiles")); }
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() { 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(); }); }
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"); } }
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 OnSettingsUI(UIHelperBase helper) { helperExtension = new UIHelperExtension((UIHelper)helper); // if (Singleton<SimulationManager>.instance.m_metaData != null) { // helperExtension.AddLabel ("Please use from Content Manager only!"); // } else { creatingUI = true; if (firstStart) { readSettings(); } checkAvailableConfigs(); UIHelperExtension groupSave = helperExtension.AddGroupExtended("Save currently activated mods, assets and district styles"); ((UIPanel)groupSave.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)groupSave.self).wrapLayout = true; ((UIPanel)groupSave.self).width = 730; configNameField = (UITextField)groupSave.AddTextfield("Enter name", lastConfigName, changeConfigName, changeConfigName); groupSave.AddButton("Save", saveCurrentConfig); helperExtension.AddSpace(20); UIHelperExtension groupLoad = helperExtension.AddGroupExtended("Load a previously saved configuration"); ((UIPanel)groupLoad.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)groupLoad.self).wrapLayout = true; ((UIPanel)groupLoad.self).width = 700; configDropdown = (UIDropDown)groupLoad.AddDropdown("Pick config", availableConfigs.ToArray(), currentLoadOption, changeLoadOption); groupLoad.AddButton("Delete", deleteConfig); docVersionField = groupLoad.AddLabel(""); groupLoad.AddSpace(20); groupLoad.AddButton("Apply On Game Restart", applyOnRestart); configRestartField = groupLoad.AddLabel(""); configRestartField.textColor = Color.cyan; groupLoad.AddSpace(20); UIButton applyNow = (UIButton)groupLoad.AddButton("Apply Now", applyConfig); configAppliedField = groupLoad.AddLabel(""); if (Singleton <SimulationManager> .instance.m_metaData != null) { applyNow.Disable(); configAppliedField.text = "Available from Content Manager Only"; configAppliedField.textColor = Color.grey; } else { configAppliedField.textColor = Color.cyan; } groupLoad.AddCheckbox("Do not affect mods status", !triggerEnableMods, changeLoadModOption); groupLoad.AddLabel("If you have many mods, applying the configuration immediately will cause \na long freeze. The game will be also slowed down after that. \nYou can however choose to affect the assets and district styles status only, \nwhich does not cause any perfomance issue."); groupLoad.AddSpace(70); groupLoad.AddDropdown("When finding an unlisted mod/asset :", unknownModsBehaviours, unknownModsStatus, changeUnknownModBehaviour).width = 400; helperExtension.AddSpace(20); UIHelperExtension groupListing = helperExtension.AddGroupExtended("Listing"); ((UIPanel)groupListing.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)groupListing.self).wrapLayout = true; ((UIPanel)groupListing.self).width = 730; ((UIPanel)groupListing.self.parent).Find <UILabel> ("Label").isVisible = false; statsField = groupListing.AddLabel(""); groupListing.AddSpace(10); listButton = (UIButton)groupListing.AddButton("View List (slow)", updateModsList); groupListing.AddButton("Copy List To Clipboard", configToClipboard); groupListing.AddSpace(10); modsList = helperExtension.AddGroupExtended("Mods Listed"); ((UIPanel)modsList.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)modsList.self).wrapLayout = true; ((UIPanel)modsList.self).width = 730; assetsList = helperExtension.AddGroupExtended("Assets Listed"); ((UIPanel)assetsList.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)assetsList.self).wrapLayout = true; ((UIPanel)assetsList.self).width = 730; districtsList = helperExtension.AddGroupExtended("District Styles Listed"); ((UIPanel)districtsList.self).autoLayoutDirection = LayoutDirection.Horizontal; ((UIPanel)districtsList.self).wrapLayout = true; ((UIPanel)districtsList.self).width = 730; //apply restart config config if (firstStart) { if (startApplyConfig != null && startApplyConfig.Length > 0) { loadModsList(startApplyConfig); applyConfig(); } startApplyConfig = ""; writeSettings(); firstStart = false; } creatingUI = false; //load last saved config int lastIndex = availableConfigs.IndexOf(lastConfigName); if (lastIndex >= 0) { changeLoadOption(lastIndex); configDropdown.selectedIndex = lastIndex; } else { changeLoadOption(0); } //} }