CharacterMgr.cs 42 KB

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