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;
        }
Example #2
0
        public void Awake()
        {
            Instance      = this;
            MainContainer = GetComponent <UIComponent>();
            m_uiHelper    = new UIHelperExtension(MainContainer);

            ((UIPanel)m_uiHelper.Self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)m_uiHelper.Self).wrapLayout          = true;
            ((UIPanel)m_uiHelper.Self).autoLayout          = true;

            UILabel titleLabel = m_uiHelper.AddLabel("");

            titleLabel.autoSize      = true;
            titleLabel.textAlignment = UIHorizontalAlignment.Center;
            titleLabel.wordWrap      = false;
            titleLabel.minimumSize   = new Vector2(MainContainer.width - 10, 0);;
            titleLabel.localeID      = "K45_TLM_PER_HOUR_TICKET_PRICE_TITLE";

            m_uiHelper.AddSpace(5);
            KlyteMonoUtils.CreateElement(out m_clockChart, m_uiHelper.Self.transform, "DailyClock");
            m_uiHelper.AddSpace(20);
            KlyteMonoUtils.CreateElement(out m_titleContainer, m_uiHelper.Self.transform, "Title");
            PopulateTitlePanel(m_titleContainer);
            KlyteMonoUtils.CreateScrollPanel(m_uiHelper.Self, out m_entryListContainer, out _, m_uiHelper.Self.width - 20f, m_uiHelper.Self.height - 150, Vector3.zero);
        }
Example #3
0
        private void Awake()
        {
            parent = GetComponentInParent <UIComponent>();
            var group15 = new UIHelperExtension(parent.GetComponentInChildren <UIScrollablePanel>());

            ((UIScrollablePanel)group15.Self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIScrollablePanel)group15.Self).wrapLayout          = true;
            ((UIScrollablePanel)group15.Self).width = 730;

            group15.AddLabel(Locale.Get("K45_TLM_AUTO_NAME_SETTINGS_PUBLIC_AREAS"));
            group15.AddSpace(1);
            group15.AddLabel(Locale.Get("K45_TLM_AUTO_NAME_SETTINGS_PUBLIC_TRANSPORT_DESC"));
            group15.AddSpace(15);

            foreach (TLMConfigWarehouse.ConfigIndex ci in TLMConfigWarehouse.extraAutoNameCategories)
            {
                UICheckBox checkbox       = TLMConfigOptions.instance.generateCheckboxConfig(group15, TLMConfigWarehouse.GetNameForServiceType(ci), TLMConfigWarehouse.ConfigIndex.USE_FOR_AUTO_NAMING_REF | ci, 200);
                UIPanel    textFieldPanel = TLMConfigOptions.instance.generateTextFieldConfig(group15, Locale.Get("K45_TLM_PREFIX_OPTIONAL"), TLMConfigWarehouse.ConfigIndex.AUTO_NAMING_REF_TEXT | ci).GetComponentInParent <UIPanel>();
                textFieldPanel.autoLayoutDirection       = LayoutDirection.Horizontal;
                textFieldPanel.autoFitChildrenVertically = true;
                UILabel title = textFieldPanel.GetComponentInChildren <UILabel>();
                title.textAlignment = UIHorizontalAlignment.Center;
                KlyteMonoUtils.LimitWidthAndBox(title, 220, true);
                textFieldPanel.AttachUIComponent(checkbox.gameObject);
                checkbox.eventVisibilityChanged += (x, y) =>
                {
                    if (x)
                    {
                        checkbox.zOrder = 0;
                    }
                };
                group15.AddSpace(2);
            }
        }
        public void Awake()
        {
            MainContainer                     = GetComponent <UIPanel>();
            MainContainer.autoLayout          = true;
            MainContainer.autoLayoutDirection = LayoutDirection.Vertical;
            MainContainer.autoLayoutPadding   = new RectOffset(5, 5, 5, 5);

            var m_uiHelperHS = new UIHelperExtension(MainContainer);

            AddEmptyDropdown(Locale.Get("K45_WTS_ABBREVIATION_FILE"), out m_abbriviationFile, m_uiHelperHS, OnSetAbbreviationFile);
            AddButtonInEditorRow(m_abbriviationFile, CommonsSpriteNames.K45_Reload, () => ReloadAbbreviations());
            ReloadAbbreviations();

            AddDropdown(Locale.Get("K45_WTS_CUSTOM_NAME_EXTRACTION_QUALIFIER"), out m_qualifierExtractionDropdown, m_uiHelperHS, ColossalUIExtensions.GetDropdownOptions <RoadQualifierExtractionMode>("K45_WTS_RoadQualifierExtractionMode"), SetRoadQualifierExtractionMode);
            m_qualifierExtractionDropdown.selectedIndex = (int)WTSRoadNodesData.Instance.RoadQualifierExtraction;

            KlyteMonoUtils.CreateUIElement(out UIPanel secondaryContainer, MainContainer.transform, "SecContainer", new Vector4(0, 0, MainContainer.width, 655));
            secondaryContainer.autoLayout          = true;
            secondaryContainer.autoLayoutDirection = LayoutDirection.Horizontal;
            secondaryContainer.autoLayoutPadding   = new RectOffset(0, 10, 0, 0);

            KlyteMonoUtils.CreateUIElement(out UIPanel tertiaryContainer, secondaryContainer.transform, "TrcContainer", new Vector4(0, 0, secondaryContainer.width * 0.25f, secondaryContainer.height));
            RuleList = tertiaryContainer.gameObject.AddComponent <WTSRoadCornerEditorRuleList>();

            KlyteMonoUtils.CreateUIElement(out UIPanel editorPanel, secondaryContainer.transform, "EditPanel", new Vector4(0, 0, secondaryContainer.width * 0.75f - 35, secondaryContainer.height));
            editorPanel.gameObject.AddComponent <WTSRoadCornerEditorDetailTabs>();
        }
