CharacterMgr.cs 42 KB

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