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); }
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); } }