Example #5
0
        public void Awake()
        {
            m_bg = component as UIScrollablePanel;

            PublicTransportWorldInfoPanel ptwip = UVMPublicTransportWorldInfoPanel.m_obj.origInstance;

            AddNewStopTemplate();

            ptwip.component.width = 800;

            BindComponents(ptwip);
            AdjustLineStopsPanel(ptwip);

            KlyteMonoUtils.CreateUIElement(out m_panelModeSelector, m_bg.parent.transform);
            m_panelModeSelector.autoFitChildrenHorizontally = true;
            m_panelModeSelector.autoFitChildrenVertically   = true;
            m_panelModeSelector.autoLayout          = true;
            m_panelModeSelector.autoLayoutDirection = LayoutDirection.Horizontal;
            m_mapModeDropDown = UIHelperExtension.CloneBasicDropDownNoLabel(Enum.GetNames(typeof(MapMode)).Select(x => Locale.Get("K45_TLM_LINEAR_MAP_VIEW_MODE", x)).ToArray(), (int idx) =>
            {
                m_currentMode = (MapMode)idx;
                RefreshVehicleButtons(GetLineID());
            }, m_panelModeSelector);
            m_mapModeDropDown.textScale  = 0.75f;
            m_mapModeDropDown.size       = new Vector2(200, 25);
            m_mapModeDropDown.itemHeight = 16;

            UICheckBox unscaledCheck = UIHelperExtension.AddCheckboxLocale(m_panelModeSelector, "K45_TLM_LINEAR_MAP_SHOW_UNSCALED", m_unscaledMode, (val) => m_unscaledMode = val);

            KlyteMonoUtils.LimitWidthAndBox(unscaledCheck.label, 165);

            InstanceManagerOverrides.EventOnBuildingRenamed += (x) => m_dirtyNames = true;
        }
        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));
                    }
                });
            }
        }
Example #7
0
        public static void OverrideStart(PublicTransportWorldInfoPanel __instance)
        {
            m_obj.origInstance         = __instance;
            __instance.component.width = 800;

            BindComponents(__instance);

            SetNameFieldProperties();

            KlyteMonoUtils.CreateTabsComponent(out m_obj.m_lineConfigTabs, out _, __instance.transform, "LineConfig", new Vector4(15, 45, 365, 30), new Vector4(15, 80, 380, 445));

            m_obj.m_childControls.Add("Default", TabCommons.CreateTab <UVMMainWIPTab>(m_obj.m_lineConfigTabs, "ThumbStatistics", "K45_TLM_WIP_STATS_TAB", "Default", false));
            m_obj.m_childControls.Add("Reports", TabCommons.CreateTab <TLMReportsTab>(m_obj.m_lineConfigTabs, "IconMessage", "K45_TLM_WIP_REPORT_TAB", "Reports", false));
            m_obj.m_childControls.Add("Budget", TabCommons.CreateTab <UVMBudgetConfigTab>(m_obj.m_lineConfigTabs, "InfoPanelIconCurrency", "K45_TLM_WIP_BUDGET_CONFIGURATION_TAB", "Budget", false));
            m_obj.m_childControls.Add("Ticket", TabCommons.CreateTab <TLMTicketConfigTab>(m_obj.m_lineConfigTabs, "FootballTicketIcon", "K45_TLM_WIP_TICKET_CONFIGURATION_TAB", "Ticket", false));
            m_obj.m_childControls.Add("AssetSelection", TabCommons.CreateTab <TLMAssetSelectorTab>(m_obj.m_lineConfigTabs, "IconPolicyFreePublicTransport", "K45_TLM_WIP_ASSET_SELECTION_TAB", "AssetSelection", false));
            m_obj.m_childControls.Add("DepotSelection", TabCommons.CreateTab <TLMDepotSelectorTab>(m_obj.m_lineConfigTabs, "UIFilterBigBuildings", "K45_TLM_WIP_DEPOT_SELECTION_TAB", "DepotSelection", false));
            m_obj.m_childControls.Add("PrefixConfig", TabCommons.CreateTab <TLMPrefixOptionsTab>(m_obj.m_lineConfigTabs, "InfoIconLevel", "K45_TLM_WIP_PREFIX_CONFIG_TAB", "PrefixConfig", false));
            m_obj.m_childControls.Add("StopsPanel", __instance.Find <UIPanel>("StopsPanel").parent.gameObject.AddComponent <UVMTransportLineLinearMap>());
            DestroyNotUsed(__instance);

            m_obj.m_specificConfig = UIHelperExtension.AddCheckboxLocale(__instance.component, "K45_TLM_USE_SPECIFIC_CONFIG", false, (x) =>
            {
                TLMTransportLineExtension.Instance.SetUseCustomConfig(GetLineID(), x);
                MarkDirty(typeof(UVMPublicTransportWorldInfoPanel));
            });
            m_obj.m_specificConfig.relativePosition = new Vector3(10, 530);
            m_obj.m_specificConfig.isInteractive    = false;
            KlyteMonoUtils.LimitWidthAndBox(m_obj.m_specificConfig.label, 400);
        }
