UndressingWindow.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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 = (this.Hadake.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.Hadake.onClick.Add(delegate(WFCheckBox check_box)
  72. {
  73. this.OnStoreDataUpdate();
  74. });
  75. this.noCharaActive.ChangeMode(true, true);
  76. }
  77. public override void OnMaidAddEvent(Maid maid, bool is_deserialize_load)
  78. {
  79. if (maid == null)
  80. {
  81. return;
  82. }
  83. this.activeMaidList.Add(maid);
  84. this.noCharaActive.ChangeMode(false, true);
  85. if (maid.boMAN)
  86. {
  87. return;
  88. }
  89. maid.body0.SetMaskMode(TBody.MaskMode.None);
  90. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(maid);
  91. HashSet<TBody.SlotID> targetSlotID = this.UndressingMgr.GetTargetSlotID();
  92. foreach (TBody.SlotID f_eSlot in targetSlotID)
  93. {
  94. string key = f_eSlot.ToString();
  95. if (maidStoreData.ContainsKey(key) && !bool.Parse(maidStoreData[key]))
  96. {
  97. maid.body0.SetMask(f_eSlot, false);
  98. }
  99. }
  100. foreach (KeyValuePair<string, WindowPartsMekureCheckBox> keyValuePair in new Dictionary<string, WindowPartsMekureCheckBox>
  101. {
  102. {
  103. "check_box_mekure_front",
  104. this.MekureFront
  105. },
  106. {
  107. "check_box_mekure_back",
  108. this.MekureBack
  109. },
  110. {
  111. "check_box_zurasi",
  112. this.Zurasi
  113. },
  114. {
  115. "check_box_hadake",
  116. this.Hadake
  117. }
  118. })
  119. {
  120. string key2 = keyValuePair.Key;
  121. WindowPartsMekureCheckBox value = keyValuePair.Value;
  122. if (!maidStoreData.ContainsKey(key2))
  123. {
  124. maidStoreData[key2] = false.ToString();
  125. }
  126. if (bool.Parse(maidStoreData[key2]))
  127. {
  128. value.SetMaid(maid);
  129. value.check = true;
  130. value.Apply();
  131. value.SetMaid(null);
  132. }
  133. }
  134. this.OnStoreDataUpdate();
  135. }
  136. public override void OnMaidRemoveEvent(Maid maid)
  137. {
  138. this.activeMaidList.Remove(maid);
  139. if (this.activeMaidList.Count <= 0)
  140. {
  141. this.noCharaActive.ChangeMode(true, true);
  142. }
  143. }
  144. public override void OnMaidChangeEvent(Maid maid)
  145. {
  146. base.OnMaidChangeEvent(maid);
  147. if (maid == null || maid.boMAN)
  148. {
  149. maid = null;
  150. }
  151. this.UndressingMgr.SetMaid(maid);
  152. this.MekureFront.SetMaid(maid);
  153. this.MekureBack.SetMaid(maid);
  154. this.Zurasi.SetMaid(maid);
  155. this.Hadake.SetMaid(maid);
  156. this.OnStoreDataUpdate();
  157. }
  158. public void OnStoreDataUpdate()
  159. {
  160. Maid select_maid = base.mgr.select_maid;
  161. if (select_maid == null || select_maid.boMAN)
  162. {
  163. return;
  164. }
  165. Dictionary<string, string> maidStoreData = base.GetMaidStoreData(select_maid);
  166. maidStoreData.Clear();
  167. HashSet<TBody.SlotID> targetSlotID = this.UndressingMgr.GetTargetSlotID();
  168. foreach (TBody.SlotID f_eSlot in targetSlotID)
  169. {
  170. bool mask = select_maid.body0.GetMask(f_eSlot);
  171. maidStoreData[f_eSlot.ToString()] = mask.ToString();
  172. }
  173. foreach (KeyValuePair<string, WindowPartsMekureCheckBox> keyValuePair in new Dictionary<string, WindowPartsMekureCheckBox>
  174. {
  175. {
  176. "check_box_mekure_front",
  177. this.MekureFront
  178. },
  179. {
  180. "check_box_mekure_back",
  181. this.MekureBack
  182. },
  183. {
  184. "check_box_zurasi",
  185. this.Zurasi
  186. },
  187. {
  188. "check_box_hadake",
  189. this.Hadake
  190. }
  191. })
  192. {
  193. string key = keyValuePair.Key;
  194. WindowPartsMekureCheckBox value = keyValuePair.Value;
  195. maidStoreData[key] = value.check.ToString();
  196. }
  197. }
  198. public override void OnDeserializeEvent()
  199. {
  200. }
  201. public UIGrid Grid;
  202. public PhotUndressingManager UndressingMgr;
  203. public WindowPartsMekureCheckBox MekureFront;
  204. public WindowPartsMekureCheckBox MekureBack;
  205. public WindowPartsMekureCheckBox Zurasi;
  206. public WindowPartsMekureCheckBox Hadake;
  207. private Dictionary<string, UIButton> unit_dic_ = new Dictionary<string, UIButton>();
  208. private PhotoNoCharaActive noCharaActive;
  209. private HashSet<Maid> activeMaidList = new HashSet<Maid>();
  210. private UIScrollView scroll_view_;
  211. }