Maid.cs 90 KB

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