Example #8
0
        private void DoWithSettingsUI(UIHelperExtension helper)
        {
            foreach (Transform child in helper.Self?.transform)
            {
                GameObject.Destroy(child?.gameObject);
            }

            var newSprites = new List <SpriteInfo>();

            TextureAtlasUtils.LoadImagesFromResources("commons.UI.Images", ref newSprites);
            TextureAtlasUtils.LoadImagesFromResources("UI.Images", ref newSprites);
            LogUtils.DoLog($"ADDING {newSprites.Count} sprites!");
            TextureAtlasUtils.RegenerateDefaultTextureAtlas(newSprites);


            helper.Self.eventVisibilityChanged += delegate(UIComponent component, bool b)
            {
                if (b)
                {
                    ShowVersionInfoPopup();
                }
            };

            TopSettingsUI(helper);

            if (UseGroup9)
            {
                CreateGroup9(helper);
            }

            ShowVersionInfoPopup();
            SearchIncompatibilitiesModal();
            LogUtils.DoLog("End Loading Options");
        }
Example #9
0
        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);
        }
Example #10
0
        protected override void AwakeActions()
        {
            KlyteMonoUtils.CreateUIElement(out UIPanel layoutPanel, MainPanel.transform, "LayoutPanel", new Vector4(0, 40, PanelWidth, PanelHeight - 40));
            layoutPanel.padding             = new RectOffset(8, 8, 10, 10);
            layoutPanel.autoLayout          = true;
            layoutPanel.autoLayoutDirection = LayoutDirection.Vertical;
            layoutPanel.autoLayoutPadding   = new RectOffset(0, 0, 10, 10);
            var uiHelper = new UIHelperExtension(layoutPanel);

            CreateSlider(uiHelper, "K45_TR_TREES_IN_TERRAIN", new Action <int>(FactorsData.Instance.SetMultiplierTree), new Func <int>(FactorsData.Instance.GetMultiplierTree));
            CreateSlider(uiHelper, "K45_TR_TREES_IN_LOTS", new Action <int>(FactorsData.Instance.SetMultiplierBuilding), new Func <int>(FactorsData.Instance.GetMultiplierBuilding));
            CreateSlider(uiHelper, "K45_TR_TREES_IN_ROADS", new Action <int>(FactorsData.Instance.SetMultiplierNet), new Func <int>(FactorsData.Instance.GetMultiplierNet));


            UILabel  labelAccuracy  = null;
            UISlider accuracySlider = uiHelper.AddSlider(Locale.Get("K45_TR_SIMULATION_ACCURACY"), 1, TRController.MAX_ACCURACY_VALUE, 1, FactorsData.Instance.GetSimulationAccuracy(), (x) =>
            {
                FactorsData.Instance.SetSimulationAccuracy(Mathf.RoundToInt(x));
                labelAccuracy.suffix = (1 << Mathf.RoundToInt(x + 3)).ToString();
                TreesRespirationMod.Controller.UpdateDivisors();
            }, out labelAccuracy);

            accuracySlider.width         = PanelWidth - 15;
            labelAccuracy.width          = PanelWidth - 15;
            labelAccuracy.minimumSize    = new Vector2(PanelWidth - 15, 0);
            labelAccuracy.suffix         = (1 << Mathf.RoundToInt(FactorsData.Instance.GetSimulationAccuracy() + 3)).ToString();
            labelAccuracy.parent.tooltip = Locale.Get("K45_TR_SIMULATION_ACCURACY_TOOLTIP");
            labelAccuracy.wordWrap       = false;
            ((UIPanel)(labelAccuracy.parent)).autoLayoutPadding = new RectOffset();
            KlyteMonoUtils.LimitWidthAndBox(labelAccuracy);
        }
        private void InitPrefixDetailTab()
        {
            UIHelperExtension detailsTabContainer = createNewAsteriskTab(Locale.Get("TLM_DETAILS"));

            m_prefixName  = detailsTabContainer.AddTextField(Locale.Get("TLM_PREFIX_NAME"), delegate(string s) { setPrefixNameDropDownSelection(m_systemTypeDropDown.selectedIndex, (uint)(m_prefixSelection.selectedIndex - 1), s); });
            m_ticketPrice = detailsTabContainer.AddTextField(Locale.Get("TLM_TICKET_PRICE_LABEL"), delegate(string s)
            {
                uint f = uint.Parse("0" + s);
                setTicketPriceDropDownSelection(m_systemTypeDropDown.selectedIndex, (uint)(m_prefixSelection.selectedIndex - 1), f);
            });
            m_prefixName.GetComponentInParent <UIPanel>().width = 300;
            m_prefixName.GetComponentInParent <UIPanel>().autoLayoutDirection = LayoutDirection.Horizontal;
            m_prefixName.GetComponentInParent <UIPanel>().autoLayoutPadding   = new RectOffset(5, 5, 3, 3);
            m_prefixName.GetComponentInParent <UIPanel>().wrapLayout          = true;

            m_ticketPrice.numericalOnly = true;
            m_ticketPrice.maxLength     = 7;

            foreach (Transform t in ((UIPanel)detailsTabContainer.self).transform)
            {
                var panel = t.gameObject.GetComponent <UIPanel>();
                if (panel)
                {
                    panel.width = 340;
                }
            }
        }
        private void Awake()
        {
            parent = GetComponentInParent <UIComponent>();
            UIHelperExtension group7 = new UIHelperExtension(parent.GetComponentInChildren <UIScrollablePanel>());

            ((UIScrollablePanel)group7.Self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIScrollablePanel)group7.Self).wrapLayout          = true;
            ((UIScrollablePanel)group7.Self).width = 730;

            group7.AddLabel(Locale.Get("K45_TLM_AUTOMATION_CONFIG"));
            group7.AddSpace(15);

            AddCheckboxLocale("K45_TLM_AUTO_COLOR_ENABLED", out m_autoColor, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.UseAutoColor = x);
            AddCheckboxLocale("K45_TLM_AUTO_NAME_ENABLED", out m_autoName, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.UseAutoName    = x);
            AddCheckboxLocale("K45_TLM_USE_CIRCULAR_AUTO_NAME", out m_circular, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.CircularIfSingleDistrictLine = x);
            AddCheckboxLocale("K45_TLM_ADD_LINE_NUMBER_AUTO_NAME", out m_addLineCode, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.AddLineCodeInAutoname  = x);
            group7.AddSpace(15);

            AddCheckboxLocale("K45_TLM_ENABLE_EXPRESS_BUSES", out m_expressBuses, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.ExpressBusesEnabled = x);
            m_expressBuses.tooltipLocaleID = "K45_TLM_ENABLE_EXPRESS_BUSES_DESC";
            AddCheckboxLocale("K45_TLM_ENABLE_EXPRESS_TRAMS", out m_expressTrams, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.ExpressTramsEnabled = x);
            m_expressTrams.tooltipLocaleID = "K45_TLM_ENABLE_EXPRESS_TRAMS_DESC";
            AddCheckboxLocale("K45_TLM_ENABLE_EXPRESS_TROLLEYS", out m_expressTrolleys, group7, (x) => TLMBaseConfigXML.CurrentContextConfig.ExpressTrolleybusesEnabled = x);
            m_expressTrolleys.tooltipLocaleID = "K45_TLM_ENABLE_EXPRESS_TROLLEYS_DESC";
            group7.AddSpace(15);

            AddCheckboxLocale("K45_TLM_USEGAMECLOCKIFDAYNIGHTDISABLED", out m_clockSwap, group7, (x) => TransportLinesManagerMod.UseGameClockAsReferenceIfNoDayNight = x);
        }
        public void Awake()
        {
            Instance            = this;
            MainContainer       = GetComponent <UIComponent>();
            m_uiHelperNeighbors = new UIHelperExtension(MainContainer);

            ((UIPanel)m_uiHelperNeighbors.Self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)m_uiHelperNeighbors.Self).wrapLayout          = true;
            ((UIPanel)m_uiHelperNeighbors.Self).autoLayout          = true;

            UILabel titleLabel = m_uiHelperNeighbors.AddLabel("");

            titleLabel.autoSize      = true;
            titleLabel.textAlignment = UIHorizontalAlignment.Center;
            titleLabel.wordWrap      = false;
            titleLabel.minimumSize   = new Vector2(MainContainer.width - 10, 0);
            titleLabel.localeID      = "K45_TLM_PER_HOUR_BUDGET_TITLE";

            m_uiHelperNeighbors.AddSpace(5);
            KlyteMonoUtils.CreateElement(out m_clockChart, m_uiHelperNeighbors.Self.transform, "DailyClock");
            m_showAbsoluteCheckbox = m_uiHelperNeighbors.AddCheckboxLocale("K45_TLM_SHOW_ABSOLUTE_VALUE", false, (x) =>
            {
                RebuildList(UVMPublicTransportWorldInfoPanel.GetLineID());
            });
            KlyteMonoUtils.LimitWidthAndBox(m_showAbsoluteCheckbox.label, m_uiHelperNeighbors.Self.width - 40f);
            KlyteMonoUtils.CreateElement(out m_titleContainer, m_uiHelperNeighbors.Self.transform, "Title");
            PopulateTitlePanel(m_titleContainer);
            KlyteMonoUtils.CreateScrollPanel(m_uiHelperNeighbors.Self, out m_entryListContainer, out _, m_uiHelperNeighbors.Self.width - 20f, m_uiHelperNeighbors.Self.height - 150, Vector3.zero);
        }
        public void Awake()
        {
            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();
        }
