UndressingWindow.cs 5.5 KB

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