using System; using System.Collections.Generic; using I2.Loc; using UnityEngine; using wf; public class EffectWindow : BaseMaidPhotoWindow { public override void Awake() { base.Awake(); for (int i = 0; i < this.EffectObjectArray.Length; i++) { GameObject gameObject = Utility.CreatePrefab(this.Grid.gameObject, "ScenePhotoMode/WindowListItem", true); gameObject.name = this.EffectObjectArray[i].Id.ToString(); gameObject.GetComponentInChildren().text = this.EffectObjectArray[i].Name; Localize componentInChildren = gameObject.GetComponentInChildren(); if (componentInChildren != null) { componentInChildren.SetTerm("ScenePhotoMode/エフェクト/" + this.EffectObjectArray[i].Name); } EventDelegate.Add(gameObject.GetComponent().onSelect, new EventDelegate.Callback(this.OnSelectEvent)); this.id_btn_dic_.Add(long.Parse(gameObject.name), gameObject.GetComponent()); } this.Grid.Reposition(); this.Grid.GetComponent().UpdateChildren(); for (int j = 0; j < this.EffectObjectArray.Length; j++) { if (!this.EffectObjectArray[j].EffectObject.gameObject.activeSelf) { this.EffectObjectArray[j].EffectObject.gameObject.SetActive(true); } } } public override void Start() { base.Start(); this.UpdateChildren(); for (int i = 0; i < this.EffectObjectArray.Length; i++) { this.EffectObjectArray[i].EffectObject.SetEffectWindow(this); this.EffectObjectArray[i].EffectObject.Init(); } this.Grid.GetComponent().Select(this.id_btn_dic_[(long)this.EffectObjectArray[0].Id]); } public override void OnMaidAddEvent(Maid maid, bool is_deserialize_load) { for (int i = 0; i < this.EffectObjectArray.Length; i++) { this.EffectObjectArray[i].EffectObject.OnMaidAddEvent(maid, is_deserialize_load); } } public void OnSelectEvent() { if (!UIWFSelectButton.current.isSelected) { return; } ulong num = ulong.Parse(UIWFSelectButton.current.name); for (int i = 0; i < this.EffectObjectArray.Length; i++) { this.EffectObjectArray[i].EffectObject.visible = ((int)num == this.EffectObjectArray[i].Id); } } public override void OnSerializeEvent() { for (int i = 0; i < this.EffectObjectArray.Length; i++) { this.EffectObjectArray[i].EffectObject.OnSerializeEvent(); } Dictionary> woldStoreData = base.GetWoldStoreData(); if (!woldStoreData.ContainsKey("選択エフェクト")) { woldStoreData.Add("選択エフェクト", new Dictionary()); } Dictionary dictionary = woldStoreData["選択エフェクト"]; dictionary["id"] = this.Grid.GetComponent().GetSelectButtonObject().name.ToString(); } public override void OnDeserializeEvent() { for (int i = 0; i < this.EffectObjectArray.Length; i++) { this.EffectObjectArray[i].EffectObject.OnDeserializeEvent(); } Dictionary> woldStoreData = base.GetWoldStoreData(); if (!woldStoreData.ContainsKey("選択エフェクト")) { woldStoreData.Add("選択エフェクト", new Dictionary()); } string value = this.EffectObjectArray[0].Id.ToString(); Dictionary dictionary = woldStoreData["選択エフェクト"]; if (!dictionary.ContainsKey("id")) { dictionary["id"] = value; } else if (dictionary["id"] == "0") { dictionary["id"] = value; } long key = long.Parse(dictionary["id"]); this.Grid.GetComponent().Select(this.id_btn_dic_[key]); } public Dictionary> GetStoreData() { return base.mgr.GetWoldStoreData(this); } public UIGrid Grid; public EffectWindow.EffectObjectData[] EffectObjectArray; private Dictionary id_btn_dic_ = new Dictionary(); [Serializable] public class EffectObjectData { public int Id; public string Name; public WindowPartsEffectBase EffectObject; } }