EffectWindow.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using wf;
  5. public class EffectWindow : BaseMaidPhotoWindow
  6. {
  7. public override void Awake()
  8. {
  9. base.Awake();
  10. for (int i = 0; i < this.EffectObjectArray.Length; i++)
  11. {
  12. GameObject gameObject = Utility.CreatePrefab(this.Grid.gameObject, "ScenePhotoMode/WindowListItem", true);
  13. gameObject.name = this.EffectObjectArray[i].Id.ToString();
  14. gameObject.GetComponentInChildren<UILabel>().text = this.EffectObjectArray[i].Name;
  15. EventDelegate.Add(gameObject.GetComponent<UIWFTabButton>().onSelect, new EventDelegate.Callback(this.OnSelectEvent));
  16. this.id_btn_dic_.Add(long.Parse(gameObject.name), gameObject.GetComponent<UIWFTabButton>());
  17. }
  18. this.Grid.Reposition();
  19. this.Grid.GetComponent<UIWFTabPanel>().UpdateChildren();
  20. for (int j = 0; j < this.EffectObjectArray.Length; j++)
  21. {
  22. if (!this.EffectObjectArray[j].EffectObject.gameObject.activeSelf)
  23. {
  24. this.EffectObjectArray[j].EffectObject.gameObject.SetActive(true);
  25. }
  26. }
  27. }
  28. public override void Start()
  29. {
  30. base.Start();
  31. this.UpdateChildren();
  32. for (int i = 0; i < this.EffectObjectArray.Length; i++)
  33. {
  34. this.EffectObjectArray[i].EffectObject.SetEffectWindow(this);
  35. this.EffectObjectArray[i].EffectObject.Init();
  36. }
  37. this.Grid.GetComponent<UIWFTabPanel>().Select(this.id_btn_dic_[(long)this.EffectObjectArray[0].Id]);
  38. }
  39. public override void OnMaidAddEvent(Maid maid, bool is_deserialize_load)
  40. {
  41. for (int i = 0; i < this.EffectObjectArray.Length; i++)
  42. {
  43. this.EffectObjectArray[i].EffectObject.OnMaidAddEvent(maid, is_deserialize_load);
  44. }
  45. }
  46. public void OnSelectEvent()
  47. {
  48. if (!UIWFSelectButton.current.isSelected)
  49. {
  50. return;
  51. }
  52. ulong num = ulong.Parse(UIWFSelectButton.current.name);
  53. for (int i = 0; i < this.EffectObjectArray.Length; i++)
  54. {
  55. this.EffectObjectArray[i].EffectObject.visible = ((int)num == this.EffectObjectArray[i].Id);
  56. }
  57. }
  58. public override void OnSerializeEvent()
  59. {
  60. for (int i = 0; i < this.EffectObjectArray.Length; i++)
  61. {
  62. this.EffectObjectArray[i].EffectObject.OnSerializeEvent();
  63. }
  64. Dictionary<string, Dictionary<string, string>> woldStoreData = base.GetWoldStoreData();
  65. if (!woldStoreData.ContainsKey("選択エフェクト"))
  66. {
  67. woldStoreData.Add("選択エフェクト", new Dictionary<string, string>());
  68. }
  69. Dictionary<string, string> dictionary = woldStoreData["選択エフェクト"];
  70. dictionary["id"] = this.Grid.GetComponent<UIWFTabPanel>().GetSelectButtonObject().name.ToString();
  71. }
  72. public override void OnDeserializeEvent()
  73. {
  74. for (int i = 0; i < this.EffectObjectArray.Length; i++)
  75. {
  76. this.EffectObjectArray[i].EffectObject.OnDeserializeEvent();
  77. }
  78. Dictionary<string, Dictionary<string, string>> woldStoreData = base.GetWoldStoreData();
  79. if (!woldStoreData.ContainsKey("選択エフェクト"))
  80. {
  81. woldStoreData.Add("選択エフェクト", new Dictionary<string, string>());
  82. }
  83. string value = this.EffectObjectArray[0].Id.ToString();
  84. Dictionary<string, string> dictionary = woldStoreData["選択エフェクト"];
  85. if (!dictionary.ContainsKey("id"))
  86. {
  87. dictionary["id"] = value;
  88. }
  89. else if (dictionary["id"] == "0")
  90. {
  91. dictionary["id"] = value;
  92. }
  93. long key = long.Parse(dictionary["id"]);
  94. this.Grid.GetComponent<UIWFTabPanel>().Select(this.id_btn_dic_[key]);
  95. }
  96. public Dictionary<string, Dictionary<string, string>> GetStoreData()
  97. {
  98. return base.mgr.GetWoldStoreData(this);
  99. }
  100. public UIGrid Grid;
  101. public EffectWindow.EffectObjectData[] EffectObjectArray;
  102. private Dictionary<long, UIWFTabButton> id_btn_dic_ = new Dictionary<long, UIWFTabButton>();
  103. [Serializable]
  104. public class EffectObjectData
  105. {
  106. public int Id;
  107. public string Name;
  108. public WindowPartsEffectBase EffectObject;
  109. }
  110. }