using System; using System.Collections.Generic; using I2.Loc; using UnityEngine; using wf; public class FreeModeItemList : MonoBehaviour { public void Awake() { this.grid_ = UTY.GetChildObject(base.gameObject, "ListParent/MaskGroup/Contents/Grid", false).GetComponent(); this.scroll_view_ = UTY.GetChildObject(base.gameObject, "ListParent/MaskGroup/Contents", false).GetComponent(); this.tab_pabel_ = UTY.GetChildObject(base.gameObject, "ListParent/MaskGroup/Contents/Grid", false).GetComponent(); this.info_label_ = UTY.GetChildObject(base.gameObject, "DetailParent/DetailBlock/Text", false).GetComponent(); UIGrid component = UTY.GetChildObject(base.gameObject, "DetailParent/ConditionBlock/GridParent", false).GetComponent(); List childList = component.GetChildList(); for (int i = 0; i < childList.Count; i++) { this.condition_label_list_.Add(UTY.GetChildObject(childList[i].gameObject, "Message", false).GetComponent()); } } public bool SetList(AbstractFreeModeItem[] item_list, Maid maid) { if (0 < this.grid_.gameObject.transform.childCount || item_list == null || item_list.Length <= 0) { return false; } this.select_item_data_ = null; UIWFTabButton uiwftabButton = null; for (int i = 0; i < item_list.Length; i++) { GameObject gameObject = Utility.CreatePrefab(this.grid_.gameObject, "SceneFreeModeSelect/FreeModeItemButton", true); UILabel component = UTY.GetChildObject(gameObject, "Name", false).GetComponent(); Localize component2 = component.GetComponent(); component.text = item_list[i].title; if (component2 != null) { component2.SetTerm(item_list[i].titleTerm); } UIWFTabButton component3 = gameObject.GetComponent(); component3.isEnabled = false; EventDelegate.Add(component3.onSelect, new EventDelegate.Callback(this.OnSelectItem)); UIEventTrigger component4 = gameObject.GetComponent(); EventDelegate eventDelegate = new EventDelegate(this, "OnMouseHoverIn"); eventDelegate.parameters[0].value = component3; EventDelegate.Add(component4.onHoverOver, eventDelegate); EventDelegate.Add(component4.onHoverOut, new EventDelegate.Callback(this.OnMouseHoverOut)); component4 = UTY.GetChildObject(gameObject, "HitRect", false).GetComponent(); eventDelegate = new EventDelegate(this, "OnMouseHoverIn"); eventDelegate.parameters[0].value = component3; EventDelegate.Add(component4.onHoverOver, eventDelegate); EventDelegate.Add(component4.onHoverOut, new EventDelegate.Callback(this.OnMouseHoverOut)); bool flag = item_list[i].isEnabled(maid); if (flag) { component3.isEnabled = true; UTY.GetChildObject(gameObject, "HitRect", false).SetActive(false); if (uiwftabButton == null) { uiwftabButton = component3; } } else { component3.isEnabled = false; UTY.GetChildObject(gameObject, "HitRect", false).SetActive(true); } this.item_obj_dic_.Add(gameObject, item_list[i]); } this.grid_.Reposition(); this.scroll_view_.ResetPosition(); this.tab_pabel_.UpdateChildren(); if (uiwftabButton != null) { this.tab_pabel_.Select(uiwftabButton); } this.UpdateInfo(this.select_item_data_); return uiwftabButton != null; } public void OnSelectItem() { if (!UIWFTabButton.current.isSelected || !this.item_obj_dic_.ContainsKey(UIWFTabButton.current.gameObject)) { return; } this.select_item_data_ = this.item_obj_dic_[UIWFTabButton.current.gameObject]; this.UpdateInfo(this.select_item_data_); } private void OnMouseHoverIn(UIWFTabButton tab_btn) { this.UpdateInfo(this.item_obj_dic_[tab_btn.gameObject]); } private void OnMouseHoverOut() { this.UpdateInfo(this.select_item_data_); } public void UpdateInfo(AbstractFreeModeItem select_item_dat) { if (select_item_dat == null) { this.info_label_.text = string.Empty; for (int i = 0; i < this.condition_label_list_.Count; i++) { this.condition_label_list_[i].transform.parent.gameObject.SetActive(false); } } else { this.info_label_.text = select_item_dat.text; Localize component = this.info_label_.GetComponent(); if (component != null) { component.SetTerm(select_item_dat.textTerm); } string[] condition_text_terms = select_item_dat.condition_text_terms; for (int j = 0; j < this.condition_label_list_.Count; j++) { if (j < select_item_dat.condition_texts.Length) { this.condition_label_list_[j].transform.parent.gameObject.SetActive(true); this.condition_label_list_[j].text = select_item_dat.condition_texts[j]; component = this.condition_label_list_[j].GetComponent(); if (component != null) { component.SetTerm(condition_text_terms[j]); } } else { this.condition_label_list_[j].transform.parent.gameObject.SetActive(false); } } } } public AbstractFreeModeItem select_item_data { get { return this.select_item_data_; } set { this.select_item_data_ = value; } } private Dictionary item_obj_dic_ = new Dictionary(); private UIGrid grid_; private UIScrollView scroll_view_; private UIWFTabPanel tab_pabel_; private UILabel info_label_; private List condition_label_list_ = new List(); private AbstractFreeModeItem select_item_data_; }