Example #15
0
        public void Awake()
        {
            m_bg                     = component as UIPanel;
            m_bg.autoLayout          = true;
            m_bg.autoLayoutDirection = LayoutDirection.Vertical;
            m_bg.clipChildren        = true;

            var uiHelper = new UIHelperExtension(m_bg);

            UILabel titleLabel = uiHelper.AddLabel("");

            titleLabel.autoSize      = true;
            titleLabel.textAlignment = UIHorizontalAlignment.Center;
            titleLabel.minimumSize   = new Vector2(m_bg.width, 0);
            titleLabel.localeID      = TitleLocaleID;

            KlyteMonoUtils.CreateUIElement(out UIPanel listTitle, m_bg.transform, "LT");
            L titleList = listTitle.gameObject.AddComponent <L>();

            titleList.AsTitle();

            KlyteMonoUtils.CreateUIElement(out UIPanel reportLinesContainer, m_bg.transform, "listContainer", new Vector4(0, 0, m_bg.width, m_bg.height - titleLabel.height - listTitle.height - 35));
            reportLinesContainer.autoLayout          = true;
            reportLinesContainer.autoLayoutDirection = LayoutDirection.Horizontal;
            KlyteMonoUtils.CreateScrollPanel(reportLinesContainer, out UIScrollablePanel reportLines, out _, reportLinesContainer.width - 10, reportLinesContainer.height, Vector3.zero);

            for (int i = 0; i < m_reportLines.Length; i++)
            {
                KlyteMonoUtils.CreateUIElement(out UIPanel line, reportLines.transform, $"L{i}");
                m_reportLines[i] = line.gameObject.AddComponent <L>();
            }
            KlyteMonoUtils.CreateUIElement(out UIPanel aggregateLine, m_bg.transform, $"L_AGG");
            m_aggregateLine = aggregateLine.gameObject.AddComponent <L>();
        }
