public StatusItemEntry(StatusItemGroup.Entry item, StatusItemCategory category, GameObject status_item_prefab, Transform parent, TextStyleSetting tooltip_style, Color color, TextStyleSetting style, bool skip_fade, Action <StatusItemEntry> onDestroy) { this.item = item; this.category = category; tooltipStyle = tooltip_style; this.onDestroy = onDestroy; this.color = color; this.style = style; widget = Util.KInstantiateUI(status_item_prefab, parent.gameObject, false); text = widget.GetComponentInChildren <LocText>(true); SetTextStyleSetting.ApplyStyle(text, style); toolTip = widget.GetComponentInChildren <ToolTip>(true); image = widget.GetComponentInChildren <Image>(true); item.SetIcon(image); widget.SetActive(true); toolTip.OnToolTip = OnToolTip; button = widget.GetComponentInChildren <KButton>(); if (item.item.statusItemClickCallback != null) { button.onClick += OnClick; } else { button.enabled = false; } fadeStage = (skip_fade ? FadeStage.WAIT : FadeStage.IN); SimAndRenderScheduler.instance.Add(this, false); Refresh(); SetColor(1f); }
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 void ApplySettings() { if (this.key != string.Empty && Application.isPlaying) { StringKey key = new StringKey(this.key); text = Strings.Get(key); } if ((Object)textStyleSetting != (Object)null) { SetTextStyleSetting.ApplyStyle(this, textStyleSetting); } }
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; }
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); } } } } }