CharacterMgr.cs 39 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using PlayerStatus;
  7. using Schedule;
  8. using UnityEngine;
  9. using wf;
  10. public class CharacterMgr : MonoBehaviour
  11. {
  12. public static Dictionary<string, CharacterMgr.NpcData> npcDatas { get; private set; }
  13. public static bool EditModeLookHaveItem
  14. {
  15. get
  16. {
  17. return CharacterMgr.m_bEditMode;
  18. }
  19. set
  20. {
  21. CharacterMgr.m_bEditMode = value;
  22. }
  23. }
  24. public GameObject CharacterAll
  25. {
  26. get
  27. {
  28. return this.m_goCharacter;
  29. }
  30. }
  31. public Status status
  32. {
  33. get
  34. {
  35. return this.m_PlayerStatus;
  36. }
  37. }
  38. public Maid GetMaid(int nMaidNo)
  39. {
  40. return (this.m_gcActiveMaid.Length > nMaidNo) ? this.m_gcActiveMaid[nMaidNo] : null;
  41. }
  42. public Maid GetMaid(string guid)
  43. {
  44. for (int i = 0; i < this.m_gcActiveMaid.Length; i++)
  45. {
  46. if (this.m_gcActiveMaid[i] != null && this.m_gcActiveMaid[i].status.guid == guid)
  47. {
  48. return this.m_gcActiveMaid[i];
  49. }
  50. }
  51. return null;
  52. }
  53. public int GetMaidCount()
  54. {
  55. return this.m_gcActiveMaid.Length;
  56. }
  57. public Maid GetMan(int nManNo)
  58. {
  59. return (this.m_gcActiveMan.Length > nManNo) ? this.m_gcActiveMan[nManNo] : null;
  60. }
  61. public int GetManCount()
  62. {
  63. return this.m_gcActiveMan.Length;
  64. }
  65. public List<Maid> GetStockMaidList()
  66. {
  67. return this.m_listStockMaid;
  68. }
  69. public Maid GetStockMaid(int nStockNo)
  70. {
  71. return this.m_listStockMaid[nStockNo];
  72. }
  73. public Maid GetStockMaid(string guid)
  74. {
  75. for (int i = 0; i < this.m_listStockMaid.Count; i++)
  76. {
  77. if (this.m_listStockMaid[i].status.guid == guid)
  78. {
  79. return this.m_listStockMaid[i];
  80. }
  81. }
  82. return null;
  83. }
  84. public Maid GetStockNpcMaid(int nStockNo)
  85. {
  86. return this.m_listStockNpcMaid[nStockNo];
  87. }
  88. public Maid GetStockNpcMaid(string guid)
  89. {
  90. for (int i = 0; i < this.m_listStockNpcMaid.Count; i++)
  91. {
  92. if (this.m_listStockNpcMaid[i].status.guid == guid)
  93. {
  94. return this.m_listStockNpcMaid[i];
  95. }
  96. }
  97. return null;
  98. }
  99. public Maid GetStockMan(int nStockNo)
  100. {
  101. return this.m_listStockMan[nStockNo];
  102. }
  103. public Maid GetStockMan(string guid)
  104. {
  105. for (int i = 0; i < this.m_listStockMan.Count; i++)
  106. {
  107. if (this.m_listStockMan[i].status.guid == guid)
  108. {
  109. return this.m_listStockMan[i];
  110. }
  111. }
  112. return null;
  113. }
  114. public Maid GetStockNpcMan(int nStockNo)
  115. {
  116. return this.m_listStockNpcMan[nStockNo];
  117. }
  118. public Maid GetStockNpcMan(string guid)
  119. {
  120. for (int i = 0; i < this.m_listStockNpcMan.Count; i++)
  121. {
  122. if (this.m_listStockNpcMan[i].status.guid == guid)
  123. {
  124. return this.m_listStockNpcMan[i];
  125. }
  126. }
  127. return null;
  128. }
  129. public int GetStockMaidCount()
  130. {
  131. return this.m_listStockMaid.Count;
  132. }
  133. public int GetStockManCount()
  134. {
  135. return this.m_listStockMan.Count;
  136. }
  137. public static void CreateNpcData()
  138. {
  139. if (CharacterMgr.npcDatas != null)
  140. {
  141. return;
  142. }
  143. CharacterMgr.npcDatas = new Dictionary<string, CharacterMgr.NpcData>();
  144. string text = "character_preset_basedata.nei";
  145. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text))
  146. {
  147. using (CsvParser csvParser = new CsvParser())
  148. {
  149. bool condition = csvParser.Open(afileBase);
  150. NDebug.Assert(condition, text + "\nopen failed.");
  151. for (int i = 1; i < csvParser.max_cell_y; i++)
  152. {
  153. CharacterMgr.NpcData npcData = new CharacterMgr.NpcData(csvParser, i);
  154. CharacterMgr.npcDatas.Add(npcData.uniqueName, npcData);
  155. }
  156. }
  157. }
  158. }
  159. private void Awake()
  160. {
  161. CharacterMgr.CreateNpcData();
  162. }
  163. private void Start()
  164. {
  165. }
  166. public void OnDestroy()
  167. {
  168. foreach (Maid obj in this.m_listStockNpcMan)
  169. {
  170. UnityEngine.Object.DestroyImmediate(obj);
  171. }
  172. this.m_listStockNpcMan.Clear();
  173. foreach (Maid obj2 in this.m_listStockMan)
  174. {
  175. UnityEngine.Object.DestroyImmediate(obj2);
  176. }
  177. this.m_listStockMan.Clear();
  178. foreach (Maid obj3 in this.m_listStockNpcMaid)
  179. {
  180. UnityEngine.Object.DestroyImmediate(obj3);
  181. }
  182. this.m_listStockNpcMaid.Clear();
  183. foreach (Maid obj4 in this.m_listStockMaid)
  184. {
  185. UnityEngine.Object.DestroyImmediate(obj4);
  186. }
  187. this.m_listStockMaid.Clear();
  188. }
  189. public void Init(GameMain f_gcGameMain)
  190. {
  191. BoneMorph.Init();
  192. this.m_PlayerStatus = new Status();
  193. this.m_goCharacter = new GameObject("Character");
  194. this.m_goCharacter.transform.parent = f_gcGameMain.transform;
  195. this.m_goActive = new GameObject("Active");
  196. this.m_goActive.transform.parent = this.m_goCharacter.transform;
  197. this.m_goAllOffset = new GameObject("AllOffset");
  198. this.m_goAllOffset.transform.parent = this.m_goActive.transform;
  199. this.m_goStock = new GameObject("Stock");
  200. this.m_goStock.transform.parent = this.m_goCharacter.transform;
  201. this.m_goStockMaid = new GameObject("Maid");
  202. this.m_goStockMaid.transform.SetParent(this.m_goStock.transform, false);
  203. this.m_goStockNpcMaid = new GameObject("NpcMaid");
  204. this.m_goStockNpcMaid.transform.SetParent(this.m_goStock.transform, false);
  205. this.m_goStockMan = new GameObject("Man");
  206. this.m_goStockMan.transform.SetParent(this.m_goStock.transform, false);
  207. this.m_goStockNpcMan = new GameObject("NpcMan");
  208. this.m_goStockNpcMan.transform.SetParent(this.m_goStock.transform, false);
  209. this.m_goChaches = new GameObject("_Caches");
  210. this.m_goChaches.transform.SetParent(this.m_goCharacter.transform, false);
  211. }
  212. public bool TryGetCacheObject(string f_key, out GameObject f_outObj)
  213. {
  214. return this.m_dicCaches.TryGetValue(f_key, out f_outObj);
  215. }
  216. public void AddCacheObject(string f_key, GameObject f_obj)
  217. {
  218. f_obj.transform.SetParent(this.m_goChaches.transform, false);
  219. this.m_dicCaches[f_key] = f_obj;
  220. }
  221. public Maid AddStockMaid()
  222. {
  223. return this.AddStock(false, false);
  224. }
  225. public Maid AddStockNpcMaid()
  226. {
  227. return this.AddStock(false, true);
  228. }
  229. public Maid AddStockNpcMan()
  230. {
  231. return this.AddStock(true, true);
  232. }
  233. public Maid AddStockMan()
  234. {
  235. return this.AddStock(true, false);
  236. }
  237. private Maid AddStock(bool f_bMan, bool f_bNpc)
  238. {
  239. GameObject gameObject = new GameObject();
  240. gameObject.name = ((!f_bMan) ? ((!f_bNpc) ? "StockMaid" : "StockNpcMaid") : ((!f_bNpc) ? "StockMan" : "StockNpcMan"));
  241. gameObject.transform.SetParent((!f_bMan) ? ((!f_bNpc) ? this.m_goStockMaid.transform : this.m_goStockNpcMaid.transform) : ((!f_bNpc) ? this.m_goStockMan.transform : this.m_goStockNpcMan.transform), false);
  242. Maid maid = gameObject.AddComponent<Maid>();
  243. maid.boNPC = f_bNpc;
  244. ((!f_bMan) ? ((!f_bNpc) ? this.m_listStockMaid : this.m_listStockNpcMaid) : ((!f_bNpc) ? this.m_listStockMan : this.m_listStockNpcMan)).Add(maid);
  245. maid.Initialize((!f_bMan) ? "Maid" : "Man", f_bMan);
  246. maid.Visible = false;
  247. return maid;
  248. }
  249. public void SetActiveMaid(Maid f_maid, int f_nActiveSlotNo)
  250. {
  251. this.SetActive(f_maid, f_nActiveSlotNo, false);
  252. }
  253. public void SetActiveMan(Maid f_maid, int f_nActiveSlotNo)
  254. {
  255. this.SetActive(f_maid, f_nActiveSlotNo, true);
  256. }
  257. private void SetActive(Maid f_maid, int f_nActiveSlotNo, bool f_bMan)
  258. {
  259. GameObject[] array = (!f_bMan) ? this.m_objActiveMaid : this.m_objActiveMan;
  260. Maid[] array2 = (!f_bMan) ? this.m_gcActiveMaid : this.m_gcActiveMan;
  261. if (array2[f_nActiveSlotNo] == f_maid)
  262. {
  263. return;
  264. }
  265. if (array[f_nActiveSlotNo] != null)
  266. {
  267. this.Deactivate(f_nActiveSlotNo, f_bMan);
  268. }
  269. f_maid.ActiveSlotNo = f_nActiveSlotNo;
  270. GameObject gameObject = f_maid.gameObject;
  271. gameObject.transform.SetParent(this.m_goAllOffset.transform, false);
  272. for (int i = 0; i < array.Length; i++)
  273. {
  274. if (array[i] == gameObject)
  275. {
  276. array[i] = null;
  277. array2[i] = null;
  278. }
  279. }
  280. gameObject.name = ((!f_bMan) ? "Maid[" : "Man[") + f_nActiveSlotNo.ToString() + "]";
  281. if (!f_bMan)
  282. {
  283. GameObject gameObject2 = gameObject;
  284. string name = gameObject2.name;
  285. gameObject2.name = string.Concat(new string[]
  286. {
  287. name,
  288. " ",
  289. f_maid.status.firstName,
  290. " ",
  291. f_maid.status.lastName
  292. });
  293. }
  294. array[f_nActiveSlotNo] = gameObject;
  295. array2[f_nActiveSlotNo] = f_maid;
  296. f_maid.DutPropAll();
  297. f_maid.AllProcPropSeqStart();
  298. }
  299. public Maid Activate(int f_nActiveSlot, int f_nStockSlot, bool f_bMan, bool f_bNpc)
  300. {
  301. List<Maid> list = (!f_bMan) ? ((!f_bNpc) ? this.m_listStockMaid : this.m_listStockNpcMaid) : ((!f_bNpc) ? this.m_listStockMan : this.m_listStockNpcMan);
  302. Maid maid = list[f_nStockSlot];
  303. if (f_bMan)
  304. {
  305. this.SetActiveMan(maid, f_nActiveSlot);
  306. }
  307. else
  308. {
  309. this.SetActiveMaid(maid, f_nActiveSlot);
  310. }
  311. return maid;
  312. }
  313. public Maid ActivateNpc(int f_nActiveSlot)
  314. {
  315. for (int i = 0; i < 3; i++)
  316. {
  317. Maid stockNpcMaid = this.GetStockNpcMaid(i);
  318. if (stockNpcMaid.ActiveSlotNo == -1)
  319. {
  320. return this.Activate(f_nActiveSlot, i, false, true);
  321. }
  322. }
  323. NDebug.Assert("Subメイドとして同時に扱える上限を超えています(" + 3.ToString() + "体までです", false);
  324. return null;
  325. }
  326. public void SwapActiveSlot(int slotNoA, int slotNoB, bool isMan)
  327. {
  328. GameObject[] array = (!isMan) ? this.m_objActiveMaid : this.m_objActiveMan;
  329. Maid[] array2 = (!isMan) ? this.m_gcActiveMaid : this.m_gcActiveMan;
  330. if (array2[slotNoA] == null || array2[slotNoB] == null)
  331. {
  332. Debug.LogError(string.Concat(new object[]
  333. {
  334. "ActiveSlot番号",
  335. slotNoA,
  336. "と",
  337. slotNoB,
  338. "を交換しようとしましたが、nullが入っています"
  339. }));
  340. return;
  341. }
  342. GameObject gameObject = array[slotNoA];
  343. array[slotNoA] = array[slotNoB];
  344. array[slotNoB] = gameObject;
  345. string name = array2[slotNoA].gameObject.name;
  346. array2[slotNoA].gameObject.name = array2[slotNoB].gameObject.name;
  347. array2[slotNoB].gameObject.name = name;
  348. Maid maid = array2[slotNoA];
  349. array2[slotNoA] = array2[slotNoB];
  350. array2[slotNoB] = maid;
  351. int activeSlotNo = array2[slotNoA].ActiveSlotNo;
  352. array2[slotNoA].ActiveSlotNo = array2[slotNoB].ActiveSlotNo;
  353. array2[slotNoB].ActiveSlotNo = activeSlotNo;
  354. }
  355. public void DeactivateCharaAll()
  356. {
  357. this.DeactivateMaidAll();
  358. this.DeactivateManAll();
  359. this.ResetCharaPosAll();
  360. }
  361. public void DeactivateMaid(int f_nActiveSlotNo)
  362. {
  363. this.Deactivate(f_nActiveSlotNo, false);
  364. }
  365. public void DeactivateMaid(Maid f_maidActive)
  366. {
  367. this.Deactivate(f_maidActive.ActiveSlotNo, false);
  368. }
  369. public void DeactivateMaidAll()
  370. {
  371. this.CharaVisible(0, false, false);
  372. Maid maid = this.GetMaid(0);
  373. for (int i = 1; i < this.m_gcActiveMaid.Length; i++)
  374. {
  375. this.Deactivate(i, false);
  376. }
  377. }
  378. public void DeactivateMan(int f_nActiveSlotNo)
  379. {
  380. this.Deactivate(f_nActiveSlotNo, true);
  381. }
  382. public void DeactivateMan(Maid f_manActive)
  383. {
  384. this.Deactivate(f_manActive.ActiveSlotNo, true);
  385. }
  386. public void DeactivateManAll()
  387. {
  388. for (int i = 0; i < this.GetManCount(); i++)
  389. {
  390. this.CharaVisible(i, false, true);
  391. }
  392. }
  393. public void Deactivate(int f_nActiveSlotNo, bool f_bMan)
  394. {
  395. if (f_nActiveSlotNo == -1)
  396. {
  397. return;
  398. }
  399. GameObject[] array = (!f_bMan) ? this.m_objActiveMaid : this.m_objActiveMan;
  400. Maid[] array2 = (!f_bMan) ? this.m_gcActiveMaid : this.m_gcActiveMan;
  401. GameObject gameObject = array[f_nActiveSlotNo];
  402. Maid maid = array2[f_nActiveSlotNo];
  403. if (gameObject == null || maid == null)
  404. {
  405. return;
  406. }
  407. Debug.Log("Deactivate " + maid.status.firstName);
  408. GameObject gameObject2 = (!f_bMan) ? ((!maid.boNPC) ? this.m_goStockMaid : this.m_goStockNpcMaid) : ((!maid.boNPC) ? this.m_goStockMan : this.m_goStockNpcMan);
  409. if (gameObject == null)
  410. {
  411. return;
  412. }
  413. if (!f_bMan && maid.body0 != null)
  414. {
  415. maid.body0.MuneYureL(1f);
  416. maid.body0.MuneYureR(1f);
  417. }
  418. maid.Visible = false;
  419. maid.ActiveSlotNo = -1;
  420. maid.Uninit();
  421. maid.LipSyncEnabled(true);
  422. gameObject.transform.SetParent(gameObject2.transform, false);
  423. gameObject.name = ((!f_bMan) ? ((!maid.boNPC) ? "StockMaid" : "StockNpcMaid") : ((!maid.boNPC) ? "StockMan" : "StockNpcMan"));
  424. if (!f_bMan)
  425. {
  426. GameObject gameObject3 = gameObject;
  427. string name = gameObject3.name;
  428. gameObject3.name = string.Concat(new string[]
  429. {
  430. name,
  431. " ",
  432. maid.status.firstName,
  433. " ",
  434. maid.status.lastName
  435. });
  436. }
  437. array[f_nActiveSlotNo] = null;
  438. array2[f_nActiveSlotNo] = null;
  439. }
  440. public void BanishmentMaid(int f_nStockNo)
  441. {
  442. this.Banishment(f_nStockNo, false);
  443. }
  444. public void BanishmentMaid(Maid f_maid)
  445. {
  446. this.BanishmentMaid(f_maid, false);
  447. }
  448. public void BanishmentMan(int f_nStockNo)
  449. {
  450. this.Banishment(f_nStockNo, true);
  451. }
  452. public void BanishmentMan(Maid f_maid)
  453. {
  454. this.BanishmentMaid(f_maid, true);
  455. }
  456. private void Banishment(int f_nStockNo, bool f_bMan)
  457. {
  458. List<Maid> list = (!f_bMan) ? this.m_listStockMaid : this.m_listStockMan;
  459. if (f_nStockNo < 0 || list.Count <= f_nStockNo)
  460. {
  461. NDebug.Assert("Banishment メイドストック数より大きいIndexが設定されました。" + f_nStockNo, false);
  462. }
  463. Maid maid = list[f_nStockNo];
  464. if (maid == null)
  465. {
  466. NDebug.Assert("Banishment メイドストックはあるのにメイドが居ません。" + f_nStockNo, false);
  467. }
  468. this.BanishmentMaid(maid, f_bMan);
  469. }
  470. public void BanishmentMaid(Maid f_maid, bool f_bMan)
  471. {
  472. List<Maid> list = (!f_bMan) ? this.m_listStockMaid : this.m_listStockMan;
  473. if (f_maid.ActiveSlotNo != -1)
  474. {
  475. this.Deactivate(f_maid.ActiveSlotNo, f_bMan);
  476. }
  477. list.Remove(f_maid);
  478. if (f_maid != null)
  479. {
  480. UnityEngine.Object.DestroyImmediate(f_maid.gameObject);
  481. }
  482. }
  483. public Maid CharaVisible(int f_nActiveSlot, bool f_bVisible, bool f_bMan)
  484. {
  485. Maid[] array = (!f_bMan) ? this.m_gcActiveMaid : this.m_gcActiveMan;
  486. Maid maid = array[f_nActiveSlot];
  487. if (maid == null)
  488. {
  489. return null;
  490. }
  491. maid.Visible = f_bVisible;
  492. return maid;
  493. }
  494. public void ManAlphaUpdate()
  495. {
  496. for (int i = 0; i < this.m_listStockMan.Count; i++)
  497. {
  498. this.m_listStockMan[i].ManColorUpdate();
  499. }
  500. }
  501. public void LoadDefault()
  502. {
  503. if (!this.IsBusy())
  504. {
  505. for (int i = 0; i < 3; i++)
  506. {
  507. Maid maid = this.AddStockNpcMaid();
  508. maid.Visible = false;
  509. }
  510. for (int j = 0; j < 6; j++)
  511. {
  512. Maid maid2 = this.AddStockMan();
  513. this.SetActiveMan(maid2, j);
  514. maid2.Visible = false;
  515. }
  516. }
  517. }
  518. public void VisibleAll(bool f_bVisible)
  519. {
  520. for (int i = 0; i < this.GetMaidCount(); i++)
  521. {
  522. Maid maid = this.GetMaid(i);
  523. if (maid != null)
  524. {
  525. maid.Visible = f_bVisible;
  526. }
  527. }
  528. for (int j = 0; j < this.GetManCount(); j++)
  529. {
  530. Maid man = this.GetMan(j);
  531. if (man != null)
  532. {
  533. man.Visible = f_bVisible;
  534. }
  535. }
  536. }
  537. public bool IsBusy()
  538. {
  539. bool flag = false;
  540. for (int i = 0; i < this.m_gcActiveMaid.Length; i++)
  541. {
  542. Maid maid = this.GetMaid(i);
  543. if (maid != null)
  544. {
  545. flag |= maid.IsBusy;
  546. }
  547. }
  548. for (int j = 0; j < this.m_gcActiveMan.Length; j++)
  549. {
  550. Maid man = this.GetMan(j);
  551. if (man != null)
  552. {
  553. flag |= man.IsBusy;
  554. }
  555. }
  556. return flag;
  557. }
  558. public void ResetCharaPosAll()
  559. {
  560. this.SetCharaAllPos(Vector3.zero);
  561. this.SetCharaAllRot(Vector3.zero);
  562. this.CharaAllOfsetPos(Vector3.zero);
  563. this.CharaAllOfsetRot(Vector3.zero);
  564. for (int i = 0; i < this.m_listStockMaid.Count; i++)
  565. {
  566. Maid maid = this.m_listStockMaid[i];
  567. maid.SetPos(Vector3.zero);
  568. maid.SetRot(Vector3.zero);
  569. maid.SetPosOffset(Vector3.zero);
  570. if (maid.body0 != null)
  571. {
  572. maid.body0.SetBoneHitHeightY(0f);
  573. }
  574. }
  575. for (int j = 0; j < this.m_listStockNpcMaid.Count; j++)
  576. {
  577. Maid maid2 = this.m_listStockNpcMaid[j];
  578. maid2.SetPos(Vector3.zero);
  579. maid2.SetRot(Vector3.zero);
  580. maid2.SetPosOffset(Vector3.zero);
  581. if (maid2.body0 != null)
  582. {
  583. maid2.body0.SetBoneHitHeightY(0f);
  584. }
  585. }
  586. for (int k = 0; k < this.m_listStockMan.Count; k++)
  587. {
  588. Maid maid3 = this.m_listStockMan[k];
  589. maid3.SetPos(Vector3.zero);
  590. maid3.SetRot(Vector3.zero);
  591. maid3.SetPosOffset(Vector3.zero);
  592. if (maid3.body0 != null)
  593. {
  594. maid3.body0.SetBoneHitHeightY(0f);
  595. }
  596. }
  597. for (int l = 0; l < this.m_listStockNpcMan.Count; l++)
  598. {
  599. Maid maid4 = this.m_listStockNpcMan[l];
  600. maid4.SetPos(Vector3.zero);
  601. maid4.SetRot(Vector3.zero);
  602. maid4.SetPosOffset(Vector3.zero);
  603. if (maid4.body0 != null)
  604. {
  605. maid4.body0.SetBoneHitHeightY(0f);
  606. }
  607. }
  608. }
  609. public void SetCharaAllPos(Vector3 f_vecLocalPos)
  610. {
  611. this.m_goActive.transform.localPosition = f_vecLocalPos;
  612. }
  613. public Vector3 GetCharaAllPos()
  614. {
  615. return this.m_goActive.transform.localPosition;
  616. }
  617. public void SetCharaAllRot(Vector3 f_vecLocalRot)
  618. {
  619. this.m_goActive.transform.localRotation = Quaternion.Euler(f_vecLocalRot);
  620. }
  621. public Vector3 GetCharaAllRot()
  622. {
  623. return this.m_goActive.transform.localRotation.eulerAngles;
  624. }
  625. public void CharaAllOfsetPos(Vector3 f_vecLocalPos)
  626. {
  627. this.m_goAllOffset.transform.localPosition = f_vecLocalPos;
  628. }
  629. public Vector3 GetCharaAllOfsetPos()
  630. {
  631. return this.m_goAllOffset.transform.localPosition;
  632. }
  633. public void CharaAllOfsetRot(Vector3 f_vecLocalRot)
  634. {
  635. this.m_goAllOffset.transform.localRotation = Quaternion.Euler(f_vecLocalRot);
  636. }
  637. public Vector3 GetCharaAllOfsetRot()
  638. {
  639. return this.m_goAllOffset.transform.localRotation.eulerAngles;
  640. }
  641. public void GetOffsetMaid(Maid f_maidMy, int f_nCSTSplitNum, out Vector3 f_vecOutCharOffset, out Vector3 f_vecOutAllOfs, CharacterMgr.CharaPer f_cIn)
  642. {
  643. f_cIn.vecOffsDouParGreater *= 100000f;
  644. f_cIn.vecOffsDouParLess *= 100000f;
  645. f_cIn.vecOffsShinChoGreater *= 100000f;
  646. f_cIn.vecOffsShinChoLess *= 100000f;
  647. f_cIn.vecOffsMuneLGreater *= 100000f;
  648. f_cIn.vecOffsMuneLLess *= 100000f;
  649. f_cIn.vecHaremDouPerGreater *= 100000f;
  650. f_cIn.vecHaremDouPerLess *= 100000f;
  651. f_cIn.vecHaremShinChoGreater *= 100000f;
  652. f_cIn.vecHaremShinChoLess *= 100000f;
  653. f_cIn.vecHaremMuneLGreater *= 100000f;
  654. f_cIn.vecHaremMuneLLess *= 100000f;
  655. NDebug.Assert(f_nCSTSplitNum != 0, "分割数は0以外でなければいけません。");
  656. MaidProp prop = f_maidMy.GetProp(MPN.DouPer);
  657. int num;
  658. if (prop.boTempDut)
  659. {
  660. num = prop.temp_value - 50;
  661. }
  662. else
  663. {
  664. num = prop.value - 50;
  665. }
  666. prop = f_maidMy.GetProp(MPN.sintyou);
  667. int num2;
  668. if (prop.boTempDut)
  669. {
  670. num2 = prop.temp_value - 50;
  671. }
  672. else
  673. {
  674. num2 = prop.value - 50;
  675. }
  676. Vector3 a;
  677. Vector3 a2;
  678. if (0 <= num)
  679. {
  680. a = (float)num * f_cIn.vecOffsDouParGreater / (float)f_nCSTSplitNum;
  681. a2 = (float)num * f_cIn.vecHaremDouPerGreater / (float)f_nCSTSplitNum;
  682. }
  683. else
  684. {
  685. int num3 = f_nCSTSplitNum * -1;
  686. a = (float)num * f_cIn.vecOffsDouParLess / (float)num3;
  687. a2 = (float)num * f_cIn.vecHaremDouPerLess / (float)num3;
  688. }
  689. Vector3 b;
  690. Vector3 b2;
  691. if (0 <= num2)
  692. {
  693. b = (float)num2 * f_cIn.vecOffsShinChoGreater / (float)f_nCSTSplitNum;
  694. b2 = (float)num2 * f_cIn.vecHaremShinChoGreater / (float)f_nCSTSplitNum;
  695. }
  696. else
  697. {
  698. int num4 = f_nCSTSplitNum * -1;
  699. b = (float)num2 * f_cIn.vecOffsShinChoLess / (float)num4;
  700. b2 = (float)num2 * f_cIn.vecHaremShinChoLess / (float)num4;
  701. }
  702. prop = f_maidMy.GetProp(MPN.MuneL);
  703. int num5;
  704. if (prop.boTempDut)
  705. {
  706. num5 = prop.temp_value - 50;
  707. }
  708. else
  709. {
  710. num5 = prop.value - 50;
  711. }
  712. Vector3 b3;
  713. Vector3 b4;
  714. if (0 <= num5)
  715. {
  716. b3 = (float)num5 * f_cIn.vecOffsMuneLGreater / (float)f_nCSTSplitNum;
  717. b4 = (float)num5 * f_cIn.vecHaremMuneLGreater / (float)f_nCSTSplitNum;
  718. }
  719. else
  720. {
  721. int num6 = f_nCSTSplitNum * -1;
  722. b3 = (float)num5 * f_cIn.vecOffsMuneLLess / (float)num6;
  723. b4 = (float)num5 * f_cIn.vecHaremMuneLLess / (float)num6;
  724. }
  725. f_vecOutCharOffset = a + b + b3;
  726. f_vecOutCharOffset /= 100000f;
  727. f_vecOutAllOfs = a2 + b2 + b4;
  728. f_vecOutAllOfs /= 100000f;
  729. }
  730. public void GetOffsetMan(Maid f_maidTarget, int f_nCSTSplitNum, bool f_bPenisDetailMode, out Vector3 f_vecOutPenis, out Vector3 f_vecOutCharOffset, CharacterMgr.CharaPer f_cIn, CharacterMgr.PenisPer f_cPenisPer)
  731. {
  732. f_cIn.vecOffsDouParGreater *= 100000f;
  733. f_cIn.vecOffsDouParLess *= 100000f;
  734. f_cIn.vecOffsShinChoGreater *= 100000f;
  735. f_cIn.vecOffsShinChoLess *= 100000f;
  736. f_cIn.vecOffsMuneLGreater *= 100000f;
  737. f_cIn.vecOffsMuneLLess *= 100000f;
  738. f_cIn.vecHaremDouPerGreater *= 100000f;
  739. f_cIn.vecHaremDouPerLess *= 100000f;
  740. f_cIn.vecHaremShinChoGreater *= 100000f;
  741. f_cIn.vecHaremShinChoLess *= 100000f;
  742. f_cIn.vecHaremMuneLGreater *= 100000f;
  743. f_cIn.vecHaremMuneLLess *= 100000f;
  744. f_cPenisPer.vecPenisCommonBase *= 100000f;
  745. f_cPenisPer.vecPenisAmend *= 100000f;
  746. f_cPenisPer.vecPenisDouPerGreater *= 100000f;
  747. f_cPenisPer.vecPenisDouPerLess *= 100000f;
  748. f_cPenisPer.vecPenisShinchoGreater *= 100000f;
  749. f_cPenisPer.vecPenisShinchoLess *= 100000f;
  750. MaidProp prop = f_maidTarget.GetProp(MPN.DouPer);
  751. int num;
  752. if (prop.boTempDut)
  753. {
  754. num = prop.temp_value - 50;
  755. }
  756. else
  757. {
  758. num = prop.value - 50;
  759. }
  760. prop = f_maidTarget.GetProp(MPN.sintyou);
  761. int num2;
  762. if (prop.boTempDut)
  763. {
  764. num2 = prop.temp_value - 50;
  765. }
  766. else
  767. {
  768. num2 = prop.value - 50;
  769. }
  770. Vector3 a;
  771. if (0 <= num)
  772. {
  773. a = (float)num * f_cIn.vecOffsDouParGreater / (float)f_nCSTSplitNum;
  774. }
  775. else
  776. {
  777. int num3 = f_nCSTSplitNum * -1;
  778. a = (float)num * f_cIn.vecOffsDouParLess / (float)num3;
  779. }
  780. Vector3 b;
  781. if (0 <= num2)
  782. {
  783. b = (float)num2 * f_cIn.vecOffsShinChoGreater / (float)f_nCSTSplitNum;
  784. }
  785. else
  786. {
  787. int num4 = f_nCSTSplitNum * -1;
  788. b = (float)num2 * f_cIn.vecOffsShinChoLess / (float)num4;
  789. }
  790. prop = f_maidTarget.GetProp(MPN.MuneL);
  791. int num5;
  792. if (prop.boTempDut)
  793. {
  794. num5 = prop.temp_value - 50;
  795. }
  796. else
  797. {
  798. num5 = prop.value - 50;
  799. }
  800. Vector3 b2;
  801. if (0 <= num5)
  802. {
  803. b2 = (float)num5 * f_cIn.vecOffsMuneLGreater / (float)f_nCSTSplitNum;
  804. }
  805. else
  806. {
  807. int num6 = f_nCSTSplitNum * -1;
  808. b2 = (float)num5 * f_cIn.vecOffsMuneLLess / (float)num6;
  809. }
  810. Vector3 vector = a + b + b2;
  811. Vector3 a2 = Vector3.zero;
  812. Vector3 b3 = Vector3.zero;
  813. if (f_bPenisDetailMode)
  814. {
  815. if (0 <= num)
  816. {
  817. a2 = (float)num * (f_cPenisPer.vecPenisDouPerGreater - f_cPenisPer.vecPenisCommonBase) / (float)f_nCSTSplitNum;
  818. }
  819. else
  820. {
  821. int num3 = f_nCSTSplitNum * -1;
  822. a2 = (float)num * (f_cPenisPer.vecPenisDouPerLess - f_cPenisPer.vecPenisCommonBase) / (float)num3;
  823. }
  824. if (0 <= num2)
  825. {
  826. b3 = (float)num2 * (f_cPenisPer.vecPenisShinchoGreater - f_cPenisPer.vecPenisCommonBase) / (float)f_nCSTSplitNum;
  827. }
  828. else
  829. {
  830. int num4 = f_nCSTSplitNum * -1;
  831. b3 = (float)num2 * (f_cPenisPer.vecPenisShinchoLess - f_cPenisPer.vecPenisCommonBase) / (float)num4;
  832. }
  833. }
  834. f_vecOutPenis = a2 + b3 + f_cPenisPer.vecPenisCommonBase + f_cPenisPer.vecPenisAmend;
  835. f_vecOutPenis /= 100000f;
  836. f_vecOutCharOffset = vector;
  837. f_vecOutCharOffset /= 100000f;
  838. }
  839. public Vector3 SetMaidOffsetPos(Maid f_maid, int f_nCSTSplitNum, CharacterMgr.CharaPer f_cIn)
  840. {
  841. Vector3 zero = Vector3.zero;
  842. Vector3 zero2 = Vector3.zero;
  843. this.GetOffsetMaid(f_maid, f_nCSTSplitNum, out zero, out zero2, f_cIn);
  844. f_maid.SetPos(zero);
  845. return zero2;
  846. }
  847. public void SetMaidOffsetOther(List<KeyValuePair<Maid, CharacterMgr.CharaPer>> f_listMaid, int f_nCSTSplitNum)
  848. {
  849. Vector3 vector = Vector3.zero;
  850. Vector3 vector2 = Vector3.zero;
  851. for (int i = 0; i < f_listMaid.Count; i++)
  852. {
  853. vector = this.SetMaidOffsetPos(f_listMaid[i].Key, f_nCSTSplitNum, f_listMaid[i].Value);
  854. if (vector2.y < vector.y)
  855. {
  856. vector2 = vector;
  857. }
  858. }
  859. this.m_goAllOffset.transform.localPosition = new Vector3(0f, vector2.y, 0f);
  860. }
  861. public void SetManOffsetPos(Maid f_manMy, Maid f_maidTarget, int f_nCSTSplitNum, bool f_bPenisDetailMode, CharacterMgr.CharaPer f_cIn, CharacterMgr.PenisPer f_cPenisPer)
  862. {
  863. Vector3 vecChinkoOffset;
  864. Vector3 pos;
  865. this.GetOffsetMan(f_maidTarget, f_nCSTSplitNum, f_bPenisDetailMode, out vecChinkoOffset, out pos, f_cIn, f_cPenisPer);
  866. f_manMy.body0.vecChinkoOffset = vecChinkoOffset;
  867. f_manMy.SetPos(pos);
  868. }
  869. public Texture2D ThumShot(Maid f_maid)
  870. {
  871. return GameMain.Instance.ThumCamera.GetComponent<ThumShot>().ShotThumPreset(f_maid);
  872. }
  873. public static string CreatePresetLowCapacityData(Maid maid, CharacterMgr.PresetType presset_type)
  874. {
  875. MemoryStream memoryStream = new MemoryStream();
  876. BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
  877. string result = string.Empty;
  878. binaryWriter.Write("CM3D2_PRESET_S");
  879. binaryWriter.Write(1140);
  880. binaryWriter.Write((char)presset_type);
  881. maid.SerializePropLowCapacity(binaryWriter);
  882. maid.SerializeMultiColor(binaryWriter);
  883. result = "^CM3D2P^" + Convert.ToBase64String(Utility.ZlibCompresss(memoryStream.ToArray()));
  884. binaryWriter.Close();
  885. memoryStream.Dispose();
  886. return result;
  887. }
  888. public CharacterMgr.Preset PresetSave(Maid f_maid, CharacterMgr.PresetType f_type)
  889. {
  890. CharacterMgr.Preset preset = new CharacterMgr.Preset();
  891. Texture2D texture2D = this.ThumShot(f_maid);
  892. MemoryStream memoryStream = new MemoryStream();
  893. BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
  894. binaryWriter.Write("CM3D2_PRESET");
  895. binaryWriter.Write(1140);
  896. binaryWriter.Write((int)f_type);
  897. if (texture2D != null)
  898. {
  899. byte[] array = texture2D.EncodeToPNG();
  900. binaryWriter.Write(array.Length);
  901. binaryWriter.Write(array);
  902. }
  903. else
  904. {
  905. binaryWriter.Write(0);
  906. }
  907. f_maid.SerializeProp(binaryWriter);
  908. f_maid.SerializeMultiColor(binaryWriter);
  909. f_maid.SerializeBody(binaryWriter);
  910. string text = string.Concat(new string[]
  911. {
  912. "pre_",
  913. f_maid.status.lastName,
  914. f_maid.status.firstName,
  915. "_",
  916. DateTime.Now.ToString("yyyyMMddHHmmss")
  917. });
  918. text = UTY.FileNameEscape(text);
  919. text += ".preset";
  920. string fullPath = Path.GetFullPath(".\\");
  921. string text2 = fullPath + "Preset";
  922. if (!Directory.Exists(text2))
  923. {
  924. Directory.CreateDirectory(text2);
  925. }
  926. File.WriteAllBytes(text2 + "\\" + text, memoryStream.ToArray());
  927. memoryStream.Dispose();
  928. preset.texThum = texture2D;
  929. preset.strFileName = text;
  930. preset.ePreType = f_type;
  931. return preset;
  932. }
  933. public void PresetSaveAsQRCode(Maid f_maid, CharacterMgr.PresetType f_type)
  934. {
  935. Texture2D texture2D = Utility.CreateQRCodeTexture(CharacterMgr.CreatePresetLowCapacityData(f_maid, f_type), 512, 512);
  936. Sprite sprite = Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), default(Vector2));
  937. sprite.name = "qr";
  938. byte[] bytes = texture2D.EncodeToPNG();
  939. string text = string.Concat(new string[]
  940. {
  941. "pre_",
  942. f_maid.status.lastName,
  943. f_maid.status.firstName,
  944. "_",
  945. DateTime.Now.ToString("yyyyMMddHHmmss")
  946. });
  947. text = UTY.FileNameEscape(text);
  948. text += ".png";
  949. string fullPath = Path.GetFullPath(".\\");
  950. string text2 = fullPath + "Preset";
  951. if (!Directory.Exists(text2))
  952. {
  953. Directory.CreateDirectory(text2);
  954. }
  955. File.WriteAllBytes(text2 + "\\" + text, bytes);
  956. }
  957. public static CharacterMgr.Preset LoadePresetLowCapacityData(string data_text)
  958. {
  959. if (string.IsNullOrEmpty(data_text) || data_text.IndexOf("^CM3D2P^") != 0)
  960. {
  961. return null;
  962. }
  963. data_text = data_text.Replace("^CM3D2P^", string.Empty);
  964. byte[] array = Convert.FromBase64String(data_text);
  965. array = Utility.ZlibUncompress(array);
  966. CharacterMgr.Preset preset = new CharacterMgr.Preset();
  967. preset.strFileName = string.Empty;
  968. using (MemoryStream memoryStream = new MemoryStream(array))
  969. {
  970. BinaryReader binaryReader = new BinaryReader(memoryStream);
  971. string a = binaryReader.ReadString();
  972. NDebug.Assert(a == "CM3D2_PRESET_S", "低用量プリセットファイルのヘッダーが不正です。");
  973. int num = binaryReader.ReadInt32();
  974. preset.ePreType = (CharacterMgr.PresetType)binaryReader.ReadChar();
  975. preset.listMprop = Maid.DeserializePropLowCapacity(binaryReader);
  976. preset.aryPartsColor = Maid.DeserializeMultiColorPre(binaryReader);
  977. binaryReader.Close();
  978. }
  979. return preset;
  980. }
  981. public CharacterMgr.Preset PresetLoad(string f_strFileName)
  982. {
  983. FileStream fileStream = new FileStream(f_strFileName, FileMode.Open);
  984. if (fileStream == null)
  985. {
  986. return null;
  987. }
  988. byte[] buffer = new byte[fileStream.Length];
  989. fileStream.Read(buffer, 0, (int)fileStream.Length);
  990. fileStream.Close();
  991. fileStream.Dispose();
  992. BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer));
  993. CharacterMgr.Preset result = this.PresetLoad(binaryReader, Path.GetFileName(f_strFileName));
  994. binaryReader.Close();
  995. return result;
  996. }
  997. public CharacterMgr.Preset PresetLoadFromResources(string f_strFileName)
  998. {
  999. TextAsset textAsset = Resources.Load("Preset/" + f_strFileName) as TextAsset;
  1000. NDebug.Assert(textAsset != null, "内部Resourcesからファイル[" + f_strFileName + "]を読み込めませんでした");
  1001. BinaryReader binaryReader = new BinaryReader(new MemoryStream(textAsset.bytes));
  1002. CharacterMgr.Preset result = this.PresetLoad(binaryReader, Path.GetFileName(f_strFileName));
  1003. binaryReader.Close();
  1004. Resources.UnloadAsset(textAsset);
  1005. return result;
  1006. }
  1007. public CharacterMgr.Preset PresetLoad(BinaryReader brRead, string f_strFileName)
  1008. {
  1009. CharacterMgr.Preset preset = new CharacterMgr.Preset();
  1010. preset.strFileName = f_strFileName;
  1011. string a = brRead.ReadString();
  1012. NDebug.Assert(a == "CM3D2_PRESET", "プリセットファイルのヘッダーが不正です。");
  1013. int num = brRead.ReadInt32();
  1014. preset.nVersion = num;
  1015. int ePreType = brRead.ReadInt32();
  1016. preset.ePreType = (CharacterMgr.PresetType)ePreType;
  1017. int num2 = brRead.ReadInt32();
  1018. if (num2 != 0)
  1019. {
  1020. byte[] data = brRead.ReadBytes(num2);
  1021. preset.texThum = new Texture2D(1, 1);
  1022. preset.texThum.LoadImage(data);
  1023. preset.texThum.wrapMode = TextureWrapMode.Clamp;
  1024. }
  1025. else
  1026. {
  1027. preset.texThum = null;
  1028. }
  1029. preset.listMprop = Maid.DeserializePropPre(brRead);
  1030. if (num >= 2)
  1031. {
  1032. preset.aryPartsColor = Maid.DeserializeMultiColorPre(brRead);
  1033. }
  1034. if (num >= 200)
  1035. {
  1036. Maid.DeserializeBodyPre(brRead);
  1037. }
  1038. return preset;
  1039. }
  1040. public void PresetDelete(CharacterMgr.Preset f_pre)
  1041. {
  1042. try
  1043. {
  1044. string fullPath = Path.GetFullPath(".\\");
  1045. string str = fullPath + "Preset";
  1046. string text = str + "\\" + f_pre.strFileName;
  1047. if (File.Exists(text))
  1048. {
  1049. File.Delete(text);
  1050. }
  1051. else
  1052. {
  1053. Debug.LogWarning("PresetDelete削除失敗 ファイルがありません。" + text);
  1054. }
  1055. }
  1056. catch (Exception ex)
  1057. {
  1058. Debug.LogWarning("PresetDelete削除失敗 " + ex.Message);
  1059. }
  1060. }
  1061. public List<CharacterMgr.Preset> PresetListLoad()
  1062. {
  1063. List<CharacterMgr.Preset> list = new List<CharacterMgr.Preset>();
  1064. string fullPath = Path.GetFullPath(".\\");
  1065. string path = fullPath + "Preset";
  1066. if (!Directory.Exists(path))
  1067. {
  1068. Directory.CreateDirectory(path);
  1069. }
  1070. foreach (string f_strFileName in Directory.GetFiles(path, "*.preset"))
  1071. {
  1072. CharacterMgr.Preset item = this.PresetLoad(f_strFileName);
  1073. list.Add(item);
  1074. }
  1075. return list;
  1076. }
  1077. private bool IsEnableMenu(string f_strFileName)
  1078. {
  1079. if (CharacterMgr.EditModeLookHaveItem)
  1080. {
  1081. return GameMain.Instance.CharacterMgr.status.IsHavePartsItem(f_strFileName) && GameUty.IsExistFile(f_strFileName, null);
  1082. }
  1083. return GameUty.IsExistFile(f_strFileName, null);
  1084. }
  1085. public void PresetSet(Maid f_maid, CharacterMgr.Preset f_prest)
  1086. {
  1087. MaidProp[] array;
  1088. if (f_prest.ePreType == CharacterMgr.PresetType.Body)
  1089. {
  1090. array = (from mp in f_prest.listMprop
  1091. where (1 <= mp.idx && mp.idx <= 52) || (87 <= mp.idx && mp.idx <= 90)
  1092. select mp).ToArray<MaidProp>();
  1093. }
  1094. else if (f_prest.ePreType == CharacterMgr.PresetType.Wear)
  1095. {
  1096. array = (from mp in f_prest.listMprop
  1097. where 53 <= mp.idx && mp.idx <= 82
  1098. select mp).ToArray<MaidProp>();
  1099. }
  1100. else
  1101. {
  1102. array = (from mp in f_prest.listMprop
  1103. where (1 <= mp.idx && mp.idx <= 82) || (87 <= mp.idx && mp.idx <= 90)
  1104. select mp).ToArray<MaidProp>();
  1105. }
  1106. NDebug.Assert(array != null, "プリセットを実行する配列が空です。");
  1107. foreach (MaidProp maidProp in array)
  1108. {
  1109. if (maidProp.type != 3)
  1110. {
  1111. f_maid.SetProp((MPN)maidProp.idx, maidProp.value, false);
  1112. }
  1113. else
  1114. {
  1115. if (string.IsNullOrEmpty(maidProp.strFileName))
  1116. {
  1117. string strFileName = maidProp.strFileName;
  1118. if (CM3.dicDelItem.TryGetValue((MPN)maidProp.idx, out strFileName))
  1119. {
  1120. maidProp.strFileName = strFileName;
  1121. }
  1122. }
  1123. if (this.IsEnableMenu(maidProp.strFileName))
  1124. {
  1125. f_maid.SetProp(maidProp);
  1126. }
  1127. else
  1128. {
  1129. f_maid.DelProp((MPN)maidProp.idx, false);
  1130. }
  1131. if (maidProp.listSubProp != null && maidProp.listSubProp.Count != 0)
  1132. {
  1133. f_maid.DelProp((MPN)maidProp.idx, false);
  1134. for (int j = 0; j < maidProp.listSubProp.Count; j++)
  1135. {
  1136. SubProp subProp = maidProp.listSubProp[j];
  1137. if (subProp != null)
  1138. {
  1139. if (this.IsEnableMenu(subProp.strFileName))
  1140. {
  1141. f_maid.SetSubProp((MPN)maidProp.idx, j, subProp.strFileName, subProp.nFileNameRID);
  1142. f_maid.GetSubProp((MPN)maidProp.idx, j).fTexMulAlpha = subProp.fTexMulAlpha;
  1143. }
  1144. else
  1145. {
  1146. f_maid.DelSubProp((MPN)maidProp.idx, j);
  1147. }
  1148. }
  1149. }
  1150. }
  1151. }
  1152. }
  1153. if ((f_prest.ePreType == CharacterMgr.PresetType.Body || f_prest.ePreType == CharacterMgr.PresetType.All) && f_prest.aryPartsColor != null)
  1154. {
  1155. for (int k = 0; k < f_prest.aryPartsColor.Length; k++)
  1156. {
  1157. f_maid.Parts.SetPartsColor((MaidParts.PARTS_COLOR)k, f_prest.aryPartsColor[k]);
  1158. }
  1159. }
  1160. f_maid.AllProcPropSeqStart();
  1161. }
  1162. public bool Serialize(BinaryWriter bwWrite)
  1163. {
  1164. bwWrite.Write("CM3D2_CHR_MGR");
  1165. bwWrite.Write(1140);
  1166. this.m_PlayerStatus.Serialize(bwWrite);
  1167. bwWrite.Write(this.m_listStockMan.Count);
  1168. for (int i = 0; i < this.m_listStockMan.Count; i++)
  1169. {
  1170. Maid maid = this.m_listStockMan[i];
  1171. maid.SerializeProp(bwWrite);
  1172. maid.SerializeMisc(bwWrite);
  1173. }
  1174. bwWrite.Write(this.m_listStockMaid.Count);
  1175. for (int j = 0; j < this.m_listStockMaid.Count; j++)
  1176. {
  1177. Maid maid2 = this.m_listStockMaid[j];
  1178. maid2.SerializeProp(bwWrite);
  1179. maid2.SerializeMultiColor(bwWrite);
  1180. maid2.status.Serialize(bwWrite);
  1181. maid2.SerializeMisc(bwWrite);
  1182. maid2.SerializeBody(bwWrite);
  1183. }
  1184. return true;
  1185. }
  1186. public bool Deserialize(BinaryReader brRead)
  1187. {
  1188. for (int i = 0; i < this.GetMaidCount(); i++)
  1189. {
  1190. Maid maid = this.GetMaid(i);
  1191. if (maid != null)
  1192. {
  1193. this.DeactivateMaid(maid);
  1194. }
  1195. }
  1196. while (this.GetStockMaidCount() != 0)
  1197. {
  1198. this.BanishmentMaid(0);
  1199. }
  1200. int manCount = this.GetManCount();
  1201. for (int j = 0; j < manCount; j++)
  1202. {
  1203. Maid man = this.GetMan(j);
  1204. if (man != null)
  1205. {
  1206. this.DeactivateMan(man);
  1207. }
  1208. }
  1209. string a = brRead.ReadString();
  1210. NDebug.Assert(a == "CM3D2_CHR_MGR", "セーブデータファイルのヘッダーが不正です。CHR_MGR");
  1211. int num = brRead.ReadInt32();
  1212. this.m_PlayerStatus.Deserialize(brRead);
  1213. int num2 = brRead.ReadInt32();
  1214. int num3 = 0;
  1215. for (int k = 0; k < num2; k++)
  1216. {
  1217. Maid maid2 = this.m_listStockMan[k];
  1218. maid2.DeserializeProp(brRead);
  1219. maid2.DeserializeMisc(brRead);
  1220. if (maid2.ActiveSlotNo != -1)
  1221. {
  1222. this.SetActiveMan(maid2, maid2.ActiveSlotNo);
  1223. num3 = System.Math.Max(num3, maid2.ActiveSlotNo);
  1224. }
  1225. }
  1226. int num4 = this.GetManCount() - 2;
  1227. for (int l = num3 + 1; l < num4; l++)
  1228. {
  1229. this.SetActiveMan(this.GetStockMan(l), l);
  1230. }
  1231. int num5 = brRead.ReadInt32();
  1232. for (int m = 0; m < num5; m++)
  1233. {
  1234. Maid maid3 = this.AddStockMaid();
  1235. maid3.DeserializeProp(brRead);
  1236. maid3.DeserializeMultiColor(brRead);
  1237. maid3.status.Deserialize(brRead);
  1238. maid3.DeserializeMisc(brRead);
  1239. if (num >= 200)
  1240. {
  1241. maid3.DeserializeBody(brRead);
  1242. }
  1243. if (maid3.ActiveSlotNo != -1)
  1244. {
  1245. this.SetActiveMaid(maid3, maid3.ActiveSlotNo);
  1246. }
  1247. }
  1248. Maid.DeletedTmpThumCards();
  1249. GameMain.Instance.MsgWnd.ClearBackLogData();
  1250. if (this.status.isDaytime)
  1251. {
  1252. ScheduleAPI.OccurNightWork();
  1253. }
  1254. return true;
  1255. }
  1256. public const int MaidStockMax = 200;
  1257. public const int ActiveMaidSlotCount = 18;
  1258. public const int NpcMaidCreateCount = 3;
  1259. public const int ActiveManSloatCount = 6;
  1260. private static bool m_bEditMode;
  1261. private GameObject m_goCharacter;
  1262. private GameObject m_goActive;
  1263. private GameObject m_goAllOffset;
  1264. private GameObject m_goStock;
  1265. private GameObject m_goStockMaid;
  1266. private GameObject m_goStockNpcMaid;
  1267. private GameObject m_goStockMan;
  1268. private GameObject m_goStockNpcMan;
  1269. private Dictionary<string, GameObject> m_dicCaches = new Dictionary<string, GameObject>();
  1270. private GameObject m_goChaches;
  1271. private Status m_PlayerStatus;
  1272. private List<Maid> m_listStockMaid = new List<Maid>();
  1273. private List<Maid> m_listStockNpcMaid = new List<Maid>();
  1274. private List<Maid> m_listStockMan = new List<Maid>();
  1275. private List<Maid> m_listStockNpcMan = new List<Maid>();
  1276. private Maid[] m_gcActiveMaid = new Maid[18];
  1277. private GameObject[] m_objActiveMaid = new GameObject[18];
  1278. private Maid[] m_gcActiveMan = new Maid[6];
  1279. private GameObject[] m_objActiveMan = new GameObject[6];
  1280. public class NpcData
  1281. {
  1282. public NpcData(CsvParser csv, int lineY)
  1283. {
  1284. int num = 0;
  1285. this.uniqueName = csv.GetCellAsString(num++, lineY);
  1286. this.lastName = csv.GetCellAsString(num++, lineY);
  1287. this.firstName = csv.GetCellAsString(num++, lineY);
  1288. this.presetFileName = Path.GetFileNameWithoutExtension(csv.GetCellAsString(num++, lineY));
  1289. if (!string.IsNullOrEmpty(this.presetFileName))
  1290. {
  1291. this.isResourcesLoad = !GameUty.FileSystem.IsExistentFile(this.presetFileName + ".preset");
  1292. }
  1293. this.menuFileName = Path.GetFileNameWithoutExtension(csv.GetCellAsString(num++, lineY));
  1294. if (!string.IsNullOrEmpty(this.menuFileName))
  1295. {
  1296. this.menuFileName += ".menu";
  1297. }
  1298. NDebug.Assert(string.IsNullOrEmpty(this.presetFileName) || string.IsNullOrEmpty(this.menuFileName), "プリセットとメニューファイル両方が指定されています");
  1299. }
  1300. public void Apply(Maid maid, bool onlyPartsLoad = false)
  1301. {
  1302. if (maid == null || GameMain.Instance.CharacterMgr == null)
  1303. {
  1304. return;
  1305. }
  1306. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  1307. maid.ResetAll();
  1308. if (!maid.boMAN)
  1309. {
  1310. NDebug.Assert(string.IsNullOrEmpty(this.menuFileName), "メイドに対して男用のNPCデータを適用しようとしています");
  1311. if (!onlyPartsLoad)
  1312. {
  1313. maid.status.firstName = this.firstName;
  1314. maid.status.lastName = this.lastName;
  1315. }
  1316. if (this.isResourcesLoad)
  1317. {
  1318. characterMgr.PresetSet(maid, characterMgr.PresetLoadFromResources(this.presetFileName));
  1319. }
  1320. else
  1321. {
  1322. using (AFileBase afileBase = GameUty.FileOpen(this.presetFileName + ".preset", null))
  1323. {
  1324. if (afileBase != null && afileBase.IsValid())
  1325. {
  1326. byte[] buffer = afileBase.ReadAll();
  1327. using (BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer), Encoding.UTF8))
  1328. {
  1329. characterMgr.PresetSet(maid, characterMgr.PresetLoad(binaryReader, this.presetFileName));
  1330. }
  1331. }
  1332. }
  1333. }
  1334. }
  1335. else
  1336. {
  1337. NDebug.Assert(string.IsNullOrEmpty(this.presetFileName), "男に対してメイド用のNPCデータを適用しようとしています");
  1338. maid.SetUpModel(this.menuFileName);
  1339. }
  1340. }
  1341. public readonly string uniqueName;
  1342. public readonly string firstName;
  1343. public readonly string lastName;
  1344. public readonly string presetFileName;
  1345. public readonly string menuFileName;
  1346. private bool isResourcesLoad;
  1347. }
  1348. public class CharaPer
  1349. {
  1350. public Vector3 vecOffsDouParGreater;
  1351. public Vector3 vecOffsDouParLess;
  1352. public Vector3 vecOffsShinChoGreater;
  1353. public Vector3 vecOffsShinChoLess;
  1354. public Vector3 vecOffsMuneLGreater;
  1355. public Vector3 vecOffsMuneLLess;
  1356. public Vector3 vecHaremDouPerGreater;
  1357. public Vector3 vecHaremDouPerLess;
  1358. public Vector3 vecHaremShinChoGreater;
  1359. public Vector3 vecHaremShinChoLess;
  1360. public Vector3 vecHaremMuneLGreater;
  1361. public Vector3 vecHaremMuneLLess;
  1362. }
  1363. public class PenisPer
  1364. {
  1365. public Vector3 vecPenisCommonBase;
  1366. public Vector3 vecPenisAmend;
  1367. public Vector3 vecPenisDouPerGreater;
  1368. public Vector3 vecPenisDouPerLess;
  1369. public Vector3 vecPenisShinchoGreater;
  1370. public Vector3 vecPenisShinchoLess;
  1371. }
  1372. public enum PresetType
  1373. {
  1374. Wear,
  1375. Body,
  1376. All
  1377. }
  1378. public class Preset
  1379. {
  1380. public int nVersion;
  1381. public Texture2D texThum;
  1382. public string strFileName;
  1383. public CharacterMgr.PresetType ePreType;
  1384. public List<MaidProp> listMprop = new List<MaidProp>();
  1385. public MaidParts.PartsColor[] aryPartsColor;
  1386. }
  1387. }