Example #16
0
        private UIDropDown CreateMiniDropdown(string localeId, OnDropdownSelectionChanged onValueChanged, string[] values)
        {
            UIDropDown ddObj = UIHelperExtension.CloneBasicDropDownLocalized(localeId, values, onValueChanged, 0, MainPanel, out UILabel label, out UIPanel container);

            container.autoFitChildrenHorizontally = false;
            container.autoLayoutDirection         = LayoutDirection.Horizontal;
            container.autoLayout = true;
            container.autoFitChildrenHorizontally = true;
            container.autoFitChildrenVertically   = true;
            ReflectionUtils.GetEventField(typeof(UIDropDown), "eventMouseWheel")?.SetValue(ddObj, null);
            ddObj.isLocalized         = false;
            ddObj.autoSize            = false;
            ddObj.horizontalAlignment = UIHorizontalAlignment.Center;
            ddObj.itemPadding         = new RectOffset(2, 2, 6, 6);
            ddObj.textFieldPadding    = new RectOffset(4, 40, 4, 4);
            ddObj.name         = localeId;
            ddObj.size         = new Vector3(240, 22);
            ddObj.textScale    = 0.8f;
            ddObj.listPosition = UIDropDown.PopupListPosition.Automatic;
            //KlyteMonoUtils.InitButtonFull(ddObj, false, "OptionsDropboxListbox");
            ddObj.horizontalAlignment = UIHorizontalAlignment.Center;

            KlyteMonoUtils.LimitWidthAndBox(label, 130);
            label.textScale         = 1;
            label.padding.top       = 4;
            label.position          = Vector3.zero;
            label.verticalAlignment = UIVerticalAlignment.Middle;
            label.textAlignment     = UIHorizontalAlignment.Left;

            return(ddObj);
        }
