Maid.cs 83 KB

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