CharacterMgr.cs 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556
  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. GameObject gameObject = array[slotNoA];
  331. array[slotNoA] = array[slotNoB];
  332. array[slotNoB] = gameObject;
  333. string text = (!(array2[slotNoA] != null)) ? null : array2[slotNoA].gameObject.name;
  334. if (array2[slotNoA] && array2[slotNoB] != null)
  335. {
  336. array2[slotNoA].gameObject.name = array2[slotNoB].gameObject.name;
  337. }
  338. if (array2[slotNoB] != null && text != null)
  339. {
  340. array2[slotNoB].gameObject.name = text;
  341. }
  342. Maid maid = array2[slotNoA];
  343. array2[slotNoA] = array2[slotNoB];
  344. array2[slotNoB] = maid;
  345. int activeSlotNo = (!(array2[slotNoA] != null)) ? -1 : array2[slotNoA].ActiveSlotNo;
  346. if (array2[slotNoA])
  347. {
  348. array2[slotNoA].ActiveSlotNo = ((!(array2[slotNoB] != null)) ? -1 : array2[slotNoB].ActiveSlotNo);
  349. }
  350. if (array2[slotNoB])
  351. {
  352. array2[slotNoB].ActiveSlotNo = activeSlotNo;
  353. }
  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.baseOffset = (maid.baseEulerAngles = Vector3.zero);
  570. maid.rotateLinkMaid = string.Empty;
  571. maid.SetPosOffset(Vector3.zero);
  572. if (maid.body0 != null)
  573. {
  574. maid.body0.SetBoneHitHeightY(0f);
  575. }
  576. }
  577. for (int j = 0; j < this.m_listStockNpcMaid.Count; j++)
  578. {
  579. Maid maid2 = this.m_listStockNpcMaid[j];
  580. maid2.SetPos(Vector3.zero);
  581. maid2.SetRot(Vector3.zero);
  582. maid2.baseOffset = (maid2.baseEulerAngles = Vector3.zero);
  583. maid2.rotateLinkMaid = string.Empty;
  584. maid2.SetPosOffset(Vector3.zero);
  585. if (maid2.body0 != null)
  586. {
  587. maid2.body0.SetBoneHitHeightY(0f);
  588. }
  589. }
  590. for (int k = 0; k < this.m_listStockMan.Count; k++)
  591. {
  592. Maid maid3 = this.m_listStockMan[k];
  593. maid3.SetPos(Vector3.zero);
  594. maid3.SetRot(Vector3.zero);
  595. maid3.baseOffset = (maid3.baseEulerAngles = Vector3.zero);
  596. maid3.rotateLinkMaid = string.Empty;
  597. maid3.SetPosOffset(Vector3.zero);
  598. if (maid3.body0 != null)
  599. {
  600. maid3.body0.SetBoneHitHeightY(0f);
  601. }
  602. }
  603. for (int l = 0; l < this.m_listStockNpcMan.Count; l++)
  604. {
  605. Maid maid4 = this.m_listStockNpcMan[l];
  606. maid4.SetPos(Vector3.zero);
  607. maid4.SetRot(Vector3.zero);
  608. maid4.baseOffset = (maid4.baseEulerAngles = Vector3.zero);
  609. maid4.rotateLinkMaid = string.Empty;
  610. maid4.SetPosOffset(Vector3.zero);
  611. if (maid4.body0 != null)
  612. {
  613. maid4.body0.SetBoneHitHeightY(0f);
  614. }
  615. }
  616. }
  617. public void SetCharaAllPos(Vector3 f_vecLocalPos)
  618. {
  619. this.m_goActive.transform.localPosition = f_vecLocalPos;
  620. }
  621. public Vector3 GetCharaAllPos()
  622. {
  623. return this.m_goActive.transform.localPosition;
  624. }
  625. public void SetCharaAllRot(Vector3 f_vecLocalRot)
  626. {
  627. this.m_goActive.transform.localRotation = Quaternion.Euler(f_vecLocalRot);
  628. }
  629. public Vector3 GetCharaAllRot()
  630. {
  631. return this.m_goActive.transform.localRotation.eulerAngles;
  632. }
  633. public void CharaAllOfsetPos(Vector3 f_vecLocalPos)
  634. {
  635. this.m_goAllOffset.transform.localPosition = f_vecLocalPos;
  636. }
  637. public Vector3 GetCharaAllOfsetPos()
  638. {
  639. return this.m_goAllOffset.transform.localPosition;
  640. }
  641. public void CharaAllOfsetRot(Vector3 f_vecLocalRot)
  642. {
  643. this.m_goAllOffset.transform.localRotation = Quaternion.Euler(f_vecLocalRot);
  644. }
  645. public Vector3 GetCharaAllOfsetRot()
  646. {
  647. return this.m_goAllOffset.transform.localRotation.eulerAngles;
  648. }
  649. public void GetOffsetMaid(Maid f_maidMy, int f_nCSTSplitNum, out Vector3 f_vecOutCharOffset, out Vector3 f_vecOutAllOfs, CharacterMgr.CharaPer f_cIn)
  650. {
  651. f_cIn.vecOffsDouParGreater *= 100000f;
  652. f_cIn.vecOffsDouParLess *= 100000f;
  653. f_cIn.vecOffsShinChoGreater *= 100000f;
  654. f_cIn.vecOffsShinChoLess *= 100000f;
  655. f_cIn.vecOffsMuneLGreater *= 100000f;
  656. f_cIn.vecOffsMuneLLess *= 100000f;
  657. f_cIn.vecHaremDouPerGreater *= 100000f;
  658. f_cIn.vecHaremDouPerLess *= 100000f;
  659. f_cIn.vecHaremShinChoGreater *= 100000f;
  660. f_cIn.vecHaremShinChoLess *= 100000f;
  661. f_cIn.vecHaremMuneLGreater *= 100000f;
  662. f_cIn.vecHaremMuneLLess *= 100000f;
  663. NDebug.Assert(f_nCSTSplitNum != 0, "分割数は0以外でなければいけません。");
  664. MaidProp prop = f_maidMy.GetProp(MPN.DouPer);
  665. int num;
  666. if (prop.boTempDut)
  667. {
  668. num = prop.temp_value - 50;
  669. }
  670. else
  671. {
  672. num = prop.value - 50;
  673. }
  674. prop = f_maidMy.GetProp(MPN.sintyou);
  675. int num2;
  676. if (prop.boTempDut)
  677. {
  678. num2 = prop.temp_value - 50;
  679. }
  680. else
  681. {
  682. num2 = prop.value - 50;
  683. }
  684. Vector3 a;
  685. Vector3 a2;
  686. if (0 <= num)
  687. {
  688. a = (float)num * f_cIn.vecOffsDouParGreater / (float)f_nCSTSplitNum;
  689. a2 = (float)num * f_cIn.vecHaremDouPerGreater / (float)f_nCSTSplitNum;
  690. }
  691. else
  692. {
  693. int num3 = f_nCSTSplitNum * -1;
  694. a = (float)num * f_cIn.vecOffsDouParLess / (float)num3;
  695. a2 = (float)num * f_cIn.vecHaremDouPerLess / (float)num3;
  696. }
  697. Vector3 b;
  698. Vector3 b2;
  699. if (0 <= num2)
  700. {
  701. b = (float)num2 * f_cIn.vecOffsShinChoGreater / (float)f_nCSTSplitNum;
  702. b2 = (float)num2 * f_cIn.vecHaremShinChoGreater / (float)f_nCSTSplitNum;
  703. }
  704. else
  705. {
  706. int num4 = f_nCSTSplitNum * -1;
  707. b = (float)num2 * f_cIn.vecOffsShinChoLess / (float)num4;
  708. b2 = (float)num2 * f_cIn.vecHaremShinChoLess / (float)num4;
  709. }
  710. prop = f_maidMy.GetProp(MPN.MuneL);
  711. int num5;
  712. if (prop.boTempDut)
  713. {
  714. num5 = prop.temp_value - 50;
  715. }
  716. else
  717. {
  718. num5 = prop.value - 50;
  719. }
  720. Vector3 b3;
  721. Vector3 b4;
  722. if (0 <= num5)
  723. {
  724. b3 = (float)num5 * f_cIn.vecOffsMuneLGreater / (float)f_nCSTSplitNum;
  725. b4 = (float)num5 * f_cIn.vecHaremMuneLGreater / (float)f_nCSTSplitNum;
  726. }
  727. else
  728. {
  729. int num6 = f_nCSTSplitNum * -1;
  730. b3 = (float)num5 * f_cIn.vecOffsMuneLLess / (float)num6;
  731. b4 = (float)num5 * f_cIn.vecHaremMuneLLess / (float)num6;
  732. }
  733. f_vecOutCharOffset = a + b + b3;
  734. f_vecOutCharOffset /= 100000f;
  735. f_vecOutAllOfs = a2 + b2 + b4;
  736. f_vecOutAllOfs /= 100000f;
  737. }
  738. 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)
  739. {
  740. f_cIn.vecOffsDouParGreater *= 100000f;
  741. f_cIn.vecOffsDouParLess *= 100000f;
  742. f_cIn.vecOffsShinChoGreater *= 100000f;
  743. f_cIn.vecOffsShinChoLess *= 100000f;
  744. f_cIn.vecOffsMuneLGreater *= 100000f;
  745. f_cIn.vecOffsMuneLLess *= 100000f;
  746. f_cIn.vecHaremDouPerGreater *= 100000f;
  747. f_cIn.vecHaremDouPerLess *= 100000f;
  748. f_cIn.vecHaremShinChoGreater *= 100000f;
  749. f_cIn.vecHaremShinChoLess *= 100000f;
  750. f_cIn.vecHaremMuneLGreater *= 100000f;
  751. f_cIn.vecHaremMuneLLess *= 100000f;
  752. f_cPenisPer.vecPenisCommonBase *= 100000f;
  753. f_cPenisPer.vecPenisAmend *= 100000f;
  754. f_cPenisPer.vecPenisDouPerGreater *= 100000f;
  755. f_cPenisPer.vecPenisDouPerLess *= 100000f;
  756. f_cPenisPer.vecPenisShinchoGreater *= 100000f;
  757. f_cPenisPer.vecPenisShinchoLess *= 100000f;
  758. MaidProp prop = f_maidTarget.GetProp(MPN.DouPer);
  759. int num;
  760. if (prop.boTempDut)
  761. {
  762. num = prop.temp_value - 50;
  763. }
  764. else
  765. {
  766. num = prop.value - 50;
  767. }
  768. prop = f_maidTarget.GetProp(MPN.sintyou);
  769. int num2;
  770. if (prop.boTempDut)
  771. {
  772. num2 = prop.temp_value - 50;
  773. }
  774. else
  775. {
  776. num2 = prop.value - 50;
  777. }
  778. Vector3 a;
  779. if (0 <= num)
  780. {
  781. a = (float)num * f_cIn.vecOffsDouParGreater / (float)f_nCSTSplitNum;
  782. }
  783. else
  784. {
  785. int num3 = f_nCSTSplitNum * -1;
  786. a = (float)num * f_cIn.vecOffsDouParLess / (float)num3;
  787. }
  788. Vector3 b;
  789. if (0 <= num2)
  790. {
  791. b = (float)num2 * f_cIn.vecOffsShinChoGreater / (float)f_nCSTSplitNum;
  792. }
  793. else
  794. {
  795. int num4 = f_nCSTSplitNum * -1;
  796. b = (float)num2 * f_cIn.vecOffsShinChoLess / (float)num4;
  797. }
  798. prop = f_maidTarget.GetProp(MPN.MuneL);
  799. int num5;
  800. if (prop.boTempDut)
  801. {
  802. num5 = prop.temp_value - 50;
  803. }
  804. else
  805. {
  806. num5 = prop.value - 50;
  807. }
  808. Vector3 b2;
  809. if (0 <= num5)
  810. {
  811. b2 = (float)num5 * f_cIn.vecOffsMuneLGreater / (float)f_nCSTSplitNum;
  812. }
  813. else
  814. {
  815. int num6 = f_nCSTSplitNum * -1;
  816. b2 = (float)num5 * f_cIn.vecOffsMuneLLess / (float)num6;
  817. }
  818. Vector3 vector = a + b + b2;
  819. Vector3 a2 = Vector3.zero;
  820. Vector3 b3 = Vector3.zero;
  821. if (f_bPenisDetailMode)
  822. {
  823. if (0 <= num)
  824. {
  825. a2 = (float)num * (f_cPenisPer.vecPenisDouPerGreater - f_cPenisPer.vecPenisCommonBase) / (float)f_nCSTSplitNum;
  826. }
  827. else
  828. {
  829. int num3 = f_nCSTSplitNum * -1;
  830. a2 = (float)num * (f_cPenisPer.vecPenisDouPerLess - f_cPenisPer.vecPenisCommonBase) / (float)num3;
  831. }
  832. if (0 <= num2)
  833. {
  834. b3 = (float)num2 * (f_cPenisPer.vecPenisShinchoGreater - f_cPenisPer.vecPenisCommonBase) / (float)f_nCSTSplitNum;
  835. }
  836. else
  837. {
  838. int num4 = f_nCSTSplitNum * -1;
  839. b3 = (float)num2 * (f_cPenisPer.vecPenisShinchoLess - f_cPenisPer.vecPenisCommonBase) / (float)num4;
  840. }
  841. }
  842. f_vecOutPenis = a2 + b3 + f_cPenisPer.vecPenisCommonBase + f_cPenisPer.vecPenisAmend;
  843. f_vecOutPenis /= 100000f;
  844. f_vecOutCharOffset = vector;
  845. f_vecOutCharOffset /= 100000f;
  846. }
  847. public Vector3 SetMaidOffsetPos(Maid f_maid, int f_nCSTSplitNum, CharacterMgr.CharaPer f_cIn)
  848. {
  849. Vector3 zero = Vector3.zero;
  850. Vector3 zero2 = Vector3.zero;
  851. this.GetOffsetMaid(f_maid, f_nCSTSplitNum, out zero, out zero2, f_cIn);
  852. if (ScriptManager.isGP001Mode)
  853. {
  854. f_maid.motionOffset = zero;
  855. f_maid.UpdateTransformData();
  856. }
  857. else
  858. {
  859. f_maid.SetPos(zero);
  860. }
  861. return zero2;
  862. }
  863. public void SetMaidOffsetOther(List<KeyValuePair<Maid, CharacterMgr.CharaPer>> f_listMaid, int f_nCSTSplitNum)
  864. {
  865. Vector3 vector = Vector3.zero;
  866. Vector3 vector2 = Vector3.zero;
  867. for (int i = 0; i < f_listMaid.Count; i++)
  868. {
  869. vector = this.SetMaidOffsetPos(f_listMaid[i].Key, f_nCSTSplitNum, f_listMaid[i].Value);
  870. if (vector2.y < vector.y)
  871. {
  872. vector2 = vector;
  873. }
  874. }
  875. if (!ScriptManager.isGP001Mode)
  876. {
  877. this.CharaAllOfsetPos(new Vector3(0f, vector2.y, 0f));
  878. }
  879. }
  880. public void SetManOffsetPos(Maid f_manMy, Maid f_maidTarget, int f_nCSTSplitNum, bool f_bPenisDetailMode, CharacterMgr.CharaPer f_cIn, CharacterMgr.PenisPer f_cPenisPer)
  881. {
  882. Vector3 vecChinkoOffset;
  883. Vector3 vector;
  884. this.GetOffsetMan(f_maidTarget, f_nCSTSplitNum, f_bPenisDetailMode, out vecChinkoOffset, out vector, f_cIn, f_cPenisPer);
  885. f_manMy.body0.vecChinkoOffset = vecChinkoOffset;
  886. if (ScriptManager.isGP001Mode)
  887. {
  888. f_manMy.motionOffset = vector;
  889. f_manMy.UpdateTransformData();
  890. }
  891. else
  892. {
  893. f_manMy.SetPos(vector);
  894. }
  895. }
  896. public Texture2D ThumShot(Maid f_maid)
  897. {
  898. return GameMain.Instance.ThumCamera.GetComponent<ThumShot>().ShotThumPreset(f_maid);
  899. }
  900. public static string CreatePresetLowCapacityData(Maid maid, CharacterMgr.PresetType presset_type)
  901. {
  902. MemoryStream memoryStream = new MemoryStream();
  903. BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
  904. string result = string.Empty;
  905. binaryWriter.Write("CM3D2_PRESET_S");
  906. binaryWriter.Write(1230);
  907. binaryWriter.Write((char)presset_type);
  908. maid.SerializePropLowCapacity(binaryWriter);
  909. maid.SerializeMultiColor(binaryWriter);
  910. result = "^CM3D2P^" + Convert.ToBase64String(Utility.ZlibCompresss(memoryStream.ToArray()));
  911. binaryWriter.Close();
  912. memoryStream.Dispose();
  913. return result;
  914. }
  915. public CharacterMgr.Preset PresetSave(Maid f_maid, CharacterMgr.PresetType f_type)
  916. {
  917. CharacterMgr.Preset preset = new CharacterMgr.Preset();
  918. Texture2D texture2D = this.ThumShot(f_maid);
  919. MemoryStream memoryStream = new MemoryStream();
  920. BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
  921. binaryWriter.Write("CM3D2_PRESET");
  922. binaryWriter.Write(1230);
  923. binaryWriter.Write((int)f_type);
  924. if (texture2D != null)
  925. {
  926. byte[] array = texture2D.EncodeToPNG();
  927. binaryWriter.Write(array.Length);
  928. binaryWriter.Write(array);
  929. }
  930. else
  931. {
  932. binaryWriter.Write(0);
  933. }
  934. f_maid.SerializeProp(binaryWriter);
  935. f_maid.SerializeMultiColor(binaryWriter);
  936. f_maid.SerializeBody(binaryWriter);
  937. string text = string.Concat(new string[]
  938. {
  939. "pre_",
  940. f_maid.status.lastName,
  941. f_maid.status.firstName,
  942. "_",
  943. DateTime.Now.ToString("yyyyMMddHHmmss")
  944. });
  945. text = UTY.FileNameEscape(text);
  946. text += ".preset";
  947. string fullPath = Path.GetFullPath(".\\");
  948. string text2 = fullPath + "Preset";
  949. if (!Directory.Exists(text2))
  950. {
  951. Directory.CreateDirectory(text2);
  952. }
  953. File.WriteAllBytes(text2 + "\\" + text, memoryStream.ToArray());
  954. memoryStream.Dispose();
  955. preset.texThum = texture2D;
  956. preset.strFileName = text;
  957. preset.ePreType = f_type;
  958. return preset;
  959. }
  960. public void PresetSaveAsQRCode(Maid f_maid, CharacterMgr.PresetType f_type)
  961. {
  962. Texture2D texture2D = Utility.CreateQRCodeTexture(CharacterMgr.CreatePresetLowCapacityData(f_maid, f_type), 512, 512);
  963. Sprite sprite = Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), default(Vector2));
  964. sprite.name = "qr";
  965. byte[] bytes = texture2D.EncodeToPNG();
  966. string text = string.Concat(new string[]
  967. {
  968. "pre_",
  969. f_maid.status.lastName,
  970. f_maid.status.firstName,
  971. "_",
  972. DateTime.Now.ToString("yyyyMMddHHmmss")
  973. });
  974. text = UTY.FileNameEscape(text);
  975. text += ".png";
  976. string fullPath = Path.GetFullPath(".\\");
  977. string text2 = fullPath + "Preset";
  978. if (!Directory.Exists(text2))
  979. {
  980. Directory.CreateDirectory(text2);
  981. }
  982. File.WriteAllBytes(text2 + "\\" + text, bytes);
  983. }
  984. public static CharacterMgr.Preset LoadePresetLowCapacityData(string data_text)
  985. {
  986. if (string.IsNullOrEmpty(data_text) || data_text.IndexOf("^CM3D2P^") != 0)
  987. {
  988. return null;
  989. }
  990. data_text = data_text.Replace("^CM3D2P^", string.Empty);
  991. byte[] array = Convert.FromBase64String(data_text);
  992. array = Utility.ZlibUncompress(array);
  993. CharacterMgr.Preset preset = new CharacterMgr.Preset();
  994. preset.strFileName = string.Empty;
  995. using (MemoryStream memoryStream = new MemoryStream(array))
  996. {
  997. BinaryReader binaryReader = new BinaryReader(memoryStream);
  998. string a = binaryReader.ReadString();
  999. NDebug.Assert(a == "CM3D2_PRESET_S", "低用量プリセットファイルのヘッダーが不正です。");
  1000. int num = binaryReader.ReadInt32();
  1001. preset.ePreType = (CharacterMgr.PresetType)binaryReader.ReadChar();
  1002. preset.listMprop = Maid.DeserializePropLowCapacity(binaryReader);
  1003. preset.aryPartsColor = Maid.DeserializeMultiColorPre(binaryReader);
  1004. binaryReader.Close();
  1005. }
  1006. return preset;
  1007. }
  1008. public CharacterMgr.Preset PresetLoad(string f_strFileName)
  1009. {
  1010. FileStream fileStream = new FileStream(f_strFileName, FileMode.Open);
  1011. if (fileStream == null)
  1012. {
  1013. return null;
  1014. }
  1015. byte[] buffer = new byte[fileStream.Length];
  1016. fileStream.Read(buffer, 0, (int)fileStream.Length);
  1017. fileStream.Close();
  1018. fileStream.Dispose();
  1019. BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer));
  1020. CharacterMgr.Preset result = this.PresetLoad(binaryReader, Path.GetFileName(f_strFileName));
  1021. binaryReader.Close();
  1022. return result;
  1023. }
  1024. public CharacterMgr.Preset PresetLoadFromResources(string f_strFileName)
  1025. {
  1026. TextAsset textAsset = Resources.Load("Preset/" + f_strFileName) as TextAsset;
  1027. NDebug.Assert(textAsset != null, "内部Resourcesからファイル[" + f_strFileName + "]を読み込めませんでした");
  1028. BinaryReader binaryReader = new BinaryReader(new MemoryStream(textAsset.bytes));
  1029. CharacterMgr.Preset result = this.PresetLoad(binaryReader, Path.GetFileName(f_strFileName));
  1030. binaryReader.Close();
  1031. Resources.UnloadAsset(textAsset);
  1032. return result;
  1033. }
  1034. public CharacterMgr.Preset PresetLoad(BinaryReader brRead, string f_strFileName)
  1035. {
  1036. CharacterMgr.Preset preset = new CharacterMgr.Preset();
  1037. preset.strFileName = f_strFileName;
  1038. string a = brRead.ReadString();
  1039. NDebug.Assert(a == "CM3D2_PRESET", "プリセットファイルのヘッダーが不正です。");
  1040. int num = brRead.ReadInt32();
  1041. preset.nVersion = num;
  1042. int ePreType = brRead.ReadInt32();
  1043. preset.ePreType = (CharacterMgr.PresetType)ePreType;
  1044. int num2 = brRead.ReadInt32();
  1045. if (num2 != 0)
  1046. {
  1047. byte[] data = brRead.ReadBytes(num2);
  1048. preset.texThum = new Texture2D(1, 1);
  1049. preset.texThum.LoadImage(data);
  1050. preset.texThum.wrapMode = TextureWrapMode.Clamp;
  1051. }
  1052. else
  1053. {
  1054. preset.texThum = null;
  1055. }
  1056. preset.listMprop = Maid.DeserializePropPre(brRead);
  1057. if (num >= 2)
  1058. {
  1059. preset.aryPartsColor = Maid.DeserializeMultiColorPre(brRead);
  1060. }
  1061. if (num >= 200)
  1062. {
  1063. Maid.DeserializeBodyPre(brRead);
  1064. }
  1065. return preset;
  1066. }
  1067. public void PresetDelete(CharacterMgr.Preset f_pre)
  1068. {
  1069. try
  1070. {
  1071. string fullPath = Path.GetFullPath(".\\");
  1072. string str = fullPath + "Preset";
  1073. string text = str + "\\" + f_pre.strFileName;
  1074. if (File.Exists(text))
  1075. {
  1076. File.Delete(text);
  1077. }
  1078. else
  1079. {
  1080. Debug.LogWarning("PresetDelete削除失敗 ファイルがありません。" + text);
  1081. }
  1082. }
  1083. catch (Exception ex)
  1084. {
  1085. Debug.LogWarning("PresetDelete削除失敗 " + ex.Message);
  1086. }
  1087. }
  1088. public List<CharacterMgr.Preset> PresetListLoad()
  1089. {
  1090. List<CharacterMgr.Preset> list = new List<CharacterMgr.Preset>();
  1091. string fullPath = Path.GetFullPath(".\\");
  1092. string path = fullPath + "Preset";
  1093. if (!Directory.Exists(path))
  1094. {
  1095. Directory.CreateDirectory(path);
  1096. }
  1097. foreach (string f_strFileName in Directory.GetFiles(path, "*.preset"))
  1098. {
  1099. CharacterMgr.Preset item = this.PresetLoad(f_strFileName);
  1100. list.Add(item);
  1101. }
  1102. return list;
  1103. }
  1104. private bool IsEnableMenu(string f_strFileName)
  1105. {
  1106. if (CharacterMgr.EditModeLookHaveItem)
  1107. {
  1108. return GameMain.Instance.CharacterMgr.status.IsHavePartsItem(f_strFileName) && GameUty.IsExistFile(f_strFileName, null);
  1109. }
  1110. return GameUty.IsExistFile(f_strFileName, null);
  1111. }
  1112. public void PresetSet(Maid f_maid, CharacterMgr.Preset f_prest)
  1113. {
  1114. MaidProp[] array;
  1115. if (f_prest.ePreType == CharacterMgr.PresetType.Body)
  1116. {
  1117. array = (from mp in f_prest.listMprop
  1118. where (1 <= mp.idx && mp.idx <= 66) || (101 <= mp.idx && mp.idx <= 105)
  1119. select mp).ToArray<MaidProp>();
  1120. }
  1121. else if (f_prest.ePreType == CharacterMgr.PresetType.Wear)
  1122. {
  1123. array = (from mp in f_prest.listMprop
  1124. where 67 <= mp.idx && mp.idx <= 96
  1125. select mp).ToArray<MaidProp>();
  1126. }
  1127. else
  1128. {
  1129. array = (from mp in f_prest.listMprop
  1130. where (1 <= mp.idx && mp.idx <= 96) || (101 <= mp.idx && mp.idx <= 105)
  1131. select mp).ToArray<MaidProp>();
  1132. }
  1133. NDebug.Assert(array != null, "プリセットを実行する配列が空です。");
  1134. foreach (MaidProp maidProp in array)
  1135. {
  1136. if (maidProp.type != 3)
  1137. {
  1138. f_maid.SetProp((MPN)maidProp.idx, maidProp.value, false);
  1139. }
  1140. else
  1141. {
  1142. if (string.IsNullOrEmpty(maidProp.strFileName))
  1143. {
  1144. string strFileName = maidProp.strFileName;
  1145. if (CM3.dicDelItem.TryGetValue((MPN)maidProp.idx, out strFileName))
  1146. {
  1147. maidProp.strFileName = strFileName;
  1148. }
  1149. }
  1150. if (this.IsEnableMenu(maidProp.strFileName))
  1151. {
  1152. f_maid.SetProp(maidProp);
  1153. }
  1154. else
  1155. {
  1156. f_maid.DelProp((MPN)maidProp.idx, false);
  1157. }
  1158. if (maidProp.listSubProp != null && maidProp.listSubProp.Count != 0)
  1159. {
  1160. f_maid.DelProp((MPN)maidProp.idx, false);
  1161. for (int j = 0; j < maidProp.listSubProp.Count; j++)
  1162. {
  1163. SubProp subProp = maidProp.listSubProp[j];
  1164. if (subProp != null)
  1165. {
  1166. if (this.IsEnableMenu(subProp.strFileName))
  1167. {
  1168. f_maid.SetSubProp((MPN)maidProp.idx, j, subProp.strFileName, subProp.nFileNameRID);
  1169. f_maid.GetSubProp((MPN)maidProp.idx, j).fTexMulAlpha = subProp.fTexMulAlpha;
  1170. }
  1171. else
  1172. {
  1173. f_maid.DelSubProp((MPN)maidProp.idx, j);
  1174. }
  1175. }
  1176. }
  1177. }
  1178. }
  1179. }
  1180. if ((f_prest.ePreType == CharacterMgr.PresetType.Body || f_prest.ePreType == CharacterMgr.PresetType.All) && f_prest.aryPartsColor != null)
  1181. {
  1182. for (int k = 0; k < f_prest.aryPartsColor.Length; k++)
  1183. {
  1184. f_maid.Parts.SetPartsColor((MaidParts.PARTS_COLOR)k, f_prest.aryPartsColor[k]);
  1185. }
  1186. }
  1187. f_maid.AllProcPropSeqStart();
  1188. }
  1189. public bool Serialize(BinaryWriter bwWrite)
  1190. {
  1191. bwWrite.Write("CM3D2_CHR_MGR");
  1192. bwWrite.Write(1230);
  1193. this.m_PlayerStatus.Serialize(bwWrite);
  1194. bwWrite.Write(this.m_listStockMan.Count);
  1195. for (int i = 0; i < this.m_listStockMan.Count; i++)
  1196. {
  1197. Maid maid = this.m_listStockMan[i];
  1198. maid.SerializeProp(bwWrite);
  1199. maid.SerializeMisc(bwWrite);
  1200. }
  1201. bwWrite.Write(this.m_listStockMaid.Count);
  1202. for (int j = 0; j < this.m_listStockMaid.Count; j++)
  1203. {
  1204. Maid maid2 = this.m_listStockMaid[j];
  1205. maid2.SerializeProp(bwWrite);
  1206. maid2.SerializeMultiColor(bwWrite);
  1207. maid2.status.Serialize(bwWrite);
  1208. maid2.SerializeMisc(bwWrite);
  1209. maid2.SerializeBody(bwWrite);
  1210. }
  1211. return true;
  1212. }
  1213. public bool Deserialize(BinaryReader brRead)
  1214. {
  1215. for (int i = 0; i < this.GetMaidCount(); i++)
  1216. {
  1217. Maid maid = this.GetMaid(i);
  1218. if (maid != null)
  1219. {
  1220. this.DeactivateMaid(maid);
  1221. }
  1222. }
  1223. while (this.GetStockMaidCount() != 0)
  1224. {
  1225. this.BanishmentMaid(0);
  1226. }
  1227. int manCount = this.GetManCount();
  1228. for (int j = 0; j < manCount; j++)
  1229. {
  1230. Maid man = this.GetMan(j);
  1231. if (man != null)
  1232. {
  1233. this.DeactivateMan(man);
  1234. }
  1235. }
  1236. string a = brRead.ReadString();
  1237. NDebug.Assert(a == "CM3D2_CHR_MGR", "セーブデータファイルのヘッダーが不正です。CHR_MGR");
  1238. int num = brRead.ReadInt32();
  1239. this.m_PlayerStatus.Deserialize(brRead);
  1240. int num2 = brRead.ReadInt32();
  1241. int num3 = 0;
  1242. for (int k = 0; k < num2; k++)
  1243. {
  1244. Maid maid2 = this.m_listStockMan[k];
  1245. maid2.DeserializeProp(brRead);
  1246. maid2.DeserializeMisc(brRead);
  1247. if (maid2.ActiveSlotNo != -1)
  1248. {
  1249. this.SetActiveMan(maid2, maid2.ActiveSlotNo);
  1250. num3 = System.Math.Max(num3, maid2.ActiveSlotNo);
  1251. }
  1252. }
  1253. int num4 = this.GetManCount() - 2;
  1254. for (int l = num3 + 1; l < num4; l++)
  1255. {
  1256. this.SetActiveMan(this.GetStockMan(l), l);
  1257. }
  1258. int num5 = brRead.ReadInt32();
  1259. for (int m = 0; m < num5; m++)
  1260. {
  1261. Maid maid3 = this.AddStockMaid();
  1262. maid3.DeserializeProp(brRead);
  1263. maid3.DeserializeMultiColor(brRead);
  1264. maid3.status.Deserialize(brRead);
  1265. maid3.DeserializeMisc(brRead);
  1266. if (num >= 200)
  1267. {
  1268. maid3.DeserializeBody(brRead);
  1269. }
  1270. if (maid3.ActiveSlotNo != -1)
  1271. {
  1272. this.SetActiveMaid(maid3, maid3.ActiveSlotNo);
  1273. }
  1274. }
  1275. Maid.DeletedTmpThumCards();
  1276. GameMain.Instance.MsgWnd.ClearBackLogData();
  1277. if (this.status.isDaytime)
  1278. {
  1279. ScheduleAPI.OccurNightWork();
  1280. }
  1281. return true;
  1282. }
  1283. public const int MaidStockMax = 200;
  1284. public const int ActiveMaidSlotCount = 18;
  1285. public const int NpcMaidCreateCount = 3;
  1286. public const int ActiveManSloatCount = 6;
  1287. private static bool m_bEditMode;
  1288. private GameObject m_goCharacter;
  1289. private GameObject m_goActive;
  1290. private GameObject m_goAllOffset;
  1291. private GameObject m_goStock;
  1292. private GameObject m_goStockMaid;
  1293. private GameObject m_goStockNpcMaid;
  1294. private GameObject m_goStockMan;
  1295. private GameObject m_goStockNpcMan;
  1296. private Dictionary<string, GameObject> m_dicCaches = new Dictionary<string, GameObject>();
  1297. private GameObject m_goChaches;
  1298. private Status m_PlayerStatus;
  1299. private List<Maid> m_listStockMaid = new List<Maid>();
  1300. private List<Maid> m_listStockNpcMaid = new List<Maid>();
  1301. private List<Maid> m_listStockMan = new List<Maid>();
  1302. private List<Maid> m_listStockNpcMan = new List<Maid>();
  1303. private Maid[] m_gcActiveMaid = new Maid[18];
  1304. private GameObject[] m_objActiveMaid = new GameObject[18];
  1305. private Maid[] m_gcActiveMan = new Maid[6];
  1306. private GameObject[] m_objActiveMan = new GameObject[6];
  1307. public class NpcData
  1308. {
  1309. public NpcData(CsvParser csv, int lineY)
  1310. {
  1311. int num = 0;
  1312. this.uniqueName = csv.GetCellAsString(num++, lineY);
  1313. this.lastName = csv.GetCellAsString(num++, lineY);
  1314. this.firstName = csv.GetCellAsString(num++, lineY);
  1315. this.presetFileName = Path.GetFileNameWithoutExtension(csv.GetCellAsString(num++, lineY));
  1316. if (!string.IsNullOrEmpty(this.presetFileName))
  1317. {
  1318. this.isResourcesLoad = !GameUty.FileSystem.IsExistentFile(this.presetFileName + ".preset");
  1319. }
  1320. this.menuFileName = Path.GetFileNameWithoutExtension(csv.GetCellAsString(num++, lineY));
  1321. if (!string.IsNullOrEmpty(this.menuFileName))
  1322. {
  1323. this.menuFileName += ".menu";
  1324. }
  1325. NDebug.Assert(string.IsNullOrEmpty(this.presetFileName) || string.IsNullOrEmpty(this.menuFileName), "プリセットとメニューファイル両方が指定されています");
  1326. }
  1327. public void Apply(Maid maid, bool onlyPartsLoad = false)
  1328. {
  1329. if (maid == null || GameMain.Instance.CharacterMgr == null)
  1330. {
  1331. return;
  1332. }
  1333. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  1334. maid.ResetAll();
  1335. if (!maid.boMAN)
  1336. {
  1337. NDebug.Assert(string.IsNullOrEmpty(this.menuFileName), "メイドに対して男用のNPCデータを適用しようとしています");
  1338. if (!onlyPartsLoad)
  1339. {
  1340. maid.status.firstName = this.firstName;
  1341. maid.status.lastName = this.lastName;
  1342. }
  1343. if (this.isResourcesLoad)
  1344. {
  1345. characterMgr.PresetSet(maid, characterMgr.PresetLoadFromResources(this.presetFileName));
  1346. }
  1347. else
  1348. {
  1349. using (AFileBase afileBase = GameUty.FileOpen(this.presetFileName + ".preset", null))
  1350. {
  1351. if (afileBase != null && afileBase.IsValid())
  1352. {
  1353. byte[] buffer = afileBase.ReadAll();
  1354. using (BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer), Encoding.UTF8))
  1355. {
  1356. characterMgr.PresetSet(maid, characterMgr.PresetLoad(binaryReader, this.presetFileName));
  1357. }
  1358. }
  1359. }
  1360. }
  1361. }
  1362. else
  1363. {
  1364. NDebug.Assert(string.IsNullOrEmpty(this.presetFileName), "男に対してメイド用のNPCデータを適用しようとしています");
  1365. maid.SetUpModel(this.menuFileName);
  1366. }
  1367. }
  1368. public readonly string uniqueName;
  1369. public readonly string firstName;
  1370. public readonly string lastName;
  1371. public readonly string presetFileName;
  1372. public readonly string menuFileName;
  1373. private bool isResourcesLoad;
  1374. }
  1375. public class CharaPer
  1376. {
  1377. public Vector3 vecOffsDouParGreater;
  1378. public Vector3 vecOffsDouParLess;
  1379. public Vector3 vecOffsShinChoGreater;
  1380. public Vector3 vecOffsShinChoLess;
  1381. public Vector3 vecOffsMuneLGreater;
  1382. public Vector3 vecOffsMuneLLess;
  1383. public Vector3 vecHaremDouPerGreater;
  1384. public Vector3 vecHaremDouPerLess;
  1385. public Vector3 vecHaremShinChoGreater;
  1386. public Vector3 vecHaremShinChoLess;
  1387. public Vector3 vecHaremMuneLGreater;
  1388. public Vector3 vecHaremMuneLLess;
  1389. }
  1390. public class PenisPer
  1391. {
  1392. public Vector3 vecPenisCommonBase;
  1393. public Vector3 vecPenisAmend;
  1394. public Vector3 vecPenisDouPerGreater;
  1395. public Vector3 vecPenisDouPerLess;
  1396. public Vector3 vecPenisShinchoGreater;
  1397. public Vector3 vecPenisShinchoLess;
  1398. }
  1399. public enum PresetType
  1400. {
  1401. Wear,
  1402. Body,
  1403. All
  1404. }
  1405. public class Preset
  1406. {
  1407. public int nVersion;
  1408. public Texture2D texThum;
  1409. public string strFileName;
  1410. public CharacterMgr.PresetType ePreType;
  1411. public List<MaidProp> listMprop = new List<MaidProp>();
  1412. public MaidParts.PartsColor[] aryPartsColor;
  1413. }
  1414. }