private void OnSetData(ref ImageLayerTextDescriptorXml x) { m_tabName.text = x.SaveName ?? ""; m_arrayCoord[0].text = x.OffsetUV.x.ToString("F3"); m_arrayCoord[1].text = x.OffsetUV.y.ToString("F3"); m_arrayPivot[0].text = x.PivotUV.x.ToString("F3"); m_arrayPivot[1].text = x.PivotUV.y.ToString("F3"); m_charSpacingFactor.text = x.m_charSpacingFactor.ToString("F3"); m_textScale.text = x.m_textScale.ToString("F3"); m_maxWidth.text = x.m_maxWidthPixels.ToString("0"); m_applyScaleOnY.isChecked = x.m_applyOverflowResizingOnY; m_fixedHeight.text = x.m_fixedHeightPixels.ToString("0"); m_colorSource.selectedIndex = (int)x.ColoringConfig.ColorSource; m_textFixedColor.selectedColor = x.ColoringConfig.m_cachedColor; m_dropdownTextContent.selectedIndex = Array.IndexOf(WTSDynamicTextRenderingRules.ALLOWED_TYPES_HIGHWAY_SHIELDS, x.m_textType); m_customText.text = x.m_fixedText ?? ""; m_overrideFontSelect.selectedIndex = x.m_overrideFont == null ? 0 : x.m_overrideFont == WTSController.DEFAULT_FONT_KEY ? 1 : Array.IndexOf(m_overrideFontSelect.items, x.m_overrideFont); m_fontClassSelect.selectedIndex = (int)x.m_fontClass; m_textPrefix.text = x.m_prefix ?? ""; m_textSuffix.text = x.m_suffix ?? ""; m_spriteFilter.text = x.m_spriteParam?.ToString() ?? ""; ApplyShowRules(x); }
private void AddTabToItem(UIComponent x, UIMouseEventParameter y) { var newItem = new ImageLayerTextDescriptorXml { SaveName = $"New text" }; EditingInstance.TextDescriptors.Add(newItem); FixTabstrip(); }
private void ApplyShowRules(ImageLayerTextDescriptorXml x) { m_customText.parent.isVisible = x.m_textType == TextType.Fixed; m_textFixedColor.parent.isVisible = x.ColoringConfig.ColorSource == ColoringSource.Fixed; m_textPrefix.parent.isVisible = !x.IsSpriteText(); m_textSuffix.parent.isVisible = !x.IsSpriteText(); m_overrideFontSelect.parent.isVisible = !x.IsSpriteText(); m_fontClassSelect.parent.isVisible = !x.IsSpriteText(); m_spriteFilter.parent.isVisible = x.m_textType == TextType.GameSprite; }