UndressingWindow.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using wf;
  5. public class UndressingWindow : BaseMaidPhotoWindow
  6. {
  7. public override void Awake()
  8. {
  9. base.Awake();
  10. this.noCharaActive = base.GetComponentInChildren<PhotoNoCharaActive>();
  11. this.scroll_view_ = NGUITools.FindInParents<UIScrollView>(this.Grid.transform);
  12. using (AFileBase afileBase = GameUty.FileSystem.FileOpen("phot_undressing_list.nei"))
  13. {
  14. using (CsvParser csvParser = new CsvParser())
  15. {
  16. bool condition = csvParser.Open(afileBase);
  17. NDebug.Assert(condition, "phot_undressing_list.nei\nopen failed.");
  18. for (int i = 1; i < csvParser.max_cell_y; i++)
  19. {
  20. if (csvParser.IsCellToExistData(0, i))
  21. {
  22. GameObject gameObject = Utility.CreatePrefab(this.Grid.gameObject, "ScenePhotoMode/WindowListItemNormalButton", true);
  23. gameObject.name = csvParser.GetCellAsString(0, i);
  24. gameObject.GetComponentInChildren<UILabel>().text = gameObject.name;
  25. UIButton componentInChildren = gameObject.GetComponentInChildren<UIButton>();
  26. componentInChildren.defaultColor = Color.white;
  27. componentInChildren.disabledColor = new Color(0.15f, 0.15f, 0.15f);
  28. this.unit_dic_.Add(gameObject.name, componentInChildren);
  29. }
  30. }
  31. }
  32. }
  33. this.UndressingMgr.SetUnitButtonList(this.unit_dic_);
  34. this.UndressingMgr.onClickEvent = new Action(this.OnStoreDataUpdate);
  35. NGUITools.FindInParents<UIScrollView>(this.Grid.transform).ResetPosition();
  36. this.Grid.Reposition();
  37. this.scroll_view_.ResetPosition();
  38. this.UpdateChildren();
  39. }
  40. public override void Start()
  41. {
  42. base.Start();
  43. this.MekureFront.onClick.Add(delegate(WFCheckBox check_box)
  44. {
  45. this.MekureBack.UpdateGui();
  46. this.OnStoreDataUpdate();
  47. });
  48. this.MekureBack.onClick.Add(delegate(WFCheckBox check_box)
  49. {
  50. this.MekureFront.UpdateGui();
  51. this.OnStoreDataUpdate();
  52. });
  53. this.Zurasi.onClick.Add(delegate(WFCheckBox check_box)
  54. {
  55. this.OnStoreDataUpdate();
  56. });
  57. this.noCharaActive.ChangeMode(true, true);
  58. }
  59. public override void OnMaidAddEvent(Maid maid, bool is_deserialize_load)
  60. {
  61. if (maid == null)
  62. {
  63. return;
  64. }
  65. this.activeMaidList.Add(maid);
  66. this.noCharaActive.ChangeMode(false, true);
  67. if (maid.boMAN)
  68. {
  69. return;
  70. }
  71. maid.body0.SetMaskMode(TBody.MaskMode.None);
  72. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maid);
  73. HashSet<TBody.SlotID> targetSlotID = this.UndressingMgr.GetTargetSlotID();
  74. foreach (TBody.SlotID f_eSlot in targetSlotID)
  75. {
  76. string key = f_eSlot.ToString();
  77. if (maidStoreData.ContainsKey(key) && !bool.Parse(maidStoreData[key]))
  78. {
  79. maid.body0.SetMask(f_eSlot, false);
  80. }
  81. }
  82. foreach (KeyValuePair<string, WindowPartsMekureCheckBox> keyValuePair in new Dictionary<string, WindowPartsMekureCheckBox>
  83. {
  84. {
  85. "check_box_mekure_front",
  86. this.MekureFront
  87. },
  88. {
  89. "check_box_mekure_back",
  90. this.MekureBack
  91. },
  92. {
  93. "check_box_zurasi",
  94. this.Zurasi
  95. }
  96. })
  97. {
  98. string key2 = keyValuePair.Key;
  99. WindowPartsMekureCheckBox value = keyValuePair.Value;
  100. if (!maidStoreData.ContainsKey(key2))
  101. {
  102. maidStoreData[key2] = false.ToString();
  103. }
  104. if (bool.Parse(maidStoreData[key2]))
  105. {
  106. value.SetMaid(maid);
  107. value.check = true;
  108. value.Apply();
  109. value.SetMaid(null);
  110. }
  111. }
  112. this.OnStoreDataUpdate();
  113. }
  114. public override void OnMaidRemoveEvent(Maid maid)
  115. {
  116. this.activeMaidList.Remove(maid);
  117. if (this.activeMaidList.Count <= 0)
  118. {
  119. this.noCharaActive.ChangeMode(true, true);
  120. }
  121. }
  122. public override void OnMaidChangeEvent(Maid maid)
  123. {
  124. base.OnMaidChangeEvent(maid);
  125. if (maid == null || maid.boMAN)
  126. {
  127. maid = null;
  128. }
  129. this.UndressingMgr.SetMaid(maid);
  130. this.MekureFront.SetMaid(maid);
  131. this.MekureBack.SetMaid(maid);
  132. this.Zurasi.SetMaid(maid);
  133. this.OnStoreDataUpdate();
  134. }
  135. public void OnStoreDataUpdate()
  136. {
  137. Maid select_maid = base.mgr.select_maid;
  138. if (select_maid == null || select_maid.boMAN)
  139. {
  140. return;
  141. }
  142. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(select_maid);
  143. maidStoreData.Clear();
  144. HashSet<TBody.SlotID> targetSlotID = this.UndressingMgr.GetTargetSlotID();
  145. foreach (TBody.SlotID f_eSlot in targetSlotID)
  146. {
  147. bool mask = select_maid.body0.GetMask(f_eSlot);
  148. maidStoreData[f_eSlot.ToString()] = mask.ToString();
  149. }
  150. foreach (KeyValuePair<string, WindowPartsMekureCheckBox> keyValuePair in new Dictionary<string, WindowPartsMekureCheckBox>
  151. {
  152. {
  153. "check_box_mekure_front",
  154. this.MekureFront
  155. },
  156. {
  157. "check_box_mekure_back",
  158. this.MekureBack
  159. },
  160. {
  161. "check_box_zurasi",
  162. this.Zurasi
  163. }
  164. })
  165. {
  166. string key = keyValuePair.Key;
  167. WindowPartsMekureCheckBox value = keyValuePair.Value;
  168. maidStoreData[key] = value.check.ToString();
  169. }
  170. }
  171. public override void OnDeserializeEvent()
  172. {
  173. }
  174. public UIGrid Grid;
  175. public PhotUndressingManager UndressingMgr;
  176. public WindowPartsMekureCheckBox MekureFront;
  177. public WindowPartsMekureCheckBox MekureBack;
  178. public WindowPartsMekureCheckBox Zurasi;
  179. private Dictionary<string, UIButton> unit_dic_ = new Dictionary<string, UIButton>();
  180. private PhotoNoCharaActive noCharaActive;
  181. private HashSet<Maid> activeMaidList = new HashSet<Maid>();
  182. private UIScrollView scroll_view_;
  183. }