private void CreateCheckboxes() { foreach (var i in m_checkboxes?.Keys) { UnityEngine.Object.Destroy(m_checkboxes[i].gameObject); } m_defaultAssets = extension.GetAllBasicAssets(0); m_checkboxes = new Dictionary <string, UICheckBox>(); TLMUtils.doLog("m_defaultAssets Size = {0} ({1})", m_defaultAssets?.Count, string.Join(",", m_defaultAssets.Keys?.ToArray() ?? new string[0])); foreach (var i in m_defaultAssets.Keys) { var checkbox = (UICheckBox)m_uiHelper.AddCheckbox(m_defaultAssets[i], false, (x) => { if (m_isLoading || m_prefixIdx < 0) { return; } if (x) { extension.AddAsset((uint)m_prefixIdx, i); } else { extension.RemoveAsset((uint)m_prefixIdx, i); } }); CreateModelCheckBox(i, checkbox); checkbox.label.tooltip = checkbox.label.text; checkbox.label.textScale = 0.9f; checkbox.label.transform.localScale = new Vector3(Math.Min((m_mainPanel.width - 70) / checkbox.label.width, 1), 1); m_checkboxes[i] = checkbox; } }
private void InitBudgetConfigTab() { UIHelperExtension perPeriodBudgetContainer = createNewAsteriskTab(Locale.Get("TLM_PREFIX_BUDGET")); m_budgetSliders = new UISlider[8]; m_chkPerHourBudget = (UICheckBox)perPeriodBudgetContainer.AddCheckbox(Locale.Get("TLM_USE_PER_PERIOD_BUDGET"), false, delegate(bool val) { for (int i = 0; i < 8; i++) { m_hourBudgets[i] = m_hourBudgets[0]; } updateBudgetSliders(); }); m_chkSingleBudget = (UICheckBox)perPeriodBudgetContainer.AddCheckbox(Locale.Get("TLM_USE_SINGLE_BUDGET"), true, delegate(bool val) { updateBudgetSliders(); }); m_chkPerHourBudget.group = m_chkPerHourBudget.parent; m_chkSingleBudget.group = m_chkPerHourBudget.parent; for (int i = 0; i < 8; i++) { var j = i; m_budgetSliders[i] = GenerateBudgetMultiplierField(perPeriodBudgetContainer, Locale.Get("TLM_BUDGET_MULTIPLIER_PERIOD_LABEL", i) + ":", delegate(float f) { m_budgetSliders[j].transform.parent.GetComponentInChildren <UILabel>().text = string.Format(" x{0:0.00}", f); if (!m_isLoadingPrefixData) { m_hourBudgets[j] = (uint)(f * 100); setBudgetMultiplierDropDownSelection(m_systemTypeDropDown.selectedIndex, (uint)(m_prefixSelection.selectedIndex - 1)); } }); } }
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); } }
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 CreateAssetLineTemplate() { var go = new GameObject(); UIPanel panel = go.AddComponent <UIPanel>(); panel.size = new Vector2(m_scrollablePanel.width - 40f, 36); panel.autoLayout = true; panel.wrapLayout = false; panel.autoLayoutDirection = LayoutDirection.Horizontal; UICheckBox uiCheckbox = UIHelperExtension.AddCheckbox(panel, "AAAAAA", false); uiCheckbox.name = "AssetCheckbox"; uiCheckbox.height = 29f; uiCheckbox.width = 290f; uiCheckbox.label.processMarkup = true; uiCheckbox.label.textScale = 0.8f; KlyteMonoUtils.CreateUIElement(out UITextField capEditField, panel.transform, "Cap", new Vector4(0, 0, 50, 30)); KlyteMonoUtils.UiTextFieldDefaults(capEditField); KlyteMonoUtils.InitButtonFull(capEditField, false, "OptionsDropboxListbox"); capEditField.isTooltipLocalized = true; capEditField.tooltipLocaleID = "K45_TLM_ASSET_CAPACITY_FIELD_DESCRIPTION"; capEditField.numericalOnly = true; capEditField.maxLength = 6; capEditField.padding = new RectOffset(2, 2, 4, 2); TLMUiTemplateUtils.GetTemplateDict()["K45_TLM_AssetSelectionTabLineTemplate"] = panel; }
void Awake() { m_mainPanel = GetComponent <UIPanel>(); m_mainPanel.autoLayout = true; m_mainPanel.autoLayoutDirection = LayoutDirection.Horizontal; m_mainPanel.wrapLayout = false; m_mainPanel.padding.left = 10; var uiHelper = new UIHelperExtension(m_mainPanel); m_checkbox = uiHelper.AddCheckbox("<<>>", false, (x) => { m_callback?.Invoke(x); }) as UICheckBox; m_checkbox.width = m_mainPanel.width - 144; m_checkbox.height = 40; m_checkbox.label.height = 40; m_checkbox.label.verticalAlignment = UIVerticalAlignment.Middle; m_preview = m_mainPanel.AddUIComponent <UIPanel>(); m_preview.area = new Vector4(0, 0, 134, 40); m_checkbox.isInteractive = false; m_checkbox.label.isInteractive = false; m_preview.isInteractive = false; m_mainPanel.eventClicked += (x, y) => m_checkbox.isChecked = !m_checkbox.isChecked; m_mouseIsOver = false; m_mainPanel.eventMouseEnter += new MouseEventHandler(OnMouseEnter); m_mainPanel.eventMouseLeave += new MouseEventHandler(OnMouseLeave); m_mainPanel.backgroundSprite = "InfoviewPanel"; SetBackgroundColor(); component.eventZOrderChanged += delegate(UIComponent c, int r) { SetBackgroundColor(); }; }
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); } }; }
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 PopulateCheckboxes() { foreach (string i in m_checkboxes.Keys) { UnityEngine.Object.Destroy(m_checkboxes[i].gameObject); } ServiceSystemDefinition ssd = SingletonLite <T> .instance.GetSSD(); m_defaultAssets = ssd.GetBuildingExtension().GetAllBasicAssets(); m_checkboxes = new Dictionary <string, UICheckBox>(); LogUtils.DoLog("m_defaultAssets Size = {0} ({1})", m_defaultAssets?.Count, string.Join(",", m_defaultAssets.Keys?.ToArray() ?? new string[0])); foreach (string i in m_defaultAssets.Keys) { var checkbox = (UICheckBox)m_uiHelper.AddCheckbox(m_defaultAssets[i], false, (x) => { IVMCBuildingExtension ext = SingletonLite <T> .instance.GetSSD().GetBuildingExtension(); ushort buildingId = m_buildingInfo.buildingIdSel.Building; if (m_isLoading) { return; } if (x) { if (ext.GetIgnoreDistrict(buildingId)) { ext.AddAsset(buildingId, i); } else { SingletonLite <T> .instance.GetSSD().GetDistrictExtension().AddAsset(BuildingUtils.GetBuildingDistrict(buildingId), i); } } else { if (ext.GetIgnoreDistrict(buildingId)) { ext.RemoveAsset(buildingId, i); } else { SingletonLite <T> .instance.GetSSD().GetDistrictExtension().RemoveAsset(BuildingUtils.GetBuildingDistrict(buildingId), i); } } }); CreateModelCheckBox(i, checkbox); checkbox.label.tooltip = checkbox.label.text; checkbox.label.textScale = 0.9f; checkbox.label.transform.localScale = new Vector3(Math.Min((m_mainPanel.width - 50) / checkbox.label.width, 1), 1); m_checkboxes[i] = checkbox; } }
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 ext) { base.TopSettingsUI(ext); var ghostModeChk = ext.AddCheckbox(Locale.Get("K45_ZM_GHOST_MODE_OPTION"), ZMController.m_ghostMode, (x) => { ZMController.m_ghostMode = x; ZoneMixerOverrides.FixZonePanel(); }) as UICheckBox; ghostModeChk.tooltip = Locale.Get("K45_ZM_GHOST_MODE_OPTION_TOOLTIP"); if (SimulationManager.exists && SimulationManager.instance.m_metaData != null) { ghostModeChk.Disable(); } }
internal UICheckBox generateCheckboxConfig(UIHelperExtension group, string title, TLMConfigWarehouse.ConfigIndex configIndex, int maxWidth = 650) { checkBoxes[configIndex] = (UICheckBox)group.AddCheckbox(title, currentConfigWarehouseEditor.GetBool(configIndex), delegate(bool b) { if (!isLoading) { currentConfigWarehouseEditor.SetBool(configIndex, b); } }); Vector3 labelPos = checkBoxes[configIndex].label.relativePosition; KlyteMonoUtils.LimitWidthAndBox(checkBoxes[configIndex].label, maxWidth, out UIPanel box); box.padding = new RectOffset((int)labelPos.x, 0, (int)labelPos.y, 0); checkBoxes[configIndex].width = maxWidth + labelPos.x + 5; return(checkBoxes[configIndex]); }
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); }); }
private void CreateDepotLineTemplate() { var go = new GameObject(); UIPanel panel = go.AddComponent <UIPanel>(); panel.size = new Vector2(m_scrollablePanel.width - 40f, 36); panel.autoLayout = true; panel.wrapLayout = false; panel.autoLayoutDirection = LayoutDirection.Horizontal; UICheckBox uiCheckbox = UIHelperExtension.AddCheckbox(panel, "AAAAAA", false); uiCheckbox.name = "DepotCheckbox"; uiCheckbox.height = 29f; uiCheckbox.width = 310f; uiCheckbox.label.processMarkup = true; uiCheckbox.label.textScale = 0.8f; KlyteMonoUtils.CreateUIElement(out UIButton gotoButton, panel.transform, "GoTo", new Vector4(0, 0, 30, 30)); KlyteMonoUtils.InitButton(gotoButton, true, "LineDetailButton"); TLMUiTemplateUtils.GetTemplateDict()["K45_TLM_DepotSelectionTabLineTemplate"] = panel; }
protected override void AwakeActions() { CreateTopButton(MainPanel, "ExportAsDefault", "K45_ER_EXPORT_DEFAULT_BTN", CommonsSpriteNames.K45_Save.ToString(), new Vector2(10, 50), (x, y) => ClassesData.Instance.SaveAsDefault()); CreateTopButton(MainPanel, "ImportDefault", "K45_ER_IMPORT_DEFAULT_BTN", CommonsSpriteNames.K45_Load.ToString(), new Vector2(95, 50), (x, y) => ClassesData.Instance.LoadDefaults()); CreateTopButton(MainPanel, "SelectAll", "K45_ER_SELECT_ALL_BTN", "check-checked", new Vector2(180, 50), (x, y) => ClassesData.Instance.SelectAll()); CreateTopButton(MainPanel, "SelectNone", "K45_ER_SELECT_NONE_BTN", "check-unchecked", new Vector2(265, 50), (x, y) => ClassesData.Instance.UnselectAll()); CreateTopButton(MainPanel, "Reset", "K45_ER_RESET_BTN", CommonsSpriteNames.K45_Reload.ToString(), new Vector2(350, 50), (x, y) => ClassesData.Instance.SafeCleanAll(m_allClasses.Keys)); KlyteMonoUtils.CreateScrollPanel(MainPanel, out UIScrollablePanel scrollPanel, out _, MainPanel.width - 25, MainPanel.height - 105, new Vector3(5, 100)); scrollPanel.autoLayout = true; scrollPanel.autoLayoutDirection = LayoutDirection.Vertical; scrollPanel.autoLayoutPadding = new RectOffset(0, 0, 5, 5); scrollPanel.backgroundSprite = "ScrollbarTrack"; scrollPanel.scrollPadding = new RectOffset(5, 5, 5, 5); m_allClasses = ((FastList <PrefabCollection <NetInfo> .PrefabData>) typeof(PrefabCollection <NetInfo>).GetField("m_scenePrefabs", RedirectorUtils.allFlags).GetValue(null)) .m_buffer .Select(x => x.m_prefab) .Where(x => x?.m_class != null && (x.m_class.m_layer == ItemClass.Layer.Default || x.m_class.m_layer == ItemClass.Layer.MetroTunnels || x.m_class.m_layer == ItemClass.Layer.WaterPipes || x.m_class.m_layer == ItemClass.Layer.WaterStructures)) .GroupBy(x => x.m_class.name) .ToDictionary(x => x.First().m_class, x => x.ToList()); foreach (KeyValuePair <ItemClass, List <NetInfo> > clazz in m_allClasses) { List <NetInfo> itemList = clazz.Value; ItemClass clazzKey = clazz.Key; string className = clazzKey.name; KlyteMonoUtils.CreateUIElement(out UIPanel row, scrollPanel.transform, $"{clazz.Key.name}", new Vector4(0, 0, scrollPanel.width, 20)); row.autoLayout = true; row.padding = new RectOffset(5, 5, 0, 0); row.stringUserData = className; UICheckBox uiCheckbox = UIHelperExtension.AddCheckbox(row, $"{clazz.Key.name}", ClassesData.Instance.GetConductibility(clazzKey)); uiCheckbox.name = "ClassCheckbox"; uiCheckbox.height = 20f; uiCheckbox.width = 335f; uiCheckbox.label.processMarkup = true; uiCheckbox.label.textScale = 0.8f; uiCheckbox.objectUserData = clazzKey; uiCheckbox.eventCheckChanged += SetItemClassValue; KlyteMonoUtils.LimitWidthAndBox(uiCheckbox.label, 325); ClassesData.Instance.eventOnValueChanged += (x, y) => { if (x == className && y is bool b) { SetNewValue(uiCheckbox, b); } }; ClassesData.Instance.eventAllChanged += () => SetNewValue(uiCheckbox, ClassesData.Instance.GetConductibility(clazzKey)); KlyteMonoUtils.CreateUIElement(out UIButton help, row.transform, "?", new Vector4(0, 0, 20, 20)); help.text = "?"; help.hoveredTextColor = Color.blue; KlyteMonoUtils.InitButtonFull(help, false, "OptionBase"); help.eventClicked += (x, y) => { K45DialogControl.ShowModal(new K45DialogControl.BindProperties() { icon = ElectricRoadsMod.Instance.IconName, messageAlign = UIHorizontalAlignment.Left, showButton1 = true, showButton2 = true, showButton3 = true, showClose = true, textButton1 = Locale.Get("K45_ER_ACTIVATE_CLASS_BTN"), textButton2 = Locale.Get("K45_ER_DEACTIVATE_CLASS_BTN"), textButton3 = Locale.Get("K45_ER_RETURN_BTN"), title = string.Format(Locale.Get("K45_ER_TITLE_NET_LIST_WINDOW"), className), message = string.Format(Locale.Get(itemList.Count <= 20 ? "K45_ER_PATTERN_NET_LIST_FEW" : "K45_ER_PATTERN_NET_LIST_FULL"), string.Join("\n", itemList.Take(20).Select(x => $"\t- {x.GetLocalizedTitle()}").ToArray()), itemList.Count - 20) }, (x) => { if (x == 1) { uiCheckbox.isChecked = true; } else if (x == 2) { uiCheckbox.isChecked = false; } return(true); }); }; } Quicksort(scrollPanel.components, new Comparison <UIComponent>(CompareNames), false); }
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); } //} }
private void BindParentChanges() { m_lineInfo.EventOnLineChanged += (lineId) => { TLMUtils.doLog("EventOnLineChanged"); m_isLoading = true; bool isCustomLine = TLMTransportLineExtension.instance.GetUseCustomConfig(lineId); TransportSystemDefinition tsd = TransportSystemDefinition.from(lineId); TLMUtils.doLog("tsd = {0}", tsd); if (m_lastDef != tsd) { foreach (var i in m_checkboxes.Keys) { UnityEngine.Object.Destroy(m_checkboxes[i].gameObject); } m_defaultAssets = tsd.GetTransportExtension().GetAllBasicAssets(0); m_checkboxes = new Dictionary <string, UICheckBox>(); TLMUtils.doLog("m_defaultAssets Size = {0} ({1})", m_defaultAssets?.Count, string.Join(",", m_defaultAssets.Keys?.ToArray() ?? new string[0])); foreach (var i in m_defaultAssets.Keys) { var checkbox = (UICheckBox)m_uiHelper.AddCheckbox(m_defaultAssets[i], false, (x) => { ushort lineIdx = m_lineInfo.CurrentSelectedId; if (m_isLoading) { return; } if (x) { if (TLMTransportLineExtension.instance.GetUseCustomConfig(lineIdx)) { TLMTransportLineExtension.instance.AddAsset(lineIdx, i); } else { tsd.GetTransportExtension().AddAsset(TLMLineUtils.getPrefix(lineIdx), i); } } else { if (TLMTransportLineExtension.instance.GetUseCustomConfig(lineIdx)) { TLMTransportLineExtension.instance.RemoveAsset(lineIdx, i); } else { tsd.GetTransportExtension().RemoveAsset(TLMLineUtils.getPrefix(lineIdx), i); } } }); CreateModelCheckBox(i, checkbox); checkbox.label.tooltip = checkbox.label.text; checkbox.label.textScale = 0.9f; checkbox.label.transform.localScale = new Vector3(Math.Min((m_mainPanel.width - 50) / checkbox.label.width, 1), 1); m_checkboxes[i] = checkbox; } } m_lastDef = tsd; List <string> selectedAssets; if (isCustomLine) { selectedAssets = TLMTransportLineExtension.instance.GetAssetList(lineId); } else { selectedAssets = tsd.GetTransportExtension().GetAssetList(TLMLineUtils.getPrefix(lineId)); } TLMUtils.doLog("selectedAssets Size = {0} ({1})", selectedAssets?.Count, string.Join(",", selectedAssets?.ToArray() ?? new string[0])); foreach (var i in m_checkboxes.Keys) { m_checkboxes[i].isChecked = selectedAssets.Contains(i); } if (isCustomLine) { m_title.text = string.Format(Locale.Get("TLM_ASSET_SELECT_WINDOW_TITLE"), TLMLineUtils.getLineStringId(lineId), TLMConfigWarehouse.getNameForTransportType(tsd.toConfigIndex())); } else { TLMConfigWarehouse.ConfigIndex transportType = tsd.toConfigIndex(); ModoNomenclatura mnPrefixo = (ModoNomenclatura)TLMConfigWarehouse.getCurrentConfigInt(TLMConfigWarehouse.ConfigIndex.PREFIX | transportType); var prefix = TLMLineUtils.getPrefix(lineId); m_title.text = string.Format(Locale.Get("TLM_ASSET_SELECT_WINDOW_TITLE_PREFIX"), prefix > 0 ? TLMUtils.getStringFromNumber(TLMUtils.getStringOptionsForPrefix(mnPrefixo), (int)prefix + 1) : Locale.Get("TLM_UNPREFIXED"), TLMConfigWarehouse.getNameForTransportType(tsd.toConfigIndex())); } m_isLoading = false; m_previewPanel.isVisible = false; }; }
private UICheckBox generateCheckboxConfig(UIHelperExtension group, string title, TLMConfigWarehouse.ConfigIndex configIndex) { checkBoxes[configIndex] = (UICheckBox)group.AddCheckbox(title, currentConfigWarehouseEditor.getBool(configIndex), delegate(bool b) { currentConfigWarehouseEditor.setBool(configIndex, b); }); return(checkBoxes[configIndex]); }
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"); } }