EffectWindow.cs 3.9 KB

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