using System; using System.Collections.Generic; using UnityEngine; using wf; [RequireComponent(typeof(UITable))] public class UIWFConditionList : MonoBehaviour { public int height { get; private set; } public int width { get; private set; } private void Awake() { if (this.condition_label_list_ != null) { return; } this.condition_label_list_ = new List(); UITable component = base.GetComponent(); List childList = component.GetChildList(); foreach (Transform transform in childList) { UILabel component2 = UTY.GetChildObject(transform.gameObject, "Message", false).GetComponent(); this.condition_label_list_.Add(component2); this.defaultFontSize = component2.fontSize; this.widthMargin = (int)(component2.transform.localPosition.x - (float)(UTY.GetChildObject(transform.gameObject, "No", false).GetComponent().width / -2)); transform.gameObject.SetActive(false); } } public void SetTexts(string[] texts, int limitTextWidth = -1) { KeyValuePair[] array = new KeyValuePair[texts.Length]; for (int i = 0; i < texts.Length; i++) { array[i] = new KeyValuePair(texts[i], Color.white); } this.SetTexts(array, limitTextWidth); } public void SetTexts(KeyValuePair[] texts, int limitTextWidth = -1) { if (this.condition_label_list_ == null) { this.Awake(); } this.width = 0; float num = 0f; float num2 = 0f; for (int i = 0; i < this.condition_label_list_.Count; i++) { if (i < texts.Length) { Transform parent = this.condition_label_list_[i].transform.parent; if (i == 0) { num = Mathf.Abs(parent.localPosition.y); } this.condition_label_list_[i].transform.parent.gameObject.SetActive(true); this.condition_label_list_[i].text = texts[i].Key; this.condition_label_list_[i].color = texts[i].Value; this.condition_label_list_[i].fontSize = this.defaultFontSize; this.condition_label_list_[i].width = 0; this.condition_label_list_[i].MakePixelPerfect(); if (0 <= limitTextWidth) { Utility.ResizeUILabelFontSize(this.condition_label_list_[i], limitTextWidth); } this.width = Mathf.Max(this.width, this.condition_label_list_[i].width); num2 = Mathf.Abs(parent.localPosition.y) + (float)parent.gameObject.GetComponent().height; } else { this.condition_label_list_[i].transform.parent.gameObject.SetActive(false); } } this.height = (int)(num2 - num); this.width += this.widthMargin; } private int widthMargin; private List condition_label_list_; private int defaultFontSize; }