Maid.cs 87 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using MaidStatus;
  7. using UnityEngine;
  8. using XVI.AniLipSync;
  9. public class Maid : MonoBehaviour
  10. {
  11. public bool Visible
  12. {
  13. get
  14. {
  15. return this.m_visible;
  16. }
  17. set
  18. {
  19. GameObject gameObject = base.gameObject;
  20. this.m_visible = value;
  21. gameObject.SetActive(value);
  22. }
  23. }
  24. public MaidParts Parts
  25. {
  26. get
  27. {
  28. return this.m_Parts;
  29. }
  30. }
  31. public Status status
  32. {
  33. get
  34. {
  35. return this.m_Status;
  36. }
  37. }
  38. public AudioSourceMgr AudioMan
  39. {
  40. get
  41. {
  42. return (!(this.body0 != null)) ? null : this.body0.AudioMan;
  43. }
  44. }
  45. public bool IsBusy
  46. {
  47. get
  48. {
  49. return this.IsAllProcPropBusy && this.Visible;
  50. }
  51. }
  52. public bool IsAllProcPropBusy
  53. {
  54. get
  55. {
  56. return this.boAllProcPropBUSY;
  57. }
  58. }
  59. public FullBodyIKCtrl IKCtrl
  60. {
  61. get
  62. {
  63. return this.body0.IKCtrl;
  64. }
  65. }
  66. public int ActiveSlotNo
  67. {
  68. get
  69. {
  70. return this.m_nActiveSlotNo;
  71. }
  72. set
  73. {
  74. this.m_nActiveSlotNo = value;
  75. }
  76. }
  77. public Color ManColor
  78. {
  79. get
  80. {
  81. return this.m_colMan;
  82. }
  83. set
  84. {
  85. this.m_colMan = value;
  86. }
  87. }
  88. public int VoicePitch
  89. {
  90. get
  91. {
  92. return this.m_nVoicePitch;
  93. }
  94. set
  95. {
  96. if (this.body0 != null)
  97. {
  98. TBody tbody = this.body0;
  99. this.m_nVoicePitch = value;
  100. tbody.SetVoicePitch(value);
  101. }
  102. }
  103. }
  104. public static string ThumbnailDictionary
  105. {
  106. get
  107. {
  108. return Path.Combine(GameMain.Instance.SerializeStorageManager.StoreDirectoryPath, "Thumb");
  109. }
  110. }
  111. public static void UpdateMaidRanking()
  112. {
  113. if (!GameMain.Instance.CharacterMgr.status.isAvailableRanking)
  114. {
  115. Debug.Log("メイドランキングは未開放なので更新されませんでした");
  116. return;
  117. }
  118. List<KeyValuePair<long, Maid>> list = new List<KeyValuePair<long, Maid>>();
  119. CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
  120. for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
  121. {
  122. Maid stockMaid = characterMgr.GetStockMaid(i);
  123. if (!(stockMaid == null))
  124. {
  125. stockMaid.status.popularRank = 0;
  126. long key = (long)stockMaid.status.evaluation + stockMaid.status.sales;
  127. list.Add(new KeyValuePair<long, Maid>(key, stockMaid));
  128. }
  129. }
  130. list.Sort(delegate(KeyValuePair<long, Maid> a, KeyValuePair<long, Maid> b)
  131. {
  132. long num3 = b.Key - a.Key;
  133. return (num3 != 0L) ? ((0L >= num3) ? -1 : 1) : 0;
  134. });
  135. long num = -1L;
  136. int num2 = 0;
  137. foreach (KeyValuePair<long, Maid> keyValuePair in list)
  138. {
  139. if (keyValuePair.Key == 0L)
  140. {
  141. break;
  142. }
  143. if (keyValuePair.Key != num)
  144. {
  145. num2++;
  146. }
  147. keyValuePair.Value.status.popularRank = num2;
  148. num = keyValuePair.Key;
  149. }
  150. }
  151. private void Awake()
  152. {
  153. }
  154. public void OnMouseUp()
  155. {
  156. if (this.IsBusy || this.body0 == null || this.onMouseUpEvent == null)
  157. {
  158. return;
  159. }
  160. this.onMouseUpEvent(this);
  161. }
  162. public void Initialize(string f_strTypeName, bool f_bMan)
  163. {
  164. this.m_Parts = base.gameObject.AddComponent<MaidParts>();
  165. this.m_goOffset = new GameObject("Offset");
  166. this.m_goOffset.transform.parent = base.gameObject.transform;
  167. this.TypeName = f_strTypeName;
  168. this.boMAN = f_bMan;
  169. this.boOffsetY = true;
  170. this.body0 = base.gameObject.AddComponent<TBody>();
  171. this.body0.Init(this, f_bMan);
  172. int length = Enum.GetValues(typeof(MPN)).Length;
  173. this.m_aryMaidProp = new MaidProp[length];
  174. List<MaidProp> list = Maid.CreateInitMaidPropList();
  175. foreach (MaidProp mp in list)
  176. {
  177. this.AddProp(mp);
  178. }
  179. this.InitializeStatus();
  180. this.m_Parts.Initialize(base.gameObject, this);
  181. this.DelPrefabAll();
  182. if (this.boMAN)
  183. {
  184. this.SetUpModel("_I_man.menu");
  185. }
  186. else
  187. {
  188. this.SetUpModel("_I_default.menu");
  189. if (Product.isPublic)
  190. {
  191. this.SetProp(MPN.bra, "bra030_i_.menu", 0, false, false);
  192. this.SetProp(MPN.panz, "Pants030_i_.menu", 0, false, false);
  193. }
  194. }
  195. }
  196. public void InitializeStatus()
  197. {
  198. if (this.m_Status == null)
  199. {
  200. this.m_Status = new Status();
  201. this.m_Status.Initialize(this);
  202. }
  203. }
  204. public static List<MaidProp> CreateInitMaidPropList()
  205. {
  206. return new List<MaidProp>
  207. {
  208. Maid.CreateProp(0, int.MaxValue, 0, MPN.null_mpn, 0),
  209. Maid.CreateProp(0, 130, 10, MPN.MuneL, 1),
  210. Maid.CreateProp(0, 100, 0, MPN.MuneS, 1),
  211. Maid.CreateProp(0, 130, 10, MPN.MuneTare, 1),
  212. Maid.CreateProp(0, 100, 40, MPN.RegFat, 1),
  213. Maid.CreateProp(0, 100, 20, MPN.ArmL, 1),
  214. Maid.CreateProp(0, 100, 20, MPN.Hara, 1),
  215. Maid.CreateProp(0, 100, 40, MPN.RegMeet, 1),
  216. Maid.CreateProp(20, 80, 50, MPN.KubiScl, 2),
  217. Maid.CreateProp(0, 100, 50, MPN.UdeScl, 2),
  218. Maid.CreateProp(0, 100, 50, MPN.EyeScl, 2),
  219. Maid.CreateProp(0, 100, 50, MPN.EyeSclX, 2),
  220. Maid.CreateProp(0, 100, 50, MPN.EyeSclY, 2),
  221. Maid.CreateProp(0, 100, 50, MPN.EyePosX, 2),
  222. Maid.CreateProp(0, 100, 50, MPN.EyePosY, 2),
  223. Maid.CreateProp(0, 100, 0, MPN.EyeClose, 2),
  224. Maid.CreateProp(0, 100, 50, MPN.EyeBallPosX, 2),
  225. Maid.CreateProp(0, 100, 50, MPN.EyeBallPosY, 2),
  226. Maid.CreateProp(0, 100, 50, MPN.EyeBallSclX, 2),
  227. Maid.CreateProp(0, 100, 50, MPN.EyeBallSclY, 2),
  228. Maid.CreateProp(0, 1, 0, MPN.EarNone, 2),
  229. Maid.CreateProp(0, 100, 0, MPN.EarElf, 2),
  230. Maid.CreateProp(0, 100, 50, MPN.EarRot, 2),
  231. Maid.CreateProp(0, 100, 50, MPN.EarScl, 2),
  232. Maid.CreateProp(0, 100, 50, MPN.NosePos, 2),
  233. Maid.CreateProp(0, 100, 50, MPN.NoseScl, 2),
  234. Maid.CreateProp(0, 100, 0, MPN.FaceShape, 2),
  235. Maid.CreateProp(0, 100, 0, MPN.FaceShapeSlim, 2),
  236. Maid.CreateProp(0, 100, 50, MPN.MayuShapeIn, 2),
  237. Maid.CreateProp(0, 100, 50, MPN.MayuShapeOut, 2),
  238. Maid.CreateProp(0, 100, 50, MPN.MayuX, 2),
  239. Maid.CreateProp(0, 100, 50, MPN.MayuY, 2),
  240. Maid.CreateProp(0, 100, 50, MPN.MayuRot, 2),
  241. Maid.CreateProp(0, 100, 50, MPN.HeadX, 2),
  242. Maid.CreateProp(0, 100, 50, MPN.HeadY, 2),
  243. Maid.CreateProp(20, 80, 50, MPN.DouPer, 2),
  244. Maid.CreateProp(20, 80, 50, MPN.sintyou, 2),
  245. Maid.CreateProp(0, 100, 50, MPN.koshi, 2),
  246. Maid.CreateProp(0, 100, 50, MPN.kata, 2),
  247. Maid.CreateProp(0, 100, 50, MPN.west, 2),
  248. Maid.CreateProp(0, 100, 10, MPN.MuneUpDown, 2),
  249. Maid.CreateProp(0, 100, 40, MPN.MuneYori, 2),
  250. Maid.CreateProp(0, 100, 50, MPN.MuneYawaraka, 2),
  251. Maid.CreateProp(string.Empty, MPN.body, 3),
  252. Maid.CreateProp(string.Empty, MPN.head, 3),
  253. Maid.CreateProp(string.Empty, MPN.hairf, 3),
  254. Maid.CreateProp(string.Empty, MPN.hairr, 3),
  255. Maid.CreateProp(string.Empty, MPN.hairt, 3),
  256. Maid.CreateProp(string.Empty, MPN.hairs, 3),
  257. Maid.CreateProp(string.Empty, MPN.wear, 3),
  258. Maid.CreateProp(string.Empty, MPN.skirt, 3),
  259. Maid.CreateProp(string.Empty, MPN.mizugi, 3),
  260. Maid.CreateProp(string.Empty, MPN.bra, 3),
  261. Maid.CreateProp(string.Empty, MPN.panz, 3),
  262. Maid.CreateProp(string.Empty, MPN.stkg, 3),
  263. Maid.CreateProp(string.Empty, MPN.shoes, 3),
  264. Maid.CreateProp(string.Empty, MPN.headset, 3),
  265. Maid.CreateProp(string.Empty, MPN.glove, 3),
  266. Maid.CreateProp(string.Empty, MPN.acchead, 3),
  267. Maid.CreateProp(string.Empty, MPN.hairaho, 3),
  268. Maid.CreateProp(string.Empty, MPN.accha, 3),
  269. Maid.CreateProp(string.Empty, MPN.acchana, 3),
  270. Maid.CreateProp(string.Empty, MPN.acckamisub, 3),
  271. Maid.CreateProp(string.Empty, MPN.acckami, 3),
  272. Maid.CreateProp(string.Empty, MPN.accmimi, 3),
  273. Maid.CreateProp(string.Empty, MPN.accnip, 3),
  274. Maid.CreateProp(string.Empty, MPN.acckubi, 3),
  275. Maid.CreateProp(string.Empty, MPN.acckubiwa, 3),
  276. Maid.CreateProp(string.Empty, MPN.accheso, 3),
  277. Maid.CreateProp(string.Empty, MPN.accude, 3),
  278. Maid.CreateProp(string.Empty, MPN.accashi, 3),
  279. Maid.CreateProp(string.Empty, MPN.accsenaka, 3),
  280. Maid.CreateProp(string.Empty, MPN.accshippo, 3),
  281. Maid.CreateProp(string.Empty, MPN.accanl, 3),
  282. Maid.CreateProp(string.Empty, MPN.accvag, 3),
  283. Maid.CreateProp(string.Empty, MPN.megane, 3),
  284. Maid.CreateProp(string.Empty, MPN.accxxx, 3),
  285. Maid.CreateProp(string.Empty, MPN.handitem, 3),
  286. Maid.CreateProp(string.Empty, MPN.acchat, 3),
  287. Maid.CreateProp(string.Empty, MPN.haircolor, 3),
  288. Maid.CreateProp(string.Empty, MPN.skin, 3),
  289. Maid.CreateProp(string.Empty, MPN.acctatoo, 3),
  290. Maid.CreateProp(string.Empty, MPN.accnail, 3),
  291. Maid.CreateProp(string.Empty, MPN.underhair, 3),
  292. Maid.CreateProp(string.Empty, MPN.hokuro, 3),
  293. Maid.CreateProp(string.Empty, MPN.mayu, 3),
  294. Maid.CreateProp(string.Empty, MPN.lip, 3),
  295. Maid.CreateProp(string.Empty, MPN.eye, 3),
  296. Maid.CreateProp(string.Empty, MPN.eye_hi, 3),
  297. Maid.CreateProp(string.Empty, MPN.eye_hi_r, 3),
  298. Maid.CreateProp(string.Empty, MPN.chikubi, 3),
  299. Maid.CreateProp(string.Empty, MPN.chikubicolor, 3),
  300. Maid.CreateProp(string.Empty, MPN.eyewhite, 3),
  301. Maid.CreateProp(string.Empty, MPN.nose, 3),
  302. Maid.CreateProp(string.Empty, MPN.facegloss, 3),
  303. Maid.CreateProp(string.Empty, MPN.moza, 3),
  304. Maid.CreateProp(string.Empty, MPN.onepiece, 3),
  305. Maid.CreateProp(string.Empty, MPN.set_maidwear, 3),
  306. Maid.CreateProp(string.Empty, MPN.set_mywear, 3),
  307. Maid.CreateProp(string.Empty, MPN.set_underwear, 3),
  308. Maid.CreateProp(string.Empty, MPN.set_body, 3),
  309. Maid.CreateProp(string.Empty, MPN.folder_eye, 3),
  310. Maid.CreateProp(string.Empty, MPN.folder_mayu, 3),
  311. Maid.CreateProp(string.Empty, MPN.folder_underhair, 3),
  312. Maid.CreateProp(string.Empty, MPN.folder_skin, 3),
  313. Maid.CreateProp(string.Empty, MPN.folder_eyewhite, 3),
  314. Maid.CreateProp(string.Empty, MPN.kousoku_upper, 3),
  315. Maid.CreateProp(string.Empty, MPN.kousoku_lower, 3),
  316. Maid.CreateProp(string.Empty, MPN.seieki_naka, 3),
  317. Maid.CreateProp(string.Empty, MPN.seieki_hara, 3),
  318. Maid.CreateProp(string.Empty, MPN.seieki_face, 3),
  319. Maid.CreateProp(string.Empty, MPN.seieki_mune, 3),
  320. Maid.CreateProp(string.Empty, MPN.seieki_hip, 3),
  321. Maid.CreateProp(string.Empty, MPN.seieki_ude, 3),
  322. Maid.CreateProp(string.Empty, MPN.seieki_ashi, 3)
  323. };
  324. }
  325. public void Uninit()
  326. {
  327. this.Visible = false;
  328. this.boOffsetY = true;
  329. this.DelPrefabAll();
  330. Debug.Log("Uninit " + this.status.firstName);
  331. this.body0.UnInit();
  332. }
  333. private void OnDestroy()
  334. {
  335. this.DelPrefabAll();
  336. this.Uninit();
  337. }
  338. public void ManColorUpdate()
  339. {
  340. if (this.body0 != null)
  341. {
  342. this.body0.ManColorUpdate();
  343. }
  344. }
  345. public void ClearPropValueDefault()
  346. {
  347. foreach (MaidProp maidProp in this.m_aryMaidProp)
  348. {
  349. if (!(maidProp.name == "body"))
  350. {
  351. maidProp.temp_value = (maidProp.value = maidProp.value_Default);
  352. }
  353. }
  354. }
  355. public MaidProp GetProp(string tag)
  356. {
  357. return this.m_dicMaidProp[tag];
  358. }
  359. public MaidProp GetPropLower(string tagLower)
  360. {
  361. return (MaidProp)this.m_hashMaidPropLower[tagLower];
  362. }
  363. public MaidProp GetProp(MPN mpn)
  364. {
  365. return this.m_aryMaidProp[(int)mpn];
  366. }
  367. public static MaidProp CreateProp(string f_strDefFileName, MPN mpn, int type)
  368. {
  369. NDebug.Assert(type == 3, "プロパティオブジェクトのタイプが不正です。");
  370. MaidProp maidProp = new MaidProp();
  371. maidProp.name = mpn.ToString();
  372. maidProp.type = type;
  373. maidProp.listSubProp = null;
  374. maidProp.strFileName = f_strDefFileName;
  375. if (string.IsNullOrEmpty(maidProp.strFileName))
  376. {
  377. string strFileName = maidProp.strFileName;
  378. if (CM3.dicDelItem.TryGetValue(mpn, out strFileName))
  379. {
  380. maidProp.strFileName = strFileName;
  381. }
  382. }
  383. maidProp.nFileNameRID = maidProp.strFileName.ToLower().GetHashCode();
  384. maidProp.boDut = true;
  385. maidProp.boTempDut = false;
  386. maidProp.idx = (int)mpn;
  387. return maidProp;
  388. }
  389. public static MaidProp CreateProp(int minval, int maxval, int defval, MPN mpn, int type)
  390. {
  391. NDebug.Assert(type == 0 || type == 1 || type == 2, "プロパティオブジェクトのタイプが不正です。");
  392. MaidProp maidProp = new MaidProp();
  393. maidProp.name = mpn.ToString();
  394. maidProp.type = type;
  395. maidProp.min = minval;
  396. maidProp.max = maxval;
  397. if (defval < minval)
  398. {
  399. defval = minval;
  400. }
  401. if (defval > maxval)
  402. {
  403. defval = maxval;
  404. }
  405. maidProp.value_Default = defval;
  406. maidProp.listSubProp = null;
  407. maidProp.strFileName = string.Empty;
  408. maidProp.temp_value = (maidProp.value = defval);
  409. maidProp.idx = (int)mpn;
  410. maidProp.boDut = true;
  411. maidProp.boTempDut = false;
  412. return maidProp;
  413. }
  414. private void AddProp(MaidProp mp)
  415. {
  416. MPN idx = (MPN)mp.idx;
  417. this.m_dicMaidProp[idx.ToString()] = mp;
  418. this.m_aryMaidProp[(int)idx] = mp;
  419. this.m_hashMaidPropLower[idx.ToString().ToLower()] = mp;
  420. }
  421. private void AddProp(string f_strDefFileName, MPN mpn, int type)
  422. {
  423. this.AddProp(Maid.CreateProp(f_strDefFileName, mpn, type));
  424. }
  425. private void AddProp(int minval, int maxval, int defval, MPN mpn, int type)
  426. {
  427. this.AddProp(Maid.CreateProp(minval, maxval, defval, mpn, type));
  428. }
  429. public void Prop_AddValue(string tag, int val)
  430. {
  431. NDebug.Assert(this.m_dicMaidProp.ContainsKey(tag), "指定されたプロパティ名がありません。");
  432. this.Prop_AddValue(this.m_dicMaidProp[tag].idx, val);
  433. }
  434. public void Prop_AddValue(int idx, int val)
  435. {
  436. val += this.m_aryMaidProp[idx].value;
  437. if (this.m_aryMaidProp[idx].min > val)
  438. {
  439. val = this.m_aryMaidProp[idx].min;
  440. }
  441. if (this.m_aryMaidProp[idx].max < val)
  442. {
  443. val = this.m_aryMaidProp[idx].max;
  444. }
  445. if (this.m_aryMaidProp[idx].value_LinkMAX != 0 && this.m_aryMaidProp[this.m_aryMaidProp[idx].value_LinkMAX].value < val)
  446. {
  447. val = this.m_aryMaidProp[this.m_aryMaidProp[idx].value_LinkMAX].value;
  448. }
  449. if (this.m_aryMaidProp[idx].value != val)
  450. {
  451. this.m_aryMaidProp[idx].value = val;
  452. }
  453. this.m_aryMaidProp[idx].boDut = true;
  454. this.m_aryMaidProp[idx].boTempDut = false;
  455. }
  456. public void SetProp(string tag, int val, bool f_bTemp = false)
  457. {
  458. MPN idx = MPN.null_mpn;
  459. try
  460. {
  461. idx = (MPN)Enum.Parse(typeof(MPN), tag);
  462. }
  463. catch
  464. {
  465. NDebug.Assert("指定されたプロパティ名がありません。" + tag, false);
  466. }
  467. this.SetProp(idx, val, f_bTemp);
  468. }
  469. public void SetProp(MPN idx, int val, bool f_bTemp = false)
  470. {
  471. NDebug.Assert(idx != MPN.null_mpn, "指定されたプロパティ名がありません。" + base.tag);
  472. MaidProp maidProp = this.m_aryMaidProp[(int)idx];
  473. if (maidProp.min > val)
  474. {
  475. val = maidProp.min;
  476. }
  477. if (maidProp.max < val)
  478. {
  479. val = maidProp.max;
  480. }
  481. if (f_bTemp)
  482. {
  483. maidProp.temp_value = val;
  484. maidProp.boTempDut = true;
  485. }
  486. else
  487. {
  488. maidProp.value = val;
  489. maidProp.boDut = true;
  490. maidProp.boTempDut = false;
  491. }
  492. }
  493. public void SetProp(string tag, string filename, int f_nFileNameRID, bool f_bTemp = false, bool f_bNoScale = false)
  494. {
  495. NDebug.Assert(this.m_dicMaidProp.ContainsKey(tag), "指定されたプロパティ名がありません。" + tag);
  496. MaidProp mp = this.m_dicMaidProp[tag];
  497. this.SetProp(mp, filename, f_nFileNameRID, f_bTemp, f_bNoScale);
  498. }
  499. public void SetProp(MPN idx, string filename, int f_nFileNameRID, bool f_bTemp = false, bool f_bNoScale = false)
  500. {
  501. MaidProp mp = this.m_aryMaidProp[(int)idx];
  502. this.SetProp(mp, filename, f_nFileNameRID, f_bTemp, f_bNoScale);
  503. }
  504. public void SetProp(MaidProp mps)
  505. {
  506. bool flag = false;
  507. bool flag2 = false;
  508. bool flag3 = false;
  509. MaidProp prop = this.GetProp((MPN)mps.idx);
  510. bool flag4 = prop.m_dicTBodySkinPos.Count != 0;
  511. flag = (prop.m_dicTBodyAttachPos.Count != 0);
  512. flag2 = (prop.m_dicMaterialProp.Count != 0);
  513. flag3 = (prop.m_dicBoneLength.Count != 0);
  514. if (mps.idx != 43)
  515. {
  516. this.SetProp((MPN)mps.idx, mps.strFileName, mps.nFileNameRID, false, false);
  517. }
  518. if (flag4 || mps.m_dicTBodySkinPos.Count != 0)
  519. {
  520. MaidProp prop2 = this.GetProp((MPN)mps.idx);
  521. prop2.m_dicTBodySkinPos.Clear();
  522. foreach (KeyValuePair<TBody.SlotID, KeyValuePair<int, BoneAttachPos>> keyValuePair in mps.m_dicTBodySkinPos)
  523. {
  524. prop2.m_dicTBodySkinPos[keyValuePair.Key] = new KeyValuePair<int, BoneAttachPos>(keyValuePair.Value.Key, new BoneAttachPos(keyValuePair.Value.Value));
  525. }
  526. if (mps.idx != 43)
  527. {
  528. prop2.boDut = true;
  529. }
  530. prop2.boAdjustDut = true;
  531. }
  532. if (flag || mps.m_dicTBodyAttachPos.Count != 0)
  533. {
  534. MaidProp prop3 = this.GetProp((MPN)mps.idx);
  535. prop3.m_dicTBodyAttachPos.Clear();
  536. foreach (KeyValuePair<TBody.SlotID, Dictionary<string, KeyValuePair<int, VtxAttachPos>>> keyValuePair2 in mps.m_dicTBodyAttachPos)
  537. {
  538. Dictionary<string, KeyValuePair<int, VtxAttachPos>> dictionary = new Dictionary<string, KeyValuePair<int, VtxAttachPos>>();
  539. foreach (KeyValuePair<string, KeyValuePair<int, VtxAttachPos>> keyValuePair3 in keyValuePair2.Value)
  540. {
  541. dictionary[keyValuePair3.Key] = new KeyValuePair<int, VtxAttachPos>(keyValuePair3.Value.Key, new VtxAttachPos(keyValuePair3.Value.Value));
  542. }
  543. prop3.m_dicTBodyAttachPos[keyValuePair2.Key] = dictionary;
  544. }
  545. if (mps.idx != 43)
  546. {
  547. prop3.boDut = true;
  548. }
  549. prop3.boAdjustDut = true;
  550. }
  551. if (flag2 || mps.m_dicMaterialProp.Count != 0)
  552. {
  553. MaidProp prop4 = this.GetProp((MPN)mps.idx);
  554. prop4.m_dicMaterialProp.Clear();
  555. foreach (KeyValuePair<TBody.SlotID, KeyValuePair<int, MatPropSave>> keyValuePair4 in mps.m_dicMaterialProp)
  556. {
  557. prop4.m_dicMaterialProp[keyValuePair4.Key] = new KeyValuePair<int, MatPropSave>(keyValuePair4.Value.Key, new MatPropSave(keyValuePair4.Value.Value));
  558. }
  559. if (mps.idx != 43)
  560. {
  561. prop4.boDut = true;
  562. }
  563. prop4.boAdjustDut = true;
  564. }
  565. if (flag3 || mps.m_dicBoneLength.Count != 0)
  566. {
  567. MaidProp prop5 = this.GetProp((MPN)mps.idx);
  568. prop5.m_dicBoneLength.Clear();
  569. foreach (KeyValuePair<TBody.SlotID, KeyValuePair<int, Dictionary<string, float>>> keyValuePair5 in mps.m_dicBoneLength)
  570. {
  571. Dictionary<string, float> dictionary2 = new Dictionary<string, float>();
  572. foreach (KeyValuePair<string, float> keyValuePair6 in keyValuePair5.Value.Value)
  573. {
  574. dictionary2[keyValuePair6.Key] = keyValuePair6.Value;
  575. }
  576. prop5.m_dicBoneLength[keyValuePair5.Key] = new KeyValuePair<int, Dictionary<string, float>>(keyValuePair5.Value.Key, dictionary2);
  577. }
  578. if (mps.idx != 43)
  579. {
  580. prop5.boDut = true;
  581. }
  582. prop5.boAdjustDut = true;
  583. }
  584. }
  585. private void SetProp(MaidProp mp, string filename, int f_nFileNameRID, bool f_bTemp, bool f_bNoScale = false)
  586. {
  587. if (f_bTemp)
  588. {
  589. if (filename != mp.strTempFileName)
  590. {
  591. mp.boTempDut = true;
  592. mp.strTempFileName = filename;
  593. mp.bNoScale = f_bNoScale;
  594. if (f_nFileNameRID == 0)
  595. {
  596. mp.nTempFileNameRID = filename.ToLower().GetHashCode();
  597. }
  598. else
  599. {
  600. mp.nTempFileNameRID = f_nFileNameRID;
  601. }
  602. if (Product.isPublic)
  603. {
  604. if (mp.idx == 71 && filename.ToLower() != "pants030_i_.menu")
  605. {
  606. this.SetProp(mp, "pants030_i_.menu", 0, f_bTemp, f_bNoScale);
  607. return;
  608. }
  609. if (mp.idx == 70 && filename.ToLower() != "bra030_i_.menu")
  610. {
  611. this.SetProp(mp, "bra030_i_.menu", 0, f_bTemp, f_bNoScale);
  612. return;
  613. }
  614. }
  615. }
  616. }
  617. else
  618. {
  619. if (mp.strFileName != filename || mp.bSubDut || (97 <= mp.idx && mp.idx <= 100))
  620. {
  621. mp.boDut = true;
  622. }
  623. mp.strFileName = filename;
  624. mp.bNoScale = f_bNoScale;
  625. if (f_nFileNameRID == 0)
  626. {
  627. mp.nFileNameRID = filename.ToLower().GetHashCode();
  628. }
  629. else
  630. {
  631. mp.nFileNameRID = f_nFileNameRID;
  632. }
  633. mp.strTempFileName = string.Empty;
  634. mp.nTempFileNameRID = 0;
  635. if (mp.listSubProp != null)
  636. {
  637. mp.listSubProp.Clear();
  638. }
  639. mp.bSubDut = false;
  640. mp.m_dicTBodySkinPos.Clear();
  641. mp.m_dicTBodyAttachPos.Clear();
  642. mp.m_dicMaterialProp.Clear();
  643. mp.m_dicBoneLength.Clear();
  644. if (Product.isPublic)
  645. {
  646. f_nFileNameRID = mp.nFileNameRID;
  647. if (filename.Contains("_del"))
  648. {
  649. f_nFileNameRID = 0;
  650. }
  651. if (mp.idx == 96)
  652. {
  653. this.m_strBefOnepiceFileName = filename;
  654. this.m_nBefOnepiceRID = f_nFileNameRID;
  655. if (f_nFileNameRID != 0)
  656. {
  657. MaidProp prop = this.GetProp(MPN.wear);
  658. if (!prop.strFileName.Contains("_del"))
  659. {
  660. this.m_strBefWearFileName = prop.strFileName;
  661. this.m_nBefWearRID = prop.nFileNameRID;
  662. }
  663. MaidProp prop2 = this.GetProp(MPN.skirt);
  664. if (!prop2.strFileName.Contains("_del"))
  665. {
  666. this.m_strBefSkirtFileName = prop2.strFileName;
  667. this.m_nBefSkirtRID = prop2.nFileNameRID;
  668. }
  669. }
  670. }
  671. else if (mp.idx == 67)
  672. {
  673. this.m_strBefWearFileName = filename;
  674. this.m_nBefWearRID = f_nFileNameRID;
  675. if (f_nFileNameRID != 0 && this.m_nBefOnepiceRID != 0)
  676. {
  677. this.m_nBefOnepiceRID = 0;
  678. if (this.m_nBefSkirtRID != 0)
  679. {
  680. this.SetProp(MPN.skirt, this.m_strBefSkirtFileName, this.m_nBefSkirtRID, false, false);
  681. }
  682. }
  683. }
  684. else if (mp.idx == 68)
  685. {
  686. this.m_strBefSkirtFileName = filename;
  687. this.m_nBefSkirtRID = f_nFileNameRID;
  688. if (f_nFileNameRID != 0 && this.m_nBefOnepiceRID != 0)
  689. {
  690. this.m_nBefOnepiceRID = 0;
  691. if (this.m_nBefWearRID != 0)
  692. {
  693. this.SetProp(MPN.wear, this.m_strBefWearFileName, this.m_nBefWearRID, false, false);
  694. }
  695. }
  696. }
  697. else
  698. {
  699. if (mp.idx == 71 && filename.ToLower() != "pants030_i_.menu")
  700. {
  701. this.SetProp(mp, "pants030_i_.menu", 0, f_bTemp, f_bNoScale);
  702. return;
  703. }
  704. if (mp.idx == 70 && filename.ToLower() != "bra030_i_.menu")
  705. {
  706. this.SetProp(mp, "bra030_i_.menu", 0, f_bTemp, f_bNoScale);
  707. return;
  708. }
  709. }
  710. }
  711. }
  712. if (mp.boTempDut && mp.boDut)
  713. {
  714. string[] array = new string[6];
  715. array[0] = "SetProp:本元とTempのどうちらにも更新フラグが付いています。";
  716. int num = 1;
  717. MPN idx = (MPN)mp.idx;
  718. array[num] = idx.ToString();
  719. array[2] = " 元=";
  720. array[3] = mp.strFileName;
  721. array[4] = " Temp=";
  722. array[5] = mp.strTempFileName;
  723. Debug.LogWarning(string.Concat(array));
  724. }
  725. }
  726. public bool DelProp(MPN idx, bool f_bTemp = false)
  727. {
  728. string empty = string.Empty;
  729. if (CM3.dicDelItem.TryGetValue(idx, out empty))
  730. {
  731. this.SetProp(idx, empty, 0, f_bTemp, false);
  732. return true;
  733. }
  734. return false;
  735. }
  736. public void SetSubProp(MPN idx, int subno, string filename, int f_nFileNameRID = 0)
  737. {
  738. MaidProp maidProp = this.m_aryMaidProp[(int)idx];
  739. if (maidProp.listSubProp == null)
  740. {
  741. maidProp.listSubProp = new List<SubProp>();
  742. }
  743. if (maidProp.listSubProp.Count<SubProp>() < subno + 1)
  744. {
  745. int num = maidProp.listSubProp.Count<SubProp>();
  746. for (int i = num; i < subno + 1; i++)
  747. {
  748. maidProp.listSubProp.Add(null);
  749. }
  750. }
  751. SubProp subProp = maidProp.listSubProp[subno];
  752. if (subProp == null)
  753. {
  754. SubProp subProp2 = new SubProp();
  755. maidProp.listSubProp[subno] = subProp2;
  756. subProp = subProp2;
  757. }
  758. subProp.bDut = true;
  759. subProp.strFileName = filename;
  760. if (f_nFileNameRID == 0)
  761. {
  762. subProp.nFileNameRID = filename.ToLower().GetHashCode();
  763. }
  764. else
  765. {
  766. subProp.nFileNameRID = f_nFileNameRID;
  767. }
  768. maidProp.bSubDut = true;
  769. }
  770. public SubProp GetSubProp(MPN idx, int subno)
  771. {
  772. MaidProp maidProp = this.m_aryMaidProp[(int)idx];
  773. SubProp result = null;
  774. if (maidProp.listSubProp != null && subno < maidProp.listSubProp.Count)
  775. {
  776. result = maidProp.listSubProp[subno];
  777. }
  778. return result;
  779. }
  780. public void DelSubProp(MPN idx, int subno = -1)
  781. {
  782. MaidProp maidProp = this.m_aryMaidProp[(int)idx];
  783. if (maidProp.listSubProp != null)
  784. {
  785. if (subno == -1)
  786. {
  787. maidProp.listSubProp.Clear();
  788. }
  789. else if (maidProp.listSubProp.Count > subno)
  790. {
  791. SubProp subProp = maidProp.listSubProp[subno];
  792. if (subProp != null)
  793. {
  794. subProp.strFileName = string.Empty;
  795. subProp.nFileNameRID = 0;
  796. subProp.bDut = false;
  797. }
  798. }
  799. }
  800. maidProp.bSubDut = true;
  801. }
  802. public void ResetProp(string mpn, bool force_reset = false)
  803. {
  804. NDebug.Assert(this.m_dicMaidProp.ContainsKey(mpn), "指定されたプロパティ名がありません。" + base.tag);
  805. MaidProp mp = this.m_dicMaidProp[mpn];
  806. this.ResetProp(mp, force_reset);
  807. }
  808. public void ResetProp(MPN idx, bool force_reset = false)
  809. {
  810. MaidProp mp = this.m_aryMaidProp[(int)idx];
  811. this.ResetProp(mp, force_reset);
  812. }
  813. public void ResetProp(MaidProp mp, bool force_reset = false)
  814. {
  815. if ((mp.nTempFileNameRID != 0 && mp.nFileNameRID != mp.nTempFileNameRID) || mp.temp_value != mp.value || force_reset)
  816. {
  817. mp.boDut = true;
  818. mp.strTempFileName = string.Empty;
  819. mp.nTempFileNameRID = 0;
  820. mp.temp_value = 0;
  821. mp.boTempDut = false;
  822. }
  823. }
  824. public void ItemChangeTemp(string mpn, string name)
  825. {
  826. MaidProp prop = this.GetProp(mpn);
  827. SortedDictionary<string, string> sortedDictionary;
  828. string filename;
  829. if (prop.nFileNameRID != 0 && Menu.m_dicResourceRef.TryGetValue(prop.nFileNameRID, out sortedDictionary) && sortedDictionary.TryGetValue(name, out filename))
  830. {
  831. this.SetProp(mpn, filename, 0, true, false);
  832. }
  833. }
  834. public bool IsItemChange(string mpn, string name)
  835. {
  836. MaidProp prop = this.GetProp(mpn);
  837. return prop.nFileNameRID != 0 && Menu.m_dicResourceRef.ContainsKey(prop.nFileNameRID) && Menu.m_dicResourceRef[prop.nFileNameRID].ContainsKey(name) && this.GetProp(mpn).strTempFileName == Menu.m_dicResourceRef[prop.nFileNameRID][name];
  838. }
  839. public bool IsItemChangeEnabled(string mpn, string name)
  840. {
  841. MaidProp prop = this.GetProp(mpn);
  842. return prop.nFileNameRID != 0 && Menu.m_dicResourceRef.ContainsKey(prop.nFileNameRID) && Menu.m_dicResourceRef[prop.nFileNameRID].ContainsKey(name);
  843. }
  844. public void DutPropAll()
  845. {
  846. for (int i = 0; i < this.m_aryMaidProp.Length; i++)
  847. {
  848. MaidProp maidProp = this.m_aryMaidProp[i];
  849. maidProp.boDut = true;
  850. if (maidProp.listSubProp != null)
  851. {
  852. for (int j = 0; j < maidProp.listSubProp.Count; j++)
  853. {
  854. if (maidProp.listSubProp[j] != null)
  855. {
  856. maidProp.listSubProp[j].bDut = true;
  857. }
  858. }
  859. }
  860. }
  861. }
  862. public void SetUpModel(string f_strPresetMenuFileName)
  863. {
  864. Menu.ProcScript(this, f_strPresetMenuFileName, false, null);
  865. this.body0.FixMaskFlag();
  866. this.body0.FixVisibleFlag(false);
  867. this.AllProcPropSeqStart();
  868. if (!this.boMAN)
  869. {
  870. }
  871. }
  872. public void AllProcPropSeqStart()
  873. {
  874. this.boAllProcPropBUSY = true;
  875. this.boModelChg = false;
  876. this.AllProcProp2Fase = 0;
  877. this.AllProcProp2Cnt = 0;
  878. }
  879. private void AllProcPropSeq()
  880. {
  881. if (this.AllProcProp2Fase == 0)
  882. {
  883. while (this.AllProcProp2Fase == 0)
  884. {
  885. MaidProp maidProp = this.m_aryMaidProp[this.AllProcProp2Cnt];
  886. this.AllProcProp2Cnt++;
  887. if (this.m_aryMaidProp.Length == this.AllProcProp2Cnt)
  888. {
  889. this.AllProcProp2Cnt = 0;
  890. if (Array.Find<MaidProp>(this.m_aryMaidProp, (MaidProp m) => m.type == 3 && (m.boDut || m.boTempDut)) == null)
  891. {
  892. this.AllProcProp2Fase++;
  893. }
  894. }
  895. if (maidProp == null)
  896. {
  897. string str = "AllProcProp2_Proc MPNがNULLです。";
  898. MPN allProcProp2Cnt = (MPN)this.AllProcProp2Cnt;
  899. NDebug.Assert(str + allProcProp2Cnt.ToString(), false);
  900. }
  901. if (maidProp.type == 3 && this.ProcItem(this.m_dicMaidProp[maidProp.name]))
  902. {
  903. if (!this.boModelChg)
  904. {
  905. this.body0.FixVisibleFlag(true);
  906. this.boModelChg = true;
  907. }
  908. if (this.boMAN && maidProp.idx == 43)
  909. {
  910. for (int i = 44; i <= 100; i++)
  911. {
  912. this.GetProp((MPN)i).boDut = true;
  913. }
  914. this.GetProp(MPN.moza).boDut = true;
  915. }
  916. else if (maidProp.idx == 50 || maidProp.idx == 46 || maidProp.idx == 47 || maidProp.idx == 49 || maidProp.idx == 48)
  917. {
  918. this.GetProp(MPN.haircolor).boDut = true;
  919. }
  920. else if (maidProp.idx == 45)
  921. {
  922. MPN[] array = new MPN[]
  923. {
  924. MPN.skin,
  925. MPN.eye,
  926. MPN.mayu,
  927. MPN.eye_hi,
  928. MPN.eye_hi_r,
  929. MPN.EyeClose,
  930. MPN.EarNone,
  931. MPN.EarElf,
  932. MPN.EarRot,
  933. MPN.EarScl,
  934. MPN.NosePos,
  935. MPN.NoseScl,
  936. MPN.FaceShape,
  937. MPN.FaceShapeSlim,
  938. MPN.MayuShapeIn,
  939. MPN.MayuShapeOut,
  940. MPN.MayuX,
  941. MPN.MayuY,
  942. MPN.MayuRot,
  943. MPN.eye_hi_r,
  944. MPN.eyewhite,
  945. MPN.nose,
  946. MPN.facegloss,
  947. MPN.lip
  948. };
  949. foreach (MPN mpn in array)
  950. {
  951. this.GetProp(mpn).boDut = true;
  952. }
  953. }
  954. else if (maidProp.idx == 52)
  955. {
  956. MaidProp prop = this.GetProp(MPN.acctatoo);
  957. prop.boDut = true;
  958. if (prop.listSubProp != null)
  959. {
  960. for (int k = 0; k < prop.listSubProp.Count; k++)
  961. {
  962. if (prop.listSubProp[k] != null)
  963. {
  964. prop.listSubProp[k].bDut = true;
  965. }
  966. }
  967. }
  968. prop = this.GetProp(MPN.hokuro);
  969. prop.boDut = true;
  970. if (prop.listSubProp != null)
  971. {
  972. for (int l = 0; l < prop.listSubProp.Count; l++)
  973. {
  974. if (prop.listSubProp[l] != null)
  975. {
  976. prop.listSubProp[l].bDut = true;
  977. }
  978. }
  979. }
  980. this.GetProp(MPN.lip).boDut = true;
  981. this.GetProp(MPN.nose).boDut = true;
  982. this.GetProp(MPN.facegloss).boDut = true;
  983. }
  984. break;
  985. }
  986. }
  987. }
  988. else if (this.AllProcProp2Fase == 1)
  989. {
  990. this.AllProcProp2Fase++;
  991. }
  992. else if (this.AllProcProp2Fase == 2)
  993. {
  994. bool flag = false;
  995. foreach (MaidProp maidProp2 in this.m_dicMaidProp.Values)
  996. {
  997. if (maidProp2.type != 3)
  998. {
  999. flag |= this.ProcItem(maidProp2);
  1000. }
  1001. }
  1002. if (flag)
  1003. {
  1004. this.body0.ItemScaleReset();
  1005. }
  1006. this.AllProcProp2Fase++;
  1007. }
  1008. else if (this.AllProcProp2Fase == 3)
  1009. {
  1010. if (this.boModelChg)
  1011. {
  1012. this.body0.MulTexProc();
  1013. this.body0.FixMaskFlag();
  1014. this.body0.FixVisibleFlag(false);
  1015. }
  1016. this.AllProcProp2Fase++;
  1017. }
  1018. else if (this.AllProcProp2Fase == 4)
  1019. {
  1020. this.ProcSSParam();
  1021. this.AllProcProp2Fase++;
  1022. }
  1023. else if (this.AllProcProp2Fase == 5)
  1024. {
  1025. this.boAllProcPropBUSY = false;
  1026. }
  1027. }
  1028. public void AllProcProp()
  1029. {
  1030. if (Product.isPublic)
  1031. {
  1032. this.AllProcPropSeqStart();
  1033. while (this.boAllProcPropBUSY)
  1034. {
  1035. this.AllProcPropSeq();
  1036. }
  1037. return;
  1038. }
  1039. this.boModelChg = false;
  1040. float realtimeSinceStartup = Time.realtimeSinceStartup;
  1041. for (;;)
  1042. {
  1043. if (Array.Find<MaidProp>(this.m_aryMaidProp, (MaidProp m) => m.type == 3 && (m.boDut || m.boTempDut)) == null)
  1044. {
  1045. break;
  1046. }
  1047. for (int i = 0; i < this.m_aryMaidProp.Length; i++)
  1048. {
  1049. MaidProp maidProp = this.m_aryMaidProp[i];
  1050. string name = maidProp.name;
  1051. if (maidProp.type == 3 && this.ProcItem(this.m_dicMaidProp[name]))
  1052. {
  1053. if (!this.boModelChg)
  1054. {
  1055. this.body0.FixVisibleFlag(true);
  1056. this.boModelChg = true;
  1057. }
  1058. if (this.boMAN && maidProp.idx == 43)
  1059. {
  1060. for (int j = 44; j <= 100; j++)
  1061. {
  1062. this.GetProp((MPN)j).boDut = true;
  1063. }
  1064. this.GetProp(MPN.moza).boDut = true;
  1065. }
  1066. else if (maidProp.idx == 50 || maidProp.idx == 46 || maidProp.idx == 47 || maidProp.idx == 49 || maidProp.idx == 48)
  1067. {
  1068. this.GetProp(MPN.haircolor).boDut = true;
  1069. }
  1070. else if (maidProp.idx == 45)
  1071. {
  1072. MPN[] array = new MPN[]
  1073. {
  1074. MPN.skin,
  1075. MPN.eye,
  1076. MPN.mayu,
  1077. MPN.eye_hi,
  1078. MPN.eye_hi_r,
  1079. MPN.EyeClose,
  1080. MPN.EarNone,
  1081. MPN.EarElf,
  1082. MPN.EarRot,
  1083. MPN.EarScl,
  1084. MPN.NosePos,
  1085. MPN.NoseScl,
  1086. MPN.FaceShape,
  1087. MPN.FaceShapeSlim,
  1088. MPN.MayuShapeIn,
  1089. MPN.MayuShapeOut,
  1090. MPN.MayuX,
  1091. MPN.MayuY,
  1092. MPN.MayuRot,
  1093. MPN.eye_hi_r,
  1094. MPN.eyewhite,
  1095. MPN.nose,
  1096. MPN.facegloss,
  1097. MPN.lip
  1098. };
  1099. foreach (MPN mpn in array)
  1100. {
  1101. this.GetProp(mpn).boDut = true;
  1102. }
  1103. }
  1104. else if (maidProp.idx == 52)
  1105. {
  1106. MaidProp prop = this.GetProp(MPN.acctatoo);
  1107. prop.boDut = true;
  1108. if (prop.listSubProp != null)
  1109. {
  1110. for (int l = 0; l < prop.listSubProp.Count; l++)
  1111. {
  1112. if (prop.listSubProp[l] != null)
  1113. {
  1114. prop.listSubProp[l].bDut = true;
  1115. }
  1116. }
  1117. }
  1118. prop = this.GetProp(MPN.hokuro);
  1119. prop.boDut = true;
  1120. if (prop.listSubProp != null)
  1121. {
  1122. for (int n = 0; n < prop.listSubProp.Count; n++)
  1123. {
  1124. if (prop.listSubProp[n] != null)
  1125. {
  1126. prop.listSubProp[n].bDut = true;
  1127. }
  1128. }
  1129. }
  1130. this.GetProp(MPN.lip).boDut = true;
  1131. this.GetProp(MPN.nose).boDut = true;
  1132. this.GetProp(MPN.facegloss).boDut = true;
  1133. }
  1134. }
  1135. }
  1136. }
  1137. realtimeSinceStartup = Time.realtimeSinceStartup;
  1138. bool flag = false;
  1139. foreach (MaidProp maidProp2 in this.m_dicMaidProp.Values)
  1140. {
  1141. if (maidProp2.type != 3)
  1142. {
  1143. flag |= this.ProcItem(maidProp2);
  1144. }
  1145. }
  1146. if (flag)
  1147. {
  1148. this.body0.ItemScaleReset();
  1149. }
  1150. realtimeSinceStartup = Time.realtimeSinceStartup;
  1151. if (this.boModelChg)
  1152. {
  1153. this.body0.MulTexProc();
  1154. this.body0.FixMaskFlag();
  1155. this.body0.FixVisibleFlag(false);
  1156. }
  1157. realtimeSinceStartup = Time.realtimeSinceStartup;
  1158. this.ProcSSParam();
  1159. }
  1160. private bool ProcItem(MaidProp mp)
  1161. {
  1162. bool result = false;
  1163. string name = mp.name;
  1164. if (mp.type == 1)
  1165. {
  1166. if (mp.boTempDut)
  1167. {
  1168. mp.boTempDut = false;
  1169. this.body0.VertexMorph_FromProcItem(name, (float)mp.temp_value / 100f);
  1170. result = true;
  1171. }
  1172. if (mp.boDut)
  1173. {
  1174. mp.boDut = false;
  1175. this.body0.VertexMorph_FromProcItem(name, (float)mp.value / 100f);
  1176. result = true;
  1177. }
  1178. }
  1179. else if (mp.type == 2)
  1180. {
  1181. if (mp.boTempDut)
  1182. {
  1183. mp.boTempDut = false;
  1184. this.body0.BoneMorph_FromProcItem(name, (float)mp.temp_value / 100f);
  1185. result = true;
  1186. }
  1187. if (mp.boDut)
  1188. {
  1189. mp.boDut = false;
  1190. this.body0.BoneMorph_FromProcItem(name, (float)mp.value / 100f);
  1191. result = true;
  1192. }
  1193. }
  1194. else if (mp.type == 3)
  1195. {
  1196. if (Product.isPublic && (mp.boTempDut || mp.boDut) && (mp.idx == 44 || mp.idx == 55 || mp.idx == 62 || mp.idx == 63 || mp.idx == 44 || mp.idx == 82 || mp.idx == 90 || mp.idx == 91 || mp.idx == 93))
  1197. {
  1198. mp.boDut = false;
  1199. mp.boTempDut = false;
  1200. }
  1201. if (mp.boTempDut && mp.boDut)
  1202. {
  1203. string[] array = new string[6];
  1204. array[0] = "Item実行を、本元とTempを同時に更新しようとしました。";
  1205. int num = 1;
  1206. MPN idx = (MPN)mp.idx;
  1207. array[num] = idx.ToString();
  1208. array[2] = " 元=";
  1209. array[3] = mp.strFileName;
  1210. array[4] = " Temp=";
  1211. array[5] = mp.strTempFileName;
  1212. Debug.LogWarning(string.Concat(array));
  1213. }
  1214. if (mp.boTempDut)
  1215. {
  1216. if (!string.IsNullOrEmpty(mp.strTempFileName) && !Menu.ProcScript(this, mp, true, null))
  1217. {
  1218. Debug.LogWarning("メニューファイル " + mp.strFileName + " が開けませんでした。");
  1219. mp.nTempFileNameRID = 0;
  1220. mp.strTempFileName = string.Empty;
  1221. }
  1222. result = true;
  1223. mp.boTempDut = false;
  1224. if (97 <= mp.idx && mp.idx <= 100)
  1225. {
  1226. mp.nTempFileNameRID = 0;
  1227. mp.strTempFileName = string.Empty;
  1228. }
  1229. }
  1230. if (mp.boDut)
  1231. {
  1232. if (!string.IsNullOrEmpty(mp.strFileName) && !Menu.ProcScript(this, mp, false, null))
  1233. {
  1234. Debug.LogWarning("メニューファイル " + mp.strFileName + " が開けませんでした。");
  1235. if (this.DelProp((MPN)mp.idx, false))
  1236. {
  1237. Menu.ProcScript(this, mp, false, null);
  1238. }
  1239. }
  1240. result = true;
  1241. mp.boDut = false;
  1242. if (97 <= mp.idx && mp.idx <= 100)
  1243. {
  1244. mp.nFileNameRID = 0;
  1245. mp.strFileName = string.Empty;
  1246. }
  1247. }
  1248. if (mp.listSubProp != null)
  1249. {
  1250. for (int i = 0; i < mp.listSubProp.Count; i++)
  1251. {
  1252. SubProp subProp = mp.listSubProp[i];
  1253. if (subProp != null && subProp.bDut)
  1254. {
  1255. if (!Menu.ProcScript(this, subProp.strFileName, false, subProp))
  1256. {
  1257. Debug.LogWarning("サブメニューファイル " + subProp.strFileName + " が開けませんでした。");
  1258. mp.listSubProp[i] = null;
  1259. }
  1260. result = true;
  1261. subProp.bDut = false;
  1262. }
  1263. }
  1264. }
  1265. if (mp.boAdjustDut)
  1266. {
  1267. if (this.body0.isLoadedBody)
  1268. {
  1269. foreach (KeyValuePair<TBody.SlotID, Dictionary<string, KeyValuePair<int, VtxAttachPos>>> keyValuePair in mp.m_dicTBodyAttachPos)
  1270. {
  1271. TBodySkin tbodySkin = this.body0.goSlot[(int)keyValuePair.Key];
  1272. if (tbodySkin.morph != null)
  1273. {
  1274. foreach (KeyValuePair<string, KeyValuePair<int, VtxAttachPos>> keyValuePair2 in keyValuePair.Value)
  1275. {
  1276. tbodySkin.morph.SetAttachPointOffsetLocal(keyValuePair2.Key, keyValuePair2.Value.Value);
  1277. result = true;
  1278. }
  1279. }
  1280. }
  1281. }
  1282. mp.boAdjustDut = false;
  1283. }
  1284. }
  1285. return result;
  1286. }
  1287. public bool MayuDrawPriority
  1288. {
  1289. get
  1290. {
  1291. string materialProperty = this.body0.GetMaterialProperty("head", 3, "_ZTest2", "AUTO");
  1292. if (!string.IsNullOrEmpty(materialProperty))
  1293. {
  1294. float num = 0f;
  1295. if (float.TryParse(materialProperty, out num))
  1296. {
  1297. if ((int)(num + 0.5f) == 1)
  1298. {
  1299. return false;
  1300. }
  1301. if ((int)(num + 0.5f) == 7)
  1302. {
  1303. return true;
  1304. }
  1305. }
  1306. }
  1307. return false;
  1308. }
  1309. set
  1310. {
  1311. this.body0.SetMaterialProperty("mayu", "head", 3, "_ZTest2", "UnityEngine.Rendering.CompareFunction", (!value) ? "1" : "7", true);
  1312. }
  1313. }
  1314. public void SubPropAlpha(MPN f_mpn, int f_nSubNo, float f_fTexMulAlpha)
  1315. {
  1316. MaidProp maidProp = this.m_aryMaidProp[(int)f_mpn];
  1317. if (maidProp.listSubProp.Count <= f_nSubNo)
  1318. {
  1319. Debug.LogError("listSubProp の範囲を超えています。");
  1320. return;
  1321. }
  1322. SubProp subProp = maidProp.listSubProp[f_nSubNo];
  1323. if (subProp == null)
  1324. {
  1325. Debug.LogError("listSubProp に " + f_nSubNo + " 番はありません。");
  1326. return;
  1327. }
  1328. subProp.fTexMulAlpha = f_fTexMulAlpha;
  1329. }
  1330. public bool SerializeProp(BinaryWriter f_bwWrite)
  1331. {
  1332. f_bwWrite.Write("CM3D2_MPROP_LIST");
  1333. f_bwWrite.Write(1470);
  1334. f_bwWrite.Write(this.m_dicMaidProp.Count);
  1335. int num = 0;
  1336. foreach (KeyValuePair<string, MaidProp> keyValuePair in this.m_dicMaidProp)
  1337. {
  1338. f_bwWrite.Write(keyValuePair.Key);
  1339. keyValuePair.Value.Serialize(f_bwWrite);
  1340. num++;
  1341. }
  1342. return true;
  1343. }
  1344. public bool SerializePropLowCapacity(BinaryWriter writer)
  1345. {
  1346. NDebug.Assert(this.m_dicMaidProp.Count < 65535, "容量over");
  1347. writer.Write((char)this.m_dicMaidProp.Count);
  1348. NDebug.Assert(true, "MPN容量over");
  1349. foreach (KeyValuePair<string, MaidProp> keyValuePair in this.m_dicMaidProp)
  1350. {
  1351. MPN mpn = (MPN)Enum.Parse(typeof(MPN), keyValuePair.Key);
  1352. writer.Write((char)mpn);
  1353. keyValuePair.Value.SerializeLowCapacity(writer);
  1354. }
  1355. return true;
  1356. }
  1357. public bool SerializeMultiColor(BinaryWriter f_bwWrite)
  1358. {
  1359. return this.m_Parts.Serialize(f_bwWrite);
  1360. }
  1361. public bool SerializeMisc(BinaryWriter f_bwWrite)
  1362. {
  1363. f_bwWrite.Write("CM3D2_MAID_MISC");
  1364. f_bwWrite.Write(1470);
  1365. f_bwWrite.Write(this.m_nActiveSlotNo);
  1366. if (this.m_texIcon != null)
  1367. {
  1368. byte[] array = this.m_texIcon.EncodeToPNG();
  1369. f_bwWrite.Write(array.Length);
  1370. f_bwWrite.Write(array);
  1371. }
  1372. else
  1373. {
  1374. f_bwWrite.Write(0);
  1375. }
  1376. f_bwWrite.Write(this.m_strThumCardTime);
  1377. f_bwWrite.Write(this.m_colMan.r);
  1378. f_bwWrite.Write(this.m_colMan.g);
  1379. f_bwWrite.Write(this.m_colMan.b);
  1380. f_bwWrite.Write(this.m_colMan.a);
  1381. f_bwWrite.Write(this.m_nVoicePitch);
  1382. this.FixThumCard();
  1383. return true;
  1384. }
  1385. public bool SerializeBody(BinaryWriter f_bwWrite)
  1386. {
  1387. f_bwWrite.Write("CM3D2_MAID_BODY");
  1388. f_bwWrite.Write(1470);
  1389. return true;
  1390. }
  1391. public bool DeserializeProp(BinaryReader f_brRead)
  1392. {
  1393. string a = f_brRead.ReadString();
  1394. NDebug.Assert(a == "CM3D2_MPROP_LIST", "メイドプロパティリストのヘッダーが不正です。");
  1395. int num = f_brRead.ReadInt32();
  1396. int num2 = f_brRead.ReadInt32();
  1397. for (int i = 0; i < num2; i++)
  1398. {
  1399. string tag = f_brRead.ReadString();
  1400. MaidProp prop = this.GetProp(tag);
  1401. prop.Deserialize(f_brRead);
  1402. if (num <= 135 && prop.idx == 83 && Path.GetFileNameWithoutExtension(prop.strFileName.ToLower()) == "acckubi007_i_")
  1403. {
  1404. prop.boDut = true;
  1405. prop.strFileName = CM3.dicDelItem[MPN.acckubi];
  1406. prop.nFileNameRID = prop.strFileName.ToLower().GetHashCode();
  1407. prop.strTempFileName = string.Empty;
  1408. prop.nTempFileNameRID = 0;
  1409. }
  1410. }
  1411. if (num <= 110)
  1412. {
  1413. MaidProp prop2 = this.GetProp(MPN.EyeScl);
  1414. MaidProp prop3 = this.GetProp(MPN.EyeSclX);
  1415. prop3.value = prop2.value;
  1416. MaidProp prop4 = this.GetProp(MPN.EyeSclY);
  1417. prop4.value = prop2.value;
  1418. }
  1419. if (!this.boMAN && Product.isPublic)
  1420. {
  1421. this.SetProp(MPN.bra, "bra030_i_.menu", 0, false, false);
  1422. this.SetProp(MPN.panz, "Pants030_i_.menu", 0, false, false);
  1423. }
  1424. this.AllProcPropSeqStart();
  1425. return true;
  1426. }
  1427. public void DeserializeOldData(OldDataConverter.MaidData data, bool statusOnly = false)
  1428. {
  1429. NDebug.AssertNull(data != null);
  1430. this.status.Deserialize(data.statusReader, true);
  1431. using (MemoryStream memoryStream = new MemoryStream(data.ReadAppearanceByte()))
  1432. {
  1433. using (BinaryReader binaryReader = new BinaryReader(memoryStream))
  1434. {
  1435. this.DeserializeProp(binaryReader);
  1436. this.DeserializeMultiColor(binaryReader);
  1437. }
  1438. }
  1439. if (!statusOnly)
  1440. {
  1441. Texture2D texture2D = new Texture2D(1, 1, TextureFormat.ARGB32, false);
  1442. texture2D.LoadImage(data.ReadThumbnailByte());
  1443. byte[] array = data.ReadAppearanceByte();
  1444. this.SetThumIcon(texture2D);
  1445. string text = GameMain.Instance.CMSystem.CM3D2Path + "\\Thumb\\" + this.status.guid + ".png";
  1446. if (File.Exists(text))
  1447. {
  1448. string text2 = Path.Combine(Maid.ThumbnailDictionary, this.status.guid + ".png");
  1449. if (!File.Exists(text2))
  1450. {
  1451. File.Copy(text, text2);
  1452. }
  1453. }
  1454. }
  1455. }
  1456. public static List<MaidProp> DeserializePropPre(BinaryReader f_brRead)
  1457. {
  1458. List<MaidProp> list = new List<MaidProp>();
  1459. string a = f_brRead.ReadString();
  1460. NDebug.Assert(a == "CM3D2_MPROP_LIST", "メイドプロパティリストのヘッダーが不正です。");
  1461. int num = f_brRead.ReadInt32();
  1462. int num2 = f_brRead.ReadInt32();
  1463. HashSet<MPN> hashSet = new HashSet<MPN>();
  1464. for (int i = 0; i < num2; i++)
  1465. {
  1466. if (4 <= num)
  1467. {
  1468. string text = f_brRead.ReadString();
  1469. }
  1470. MaidProp maidProp = new MaidProp();
  1471. maidProp.Deserialize(f_brRead);
  1472. hashSet.Add((MPN)maidProp.idx);
  1473. list.Add(maidProp);
  1474. if (num <= 110 && maidProp.idx == 10)
  1475. {
  1476. list.Add(new MaidProp
  1477. {
  1478. type = maidProp.type,
  1479. idx = 11,
  1480. name = MPN.EyeSclX.ToString(),
  1481. value = maidProp.value,
  1482. min = maidProp.min,
  1483. max = maidProp.max,
  1484. boDut = true
  1485. });
  1486. list.Add(new MaidProp
  1487. {
  1488. type = maidProp.type,
  1489. idx = 12,
  1490. name = MPN.EyeSclY.ToString(),
  1491. value = maidProp.value,
  1492. min = maidProp.min,
  1493. max = maidProp.max,
  1494. boDut = true
  1495. });
  1496. }
  1497. }
  1498. if (num < 200)
  1499. {
  1500. list.Add(Maid.CreateProp(0, 100, 0, MPN.EyeClose, 2));
  1501. list.Add(Maid.CreateProp(0, 100, 0, MPN.FaceShape, 2));
  1502. list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuX, 2));
  1503. list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuY, 2));
  1504. }
  1505. if (num < 210)
  1506. {
  1507. list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallPosX, 2));
  1508. list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallPosY, 2));
  1509. list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallSclX, 2));
  1510. list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallSclY, 2));
  1511. }
  1512. if (!hashSet.Contains(MPN.FaceShapeSlim))
  1513. {
  1514. list.Add(Maid.CreateProp(0, 100, 0, MPN.FaceShapeSlim, 2));
  1515. }
  1516. if (!hashSet.Contains(MPN.EarNone))
  1517. {
  1518. list.Add(Maid.CreateProp(0, 1, 0, MPN.EarNone, 2));
  1519. }
  1520. if (!hashSet.Contains(MPN.EarElf))
  1521. {
  1522. list.Add(Maid.CreateProp(0, 100, 0, MPN.EarElf, 2));
  1523. }
  1524. if (!hashSet.Contains(MPN.EarRot))
  1525. {
  1526. list.Add(Maid.CreateProp(0, 100, 50, MPN.EarRot, 2));
  1527. }
  1528. if (!hashSet.Contains(MPN.EarScl))
  1529. {
  1530. list.Add(Maid.CreateProp(0, 100, 50, MPN.EarScl, 2));
  1531. }
  1532. if (!hashSet.Contains(MPN.NosePos))
  1533. {
  1534. list.Add(Maid.CreateProp(0, 100, 50, MPN.NosePos, 2));
  1535. }
  1536. if (!hashSet.Contains(MPN.NoseScl))
  1537. {
  1538. list.Add(Maid.CreateProp(0, 100, 50, MPN.NoseScl, 2));
  1539. }
  1540. if (!hashSet.Contains(MPN.MayuShapeIn))
  1541. {
  1542. list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuShapeIn, 2));
  1543. }
  1544. if (!hashSet.Contains(MPN.MayuShapeOut))
  1545. {
  1546. list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuShapeOut, 2));
  1547. }
  1548. if (!hashSet.Contains(MPN.MayuRot))
  1549. {
  1550. list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuRot, 2));
  1551. }
  1552. return list;
  1553. }
  1554. public static List<MaidProp> DeserializePropLowCapacity(BinaryReader reader)
  1555. {
  1556. List<MaidProp> list = Maid.CreateInitMaidPropList();
  1557. Dictionary<int, MaidProp> dictionary = new Dictionary<int, MaidProp>();
  1558. for (int i = 0; i < list.Count; i++)
  1559. {
  1560. dictionary.Add(list[i].idx, list[i]);
  1561. }
  1562. int num = (int)reader.ReadChar();
  1563. for (int j = 0; j < num; j++)
  1564. {
  1565. int key = (int)reader.ReadChar();
  1566. MaidProp maidProp = dictionary[key];
  1567. maidProp.DeserializeLowCapacity(reader);
  1568. }
  1569. return list;
  1570. }
  1571. public static MaidParts.PartsColor[] DeserializeMultiColorPre(BinaryReader f_brRead)
  1572. {
  1573. return MaidParts.DeserializePre(f_brRead);
  1574. }
  1575. public bool DeserializeMultiColor(BinaryReader f_brRead)
  1576. {
  1577. MaidParts.PartsColor[] array = MaidParts.DeserializePre(f_brRead);
  1578. for (int i = 0; i < array.Length; i++)
  1579. {
  1580. this.Parts.SetPartsColor((MaidParts.PARTS_COLOR)i, array[i]);
  1581. }
  1582. return true;
  1583. }
  1584. public bool DeserializeMisc(BinaryReader f_brRead)
  1585. {
  1586. string a = f_brRead.ReadString();
  1587. NDebug.Assert(a == "CM3D2_MAID_MISC", "メイドその他のヘッダーが不正です。");
  1588. int num = f_brRead.ReadInt32();
  1589. this.m_nActiveSlotNo = f_brRead.ReadInt32();
  1590. int num2 = f_brRead.ReadInt32();
  1591. if (num2 != 0)
  1592. {
  1593. byte[] data = f_brRead.ReadBytes(num2);
  1594. UnityEngine.Object.Destroy(this.m_texIcon);
  1595. this.m_texIcon = new Texture2D(1, 1, TextureFormat.ARGB32, false);
  1596. this.m_texIcon.LoadImage(data);
  1597. }
  1598. if (8 <= num)
  1599. {
  1600. this.m_strThumCardTime = f_brRead.ReadString();
  1601. }
  1602. this.m_colMan.r = f_brRead.ReadSingle();
  1603. this.m_colMan.g = f_brRead.ReadSingle();
  1604. this.m_colMan.b = f_brRead.ReadSingle();
  1605. this.m_colMan.a = f_brRead.ReadSingle();
  1606. if (202 <= num)
  1607. {
  1608. this.m_nVoicePitch = f_brRead.ReadInt32();
  1609. }
  1610. this.CheckOldThumCard();
  1611. return true;
  1612. }
  1613. public static bool DeserializeBodyPre(BinaryReader f_brRead)
  1614. {
  1615. return Maid.DeserializeBodyRead(f_brRead);
  1616. }
  1617. public bool DeserializeBody(BinaryReader f_brRead)
  1618. {
  1619. return Maid.DeserializeBodyRead(f_brRead);
  1620. }
  1621. public static bool DeserializeBodyRead(BinaryReader f_brRead)
  1622. {
  1623. string a = f_brRead.ReadString();
  1624. NDebug.Assert(a == "CM3D2_MAID_BODY", "メイドBodyヘッダーが不正です。");
  1625. int num = f_brRead.ReadInt32();
  1626. return true;
  1627. }
  1628. public void SetTBodySkinPos(MPN m_mpn, TBody.SlotID f_slot, Vector3 f_vPosLocal, Quaternion f_qRotLocal, Vector3 f_vScaleRate, bool f_bEnable)
  1629. {
  1630. MaidProp prop = this.GetProp(m_mpn);
  1631. BoneAttachPos boneAttachPos = new BoneAttachPos();
  1632. boneAttachPos.bEnable = f_bEnable;
  1633. boneAttachPos.pss.position = f_vPosLocal;
  1634. boneAttachPos.pss.rotation = f_qRotLocal;
  1635. boneAttachPos.pss.scale = f_vScaleRate;
  1636. prop.m_dicTBodySkinPos[f_slot] = new KeyValuePair<int, BoneAttachPos>(prop.nFileNameRID, boneAttachPos);
  1637. }
  1638. public BoneAttachPos GetTBodySkinPos(MPN m_mpn, TBody.SlotID f_slot)
  1639. {
  1640. BoneAttachPos result = null;
  1641. MaidProp prop = this.GetProp(m_mpn);
  1642. KeyValuePair<int, BoneAttachPos> keyValuePair;
  1643. if (prop.m_dicTBodySkinPos.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID)
  1644. {
  1645. result = keyValuePair.Value;
  1646. }
  1647. return result;
  1648. }
  1649. public void ClearTBodySkinPos(MPN m_mpn, TBody.SlotID f_slot)
  1650. {
  1651. MaidProp prop = this.GetProp(m_mpn);
  1652. prop.m_dicTBodySkinPos.Remove(f_slot);
  1653. }
  1654. public void SetAttachPointPos(MPN m_mpn, TBody.SlotID f_slot, int f_vtxcount, string f_apname, int f_vidx, Vector3 f_vPosLocal, Quaternion f_qRotLocal, Vector3 f_vScaleRate, bool f_bEnable)
  1655. {
  1656. MaidProp prop = this.GetProp(m_mpn);
  1657. Dictionary<string, KeyValuePair<int, VtxAttachPos>> dictionary;
  1658. if (!prop.m_dicTBodyAttachPos.TryGetValue(f_slot, out dictionary))
  1659. {
  1660. dictionary = (prop.m_dicTBodyAttachPos[f_slot] = new Dictionary<string, KeyValuePair<int, VtxAttachPos>>());
  1661. }
  1662. VtxAttachPos vtxAttachPos = new VtxAttachPos();
  1663. vtxAttachPos.vtxcount = f_vtxcount;
  1664. vtxAttachPos.vidx = f_vidx;
  1665. vtxAttachPos.prs.position = f_vPosLocal;
  1666. vtxAttachPos.prs.rotation = f_qRotLocal;
  1667. vtxAttachPos.prs.scale = f_vScaleRate;
  1668. vtxAttachPos.bEnable = f_bEnable;
  1669. dictionary[f_apname] = new KeyValuePair<int, VtxAttachPos>(prop.nFileNameRID, vtxAttachPos);
  1670. }
  1671. public VtxAttachPos GetAttachPointPos(MPN m_mpn, TBody.SlotID f_slot, int f_vtxcount, string f_apname)
  1672. {
  1673. VtxAttachPos result = null;
  1674. MaidProp prop = this.GetProp(m_mpn);
  1675. Dictionary<string, KeyValuePair<int, VtxAttachPos>> dictionary;
  1676. KeyValuePair<int, VtxAttachPos> keyValuePair;
  1677. if (prop.m_dicTBodyAttachPos.TryGetValue(f_slot, out dictionary) && dictionary.TryGetValue(f_apname, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID && keyValuePair.Value.vtxcount == f_vtxcount)
  1678. {
  1679. result = keyValuePair.Value;
  1680. }
  1681. return result;
  1682. }
  1683. public void ClearAttachPointPos(MPN m_mpn, TBody.SlotID f_slot, string f_apname)
  1684. {
  1685. MaidProp prop = this.GetProp(m_mpn);
  1686. Dictionary<string, KeyValuePair<int, VtxAttachPos>> dictionary;
  1687. if (prop.m_dicTBodyAttachPos.TryGetValue(f_slot, out dictionary))
  1688. {
  1689. dictionary.Remove(f_apname);
  1690. }
  1691. }
  1692. public void SetMaterialProperty(MPN m_mpn, TBody.SlotID f_slot, int f_nMatNo, string f_strPropName, string f_strTypeName, string f_strValue)
  1693. {
  1694. MaidProp prop = this.GetProp(m_mpn);
  1695. prop.m_dicMaterialProp[f_slot] = new KeyValuePair<int, MatPropSave>(prop.nFileNameRID, new MatPropSave(f_nMatNo, f_strPropName, f_strTypeName, f_strValue));
  1696. }
  1697. public MatPropSave GetMaterialProperty(MPN m_mpn, TBody.SlotID f_slot)
  1698. {
  1699. MaidProp prop = this.GetProp(m_mpn);
  1700. KeyValuePair<int, MatPropSave> keyValuePair;
  1701. if (prop.m_dicMaterialProp.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID)
  1702. {
  1703. return keyValuePair.Value;
  1704. }
  1705. return null;
  1706. }
  1707. public void SetHairLengthSaveToMP(MPN f_mpn, TBody.SlotID f_slot, string f_strName, float f_fValue)
  1708. {
  1709. MaidProp prop = this.GetProp(f_mpn);
  1710. KeyValuePair<int, Dictionary<string, float>> value;
  1711. if (!prop.m_dicBoneLength.TryGetValue(f_slot, out value))
  1712. {
  1713. Dictionary<TBody.SlotID, KeyValuePair<int, Dictionary<string, float>>> dicBoneLength = prop.m_dicBoneLength;
  1714. value = new KeyValuePair<int, Dictionary<string, float>>(prop.nFileNameRID, new Dictionary<string, float>());
  1715. dicBoneLength[f_slot] = value;
  1716. }
  1717. value.Value[f_strName] = f_fValue;
  1718. }
  1719. public bool GetHairLengthFromMP(MPN f_mpn, TBody.SlotID f_slot, string f_strName, out float f_fOutValue)
  1720. {
  1721. MaidProp prop = this.GetProp(f_mpn);
  1722. KeyValuePair<int, Dictionary<string, float>> keyValuePair;
  1723. if (prop.m_dicBoneLength.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID && keyValuePair.Value.TryGetValue(f_strName, out f_fOutValue))
  1724. {
  1725. return true;
  1726. }
  1727. f_fOutValue = 0.5f;
  1728. return false;
  1729. }
  1730. public void ClearHairLengthMP(MPN f_mpn, TBody.SlotID f_slot)
  1731. {
  1732. MaidProp prop = this.GetProp(f_mpn);
  1733. if (prop.m_dicBoneLength != null && prop.m_dicBoneLength.ContainsKey(f_slot))
  1734. {
  1735. prop.m_dicBoneLength.Remove(f_slot);
  1736. }
  1737. }
  1738. public bool NotExistThenClearHairLengthMP(MPN f_mpn, TBody.SlotID f_slot)
  1739. {
  1740. MaidProp prop = this.GetProp(f_mpn);
  1741. KeyValuePair<int, Dictionary<string, float>> keyValuePair;
  1742. if (prop.m_dicBoneLength.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key != prop.nFileNameRID)
  1743. {
  1744. prop.m_dicBoneLength.Remove(f_slot);
  1745. return true;
  1746. }
  1747. return false;
  1748. }
  1749. public void ThumShotCamMove()
  1750. {
  1751. GameMain.Instance.ThumCamera.GetComponent<ThumShot>().MoveTargetCard(this);
  1752. GameMain.Instance.ThumCamera.GetComponent<ThumShot>().MoveTargetThum(this);
  1753. }
  1754. public void ThumShot()
  1755. {
  1756. UnityEngine.Object.Destroy(this.m_texIcon);
  1757. this.m_texIcon = GameMain.Instance.ThumCamera.GetComponent<ThumShot>().ShotThumIcon(this);
  1758. this.SetThumCard(GameMain.Instance.ThumCamera.GetComponent<ThumShot>().ShotThumCard(this));
  1759. }
  1760. public void ThumShotCustom(string saveFileName, bool adjustmentCameraTransform)
  1761. {
  1762. ThumShot component = GameMain.Instance.ThumCamera.GetComponent<ThumShot>();
  1763. Texture2D texture2D;
  1764. if (adjustmentCameraTransform)
  1765. {
  1766. texture2D = component.ShotThumCard(this);
  1767. }
  1768. else
  1769. {
  1770. texture2D = component.ShotThumCardOriginal();
  1771. }
  1772. string text = Maid.ThumbnailDictionary;
  1773. if (!Directory.Exists(text))
  1774. {
  1775. Directory.CreateDirectory(text);
  1776. }
  1777. text = text + "/" + saveFileName;
  1778. UTY.SaveImage(texture2D, text);
  1779. UnityEngine.Object.Destroy(texture2D);
  1780. }
  1781. public void SetThumCard(Texture2D tex)
  1782. {
  1783. string thumbnailDictionary = Maid.ThumbnailDictionary;
  1784. if (!Directory.Exists(thumbnailDictionary))
  1785. {
  1786. Directory.CreateDirectory(thumbnailDictionary);
  1787. }
  1788. string f_strFileName = string.Empty;
  1789. this.m_strThumCardTime = DateTime.Now.ToString("yyyyMMddHHmmssfff");
  1790. f_strFileName = thumbnailDictionary + "/_tmp_thum_" + this.status.guid + ".png";
  1791. UTY.SaveImage(tex, f_strFileName);
  1792. UnityEngine.Object.Destroy(tex);
  1793. Texture2D thumIcon = this.GetThumIcon();
  1794. f_strFileName = thumbnailDictionary + "/icon_thum_" + this.status.guid + ".png";
  1795. UTY.SaveImage(thumIcon, f_strFileName);
  1796. }
  1797. public void SetThumIcon(Texture2D icon_tex)
  1798. {
  1799. this.m_texIcon = icon_tex;
  1800. }
  1801. public Texture2D GetThumIcon()
  1802. {
  1803. return this.m_texIcon;
  1804. }
  1805. public Texture2D GetThumCard()
  1806. {
  1807. Texture2D result = null;
  1808. string thumbnailDictionary = Maid.ThumbnailDictionary;
  1809. if (!Directory.Exists(thumbnailDictionary))
  1810. {
  1811. Directory.CreateDirectory(thumbnailDictionary);
  1812. }
  1813. string text = thumbnailDictionary + "/_tmp_thum_" + this.status.guid + ".png";
  1814. if (File.Exists(text))
  1815. {
  1816. result = UTY.LoadTexture(text);
  1817. }
  1818. else
  1819. {
  1820. text = thumbnailDictionary + "/" + this.status.guid + ".png";
  1821. if (File.Exists(text))
  1822. {
  1823. result = UTY.LoadTexture(text);
  1824. }
  1825. }
  1826. return result;
  1827. }
  1828. public static void DeletedTmpThumCards()
  1829. {
  1830. string thumbnailDictionary = Maid.ThumbnailDictionary;
  1831. if (!Directory.Exists(thumbnailDictionary))
  1832. {
  1833. return;
  1834. }
  1835. string[] files = Directory.GetFiles(thumbnailDictionary, "*", SearchOption.TopDirectoryOnly);
  1836. for (int i = 0; i < files.Length; i++)
  1837. {
  1838. string text = thumbnailDictionary + "\\";
  1839. int num = files[i].IndexOf(text);
  1840. if (num != 0)
  1841. {
  1842. files[i] = string.Empty;
  1843. }
  1844. else
  1845. {
  1846. string text2 = string.Empty;
  1847. try
  1848. {
  1849. text2 = files[i].Substring(text.Length, files[i].Length - text.Length);
  1850. }
  1851. catch
  1852. {
  1853. }
  1854. if (string.IsNullOrEmpty(text2))
  1855. {
  1856. files[i] = string.Empty;
  1857. }
  1858. else if (0 > text2.IndexOf(".png") || text2.IndexOf("_tmp_thum_") != 0)
  1859. {
  1860. files[i] = string.Empty;
  1861. }
  1862. }
  1863. }
  1864. for (int j = 0; j < files.Length; j++)
  1865. {
  1866. if (!string.IsNullOrEmpty(files[j]))
  1867. {
  1868. try
  1869. {
  1870. File.Delete(files[j]);
  1871. }
  1872. catch
  1873. {
  1874. }
  1875. }
  1876. }
  1877. }
  1878. private void FixThumCard()
  1879. {
  1880. string thumbnailDictionary = Maid.ThumbnailDictionary;
  1881. if (!Directory.Exists(thumbnailDictionary))
  1882. {
  1883. return;
  1884. }
  1885. string text = thumbnailDictionary + "/_tmp_thum_" + this.status.guid + ".png";
  1886. if (!File.Exists(text))
  1887. {
  1888. return;
  1889. }
  1890. string text2 = thumbnailDictionary + "/" + this.status.guid + ".png";
  1891. try
  1892. {
  1893. if (File.Exists(text2))
  1894. {
  1895. File.Delete(text2);
  1896. }
  1897. File.Move(text, text2);
  1898. }
  1899. catch
  1900. {
  1901. }
  1902. }
  1903. private void CheckOldThumCard()
  1904. {
  1905. string thumbnailDictionary = Maid.ThumbnailDictionary;
  1906. if (!Directory.Exists(thumbnailDictionary))
  1907. {
  1908. return;
  1909. }
  1910. string text = string.Concat(new string[]
  1911. {
  1912. thumbnailDictionary,
  1913. "/",
  1914. this.status.guid,
  1915. this.m_strThumCardTime,
  1916. ".png"
  1917. });
  1918. if (!File.Exists(text))
  1919. {
  1920. return;
  1921. }
  1922. File.Move(text, thumbnailDictionary + "/" + this.status.guid + ".png");
  1923. }
  1924. public void ProcSSParam()
  1925. {
  1926. this.boBallGAG = (this.body0.GetSlotUserParam("accHa", "口枷") > 0);
  1927. this.boNoseFook = (this.body0.GetSlotUserParam("accHana", "鼻フック") > 0);
  1928. }
  1929. public void StopAnime(string fn = "")
  1930. {
  1931. this.body0.StopAnime(fn);
  1932. }
  1933. public string CrossFade(string fn, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f)
  1934. {
  1935. return this.CrossFade(fn, GameUty.FileSystem, additive, loop, boAddQue, val, weight);
  1936. }
  1937. public string CrossFade(string fn, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f)
  1938. {
  1939. return this.body0.CrossFade(fn, fileSystem, additive, loop, boAddQue, val, weight);
  1940. }
  1941. public string CrossFadeAbsolute(string fn, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f)
  1942. {
  1943. return this.CrossFadeAbsolute(fn, GameUty.FileSystem, additive, loop, boAddQue, val, weight);
  1944. }
  1945. public string CrossFadeAbsolute(string fn, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f)
  1946. {
  1947. return this.body0.CrossFadeAbsolute(fn, fileSystem, additive, loop, boAddQue, val, weight);
  1948. }
  1949. public void CacheAnime(string fn, bool loadMuneL = false, bool loadMuneR = false)
  1950. {
  1951. this.body0.CacheLoadAnime(GameUty.FileSystem, Path.ChangeExtension(fn, ".anm"), loadMuneL, loadMuneR);
  1952. }
  1953. public Animation GetAnimation()
  1954. {
  1955. return this.body0.GetAnimation();
  1956. }
  1957. private void Start()
  1958. {
  1959. }
  1960. public void ResetAll()
  1961. {
  1962. this.FaceAnime("通常", 0f, 0);
  1963. this.FaceBlend("無し");
  1964. this.OpenMouth(false);
  1965. this.EyeToReset(0f);
  1966. this.DelPrefabAll();
  1967. string[] array = new string[]
  1968. {
  1969. "handitem",
  1970. "kousoku_upper",
  1971. "kousoku_lower",
  1972. "eye_hi",
  1973. "skirt",
  1974. "panz",
  1975. "mizugi",
  1976. "onepiece",
  1977. "accanl",
  1978. "accvag",
  1979. "KubiScl",
  1980. "UdeScl",
  1981. "DouPer",
  1982. "sintyou",
  1983. "kata",
  1984. "seieki_naka"
  1985. };
  1986. for (int i = 0; i < array.Length; i++)
  1987. {
  1988. this.ResetProp(array[i], false);
  1989. }
  1990. if (this.body0 != null && this.body0.isLoadedBody)
  1991. {
  1992. this.body0.SetMaskMode(TBody.MaskMode.None);
  1993. for (int j = 10; j <= 20; j++)
  1994. {
  1995. this.body0.MulTexRemove("body", 0, "_MainTex", j);
  1996. this.body0.MulTexRemove("body", 0, "_ShadowTex", j);
  1997. this.body0.MulTexRemove("head", 5, "_MainTex", j);
  1998. this.body0.MulTexRemove("head", 5, "_ShadowTex", j);
  1999. }
  2000. this.body0.MulTexProc("body");
  2001. this.body0.MulTexProc("head");
  2002. this.SetModeHairR(TBody.ModeHirR.Normal);
  2003. if (this.body0.isLoadedBody)
  2004. {
  2005. this.body0.MuneYureL(1f);
  2006. this.body0.MuneYureR(1f);
  2007. this.IKTargetToBone("左手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, IKCtrlData.IKExecTiming.Normal);
  2008. this.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, IKCtrlData.IKExecTiming.Normal);
  2009. }
  2010. }
  2011. }
  2012. public void Lipsync(bool f_bEnable)
  2013. {
  2014. this.boLipsync = f_bEnable;
  2015. }
  2016. public void LipSyncEnabled(bool enabled)
  2017. {
  2018. this.lipSyncEnabled = enabled;
  2019. }
  2020. public bool MicLipSync
  2021. {
  2022. get
  2023. {
  2024. return this.m_MicLipSync;
  2025. }
  2026. }
  2027. public void SetMicLipSync(bool is_start)
  2028. {
  2029. if (!this.AudioMan)
  2030. {
  2031. Debug.LogError("AudioManが見つかりません");
  2032. return;
  2033. }
  2034. this.m_MicLipSync = is_start;
  2035. this.m_bFoceKuchipakuSelfUpdateTime = is_start;
  2036. if (is_start)
  2037. {
  2038. if (!this.MicLipData.Context)
  2039. {
  2040. this.MicLipData.Context = this.AudioMan.gameObject.AddComponent<LowLatencyLipSyncContext>();
  2041. }
  2042. if (!this.MicLipData.MorphTarget)
  2043. {
  2044. this.MicLipData.MorphTarget = this.AudioMan.gameObject.AddComponent<OVRLipSyncContextMorphTarget>();
  2045. }
  2046. if (!this.MicLipData.MicInput)
  2047. {
  2048. this.MicLipData.MicInput = this.AudioMan.gameObject.AddComponent<OVRLipSyncMicInput>();
  2049. }
  2050. this.MicLipData.Context.Init();
  2051. this.MicLipData.MorphTarget.Init(this);
  2052. this.MicLipData.MicInput.Init(this);
  2053. this.MicLipData.MicInput.StartMicrophone();
  2054. }
  2055. else
  2056. {
  2057. if (this.MicLipData.MicInput)
  2058. {
  2059. this.MicLipData.MicInput.StopMicrophone();
  2060. }
  2061. this.AudioMan.audiosource.clip = null;
  2062. UnityEngine.Object.Destroy(this.MicLipData.Context);
  2063. UnityEngine.Object.Destroy(this.MicLipData.MorphTarget);
  2064. UnityEngine.Object.Destroy(this.MicLipData.MicInput);
  2065. }
  2066. }
  2067. public void StartKuchipakuPattern(float f_fOffsetTime, string f_strPattern, bool f_bSelfUpdateTime = false)
  2068. {
  2069. this.m_fKuchipakuPatternOffsetTime = f_fOffsetTime;
  2070. this.m_baKuchipakuPattern = Convert.FromBase64String(f_strPattern);
  2071. this.m_bFoceKuchipakuSelfUpdateTime = f_bSelfUpdateTime;
  2072. }
  2073. public void StopKuchipakuPattern()
  2074. {
  2075. this.m_fKuchipakuPatternOffsetTime = 0f;
  2076. this.m_baKuchipakuPattern = null;
  2077. this.m_bFoceKuchipakuSelfUpdateTime = false;
  2078. }
  2079. public void IKTargetToAttachPoint(string tag, Maid tgt_maid, string tgt_name, string attachpoint_name, Vector3 f_vecOffset, IKCtrlData.IKAttachType attach_type = IKCtrlData.IKAttachType.Point, string axisbone = "", bool do_animation = false, IKCtrlData.IKExecTiming timing = IKCtrlData.IKExecTiming.Normal)
  2080. {
  2081. IKCtrlData ikdata = this.body0.IKCtrl.GetIKData(tag);
  2082. Transform axis_bone = null;
  2083. if (attach_type != IKCtrlData.IKAttachType.Rotate && !string.IsNullOrEmpty(axisbone))
  2084. {
  2085. axis_bone = CMT.SearchObjName(tgt_maid.body0.m_trBones, axisbone, true);
  2086. }
  2087. ikdata.SetIKSetting(attach_type, timing, tgt_maid, this.body0.GetSlotNo(tgt_name), attachpoint_name, axis_bone, f_vecOffset, do_animation);
  2088. }
  2089. public void IKTargetToBone(string tag, Maid tgt_maid, string tgtbone_name, Vector3 f_vecOffset, IKCtrlData.IKAttachType attach_type = IKCtrlData.IKAttachType.Point, bool search_sm = false, bool do_animation = false, IKCtrlData.IKExecTiming timing = IKCtrlData.IKExecTiming.Normal)
  2090. {
  2091. IKCtrlData ikdata = this.IKCtrl.GetIKData(tag);
  2092. if (tgtbone_name != "無し")
  2093. {
  2094. Transform target;
  2095. if (!search_sm)
  2096. {
  2097. target = CMT.SearchObjName(tgt_maid.body0.m_trBones, tgtbone_name, true);
  2098. }
  2099. else
  2100. {
  2101. target = CMT.SearchObjName(tgt_maid.body0.SmBody, tgtbone_name, false);
  2102. }
  2103. ikdata.SetIKSetting(attach_type, timing, tgt_maid, target, f_vecOffset, do_animation);
  2104. }
  2105. else
  2106. {
  2107. ikdata.Detach(IKCtrlData.IKAttachType.NewPoint);
  2108. ikdata.Detach(IKCtrlData.IKAttachType.Rotate);
  2109. }
  2110. }
  2111. public void IKTargetToOdogu(string tag, string odogu_name, string tgt_name, Vector3 f_vecOffset, IKCtrlData.IKAttachType attach_type = IKCtrlData.IKAttachType.Point, bool do_animation = false, IKCtrlData.IKExecTiming timing = IKCtrlData.IKExecTiming.Normal)
  2112. {
  2113. Transform transform = null;
  2114. GameObject prefabFromBg = GameMain.Instance.BgMgr.GetPrefabFromBg(odogu_name);
  2115. if (!prefabFromBg)
  2116. {
  2117. Debug.LogErrorFormat("現在の背景に大道具「{0}」は存在しません", new object[]
  2118. {
  2119. odogu_name
  2120. });
  2121. }
  2122. else if (prefabFromBg.transform.childCount == 0 || string.IsNullOrEmpty(tgt_name))
  2123. {
  2124. transform = prefabFromBg.transform;
  2125. }
  2126. else
  2127. {
  2128. for (int i = 0; i < prefabFromBg.transform.childCount; i++)
  2129. {
  2130. Transform child = prefabFromBg.transform.GetChild(i);
  2131. if (child && !(child.name != tgt_name))
  2132. {
  2133. transform = prefabFromBg.transform.GetChild(i);
  2134. break;
  2135. }
  2136. }
  2137. if (!transform)
  2138. {
  2139. Debug.LogErrorFormat("大道具「{0}」にターゲット「{1}」は存在しません", new object[]
  2140. {
  2141. odogu_name,
  2142. tgt_name
  2143. });
  2144. }
  2145. }
  2146. IKCtrlData ikdata = this.IKCtrl.GetIKData(tag);
  2147. ikdata.SetIKSetting(attach_type, timing, transform, f_vecOffset, do_animation);
  2148. }
  2149. public void IKTargetToIKBone(string my_tag, Maid f_maidTarget, string bone_name, Vector3 f_vecOffset, IKCtrlData.IKAttachType attach_type = IKCtrlData.IKAttachType.Point, bool do_animation = false, IKCtrlData.IKExecTiming timing = IKCtrlData.IKExecTiming.Normal)
  2150. {
  2151. IKCtrlData ikdata = f_maidTarget.IKCtrl.GetIKData(bone_name);
  2152. if (!ikdata)
  2153. {
  2154. return;
  2155. }
  2156. Transform targetBone = ikdata.TargetBone;
  2157. IKCtrlData ikdata2 = this.IKCtrl.GetIKData(my_tag);
  2158. ikdata2.SetIKSetting(attach_type, timing, f_maidTarget, bone_name, targetBone, f_vecOffset, do_animation);
  2159. }
  2160. public void IKDetach(string name)
  2161. {
  2162. this.IKTargetToBone(name, null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, IKCtrlData.IKExecTiming.Normal);
  2163. }
  2164. public void AllIKDetach(float blendtime = 0f)
  2165. {
  2166. this.IKCtrl.BlendTime = blendtime;
  2167. this.IKCtrl.IKActive = (blendtime > 0f);
  2168. this.IKCtrl.AllForceIK = false;
  2169. foreach (string tag in this.IKCtrl.strIKDataPair.Keys)
  2170. {
  2171. this.IKTargetToBone(tag, null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, IKCtrlData.IKExecTiming.Normal);
  2172. }
  2173. }
  2174. public void OpenMouth(bool f_bOpen)
  2175. {
  2176. this.boMouthOpen = f_bOpen;
  2177. }
  2178. public void OpenMouthLookTooth(bool f_bOpen)
  2179. {
  2180. this.boLookTooth = f_bOpen;
  2181. }
  2182. public void EyeToPosition(Vector3 f_vecTargetPos, float f_fFadeTime = 0f)
  2183. {
  2184. if (f_fFadeTime <= 0f)
  2185. {
  2186. f_fFadeTime = 0.001f;
  2187. }
  2188. this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime;
  2189. this.body0.trsLookTarget = null;
  2190. this.body0.offsetLookTarget = f_vecTargetPos;
  2191. this.body0.boHeadToCam = true;
  2192. this.body0.boEyeToCam = true;
  2193. this.body0.boEyeSorashi = false;
  2194. }
  2195. public void EyeToTargetObject(Transform target_trans, float f_fFadeTime = 0f)
  2196. {
  2197. this.body0.trsLookTarget = target_trans;
  2198. if (this.body0.trsLookTarget == null)
  2199. {
  2200. this.body0.offsetLookTarget = new Vector3(0f, 1f, 0f);
  2201. }
  2202. if (f_fFadeTime <= 0f)
  2203. {
  2204. f_fFadeTime = 0.001f;
  2205. }
  2206. this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime;
  2207. this.body0.boHeadToCam = true;
  2208. this.body0.boEyeToCam = true;
  2209. this.body0.boEyeSorashi = false;
  2210. }
  2211. public void EyeToTarget(Maid f_maidTarget, float f_fFadeTime = 0f, string f_strBoneName = "Bip01 Head")
  2212. {
  2213. Transform transform = CMT.SearchObjName(f_maidTarget.body0.m_trBones, f_strBoneName, true);
  2214. this.body0.trsLookTarget = transform;
  2215. if (transform == null)
  2216. {
  2217. this.body0.offsetLookTarget = new Vector3(0f, 1f, 0f);
  2218. }
  2219. if (f_fFadeTime <= 0f)
  2220. {
  2221. f_fFadeTime = 0.001f;
  2222. }
  2223. this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime;
  2224. this.body0.boHeadToCam = true;
  2225. this.body0.boEyeToCam = true;
  2226. this.body0.boEyeSorashi = false;
  2227. }
  2228. public void EyeToCamera(Maid.EyeMoveType f_eType, float f_fFadeTime = 0f)
  2229. {
  2230. this.body0.boHeadToCam = false;
  2231. this.body0.boEyeToCam = true;
  2232. this.body0.boEyeSorashi = false;
  2233. if (f_fFadeTime <= 0f)
  2234. {
  2235. f_fFadeTime = 0.001f;
  2236. }
  2237. this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime;
  2238. if (GameMain.Instance.VRMode)
  2239. {
  2240. if (GameMain.Instance.OvrMgr != null)
  2241. {
  2242. this.body0.trsLookTarget = GameMain.Instance.OvrMgr.EyeAnchor;
  2243. }
  2244. if (GameMain.Instance.OvrIK != null && OvrIK.IsVRIKMode && GameMain.Instance.OvrIK.NowMaid == this)
  2245. {
  2246. this.body0.trsLookTarget = GameMain.Instance.OvrIK.EyeTargetTrs;
  2247. }
  2248. }
  2249. else if (GameMain.Instance.MainCamera != null)
  2250. {
  2251. this.body0.trsLookTarget = GameMain.Instance.MainCamera.transform;
  2252. }
  2253. if (f_eType == Maid.EyeMoveType.無し)
  2254. {
  2255. this.body0.boEyeToCam = false;
  2256. }
  2257. if (f_eType == Maid.EyeMoveType.無視する)
  2258. {
  2259. this.body0.boEyeToCam = false;
  2260. }
  2261. if (f_eType == Maid.EyeMoveType.顔を向ける)
  2262. {
  2263. this.body0.boHeadToCam = true;
  2264. }
  2265. if (f_eType == Maid.EyeMoveType.顔だけ動かす)
  2266. {
  2267. this.body0.boHeadToCam = true;
  2268. this.body0.boEyeToCam = false;
  2269. }
  2270. if (f_eType == Maid.EyeMoveType.顔をそらす)
  2271. {
  2272. this.body0.trsLookTarget = null;
  2273. this.body0.boEyeSorashi = true;
  2274. this.body0.boEyeToCam = true;
  2275. this.body0.boHeadToCam = true;
  2276. }
  2277. if (f_eType == Maid.EyeMoveType.目と顔を向ける)
  2278. {
  2279. this.body0.boHeadToCam = true;
  2280. this.body0.boEyeToCam = true;
  2281. }
  2282. if (f_eType == Maid.EyeMoveType.目だけ向ける)
  2283. {
  2284. this.body0.boHeadToCam = false;
  2285. this.body0.boEyeToCam = true;
  2286. }
  2287. if (f_eType == Maid.EyeMoveType.目だけそらす)
  2288. {
  2289. this.body0.trsLookTarget = null;
  2290. this.body0.boEyeSorashi = true;
  2291. this.body0.boEyeToCam = true;
  2292. this.body0.boHeadToCam = false;
  2293. }
  2294. }
  2295. public void EyeToReset(float f_fFadeTime = 0f)
  2296. {
  2297. this.EyeToCamera(Maid.EyeMoveType.無し, f_fFadeTime);
  2298. }
  2299. public void LockHeadAndEye(bool toLock)
  2300. {
  2301. this.body0.boLockHeadAndEye = toLock;
  2302. }
  2303. public bool GetLockHeadAndEye()
  2304. {
  2305. return this.body0.boLockHeadAndEye;
  2306. }
  2307. public void SetModeHairR(TBody.ModeHirR f_eMode)
  2308. {
  2309. this.body0.Mode_HairR = f_eMode;
  2310. }
  2311. public void SetAutoTwist(Maid.AutoTwist f_eType, bool f_bEnable)
  2312. {
  2313. switch (f_eType)
  2314. {
  2315. case Maid.AutoTwist.ShoulderL:
  2316. this.body0.boAutoTwistShoulderL = f_bEnable;
  2317. break;
  2318. case Maid.AutoTwist.ShoulderR:
  2319. this.body0.boAutoTwistShoulderR = f_bEnable;
  2320. break;
  2321. case Maid.AutoTwist.WristL:
  2322. this.body0.boAutoTwistWristL = f_bEnable;
  2323. break;
  2324. case Maid.AutoTwist.WristR:
  2325. this.body0.boAutoTwistWristR = f_bEnable;
  2326. break;
  2327. case Maid.AutoTwist.ThighL:
  2328. this.body0.boAutoTwistThighL = f_bEnable;
  2329. break;
  2330. case Maid.AutoTwist.ThighR:
  2331. this.body0.boAutoTwistThighR = f_bEnable;
  2332. break;
  2333. }
  2334. }
  2335. public void SetAutoTwistAll(bool f_bEnable)
  2336. {
  2337. this.body0.boAutoTwistShoulderL = f_bEnable;
  2338. this.body0.boAutoTwistShoulderR = f_bEnable;
  2339. this.body0.boAutoTwistWristL = f_bEnable;
  2340. this.body0.boAutoTwistWristR = f_bEnable;
  2341. this.body0.boAutoTwistThighL = f_bEnable;
  2342. this.body0.boAutoTwistThighR = f_bEnable;
  2343. }
  2344. public void FaceAnime(string tag, float t = 1f, int chkcode = 0)
  2345. {
  2346. this.FaceAnimeChkCode = chkcode;
  2347. this.ActiveFace = tag;
  2348. if (this.body0 != null && this.body0.Face != null && this.body0.Face.morph != null && this.body0.Face.morph.dicBlendSet != null && this.body0.Face.morph.dicBlendSet.ContainsKey(tag + "〓通常"))
  2349. {
  2350. tag += "〓通常";
  2351. }
  2352. if (t == 0f)
  2353. {
  2354. this.boFaceAnime = false;
  2355. this.FaceName = tag;
  2356. this.FaceName2 = string.Empty;
  2357. return;
  2358. }
  2359. this.boFaceAnime = true;
  2360. if (this.FaceName2 != string.Empty)
  2361. {
  2362. this.FaceName = this.FaceName2;
  2363. this.FaceName2 = string.Empty;
  2364. }
  2365. if (this.FaceName == string.Empty)
  2366. {
  2367. this.FaceName = "デフォ";
  2368. }
  2369. this.FaceName2 = tag;
  2370. this.FacePlus = 1f / t;
  2371. this.FaceTime = this.FacePlus * 0.0166666675f;
  2372. }
  2373. public void FaceBlend(string tag)
  2374. {
  2375. if (this.body0 == null)
  2376. {
  2377. Debug.LogError("Bodyが読み込まれる前に、表情ブレンドが呼ばれました。" + tag);
  2378. return;
  2379. }
  2380. if (tag == "無し")
  2381. {
  2382. tag = string.Empty;
  2383. }
  2384. this.FaceName3 = tag;
  2385. }
  2386. public void ChangeAutoFace(bool bo)
  2387. {
  2388. if (this.boAutoFace != bo)
  2389. {
  2390. this.AutoFaceLV_old = 0;
  2391. this.Hazukashi = 0f;
  2392. }
  2393. this.boAutoFace = bo;
  2394. }
  2395. public void AddPrefab(string f_strPrefab, string f_strName, string f_strDestBone, Vector3 f_vOffsetLocalPos, Vector3 f_vOffsetLocalRot)
  2396. {
  2397. UnityEngine.Object @object = Resources.Load("Prefab/" + f_strPrefab);
  2398. if (@object != null)
  2399. {
  2400. Transform transform = null;
  2401. if (this.body0 != null && this.body0.isLoadedBody)
  2402. {
  2403. transform = CMT.SearchObjName(this.body0.m_trBones, f_strDestBone, true);
  2404. }
  2405. if (transform != null)
  2406. {
  2407. GameObject goItem = UnityEngine.Object.Instantiate(@object) as GameObject;
  2408. goItem.AddComponent<AttachPrefab>();
  2409. goItem.name = goItem.name.Replace("(Clone)", string.Empty);
  2410. if (!string.IsNullOrEmpty(f_strName))
  2411. {
  2412. goItem.name = f_strName;
  2413. }
  2414. AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren<AttachPrefab>(true);
  2415. AttachPrefab[] array = (from a in componentsInChildren
  2416. where a.name == goItem.name
  2417. select a).ToArray<AttachPrefab>();
  2418. for (int i = 0; i < array.Length; i++)
  2419. {
  2420. UnityEngine.Object.DestroyImmediate(array[i].gameObject);
  2421. }
  2422. goItem.transform.SetParent(transform, false);
  2423. goItem.transform.localPosition = f_vOffsetLocalPos;
  2424. goItem.transform.localRotation = Quaternion.Euler(f_vOffsetLocalRot);
  2425. }
  2426. else
  2427. {
  2428. Debug.LogError("人物にプレハブ追加で、ボーン名が見つかりません。" + f_strDestBone);
  2429. }
  2430. }
  2431. else
  2432. {
  2433. Debug.LogError("人物にプレハブ追加で、プレハブが見つかりません。Prefab/" + f_strPrefab);
  2434. }
  2435. }
  2436. public void DelPrefab(string f_strName)
  2437. {
  2438. if (this.body0 == null || !this.body0.isLoadedBody)
  2439. {
  2440. return;
  2441. }
  2442. AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren<AttachPrefab>(true);
  2443. AttachPrefab[] array = (from a in componentsInChildren
  2444. where a.name == f_strName
  2445. select a).ToArray<AttachPrefab>();
  2446. for (int i = 0; i < array.Length; i++)
  2447. {
  2448. UnityEngine.Object.DestroyImmediate(array[i].gameObject);
  2449. }
  2450. }
  2451. public void DelPrefabAll()
  2452. {
  2453. if (this.body0 == null || !this.body0.isLoadedBody)
  2454. {
  2455. return;
  2456. }
  2457. AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren<AttachPrefab>(true);
  2458. for (int i = 0; i < componentsInChildren.Length; i++)
  2459. {
  2460. UnityEngine.Object.DestroyImmediate(componentsInChildren[i].gameObject);
  2461. }
  2462. }
  2463. public GameObject GetPrefab(string f_strName)
  2464. {
  2465. if (this.body0 == null || !this.body0.isLoadedBody)
  2466. {
  2467. return null;
  2468. }
  2469. AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren<AttachPrefab>(true);
  2470. AttachPrefab[] array = (from a in componentsInChildren
  2471. where a.name == f_strName
  2472. select a).ToArray<AttachPrefab>();
  2473. return (0 >= array.Length) ? null : array[0].gameObject;
  2474. }
  2475. public void AnimationObject(string f_strName, string f_strAnimName, bool f_bNowPlay, bool f_bLoop)
  2476. {
  2477. Transform transform;
  2478. if ((transform = CMT.SearchObjName(this.body0.m_trBones, f_strName, false)) != null)
  2479. {
  2480. Animation animation = transform.gameObject.GetComponent<Animation>();
  2481. if (animation == null)
  2482. {
  2483. animation = transform.gameObject.AddComponent<Animation>();
  2484. }
  2485. AnimationClip animationClip = ImportCM.LoadAniClipNative(GameUty.FileSystem, f_strAnimName, true, true, true);
  2486. if (animationClip == null)
  2487. {
  2488. NDebug.Assert("アニメーション " + f_strAnimName + " が見つかりません。", false);
  2489. }
  2490. animation.AddClip(animationClip, f_strAnimName);
  2491. animation.clip = animationClip;
  2492. animation.playAutomatically = true;
  2493. animation.wrapMode = ((!f_bLoop) ? WrapMode.Once : WrapMode.Loop);
  2494. if (f_bNowPlay)
  2495. {
  2496. animation.PlayQueued(f_strAnimName, QueueMode.PlayNow);
  2497. }
  2498. this.m_goTestAnim = transform.gameObject;
  2499. }
  2500. else
  2501. {
  2502. NDebug.Assert("人物に追加した " + f_strName + " は見つかりませんでした。", false);
  2503. }
  2504. }
  2505. public void SetPos(Vector3 f_vecLocalPos)
  2506. {
  2507. base.gameObject.transform.localPosition = f_vecLocalPos;
  2508. }
  2509. public void SetRot(Vector3 f_vecLocalRot)
  2510. {
  2511. base.gameObject.transform.localRotation = Quaternion.Euler(f_vecLocalRot);
  2512. }
  2513. public Vector3 GetPos()
  2514. {
  2515. return base.gameObject.transform.localPosition;
  2516. }
  2517. public Vector3 GetRot()
  2518. {
  2519. return base.gameObject.transform.localRotation.eulerAngles;
  2520. }
  2521. public Vector3 GetWorldRot()
  2522. {
  2523. return base.gameObject.transform.rotation.eulerAngles;
  2524. }
  2525. public void SetPosOffset(Vector3 f_vecLocalPos)
  2526. {
  2527. this.m_vOffsetPostion = f_vecLocalPos;
  2528. }
  2529. public void UpdateTransformData()
  2530. {
  2531. this.SetPos(this.baseOffset + this.motionOffset);
  2532. if (this.boMAN)
  2533. {
  2534. if (!string.IsNullOrEmpty(this.rotateLinkMaid))
  2535. {
  2536. for (int i = 0; i < GameMain.Instance.CharacterMgr.GetMaidCount(); i++)
  2537. {
  2538. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(i);
  2539. if (maid != null && maid.status.guid == this.rotateLinkMaid)
  2540. {
  2541. maid.UpdateTransformData();
  2542. break;
  2543. }
  2544. }
  2545. }
  2546. return;
  2547. }
  2548. Vector3 position = base.transform.position;
  2549. base.transform.localRotation = Quaternion.identity;
  2550. if (!Mathf.Approximately(0f, this.baseEulerAngles.x))
  2551. {
  2552. base.transform.RotateAround(position, Vector3.right, this.baseEulerAngles.x);
  2553. }
  2554. if (!Mathf.Approximately(0f, this.baseEulerAngles.y))
  2555. {
  2556. base.transform.RotateAround(position, Vector3.up, this.baseEulerAngles.y);
  2557. }
  2558. if (!Mathf.Approximately(0f, this.baseEulerAngles.z))
  2559. {
  2560. base.transform.RotateAround(position, Vector3.forward, this.baseEulerAngles.z);
  2561. }
  2562. for (int j = 0; j < GameMain.Instance.CharacterMgr.GetManCount(); j++)
  2563. {
  2564. Maid man = GameMain.Instance.CharacterMgr.GetMan(j);
  2565. if (man != null && man.status.guid == this.rotateLinkMaid)
  2566. {
  2567. man.SetPos(man.baseOffset + man.motionOffset);
  2568. man.transform.localRotation = Quaternion.identity;
  2569. if (!Mathf.Approximately(0f, this.baseEulerAngles.x))
  2570. {
  2571. man.transform.RotateAround(position, Vector3.right, this.baseEulerAngles.x);
  2572. }
  2573. if (!Mathf.Approximately(0f, this.baseEulerAngles.y))
  2574. {
  2575. man.transform.RotateAround(position, Vector3.up, this.baseEulerAngles.y);
  2576. }
  2577. if (!Mathf.Approximately(0f, this.baseEulerAngles.z))
  2578. {
  2579. man.transform.RotateAround(position, Vector3.forward, this.baseEulerAngles.z);
  2580. }
  2581. break;
  2582. }
  2583. }
  2584. }
  2585. public void SetPosOffsetFromUdeSclX(string category, float val)
  2586. {
  2587. this.m_vOffsetPostion.x = ((float)this.GetProp(category).value - 50f) * (val / 50f);
  2588. }
  2589. public void SetPosOffsetFromUdeSclY(string category, float val)
  2590. {
  2591. this.m_vOffsetPostion.y = ((float)this.GetProp(category).value - 50f) * (val / 50f);
  2592. }
  2593. public void SetPosOffsetFromUdeSclZ(string category, float val)
  2594. {
  2595. this.m_vOffsetPostion.z = ((float)this.GetProp(category).value - 50f) * (val / 50f);
  2596. }
  2597. public void ExportModBaseMenu(MPN f_mpn)
  2598. {
  2599. MaidProp prop = this.GetProp(f_mpn);
  2600. if (string.IsNullOrEmpty(prop.strFileName))
  2601. {
  2602. NUty.WinMessageBox(NUty.GetWindowHandle(), "現在このスロットにはパーツが設定されていません。", "MOD Export Error", 0);
  2603. return;
  2604. }
  2605. Menu.ExportModScript(this, prop.strFileName, false);
  2606. }
  2607. public void ExportModBaseMqo(MPN f_mpn, string f_strOutFileName)
  2608. {
  2609. MaidProp prop = this.GetProp(f_mpn);
  2610. if (string.IsNullOrEmpty(prop.strFileName))
  2611. {
  2612. NUty.WinMessageBox(NUty.GetWindowHandle(), "現在このスロットにはパーツが設定されていません。", "MQO Export Error", 0);
  2613. return;
  2614. }
  2615. }
  2616. public void FoceKuchipakuUpdate(float f_fNowTime)
  2617. {
  2618. if (this.m_baKuchipakuPattern != null)
  2619. {
  2620. int num = (int)((this.m_fKuchipakuPatternOffsetTime + f_fNowTime) * 30f);
  2621. int num2 = this.m_baKuchipakuPattern.Length / 3;
  2622. if (0 < num && num < num2)
  2623. {
  2624. this.body0.Face.morph.boLipSync = true;
  2625. this.body0.Face.morph.LipSync1 = this.body0.Face.morph.LipSync1 * 0.15f + (float)this.m_baKuchipakuPattern[num * 3] / 255f * 0.85f * 3f;
  2626. this.body0.Face.morph.LipSync2 = this.body0.Face.morph.LipSync2 * 0.15f + (float)this.m_baKuchipakuPattern[num * 3 + 1] / 255f * 0.85f * 3f;
  2627. this.body0.Face.morph.LipSync3 = this.body0.Face.morph.LipSync3 * 0.15f + (float)this.m_baKuchipakuPattern[num * 3 + 2] / 255f * 0.85f * 3f;
  2628. }
  2629. else
  2630. {
  2631. this.body0.Face.morph.boLipSync = false;
  2632. }
  2633. }
  2634. }
  2635. private void Update()
  2636. {
  2637. if (this.boAllProcPropBUSY)
  2638. {
  2639. this.AllProcPropSeq();
  2640. return;
  2641. }
  2642. if (this.boMAN)
  2643. {
  2644. this.m_goOffset.transform.localPosition = this.m_vOffsetPostion;
  2645. return;
  2646. }
  2647. if (!this.body0.isLoadedBody)
  2648. {
  2649. return;
  2650. }
  2651. if (this.boOffsetY)
  2652. {
  2653. float num = this.body0.ToeL.position.y;
  2654. if (this.body0.ToeR.position.y < num)
  2655. {
  2656. num = this.body0.ToeR.position.y;
  2657. }
  2658. num = this.body0.CenterBone.position.y;
  2659. num *= 0.8f;
  2660. float num2 = this.body0.Pelvis.position.y - this.body0.CenterBone.position.y;
  2661. this.m_goOffset.transform.localPosition = new Vector3(0f, -num2 + num2 * this.body0.bonemorph.SnityouOutScale, 0f) + this.m_vOffsetPostion;
  2662. }
  2663. this.body0.Face.morph.boLookTooth = this.boLookTooth;
  2664. this.body0.Face.morph.boBallGAG = (this.boBallGAG | this.boMouthOpen);
  2665. this.body0.Face.morph.boNoseFook = this.boNoseFook;
  2666. if (this.AudioMan != null && !this.m_bFoceKuchipakuSelfUpdateTime)
  2667. {
  2668. this.body0.Face.morph.boLipSync = this.AudioMan.audiosource.isPlaying;
  2669. if (!this.lipSyncEnabled)
  2670. {
  2671. this.body0.Face.morph.boLipSync = false;
  2672. }
  2673. float voicePara_ = this.VoicePara_1;
  2674. float voicePara_2 = this.VoicePara_3;
  2675. float vol = this.AudioMan.GetVol();
  2676. this.voice_avg1 = this.voice_avg1 * (1f - voicePara_) + vol * voicePara_;
  2677. this.voice_avg2 = this.voice_avg2 * (1f - voicePara_) + this.AudioMan.VAvgMax * voicePara_;
  2678. this.voice_avg1D = this.voice_avg1D * (1f - voicePara_2) + (vol - this.voice_avg1_old) * voicePara_2;
  2679. this.voice_avg2D = this.voice_avg2D * (1f - voicePara_2) + (this.AudioMan.VAvgMax - this.voice_avg2_old) * voicePara_2;
  2680. this.voice_avg1_old = vol;
  2681. this.voice_avg2_old = this.AudioMan.VAvgMax;
  2682. this.voice_ao_time -= Time.deltaTime;
  2683. if (this.voice_ao_time < 0f && this.voice_avg1D > 0f && this.voice_ao_chk0 < -0.05f && this.voice_ao_chk1 > 0.1f)
  2684. {
  2685. this.voice_ao_time = 0.05f;
  2686. this.voice_ao = (this.voice_ao + 1) % 8;
  2687. this.voice_ao_chk0 = 0f;
  2688. this.voice_ao_chk1 = 0f;
  2689. }
  2690. if (this.voice_ao_chk1 < this.voice_avg1D)
  2691. {
  2692. this.voice_ao_chk1 = this.voice_avg1D;
  2693. }
  2694. if (0.1f < this.voice_avg1D)
  2695. {
  2696. this.voice_ao_chk0 = 0f;
  2697. }
  2698. if (this.voice_ao_chk0 > this.voice_avg1D)
  2699. {
  2700. this.voice_ao_chk0 = this.voice_avg1D;
  2701. }
  2702. float num3 = Mathf.Pow(this.voice_avg1, 1f) * 10f * this.VoicePara_2;
  2703. if (this.voice_ao % 2 == 0)
  2704. {
  2705. this.voice_ao_f *= 0.5f;
  2706. }
  2707. else
  2708. {
  2709. this.voice_ao_f = this.voice_ao_f * 0.5f + 0.5f;
  2710. }
  2711. this.voice_lf2 = num3 * this.voice_ao_f;
  2712. this.voice_lf3 = num3 * (1f - this.voice_ao_f);
  2713. this.body0.Face.morph.LipSync2 = this.voice_lf2;
  2714. this.body0.Face.morph.LipSync3 = this.voice_lf3;
  2715. float num4 = Mathf.Pow(this.voice_avg2, 0.5f) * (this.voice_avg2D * 30f * this.VoicePara_4 + 0.5f);
  2716. this.voice_lf1 = num4;
  2717. this.body0.Face.morph.LipSync1 = this.voice_lf1;
  2718. if (this.voice_ao % 4 < 2)
  2719. {
  2720. this.voice_ao_f2 *= 0.5f;
  2721. }
  2722. else
  2723. {
  2724. this.voice_ao_f2 = this.voice_ao_f2 * 0.5f + 0.5f;
  2725. }
  2726. this.body0.Face.morph.LipSync1 *= this.voice_ao_f2;
  2727. this.body0.Face.morph.LipSync2 *= 1f - this.voice_ao_f2;
  2728. this.body0.Face.morph.LipSync3 *= 1f - this.voice_ao_f2;
  2729. this.body0.Face.morph.LipSync1 = Mathf.Clamp01(this.body0.Face.morph.LipSync1 * 0.5f);
  2730. this.body0.Face.morph.LipSync2 = Mathf.Clamp01(this.body0.Face.morph.LipSync2 * 0.5f);
  2731. this.body0.Face.morph.LipSync3 = Mathf.Clamp01(this.body0.Face.morph.LipSync3 * 0.5f);
  2732. }
  2733. if (this.m_baKuchipakuPattern != null && this.lipSyncEnabled && !this.m_bFoceKuchipakuSelfUpdateTime && this.AudioMan != null)
  2734. {
  2735. this.FoceKuchipakuUpdate(this.AudioMan.audiosource.time);
  2736. }
  2737. if (this.boLipsync && this.lipSyncEnabled)
  2738. {
  2739. this.body0.Face.morph.boLipSync = true;
  2740. this.LipsyncT1 += Mathf.Sin(Time.time * 10f) * 0.5f + Mathf.Cos(Time.time * 5.55f) * 0.1f * 0.2f;
  2741. this.LipsyncT2 += Mathf.Sin(Time.time * 5f) * 0.1f + Mathf.Cos(Time.time * 5.55f) * 0.1f * 0.2f;
  2742. float num5 = (1f + Mathf.Sin(Time.time * 4f + this.LipsyncT1)) * 0.5f * 0.98f + 0.1f;
  2743. float num6 = (Mathf.Sin(this.LipsyncT1) + 1f) * 0.5f;
  2744. float num7 = (Mathf.Sin(this.LipsyncT2) + 1f) * 0.5f;
  2745. this.body0.Face.morph.LipSync1 = num5 * num6 * num7 * 0.5f;
  2746. this.body0.Face.morph.LipSync3 = num5 * (1f - num6) * num7 * 0.5f;
  2747. this.body0.Face.morph.LipSync2 = num5 * (1f - num7) * 0.5f;
  2748. }
  2749. else if (this.boLipsync_old)
  2750. {
  2751. this.body0.Face.morph.LipSync1 = 0f;
  2752. this.body0.Face.morph.LipSync3 = 0f;
  2753. this.body0.Face.morph.LipSync2 = 0f;
  2754. }
  2755. this.boLipsync_old = this.boLipsync;
  2756. if (this.boMabataki)
  2757. {
  2758. this.body0.Face.morph.ClearBlendValues();
  2759. if (this.FaceName != string.Empty)
  2760. {
  2761. this.body0.Face.morph.MulBlendValues(this.FaceName, 1f);
  2762. }
  2763. if (this.FaceName2 != string.Empty)
  2764. {
  2765. this.body0.Face.morph.MulBlendValues(this.FaceName2, UTY.COSS2(Mathf.Pow(this.FaceTime, 0.4f), 4f));
  2766. this.FaceTime += Time.deltaTime * this.FacePlus;
  2767. if (this.FaceTime >= 1f)
  2768. {
  2769. this.boFaceAnime = false;
  2770. this.FaceName = this.FaceName2;
  2771. this.FaceName2 = string.Empty;
  2772. }
  2773. }
  2774. if (this.FaceName3 != string.Empty)
  2775. {
  2776. this.body0.Face.morph.AddBlendValues(this.FaceName3, 1f);
  2777. }
  2778. if (this.MabatakiVal > 0f)
  2779. {
  2780. float num8 = this.MabatakiVal * this.MabatakiVal;
  2781. num8 = Mathf.Sin(num8 * 3.14159274f);
  2782. this.body0.Face.morph.EyeMabataki = num8;
  2783. }
  2784. else
  2785. {
  2786. this.body0.Face.morph.EyeMabataki = 0f;
  2787. }
  2788. if (!this.MabatakiUpdateStop)
  2789. {
  2790. this.MabatakiVal -= Time.deltaTime * 2f;
  2791. }
  2792. this.body0.Face.morph.FixBlendValues_Face();
  2793. if (!this.boFaceAnime && this.NextMabatakiTime < Time.time && !this.MabatakiUpdateStop)
  2794. {
  2795. float num9 = 0.5f + (float)UTY.GetRnd(80) * 0.1f;
  2796. this.NextMabatakiTime = Time.time + num9;
  2797. this.MabatakiVal = 1f;
  2798. }
  2799. }
  2800. else if (this.FaceName2 != string.Empty)
  2801. {
  2802. this.body0.Face.morph.ClearBlendValues();
  2803. if (this.FaceName != string.Empty)
  2804. {
  2805. this.body0.Face.morph.MulBlendValues(this.FaceName, 1f);
  2806. }
  2807. this.body0.Face.morph.MulBlendValues(this.FaceName2, UTY.COSS2(Mathf.Pow(this.FaceTime, 0.4f), 4f));
  2808. this.FaceTime += Time.deltaTime * this.FacePlus;
  2809. if (this.FaceTime >= 1f)
  2810. {
  2811. this.boFaceAnime = false;
  2812. this.FaceName = this.FaceName2;
  2813. this.FaceName2 = string.Empty;
  2814. }
  2815. this.MabatakiVal = 0f;
  2816. this.body0.Face.morph.FixBlendValues_Face();
  2817. }
  2818. }
  2819. private void LateUpdate()
  2820. {
  2821. if (this.boAllProcPropBUSY)
  2822. {
  2823. return;
  2824. }
  2825. if (!this.body0.isLoadedBody)
  2826. {
  2827. return;
  2828. }
  2829. if (this.m_MotionLoad == 1)
  2830. {
  2831. this.m_MotionLoad = 0;
  2832. if (!this.boMAN)
  2833. {
  2834. this.CrossFade("maid_stand01.anm", false, true, false, 0.5f, 1f);
  2835. this.FaceAnime("通常", 1f, 0);
  2836. if (GameMain.Instance.VRMode)
  2837. {
  2838. if (GameMain.Instance.OvrMgr != null)
  2839. {
  2840. this.body0.trsLookTarget = GameMain.Instance.OvrMgr.EyeAnchor;
  2841. }
  2842. }
  2843. else if (GameMain.Instance.MainCamera != null)
  2844. {
  2845. this.body0.trsLookTarget = GameMain.Instance.MainCamera.transform;
  2846. }
  2847. }
  2848. }
  2849. }
  2850. public GameObject m_goOffset;
  2851. private Status m_Status;
  2852. private MaidParts m_Parts;
  2853. private bool m_visible;
  2854. public Action<Maid> onMouseUpEvent;
  2855. public string TypeName = string.Empty;
  2856. public TBody body0;
  2857. public bool boMAN;
  2858. public bool boNPC;
  2859. public bool boOffsetY = true;
  2860. public Vector3 baseOffset = Vector3.zero;
  2861. public Vector3 motionOffset = Vector3.zero;
  2862. public Vector3 baseEulerAngles = Vector3.zero;
  2863. public string rotateLinkMaid = string.Empty;
  2864. private Dictionary<string, MaidProp> m_dicMaidProp = new Dictionary<string, MaidProp>();
  2865. private MaidProp[] m_aryMaidProp;
  2866. private Hashtable m_hashMaidPropLower = new Hashtable();
  2867. private int m_nActiveSlotNo = -1;
  2868. private string m_strThumCardTime = string.Empty;
  2869. private Texture2D m_texIcon;
  2870. private Color m_colMan = new Color(0f, 0.09f, 1f, 1f);
  2871. private int m_nVoicePitch = 50;
  2872. private string m_strBefOnepiceFileName;
  2873. private int m_nBefOnepiceRID;
  2874. private string m_strBefWearFileName;
  2875. private int m_nBefWearRID;
  2876. private string m_strBefSkirtFileName;
  2877. private int m_nBefSkirtRID;
  2878. private bool boModelChg;
  2879. public bool boAllProcPropBUSY;
  2880. private int AllProcProp2Fase;
  2881. private int AllProcProp2Cnt;
  2882. public bool boLookTooth;
  2883. public bool boBallGAG;
  2884. public bool boMouthOpen;
  2885. public bool boNoseFook;
  2886. private float m_fKuchipakuPatternOffsetTime;
  2887. public byte[] m_baKuchipakuPattern;
  2888. private bool m_bFoceKuchipakuSelfUpdateTime;
  2889. [Header("音声入力用コンポーネント")]
  2890. public Maid.LipSyncComp MicLipData = new Maid.LipSyncComp();
  2891. private bool m_MicLipSync;
  2892. private bool boAutoFace;
  2893. private float NextMabatakiTime;
  2894. private float MabatakiVal;
  2895. private string FaceName = string.Empty;
  2896. private string FaceName2 = string.Empty;
  2897. public string FaceName3 = string.Empty;
  2898. private float FaceTime;
  2899. private float FacePlus;
  2900. public string ActiveFace = string.Empty;
  2901. public int FaceAnimeChkCode;
  2902. public bool boFaceAnime;
  2903. public int OldFaceAtr;
  2904. public bool boShitakaraNozoku;
  2905. public bool boVisibleBottom;
  2906. public int AutoFaceLV_old;
  2907. public float Hazukashi;
  2908. public bool boChkEye_old;
  2909. public GameObject m_goTestAnim;
  2910. public float voice_time;
  2911. public float voice_avg1;
  2912. public float voice_avg2;
  2913. public float voice_avg1_old;
  2914. public float voice_avg2_old;
  2915. public float voice_avg1D;
  2916. public float voice_avg2D;
  2917. public int voice_ao;
  2918. public float voice_ao_f;
  2919. public float voice_ao_f2;
  2920. public float voice_ao_time;
  2921. public float voice_ao_chk0;
  2922. public float voice_ao_chk1;
  2923. public float voice_lf1;
  2924. public float voice_lf2;
  2925. public float voice_lf3;
  2926. public float VoicePara_1 = 0.5f;
  2927. public float VoicePara_2 = 0.074f;
  2928. public float VoicePara_3 = 0.5f;
  2929. public float VoicePara_4 = 0.05f;
  2930. private bool lipSyncEnabled = true;
  2931. private bool boLipsync;
  2932. private bool boLipsync_old;
  2933. private float LipsyncT1;
  2934. private float LipsyncT2;
  2935. public bool boMabataki = true;
  2936. public bool MabatakiUpdateStop;
  2937. private Vector3 m_vOffsetPostion = Vector3.zero;
  2938. public static int changetest;
  2939. private int m_MotionLoad = 1;
  2940. [Serializable]
  2941. public class LipSyncComp
  2942. {
  2943. [HideInInspector]
  2944. public bool IsInit = true;
  2945. public LowLatencyLipSyncContext Context;
  2946. public OVRLipSyncContextMorphTarget MorphTarget;
  2947. public OVRLipSyncMicInput MicInput;
  2948. }
  2949. public enum EyeMoveType
  2950. {
  2951. 無し,
  2952. 無視する,
  2953. 顔を向ける,
  2954. 顔だけ動かす,
  2955. 顔をそらす,
  2956. 目と顔を向ける,
  2957. 目だけ向ける,
  2958. 目だけそらす
  2959. }
  2960. public enum AutoTwist
  2961. {
  2962. ShoulderL,
  2963. ShoulderR,
  2964. WristL,
  2965. WristR,
  2966. ThighL,
  2967. ThighR
  2968. }
  2969. }