using System; using System.Collections.Generic; using UnityEngine; public class UIWFTabPanel : MonoBehaviour { public void Start() { if (this.onclick_event_ != null) { return; } this.UpdateChildren(); } public void AddChildrenList(List button_list) { if (!base.enabled) { return; } if (this.onclick_event_ == null) { this.onclick_event_ = new EventDelegate(this, "OnClick"); } this.button_list_.Clear(); for (int i = 0; i < button_list.Count; i++) { UIWFTabButton uiwftabButton = this.button_list_[i]; if (uiwftabButton != null) { bool flag = false; for (int j = 0; j < uiwftabButton.onClick.Count; j++) { if (uiwftabButton.onClick[j] == this.onclick_event_) { flag = true; break; } } if (!flag) { uiwftabButton.onClick.Add(this.onclick_event_); } } } } public void UpdateChildren() { if (!base.enabled) { return; } if (this.onclick_event_ == null) { this.onclick_event_ = new EventDelegate(this, "OnClick"); } this.button_list_.Clear(); Transform transform = base.transform; for (int i = 0; i < transform.childCount; i++) { if (transform.gameObject.activeSelf) { UIWFTabButton componentInChildren = transform.GetChild(i).GetComponentInChildren(); if (componentInChildren != null) { this.button_list_.Add(componentInChildren); bool flag = false; for (int j = 0; j < componentInChildren.onClick.Count; j++) { if (componentInChildren.onClick[j] == this.onclick_event_) { flag = true; break; } } if (!flag) { componentInChildren.onClick.Add(this.onclick_event_); } } } } } public void Select(UIWFTabButton button) { if (!base.enabled) { return; } UIWFTabButton current = UIWFTabButton.current; UIButton current2 = UIButton.current; UIWFTabButton.current = button; UIButton.current = button; EventDelegate.Execute(button.onClick); UIWFTabButton.current = current; UIButton.current = current2; } public void ResetSelect() { this.select_button_ = null; } public UIWFTabButton GetSelectButtonObject() { return this.select_button_; } private void OnClick() { if (!base.enabled) { return; } for (int i = 0; i < this.button_list_.Count; i++) { if (this.button_list_[i].enabled) { bool flag = UIButton.current == this.button_list_[i]; if (flag) { this.select_button_ = this.button_list_[i]; } this.button_list_[i].SetSelect(flag); } } } public List button_list { get { return this.button_list_; } } private List button_list_ = new List(); private EventDelegate onclick_event_; private HashSet event_add_object_hash_list_ = new HashSet(); private UIWFTabButton select_button_; }