PhotoManEditManager.cs 5.5 KB

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