PhotoManEditManager.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using wf;
  5. public class PhotoManEditManager
  6. {
  7. public PhotoManEditManager()
  8. {
  9. this.man_head_menu_list_ = new List<SceneEdit.SMenuItem>();
  10. this.man_body_menu_list_ = new List<SceneEdit.SMenuItem>();
  11. if (PhotoManEditManager.menu_file_name_list_ == null)
  12. {
  13. PhotoManEditManager.menu_file_name_list_ = new HashSet<string>();
  14. foreach (string text in GameUty.MenuFiles)
  15. {
  16. string text2 = text.ToLower();
  17. if (text2.Contains("mhead") || text2.Contains("mbody"))
  18. {
  19. SceneEdit.SMenuItem smenuItem = new SceneEdit.SMenuItem();
  20. if (SceneEdit.GetMenuItemSetUP(smenuItem, text, true))
  21. {
  22. if (!(smenuItem.m_texIcon == null) && smenuItem.m_bMan)
  23. {
  24. if (!PhotoManEditManager.menu_file_name_list_.Contains(text))
  25. {
  26. PhotoManEditManager.menu_file_name_list_.Add(text);
  27. if (smenuItem.m_mpn == MPN.head)
  28. {
  29. this.man_head_menu_list_.Add(smenuItem);
  30. }
  31. else
  32. {
  33. this.man_body_menu_list_.Add(smenuItem);
  34. }
  35. }
  36. }
  37. }
  38. }
  39. }
  40. }
  41. else
  42. {
  43. foreach (string f_strMenuFileName in PhotoManEditManager.menu_file_name_list_)
  44. {
  45. SceneEdit.SMenuItem smenuItem2 = new SceneEdit.SMenuItem();
  46. if (SceneEdit.GetMenuItemSetUP(smenuItem2, f_strMenuFileName, true))
  47. {
  48. if (smenuItem2.m_mpn == MPN.head)
  49. {
  50. this.man_head_menu_list_.Add(smenuItem2);
  51. }
  52. else
  53. {
  54. this.man_body_menu_list_.Add(smenuItem2);
  55. }
  56. }
  57. }
  58. }
  59. }
  60. public void Destroy()
  61. {
  62. List<SceneEdit.SMenuItem>[] array = new List<SceneEdit.SMenuItem>[]
  63. {
  64. this.man_head_menu_list_,
  65. this.man_body_menu_list_
  66. };
  67. foreach (List<SceneEdit.SMenuItem> list in array)
  68. {
  69. foreach (SceneEdit.SMenuItem smenuItem in list)
  70. {
  71. if (smenuItem.m_texIcon != null)
  72. {
  73. UnityEngine.Object.Destroy(smenuItem.m_texIcon);
  74. }
  75. if (smenuItem.m_texIconRandomColor != null)
  76. {
  77. UnityEngine.Object.Destroy(smenuItem.m_texIconRandomColor);
  78. }
  79. }
  80. list.Clear();
  81. }
  82. }
  83. public List<SceneEdit.SMenuItem> man_head_menu_list
  84. {
  85. get
  86. {
  87. return this.man_head_menu_list_;
  88. }
  89. }
  90. public List<SceneEdit.SMenuItem> man_body_menu_list
  91. {
  92. get
  93. {
  94. return this.man_body_menu_list_;
  95. }
  96. }
  97. private List<SceneEdit.SMenuItem> man_head_menu_list_;
  98. private List<SceneEdit.SMenuItem> man_body_menu_list_;
  99. private static HashSet<string> menu_file_name_list_;
  100. public class Controller
  101. {
  102. public Controller()
  103. {
  104. }
  105. public Controller(Maid man)
  106. {
  107. this.man = man;
  108. if (man != null)
  109. {
  110. NDebug.Assert(man.boMAN, "メイドが設定されました");
  111. }
  112. }
  113. public bool SetMenu(SceneEdit.SMenuItem set_menu)
  114. {
  115. if (this.man == null || this.IsSelected(set_menu))
  116. {
  117. return false;
  118. }
  119. bool chinkoVisible = this.man.body0.GetChinkoVisible();
  120. bool result = false;
  121. if (this.man.GetProp(set_menu.m_mpn).nFileNameRID != set_menu.m_nMenuFileRID)
  122. {
  123. this.man.SetProp(set_menu.m_mpn, set_menu.m_strMenuFileName, set_menu.m_nMenuFileRID, false, false);
  124. this.man.AllProcProp();
  125. result = true;
  126. }
  127. if (set_menu.m_mpn == MPN.body)
  128. {
  129. this.man.body0.SetChinkoVisible(chinkoVisible);
  130. }
  131. return result;
  132. }
  133. public bool IsSelected(SceneEdit.SMenuItem check_menu)
  134. {
  135. if (this.man == null || check_menu == null)
  136. {
  137. return false;
  138. }
  139. MaidProp prop = this.man.GetProp(check_menu.m_mpn);
  140. return prop != null && prop.nFileNameRID == check_menu.m_nMenuFileRID;
  141. }
  142. public Maid man { get; set; }
  143. public float fat
  144. {
  145. get
  146. {
  147. if (this.man == null)
  148. {
  149. return 0f;
  150. }
  151. MaidProp prop = this.man.GetProp(MPN.Hara);
  152. return (float)(prop.value - prop.min) / (float)(prop.max - prop.min);
  153. }
  154. set
  155. {
  156. if (this.man == null)
  157. {
  158. return;
  159. }
  160. MaidProp prop = this.man.GetProp(MPN.Hara);
  161. if (this.fat == value)
  162. {
  163. return;
  164. }
  165. this.man.SetProp(MPN.Hara, (int)((float)prop.min + (float)(prop.max - prop.min) * value + 0.5f), false);
  166. this.man.AllProcProp();
  167. }
  168. }
  169. public Color color
  170. {
  171. get
  172. {
  173. return (!(this.man == null)) ? this.man.ManColor : Color.black;
  174. }
  175. set
  176. {
  177. if (this.man == null)
  178. {
  179. return;
  180. }
  181. this.man.ManColor = value;
  182. this.man.ManColorUpdate();
  183. }
  184. }
  185. public int alpha
  186. {
  187. get
  188. {
  189. return GameMain.Instance.CMSystem.ManAlpha;
  190. }
  191. set
  192. {
  193. GameMain.Instance.CMSystem.ManAlpha = wf.Math.RoundMinMax(value, 0, 100);
  194. GameMain.Instance.CharacterMgr.ManAlphaUpdate();
  195. }
  196. }
  197. public bool parts_visible
  198. {
  199. get
  200. {
  201. if (this.man == null || this.man.body0 == null)
  202. {
  203. return false;
  204. }
  205. List<TBodySkin> goSlot = this.man.body0.goSlot;
  206. foreach (TBodySkin tbodySkin in goSlot)
  207. {
  208. if (!(tbodySkin.obj == null))
  209. {
  210. Transform transform = CMT.SearchObjName(tbodySkin.obj.transform, "chinkoCenter", false);
  211. if (!(transform == null))
  212. {
  213. return transform.localScale == Vector3.one;
  214. }
  215. }
  216. }
  217. return false;
  218. }
  219. set
  220. {
  221. if (this.man == null || this.man.body0 == null)
  222. {
  223. return;
  224. }
  225. this.man.body0.SetChinkoVisible(value);
  226. }
  227. }
  228. public int head_menu_rid
  229. {
  230. get
  231. {
  232. return (!(this.man == null)) ? this.man.GetProp(MPN.head).nFileNameRID : -1;
  233. }
  234. }
  235. public int body_menu_rid
  236. {
  237. get
  238. {
  239. return (!(this.man == null)) ? this.man.GetProp(MPN.body).nFileNameRID : -1;
  240. }
  241. }
  242. }
  243. }