Example #17
0
        private UITextField CreateMiniTextField(string localeId, OnTextSubmitted onValueChanged)
        {
            UITextField ddObj = UIHelperExtension.AddTextfield(MainPanel, localeId, "", out UILabel label, out UIPanel container);

            container.autoFitChildrenHorizontally = false;
            container.autoLayoutDirection         = LayoutDirection.Horizontal;
            container.autoLayout = true;
            container.autoFitChildrenHorizontally = true;
            container.autoFitChildrenVertically   = true;

            ddObj.isLocalized         = false;
            ddObj.autoSize            = false;
            ddObj.eventTextSubmitted += (x, y) => onValueChanged(y);
            ddObj.name      = localeId;
            ddObj.size      = new Vector3(240, 22);
            ddObj.textScale = 1;


            KlyteMonoUtils.LimitWidthAndBox(label, 130);
            label.textScale         = 1;
            label.padding.top       = 4;
            label.position          = Vector3.zero;
            label.isLocalized       = true;
            label.localeID          = localeId;
            label.verticalAlignment = UIVerticalAlignment.Middle;
            label.textAlignment     = UIHorizontalAlignment.Left;

            return(ddObj);
        }
 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);
 }
        private void InitPrefixesSelector()
        {
            m_prefixSelectorPanel = new UIHelperExtension(m_PrefixEditor);
            ((UIScrollablePanel)m_prefixSelectorPanel.self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIScrollablePanel)m_prefixSelectorPanel.self).autoLayoutPadding   = new RectOffset(5, 5, 0, 0);
            ((UIScrollablePanel)m_prefixSelectorPanel.self).wrapLayout          = true;
            ((UIScrollablePanel)m_prefixSelectorPanel.self).autoLayout          = true;

            string[] optionList = new string[m_transportTypeOrder.Length + 1];
            optionList[0] = "--" + Locale.Get("SELECT") + "--";
            for (int i = 1; i < optionList.Length; i++)
            {
                optionList[i] = TLMCW.getNameForTransportType(m_transportTypeOrder[i - 1]);
            }

            TLMUtils.doLog("INIT m_systemTypeDropDown");
            m_systemTypeDropDown = (UIDropDown)m_prefixSelectorPanel.AddDropdown(Locale.Get("TLM_TRANSPORT_SYSTEM"), optionList, 0, loadPrefixes);
            m_prefixSelection    = (UIDropDown)m_prefixSelectorPanel.AddDropdown(Locale.Get("TLM_PREFIX"), new string[] { "" }, 0, selectPrefixAction);

            foreach (Transform t in m_prefixSelectorPanel.self.transform)
            {
                var panel = t.gameObject.GetComponent <UIPanel>();
                if (panel)
                {
                    panel.width = 340;
                }
            }
        }
        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);
        }
        private void setPreviewWindow(UIHelperExtension assetSelectionTabContainer)
        {
            UIPanel uIPanel = assetSelectionTabContainer.self.AddUIComponent <UIPanel>();

            uIPanel.backgroundSprite        = "GenericPanel";
            uIPanel.width                   = 900f;
            uIPanel.height                  = 250f;
            uIPanel.relativePosition        = new Vector3(0f, 350);
            this.m_preview                  = uIPanel.AddUIComponent <UITextureSprite>();
            this.m_preview.size             = uIPanel.size;
            this.m_preview.relativePosition = Vector3.zero;
            this.m_previewRenderer          = assetSelectionTabContainer.self.gameObject.AddComponent <AVOPreviewRenderer>();
            this.m_previewRenderer.size     = this.m_preview.size * 2f;
            this.m_preview.texture          = this.m_previewRenderer.texture;
            uIPanel.eventMouseDown         += delegate(UIComponent c, UIMouseEventParameter p)
            {
                assetSelectionTabContainer.self.eventMouseMove += new MouseEventHandler(RotateCamera);
                redrawModel();
            };
            uIPanel.eventMouseUp += delegate(UIComponent c, UIMouseEventParameter p)
            {
                assetSelectionTabContainer.self.eventMouseMove -= new MouseEventHandler(RotateCamera);
                redrawModel();
            };
            uIPanel.eventMouseWheel += delegate(UIComponent c, UIMouseEventParameter p)
            {
                this.m_previewRenderer.zoom -= Mathf.Sign(p.wheelDelta) * 0.25f;
                redrawModel();
            };
        }
Example #22
0
        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);
                }
            };
        }
Example #23
0
        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();
            };
        }
