Beispiel #1
0
        public void Awake()
        {
            MainContainer                     = GetComponent <UIPanel>();
            MainContainer.autoLayout          = true;
            MainContainer.autoLayoutDirection = LayoutDirection.Vertical;
            MainContainer.padding             = new RectOffset(5, 5, 5, 5);
            MainContainer.autoLayoutPadding   = new RectOffset(0, 0, 3, 3);

            KlyteMonoUtils.CreateTabsComponent(out m_tabstrip, out m_tabContainer, MainContainer.transform, "TextEditor", new Vector4(0, 0, MainContainer.width, 40), new Vector4(0, 0, MainContainer.width, 315));
            m_tabSettings     = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Settings), "K45_WTS_GENERAL_SETTINGS", "TxtSettings");
            m_tabSize         = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_MoveCross), "K45_WTS_TEXT_SIZE_ATTRIBUTES", "TxtSize");
            m_tabAppearence   = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoColorIcon), "K45_WTS_TEXT_APPEARANCE_ATTRIBUTES", "TxtApp");
            m_tabFrame        = TabCommons.CreateScrollableTabLocalized(m_tabstrip, "frame", "K45_WTS_TEXT_CONTAINERFRAME_ATTRIBUTES", "TxtFrm");
            m_tabIllumination = TabCommons.CreateScrollableTabLocalized(m_tabstrip, "SubBarPropsCommonLights", "K45_WTS_TEXT_ILLUMINATION_ATTRIBUTES", "TxtIll");
            m_tabConfig       = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoNameIcon), "K45_WTS_TEXT_CONFIGURATION_ATTRIBUTES", "TxtCnf");

            var helperSettings     = new UIHelperExtension(m_tabSettings, LayoutDirection.Vertical);
            var helperSize         = new UIHelperExtension(m_tabSize, LayoutDirection.Vertical);
            var helperAppearance   = new UIHelperExtension(m_tabAppearence, LayoutDirection.Vertical);
            var helperFrame        = new UIHelperExtension(m_tabFrame, LayoutDirection.Vertical);
            var helperIllumination = new UIHelperExtension(m_tabIllumination, LayoutDirection.Vertical);
            var helperConfig       = new UIHelperExtension(m_tabConfig, LayoutDirection.Vertical);

            AddTextField(Locale.Get("K45_WTS_TEXT_TAB_TITLE"), out m_tabName, helperSettings, OnTabNameChanged);

            AddVector3Field(Locale.Get("K45_WTS_RELATIVE_POS"), out m_arrayCoord, helperSize, OnPositionChange);
            AddVector3Field(Locale.Get("K45_WTS_RELATIVE_ROT"), out m_arrayRotation, helperSize, OnRotationChange);
            AddFloatField(Locale.Get("K45_WTS_TEXT_SCALE"), out m_textScale, helperSize, OnScaleSubmit, false);
            AddFloatField(Locale.Get("K45_WTS_MAX_WIDTH_METERS"), out m_maxWidth, helperSize, OnMaxWidthChange, false);
            AddCheckboxLocale("K45_WTS_RESIZE_Y_TEXT_OVERFLOW", out m_applyScaleOnY, helperSize, OnChangeApplyRescaleOnY);
            AddCheckboxLocale("K45_WTS_CREATE_CLONE_180DEG", out m_create180degSimmetricClone, helperSize, OnChangeCreateSimmetricClone);
            AddCheckboxLocale("K45_WTS_CLONE_180DEG_INVERT_TEXT_HOR_ALIGN", out m_invertTextHorizontalAlignClone, helperSize, OnChangeInvertCloneTextHorizontalAlignment);

            AddVector2Field(Locale.Get("K45_WTS_TEXTBACKGROUNDSIZEGENERATED"), out m_bgSize, helperAppearance, OnBgSizeChanged); m_bgSize.ForEach(x => x.allowNegative = false);
            AddColorField(helperAppearance, Locale.Get("K45_WTS_BG_COLOR"), out m_bgColor, OnBgColorChanged);
            helperAppearance.AddSpace(5);
            AddColorField(helperAppearance, Locale.Get("K45_WTS_TEXT_COLOR"), out m_textFixedColor, OnFixedColorChanged);
            AddCheckboxLocale("K45_WTS_USE_CONTRAST_COLOR", out m_useContrastColor, helperAppearance, OnContrastColorChange);
            helperAppearance.AddSpace(5);
            AddSlider(Locale.Get("K45_WTS_TEXT_DEPTH"), out m_sliderDepth, helperAppearance, OnChangeDepth, -1, 1, 0.025f, (x) => $"{x.ToString("P1")}");
            AddDropdown(Locale.Get("K45_WTS_TEXT_ALIGN_HOR"), out m_dropdownTextAlignHorizontal, helperAppearance, ColossalUIExtensions.GetDropdownOptions <UIHorizontalAlignment>("K45_ALIGNMENT"), OnSetTextAlignmentHorizontal);

            AddCheckboxLocale("K45_WTS_TEXT_USEFRAME", out m_useFrame, helperFrame, OnUseFrameChange);
            AddCheckboxLocale("K45_WTS_TEXT_CONTAINERUSEVEHICLECOLOR", out m_frameUseVehicleColor, helperFrame, OnFrameUseVehicleColorChange);
            AddColorField(helperFrame, Locale.Get("K45_WTS_TEXT_CONTAINEROUTERCOLOR"), out m_frameColor, OnFrameColorChanged);
            AddSlider(Locale.Get("K45_WTS_TEXT_CONTAINEROUTERSPECULARITY"), out m_frameOuterSpecularLevel, helperFrame, OnFrameOuterSpecularLevelChanged, 0, 1, 0.01f, (x) => (x * 100).ToString("F0") + "%");
            AddVector2Field(Locale.Get("K45_WTS_TEXT_CONTAINERBACKSIZE"), out m_frameBackSize, helperFrame, OnFrameBackSizeChanged, true, false, false);
            AddVector2Field(Locale.Get("K45_WTS_TEXT_CONTAINERBACKOFFSET"), out m_frameBackOffset, helperFrame, OnFrameBackOffsetChanged);
            AddVector2Field(Locale.Get("K45_WTS_TEXT_CONTAINERDEPTHFRONTBACK"), out m_frameDepths, helperFrame, OnFrameDepthsChanged, true, false, false);
            AddFloatField(Locale.Get("K45_WTS_TEXT_CONTAINERFRONTBORDERTHICKNESS"), out m_frameFrontBorder, helperFrame, OnFrameBorderThicknessChanged, false);
            AddColorField(helperFrame, Locale.Get("K45_WTS_TEXT_CONTAINERGLASSCOLOR"), out m_frameGlassColor, OnFrameGlassColorChanged);
            AddSlider(Locale.Get("K45_WTS_TEXT_CONTAINERGLASSTRANSPARENCY"), out m_frameGlassTransparency, helperFrame, OnFrameGlassTransparencyChanged, 0, 1, 0.01f, (x) => (x * 100).ToString("F0") + "%");
            AddSlider(Locale.Get("K45_WTS_TEXT_CONTAINERGLASSSPECULARITY"), out m_frameGlassSpecularLevel, helperFrame, OnFrameGlassSpecularLevelChanged, 0, 1, 0.01f, (x) => (x * 100).ToString("F0") + "%");

            AddDropdown(Locale.Get("K45_WTS_TEXT_MATERIALTYPE"), out m_dropdownMaterialType, helperIllumination, ColossalUIExtensions.GetDropdownOptions <MaterialType>("K45_WTS_TEXTMATERIALTYPE"), OnSetMaterialType);
            AddSlider(Locale.Get("K45_WTS_TEXT_ILLUMINATIONSTRENGTH"), out m_sliderIllumination, helperIllumination, OnChangeIlluminationStrength, 0, 10, 0.025f, (x) => $"{x.ToString("P1")}");
            AddDropdown(Locale.Get("K45_WTS_TEXT_BLINKTYPE"), out m_dropdownBlinkType, helperIllumination, ColossalUIExtensions.GetDropdownOptions <BlinkType>("K45_WTS_BLINKTYPE"), OnSetBlinkType);
            AddVector4Field(Locale.Get("K45_WTS_TEXT_CUSTOMBLINKPARAMS"), out m_arrayCustomBlink, helperIllumination, OnCustomBlinkChange);



            m_flagsState = new Dictionary <Vehicle.Flags, UIMultiStateButton>();
            var flagsCheck = helperIllumination.AddGroupExtended(Locale.Get("K45_WTS_FLAGSREQUREDFORBIDDEN"));

            m_flagsContainer = flagsCheck.Self.parent;
            ((UIPanel)flagsCheck.Self).autoLayoutDirection = LayoutDirection.Horizontal;
            ((UIPanel)flagsCheck.Self).wrapLayout          = true;

            (Enum.GetValues(typeof(Vehicle.Flags)) as Vehicle.Flags[]).ForEach(f =>
            {
                AddMultistateButton(f.ToString(), flagsCheck.Self, out UIMultiStateButton button, out _, out _, flagsCheck.Self.width / 4.1f, new string[] { "AchievementCheckedFalse", "AchievementCheckedTrue", "AchievementCheckedTrueNegative", }, (x, y) => OnSetStateFlag(f, y), new Vector2(20, 20));
                m_flagsState[f] = button;
            });


            AddDropdown(Locale.Get("K45_WTS_TEXT_CONTENT"), out m_dropdownTextContent, helperConfig, WTSDynamicTextRenderingRules.ALLOWED_TYPES_VEHICLE.GetDropdownOptions("K45_WTS_BOARD_TEXT_TYPE_DESC_VEHICLE"), OnSetTextOwnNameContent);
            AddTextField(Locale.Get("K45_WTS_CUSTOM_TEXT"), out m_customText, helperConfig, OnSetTextCustom);

            IEnumerator OnFilter(string x, Wrapper <string[]> result)
            {
                yield return(result.Value = OnFilterSprites(WTSVehicleLayoutEditor.Instance.Preview.OverrideSprite, x));
            }

            AddFilterableInput(Locale.Get("K45_WTS_SPRITE_NAME"), helperConfig, out m_spriteFilter, out UIListBox lb2, OnFilter, OnSpriteNameChanged);
            lb2.size                      = new Vector2(MainContainer.width - 20, 220);
            lb2.processMarkup             = true;
            m_spriteFilter.eventGotFocus += (x, y) =>
            {
                var text = ((UITextField)x).text;
                if (text.StartsWith(WTSAtlasesLibrary.PROTOCOL_IMAGE_ASSET) || text.StartsWith(WTSAtlasesLibrary.PROTOCOL_IMAGE))
                {
                    WTSVehicleLayoutEditor.Instance.Preview.OverrideSprite.spriteName = ((UITextField)x).text.Split('/').Last().Trim();
                }
            };
            lb2.eventItemMouseHover += (x, y) =>
            {
                if (y >= 0 && y < lb2.items.Length)
                {
                    WTSVehicleLayoutEditor.Instance.Preview.OverrideSprite.spriteName = lb2.items[y].Split('/').Last().Trim();
                }
            };
            lb2.eventVisibilityChanged += (x, y) => WTSVehicleLayoutEditor.Instance.Preview.OverrideSprite.parent.isVisible = y;
            WTSVehicleLayoutEditor.Instance.Preview.OverrideSprite.parent.isVisible = false;

            helperConfig.AddSpace(5);
            AddEmptyDropdown(Locale.Get("K45_WTS_OVERRIDE_FONT"), out m_overrideFontSelect, helperConfig, OnSetOverrideFont);
            AddDropdown(Locale.Get("K45_WTS_CLASS_FONT"), out m_fontClassSelect, helperConfig, ColossalUIExtensions.GetDropdownOptions <FontClass>("K45_WTS_FONTCLASS"), OnSetFontClass);
            AddTextField(Locale.Get("K45_WTS_PREFIX"), out m_textPrefix, helperConfig, OnSetPrefix);
            AddTextField(Locale.Get("K45_WTS_SUFFIX"), out m_textSuffix, helperConfig, OnSetSuffix);
            AddCheckboxLocale("K45_WTS_TEXT_ALL_CAPS", out m_allCaps, helperConfig, OnSetAllCaps);
            AddCheckboxLocale("K45_WTS_TEXT_APPLYABBREVIATIONS", out m_applyAbbreviations, helperConfig, OnSetApplyAbbreviations);

            WTSUtils.ReloadFontsOf(m_overrideFontSelect, null, true, true);

            WTSVehicleLayoutEditor.Instance.CurrentTabChanged += (newVal) =>
            {
                int targetTab = newVal - 1;
                SafeObtain(OnSetData, targetTab);
            };
            m_isEditing = false;


            AddLibBox <WTSLibVehicleTextItem, BoardTextDescriptorGeneralXml>(helperSettings, out UIButton m_copyButtonText,
                                                                             DoCopyText, out m_pasteButtonText,
                                                                             DoPasteText, out UIButton m_deleteButtonText,
                                                                             DoDeleteText, (loadedItem) => SafeObtain((ref BoardTextDescriptorGeneralXml x) =>
            {
                string name = x.SaveName;
                x           = XmlUtils.DefaultXmlDeserialize <BoardTextDescriptorGeneralXml>(loadedItem);
                x.SaveName  = name;
                OnSetData(ref x);
                x.SaveName = name;
            }),
                                                                             () => XmlUtils.DefaultXmlSerialize(WTSVehicleLayoutEditor.Instance.EditingInstance.TextDescriptors[Math.Max(0, TabToEdit)]));
        }
        public void Awake()
        {
            MainContainer                     = GetComponent <UIPanel>();
            MainContainer.autoLayout          = true;
            MainContainer.autoLayoutDirection = LayoutDirection.Vertical;
            MainContainer.padding             = new RectOffset(5, 5, 5, 5);
            MainContainer.autoLayoutPadding   = new RectOffset(0, 0, 3, 3);

            KlyteMonoUtils.CreateTabsComponent(out m_tabstrip, out m_tabContainer, MainContainer.transform, "TextEditor", new Vector4(0, 0, MainContainer.width, 40), new Vector4(0, 0, MainContainer.width, MainContainer.height - 40));
            m_tabSettings   = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Settings), "K45_WTS_GENERAL_SETTINGS", "TxtSettings");
            m_tabSize       = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_MoveCross), "K45_WTS_TEXT_SIZE_ATTRIBUTES", "TxtSize");
            m_tabAppearence = TabCommons.CreateScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoColorIcon), "K45_WTS_TEXT_APPEARANCE_ATTRIBUTES", "TxtApp");
            m_tabConfig     = TabCommons.CreateScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoNameIcon), "K45_WTS_TEXT_CONFIGURATION_ATTRIBUTES", "TxtCnf");

            var helperSettings   = new UIHelperExtension(m_tabSettings, LayoutDirection.Vertical);
            var helperSize       = new UIHelperExtension(m_tabSize, LayoutDirection.Vertical);
            var helperAppearance = new UIHelperExtension(m_tabAppearence, LayoutDirection.Vertical);
            var helperConfig     = new UIHelperExtension(m_tabConfig, LayoutDirection.Vertical);

            AddTextField(Locale.Get("K45_WTS_TEXT_TAB_TITLE"), out m_tabName, helperSettings, OnTabNameChanged);

            AddVector3Field(Locale.Get("K45_WTS_RELATIVE_POS"), out m_arrayCoord, helperSize, OnPositionChange);
            AddVector3Field(Locale.Get("K45_WTS_RELATIVE_ROT"), out m_arrayRotation, helperSize, OnRotationChange);
            AddFloatField(Locale.Get("K45_WTS_TEXT_SCALE"), out m_textScale, helperSize, OnScaleSubmit, false);
            AddFloatField(Locale.Get("K45_WTS_MAX_WIDTH_METERS"), out m_maxWidth, helperSize, OnMaxWidthChange, false);
            AddCheckboxLocale("K45_WTS_RESIZE_Y_TEXT_OVERFLOW", out m_applyScaleOnY, helperSize, OnChangeApplyRescaleOnY);
            AddCheckboxLocale("K45_WTS_CREATE_CLONE_180DEG", out m_create180degSimmetricClone, helperSize, OnChangeCreateSimmetricClone);
            AddCheckboxLocale("K45_WTS_CLONE_180DEG_INVERT_TEXT_HOR_ALIGN", out m_invertTextHorizontalAlignClone, helperSize, OnChangeInvertCloneTextHorizontalAlignment);

            //      AddCheckboxLocale("K45_WTS_MIRRORED", out m_mirrored, helperSize, OnChangeMirrored);

            AddDropdown(Locale.Get("K45_WTS_TEXT_ALIGN_HOR"), out m_dropdownTextAlignHorizontal, helperAppearance, ColossalUIExtensions.GetDropdownOptions <UIHorizontalAlignment>("K45_ALIGNMENT"), OnSetTextAlignmentHorizontal);
            helperAppearance.AddSpace(5);
            AddCheckboxLocale("K45_WTS_USE_CONTRAST_COLOR", out m_useContrastColor, helperAppearance, OnContrastColorChange);
            AddColorField(helperAppearance, Locale.Get("K45_WTS_TEXT_COLOR"), out m_textFixedColor, OnFixedColorChanged);
            AddSlider(Locale.Get("K45_WTS_TEXT_DEPTH"), out m_sliderDepth, helperAppearance, OnChangeDepth, -1, 1, 0.025f, (x) => $"{x.ToString("P1")}");
            AddDropdown(Locale.Get("K45_WTS_TEXT_MATERIALTYPE"), out m_dropdownMaterialType, helperAppearance, ColossalUIExtensions.GetDropdownOptions <MaterialType>("K45_WTS_TEXTMATERIALTYPE"), OnSetMaterialType);
            AddSlider(Locale.Get("K45_WTS_TEXT_ILLUMINATIONSTRENGTH"), out m_sliderIllumination, helperAppearance, OnChangeIlluminationStrength, 0, 10, 0.025f, (x) => $"{x.ToString("P1")}");
            AddDropdown(Locale.Get("K45_WTS_TEXT_BLINKTYPE"), out m_dropdownBlinkType, helperAppearance, ColossalUIExtensions.GetDropdownOptions <BlinkType>("K45_WTS_BLINKTYPE"), OnSetBlinkType);
            AddVector4Field(Locale.Get("K45_WTS_TEXT_CUSTOMBLINKPARAMS"), out m_arrayCustomBlink, helperAppearance, OnCustomBlinkChange);


            AddEmptyDropdown(Locale.Get("K45_WTS_TEXT_CONTENT"), out m_dropdownTextContent, helperConfig, OnSetTextOwnNameContent);
            AddTextField(Locale.Get("K45_WTS_CUSTOM_TEXT"), out m_customText, helperConfig, OnSetTextCustom);

            IEnumerator OnFilter(string x, Wrapper <string[]> result)
            {
                yield return(result.Value = OnFilterParamImages(WTSPropLayoutEditor.Instance.PropPreview.OverrideSprite, x));
            }

            AddFilterableInput(Locale.Get("K45_WTS_SPRITE_NAME"), helperConfig, out m_spriteFilter, out UIListBox lb2, OnFilter, OnSpriteNameChanged);
            lb2.size                      = new Vector2(MainContainer.width - 20, 220);
            lb2.processMarkup             = true;
            m_spriteFilter.eventGotFocus += (x, y) =>
            {
                var text = ((UITextField)x).text;
                if (text.StartsWith(WTSAtlasesLibrary.PROTOCOL_IMAGE_ASSET) || text.StartsWith(WTSAtlasesLibrary.PROTOCOL_IMAGE))
                {
                    WTSPropLayoutEditor.Instance.PropPreview.OverrideSprite.spriteName = ((UITextField)x).text.Split('/').Last().Trim();
                }
            };
            lb2.eventItemMouseHover += (x, y) =>
            {
                if (y >= 0 && y < lb2.items.Length)
                {
                    WTSPropLayoutEditor.Instance.PropPreview.OverrideSprite.spriteName = lb2.items[y].Split('/').Last().Trim();
                }
            };
            lb2.eventVisibilityChanged += (x, y) => WTSPropLayoutEditor.Instance.PropPreview.OverrideSprite.parent.isVisible = y;
            WTSPropLayoutEditor.Instance.PropPreview.OverrideSprite.parent.isVisible = false;

            AddDropdown(Locale.Get("K45_WTS_PROPLAYOUT_DESTINATIONREFERENCE"), out m_destinationRef, helperConfig, ColossalUIExtensions.GetDropdownOptions <DestinationReference>("K45_WTS_ONNETTEXT_DESTINATION_DESC"), OnChangeDestinationRef);
            AddDropdown(Locale.Get("K45_WTS_PROPLAYOUT_TEXTPARAMETERIDX"), out m_parameterIdx, helperConfig, ColossalUIExtensions.GetDropdownOptionsUnlocalized(new string[BoardInstanceOnNetXml.TEXT_PARAMETERS_COUNT].Select((x, i) => $"#{i}").ToArray()), OnChangeTextParameterIdx);
            AddTextField(Locale.Get("K45_WTS_PROPLAYOUT_TEXTPARAMETERNAME"), out m_parameterDisplayName, helperConfig, OnSetParameterDisplayName);
            IEnumerator OnFilter2(string x, Wrapper <string[]> result)
            {
                yield return(result.Value = OnFilterParamImages(WTSPropLayoutEditor.Instance.PropPreview.OverrideSprite, x));
            }

            AddFilterableInput(Locale.Get("K45_WTS_PROPLAYOUT_TEXTPARAMETERDEFAULTVAL"), helperConfig, out m_defaultParameterValue, out UIListBox lb, OnFilter2, OnChangedDefaultTextParam);
            lb.processMarkup = true;
            lb.size          = new Vector2(MainContainer.width - 20, 220);
            m_defaultParameterValue.eventGotFocus += (x, y) =>
            {
                var text = ((UITextField)x).text;
                if (text.StartsWith(WTSAtlasesLibrary.PROTOCOL_IMAGE_ASSET) || text.StartsWith(WTSAtlasesLibrary.PROTOCOL_IMAGE))
                {
                    WTSPropLayoutEditor.Instance.PropPreview.OverrideSprite.spriteName = ((UITextField)x).text.Split('/').Last().Trim();
                }
            };
            lb.eventItemMouseHover += (x, y) =>
            {
                if (y >= 0 && y < lb.items.Length)
                {
                    WTSPropLayoutEditor.Instance.PropPreview.OverrideSprite.spriteName = lb.items[y].Split('/').Last().Trim();
                }
            };
            lb.eventVisibilityChanged += (x, y) => WTSPropLayoutEditor.Instance.PropPreview.OverrideSprite.parent.isVisible = y;
            WTSPropLayoutEditor.Instance.PropPreview.OverrideSprite.parent.isVisible = false;

            AddIntField(Locale.Get("K45_WTS_PROPLAYOUT_ITEMDURATIONFRAMES"), out m_slideDurationFrames, helperConfig, OnSetDurationFrames, false);
            AddIntField(Locale.Get("K45_WTS_PROPLAYOUT_DESYNCFRAMES"), out m_slideDesync, helperConfig, OnSetDesyncOffset, false);
            helperConfig.AddSpace(5);
            AddDropdown(Locale.Get("K45_WTS_CLASS_FONT"), out m_fontClassSelect, helperConfig, ColossalUIExtensions.GetDropdownOptions <FontClass>("K45_WTS_FONTCLASS"), OnSetFontClass);
            AddEmptyDropdown(Locale.Get("K45_WTS_OVERRIDE_FONT"), out m_overrideFontSelect, helperConfig, OnSetOverrideFont);
            AddTextField(Locale.Get("K45_WTS_PREFIX"), out m_textPrefix, helperConfig, OnSetPrefix);
            AddTextField(Locale.Get("K45_WTS_SUFFIX"), out m_textSuffix, helperConfig, OnSetSuffix);
            AddCheckboxLocale("K45_WTS_TEXT_ALL_CAPS", out m_allCaps, helperConfig, OnSetAllCaps);
            AddCheckboxLocale("K45_WTS_TEXT_APPLYABBREVIATIONS", out m_applyAbbreviations, helperConfig, OnSetApplyAbbreviations);
            AddVector2Field(Locale.Get("K45_WTS_TEXT_ROW_COLUMNS"), out m_arrayRowColumnsCount, helperConfig, OnRowColumnCountChanged, true, true);
            m_arrayRowColumnsCount.ForEach(x => x.allowNegative = false);
            AddVector2Field(Locale.Get("K45_WTS_TEXT_ROW_COLUMNS_SPACING"), out m_arrayRowColumnsSpacing, helperConfig, OnRowColumnSpacingChanged);
            AddDropdown(Locale.Get("K45_WTS_VERTICAL_ALIGNMENT"), out m_verticalAlignDD, helperConfig, ColossalUIExtensions.GetDropdownOptions <UIVerticalAlignment>("K45_VERT_ALIGNMENT"), OnSetVerticalAlign);
            AddCheckboxLocale("K45_WTS_TEXT_FILLCOLUMNSFIRST", out m_checkboxVerticalFirst, helperConfig, OnColumnsFirstChanged);

            WTSUtils.ReloadFontsOf(m_overrideFontSelect, null, true, true);

            WTSPropLayoutEditor.Instance.CurrentTabChanged += (newVal) =>
            {
                int targetTab = newVal - 1;
                SafeObtain(OnSetData, targetTab);
                if (WTSPropLayoutEditor.Instance.EditingInstance?.m_configurationSource == ConfigurationSource.CITY)
                {
                    m_tabContainer.Enable();
                }
                else
                {
                    m_tabContainer.Disable();
                }
            };
            m_isEditing = false;


            AddLibBox <WTSLibPropTextItem, BoardTextDescriptorGeneralXml>(helperSettings, out UIButton m_copyButtonText,
                                                                          DoCopyText, out m_pasteButtonText,
                                                                          DoPasteText, out UIButton m_deleteButtonText,
                                                                          DoDeleteText, (loadedItem) => SafeObtain((ref BoardTextDescriptorGeneralXml x) =>
            {
                string name = x.SaveName;
                x           = XmlUtils.DefaultXmlDeserialize <BoardTextDescriptorGeneralXml>(loadedItem);
                x.SaveName  = name;
                OnSetData(ref x);
                x.SaveName = name;
            }),
                                                                          () => XmlUtils.DefaultXmlSerialize(WTSPropLayoutEditor.Instance.EditingInstance.TextDescriptors[Math.Max(0, TabToEdit)]));
        }