UndressingWindow.cs 5.7 KB

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