Example #24
0
        private void Awake()
        {
            if (m_instance != null)
            {
                throw new Exception("MULTIPLE INSTANTIATION!!!!!!!!");
            }
            m_instance                    = this;
            mainPanel                     = GetComponentInChildren <UIScrollablePanel>();
            mainPanel.autoLayout          = true;
            mainPanel.autoLayoutDirection = LayoutDirection.Vertical;
            m_uiHelper                    = new UIHelperExtension(mainPanel);

            TLMUtils.doLog("PrefixDD");

            m_prefixSelector = m_uiHelper.AddDropdownLocalized("TLM_PREFIX", new string[0], -1, onChangePrefix);

            ReloadPrefixOptions();
            TLMUtils.doLog("PrefixDD Panel");
            var ddPanel = m_prefixSelector.GetComponentInParent <UIPanel>();

            ConfigComponentPanel(m_prefixSelector);


            TLMUtils.doLog("SubPanel");
            TLMUtils.createUIElement(out UIPanel subpanel, mainPanel.transform, "Subpanel", new Vector4(0, 0, 500, 180));
            subpanel.autoLayout          = true;
            subpanel.autoLayoutDirection = LayoutDirection.Vertical;
            subpanel.autoSize            = true;
            m_subpanel = new UIHelperExtension(subpanel);

            TLMUtils.doLog("AssetSelector");
            TLMUtils.createUIElement(out m_panelAssetSelector, mainPanel.transform, "AssetSelector", new Vector4(0, 0, 0, 0.0001f));
            m_assetSelectorWindow = TLMUtils.createElement(ImplClassChildren, m_panelAssetSelector.transform).GetComponent <TLMAssetSelectorWindowPrefixTab <T> >();

            m_subpanel.self.isVisible = false;
            m_assetSelectorWindow.mainPanel.isVisible = false;

            TLMUtils.doLog("Name");
            m_prefixName = m_subpanel.AddTextField(Locale.Get("TLM_PREFIX_NAME"), null, "", onPrefixNameChange);
            ConfigComponentPanel(m_prefixName);

            TLMUtils.doLog("Price");
            m_prefixTicketPrice = m_subpanel.AddTextField(Locale.Get("TLM_TICKET_PRICE_LABEL"), null, "", onTicketChange);
            ConfigComponentPanel(m_prefixTicketPrice);

            TLMUtils.doLog("ColorForModel");
            m_useColorForModel = m_subpanel.AddCheckboxLocale("TLM_USE_PREFIX_COLOR_FOR_VEHICLE", false, onUseColorVehicleChange);
            TLMUtils.LimitWidth(m_useColorForModel.label, 420, true);

            TLMUtils.doLog("ColorSel");
            CreateColorSelector();

            TLMUtils.doLog("Budget");
            TLMUtils.createUIElement(out UIPanel m_budgetPanel, subpanel.transform, "BudgetPanel", new Vector4(0, 0, 460, 180));
            CreateBudgetSliders(m_budgetPanel);
            CreateToggleBudgetButtons(m_budgetPanel);

            GetComponent <UIComponent>().eventVisibilityChanged += (x, y) => forceRefresh();
            TLMConfigWarehouse.eventOnPropertyChanged           += OnWarehouseChange;
        }
Example #25
0
        private void Awake()
        {
            SVMServiceBuildingDetailPanel.eventOnDistrictSelectionChanged += onDistrictChanged;


            mainPanel            = GetComponentInChildren <UIScrollablePanel>();
            mainPanel.autoLayout = false;
            m_uiHelper           = new UIHelperExtension(mainPanel);

            SVMUtils.createUIElement(out UILabel lbl, mainPanel.transform, "DistrictColorLabel", new Vector4(5, 5, 250, 40));

            allowColorChange = SVMConfigWarehouse.allowColorChanging(extension.ConfigIndexKey);
            if (allowColorChange)
            {
                SVMUtils.LimitWidth(lbl, 250);
                lbl.autoSize = true;
                lbl.localeID = "SVM_DISTRICT_COLOR_LABEL";

                m_districtColor = KlyteUtils.CreateColorField(mainPanel);
                m_districtColor.eventSelectedColorChanged += onChangeDistrictColor;

                SVMUtils.createUIElement(out UIButton resetColor, mainPanel.transform, "DistrictColorReset", new Vector4(290, 0, 0, 0));
                SVMUtils.initButton(resetColor, false, "ButtonMenu");
                SVMUtils.LimitWidth(resetColor, 200);
                resetColor.textPadding = new RectOffset(5, 5, 5, 2);
                resetColor.autoSize    = true;
                resetColor.localeID    = "SVM_RESET_COLOR";
                resetColor.eventClick += onResetColor;
            }


            SVMUtils.createElement(out m_assetSelectorWindow, mainPanel.transform);
            m_assetSelectorWindow.setTabContent(this);
        }
