UndressingWindow.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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.mgr = (this.MekureBack.mgr = (this.Zurasi.mgr = base.mgr));
  44. this.MekureFront.onClick.Add(delegate(WFCheckBox check_box)
  45. {
  46. this.MekureBack.UpdateGui();
  47. this.OnStoreDataUpdate();
  48. });
  49. this.MekureBack.onClick.Add(delegate(WFCheckBox check_box)
  50. {
  51. this.MekureFront.UpdateGui();
  52. this.OnStoreDataUpdate();
  53. });
  54. this.Zurasi.onClick.Add(delegate(WFCheckBox check_box)
  55. {
  56. this.OnStoreDataUpdate();
  57. });
  58. this.noCharaActive.ChangeMode(true, true);
  59. }
  60. public override void OnMaidAddEvent(Maid maid, bool is_deserialize_load)
  61. {
  62. if (maid == null)
  63. {
  64. return;
  65. }
  66. this.activeMaidList.Add(maid);
  67. this.noCharaActive.ChangeMode(false, true);
  68. if (maid.boMAN)
  69. {
  70. return;
  71. }
  72. maid.body0.SetMaskMode(TBody.MaskMode.None);
  73. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maid);
  74. HashSet<TBody.SlotID> targetSlotID = this.UndressingMgr.GetTargetSlotID();
  75. foreach (TBody.SlotID f_eSlot in targetSlotID)
  76. {
  77. string key = f_eSlot.ToString();
  78. if (maidStoreData.ContainsKey(key) && !bool.Parse(maidStoreData[key]))
  79. {
  80. maid.body0.SetMask(f_eSlot, false);
  81. }
  82. }
  83. foreach (KeyValuePair<string, WindowPartsMekureCheckBox> keyValuePair in new Dictionary<string, WindowPartsMekureCheckBox>
  84. {
  85. {
  86. "check_box_mekure_front",
  87. this.MekureFront
  88. },
  89. {
  90. "check_box_mekure_back",
  91. this.MekureBack
  92. },
  93. {
  94. "check_box_zurasi",
  95. this.Zurasi
  96. }
  97. })
  98. {
  99. string key2 = keyValuePair.Key;
  100. WindowPartsMekureCheckBox value = keyValuePair.Value;
  101. if (!maidStoreData.ContainsKey(key2))
  102. {
  103. maidStoreData[key2] = false.ToString();
  104. }
  105. if (bool.Parse(maidStoreData[key2]))
  106. {
  107. value.SetMaid(maid);
  108. value.check = true;
  109. value.Apply();
  110. value.SetMaid(null);
  111. }
  112. }
  113. this.OnStoreDataUpdate();
  114. }
  115. public override void OnMaidRemoveEvent(Maid maid)
  116. {
  117. this.activeMaidList.Remove(maid);
  118. if (this.activeMaidList.Count <= 0)
  119. {
  120. this.noCharaActive.ChangeMode(true, true);
  121. }
  122. }
  123. public override void OnMaidChangeEvent(Maid maid)
  124. {
  125. base.OnMaidChangeEvent(maid);
  126. if (maid == null || maid.boMAN)
  127. {
  128. maid = null;
  129. }
  130. this.UndressingMgr.SetMaid(maid);
  131. this.MekureFront.SetMaid(maid);
  132. this.MekureBack.SetMaid(maid);
  133. this.Zurasi.SetMaid(maid);
  134. this.OnStoreDataUpdate();
  135. }
  136. public void OnStoreDataUpdate()
  137. {
  138. Maid select_maid = base.mgr.select_maid;
  139. if (select_maid == null || select_maid.boMAN)
  140. {
  141. return;
  142. }
  143. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(select_maid);
  144. maidStoreData.Clear();
  145. HashSet<TBody.SlotID> targetSlotID = this.UndressingMgr.GetTargetSlotID();
  146. foreach (TBody.SlotID f_eSlot in targetSlotID)
  147. {
  148. bool mask = select_maid.body0.GetMask(f_eSlot);
  149. maidStoreData[f_eSlot.ToString()] = mask.ToString();
  150. }
  151. foreach (KeyValuePair<string, WindowPartsMekureCheckBox> keyValuePair in new Dictionary<string, WindowPartsMekureCheckBox>
  152. {
  153. {
  154. "check_box_mekure_front",
  155. this.MekureFront
  156. },
  157. {
  158. "check_box_mekure_back",
  159. this.MekureBack
  160. },
  161. {
  162. "check_box_zurasi",
  163. this.Zurasi
  164. }
  165. })
  166. {
  167. string key = keyValuePair.Key;
  168. WindowPartsMekureCheckBox value = keyValuePair.Value;
  169. maidStoreData[key] = value.check.ToString();
  170. }
  171. }
  172. public override void OnDeserializeEvent()
  173. {
  174. }
  175. public UIGrid Grid;
  176. public PhotUndressingManager UndressingMgr;
  177. public WindowPartsMekureCheckBox MekureFront;
  178. public WindowPartsMekureCheckBox MekureBack;
  179. public WindowPartsMekureCheckBox Zurasi;
  180. private Dictionary<string, UIButton> unit_dic_ = new Dictionary<string, UIButton>();
  181. private PhotoNoCharaActive noCharaActive;
  182. private HashSet<Maid> activeMaidList = new HashSet<Maid>();
  183. private UIScrollView scroll_view_;
  184. }