CharacterMgr.cs 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using I2.Loc;
  7. using MaidStatus;
  8. using PlayerStatus;
  9. using SceneNPCEdit;
  10. using Schedule;
  11. using UnityEngine;
  12. using wf;
  13. public class CharacterMgr : MonoBehaviour
  14. {
  15. public static Dictionary<string, CharacterMgr.NpcData> npcDatas { get; private set; }
  16. public static bool EditModeLookHaveItem
  17. {
  18. get
  19. {
  20. return CharacterMgr.m_bEditMode;
  21. }
  22. set
  23. {
  24. CharacterMgr.m_bEditMode = value;
  25. }
  26. }
  27. public string PresetDirectory
  28. {
  29. get
  30. {
  31. return Path.Combine(GameMain.Instance.SerializeStorageManager.StoreDirectoryPath, "Preset");
  32. }
  33. }
  34. public GameObject CharacterAll
  35. {
  36. get
  37. {
  38. return this.m_goCharacter;
  39. }
  40. }
  41. public PlayerStatus.Status status
  42. {
  43. get
  44. {
  45. return this.m_PlayerStatus;
  46. }
  47. }
  48. public Maid GetMaid(int nMaidNo)
  49. {
  50. return (this.m_gcActiveMaid.Length > nMaidNo) ? this.m_gcActiveMaid[nMaidNo] : null;
  51. }
  52. public Maid GetMaid(string guid)
  53. {
  54. for (int i = 0; i < this.m_gcActiveMaid.Length; i++)
  55. {
  56. if (this.m_gcActiveMaid[i] != null && this.m_gcActiveMaid[i].status.guid == guid)
  57. {
  58. return this.m_gcActiveMaid[i];
  59. }
  60. }
  61. return null;
  62. }
  63. public int GetMaidCount()
  64. {
  65. return this.m_gcActiveMaid.Length;
  66. }
  67. public Maid GetMan(int nManNo)
  68. {
  69. return (this.m_gcActiveMan.Length > nManNo) ? this.m_gcActiveMan[nManNo] : null;
  70. }
  71. public int GetManCount()
  72. {
  73. return this.m_gcActiveMan.Length;
  74. }
  75. public List<Maid> GetStockMaidList()
  76. {
  77. return this.m_listStockMaid;
  78. }
  79. public Maid GetStockMaid(int nStockNo)
  80. {
  81. return this.m_listStockMaid[nStockNo];
  82. }
  83. public Maid GetStockMaid(string guid)
  84. {
  85. for (int i = 0; i < this.m_listStockMaid.Count; i++)
  86. {
  87. if (this.m_listStockMaid[i].status.guid == guid)
  88. {
  89. return this.m_listStockMaid[i];
  90. }
  91. }
  92. return null;
  93. }
  94. public Maid GetStockNpcMaid(int nStockNo)
  95. {
  96. return this.m_listStockNpcMaid[nStockNo];
  97. }
  98. public Maid GetStockNpcMaid(string guid)
  99. {
  100. for (int i = 0; i < this.m_listStockNpcMaid.Count; i++)
  101. {
  102. if (this.m_listStockNpcMaid[i].status.guid == guid)
  103. {
  104. return this.m_listStockNpcMaid[i];
  105. }
  106. }
  107. return null;
  108. }
  109. public Maid GetStockMan(int nStockNo)
  110. {
  111. return this.m_listStockMan[nStockNo];
  112. }
  113. public Maid GetStockMan(string guid)
  114. {
  115. for (int i = 0; i < this.m_listStockMan.Count; i++)
  116. {
  117. if (this.m_listStockMan[i].status.guid == guid)
  118. {
  119. return this.m_listStockMan[i];
  120. }
  121. }
  122. return null;
  123. }
  124. public Maid GetStockNpcMan(int nStockNo)
  125. {
  126. return this.m_listStockNpcMan[nStockNo];
  127. }
  128. public Maid GetStockNpcMan(string guid)
  129. {
  130. for (int i = 0; i < this.m_listStockNpcMan.Count; i++)
  131. {
  132. if (this.m_listStockNpcMan[i].status.guid == guid)
  133. {
  134. return this.m_listStockNpcMan[i];
  135. }
  136. }
  137. return null;
  138. }
  139. public int GetStockMaidCount()
  140. {
  141. return this.m_listStockMaid.Count;
  142. }
  143. public int GetStockManCount()
  144. {
  145. return this.m_listStockMan.Count;
  146. }
  147. public string RenewSaveDataGUID()
  148. {
  149. return this.SaveDataGUID = Guid.NewGuid().ToString();
  150. }
  151. public static void CreateNpcData()
  152. {
  153. if (CharacterMgr.npcDatas != null)
  154. {
  155. return;
  156. }
  157. CharacterMgr.npcDatas = new Dictionary<string, CharacterMgr.NpcData>();
  158. string text = "character_preset_basedata.nei";
  159. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text))
  160. {
  161. using (CsvParser csvParser = new CsvParser())
  162. {
  163. bool condition = csvParser.Open(afileBase);
  164. NDebug.Assert(condition, text + "\nopen failed.");
  165. for (int i = 1; i < csvParser.max_cell_y; i++)
  166. {
  167. CharacterMgr.NpcData npcData = new CharacterMgr.NpcData(csvParser, i);
  168. CharacterMgr.npcDatas.Add(npcData.uniqueName, npcData);
  169. }
  170. }
  171. }
  172. }
  173. private void Awake()
  174. {
  175. CharacterMgr.CreateNpcData();
  176. }
  177. private void Start()
  178. {
  179. }
  180. public void OnDestroy()
  181. {
  182. foreach (Maid obj in this.m_listStockNpcMan)
  183. {
  184. UnityEngine.Object.DestroyImmediate(obj);
  185. }
  186. this.m_listStockNpcMan.Clear();
  187. foreach (Maid obj2 in this.m_listStockMan)
  188. {
  189. UnityEngine.Object.DestroyImmediate(obj2);
  190. }
  191. this.m_listStockMan.Clear();
  192. foreach (Maid obj3 in this.m_listStockNpcMaid)
  193. {
  194. UnityEngine.Object.DestroyImmediate(obj3);
  195. }
  196. this.m_listStockNpcMaid.Clear();
  197. foreach (Maid obj4 in this.m_listStockMaid)
  198. {
  199. UnityEngine.Object.DestroyImmediate(obj4);
  200. }
  201. this.m_listStockMaid.Clear();
  202. }
  203. public void Init(GameMain f_gcGameMain)
  204. {
  205. CM3.Init();
  206. this.SaveDataGUID = Guid.NewGuid().ToString();
  207. BoneMorph.Init();
  208. BoneMorphDefine.Init();
  209. this.m_PlayerStatus = new PlayerStatus.Status();
  210. this.m_goCharacter = new GameObject("Character");
  211. this.m_goCharacter.transform.parent = f_gcGameMain.transform;
  212. this.m_goActive = new GameObject("Active");
  213. this.m_goActive.transform.parent = this.m_goCharacter.transform;
  214. this.m_goAllOffset = new GameObject("AllOffset");
  215. this.m_goAllOffset.transform.parent = this.m_goActive.transform;
  216. this.m_goStock = new GameObject("Stock");
  217. this.m_goStock.transform.parent = this.m_goCharacter.transform;
  218. this.m_goStockMaid = new GameObject("Maid");
  219. this.m_goStockMaid.transform.SetParent(this.m_goStock.transform, false);
  220. this.m_goStockNpcMaid = new GameObject("NpcMaid");
  221. this.m_goStockNpcMaid.transform.SetParent(this.m_goStock.transform, false);
  222. this.m_goStockMan = new GameObject("Man");
  223. this.m_goStockMan.transform.SetParent(this.m_goStock.transform, false);
  224. this.m_goStockNpcMan = new GameObject("NpcMan");
  225. this.m_goStockNpcMan.transform.SetParent(this.m_goStock.transform, false);
  226. this.m_goChaches = new GameObject("_Caches");
  227. this.m_goChaches.transform.SetParent(this.m_goCharacter.transform, false);
  228. }
  229. public bool TryGetCacheObject(string f_key, out GameObject f_outObj)
  230. {
  231. return this.m_dicCaches.TryGetValue(f_key, out f_outObj);
  232. }
  233. public void AddCacheObject(string f_key, GameObject f_obj)
  234. {
  235. f_obj.transform.SetParent(this.m_goChaches.transform, false);
  236. this.m_dicCaches[f_key] = f_obj;
  237. }
  238. public Maid AddStockMaid()
  239. {
  240. return this.AddStock(false, false);
  241. }
  242. public Maid AddStockNpcMaid()
  243. {
  244. return this.AddStock(false, true);
  245. }
  246. public Maid AddStockMan()
  247. {
  248. return this.AddStock(true, false);
  249. }
  250. private Maid AddStock(bool f_bMan, bool f_bNpc)
  251. {
  252. GameObject gameObject = new GameObject();
  253. gameObject.name = ((!f_bMan) ? ((!f_bNpc) ? "StockMaid" : "StockNpcMaid") : ((!f_bNpc) ? "StockMan" : "StockNpcMan"));
  254. 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);
  255. Maid maid = gameObject.AddComponent<Maid>();
  256. maid.boNPC = f_bNpc;
  257. ((!f_bMan) ? ((!f_bNpc) ? this.m_listStockMaid : this.m_listStockNpcMaid) : ((!f_bNpc) ? this.m_listStockMan : this.m_listStockNpcMan)).Add(maid);
  258. maid.Initialize((!f_bMan) ? "Maid" : "Man", f_bMan, false);
  259. maid.Visible = false;
  260. return maid;
  261. }
  262. public void SetActiveMaid(Maid f_maid, int f_nActiveSlotNo)
  263. {
  264. this.SetActive(f_maid, f_nActiveSlotNo, false);
  265. }
  266. public void SetActiveMan(Maid f_maid, int f_nActiveSlotNo)
  267. {
  268. this.SetActive(f_maid, f_nActiveSlotNo, true);
  269. }
  270. private void SetActive(Maid f_maid, int f_nActiveSlotNo, bool f_bMan)
  271. {
  272. GameObject[] array = (!f_bMan) ? this.m_objActiveMaid : this.m_objActiveMan;
  273. Maid[] array2 = (!f_bMan) ? this.m_gcActiveMaid : this.m_gcActiveMan;
  274. if (array2[f_nActiveSlotNo] == f_maid)
  275. {
  276. return;
  277. }
  278. if (array[f_nActiveSlotNo] != null)
  279. {
  280. this.Deactivate(f_nActiveSlotNo, f_bMan);
  281. }
  282. f_maid.ActiveSlotNo = f_nActiveSlotNo;
  283. GameObject gameObject = f_maid.gameObject;
  284. gameObject.transform.SetParent(this.m_goAllOffset.transform, false);
  285. for (int i = 0; i < array.Length; i++)
  286. {
  287. if (array[i] == gameObject)
  288. {
  289. array[i] = null;
  290. array2[i] = null;
  291. }
  292. }
  293. gameObject.name = ((!f_bMan) ? "Maid[" : "Man[") + f_nActiveSlotNo.ToString() + "]";
  294. if (!f_bMan)
  295. {
  296. GameObject gameObject2 = gameObject;
  297. string name = gameObject2.name;
  298. gameObject2.name = string.Concat(new string[]
  299. {
  300. name,
  301. " ",
  302. f_maid.status.firstName,
  303. " ",
  304. f_maid.status.lastName
  305. });
  306. }
  307. array[f_nActiveSlotNo] = gameObject;
  308. array2[f_nActiveSlotNo] = f_maid;
  309. if (!f_bMan && f_maid.status != null)
  310. {
  311. if (f_maid.status.heroineType != HeroineType.Sub)
  312. {
  313. f_maid.status.voiceGroup = VoiceGroup.Heroine;
  314. }
  315. if (f_maid.status.subCharaStatus != null)
  316. {
  317. string contractText = f_maid.status.subCharaStatus.contractText;
  318. f_maid.status.voiceGroup = ((!(contractText == "ユニーク")) ? VoiceGroup.Extra : VoiceGroup.Sub);
  319. }
  320. }
  321. f_maid.DutPropAll();
  322. f_maid.AllProcPropSeqStart();
  323. }
  324. public Maid Activate(int f_nActiveSlot, int f_nStockSlot, bool f_bMan, bool f_bNpc)
  325. {
  326. List<Maid> list = (!f_bMan) ? ((!f_bNpc) ? this.m_listStockMaid : this.m_listStockNpcMaid) : ((!f_bNpc) ? this.m_listStockMan : this.m_listStockNpcMan);
  327. Maid maid = list[f_nStockSlot];
  328. if (f_bMan)
  329. {
  330. this.SetActiveMan(maid, f_nActiveSlot);
  331. }
  332. else
  333. {
  334. this.SetActiveMaid(maid, f_nActiveSlot);
  335. }
  336. return maid;
  337. }
  338. public Maid ActivateNpc(int f_nActiveSlot)
  339. {
  340. for (int i = 0; i < 3; i++)
  341. {
  342. Maid stockNpcMaid = this.GetStockNpcMaid(i);
  343. if (stockNpcMaid.ActiveSlotNo == -1)
  344. {
  345. return this.Activate(f_nActiveSlot, i, false, true);
  346. }
  347. }
  348. NDebug.Assert("Subメイドとして同時に扱える上限を超えています(" + 3.ToString() + "体までです", false);
  349. return null;
  350. }
  351. public void SwapActiveSlot(int slotNoA, int slotNoB, bool isMan)
  352. {
  353. GameObject[] array = (!isMan) ? this.m_objActiveMaid : this.m_objActiveMan;
  354. Maid[] array2 = (!isMan) ? this.m_gcActiveMaid : this.m_gcActiveMan;
  355. GameObject gameObject = array[slotNoA];
  356. array[slotNoA] = array[slotNoB];
  357. array[slotNoB] = gameObject;
  358. string text = (!(array2[slotNoA] != null)) ? null : array2[slotNoA].gameObject.name;
  359. if (array2[slotNoA] && array2[slotNoB] != null)
  360. {
  361. array2[slotNoA].gameObject.name = array2[slotNoB].gameObject.name;
  362. }
  363. if (array2[slotNoB] != null && text != null)
  364. {
  365. array2[slotNoB].gameObject.name = text;
  366. }
  367. Maid maid = array2[slotNoA];
  368. array2[slotNoA] = array2[slotNoB];
  369. array2[slotNoB] = maid;
  370. int activeSlotNo = (!(array2[slotNoA] != null)) ? -1 : array2[slotNoA].ActiveSlotNo;
  371. if (array2[slotNoA])
  372. {
  373. array2[slotNoA].ActiveSlotNo = ((!(array2[slotNoB] != null)) ? -1 : array2[slotNoB].ActiveSlotNo);
  374. }
  375. if (array2[slotNoB])
  376. {
  377. array2[slotNoB].ActiveSlotNo = activeSlotNo;
  378. }
  379. }
  380. public void DeactivateCharaAll()
  381. {
  382. this.DeactivateMaidAll();
  383. this.DeactivateManAll();
  384. this.ResetCharaPosAll();
  385. }
  386. public void DeactivateMaid(int f_nActiveSlotNo)
  387. {
  388. this.Deactivate(f_nActiveSlotNo, false);
  389. }
  390. public void DeactivateMaid(Maid f_maidActive)
  391. {
  392. this.Deactivate(f_maidActive.ActiveSlotNo, false);
  393. }
  394. public void DeactivateMaidAll()
  395. {
  396. this.CharaVisible(0, false, false);
  397. Maid maid = this.GetMaid(0);
  398. for (int i = 1; i < this.m_gcActiveMaid.Length; i++)
  399. {
  400. this.Deactivate(i, false);
  401. }
  402. }
  403. public void DeactivateMan(int f_nActiveSlotNo)
  404. {
  405. this.Deactivate(f_nActiveSlotNo, true);
  406. }
  407. public void DeactivateMan(Maid f_manActive)
  408. {
  409. this.Deactivate(f_manActive.ActiveSlotNo, true);
  410. }
  411. public void DeactivateManAll()
  412. {
  413. for (int i = 0; i < this.GetManCount(); i++)
  414. {
  415. this.CharaVisible(i, false, true);
  416. }
  417. }
  418. public void Deactivate(int f_nActiveSlotNo, bool f_bMan)
  419. {
  420. if (f_nActiveSlotNo == -1)
  421. {
  422. return;
  423. }
  424. GameObject[] array = (!f_bMan) ? this.m_objActiveMaid : this.m_objActiveMan;
  425. Maid[] array2 = (!f_bMan) ? this.m_gcActiveMaid : this.m_gcActiveMan;
  426. GameObject gameObject = array[f_nActiveSlotNo];
  427. Maid maid = array2[f_nActiveSlotNo];
  428. if (gameObject == null || maid == null)
  429. {
  430. return;
  431. }
  432. Debug.Log("Deactivate " + maid.status.firstName);
  433. GameObject gameObject2 = (!f_bMan) ? ((!maid.boNPC) ? this.m_goStockMaid : this.m_goStockNpcMaid) : ((!maid.boNPC) ? this.m_goStockMan : this.m_goStockNpcMan);
  434. if (gameObject == null)
  435. {
  436. return;
  437. }
  438. if (!f_bMan && maid.body0 != null)
  439. {
  440. maid.body0.MuneYureL(1f);
  441. maid.body0.MuneYureR(1f);
  442. }
  443. maid.Visible = false;
  444. maid.ActiveSlotNo = -1;
  445. if (maid.pairMan != null)
  446. {
  447. maid.pairMan.Visible = false;
  448. maid.pairMan.ActiveSlotNo = -1;
  449. }
  450. maid.Uninit();
  451. if (maid.body0 != null)
  452. {
  453. maid.body0.LastAnimeFN = string.Empty;
  454. }
  455. if (maid.pairMan != null)
  456. {
  457. maid.pairMan.Uninit();
  458. if (maid.pairMan.body0 != null)
  459. {
  460. maid.pairMan.body0.LastAnimeFN = string.Empty;
  461. }
  462. }
  463. maid.LipSyncEnabled(true);
  464. gameObject.transform.SetParent(gameObject2.transform, false);
  465. gameObject.name = ((!f_bMan) ? ((!maid.boNPC) ? "StockMaid" : "StockNpcMaid") : ((!maid.boNPC) ? "StockMan" : "StockNpcMan"));
  466. if (!f_bMan)
  467. {
  468. GameObject gameObject3 = gameObject;
  469. string name = gameObject3.name;
  470. gameObject3.name = string.Concat(new string[]
  471. {
  472. name,
  473. " ",
  474. maid.status.firstName,
  475. " ",
  476. maid.status.lastName
  477. });
  478. }
  479. if (f_bMan && maid.IsCrcBody)
  480. {
  481. gameObject.name = "NewMan";
  482. }
  483. array[f_nActiveSlotNo] = null;
  484. array2[f_nActiveSlotNo] = null;
  485. }
  486. public void BanishmentMaid(int f_nStockNo)
  487. {
  488. this.Banishment(f_nStockNo, false);
  489. }
  490. public void BanishmentMaid(Maid f_maid)
  491. {
  492. this.BanishmentMaid(f_maid, false);
  493. }
  494. public void BanishmentMan(int f_nStockNo)
  495. {
  496. this.Banishment(f_nStockNo, true);
  497. }
  498. public void BanishmentMan(Maid f_maid)
  499. {
  500. this.BanishmentMaid(f_maid, true);
  501. }
  502. private void Banishment(int f_nStockNo, bool f_bMan)
  503. {
  504. List<Maid> list = (!f_bMan) ? this.m_listStockMaid : this.m_listStockMan;
  505. if (f_nStockNo < 0 || list.Count <= f_nStockNo)
  506. {
  507. NDebug.Assert("Banishment メイドストック数より大きいIndexが設定されました。" + f_nStockNo, false);
  508. }
  509. Maid maid = list[f_nStockNo];
  510. if (maid == null)
  511. {
  512. NDebug.Assert("Banishment メイドストックはあるのにメイドが居ません。" + f_nStockNo, false);
  513. }
  514. this.BanishmentMaid(maid, f_bMan);
  515. }
  516. public void BanishmentMaid(Maid f_maid, bool f_bMan)
  517. {
  518. List<Maid> list = (!f_bMan) ? this.m_listStockMaid : this.m_listStockMan;
  519. if (f_maid.ActiveSlotNo != -1)
  520. {
  521. this.Deactivate(f_maid.ActiveSlotNo, f_bMan);
  522. }
  523. list.Remove(f_maid);
  524. if (f_maid != null)
  525. {
  526. UnityEngine.Object.DestroyImmediate(f_maid.gameObject);
  527. }
  528. }
  529. public Maid CharaVisible(int f_nActiveSlot, bool f_bVisible, bool f_bMan)
  530. {
  531. Maid[] array = (!f_bMan) ? this.m_gcActiveMaid : this.m_gcActiveMan;
  532. Maid maid = array[f_nActiveSlot];
  533. if (maid == null)
  534. {
  535. return null;
  536. }
  537. maid.Visible = f_bVisible;
  538. return maid;
  539. }
  540. public void SwapNewManBody(int activeSlot, bool toNewBody)
  541. {
  542. Maid man = this.GetMan(activeSlot);
  543. NDebug.Assert(man.boMAN, "can't swap maid body.");
  544. if ((toNewBody && !man.IsCrcBody) || (!toNewBody && man.IsCrcBody))
  545. {
  546. Maid maid = this.m_gcActiveMan[activeSlot];
  547. Maid pairMan = this.m_gcActiveMan[activeSlot].pairMan;
  548. this.m_gcActiveMan[activeSlot] = pairMan;
  549. this.m_objActiveMan[activeSlot] = pairMan.gameObject;
  550. pairMan.ActiveSlotNo = activeSlot;
  551. pairMan.gameObject.transform.SetParent(this.m_goAllOffset.transform, false);
  552. pairMan.transform.localPosition = maid.transform.localPosition;
  553. pairMan.transform.localRotation = maid.transform.localRotation;
  554. pairMan.transform.localScale = maid.transform.localScale;
  555. pairMan.baseOffset = maid.baseOffset;
  556. pairMan.baseEulerAngles = maid.baseEulerAngles;
  557. pairMan.motionOffset = maid.motionOffset;
  558. pairMan.motionOffsetGP03 = maid.motionOffsetGP03;
  559. pairMan.name = ((!pairMan.IsCrcBody) ? ("Man[" + activeSlot + "]") : ("NewMan[" + activeSlot + "]"));
  560. pairMan.Visible = maid.Visible;
  561. maid.gameObject.transform.SetParent(this.m_goStockMan.transform, false);
  562. maid.name = ((!maid.IsCrcBody) ? "Man" : "NewStockMan");
  563. maid.Visible = false;
  564. if (pairMan.IsCrcBody)
  565. {
  566. string strFileName = maid.GetProp(MPN.head).strFileName;
  567. string strFileName2 = pairMan.GetProp(MPN.head).strFileName;
  568. if (!string.Equals(strFileName.Replace("crc_", string.Empty), strFileName2.Replace("crc_", string.Empty)))
  569. {
  570. Debug.LogWarning("男新旧Bodyでパーツが異なるので修正しました。-> " + strFileName + " : " + strFileName2);
  571. pairMan.SetProp(MPN.head, strFileName, 0, false, false);
  572. pairMan.AllProcProp();
  573. }
  574. if (pairMan.ManColor != maid.ManColor)
  575. {
  576. pairMan.ManColor = maid.ManColor;
  577. pairMan.body0.ManColorUpdate();
  578. }
  579. }
  580. }
  581. }
  582. public void SwapNewMaidBody(int activeSlot, bool toNewBody)
  583. {
  584. this.SwapNewMaidBody(this.GetMaid(activeSlot), toNewBody);
  585. }
  586. public void SwapNewMaidBody(Maid maid, bool toNewBody)
  587. {
  588. maid.SwapNewMaidProp(toNewBody);
  589. }
  590. public void ExportBridgeGP03(string tempPath, int activeSlot)
  591. {
  592. this.ExportBridgeGP03(tempPath, this.GetMaid(activeSlot));
  593. }
  594. public void ExportBridgeGP03(string tempPath, Maid maid)
  595. {
  596. maid.ExportBridgeGP03(tempPath);
  597. }
  598. public bool ImportBreadgeGP03(string tempPath, int activeSlot)
  599. {
  600. return this.ImportBreadgeGP03(tempPath, this.GetMaid(activeSlot));
  601. }
  602. public bool ImportBreadgeGP03(string tempPath, Maid maid)
  603. {
  604. bool result;
  605. try
  606. {
  607. result = maid.ImportBreadgeGP03(tempPath);
  608. }
  609. catch (Exception ex)
  610. {
  611. Debug.LogError("ImportBreadgeGP03 Unexpected error : " + ex.Message);
  612. result = false;
  613. }
  614. return result;
  615. }
  616. public void ManAlphaUpdate()
  617. {
  618. for (int i = 0; i < this.m_listStockMan.Count; i++)
  619. {
  620. this.m_listStockMan[i].ManColorUpdate();
  621. }
  622. }
  623. public void LoadDefault()
  624. {
  625. if (!this.IsBusy())
  626. {
  627. for (int i = 0; i < 3; i++)
  628. {
  629. Maid maid = this.AddStockNpcMaid();
  630. maid.Visible = false;
  631. }
  632. for (int j = 0; j < 6; j++)
  633. {
  634. Maid maid2 = this.AddStockMan();
  635. this.SetActiveMan(maid2, j);
  636. maid2.Visible = false;
  637. }
  638. if (GameUty.IsExistFile("crc_mbluebody001_i_.menu", null))
  639. {
  640. for (int k = 0; k < 6; k++)
  641. {
  642. GameObject gameObject = new GameObject();
  643. gameObject.name = "NewMan";
  644. gameObject.transform.SetParent(this.m_goStockMan.transform, false);
  645. Maid maid3 = gameObject.AddComponent<Maid>();
  646. maid3.boNPC = false;
  647. maid3.Initialize("Man", true, true);
  648. maid3.Visible = false;
  649. maid3.Visible = false;
  650. (maid3.pairMan = this.GetMan(k)).pairMan = maid3;
  651. maid3.ActiveSlotNo = this.GetMan(k).ActiveSlotNo;
  652. maid3.SetProp(MPN.Hara, this.GetMan(k).GetProp(MPN.Hara).value, false);
  653. }
  654. }
  655. }
  656. }
  657. public void VisibleAll(bool f_bVisible)
  658. {
  659. for (int i = 0; i < this.GetMaidCount(); i++)
  660. {
  661. Maid maid = this.GetMaid(i);
  662. if (maid != null)
  663. {
  664. maid.Visible = f_bVisible;
  665. }
  666. }
  667. for (int j = 0; j < this.GetManCount(); j++)
  668. {
  669. Maid man = this.GetMan(j);
  670. if (man != null)
  671. {
  672. man.Visible = f_bVisible;
  673. }
  674. }
  675. }
  676. public bool IsBusy()
  677. {
  678. bool flag = false;
  679. for (int i = 0; i < this.m_gcActiveMaid.Length; i++)
  680. {
  681. Maid maid = this.GetMaid(i);
  682. if (maid != null)
  683. {
  684. flag |= maid.IsBusy;
  685. }
  686. }
  687. for (int j = 0; j < this.m_gcActiveMan.Length; j++)
  688. {
  689. Maid man = this.GetMan(j);
  690. if (man != null)
  691. {
  692. flag |= man.IsBusy;
  693. }
  694. }
  695. return flag;
  696. }
  697. public void ResetCharaPosAll()
  698. {
  699. this.SetCharaAllPos(Vector3.zero);
  700. this.SetCharaAllRot(Vector3.zero);
  701. this.CharaAllOfsetPos(Vector3.zero);
  702. this.CharaAllOfsetRot(Vector3.zero);
  703. for (int i = 0; i < this.m_listStockMaid.Count; i++)
  704. {
  705. Maid maid = this.m_listStockMaid[i];
  706. maid.SetPos(Vector3.zero);
  707. maid.SetRot(Vector3.zero);
  708. maid.baseOffset = (maid.baseEulerAngles = Vector3.zero);
  709. maid.rotateLinkMaid = string.Empty;
  710. maid.SetPosOffset(Vector3.zero);
  711. if (maid.body0 != null)
  712. {
  713. maid.body0.SetBoneHitHeightY(0f);
  714. }
  715. }
  716. for (int j = 0; j < this.m_listStockNpcMaid.Count; j++)
  717. {
  718. Maid maid2 = this.m_listStockNpcMaid[j];
  719. maid2.SetPos(Vector3.zero);
  720. maid2.SetRot(Vector3.zero);
  721. maid2.baseOffset = (maid2.baseEulerAngles = Vector3.zero);
  722. maid2.rotateLinkMaid = string.Empty;
  723. maid2.SetPosOffset(Vector3.zero);
  724. if (maid2.body0 != null)
  725. {
  726. maid2.body0.SetBoneHitHeightY(0f);
  727. }
  728. }
  729. for (int k = 0; k < this.m_listStockMan.Count; k++)
  730. {
  731. Maid maid3 = this.m_listStockMan[k];
  732. maid3.SetPos(Vector3.zero);
  733. maid3.SetRot(Vector3.zero);
  734. maid3.baseOffset = (maid3.baseEulerAngles = Vector3.zero);
  735. maid3.rotateLinkMaid = string.Empty;
  736. maid3.SetPosOffset(Vector3.zero);
  737. if (maid3.body0 != null)
  738. {
  739. maid3.body0.SetBoneHitHeightY(0f);
  740. }
  741. if (maid3.pairMan && maid3.pairMan.IsCrcBody)
  742. {
  743. Maid pairMan = maid3.pairMan;
  744. pairMan.SetPos(Vector3.zero);
  745. pairMan.SetRot(Vector3.zero);
  746. pairMan.baseOffset = (pairMan.baseEulerAngles = Vector3.zero);
  747. pairMan.rotateLinkMaid = string.Empty;
  748. pairMan.SetPosOffset(Vector3.zero);
  749. if (pairMan.body0 != null)
  750. {
  751. pairMan.body0.SetBoneHitHeightY(0f);
  752. }
  753. }
  754. }
  755. for (int l = 0; l < this.m_listStockNpcMan.Count; l++)
  756. {
  757. Maid maid4 = this.m_listStockNpcMan[l];
  758. maid4.SetPos(Vector3.zero);
  759. maid4.SetRot(Vector3.zero);
  760. maid4.baseOffset = (maid4.baseEulerAngles = Vector3.zero);
  761. maid4.rotateLinkMaid = string.Empty;
  762. maid4.SetPosOffset(Vector3.zero);
  763. if (maid4.body0 != null)
  764. {
  765. maid4.body0.SetBoneHitHeightY(0f);
  766. }
  767. if (maid4.pairMan && maid4.pairMan.IsCrcBody)
  768. {
  769. Maid pairMan2 = maid4.pairMan;
  770. pairMan2.SetPos(Vector3.zero);
  771. pairMan2.SetRot(Vector3.zero);
  772. pairMan2.baseOffset = (pairMan2.baseEulerAngles = Vector3.zero);
  773. pairMan2.rotateLinkMaid = string.Empty;
  774. pairMan2.SetPosOffset(Vector3.zero);
  775. if (pairMan2.body0 != null)
  776. {
  777. pairMan2.body0.SetBoneHitHeightY(0f);
  778. }
  779. }
  780. }
  781. }
  782. public void SetCharaAllPos(Vector3 f_vecLocalPos)
  783. {
  784. this.m_goActive.transform.localPosition = f_vecLocalPos;
  785. }
  786. public Vector3 GetCharaAllPos()
  787. {
  788. return this.m_goActive.transform.localPosition;
  789. }
  790. public void SetCharaAllRot(Vector3 f_vecLocalRot)
  791. {
  792. this.m_goActive.transform.localRotation = Quaternion.Euler(f_vecLocalRot);
  793. }
  794. public Vector3 GetCharaAllRot()
  795. {
  796. return this.m_goActive.transform.localRotation.eulerAngles;
  797. }
  798. public void CharaAllOfsetPos(Vector3 f_vecLocalPos)
  799. {
  800. this.m_goAllOffset.transform.localPosition = f_vecLocalPos;
  801. }
  802. public Vector3 GetCharaAllOfsetPos()
  803. {
  804. return this.m_goAllOffset.transform.localPosition;
  805. }
  806. public void CharaAllOfsetRot(Vector3 f_vecLocalRot)
  807. {
  808. this.m_goAllOffset.transform.localRotation = Quaternion.Euler(f_vecLocalRot);
  809. }
  810. public Vector3 GetCharaAllOfsetRot()
  811. {
  812. return this.m_goAllOffset.transform.localRotation.eulerAngles;
  813. }
  814. public void GetOffsetMaid(Maid f_maidMy, int f_nCSTSplitNum, out Vector3 f_vecOutCharOffset, out Vector3 f_vecOutAllOfs, CharacterMgr.CharaPer f_cIn)
  815. {
  816. f_cIn.vecOffsDouParGreater *= 100000f;
  817. f_cIn.vecOffsDouParLess *= 100000f;
  818. f_cIn.vecOffsShinChoGreater *= 100000f;
  819. f_cIn.vecOffsShinChoLess *= 100000f;
  820. f_cIn.vecOffsMuneLGreater *= 100000f;
  821. f_cIn.vecOffsMuneLLess *= 100000f;
  822. f_cIn.vecHaremDouPerGreater *= 100000f;
  823. f_cIn.vecHaremDouPerLess *= 100000f;
  824. f_cIn.vecHaremShinChoGreater *= 100000f;
  825. f_cIn.vecHaremShinChoLess *= 100000f;
  826. f_cIn.vecHaremMuneLGreater *= 100000f;
  827. f_cIn.vecHaremMuneLLess *= 100000f;
  828. NDebug.Assert(f_nCSTSplitNum != 0, "分割数は0以外でなければいけません。");
  829. MaidProp prop = f_maidMy.GetProp(MPN.DouPer);
  830. int num;
  831. if (prop.boTempDut)
  832. {
  833. num = prop.temp_value - 50;
  834. }
  835. else
  836. {
  837. num = prop.value - 50;
  838. }
  839. prop = f_maidMy.GetProp(MPN.sintyou);
  840. int num2;
  841. if (prop.boTempDut)
  842. {
  843. num2 = prop.temp_value - 50;
  844. }
  845. else
  846. {
  847. num2 = prop.value - 50;
  848. }
  849. Vector3 a;
  850. Vector3 a2;
  851. if (0 <= num)
  852. {
  853. a = (float)num * f_cIn.vecOffsDouParGreater / (float)f_nCSTSplitNum;
  854. a2 = (float)num * f_cIn.vecHaremDouPerGreater / (float)f_nCSTSplitNum;
  855. }
  856. else
  857. {
  858. int num3 = f_nCSTSplitNum * -1;
  859. a = (float)num * f_cIn.vecOffsDouParLess / (float)num3;
  860. a2 = (float)num * f_cIn.vecHaremDouPerLess / (float)num3;
  861. }
  862. Vector3 b;
  863. Vector3 b2;
  864. if (0 <= num2)
  865. {
  866. b = (float)num2 * f_cIn.vecOffsShinChoGreater / (float)f_nCSTSplitNum;
  867. b2 = (float)num2 * f_cIn.vecHaremShinChoGreater / (float)f_nCSTSplitNum;
  868. }
  869. else
  870. {
  871. int num4 = f_nCSTSplitNum * -1;
  872. b = (float)num2 * f_cIn.vecOffsShinChoLess / (float)num4;
  873. b2 = (float)num2 * f_cIn.vecHaremShinChoLess / (float)num4;
  874. }
  875. prop = f_maidMy.GetProp(MPN.MuneL);
  876. int num5;
  877. if (prop.boTempDut)
  878. {
  879. num5 = prop.temp_value - 50;
  880. }
  881. else
  882. {
  883. num5 = prop.value - 50;
  884. }
  885. Vector3 b3;
  886. Vector3 b4;
  887. if (0 <= num5)
  888. {
  889. b3 = (float)num5 * f_cIn.vecOffsMuneLGreater / (float)f_nCSTSplitNum;
  890. b4 = (float)num5 * f_cIn.vecHaremMuneLGreater / (float)f_nCSTSplitNum;
  891. }
  892. else
  893. {
  894. int num6 = f_nCSTSplitNum * -1;
  895. b3 = (float)num5 * f_cIn.vecOffsMuneLLess / (float)num6;
  896. b4 = (float)num5 * f_cIn.vecHaremMuneLLess / (float)num6;
  897. }
  898. f_vecOutCharOffset = a + b + b3;
  899. f_vecOutCharOffset /= 100000f;
  900. f_vecOutAllOfs = a2 + b2 + b4;
  901. f_vecOutAllOfs /= 100000f;
  902. }
  903. 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)
  904. {
  905. f_cIn.vecOffsDouParGreater *= 100000f;
  906. f_cIn.vecOffsDouParLess *= 100000f;
  907. f_cIn.vecOffsShinChoGreater *= 100000f;
  908. f_cIn.vecOffsShinChoLess *= 100000f;
  909. f_cIn.vecOffsMuneLGreater *= 100000f;
  910. f_cIn.vecOffsMuneLLess *= 100000f;
  911. f_cIn.vecHaremDouPerGreater *= 100000f;
  912. f_cIn.vecHaremDouPerLess *= 100000f;
  913. f_cIn.vecHaremShinChoGreater *= 100000f;
  914. f_cIn.vecHaremShinChoLess *= 100000f;
  915. f_cIn.vecHaremMuneLGreater *= 100000f;
  916. f_cIn.vecHaremMuneLLess *= 100000f;
  917. f_cPenisPer.vecPenisCommonBase *= 100000f;
  918. f_cPenisPer.vecPenisAmend *= 100000f;
  919. f_cPenisPer.vecPenisDouPerGreater *= 100000f;
  920. f_cPenisPer.vecPenisDouPerLess *= 100000f;
  921. f_cPenisPer.vecPenisShinchoGreater *= 100000f;
  922. f_cPenisPer.vecPenisShinchoLess *= 100000f;
  923. MaidProp prop = f_maidTarget.GetProp(MPN.DouPer);
  924. int num;
  925. if (prop.boTempDut)
  926. {
  927. num = prop.temp_value - 50;
  928. }
  929. else
  930. {
  931. num = prop.value - 50;
  932. }
  933. prop = f_maidTarget.GetProp(MPN.sintyou);
  934. int num2;
  935. if (prop.boTempDut)
  936. {
  937. num2 = prop.temp_value - 50;
  938. }
  939. else
  940. {
  941. num2 = prop.value - 50;
  942. }
  943. Vector3 a;
  944. if (0 <= num)
  945. {
  946. a = (float)num * f_cIn.vecOffsDouParGreater / (float)f_nCSTSplitNum;
  947. }
  948. else
  949. {
  950. int num3 = f_nCSTSplitNum * -1;
  951. a = (float)num * f_cIn.vecOffsDouParLess / (float)num3;
  952. }
  953. Vector3 b;
  954. if (0 <= num2)
  955. {
  956. b = (float)num2 * f_cIn.vecOffsShinChoGreater / (float)f_nCSTSplitNum;
  957. }
  958. else
  959. {
  960. int num4 = f_nCSTSplitNum * -1;
  961. b = (float)num2 * f_cIn.vecOffsShinChoLess / (float)num4;
  962. }
  963. prop = f_maidTarget.GetProp(MPN.MuneL);
  964. int num5;
  965. if (prop.boTempDut)
  966. {
  967. num5 = prop.temp_value - 50;
  968. }
  969. else
  970. {
  971. num5 = prop.value - 50;
  972. }
  973. Vector3 b2;
  974. if (0 <= num5)
  975. {
  976. b2 = (float)num5 * f_cIn.vecOffsMuneLGreater / (float)f_nCSTSplitNum;
  977. }
  978. else
  979. {
  980. int num6 = f_nCSTSplitNum * -1;
  981. b2 = (float)num5 * f_cIn.vecOffsMuneLLess / (float)num6;
  982. }
  983. Vector3 vector = a + b + b2;
  984. Vector3 a2 = Vector3.zero;
  985. Vector3 b3 = Vector3.zero;
  986. if (f_bPenisDetailMode)
  987. {
  988. if (0 <= num)
  989. {
  990. a2 = (float)num * (f_cPenisPer.vecPenisDouPerGreater - f_cPenisPer.vecPenisCommonBase) / (float)f_nCSTSplitNum;
  991. }
  992. else
  993. {
  994. int num3 = f_nCSTSplitNum * -1;
  995. a2 = (float)num * (f_cPenisPer.vecPenisDouPerLess - f_cPenisPer.vecPenisCommonBase) / (float)num3;
  996. }
  997. if (0 <= num2)
  998. {
  999. b3 = (float)num2 * (f_cPenisPer.vecPenisShinchoGreater - f_cPenisPer.vecPenisCommonBase) / (float)f_nCSTSplitNum;
  1000. }
  1001. else
  1002. {
  1003. int num4 = f_nCSTSplitNum * -1;
  1004. b3 = (float)num2 * (f_cPenisPer.vecPenisShinchoLess - f_cPenisPer.vecPenisCommonBase) / (float)num4;
  1005. }
  1006. }
  1007. f_vecOutPenis = a2 + b3 + f_cPenisPer.vecPenisCommonBase + f_cPenisPer.vecPenisAmend;
  1008. f_vecOutPenis /= 100000f;
  1009. f_vecOutCharOffset = vector;
  1010. f_vecOutCharOffset /= 100000f;
  1011. }
  1012. public Vector3 SetMaidOffsetPos(Maid f_maid, int f_nCSTSplitNum, CharacterMgr.CharaPer f_cIn)
  1013. {
  1014. Vector3 zero = Vector3.zero;
  1015. Vector3 zero2 = Vector3.zero;
  1016. this.GetOffsetMaid(f_maid, f_nCSTSplitNum, out zero, out zero2, f_cIn);
  1017. if (ScriptManager.isGP001Mode)
  1018. {
  1019. f_maid.motionOffset = zero;
  1020. f_maid.UpdateTransformData();
  1021. }
  1022. else
  1023. {
  1024. f_maid.SetPos(zero);
  1025. }
  1026. return zero2;
  1027. }
  1028. public void SetMaidOffsetOther(List<KeyValuePair<Maid, CharacterMgr.CharaPer>> f_listMaid, int f_nCSTSplitNum)
  1029. {
  1030. Vector3 vector = Vector3.zero;
  1031. Vector3 vector2 = Vector3.zero;
  1032. for (int i = 0; i < f_listMaid.Count; i++)
  1033. {
  1034. vector = this.SetMaidOffsetPos(f_listMaid[i].Key, f_nCSTSplitNum, f_listMaid[i].Value);
  1035. if (vector2.y < vector.y)
  1036. {
  1037. vector2 = vector;
  1038. }
  1039. }
  1040. if (!ScriptManager.isGP001Mode)
  1041. {
  1042. this.CharaAllOfsetPos(new Vector3(0f, vector2.y, 0f));
  1043. }
  1044. }
  1045. public void SetManOffsetPos(Maid f_manMy, Maid f_maidTarget, int f_nCSTSplitNum, bool f_bPenisDetailMode, CharacterMgr.CharaPer f_cIn, CharacterMgr.PenisPer f_cPenisPer)
  1046. {
  1047. Vector3 vecChinkoOffset;
  1048. Vector3 vector;
  1049. this.GetOffsetMan(f_maidTarget, f_nCSTSplitNum, f_bPenisDetailMode, out vecChinkoOffset, out vector, f_cIn, f_cPenisPer);
  1050. f_manMy.body0.vecChinkoOffset = vecChinkoOffset;
  1051. if (ScriptManager.isGP001Mode)
  1052. {
  1053. f_manMy.motionOffset = vector;
  1054. f_manMy.UpdateTransformData();
  1055. }
  1056. else
  1057. {
  1058. f_manMy.SetPos(vector);
  1059. }
  1060. }
  1061. public Texture2D ThumShot(Maid f_maid)
  1062. {
  1063. return GameMain.Instance.ThumCamera.GetComponent<ThumShot>().ShotThumPreset(f_maid);
  1064. }
  1065. public static string CreatePresetLowCapacityData(Maid maid, CharacterMgr.PresetType presset_type)
  1066. {
  1067. MemoryStream memoryStream = new MemoryStream();
  1068. BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
  1069. string result = string.Empty;
  1070. binaryWriter.Write("CM3D2_PRESET_S");
  1071. binaryWriter.Write(1570);
  1072. binaryWriter.Write((char)presset_type);
  1073. maid.SerializePropLowCapacity(binaryWriter);
  1074. maid.SerializeMultiColor(binaryWriter);
  1075. result = "^CM3D2P^" + Convert.ToBase64String(Utility.ZlibCompresss(memoryStream.ToArray()));
  1076. binaryWriter.Close();
  1077. memoryStream.Dispose();
  1078. return result;
  1079. }
  1080. public CharacterMgr.Preset PresetSave(Maid f_maid, CharacterMgr.PresetType f_type)
  1081. {
  1082. CharacterMgr.Preset preset = new CharacterMgr.Preset();
  1083. Texture2D texture2D = this.ThumShot(f_maid);
  1084. MemoryStream memoryStream = new MemoryStream();
  1085. BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
  1086. binaryWriter.Write("CM3D2_PRESET");
  1087. binaryWriter.Write(1570);
  1088. binaryWriter.Write((int)f_type);
  1089. if (texture2D != null)
  1090. {
  1091. byte[] array = texture2D.EncodeToPNG();
  1092. binaryWriter.Write(array.Length);
  1093. binaryWriter.Write(array);
  1094. }
  1095. else
  1096. {
  1097. binaryWriter.Write(0);
  1098. }
  1099. f_maid.SerializeProp(binaryWriter);
  1100. f_maid.SerializeMultiColor(binaryWriter);
  1101. f_maid.SerializeBody(binaryWriter);
  1102. string text = string.Concat(new string[]
  1103. {
  1104. "pre_",
  1105. f_maid.status.lastName,
  1106. f_maid.status.firstName,
  1107. "_",
  1108. DateTime.Now.ToString("yyyyMMddHHmmss")
  1109. });
  1110. text = UTY.FileNameEscape(text);
  1111. text += ".preset";
  1112. string presetDirectory = this.PresetDirectory;
  1113. if (!Directory.Exists(presetDirectory))
  1114. {
  1115. Directory.CreateDirectory(presetDirectory);
  1116. }
  1117. File.WriteAllBytes(presetDirectory + "\\" + text, memoryStream.ToArray());
  1118. memoryStream.Dispose();
  1119. preset.texThum = texture2D;
  1120. preset.strFileName = text;
  1121. preset.ePreType = f_type;
  1122. return preset;
  1123. }
  1124. public byte[] PresetSaveNotWriteFile(Maid f_maid, CharacterMgr.PresetType f_type)
  1125. {
  1126. CharacterMgr.Preset preset = new CharacterMgr.Preset();
  1127. Texture2D texture2D = this.ThumShot(f_maid);
  1128. MemoryStream memoryStream = new MemoryStream();
  1129. BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
  1130. binaryWriter.Write("CM3D2_PRESET");
  1131. binaryWriter.Write(1570);
  1132. binaryWriter.Write((int)f_type);
  1133. if (texture2D != null)
  1134. {
  1135. byte[] array = texture2D.EncodeToPNG();
  1136. binaryWriter.Write(array.Length);
  1137. binaryWriter.Write(array);
  1138. }
  1139. else
  1140. {
  1141. binaryWriter.Write(0);
  1142. }
  1143. f_maid.SerializeProp(binaryWriter);
  1144. f_maid.SerializeMultiColor(binaryWriter);
  1145. f_maid.SerializeBody(binaryWriter);
  1146. return memoryStream.ToArray();
  1147. }
  1148. public void PresetSaveAsQRCode(Maid f_maid, CharacterMgr.PresetType f_type)
  1149. {
  1150. Texture2D texture2D = Utility.CreateQRCodeTexture(CharacterMgr.CreatePresetLowCapacityData(f_maid, f_type), 512, 512);
  1151. Sprite sprite = Sprite.Create(texture2D, new Rect(0f, 0f, (float)texture2D.width, (float)texture2D.height), default(Vector2));
  1152. sprite.name = "qr";
  1153. byte[] bytes = texture2D.EncodeToPNG();
  1154. string text = string.Concat(new string[]
  1155. {
  1156. "pre_",
  1157. f_maid.status.lastName,
  1158. f_maid.status.firstName,
  1159. "_",
  1160. DateTime.Now.ToString("yyyyMMddHHmmss")
  1161. });
  1162. text = UTY.FileNameEscape(text);
  1163. text += ".png";
  1164. string presetDirectory = this.PresetDirectory;
  1165. if (!Directory.Exists(presetDirectory))
  1166. {
  1167. Directory.CreateDirectory(presetDirectory);
  1168. }
  1169. File.WriteAllBytes(presetDirectory + "\\" + text, bytes);
  1170. }
  1171. [Obsolete("GameUty.RidMenuDic廃止により使用不可", true)]
  1172. public static CharacterMgr.Preset LoadePresetLowCapacityData(string data_text)
  1173. {
  1174. if (string.IsNullOrEmpty(data_text) || data_text.IndexOf("^CM3D2P^") != 0)
  1175. {
  1176. return null;
  1177. }
  1178. data_text = data_text.Replace("^CM3D2P^", string.Empty);
  1179. byte[] array = Convert.FromBase64String(data_text);
  1180. array = Utility.ZlibUncompress(array);
  1181. CharacterMgr.Preset preset = new CharacterMgr.Preset();
  1182. preset.strFileName = string.Empty;
  1183. using (MemoryStream memoryStream = new MemoryStream(array))
  1184. {
  1185. BinaryReader binaryReader = new BinaryReader(memoryStream);
  1186. string a = binaryReader.ReadString();
  1187. NDebug.Assert(a == "CM3D2_PRESET_S", "低用量プリセットファイルのヘッダーが不正です。");
  1188. int num = binaryReader.ReadInt32();
  1189. preset.ePreType = (CharacterMgr.PresetType)binaryReader.ReadChar();
  1190. preset.listMprop = Maid.DeserializePropLowCapacity(binaryReader);
  1191. preset.aryPartsColor = Maid.DeserializeMultiColorPre(binaryReader);
  1192. binaryReader.Close();
  1193. }
  1194. return preset;
  1195. }
  1196. public CharacterMgr.Preset PresetLoad(string f_strFileName)
  1197. {
  1198. FileStream fileStream = new FileStream(f_strFileName, FileMode.Open);
  1199. if (fileStream == null)
  1200. {
  1201. return null;
  1202. }
  1203. byte[] buffer = new byte[fileStream.Length];
  1204. fileStream.Read(buffer, 0, (int)fileStream.Length);
  1205. fileStream.Close();
  1206. fileStream.Dispose();
  1207. BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer));
  1208. CharacterMgr.Preset result = this.PresetLoad(binaryReader, Path.GetFileName(f_strFileName));
  1209. binaryReader.Close();
  1210. return result;
  1211. }
  1212. public CharacterMgr.Preset PresetLoadFromResources(string f_strFileName)
  1213. {
  1214. TextAsset textAsset = Resources.Load("Preset/" + f_strFileName) as TextAsset;
  1215. NDebug.Assert(textAsset != null, "内部Resourcesからファイル[" + f_strFileName + "]を読み込めませんでした");
  1216. BinaryReader binaryReader = new BinaryReader(new MemoryStream(textAsset.bytes));
  1217. CharacterMgr.Preset result = this.PresetLoad(binaryReader, Path.GetFileName(f_strFileName));
  1218. binaryReader.Close();
  1219. Resources.UnloadAsset(textAsset);
  1220. return result;
  1221. }
  1222. public CharacterMgr.Preset PresetLoad(BinaryReader brRead, string f_strFileName)
  1223. {
  1224. CharacterMgr.Preset preset = new CharacterMgr.Preset();
  1225. preset.strFileName = f_strFileName;
  1226. string a = brRead.ReadString();
  1227. NDebug.Assert(a == "CM3D2_PRESET", "プリセットファイルのヘッダーが不正です。");
  1228. int num = brRead.ReadInt32();
  1229. preset.nVersion = num;
  1230. int ePreType = brRead.ReadInt32();
  1231. preset.ePreType = (CharacterMgr.PresetType)ePreType;
  1232. int num2 = brRead.ReadInt32();
  1233. if (num2 != 0)
  1234. {
  1235. byte[] data = brRead.ReadBytes(num2);
  1236. preset.texThum = new Texture2D(1, 1);
  1237. preset.texThum.LoadImage(data);
  1238. preset.texThum.wrapMode = TextureWrapMode.Clamp;
  1239. }
  1240. else
  1241. {
  1242. preset.texThum = null;
  1243. }
  1244. preset.listMprop = Maid.DeserializePropPre(brRead);
  1245. if (num >= 2 && num < 2000)
  1246. {
  1247. preset.aryPartsColor = Maid.DeserializeMultiColorPre(brRead);
  1248. }
  1249. if (num >= 200 && num < 2000)
  1250. {
  1251. Maid.DeserializeBodyPre(brRead);
  1252. }
  1253. return preset;
  1254. }
  1255. public void PresetDelete(CharacterMgr.Preset f_pre)
  1256. {
  1257. try
  1258. {
  1259. string presetDirectory = this.PresetDirectory;
  1260. string text = presetDirectory + "\\" + f_pre.strFileName;
  1261. if (File.Exists(text))
  1262. {
  1263. File.Delete(text);
  1264. }
  1265. else
  1266. {
  1267. Debug.LogWarning("PresetDelete削除失敗 ファイルがありません。" + text);
  1268. }
  1269. }
  1270. catch (Exception ex)
  1271. {
  1272. Debug.LogWarning("PresetDelete削除失敗 " + ex.Message);
  1273. }
  1274. }
  1275. public List<CharacterMgr.Preset> PresetListLoad()
  1276. {
  1277. List<CharacterMgr.Preset> list = new List<CharacterMgr.Preset>();
  1278. string presetDirectory = this.PresetDirectory;
  1279. if (!Directory.Exists(presetDirectory))
  1280. {
  1281. Directory.CreateDirectory(presetDirectory);
  1282. }
  1283. foreach (string f_strFileName in Directory.GetFiles(presetDirectory, "*.preset"))
  1284. {
  1285. CharacterMgr.Preset item = this.PresetLoad(f_strFileName);
  1286. list.Add(item);
  1287. }
  1288. return list;
  1289. }
  1290. private bool IsEnableMenu(string f_strFileName)
  1291. {
  1292. if (CharacterMgr.EditModeLookHaveItem)
  1293. {
  1294. return GameMain.Instance.CharacterMgr.status.IsHavePartsItem(f_strFileName) && GameUty.IsExistFile(f_strFileName, null);
  1295. }
  1296. return GameUty.IsExistFile(f_strFileName, null);
  1297. }
  1298. public void PresetSet(Maid f_maid, CharacterMgr.Preset f_prest, bool forceBody = false)
  1299. {
  1300. MaidProp[] array;
  1301. if (f_prest.ePreType == CharacterMgr.PresetType.Body)
  1302. {
  1303. array = (from mp in f_prest.listMprop
  1304. where (1 <= mp.idx && mp.idx <= 166) || (207 <= mp.idx && mp.idx <= 214)
  1305. select mp).ToArray<MaidProp>();
  1306. }
  1307. else if (f_prest.ePreType == CharacterMgr.PresetType.Wear)
  1308. {
  1309. array = (from mp in f_prest.listMprop
  1310. where 167 <= mp.idx && mp.idx <= 201
  1311. select mp).ToArray<MaidProp>();
  1312. }
  1313. else
  1314. {
  1315. array = (from mp in f_prest.listMprop
  1316. where (1 <= mp.idx && mp.idx <= 201) || (207 <= mp.idx && mp.idx <= 214)
  1317. select mp).ToArray<MaidProp>();
  1318. }
  1319. NDebug.Assert(array != null, "プリセットを実行する配列が空です。");
  1320. foreach (MaidProp maidProp in array)
  1321. {
  1322. if (maidProp.type != 3)
  1323. {
  1324. f_maid.SetProp((MPN)maidProp.idx, maidProp.value, false);
  1325. }
  1326. else
  1327. {
  1328. if (string.IsNullOrEmpty(maidProp.strFileName))
  1329. {
  1330. string strFileName = maidProp.strFileName;
  1331. if (CM3.dicDelItem.TryGetValue((MPN)maidProp.idx, out strFileName))
  1332. {
  1333. maidProp.strFileName = strFileName;
  1334. }
  1335. }
  1336. if (this.IsEnableMenu(maidProp.strFileName))
  1337. {
  1338. f_maid.SetProp(maidProp, forceBody);
  1339. }
  1340. else
  1341. {
  1342. f_maid.DelProp((MPN)maidProp.idx, false);
  1343. }
  1344. if (maidProp.listSubProp != null && maidProp.listSubProp.Count != 0)
  1345. {
  1346. f_maid.DelProp((MPN)maidProp.idx, false);
  1347. for (int j = 0; j < maidProp.listSubProp.Count; j++)
  1348. {
  1349. SubProp subProp = maidProp.listSubProp[j];
  1350. if (subProp != null)
  1351. {
  1352. if (this.IsEnableMenu(subProp.strFileName))
  1353. {
  1354. f_maid.SetSubProp((MPN)maidProp.idx, j, subProp.strFileName, subProp.nFileNameRID);
  1355. f_maid.GetSubProp((MPN)maidProp.idx, j).fTexMulAlpha = subProp.fTexMulAlpha;
  1356. }
  1357. else
  1358. {
  1359. f_maid.DelSubProp((MPN)maidProp.idx, j);
  1360. }
  1361. }
  1362. }
  1363. }
  1364. }
  1365. }
  1366. if ((f_prest.ePreType == CharacterMgr.PresetType.Body || f_prest.ePreType == CharacterMgr.PresetType.All) && f_prest.aryPartsColor != null)
  1367. {
  1368. for (int k = 0; k < f_prest.aryPartsColor.Length; k++)
  1369. {
  1370. f_maid.Parts.SetPartsColor((MaidParts.PARTS_COLOR)k, f_prest.aryPartsColor[k]);
  1371. }
  1372. }
  1373. if (Product.isPublic)
  1374. {
  1375. f_maid.SetProp(MPN.bra, "bra030_i_.menu", 0, false, false);
  1376. f_maid.SetProp(MPN.panz, "Pants030_i_.menu", 0, false, false);
  1377. }
  1378. f_maid.AllProcPropSeqStart();
  1379. }
  1380. public void CrcPresetCopy(Maid maid, CharacterMgr.Preset srcPreset)
  1381. {
  1382. maid.CreateProps();
  1383. for (int i = 207; i <= 214; i++)
  1384. {
  1385. maid.SetProp((MPN)i, string.Empty, 0, false, false);
  1386. }
  1387. foreach (MaidProp maidProp in srcPreset.listMprop)
  1388. {
  1389. MaidProp prop = maid.GetProp((MPN)maidProp.idx);
  1390. int type = prop.type;
  1391. maidProp.CopyTo(prop);
  1392. prop.type = type;
  1393. }
  1394. if (srcPreset.aryPartsColor != null)
  1395. {
  1396. for (int j = 0; j < srcPreset.aryPartsColor.Length; j++)
  1397. {
  1398. maid.Parts.SetPartsColor((MaidParts.PARTS_COLOR)j, srcPreset.aryPartsColor[j]);
  1399. }
  1400. }
  1401. maid.AllProcPropSeqStart();
  1402. }
  1403. public bool Serialize(BinaryWriter bwWrite)
  1404. {
  1405. bwWrite.Write("CM3D2_CHR_MGR");
  1406. bwWrite.Write(2002);
  1407. bwWrite.Write("dummy");
  1408. this.m_PlayerStatus.Serialize(bwWrite);
  1409. bwWrite.Write(this.m_listStockMan.Count);
  1410. for (int i = 0; i < this.m_listStockMan.Count; i++)
  1411. {
  1412. Maid maid = this.m_listStockMan[i];
  1413. maid.SerializeProp(bwWrite);
  1414. maid.SerializeMisc(bwWrite);
  1415. bwWrite.Write(maid.pairMan != null);
  1416. if (maid.pairMan != null)
  1417. {
  1418. maid.pairMan.SerializeProp(bwWrite);
  1419. maid.pairMan.SerializeMisc(bwWrite);
  1420. }
  1421. }
  1422. bwWrite.Write(this.m_listStockMaid.Count);
  1423. for (int j = 0; j < this.m_listStockMaid.Count; j++)
  1424. {
  1425. Maid maid2 = this.m_listStockMaid[j];
  1426. maid2.SerializeProp(bwWrite);
  1427. maid2.SerializeMultiColor(bwWrite);
  1428. maid2.status.Serialize(bwWrite);
  1429. maid2.SerializeMisc(bwWrite);
  1430. maid2.SerializeBody(bwWrite);
  1431. ImportCM.AddSaveDataReferenceToMaidGP03(this.SaveDataGUID, maid2.status.saveDataGuidGP03);
  1432. }
  1433. return true;
  1434. }
  1435. public bool Deserialize(BinaryReader brRead)
  1436. {
  1437. for (int i = 0; i < this.GetMaidCount(); i++)
  1438. {
  1439. Maid maid = this.GetMaid(i);
  1440. if (maid != null)
  1441. {
  1442. this.DeactivateMaid(maid);
  1443. }
  1444. }
  1445. while (this.GetStockMaidCount() != 0)
  1446. {
  1447. this.BanishmentMaid(0);
  1448. }
  1449. int manCount = this.GetManCount();
  1450. for (int j = 0; j < manCount; j++)
  1451. {
  1452. Maid man = this.GetMan(j);
  1453. if (man != null)
  1454. {
  1455. this.DeactivateMan(man);
  1456. }
  1457. }
  1458. string a = brRead.ReadString();
  1459. NDebug.Assert(a == "CM3D2_CHR_MGR", "セーブデータファイルのヘッダーが不正です。CHR_MGR");
  1460. int num = brRead.ReadInt32();
  1461. if (2002 <= num)
  1462. {
  1463. string text = brRead.ReadString();
  1464. }
  1465. this.m_PlayerStatus.Deserialize(brRead);
  1466. int num2 = brRead.ReadInt32();
  1467. int num3 = 0;
  1468. for (int k = 0; k < num2; k++)
  1469. {
  1470. Maid maid2 = this.m_listStockMan[k];
  1471. maid2.DeserializeProp(brRead);
  1472. maid2.DeserializeMisc(brRead);
  1473. if (2001 <= num && brRead.ReadBoolean())
  1474. {
  1475. if (maid2.pairMan == null)
  1476. {
  1477. GameObject gameObject = new GameObject("ManDummy");
  1478. gameObject.SetActive(false);
  1479. Maid maid3 = gameObject.AddComponent<Maid>();
  1480. maid3.Initialize("Man", true, true);
  1481. maid3.DeserializeProp(brRead);
  1482. maid3.DeserializeMisc(brRead);
  1483. maid3.Uninit();
  1484. UnityEngine.Object.Destroy(gameObject);
  1485. }
  1486. else
  1487. {
  1488. maid2.pairMan.DeserializeProp(brRead);
  1489. maid2.pairMan.DeserializeMisc(brRead);
  1490. }
  1491. }
  1492. if (maid2.ActiveSlotNo != -1)
  1493. {
  1494. this.SetActiveMan(maid2, maid2.ActiveSlotNo);
  1495. num3 = System.Math.Max(num3, maid2.ActiveSlotNo);
  1496. }
  1497. }
  1498. int num4 = this.GetManCount() - 2;
  1499. for (int l = num3 + 1; l < num4; l++)
  1500. {
  1501. this.SetActiveMan(this.GetStockMan(l), l);
  1502. }
  1503. int num5 = brRead.ReadInt32();
  1504. string text2 = string.Empty;
  1505. for (int m = 0; m < num5; m++)
  1506. {
  1507. Maid maid4 = this.AddStockMaid();
  1508. maid4.DeserializeProp(brRead);
  1509. maid4.DeserializeMultiColor(brRead);
  1510. maid4.status.Deserialize(brRead);
  1511. maid4.DeserializeMisc(brRead);
  1512. if (num >= 200)
  1513. {
  1514. maid4.DeserializeBody(brRead);
  1515. }
  1516. if (maid4.ActiveSlotNo != -1)
  1517. {
  1518. this.SetActiveMaid(maid4, maid4.ActiveSlotNo);
  1519. }
  1520. if (maid4.HasCrcBody)
  1521. {
  1522. if (maid4.IsCrcBody)
  1523. {
  1524. string strFileName;
  1525. if (!GameUty.IsExistFile(strFileName = maid4.GetProp(MPN.body).strFileName, null) || !GameUty.IsExistFile(strFileName = maid4.GetProp(MPN.head).strFileName, null))
  1526. {
  1527. text2 = text2 + maid4.status.fullNameJpStyle + "\n";
  1528. Debug.LogError("新Bodyエクスポート主要パーツ無し " + strFileName + " -> " + maid4.status.fullNameJpStyle);
  1529. this.SwapNewMaidBody(maid4, false);
  1530. maid4.RemoveCrcBodyProp();
  1531. }
  1532. }
  1533. else
  1534. {
  1535. string str = string.Empty;
  1536. MaidProp otherBodyProp = maid4.GetOtherBodyProp(MPN.body);
  1537. MaidProp otherBodyProp2 = maid4.GetOtherBodyProp(MPN.head);
  1538. if (otherBodyProp == null || (!GameUty.IsExistFile(str = otherBodyProp.strFileName, null) || otherBodyProp2 == null) || !GameUty.IsExistFile(str = otherBodyProp2.strFileName, null))
  1539. {
  1540. text2 = text2 + maid4.status.fullNameJpStyle + "\n";
  1541. Debug.LogError("新Bodyエクスポート主要パーツ無し " + str + " -> " + maid4.status.fullNameJpStyle);
  1542. maid4.RemoveCrcBodyProp();
  1543. }
  1544. }
  1545. }
  1546. }
  1547. if (!string.IsNullOrEmpty(text2))
  1548. {
  1549. NUty.WinMessageBox(NUty.GetWindowHandle(), "CRC新Bodyの主要パーツが見つからなかったのでCOM3D2旧Bodyに戻しました。再度CREditに行くと復旧します。\n" + text2, "情報", 48);
  1550. }
  1551. Maid.DeletedTmpThumCards();
  1552. GameMain.Instance.MsgWnd.ClearBackLogData();
  1553. if (this.status.isDaytime)
  1554. {
  1555. ScheduleAPI.OccurNightWork();
  1556. }
  1557. return true;
  1558. }
  1559. public bool SerializeAddition(BinaryWriter writer)
  1560. {
  1561. if (this.subMaidBackupStatusList == null)
  1562. {
  1563. this.subMaidBackupStatusList = new List<SubMaid.BackupStatus>();
  1564. }
  1565. byte[] array = new byte[0];
  1566. MemoryStream memoryStream = new MemoryStream();
  1567. BinaryWriter binaryWriter = new BinaryWriter(memoryStream);
  1568. int count = this.subMaidBackupStatusList.Count;
  1569. binaryWriter.Write(count);
  1570. for (int i = 0; i < this.subMaidBackupStatusList.Count; i++)
  1571. {
  1572. binaryWriter.Write(JsonUtility.ToJson(this.subMaidBackupStatusList[i]));
  1573. if (this.subMaidBackupStatusList[i].iconBinary == null)
  1574. {
  1575. this.subMaidBackupStatusList[i].iconBinary = new byte[0];
  1576. }
  1577. if (this.subMaidBackupStatusList[i].presetBinary == null)
  1578. {
  1579. this.subMaidBackupStatusList[i].presetBinary = new byte[0];
  1580. }
  1581. binaryWriter.Write(this.subMaidBackupStatusList[i].iconBinary.Length);
  1582. binaryWriter.Write(this.subMaidBackupStatusList[i].iconBinary);
  1583. binaryWriter.Write(this.subMaidBackupStatusList[i].presetBinary.Length);
  1584. binaryWriter.Write(this.subMaidBackupStatusList[i].presetBinary);
  1585. }
  1586. array = Utility.ZlibCompresss(memoryStream.ToArray());
  1587. writer.Write(array.Length);
  1588. writer.Write(array);
  1589. return true;
  1590. }
  1591. public bool DeserializeAddition(BinaryReader reader)
  1592. {
  1593. int count = reader.ReadInt32();
  1594. byte[] buffer = Utility.ZlibUncompress(reader.ReadBytes(count));
  1595. BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer));
  1596. if (this.subMaidBackupStatusList == null)
  1597. {
  1598. this.subMaidBackupStatusList = new List<SubMaid.BackupStatus>();
  1599. }
  1600. this.subMaidBackupStatusList.Clear();
  1601. int num = binaryReader.ReadInt32();
  1602. for (int i = 0; i < num; i++)
  1603. {
  1604. SubMaid.BackupStatus backupStatus = JsonUtility.FromJson<SubMaid.BackupStatus>(binaryReader.ReadString());
  1605. int count2 = binaryReader.ReadInt32();
  1606. backupStatus.iconBinary = binaryReader.ReadBytes(count2);
  1607. count2 = binaryReader.ReadInt32();
  1608. backupStatus.presetBinary = binaryReader.ReadBytes(count2);
  1609. this.subMaidBackupStatusList.Add(backupStatus);
  1610. }
  1611. return true;
  1612. }
  1613. public const int MaidStockMax = 999;
  1614. public const int ActiveMaidSlotCount = 18;
  1615. public const int NpcMaidCreateCount = 3;
  1616. public const int ActiveManSloatCount = 6;
  1617. public const int CHR_MGR_VERSION = 2002;
  1618. public string SaveDataGUID = string.Empty;
  1619. private static bool m_bEditMode;
  1620. public List<SubMaid.BackupStatus> subMaidBackupStatusList = new List<SubMaid.BackupStatus>();
  1621. private GameObject m_goCharacter;
  1622. private GameObject m_goActive;
  1623. private GameObject m_goAllOffset;
  1624. private GameObject m_goStock;
  1625. private GameObject m_goStockMaid;
  1626. private GameObject m_goStockNpcMaid;
  1627. private GameObject m_goStockMan;
  1628. private GameObject m_goStockNpcMan;
  1629. private Dictionary<string, GameObject> m_dicCaches = new Dictionary<string, GameObject>();
  1630. private GameObject m_goChaches;
  1631. private PlayerStatus.Status m_PlayerStatus;
  1632. private List<Maid> m_listStockMaid = new List<Maid>();
  1633. private List<Maid> m_listStockNpcMaid = new List<Maid>();
  1634. private List<Maid> m_listStockMan = new List<Maid>();
  1635. private List<Maid> m_listStockNpcMan = new List<Maid>();
  1636. private Maid[] m_gcActiveMaid = new Maid[18];
  1637. private GameObject[] m_objActiveMaid = new GameObject[18];
  1638. private Maid[] m_gcActiveMan = new Maid[6];
  1639. private GameObject[] m_objActiveMan = new GameObject[6];
  1640. public class NpcData
  1641. {
  1642. public NpcData(CsvParser csv, int lineY)
  1643. {
  1644. int num = 0;
  1645. this.uniqueName = csv.GetCellAsString(num++, lineY);
  1646. this.lastName = csv.GetCellAsString(num++, lineY);
  1647. this.firstName = csv.GetCellAsString(num++, lineY);
  1648. string cellAsString = csv.GetCellAsString(num++, lineY);
  1649. this.voiceGroup = VoiceGroup.Mob;
  1650. if (!string.IsNullOrEmpty(cellAsString))
  1651. {
  1652. try
  1653. {
  1654. this.voiceGroup = (VoiceGroup)Enum.Parse(typeof(VoiceGroup), cellAsString);
  1655. }
  1656. catch (Exception ex)
  1657. {
  1658. Debug.LogError(ex.StackTrace);
  1659. Debug.LogError(ex.Message);
  1660. }
  1661. }
  1662. this.presetFileName = Path.GetFileNameWithoutExtension(csv.GetCellAsString(num++, lineY));
  1663. if (!string.IsNullOrEmpty(this.presetFileName))
  1664. {
  1665. this.isResourcesLoad = !GameUty.FileSystem.IsExistentFile(this.presetFileName + ".preset");
  1666. }
  1667. this.menuFileName = Path.GetFileNameWithoutExtension(csv.GetCellAsString(num++, lineY));
  1668. if (!string.IsNullOrEmpty(this.menuFileName))
  1669. {
  1670. this.menuFileName += ".menu";
  1671. }
  1672. NDebug.Assert(string.IsNullOrEmpty(this.presetFileName) || string.IsNullOrEmpty(this.menuFileName), "プリセットとメニューファイル両方が指定されています");
  1673. }
  1674. public string firstNameTerm
  1675. {
  1676. get
  1677. {
  1678. return "SubMaid/" + this.uniqueName + "/名前";
  1679. }
  1680. }
  1681. public string lastNameTerm
  1682. {
  1683. get
  1684. {
  1685. return "SubMaid/" + this.uniqueName + "/苗字";
  1686. }
  1687. }
  1688. public void Apply(Maid maid, bool onlyPartsLoad = false)
  1689. {
  1690. if (maid == null || GameMain.Instance.CharacterMgr == null)
  1691. {
  1692. return;
  1693. }
  1694. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  1695. maid.ResetAll();
  1696. if (!maid.boMAN)
  1697. {
  1698. NDebug.Assert(string.IsNullOrEmpty(this.menuFileName), "メイドに対して男用のNPCデータを適用しようとしています");
  1699. if (!onlyPartsLoad)
  1700. {
  1701. maid.status.firstName = this.firstName;
  1702. maid.status.lastName = this.lastName;
  1703. if (Product.supportMultiLanguage)
  1704. {
  1705. string translation = LocalizationManager.GetTranslation(this.lastNameTerm, true, 0, true, false, null, Product.EnumConvert.ToI2LocalizeLanguageName(Product.defaultLanguage));
  1706. if (!string.IsNullOrEmpty(translation))
  1707. {
  1708. maid.status.lastName = translation;
  1709. }
  1710. translation = LocalizationManager.GetTranslation(this.firstNameTerm, true, 0, true, false, null, Product.EnumConvert.ToI2LocalizeLanguageName(Product.defaultLanguage));
  1711. if (!string.IsNullOrEmpty(translation))
  1712. {
  1713. maid.status.firstName = translation;
  1714. }
  1715. }
  1716. }
  1717. CharacterMgr.Preset preset = SaveData.GetPreset(this);
  1718. if (preset != null)
  1719. {
  1720. characterMgr.PresetSet(maid, preset, false);
  1721. }
  1722. else if (this.isResourcesLoad)
  1723. {
  1724. characterMgr.PresetSet(maid, characterMgr.PresetLoadFromResources(this.presetFileName), false);
  1725. }
  1726. else
  1727. {
  1728. using (AFileBase afileBase = GameUty.FileOpen(this.presetFileName + ".preset", null))
  1729. {
  1730. if (afileBase != null && afileBase.IsValid())
  1731. {
  1732. byte[] buffer = afileBase.ReadAll();
  1733. using (BinaryReader binaryReader = new BinaryReader(new MemoryStream(buffer), Encoding.UTF8))
  1734. {
  1735. characterMgr.PresetSet(maid, characterMgr.PresetLoad(binaryReader, this.presetFileName), false);
  1736. }
  1737. }
  1738. }
  1739. }
  1740. maid.status.voiceGroup = this.voiceGroup;
  1741. }
  1742. else
  1743. {
  1744. NDebug.Assert(string.IsNullOrEmpty(this.presetFileName), "男に対してメイド用のNPCデータを適用しようとしています");
  1745. maid.SetUpModel(this.menuFileName);
  1746. }
  1747. }
  1748. public readonly string uniqueName;
  1749. public readonly string firstName;
  1750. public readonly string lastName;
  1751. public readonly VoiceGroup voiceGroup;
  1752. public readonly string presetFileName;
  1753. public readonly string menuFileName;
  1754. public readonly bool isResourcesLoad;
  1755. }
  1756. public class CharaPer
  1757. {
  1758. public Vector3 vecOffsDouParGreater;
  1759. public Vector3 vecOffsDouParLess;
  1760. public Vector3 vecOffsShinChoGreater;
  1761. public Vector3 vecOffsShinChoLess;
  1762. public Vector3 vecOffsMuneLGreater;
  1763. public Vector3 vecOffsMuneLLess;
  1764. public Vector3 vecHaremDouPerGreater;
  1765. public Vector3 vecHaremDouPerLess;
  1766. public Vector3 vecHaremShinChoGreater;
  1767. public Vector3 vecHaremShinChoLess;
  1768. public Vector3 vecHaremMuneLGreater;
  1769. public Vector3 vecHaremMuneLLess;
  1770. }
  1771. public class PenisPer
  1772. {
  1773. public Vector3 vecPenisCommonBase;
  1774. public Vector3 vecPenisAmend;
  1775. public Vector3 vecPenisDouPerGreater;
  1776. public Vector3 vecPenisDouPerLess;
  1777. public Vector3 vecPenisShinchoGreater;
  1778. public Vector3 vecPenisShinchoLess;
  1779. }
  1780. public enum PresetType
  1781. {
  1782. Wear,
  1783. Body,
  1784. All
  1785. }
  1786. public class Preset
  1787. {
  1788. public int nVersion;
  1789. public Texture2D texThum;
  1790. public string strFileName;
  1791. public CharacterMgr.PresetType ePreType;
  1792. public List<MaidProp> listMprop = new List<MaidProp>();
  1793. public MaidParts.PartsColor[] aryPartsColor;
  1794. }
  1795. }