private new void Awake()
 {
     base.Awake();
     if (Application.isPlaying)
     {
         if (this.key != string.Empty)
         {
             StringKey   key         = new StringKey(this.key);
             StringEntry stringEntry = Strings.Get(key);
             text = stringEntry.String;
         }
         text = Localization.Fixup(text);
         base.isRightToLeftText = Localization.IsRightToLeft;
         SetTextStyleSetting setTextStyleSetting = base.gameObject.GetComponent <SetTextStyleSetting>();
         if ((Object)setTextStyleSetting == (Object)null)
         {
             setTextStyleSetting = base.gameObject.AddComponent <SetTextStyleSetting>();
         }
         if (!allowOverride)
         {
             setTextStyleSetting.SetStyle(textStyleSetting);
         }
         textLinkHandler = GetComponent <TextLinkHandler>();
     }
 }
 public virtual void ActivateTabArtwork(int tabIdx)
 {
     if (tabIdx < base.transform.childCount)
     {
         for (int i = 0; i < base.transform.childCount; i++)
         {
             ImageToggleState component = base.transform.GetChild(i).GetComponent <ImageToggleState>();
             if ((Object)component != (Object)null)
             {
                 if (i == tabIdx)
                 {
                     component.SetActive();
                 }
                 else
                 {
                     component.SetInactive();
                 }
             }
             Canvas componentInChildren = base.transform.GetChild(i).GetComponentInChildren <Canvas>(true);
             if ((Object)componentInChildren != (Object)null)
             {
                 componentInChildren.overrideSorting = (tabIdx == i);
             }
             SetTextStyleSetting componentInChildren2 = base.transform.GetChild(i).GetComponentInChildren <SetTextStyleSetting>();
             if ((Object)componentInChildren2 != (Object)null && (Object)TextStyle_Active != (Object)null && (Object)TextStyle_Inactive != (Object)null)
             {
                 if (i == tabIdx)
                 {
                     componentInChildren2.SetStyle(TextStyle_Active);
                 }
                 else
                 {
                     componentInChildren2.SetStyle(TextStyle_Inactive);
                 }
             }
         }
     }
 }
Esempio n. 3
0
    private void prepareMultiStringTooltip(ToolTip setting)
    {
        int multiStringCount = tooltipSetting.multiStringCount;

        clearMultiStringTooltip();
        for (int i = 0; i < multiStringCount; i++)
        {
            GameObject gameObject = Util.KInstantiateUI(labelPrefab, null, true);
            gameObject.transform.SetParent(multiTooltipContainer.transform);
        }
        for (int j = 0; j < tooltipSetting.multiStringCount; j++)
        {
            Transform       child      = multiTooltipContainer.transform.GetChild(j);
            LayoutElement   component  = child.GetComponent <LayoutElement>();
            TextMeshProUGUI component2 = child.GetComponent <TextMeshProUGUI>();
            component2.text = tooltipSetting.GetMultiString(j);
            SetTextStyleSetting component3 = child.GetComponent <SetTextStyleSetting>();
            component3.SetStyle((TextStyleSetting)tooltipSetting.GetStyleSetting(j));
            if (setting.SizingSetting == ToolTip.ToolTipSizeSetting.MaxWidthWrapContent)
            {
                float num2 = component.minWidth = (component.preferredWidth = setting.WrapWidth);
                component.rectTransform().sizeDelta = new Vector2(setting.WrapWidth, 1000f);
                num2 = (component.minHeight = (component.preferredHeight = component2.preferredHeight));
                num2 = (component.minHeight = (component.preferredHeight = component2.preferredHeight));
                component.rectTransform().sizeDelta = new Vector2(setting.WrapWidth, component.minHeight);
                GetComponentInChildren <ContentSizeFitter>(true).horizontalFit = ContentSizeFitter.FitMode.MinSize;
                multiTooltipContainer.GetComponent <LayoutElement>().minWidth  = setting.WrapWidth;
            }
            else if (setting.SizingSetting == ToolTip.ToolTipSizeSetting.DynamicWidthNoWrap)
            {
                GetComponentInChildren <ContentSizeFitter>(true).horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
                Vector2       preferredValues = component2.GetPreferredValues();
                LayoutElement component4      = multiTooltipContainer.GetComponent <LayoutElement>();
                float         num2            = component.preferredWidth = preferredValues.x;
                num2 = (component4.minWidth = (component.minWidth = num2));
                num2 = (component.minHeight = (component.preferredHeight = preferredValues.y));
                GetComponentInChildren <ContentSizeFitter>(true).SetLayoutHorizontal();
                GetComponentInChildren <ContentSizeFitter>(true).SetLayoutVertical();
                multiTooltipContainer.rectTransform().sizeDelta = new Vector2(component.minWidth, component.minHeight);
                multiTooltipContainer.transform.parent.rectTransform().sizeDelta = multiTooltipContainer.rectTransform().sizeDelta;
            }
            component2.ForceMeshUpdate();
        }
        tooltipIncubating = true;
    }