Example #26
0
 public static void AddFloatField(string label, out UITextField field, UIHelperExtension parentHelper, Action <float> onChange, bool acceptNegative)
 {
     field       = parentHelper.AddFloatField(label, 0, onChange, acceptNegative);
     field.width = 90;
     KlyteMonoUtils.LimitWidthAndBox(field.parent.GetComponentInChildren <UILabel>(), (parentHelper.Self.width / 2) - 10, true);
     field.eventMouseWheel += RollFloat;
 }
        private void CreateScrollPanel()
        {
            TLMUtils.createUIElement(out m_scrollablePanel, m_mainPanel.transform);
            m_scrollablePanel.width  = m_mainPanel.width - 20f;
            m_scrollablePanel.height = m_mainPanel.height - 50f;
            m_scrollablePanel.autoLayoutDirection = LayoutDirection.Vertical;
            m_scrollablePanel.autoLayoutStart     = LayoutStart.TopLeft;
            m_scrollablePanel.autoLayoutPadding   = new RectOffset(0, 0, 0, 0);
            m_scrollablePanel.autoLayout          = true;
            m_scrollablePanel.clipChildren        = true;
            m_scrollablePanel.relativePosition    = new Vector3(5, 45);

            TLMUtils.createUIElement(out UIPanel trackballPanel, m_mainPanel.transform);
            trackballPanel.width  = 10f;
            trackballPanel.height = m_scrollablePanel.height;
            trackballPanel.autoLayoutDirection = LayoutDirection.Horizontal;
            trackballPanel.autoLayoutStart     = LayoutStart.TopLeft;
            trackballPanel.autoLayoutPadding   = new RectOffset(0, 0, 0, 0);
            trackballPanel.autoLayout          = true;
            trackballPanel.relativePosition    = new Vector3(m_mainPanel.width - 15, 45);


            TLMUtils.createUIElement(out m_scrollbar, trackballPanel.transform);
            m_scrollbar.width       = 10f;
            m_scrollbar.height      = m_scrollbar.parent.height;
            m_scrollbar.orientation = UIOrientation.Vertical;
            m_scrollbar.pivot       = UIPivotPoint.BottomLeft;
            m_scrollbar.AlignTo(trackballPanel, UIAlignAnchor.TopRight);
            m_scrollbar.minValue        = 0f;
            m_scrollbar.value           = 0f;
            m_scrollbar.incrementAmount = 25f;

            TLMUtils.createUIElement(out UISlicedSprite scrollBg, m_scrollbar.transform);
            scrollBg.relativePosition = Vector2.zero;
            scrollBg.autoSize         = true;
            scrollBg.size             = scrollBg.parent.size;
            scrollBg.fillDirection    = UIFillDirection.Vertical;
            scrollBg.spriteName       = "ScrollbarTrack";
            m_scrollbar.trackObject   = scrollBg;

            TLMUtils.createUIElement(out UISlicedSprite scrollFg, scrollBg.transform);
            scrollFg.relativePosition           = Vector2.zero;
            scrollFg.fillDirection              = UIFillDirection.Vertical;
            scrollFg.autoSize                   = true;
            scrollFg.width                      = scrollFg.parent.width - 4f;
            scrollFg.spriteName                 = "ScrollbarThumb";
            m_scrollbar.thumbObject             = scrollFg;
            m_scrollablePanel.verticalScrollbar = m_scrollbar;
            m_scrollablePanel.eventMouseWheel  += delegate(UIComponent component, UIMouseEventParameter param)
            {
                m_scrollablePanel.scrollPosition += new Vector2(0f, Mathf.Sign(param.wheelDelta) * -1f * m_scrollbar.incrementAmount);
            };
            m_scrollablePanel.eventMouseLeave += (x, y) =>
            {
                m_previewPanel.isVisible = false;
            };

            m_uiHelper = new UIHelperExtension(m_scrollablePanel);
        }
Example #28
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");
        }
 private void CreateScrollPanel()
 {
     m_uiHelper = SVMUtils.CreateScrollPanel(m_mainPanel, out m_scrollablePanel, out m_scrollbar, m_mainPanel.width - 20f, m_mainPanel.height - 90f, new Vector3(5, 45));
     m_scrollablePanel.eventMouseLeave += (x, y) =>
     {
         m_previewPanel.isVisible = false;
     };
 }
Example #30
0
 public override void Group9SettingsUI(UIHelperExtension group9)
 {
     group9.AddDropdownLocalized("SS_MOD_LANG", SSLocaleUtils.instance.getLanguageIndex(), SSLocaleUtils.currentLanguageId.value, delegate(int idx)
     {
         SSLocaleUtils.currentLanguageId.value = idx;
         loadLocale(true);
     });
 }