Maid.cs 83 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095
  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. MPN.lip
  856. };
  857. foreach (MPN mpn in array)
  858. {
  859. this.GetProp(mpn).boDut = true;
  860. }
  861. }
  862. else if (maidProp.idx == 52)
  863. {
  864. MaidProp prop = this.GetProp(MPN.acctatoo);
  865. prop.boDut = true;
  866. if (prop.listSubProp != null)
  867. {
  868. for (int k = 0; k < prop.listSubProp.Count; k++)
  869. {
  870. if (prop.listSubProp[k] != null)
  871. {
  872. prop.listSubProp[k].bDut = true;
  873. }
  874. }
  875. }
  876. prop = this.GetProp(MPN.hokuro);
  877. prop.boDut = true;
  878. if (prop.listSubProp != null)
  879. {
  880. for (int l = 0; l < prop.listSubProp.Count; l++)
  881. {
  882. if (prop.listSubProp[l] != null)
  883. {
  884. prop.listSubProp[l].bDut = true;
  885. }
  886. }
  887. }
  888. this.GetProp(MPN.lip).boDut = true;
  889. this.GetProp(MPN.nose).boDut = true;
  890. this.GetProp(MPN.facegloss).boDut = true;
  891. }
  892. break;
  893. }
  894. }
  895. }
  896. else if (this.AllProcProp2Fase == 1)
  897. {
  898. this.AllProcProp2Fase++;
  899. }
  900. else if (this.AllProcProp2Fase == 2)
  901. {
  902. bool flag = false;
  903. foreach (MaidProp maidProp2 in this.m_dicMaidProp.Values)
  904. {
  905. if (maidProp2.type != 3)
  906. {
  907. flag |= this.ProcItem(maidProp2);
  908. }
  909. }
  910. if (flag)
  911. {
  912. this.body0.ItemScaleReset();
  913. }
  914. this.AllProcProp2Fase++;
  915. }
  916. else if (this.AllProcProp2Fase == 3)
  917. {
  918. if (this.boModelChg)
  919. {
  920. this.body0.MulTexProc();
  921. this.body0.FixMaskFlag();
  922. this.body0.FixVisibleFlag(false);
  923. }
  924. this.AllProcProp2Fase++;
  925. }
  926. else if (this.AllProcProp2Fase == 4)
  927. {
  928. this.ProcSSParam();
  929. this.AllProcProp2Fase++;
  930. }
  931. else if (this.AllProcProp2Fase == 5)
  932. {
  933. this.boAllProcPropBUSY = false;
  934. }
  935. }
  936. public void AllProcProp()
  937. {
  938. this.boModelChg = false;
  939. float realtimeSinceStartup = Time.realtimeSinceStartup;
  940. for (;;)
  941. {
  942. if (Array.Find<MaidProp>(this.m_aryMaidProp, (MaidProp m) => m.type == 3 && (m.boDut || m.boTempDut)) == null)
  943. {
  944. break;
  945. }
  946. for (int i = 0; i < this.m_aryMaidProp.Length; i++)
  947. {
  948. MaidProp maidProp = this.m_aryMaidProp[i];
  949. string name = maidProp.name;
  950. if (maidProp.type == 3 && this.ProcItem(this.m_dicMaidProp[name]))
  951. {
  952. if (!this.boModelChg)
  953. {
  954. this.body0.FixVisibleFlag(true);
  955. this.boModelChg = true;
  956. }
  957. if (this.boMAN && maidProp.idx == 43)
  958. {
  959. for (int j = 44; j <= 100; j++)
  960. {
  961. this.GetProp((MPN)j).boDut = true;
  962. }
  963. this.GetProp(MPN.moza).boDut = true;
  964. }
  965. else if (maidProp.idx == 50 || maidProp.idx == 46 || maidProp.idx == 47 || maidProp.idx == 49 || maidProp.idx == 48)
  966. {
  967. this.GetProp(MPN.haircolor).boDut = true;
  968. }
  969. else if (maidProp.idx == 45)
  970. {
  971. MPN[] array = new MPN[]
  972. {
  973. MPN.skin,
  974. MPN.eye,
  975. MPN.mayu,
  976. MPN.eye_hi,
  977. MPN.eye_hi_r,
  978. MPN.EyeClose,
  979. MPN.EarNone,
  980. MPN.EarElf,
  981. MPN.EarRot,
  982. MPN.EarScl,
  983. MPN.NosePos,
  984. MPN.NoseScl,
  985. MPN.FaceShape,
  986. MPN.FaceShapeSlim,
  987. MPN.MayuShapeIn,
  988. MPN.MayuShapeOut,
  989. MPN.MayuX,
  990. MPN.MayuY,
  991. MPN.MayuRot,
  992. MPN.eye_hi_r,
  993. MPN.eyewhite,
  994. MPN.nose,
  995. MPN.facegloss,
  996. MPN.lip
  997. };
  998. foreach (MPN mpn in array)
  999. {
  1000. this.GetProp(mpn).boDut = true;
  1001. }
  1002. }
  1003. else if (maidProp.idx == 52)
  1004. {
  1005. MaidProp prop = this.GetProp(MPN.acctatoo);
  1006. prop.boDut = true;
  1007. if (prop.listSubProp != null)
  1008. {
  1009. for (int l = 0; l < prop.listSubProp.Count; l++)
  1010. {
  1011. if (prop.listSubProp[l] != null)
  1012. {
  1013. prop.listSubProp[l].bDut = true;
  1014. }
  1015. }
  1016. }
  1017. prop = this.GetProp(MPN.hokuro);
  1018. prop.boDut = true;
  1019. if (prop.listSubProp != null)
  1020. {
  1021. for (int n = 0; n < prop.listSubProp.Count; n++)
  1022. {
  1023. if (prop.listSubProp[n] != null)
  1024. {
  1025. prop.listSubProp[n].bDut = true;
  1026. }
  1027. }
  1028. }
  1029. this.GetProp(MPN.lip).boDut = true;
  1030. this.GetProp(MPN.nose).boDut = true;
  1031. this.GetProp(MPN.facegloss).boDut = true;
  1032. }
  1033. }
  1034. }
  1035. }
  1036. realtimeSinceStartup = Time.realtimeSinceStartup;
  1037. bool flag = false;
  1038. foreach (MaidProp maidProp2 in this.m_dicMaidProp.Values)
  1039. {
  1040. if (maidProp2.type != 3)
  1041. {
  1042. flag |= this.ProcItem(maidProp2);
  1043. }
  1044. }
  1045. if (flag)
  1046. {
  1047. this.body0.ItemScaleReset();
  1048. }
  1049. realtimeSinceStartup = Time.realtimeSinceStartup;
  1050. if (this.boModelChg)
  1051. {
  1052. this.body0.MulTexProc();
  1053. this.body0.FixMaskFlag();
  1054. this.body0.FixVisibleFlag(false);
  1055. }
  1056. realtimeSinceStartup = Time.realtimeSinceStartup;
  1057. this.ProcSSParam();
  1058. }
  1059. private bool ProcItem(MaidProp mp)
  1060. {
  1061. bool result = false;
  1062. string name = mp.name;
  1063. if (mp.type == 1)
  1064. {
  1065. if (mp.boTempDut)
  1066. {
  1067. mp.boTempDut = false;
  1068. this.body0.VertexMorph_FromProcItem(name, (float)mp.temp_value / 100f);
  1069. result = true;
  1070. }
  1071. if (mp.boDut)
  1072. {
  1073. mp.boDut = false;
  1074. this.body0.VertexMorph_FromProcItem(name, (float)mp.value / 100f);
  1075. result = true;
  1076. }
  1077. }
  1078. else if (mp.type == 2)
  1079. {
  1080. if (mp.boTempDut)
  1081. {
  1082. mp.boTempDut = false;
  1083. this.body0.BoneMorph_FromProcItem(name, (float)mp.temp_value / 100f);
  1084. result = true;
  1085. }
  1086. if (mp.boDut)
  1087. {
  1088. mp.boDut = false;
  1089. this.body0.BoneMorph_FromProcItem(name, (float)mp.value / 100f);
  1090. result = true;
  1091. }
  1092. }
  1093. else if (mp.type == 3)
  1094. {
  1095. if (mp.boTempDut && mp.boDut)
  1096. {
  1097. string[] array = new string[6];
  1098. array[0] = "Item実行を、本元とTempを同時に更新しようとしました。";
  1099. int num = 1;
  1100. MPN idx = (MPN)mp.idx;
  1101. array[num] = idx.ToString();
  1102. array[2] = " 元=";
  1103. array[3] = mp.strFileName;
  1104. array[4] = " Temp=";
  1105. array[5] = mp.strTempFileName;
  1106. Debug.LogWarning(string.Concat(array));
  1107. }
  1108. if (mp.boTempDut)
  1109. {
  1110. if (!string.IsNullOrEmpty(mp.strTempFileName) && !Menu.ProcScript(this, mp, true, null))
  1111. {
  1112. Debug.LogWarning("メニューファイル " + mp.strFileName + " が開けませんでした。");
  1113. mp.nTempFileNameRID = 0;
  1114. mp.strTempFileName = string.Empty;
  1115. }
  1116. result = true;
  1117. mp.boTempDut = false;
  1118. if (97 <= mp.idx && mp.idx <= 100)
  1119. {
  1120. mp.nTempFileNameRID = 0;
  1121. mp.strTempFileName = string.Empty;
  1122. }
  1123. }
  1124. if (mp.boDut)
  1125. {
  1126. if (!string.IsNullOrEmpty(mp.strFileName) && !Menu.ProcScript(this, mp, false, null))
  1127. {
  1128. Debug.LogWarning("メニューファイル " + mp.strFileName + " が開けませんでした。");
  1129. if (this.DelProp((MPN)mp.idx, false))
  1130. {
  1131. Menu.ProcScript(this, mp, false, null);
  1132. }
  1133. }
  1134. result = true;
  1135. mp.boDut = false;
  1136. if (97 <= mp.idx && mp.idx <= 100)
  1137. {
  1138. mp.nFileNameRID = 0;
  1139. mp.strFileName = string.Empty;
  1140. }
  1141. }
  1142. if (mp.listSubProp != null)
  1143. {
  1144. for (int i = 0; i < mp.listSubProp.Count; i++)
  1145. {
  1146. SubProp subProp = mp.listSubProp[i];
  1147. if (subProp != null && subProp.bDut)
  1148. {
  1149. if (!Menu.ProcScript(this, subProp.strFileName, false, subProp))
  1150. {
  1151. Debug.LogWarning("サブメニューファイル " + subProp.strFileName + " が開けませんでした。");
  1152. mp.listSubProp[i] = null;
  1153. }
  1154. result = true;
  1155. subProp.bDut = false;
  1156. }
  1157. }
  1158. }
  1159. if (mp.boAdjustDut)
  1160. {
  1161. if (this.body0.isLoadedBody)
  1162. {
  1163. foreach (KeyValuePair<TBody.SlotID, Dictionary<string, KeyValuePair<int, VtxAttachPos>>> keyValuePair in mp.m_dicTBodyAttachPos)
  1164. {
  1165. TBodySkin tbodySkin = this.body0.goSlot[(int)keyValuePair.Key];
  1166. if (tbodySkin.morph != null)
  1167. {
  1168. foreach (KeyValuePair<string, KeyValuePair<int, VtxAttachPos>> keyValuePair2 in keyValuePair.Value)
  1169. {
  1170. tbodySkin.morph.SetAttachPointOffsetLocal(keyValuePair2.Key, keyValuePair2.Value.Value);
  1171. result = true;
  1172. }
  1173. }
  1174. }
  1175. }
  1176. mp.boAdjustDut = false;
  1177. }
  1178. }
  1179. return result;
  1180. }
  1181. public bool MayuDrawPriority
  1182. {
  1183. get
  1184. {
  1185. string materialProperty = this.body0.GetMaterialProperty("head", 3, "_ZTest2", "AUTO");
  1186. if (!string.IsNullOrEmpty(materialProperty))
  1187. {
  1188. float num = 0f;
  1189. if (float.TryParse(materialProperty, out num))
  1190. {
  1191. if ((int)(num + 0.5f) == 1)
  1192. {
  1193. return false;
  1194. }
  1195. if ((int)(num + 0.5f) == 7)
  1196. {
  1197. return true;
  1198. }
  1199. }
  1200. }
  1201. return false;
  1202. }
  1203. set
  1204. {
  1205. this.body0.SetMaterialProperty("mayu", "head", 3, "_ZTest2", "UnityEngine.Rendering.CompareFunction", (!value) ? "1" : "7", true);
  1206. }
  1207. }
  1208. public void SubPropAlpha(MPN f_mpn, int f_nSubNo, float f_fTexMulAlpha)
  1209. {
  1210. MaidProp maidProp = this.m_aryMaidProp[(int)f_mpn];
  1211. if (maidProp.listSubProp.Count <= f_nSubNo)
  1212. {
  1213. Debug.LogError("listSubProp の範囲を超えています。");
  1214. return;
  1215. }
  1216. SubProp subProp = maidProp.listSubProp[f_nSubNo];
  1217. if (subProp == null)
  1218. {
  1219. Debug.LogError("listSubProp に " + f_nSubNo + " 番はありません。");
  1220. return;
  1221. }
  1222. subProp.fTexMulAlpha = f_fTexMulAlpha;
  1223. }
  1224. public bool SerializeProp(BinaryWriter f_bwWrite)
  1225. {
  1226. f_bwWrite.Write("CM3D2_MPROP_LIST");
  1227. f_bwWrite.Write(1260);
  1228. f_bwWrite.Write(this.m_dicMaidProp.Count);
  1229. int num = 0;
  1230. foreach (KeyValuePair<string, MaidProp> keyValuePair in this.m_dicMaidProp)
  1231. {
  1232. f_bwWrite.Write(keyValuePair.Key);
  1233. keyValuePair.Value.Serialize(f_bwWrite);
  1234. num++;
  1235. }
  1236. return true;
  1237. }
  1238. public bool SerializePropLowCapacity(BinaryWriter writer)
  1239. {
  1240. NDebug.Assert(this.m_dicMaidProp.Count < 65535, "容量over");
  1241. writer.Write((char)this.m_dicMaidProp.Count);
  1242. NDebug.Assert(true, "MPN容量over");
  1243. foreach (KeyValuePair<string, MaidProp> keyValuePair in this.m_dicMaidProp)
  1244. {
  1245. MPN mpn = (MPN)Enum.Parse(typeof(MPN), keyValuePair.Key);
  1246. writer.Write((char)mpn);
  1247. keyValuePair.Value.SerializeLowCapacity(writer);
  1248. }
  1249. return true;
  1250. }
  1251. public bool SerializeMultiColor(BinaryWriter f_bwWrite)
  1252. {
  1253. return this.m_Parts.Serialize(f_bwWrite);
  1254. }
  1255. public bool SerializeMisc(BinaryWriter f_bwWrite)
  1256. {
  1257. f_bwWrite.Write("CM3D2_MAID_MISC");
  1258. f_bwWrite.Write(1260);
  1259. f_bwWrite.Write(this.m_nActiveSlotNo);
  1260. if (this.m_texIcon != null)
  1261. {
  1262. byte[] array = this.m_texIcon.EncodeToPNG();
  1263. f_bwWrite.Write(array.Length);
  1264. f_bwWrite.Write(array);
  1265. }
  1266. else
  1267. {
  1268. f_bwWrite.Write(0);
  1269. }
  1270. f_bwWrite.Write(this.m_strThumCardTime);
  1271. f_bwWrite.Write(this.m_colMan.r);
  1272. f_bwWrite.Write(this.m_colMan.g);
  1273. f_bwWrite.Write(this.m_colMan.b);
  1274. f_bwWrite.Write(this.m_colMan.a);
  1275. f_bwWrite.Write(this.m_nVoicePitch);
  1276. this.FixThumCard();
  1277. return true;
  1278. }
  1279. public bool SerializeBody(BinaryWriter f_bwWrite)
  1280. {
  1281. f_bwWrite.Write("CM3D2_MAID_BODY");
  1282. f_bwWrite.Write(1260);
  1283. return true;
  1284. }
  1285. public bool DeserializeProp(BinaryReader f_brRead)
  1286. {
  1287. string a = f_brRead.ReadString();
  1288. NDebug.Assert(a == "CM3D2_MPROP_LIST", "メイドプロパティリストのヘッダーが不正です。");
  1289. int num = f_brRead.ReadInt32();
  1290. int num2 = f_brRead.ReadInt32();
  1291. for (int i = 0; i < num2; i++)
  1292. {
  1293. string tag = f_brRead.ReadString();
  1294. MaidProp prop = this.GetProp(tag);
  1295. prop.Deserialize(f_brRead);
  1296. if (num <= 135 && prop.idx == 83 && Path.GetFileNameWithoutExtension(prop.strFileName.ToLower()) == "acckubi007_i_")
  1297. {
  1298. prop.boDut = true;
  1299. prop.strFileName = CM3.dicDelItem[MPN.acckubi];
  1300. prop.nFileNameRID = prop.strFileName.ToLower().GetHashCode();
  1301. prop.strTempFileName = string.Empty;
  1302. prop.nTempFileNameRID = 0;
  1303. }
  1304. }
  1305. if (num <= 110)
  1306. {
  1307. MaidProp prop2 = this.GetProp(MPN.EyeScl);
  1308. MaidProp prop3 = this.GetProp(MPN.EyeSclX);
  1309. prop3.value = prop2.value;
  1310. MaidProp prop4 = this.GetProp(MPN.EyeSclY);
  1311. prop4.value = prop2.value;
  1312. }
  1313. this.AllProcPropSeqStart();
  1314. return true;
  1315. }
  1316. public void DeserializeOldData(OldDataConverter.MaidData data, bool statusOnly = false)
  1317. {
  1318. NDebug.AssertNull(data != null);
  1319. this.status.Deserialize(data.statusReader, true);
  1320. using (MemoryStream memoryStream = new MemoryStream(data.ReadAppearanceByte()))
  1321. {
  1322. using (BinaryReader binaryReader = new BinaryReader(memoryStream))
  1323. {
  1324. this.DeserializeProp(binaryReader);
  1325. this.DeserializeMultiColor(binaryReader);
  1326. }
  1327. }
  1328. if (!statusOnly)
  1329. {
  1330. Texture2D texture2D = new Texture2D(1, 1, TextureFormat.ARGB32, false);
  1331. texture2D.LoadImage(data.ReadThumbnailByte());
  1332. byte[] array = data.ReadAppearanceByte();
  1333. this.SetThumIcon(texture2D);
  1334. string text = GameMain.Instance.CMSystem.CM3D2Path + "\\Thumb\\" + this.status.guid + ".png";
  1335. if (File.Exists(text))
  1336. {
  1337. string text2 = Path.GetFullPath(".\\") + "Thumb\\" + this.status.guid + ".png";
  1338. if (!File.Exists(text2))
  1339. {
  1340. File.Copy(text, text2);
  1341. }
  1342. }
  1343. }
  1344. }
  1345. public static List<MaidProp> DeserializePropPre(BinaryReader f_brRead)
  1346. {
  1347. List<MaidProp> list = new List<MaidProp>();
  1348. string a = f_brRead.ReadString();
  1349. NDebug.Assert(a == "CM3D2_MPROP_LIST", "メイドプロパティリストのヘッダーが不正です。");
  1350. int num = f_brRead.ReadInt32();
  1351. int num2 = f_brRead.ReadInt32();
  1352. HashSet<MPN> hashSet = new HashSet<MPN>();
  1353. for (int i = 0; i < num2; i++)
  1354. {
  1355. if (4 <= num)
  1356. {
  1357. string text = f_brRead.ReadString();
  1358. }
  1359. MaidProp maidProp = new MaidProp();
  1360. maidProp.Deserialize(f_brRead);
  1361. hashSet.Add((MPN)maidProp.idx);
  1362. list.Add(maidProp);
  1363. if (num <= 110 && maidProp.idx == 10)
  1364. {
  1365. list.Add(new MaidProp
  1366. {
  1367. type = maidProp.type,
  1368. idx = 11,
  1369. name = MPN.EyeSclX.ToString(),
  1370. value = maidProp.value,
  1371. min = maidProp.min,
  1372. max = maidProp.max,
  1373. boDut = true
  1374. });
  1375. list.Add(new MaidProp
  1376. {
  1377. type = maidProp.type,
  1378. idx = 12,
  1379. name = MPN.EyeSclY.ToString(),
  1380. value = maidProp.value,
  1381. min = maidProp.min,
  1382. max = maidProp.max,
  1383. boDut = true
  1384. });
  1385. }
  1386. }
  1387. if (num < 200)
  1388. {
  1389. list.Add(Maid.CreateProp(0, 100, 0, MPN.EyeClose, 2));
  1390. list.Add(Maid.CreateProp(0, 100, 0, MPN.FaceShape, 2));
  1391. list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuX, 2));
  1392. list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuY, 2));
  1393. }
  1394. if (num < 210)
  1395. {
  1396. list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallPosX, 2));
  1397. list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallPosY, 2));
  1398. list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallSclX, 2));
  1399. list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallSclY, 2));
  1400. }
  1401. if (!hashSet.Contains(MPN.FaceShapeSlim))
  1402. {
  1403. list.Add(Maid.CreateProp(0, 100, 0, MPN.FaceShapeSlim, 2));
  1404. }
  1405. if (!hashSet.Contains(MPN.EarNone))
  1406. {
  1407. list.Add(Maid.CreateProp(0, 1, 0, MPN.EarNone, 2));
  1408. }
  1409. if (!hashSet.Contains(MPN.EarElf))
  1410. {
  1411. list.Add(Maid.CreateProp(0, 100, 0, MPN.EarElf, 2));
  1412. }
  1413. if (!hashSet.Contains(MPN.EarRot))
  1414. {
  1415. list.Add(Maid.CreateProp(0, 100, 50, MPN.EarRot, 2));
  1416. }
  1417. if (!hashSet.Contains(MPN.EarScl))
  1418. {
  1419. list.Add(Maid.CreateProp(0, 100, 50, MPN.EarScl, 2));
  1420. }
  1421. if (!hashSet.Contains(MPN.NosePos))
  1422. {
  1423. list.Add(Maid.CreateProp(0, 100, 50, MPN.NosePos, 2));
  1424. }
  1425. if (!hashSet.Contains(MPN.NoseScl))
  1426. {
  1427. list.Add(Maid.CreateProp(0, 100, 50, MPN.NoseScl, 2));
  1428. }
  1429. if (!hashSet.Contains(MPN.MayuShapeIn))
  1430. {
  1431. list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuShapeIn, 2));
  1432. }
  1433. if (!hashSet.Contains(MPN.MayuShapeOut))
  1434. {
  1435. list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuShapeOut, 2));
  1436. }
  1437. if (!hashSet.Contains(MPN.MayuRot))
  1438. {
  1439. list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuRot, 2));
  1440. }
  1441. return list;
  1442. }
  1443. public static List<MaidProp> DeserializePropLowCapacity(BinaryReader reader)
  1444. {
  1445. List<MaidProp> list = Maid.CreateInitMaidPropList();
  1446. Dictionary<int, MaidProp> dictionary = new Dictionary<int, MaidProp>();
  1447. for (int i = 0; i < list.Count; i++)
  1448. {
  1449. dictionary.Add(list[i].idx, list[i]);
  1450. }
  1451. int num = (int)reader.ReadChar();
  1452. for (int j = 0; j < num; j++)
  1453. {
  1454. int key = (int)reader.ReadChar();
  1455. MaidProp maidProp = dictionary[key];
  1456. maidProp.DeserializeLowCapacity(reader);
  1457. }
  1458. return list;
  1459. }
  1460. public static MaidParts.PartsColor[] DeserializeMultiColorPre(BinaryReader f_brRead)
  1461. {
  1462. return MaidParts.DeserializePre(f_brRead);
  1463. }
  1464. public bool DeserializeMultiColor(BinaryReader f_brRead)
  1465. {
  1466. MaidParts.PartsColor[] array = MaidParts.DeserializePre(f_brRead);
  1467. for (int i = 0; i < array.Length; i++)
  1468. {
  1469. this.Parts.SetPartsColor((MaidParts.PARTS_COLOR)i, array[i]);
  1470. }
  1471. return true;
  1472. }
  1473. public bool DeserializeMisc(BinaryReader f_brRead)
  1474. {
  1475. string a = f_brRead.ReadString();
  1476. NDebug.Assert(a == "CM3D2_MAID_MISC", "メイドその他のヘッダーが不正です。");
  1477. int num = f_brRead.ReadInt32();
  1478. this.m_nActiveSlotNo = f_brRead.ReadInt32();
  1479. int num2 = f_brRead.ReadInt32();
  1480. if (num2 != 0)
  1481. {
  1482. byte[] data = f_brRead.ReadBytes(num2);
  1483. UnityEngine.Object.Destroy(this.m_texIcon);
  1484. this.m_texIcon = new Texture2D(1, 1, TextureFormat.ARGB32, false);
  1485. this.m_texIcon.LoadImage(data);
  1486. }
  1487. if (8 <= num)
  1488. {
  1489. this.m_strThumCardTime = f_brRead.ReadString();
  1490. }
  1491. this.m_colMan.r = f_brRead.ReadSingle();
  1492. this.m_colMan.g = f_brRead.ReadSingle();
  1493. this.m_colMan.b = f_brRead.ReadSingle();
  1494. this.m_colMan.a = f_brRead.ReadSingle();
  1495. if (202 <= num)
  1496. {
  1497. this.m_nVoicePitch = f_brRead.ReadInt32();
  1498. }
  1499. this.CheckOldThumCard();
  1500. return true;
  1501. }
  1502. public static bool DeserializeBodyPre(BinaryReader f_brRead)
  1503. {
  1504. return Maid.DeserializeBodyRead(f_brRead);
  1505. }
  1506. public bool DeserializeBody(BinaryReader f_brRead)
  1507. {
  1508. return Maid.DeserializeBodyRead(f_brRead);
  1509. }
  1510. public static bool DeserializeBodyRead(BinaryReader f_brRead)
  1511. {
  1512. string a = f_brRead.ReadString();
  1513. NDebug.Assert(a == "CM3D2_MAID_BODY", "メイドBodyヘッダーが不正です。");
  1514. int num = f_brRead.ReadInt32();
  1515. return true;
  1516. }
  1517. public void SetTBodySkinPos(MPN m_mpn, TBody.SlotID f_slot, Vector3 f_vPosLocal, Quaternion f_qRotLocal, Vector3 f_vScaleRate, bool f_bEnable)
  1518. {
  1519. MaidProp prop = this.GetProp(m_mpn);
  1520. BoneAttachPos boneAttachPos = new BoneAttachPos();
  1521. boneAttachPos.bEnable = f_bEnable;
  1522. boneAttachPos.pss.position = f_vPosLocal;
  1523. boneAttachPos.pss.rotation = f_qRotLocal;
  1524. boneAttachPos.pss.scale = f_vScaleRate;
  1525. prop.m_dicTBodySkinPos[f_slot] = new KeyValuePair<int, BoneAttachPos>(prop.nFileNameRID, boneAttachPos);
  1526. }
  1527. public BoneAttachPos GetTBodySkinPos(MPN m_mpn, TBody.SlotID f_slot)
  1528. {
  1529. BoneAttachPos result = null;
  1530. MaidProp prop = this.GetProp(m_mpn);
  1531. KeyValuePair<int, BoneAttachPos> keyValuePair;
  1532. if (prop.m_dicTBodySkinPos.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID)
  1533. {
  1534. result = keyValuePair.Value;
  1535. }
  1536. return result;
  1537. }
  1538. public void ClearTBodySkinPos(MPN m_mpn, TBody.SlotID f_slot)
  1539. {
  1540. MaidProp prop = this.GetProp(m_mpn);
  1541. prop.m_dicTBodySkinPos.Remove(f_slot);
  1542. }
  1543. 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)
  1544. {
  1545. MaidProp prop = this.GetProp(m_mpn);
  1546. Dictionary<string, KeyValuePair<int, VtxAttachPos>> dictionary;
  1547. if (!prop.m_dicTBodyAttachPos.TryGetValue(f_slot, out dictionary))
  1548. {
  1549. dictionary = (prop.m_dicTBodyAttachPos[f_slot] = new Dictionary<string, KeyValuePair<int, VtxAttachPos>>());
  1550. }
  1551. VtxAttachPos vtxAttachPos = new VtxAttachPos();
  1552. vtxAttachPos.vtxcount = f_vtxcount;
  1553. vtxAttachPos.vidx = f_vidx;
  1554. vtxAttachPos.prs.position = f_vPosLocal;
  1555. vtxAttachPos.prs.rotation = f_qRotLocal;
  1556. vtxAttachPos.prs.scale = f_vScaleRate;
  1557. vtxAttachPos.bEnable = f_bEnable;
  1558. dictionary[f_apname] = new KeyValuePair<int, VtxAttachPos>(prop.nFileNameRID, vtxAttachPos);
  1559. }
  1560. public VtxAttachPos GetAttachPointPos(MPN m_mpn, TBody.SlotID f_slot, int f_vtxcount, string f_apname)
  1561. {
  1562. VtxAttachPos result = null;
  1563. MaidProp prop = this.GetProp(m_mpn);
  1564. Dictionary<string, KeyValuePair<int, VtxAttachPos>> dictionary;
  1565. KeyValuePair<int, VtxAttachPos> keyValuePair;
  1566. if (prop.m_dicTBodyAttachPos.TryGetValue(f_slot, out dictionary) && dictionary.TryGetValue(f_apname, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID && keyValuePair.Value.vtxcount == f_vtxcount)
  1567. {
  1568. result = keyValuePair.Value;
  1569. }
  1570. return result;
  1571. }
  1572. public void ClearAttachPointPos(MPN m_mpn, TBody.SlotID f_slot, string f_apname)
  1573. {
  1574. MaidProp prop = this.GetProp(m_mpn);
  1575. Dictionary<string, KeyValuePair<int, VtxAttachPos>> dictionary;
  1576. if (prop.m_dicTBodyAttachPos.TryGetValue(f_slot, out dictionary))
  1577. {
  1578. dictionary.Remove(f_apname);
  1579. }
  1580. }
  1581. public void SetMaterialProperty(MPN m_mpn, TBody.SlotID f_slot, int f_nMatNo, string f_strPropName, string f_strTypeName, string f_strValue)
  1582. {
  1583. MaidProp prop = this.GetProp(m_mpn);
  1584. prop.m_dicMaterialProp[f_slot] = new KeyValuePair<int, MatPropSave>(prop.nFileNameRID, new MatPropSave(f_nMatNo, f_strPropName, f_strTypeName, f_strValue));
  1585. }
  1586. public MatPropSave GetMaterialProperty(MPN m_mpn, TBody.SlotID f_slot)
  1587. {
  1588. MaidProp prop = this.GetProp(m_mpn);
  1589. KeyValuePair<int, MatPropSave> keyValuePair;
  1590. if (prop.m_dicMaterialProp.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID)
  1591. {
  1592. return keyValuePair.Value;
  1593. }
  1594. return null;
  1595. }
  1596. public void SetHairLengthSaveToMP(MPN f_mpn, TBody.SlotID f_slot, string f_strName, float f_fValue)
  1597. {
  1598. MaidProp prop = this.GetProp(f_mpn);
  1599. KeyValuePair<int, Dictionary<string, float>> value;
  1600. if (!prop.m_dicBoneLength.TryGetValue(f_slot, out value))
  1601. {
  1602. Dictionary<TBody.SlotID, KeyValuePair<int, Dictionary<string, float>>> dicBoneLength = prop.m_dicBoneLength;
  1603. value = new KeyValuePair<int, Dictionary<string, float>>(prop.nFileNameRID, new Dictionary<string, float>());
  1604. dicBoneLength[f_slot] = value;
  1605. }
  1606. value.Value[f_strName] = f_fValue;
  1607. }
  1608. public bool GetHairLengthFromMP(MPN f_mpn, TBody.SlotID f_slot, string f_strName, out float f_fOutValue)
  1609. {
  1610. MaidProp prop = this.GetProp(f_mpn);
  1611. KeyValuePair<int, Dictionary<string, float>> keyValuePair;
  1612. if (prop.m_dicBoneLength.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID && keyValuePair.Value.TryGetValue(f_strName, out f_fOutValue))
  1613. {
  1614. return true;
  1615. }
  1616. f_fOutValue = 0.5f;
  1617. return false;
  1618. }
  1619. public void ClearHairLengthMP(MPN f_mpn, TBody.SlotID f_slot)
  1620. {
  1621. MaidProp prop = this.GetProp(f_mpn);
  1622. if (prop.m_dicBoneLength != null && prop.m_dicBoneLength.ContainsKey(f_slot))
  1623. {
  1624. prop.m_dicBoneLength.Remove(f_slot);
  1625. }
  1626. }
  1627. public bool NotExistThenClearHairLengthMP(MPN f_mpn, TBody.SlotID f_slot)
  1628. {
  1629. MaidProp prop = this.GetProp(f_mpn);
  1630. KeyValuePair<int, Dictionary<string, float>> keyValuePair;
  1631. if (prop.m_dicBoneLength.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key != prop.nFileNameRID)
  1632. {
  1633. prop.m_dicBoneLength.Remove(f_slot);
  1634. return true;
  1635. }
  1636. return false;
  1637. }
  1638. public void ThumShotCamMove()
  1639. {
  1640. GameMain.Instance.ThumCamera.GetComponent<ThumShot>().MoveTargetCard(this);
  1641. GameMain.Instance.ThumCamera.GetComponent<ThumShot>().MoveTargetThum(this);
  1642. }
  1643. public void ThumShot()
  1644. {
  1645. UnityEngine.Object.Destroy(this.m_texIcon);
  1646. this.m_texIcon = GameMain.Instance.ThumCamera.GetComponent<ThumShot>().ShotThumIcon(this);
  1647. this.SetThumCard(GameMain.Instance.ThumCamera.GetComponent<ThumShot>().ShotThumCard(this));
  1648. }
  1649. public void ThumShotCustom(string saveFileName, bool adjustmentCameraTransform)
  1650. {
  1651. ThumShot component = GameMain.Instance.ThumCamera.GetComponent<ThumShot>();
  1652. Texture2D texture2D;
  1653. if (adjustmentCameraTransform)
  1654. {
  1655. texture2D = component.ShotThumCard(this);
  1656. }
  1657. else
  1658. {
  1659. texture2D = component.ShotThumCardOriginal();
  1660. }
  1661. string fullPath = Path.GetFullPath(".\\");
  1662. string text = fullPath + "Thumb";
  1663. if (!Directory.Exists(text))
  1664. {
  1665. Directory.CreateDirectory(text);
  1666. }
  1667. text = text + "/" + saveFileName;
  1668. UTY.SaveImage(texture2D, text);
  1669. UnityEngine.Object.Destroy(texture2D);
  1670. }
  1671. public void SetThumCard(Texture2D tex)
  1672. {
  1673. string fullPath = Path.GetFullPath(".\\");
  1674. string text = fullPath + "Thumb";
  1675. if (!Directory.Exists(text))
  1676. {
  1677. Directory.CreateDirectory(text);
  1678. }
  1679. string f_strFileName = string.Empty;
  1680. this.m_strThumCardTime = DateTime.Now.ToString("yyyyMMddHHmmssfff");
  1681. f_strFileName = text + "/_tmp_thum_" + this.status.guid + ".png";
  1682. UTY.SaveImage(tex, f_strFileName);
  1683. UnityEngine.Object.Destroy(tex);
  1684. Texture2D thumIcon = this.GetThumIcon();
  1685. f_strFileName = text + "/icon_thum_" + this.status.guid + ".png";
  1686. UTY.SaveImage(thumIcon, f_strFileName);
  1687. }
  1688. public void SetThumIcon(Texture2D icon_tex)
  1689. {
  1690. this.m_texIcon = icon_tex;
  1691. }
  1692. public Texture2D GetThumIcon()
  1693. {
  1694. return this.m_texIcon;
  1695. }
  1696. public Texture2D GetThumCard()
  1697. {
  1698. Texture2D result = null;
  1699. string fullPath = Path.GetFullPath(".\\");
  1700. string text = fullPath + "Thumb";
  1701. if (!Directory.Exists(text))
  1702. {
  1703. Directory.CreateDirectory(text);
  1704. }
  1705. string text2 = text + "/_tmp_thum_" + this.status.guid + ".png";
  1706. if (File.Exists(text2))
  1707. {
  1708. result = UTY.LoadTexture(text2);
  1709. }
  1710. else
  1711. {
  1712. text2 = text + "/" + this.status.guid + ".png";
  1713. if (File.Exists(text2))
  1714. {
  1715. result = UTY.LoadTexture(text2);
  1716. }
  1717. }
  1718. return result;
  1719. }
  1720. public static void DeletedTmpThumCards()
  1721. {
  1722. string fullPath = Path.GetFullPath(".\\");
  1723. string text = fullPath + "Thumb";
  1724. if (!Directory.Exists(text))
  1725. {
  1726. return;
  1727. }
  1728. string[] files = Directory.GetFiles(text, "*", SearchOption.TopDirectoryOnly);
  1729. for (int i = 0; i < files.Length; i++)
  1730. {
  1731. string text2 = text + "\\";
  1732. int num = files[i].IndexOf(text2);
  1733. if (num != 0)
  1734. {
  1735. files[i] = string.Empty;
  1736. }
  1737. else
  1738. {
  1739. string text3 = string.Empty;
  1740. try
  1741. {
  1742. text3 = files[i].Substring(text2.Length, files[i].Length - text2.Length);
  1743. }
  1744. catch
  1745. {
  1746. }
  1747. if (string.IsNullOrEmpty(text3))
  1748. {
  1749. files[i] = string.Empty;
  1750. }
  1751. else if (0 > text3.IndexOf(".png") || text3.IndexOf("_tmp_thum_") != 0)
  1752. {
  1753. files[i] = string.Empty;
  1754. }
  1755. }
  1756. }
  1757. for (int j = 0; j < files.Length; j++)
  1758. {
  1759. if (!string.IsNullOrEmpty(files[j]))
  1760. {
  1761. try
  1762. {
  1763. File.Delete(files[j]);
  1764. }
  1765. catch
  1766. {
  1767. }
  1768. }
  1769. }
  1770. }
  1771. private void FixThumCard()
  1772. {
  1773. string fullPath = Path.GetFullPath(".\\");
  1774. string text = fullPath + "Thumb";
  1775. if (!Directory.Exists(text))
  1776. {
  1777. return;
  1778. }
  1779. string text2 = text + "/_tmp_thum_" + this.status.guid + ".png";
  1780. if (!File.Exists(text2))
  1781. {
  1782. return;
  1783. }
  1784. string text3 = text + "/" + this.status.guid + ".png";
  1785. try
  1786. {
  1787. if (File.Exists(text3))
  1788. {
  1789. File.Delete(text3);
  1790. }
  1791. File.Move(text2, text3);
  1792. }
  1793. catch
  1794. {
  1795. }
  1796. }
  1797. private void CheckOldThumCard()
  1798. {
  1799. string fullPath = Path.GetFullPath(".\\");
  1800. string text = fullPath + "Thumb";
  1801. if (!Directory.Exists(text))
  1802. {
  1803. return;
  1804. }
  1805. string text2 = string.Concat(new string[]
  1806. {
  1807. text,
  1808. "/",
  1809. this.status.guid,
  1810. this.m_strThumCardTime,
  1811. ".png"
  1812. });
  1813. if (!File.Exists(text2))
  1814. {
  1815. return;
  1816. }
  1817. File.Move(text2, text + "/" + this.status.guid + ".png");
  1818. }
  1819. public void ProcSSParam()
  1820. {
  1821. this.boBallGAG = (this.body0.GetSlotUserParam("accHa", "口枷") > 0);
  1822. this.boNoseFook = (this.body0.GetSlotUserParam("accHana", "鼻フック") > 0);
  1823. }
  1824. public void StopAnime(string fn = "")
  1825. {
  1826. this.body0.StopAnime(fn);
  1827. }
  1828. public string CrossFade(string fn, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f)
  1829. {
  1830. return this.CrossFade(fn, GameUty.FileSystem, additive, loop, boAddQue, val, weight);
  1831. }
  1832. public string CrossFade(string fn, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f)
  1833. {
  1834. return this.body0.CrossFade(fn, fileSystem, additive, loop, boAddQue, val, weight);
  1835. }
  1836. public string CrossFadeAbsolute(string fn, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f)
  1837. {
  1838. return this.CrossFadeAbsolute(fn, GameUty.FileSystem, additive, loop, boAddQue, val, weight);
  1839. }
  1840. public string CrossFadeAbsolute(string fn, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f)
  1841. {
  1842. return this.body0.CrossFadeAbsolute(fn, fileSystem, additive, loop, boAddQue, val, weight);
  1843. }
  1844. public void CacheAnime(string fn, bool loadMuneL = false, bool loadMuneR = false)
  1845. {
  1846. this.body0.CacheLoadAnime(GameUty.FileSystem, Path.ChangeExtension(fn, ".anm"), loadMuneL, loadMuneR);
  1847. }
  1848. public Animation GetAnimation()
  1849. {
  1850. return this.body0.GetAnimation();
  1851. }
  1852. private void Start()
  1853. {
  1854. }
  1855. public void ResetAll()
  1856. {
  1857. this.FaceAnime("通常", 0f, 0);
  1858. this.FaceBlend("無し");
  1859. this.OpenMouth(false);
  1860. this.EyeToReset(0f);
  1861. this.DelPrefabAll();
  1862. string[] array = new string[]
  1863. {
  1864. "handitem",
  1865. "kousoku_upper",
  1866. "kousoku_lower",
  1867. "eye_hi",
  1868. "skirt",
  1869. "panz",
  1870. "mizugi",
  1871. "onepiece",
  1872. "accanl",
  1873. "accvag",
  1874. "KubiScl",
  1875. "UdeScl",
  1876. "DouPer",
  1877. "sintyou",
  1878. "kata",
  1879. "seieki_naka"
  1880. };
  1881. for (int i = 0; i < array.Length; i++)
  1882. {
  1883. this.ResetProp(array[i], false);
  1884. }
  1885. if (this.body0 != null && this.body0.isLoadedBody)
  1886. {
  1887. this.body0.SetMaskMode(TBody.MaskMode.None);
  1888. for (int j = 10; j <= 20; j++)
  1889. {
  1890. this.body0.MulTexRemove("body", 0, "_MainTex", j);
  1891. this.body0.MulTexRemove("body", 0, "_ShadowTex", j);
  1892. this.body0.MulTexRemove("head", 5, "_MainTex", j);
  1893. this.body0.MulTexRemove("head", 5, "_ShadowTex", j);
  1894. }
  1895. this.body0.MulTexProc("body");
  1896. this.body0.MulTexProc("head");
  1897. this.SetModeHairR(TBody.ModeHirR.Normal);
  1898. if (this.body0.isLoadedBody)
  1899. {
  1900. this.body0.MuneYureL(1f);
  1901. this.body0.MuneYureR(1f);
  1902. this.IKTargetToBone("左手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
  1903. this.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
  1904. }
  1905. }
  1906. }
  1907. public void Lipsync(bool f_bEnable)
  1908. {
  1909. this.boLipsync = f_bEnable;
  1910. }
  1911. public void LipSyncEnabled(bool enabled)
  1912. {
  1913. this.lipSyncEnabled = enabled;
  1914. }
  1915. public bool MicLipSync
  1916. {
  1917. get
  1918. {
  1919. return this.m_MicLipSync;
  1920. }
  1921. }
  1922. public void SetMicLipSync(bool is_start)
  1923. {
  1924. if (!this.AudioMan)
  1925. {
  1926. Debug.LogError("AudioManが見つかりません");
  1927. return;
  1928. }
  1929. this.m_MicLipSync = is_start;
  1930. this.m_bFoceKuchipakuSelfUpdateTime = is_start;
  1931. if (is_start)
  1932. {
  1933. if (!this.MicLipData.Context)
  1934. {
  1935. this.MicLipData.Context = this.AudioMan.gameObject.AddComponent<LowLatencyLipSyncContext>();
  1936. }
  1937. if (!this.MicLipData.MorphTarget)
  1938. {
  1939. this.MicLipData.MorphTarget = this.AudioMan.gameObject.AddComponent<OVRLipSyncContextMorphTarget>();
  1940. }
  1941. if (!this.MicLipData.MicInput)
  1942. {
  1943. this.MicLipData.MicInput = this.AudioMan.gameObject.AddComponent<OVRLipSyncMicInput>();
  1944. }
  1945. this.MicLipData.Context.Init();
  1946. this.MicLipData.MorphTarget.Init(this);
  1947. this.MicLipData.MicInput.Init(this);
  1948. this.MicLipData.MicInput.StartMicrophone();
  1949. }
  1950. else
  1951. {
  1952. if (this.MicLipData.MicInput)
  1953. {
  1954. this.MicLipData.MicInput.StopMicrophone();
  1955. }
  1956. this.AudioMan.audiosource.clip = null;
  1957. UnityEngine.Object.Destroy(this.MicLipData.Context);
  1958. UnityEngine.Object.Destroy(this.MicLipData.MorphTarget);
  1959. UnityEngine.Object.Destroy(this.MicLipData.MicInput);
  1960. }
  1961. }
  1962. public void StartKuchipakuPattern(float f_fOffsetTime, string f_strPattern, bool f_bSelfUpdateTime = false)
  1963. {
  1964. this.m_fKuchipakuPatternOffsetTime = f_fOffsetTime;
  1965. this.m_baKuchipakuPattern = Convert.FromBase64String(f_strPattern);
  1966. this.m_bFoceKuchipakuSelfUpdateTime = f_bSelfUpdateTime;
  1967. }
  1968. public void StopKuchipakuPattern()
  1969. {
  1970. this.m_fKuchipakuPatternOffsetTime = 0f;
  1971. this.m_baKuchipakuPattern = null;
  1972. this.m_bFoceKuchipakuSelfUpdateTime = false;
  1973. }
  1974. 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)
  1975. {
  1976. IKCtrlData ikdata = this.body0.IKCtrl.GetIKData(tag, true);
  1977. Transform axis_bone = null;
  1978. if (attach_type != IKCtrlData.IKAttachType.Rotate && !string.IsNullOrEmpty(axisbone))
  1979. {
  1980. axis_bone = CMT.SearchObjName(tgt_maid.body0.m_trBones, axisbone, true);
  1981. }
  1982. ikdata.SetIKSetting(attach_type, is_next, tgt_maid, this.body0.GetSlotNo(tgt_name), attachpoint_name, axis_bone, f_vecOffset, do_animation);
  1983. }
  1984. 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)
  1985. {
  1986. IKCtrlData ikdata = this.IKCtrl.GetIKData(tag, true);
  1987. if (tgtbone_name != "無し")
  1988. {
  1989. Transform target;
  1990. if (!search_sm)
  1991. {
  1992. target = CMT.SearchObjName(tgt_maid.body0.m_trBones, tgtbone_name, true);
  1993. }
  1994. else
  1995. {
  1996. target = CMT.SearchObjName(tgt_maid.body0.SmBody, tgtbone_name, false);
  1997. }
  1998. ikdata.SetIKSetting(attach_type, is_next, tgt_maid, target, f_vecOffset, do_animation);
  1999. }
  2000. else
  2001. {
  2002. ikdata.Detach(IKCtrlData.IKAttachType.NewPoint);
  2003. ikdata.Detach(IKCtrlData.IKAttachType.Rotate);
  2004. }
  2005. }
  2006. 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)
  2007. {
  2008. Transform transform = null;
  2009. GameObject prefabFromBg = GameMain.Instance.BgMgr.GetPrefabFromBg(odogu_name);
  2010. if (!prefabFromBg)
  2011. {
  2012. Debug.LogErrorFormat("現在の背景に大道具「{0}」は存在しません", new object[]
  2013. {
  2014. odogu_name
  2015. });
  2016. }
  2017. else if (prefabFromBg.transform.childCount == 0 || string.IsNullOrEmpty(tgt_name))
  2018. {
  2019. transform = prefabFromBg.transform;
  2020. }
  2021. else
  2022. {
  2023. for (int i = 0; i < prefabFromBg.transform.childCount; i++)
  2024. {
  2025. Transform child = prefabFromBg.transform.GetChild(i);
  2026. if (child && !(child.name != tgt_name))
  2027. {
  2028. transform = prefabFromBg.transform.GetChild(i);
  2029. break;
  2030. }
  2031. }
  2032. if (!transform)
  2033. {
  2034. Debug.LogErrorFormat("大道具「{0}」にターゲット「{1}」は存在しません", new object[]
  2035. {
  2036. odogu_name,
  2037. tgt_name
  2038. });
  2039. }
  2040. }
  2041. IKCtrlData ikdata = this.IKCtrl.GetIKData(tag, true);
  2042. ikdata.SetIKSetting(attach_type, is_next, transform, f_vecOffset, do_animation);
  2043. }
  2044. 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)
  2045. {
  2046. IKCtrlData ikdata = f_maidTarget.IKCtrl.GetIKData(bone_name, true);
  2047. if (!ikdata)
  2048. {
  2049. return;
  2050. }
  2051. Transform targetBone = ikdata.TargetBone;
  2052. IKCtrlData ikdata2 = this.IKCtrl.GetIKData(my_tag, true);
  2053. ikdata2.SetIKSetting(attach_type, is_next, f_maidTarget, bone_name, targetBone, f_vecOffset, do_animation);
  2054. }
  2055. public void IKDetach(string name)
  2056. {
  2057. this.IKTargetToBone(name, null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
  2058. }
  2059. public void AllIKDetach(float blendtime = 0f)
  2060. {
  2061. this.IKCtrl.BlendTime = blendtime;
  2062. this.IKCtrl.IKActive = (blendtime > 0f);
  2063. this.IKCtrl.AllForceIK = false;
  2064. foreach (string tag in this.IKCtrl.strIKDataPair.Keys)
  2065. {
  2066. this.IKTargetToBone(tag, null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
  2067. }
  2068. }
  2069. public void OpenMouth(bool f_bOpen)
  2070. {
  2071. this.boMouthOpen = f_bOpen;
  2072. }
  2073. public void OpenMouthLookTooth(bool f_bOpen)
  2074. {
  2075. this.boLookTooth = f_bOpen;
  2076. }
  2077. public void EyeToPosition(Vector3 f_vecTargetPos, float f_fFadeTime = 0f)
  2078. {
  2079. if (f_fFadeTime <= 0f)
  2080. {
  2081. f_fFadeTime = 0.001f;
  2082. }
  2083. this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime;
  2084. this.body0.trsLookTarget = null;
  2085. this.body0.offsetLookTarget = f_vecTargetPos;
  2086. this.body0.boHeadToCam = true;
  2087. this.body0.boEyeToCam = true;
  2088. this.body0.boEyeSorashi = false;
  2089. }
  2090. public void EyeToTargetObject(Transform target_trans, float f_fFadeTime = 0f)
  2091. {
  2092. this.body0.trsLookTarget = target_trans;
  2093. if (this.body0.trsLookTarget == null)
  2094. {
  2095. this.body0.offsetLookTarget = new Vector3(0f, 1f, 0f);
  2096. }
  2097. if (f_fFadeTime <= 0f)
  2098. {
  2099. f_fFadeTime = 0.001f;
  2100. }
  2101. this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime;
  2102. this.body0.boHeadToCam = true;
  2103. this.body0.boEyeToCam = true;
  2104. this.body0.boEyeSorashi = false;
  2105. }
  2106. public void EyeToTarget(Maid f_maidTarget, float f_fFadeTime = 0f, string f_strBoneName = "Bip01 Head")
  2107. {
  2108. Transform transform = CMT.SearchObjName(f_maidTarget.body0.m_trBones, f_strBoneName, true);
  2109. this.body0.trsLookTarget = transform;
  2110. if (transform == null)
  2111. {
  2112. this.body0.offsetLookTarget = new Vector3(0f, 1f, 0f);
  2113. }
  2114. if (f_fFadeTime <= 0f)
  2115. {
  2116. f_fFadeTime = 0.001f;
  2117. }
  2118. this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime;
  2119. this.body0.boHeadToCam = true;
  2120. this.body0.boEyeToCam = true;
  2121. this.body0.boEyeSorashi = false;
  2122. }
  2123. public void EyeToCamera(Maid.EyeMoveType f_eType, float f_fFadeTime = 0f)
  2124. {
  2125. this.body0.boHeadToCam = false;
  2126. this.body0.boEyeToCam = true;
  2127. this.body0.boEyeSorashi = false;
  2128. if (f_fFadeTime <= 0f)
  2129. {
  2130. f_fFadeTime = 0.001f;
  2131. }
  2132. this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime;
  2133. if (GameMain.Instance.VRMode)
  2134. {
  2135. if (GameMain.Instance.OvrMgr != null)
  2136. {
  2137. this.body0.trsLookTarget = GameMain.Instance.OvrMgr.EyeAnchor;
  2138. }
  2139. if (GameMain.Instance.OvrIK != null && OvrIK.IsVRIKMode && GameMain.Instance.OvrIK.NowMaid == this)
  2140. {
  2141. this.body0.trsLookTarget = GameMain.Instance.OvrIK.EyeTargetTrs;
  2142. }
  2143. }
  2144. else if (GameMain.Instance.MainCamera != null)
  2145. {
  2146. this.body0.trsLookTarget = GameMain.Instance.MainCamera.transform;
  2147. }
  2148. if (f_eType == Maid.EyeMoveType.無し)
  2149. {
  2150. this.body0.boEyeToCam = false;
  2151. }
  2152. if (f_eType == Maid.EyeMoveType.無視する)
  2153. {
  2154. this.body0.boEyeToCam = false;
  2155. }
  2156. if (f_eType == Maid.EyeMoveType.顔を向ける)
  2157. {
  2158. this.body0.boHeadToCam = true;
  2159. }
  2160. if (f_eType == Maid.EyeMoveType.顔だけ動かす)
  2161. {
  2162. this.body0.boHeadToCam = true;
  2163. this.body0.boEyeToCam = false;
  2164. }
  2165. if (f_eType == Maid.EyeMoveType.顔をそらす)
  2166. {
  2167. this.body0.trsLookTarget = null;
  2168. this.body0.boEyeSorashi = true;
  2169. this.body0.boEyeToCam = true;
  2170. this.body0.boHeadToCam = true;
  2171. }
  2172. if (f_eType == Maid.EyeMoveType.目と顔を向ける)
  2173. {
  2174. this.body0.boHeadToCam = true;
  2175. this.body0.boEyeToCam = true;
  2176. }
  2177. if (f_eType == Maid.EyeMoveType.目だけ向ける)
  2178. {
  2179. this.body0.boHeadToCam = false;
  2180. this.body0.boEyeToCam = true;
  2181. }
  2182. if (f_eType == Maid.EyeMoveType.目だけそらす)
  2183. {
  2184. this.body0.trsLookTarget = null;
  2185. this.body0.boEyeSorashi = true;
  2186. this.body0.boEyeToCam = true;
  2187. this.body0.boHeadToCam = false;
  2188. }
  2189. }
  2190. public void EyeToReset(float f_fFadeTime = 0f)
  2191. {
  2192. this.EyeToCamera(Maid.EyeMoveType.無し, f_fFadeTime);
  2193. }
  2194. public void LockHeadAndEye(bool toLock)
  2195. {
  2196. this.body0.boLockHeadAndEye = toLock;
  2197. }
  2198. public bool GetLockHeadAndEye()
  2199. {
  2200. return this.body0.boLockHeadAndEye;
  2201. }
  2202. public void SetModeHairR(TBody.ModeHirR f_eMode)
  2203. {
  2204. this.body0.Mode_HairR = f_eMode;
  2205. }
  2206. public void SetAutoTwist(Maid.AutoTwist f_eType, bool f_bEnable)
  2207. {
  2208. switch (f_eType)
  2209. {
  2210. case Maid.AutoTwist.ShoulderL:
  2211. this.body0.boAutoTwistShoulderL = f_bEnable;
  2212. break;
  2213. case Maid.AutoTwist.ShoulderR:
  2214. this.body0.boAutoTwistShoulderR = f_bEnable;
  2215. break;
  2216. case Maid.AutoTwist.WristL:
  2217. this.body0.boAutoTwistWristL = f_bEnable;
  2218. break;
  2219. case Maid.AutoTwist.WristR:
  2220. this.body0.boAutoTwistWristR = f_bEnable;
  2221. break;
  2222. case Maid.AutoTwist.ThighL:
  2223. this.body0.boAutoTwistThighL = f_bEnable;
  2224. break;
  2225. case Maid.AutoTwist.ThighR:
  2226. this.body0.boAutoTwistThighR = f_bEnable;
  2227. break;
  2228. }
  2229. }
  2230. public void SetAutoTwistAll(bool f_bEnable)
  2231. {
  2232. this.body0.boAutoTwistShoulderL = f_bEnable;
  2233. this.body0.boAutoTwistShoulderR = f_bEnable;
  2234. this.body0.boAutoTwistWristL = f_bEnable;
  2235. this.body0.boAutoTwistWristR = f_bEnable;
  2236. this.body0.boAutoTwistThighL = f_bEnable;
  2237. this.body0.boAutoTwistThighR = f_bEnable;
  2238. }
  2239. public void FaceAnime(string tag, float t = 1f, int chkcode = 0)
  2240. {
  2241. this.FaceAnimeChkCode = chkcode;
  2242. this.ActiveFace = tag;
  2243. 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 + "〓通常"))
  2244. {
  2245. tag += "〓通常";
  2246. }
  2247. if (t == 0f)
  2248. {
  2249. this.boFaceAnime = false;
  2250. this.FaceName = tag;
  2251. this.FaceName2 = string.Empty;
  2252. return;
  2253. }
  2254. this.boFaceAnime = true;
  2255. if (this.FaceName2 != string.Empty)
  2256. {
  2257. this.FaceName = this.FaceName2;
  2258. this.FaceName2 = string.Empty;
  2259. }
  2260. if (this.FaceName == string.Empty)
  2261. {
  2262. this.FaceName = "デフォ";
  2263. }
  2264. this.FaceName2 = tag;
  2265. this.FacePlus = 1f / t;
  2266. this.FaceTime = this.FacePlus * 0.0166666675f;
  2267. }
  2268. public void FaceBlend(string tag)
  2269. {
  2270. if (this.body0 == null)
  2271. {
  2272. Debug.LogError("Bodyが読み込まれる前に、表情ブレンドが呼ばれました。" + tag);
  2273. return;
  2274. }
  2275. if (tag == "無し")
  2276. {
  2277. tag = string.Empty;
  2278. }
  2279. this.FaceName3 = tag;
  2280. }
  2281. public void ChangeAutoFace(bool bo)
  2282. {
  2283. if (this.boAutoFace != bo)
  2284. {
  2285. this.AutoFaceLV_old = 0;
  2286. this.Hazukashi = 0f;
  2287. }
  2288. this.boAutoFace = bo;
  2289. }
  2290. public void AddPrefab(string f_strPrefab, string f_strName, string f_strDestBone, Vector3 f_vOffsetLocalPos, Vector3 f_vOffsetLocalRot)
  2291. {
  2292. UnityEngine.Object @object = Resources.Load("Prefab/" + f_strPrefab);
  2293. if (@object != null)
  2294. {
  2295. Transform transform = null;
  2296. if (this.body0 != null && this.body0.isLoadedBody)
  2297. {
  2298. transform = CMT.SearchObjName(this.body0.m_trBones, f_strDestBone, true);
  2299. }
  2300. if (transform != null)
  2301. {
  2302. GameObject goItem = UnityEngine.Object.Instantiate(@object) as GameObject;
  2303. goItem.AddComponent<AttachPrefab>();
  2304. goItem.name = goItem.name.Replace("(Clone)", string.Empty);
  2305. if (!string.IsNullOrEmpty(f_strName))
  2306. {
  2307. goItem.name = f_strName;
  2308. }
  2309. AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren<AttachPrefab>(true);
  2310. AttachPrefab[] array = (from a in componentsInChildren
  2311. where a.name == goItem.name
  2312. select a).ToArray<AttachPrefab>();
  2313. for (int i = 0; i < array.Length; i++)
  2314. {
  2315. UnityEngine.Object.DestroyImmediate(array[i].gameObject);
  2316. }
  2317. goItem.transform.SetParent(transform, false);
  2318. goItem.transform.localPosition = f_vOffsetLocalPos;
  2319. goItem.transform.localRotation = Quaternion.Euler(f_vOffsetLocalRot);
  2320. }
  2321. else
  2322. {
  2323. Debug.LogError("人物にプレハブ追加で、ボーン名が見つかりません。" + f_strDestBone);
  2324. }
  2325. }
  2326. else
  2327. {
  2328. Debug.LogError("人物にプレハブ追加で、プレハブが見つかりません。Prefab/" + f_strPrefab);
  2329. }
  2330. }
  2331. public void DelPrefab(string f_strName)
  2332. {
  2333. if (this.body0 == null || !this.body0.isLoadedBody)
  2334. {
  2335. return;
  2336. }
  2337. AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren<AttachPrefab>(true);
  2338. AttachPrefab[] array = (from a in componentsInChildren
  2339. where a.name == f_strName
  2340. select a).ToArray<AttachPrefab>();
  2341. for (int i = 0; i < array.Length; i++)
  2342. {
  2343. UnityEngine.Object.DestroyImmediate(array[i].gameObject);
  2344. }
  2345. }
  2346. public void DelPrefabAll()
  2347. {
  2348. if (this.body0 == null || !this.body0.isLoadedBody)
  2349. {
  2350. return;
  2351. }
  2352. AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren<AttachPrefab>(true);
  2353. for (int i = 0; i < componentsInChildren.Length; i++)
  2354. {
  2355. UnityEngine.Object.DestroyImmediate(componentsInChildren[i].gameObject);
  2356. }
  2357. }
  2358. public GameObject GetPrefab(string f_strName)
  2359. {
  2360. if (this.body0 == null || !this.body0.isLoadedBody)
  2361. {
  2362. return null;
  2363. }
  2364. AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren<AttachPrefab>(true);
  2365. AttachPrefab[] array = (from a in componentsInChildren
  2366. where a.name == f_strName
  2367. select a).ToArray<AttachPrefab>();
  2368. return (0 >= array.Length) ? null : array[0].gameObject;
  2369. }
  2370. public void AnimationObject(string f_strName, string f_strAnimName, bool f_bNowPlay, bool f_bLoop)
  2371. {
  2372. Transform transform;
  2373. if ((transform = CMT.SearchObjName(this.body0.m_trBones, f_strName, false)) != null)
  2374. {
  2375. Animation animation = transform.gameObject.GetComponent<Animation>();
  2376. if (animation == null)
  2377. {
  2378. animation = transform.gameObject.AddComponent<Animation>();
  2379. }
  2380. AnimationClip animationClip = ImportCM.LoadAniClipNative(GameUty.FileSystem, f_strAnimName, true, true, true);
  2381. if (animationClip == null)
  2382. {
  2383. NDebug.Assert("アニメーション " + f_strAnimName + " が見つかりません。", false);
  2384. }
  2385. animation.AddClip(animationClip, f_strAnimName);
  2386. animation.clip = animationClip;
  2387. animation.playAutomatically = true;
  2388. animation.wrapMode = ((!f_bLoop) ? WrapMode.Once : WrapMode.Loop);
  2389. if (f_bNowPlay)
  2390. {
  2391. animation.PlayQueued(f_strAnimName, QueueMode.PlayNow);
  2392. }
  2393. this.m_goTestAnim = transform.gameObject;
  2394. }
  2395. else
  2396. {
  2397. NDebug.Assert("人物に追加した " + f_strName + " は見つかりませんでした。", false);
  2398. }
  2399. }
  2400. public void SetPos(Vector3 f_vecLocalPos)
  2401. {
  2402. base.gameObject.transform.localPosition = f_vecLocalPos;
  2403. }
  2404. public void SetRot(Vector3 f_vecLocalRot)
  2405. {
  2406. base.gameObject.transform.localRotation = Quaternion.Euler(f_vecLocalRot);
  2407. }
  2408. public Vector3 GetPos()
  2409. {
  2410. return base.gameObject.transform.localPosition;
  2411. }
  2412. public Vector3 GetRot()
  2413. {
  2414. return base.gameObject.transform.localRotation.eulerAngles;
  2415. }
  2416. public Vector3 GetWorldRot()
  2417. {
  2418. return base.gameObject.transform.rotation.eulerAngles;
  2419. }
  2420. public void SetPosOffset(Vector3 f_vecLocalPos)
  2421. {
  2422. this.m_vOffsetPostion = f_vecLocalPos;
  2423. }
  2424. public void UpdateTransformData()
  2425. {
  2426. this.SetPos(this.baseOffset + this.motionOffset);
  2427. if (this.boMAN)
  2428. {
  2429. if (!string.IsNullOrEmpty(this.rotateLinkMaid))
  2430. {
  2431. for (int i = 0; i < GameMain.Instance.CharacterMgr.GetMaidCount(); i++)
  2432. {
  2433. Maid maid = GameMain.Instance.CharacterMgr.GetMaid(i);
  2434. if (maid != null && maid.status.guid == this.rotateLinkMaid)
  2435. {
  2436. maid.UpdateTransformData();
  2437. break;
  2438. }
  2439. }
  2440. }
  2441. return;
  2442. }
  2443. Vector3 position = base.transform.position;
  2444. base.transform.localRotation = Quaternion.identity;
  2445. if (!Mathf.Approximately(0f, this.baseEulerAngles.x))
  2446. {
  2447. base.transform.RotateAround(position, Vector3.right, this.baseEulerAngles.x);
  2448. }
  2449. if (!Mathf.Approximately(0f, this.baseEulerAngles.y))
  2450. {
  2451. base.transform.RotateAround(position, Vector3.up, this.baseEulerAngles.y);
  2452. }
  2453. if (!Mathf.Approximately(0f, this.baseEulerAngles.z))
  2454. {
  2455. base.transform.RotateAround(position, Vector3.forward, this.baseEulerAngles.z);
  2456. }
  2457. for (int j = 0; j < GameMain.Instance.CharacterMgr.GetManCount(); j++)
  2458. {
  2459. Maid man = GameMain.Instance.CharacterMgr.GetMan(j);
  2460. if (man != null && man.status.guid == this.rotateLinkMaid)
  2461. {
  2462. man.SetPos(man.baseOffset + man.motionOffset);
  2463. man.transform.localRotation = Quaternion.identity;
  2464. if (!Mathf.Approximately(0f, this.baseEulerAngles.x))
  2465. {
  2466. man.transform.RotateAround(position, Vector3.right, this.baseEulerAngles.x);
  2467. }
  2468. if (!Mathf.Approximately(0f, this.baseEulerAngles.y))
  2469. {
  2470. man.transform.RotateAround(position, Vector3.up, this.baseEulerAngles.y);
  2471. }
  2472. if (!Mathf.Approximately(0f, this.baseEulerAngles.z))
  2473. {
  2474. man.transform.RotateAround(position, Vector3.forward, this.baseEulerAngles.z);
  2475. }
  2476. break;
  2477. }
  2478. }
  2479. }
  2480. public void SetPosOffsetFromUdeSclX(string category, float val)
  2481. {
  2482. this.m_vOffsetPostion.x = ((float)this.GetProp(category).value - 50f) * (val / 50f);
  2483. }
  2484. public void SetPosOffsetFromUdeSclY(string category, float val)
  2485. {
  2486. this.m_vOffsetPostion.y = ((float)this.GetProp(category).value - 50f) * (val / 50f);
  2487. }
  2488. public void SetPosOffsetFromUdeSclZ(string category, float val)
  2489. {
  2490. this.m_vOffsetPostion.z = ((float)this.GetProp(category).value - 50f) * (val / 50f);
  2491. }
  2492. public void ExportModBaseMenu(MPN f_mpn)
  2493. {
  2494. MaidProp prop = this.GetProp(f_mpn);
  2495. if (string.IsNullOrEmpty(prop.strFileName))
  2496. {
  2497. NUty.WinMessageBox(NUty.GetWindowHandle(), "現在このスロットにはパーツが設定されていません。", "MOD Export Error", 0);
  2498. return;
  2499. }
  2500. Menu.ExportModScript(this, prop.strFileName, false);
  2501. }
  2502. public void ExportModBaseMqo(MPN f_mpn, string f_strOutFileName)
  2503. {
  2504. MaidProp prop = this.GetProp(f_mpn);
  2505. if (string.IsNullOrEmpty(prop.strFileName))
  2506. {
  2507. NUty.WinMessageBox(NUty.GetWindowHandle(), "現在このスロットにはパーツが設定されていません。", "MQO Export Error", 0);
  2508. return;
  2509. }
  2510. }
  2511. public void FoceKuchipakuUpdate(float f_fNowTime)
  2512. {
  2513. if (this.m_baKuchipakuPattern != null)
  2514. {
  2515. int num = (int)((this.m_fKuchipakuPatternOffsetTime + f_fNowTime) * 30f);
  2516. int num2 = this.m_baKuchipakuPattern.Length / 3;
  2517. if (0 < num && num < num2)
  2518. {
  2519. this.body0.Face.morph.boLipSync = true;
  2520. this.body0.Face.morph.LipSync1 = this.body0.Face.morph.LipSync1 * 0.15f + (float)this.m_baKuchipakuPattern[num * 3] / 255f * 0.85f * 3f;
  2521. this.body0.Face.morph.LipSync2 = this.body0.Face.morph.LipSync2 * 0.15f + (float)this.m_baKuchipakuPattern[num * 3 + 1] / 255f * 0.85f * 3f;
  2522. this.body0.Face.morph.LipSync3 = this.body0.Face.morph.LipSync3 * 0.15f + (float)this.m_baKuchipakuPattern[num * 3 + 2] / 255f * 0.85f * 3f;
  2523. }
  2524. else
  2525. {
  2526. this.body0.Face.morph.boLipSync = false;
  2527. }
  2528. }
  2529. }
  2530. private void Update()
  2531. {
  2532. if (this.boAllProcPropBUSY)
  2533. {
  2534. this.AllProcPropSeq();
  2535. return;
  2536. }
  2537. if (this.boMAN)
  2538. {
  2539. this.m_goOffset.transform.localPosition = this.m_vOffsetPostion;
  2540. return;
  2541. }
  2542. if (!this.body0.isLoadedBody)
  2543. {
  2544. return;
  2545. }
  2546. if (this.boOffsetY)
  2547. {
  2548. float num = this.body0.ToeL.position.y;
  2549. if (this.body0.ToeR.position.y < num)
  2550. {
  2551. num = this.body0.ToeR.position.y;
  2552. }
  2553. num = this.body0.CenterBone.position.y;
  2554. num *= 0.8f;
  2555. float num2 = this.body0.Pelvis.position.y - this.body0.CenterBone.position.y;
  2556. this.m_goOffset.transform.localPosition = new Vector3(0f, -num2 + num2 * this.body0.bonemorph.SnityouOutScale, 0f) + this.m_vOffsetPostion;
  2557. }
  2558. this.body0.Face.morph.boLookTooth = this.boLookTooth;
  2559. this.body0.Face.morph.boBallGAG = (this.boBallGAG | this.boMouthOpen);
  2560. this.body0.Face.morph.boNoseFook = this.boNoseFook;
  2561. if (this.AudioMan != null && !this.m_bFoceKuchipakuSelfUpdateTime)
  2562. {
  2563. this.body0.Face.morph.boLipSync = this.AudioMan.audiosource.isPlaying;
  2564. if (!this.lipSyncEnabled)
  2565. {
  2566. this.body0.Face.morph.boLipSync = false;
  2567. }
  2568. float voicePara_ = this.VoicePara_1;
  2569. float voicePara_2 = this.VoicePara_3;
  2570. float vol = this.AudioMan.GetVol();
  2571. this.voice_avg1 = this.voice_avg1 * (1f - voicePara_) + vol * voicePara_;
  2572. this.voice_avg2 = this.voice_avg2 * (1f - voicePara_) + this.AudioMan.VAvgMax * voicePara_;
  2573. this.voice_avg1D = this.voice_avg1D * (1f - voicePara_2) + (vol - this.voice_avg1_old) * voicePara_2;
  2574. this.voice_avg2D = this.voice_avg2D * (1f - voicePara_2) + (this.AudioMan.VAvgMax - this.voice_avg2_old) * voicePara_2;
  2575. this.voice_avg1_old = vol;
  2576. this.voice_avg2_old = this.AudioMan.VAvgMax;
  2577. this.voice_ao_time -= Time.deltaTime;
  2578. if (this.voice_ao_time < 0f && this.voice_avg1D > 0f && this.voice_ao_chk0 < -0.05f && this.voice_ao_chk1 > 0.1f)
  2579. {
  2580. this.voice_ao_time = 0.05f;
  2581. this.voice_ao = (this.voice_ao + 1) % 8;
  2582. this.voice_ao_chk0 = 0f;
  2583. this.voice_ao_chk1 = 0f;
  2584. }
  2585. if (this.voice_ao_chk1 < this.voice_avg1D)
  2586. {
  2587. this.voice_ao_chk1 = this.voice_avg1D;
  2588. }
  2589. if (0.1f < this.voice_avg1D)
  2590. {
  2591. this.voice_ao_chk0 = 0f;
  2592. }
  2593. if (this.voice_ao_chk0 > this.voice_avg1D)
  2594. {
  2595. this.voice_ao_chk0 = this.voice_avg1D;
  2596. }
  2597. float num3 = Mathf.Pow(this.voice_avg1, 1f) * 10f * this.VoicePara_2;
  2598. if (this.voice_ao % 2 == 0)
  2599. {
  2600. this.voice_ao_f *= 0.5f;
  2601. }
  2602. else
  2603. {
  2604. this.voice_ao_f = this.voice_ao_f * 0.5f + 0.5f;
  2605. }
  2606. this.voice_lf2 = num3 * this.voice_ao_f;
  2607. this.voice_lf3 = num3 * (1f - this.voice_ao_f);
  2608. this.body0.Face.morph.LipSync2 = this.voice_lf2;
  2609. this.body0.Face.morph.LipSync3 = this.voice_lf3;
  2610. float num4 = Mathf.Pow(this.voice_avg2, 0.5f) * (this.voice_avg2D * 30f * this.VoicePara_4 + 0.5f);
  2611. this.voice_lf1 = num4;
  2612. this.body0.Face.morph.LipSync1 = this.voice_lf1;
  2613. if (this.voice_ao % 4 < 2)
  2614. {
  2615. this.voice_ao_f2 *= 0.5f;
  2616. }
  2617. else
  2618. {
  2619. this.voice_ao_f2 = this.voice_ao_f2 * 0.5f + 0.5f;
  2620. }
  2621. this.body0.Face.morph.LipSync1 *= this.voice_ao_f2;
  2622. this.body0.Face.morph.LipSync2 *= 1f - this.voice_ao_f2;
  2623. this.body0.Face.morph.LipSync3 *= 1f - this.voice_ao_f2;
  2624. this.body0.Face.morph.LipSync1 = Mathf.Clamp01(this.body0.Face.morph.LipSync1 * 0.5f);
  2625. this.body0.Face.morph.LipSync2 = Mathf.Clamp01(this.body0.Face.morph.LipSync2 * 0.5f);
  2626. this.body0.Face.morph.LipSync3 = Mathf.Clamp01(this.body0.Face.morph.LipSync3 * 0.5f);
  2627. }
  2628. if (this.m_baKuchipakuPattern != null && this.lipSyncEnabled && !this.m_bFoceKuchipakuSelfUpdateTime && this.AudioMan != null)
  2629. {
  2630. this.FoceKuchipakuUpdate(this.AudioMan.audiosource.time);
  2631. }
  2632. if (this.boLipsync && this.lipSyncEnabled)
  2633. {
  2634. this.body0.Face.morph.boLipSync = true;
  2635. this.LipsyncT1 += Mathf.Sin(Time.time * 10f) * 0.5f + Mathf.Cos(Time.time * 5.55f) * 0.1f * 0.2f;
  2636. this.LipsyncT2 += Mathf.Sin(Time.time * 5f) * 0.1f + Mathf.Cos(Time.time * 5.55f) * 0.1f * 0.2f;
  2637. float num5 = (1f + Mathf.Sin(Time.time * 4f + this.LipsyncT1)) * 0.5f * 0.98f + 0.1f;
  2638. float num6 = (Mathf.Sin(this.LipsyncT1) + 1f) * 0.5f;
  2639. float num7 = (Mathf.Sin(this.LipsyncT2) + 1f) * 0.5f;
  2640. this.body0.Face.morph.LipSync1 = num5 * num6 * num7 * 0.5f;
  2641. this.body0.Face.morph.LipSync3 = num5 * (1f - num6) * num7 * 0.5f;
  2642. this.body0.Face.morph.LipSync2 = num5 * (1f - num7) * 0.5f;
  2643. }
  2644. else if (this.boLipsync_old)
  2645. {
  2646. this.body0.Face.morph.LipSync1 = 0f;
  2647. this.body0.Face.morph.LipSync3 = 0f;
  2648. this.body0.Face.morph.LipSync2 = 0f;
  2649. }
  2650. this.boLipsync_old = this.boLipsync;
  2651. if (this.boMabataki)
  2652. {
  2653. this.body0.Face.morph.ClearBlendValues();
  2654. if (this.FaceName != string.Empty)
  2655. {
  2656. this.body0.Face.morph.MulBlendValues(this.FaceName, 1f);
  2657. }
  2658. if (this.FaceName2 != string.Empty)
  2659. {
  2660. this.body0.Face.morph.MulBlendValues(this.FaceName2, UTY.COSS2(Mathf.Pow(this.FaceTime, 0.4f), 4f));
  2661. this.FaceTime += Time.deltaTime * this.FacePlus;
  2662. if (this.FaceTime >= 1f)
  2663. {
  2664. this.boFaceAnime = false;
  2665. this.FaceName = this.FaceName2;
  2666. this.FaceName2 = string.Empty;
  2667. }
  2668. }
  2669. if (this.FaceName3 != string.Empty)
  2670. {
  2671. this.body0.Face.morph.AddBlendValues(this.FaceName3, 1f);
  2672. }
  2673. if (this.MabatakiVal > 0f)
  2674. {
  2675. float num8 = this.MabatakiVal * this.MabatakiVal;
  2676. num8 = Mathf.Sin(num8 * 3.14159274f);
  2677. this.body0.Face.morph.EyeMabataki = num8;
  2678. }
  2679. else
  2680. {
  2681. this.body0.Face.morph.EyeMabataki = 0f;
  2682. }
  2683. if (!this.MabatakiUpdateStop)
  2684. {
  2685. this.MabatakiVal -= Time.deltaTime * 2f;
  2686. }
  2687. this.body0.Face.morph.FixBlendValues_Face();
  2688. if (!this.boFaceAnime && this.NextMabatakiTime < Time.time && !this.MabatakiUpdateStop)
  2689. {
  2690. float num9 = 0.5f + (float)UTY.GetRnd(80) * 0.1f;
  2691. this.NextMabatakiTime = Time.time + num9;
  2692. this.MabatakiVal = 1f;
  2693. }
  2694. }
  2695. else if (this.FaceName2 != string.Empty)
  2696. {
  2697. this.body0.Face.morph.ClearBlendValues();
  2698. if (this.FaceName != string.Empty)
  2699. {
  2700. this.body0.Face.morph.MulBlendValues(this.FaceName, 1f);
  2701. }
  2702. this.body0.Face.morph.MulBlendValues(this.FaceName2, UTY.COSS2(Mathf.Pow(this.FaceTime, 0.4f), 4f));
  2703. this.FaceTime += Time.deltaTime * this.FacePlus;
  2704. if (this.FaceTime >= 1f)
  2705. {
  2706. this.boFaceAnime = false;
  2707. this.FaceName = this.FaceName2;
  2708. this.FaceName2 = string.Empty;
  2709. }
  2710. this.MabatakiVal = 0f;
  2711. this.body0.Face.morph.FixBlendValues_Face();
  2712. }
  2713. }
  2714. private void LateUpdate()
  2715. {
  2716. if (this.boAllProcPropBUSY)
  2717. {
  2718. return;
  2719. }
  2720. if (!this.body0.isLoadedBody)
  2721. {
  2722. return;
  2723. }
  2724. if (this.m_MotionLoad == 1)
  2725. {
  2726. this.m_MotionLoad = 0;
  2727. if (!this.boMAN)
  2728. {
  2729. this.CrossFade("maid_stand01.anm", false, true, false, 0.5f, 1f);
  2730. this.FaceAnime("通常", 1f, 0);
  2731. if (GameMain.Instance.VRMode)
  2732. {
  2733. if (GameMain.Instance.OvrMgr != null)
  2734. {
  2735. this.body0.trsLookTarget = GameMain.Instance.OvrMgr.EyeAnchor;
  2736. }
  2737. }
  2738. else if (GameMain.Instance.MainCamera != null)
  2739. {
  2740. this.body0.trsLookTarget = GameMain.Instance.MainCamera.transform;
  2741. }
  2742. }
  2743. }
  2744. }
  2745. public GameObject m_goOffset;
  2746. private Status m_Status;
  2747. private MaidParts m_Parts;
  2748. private bool m_visible;
  2749. public Action<Maid> onMouseUpEvent;
  2750. public string TypeName = string.Empty;
  2751. public TBody body0;
  2752. public bool boMAN;
  2753. public bool boNPC;
  2754. public bool boOffsetY = true;
  2755. public Vector3 baseOffset = Vector3.zero;
  2756. public Vector3 motionOffset = Vector3.zero;
  2757. public Vector3 baseEulerAngles = Vector3.zero;
  2758. public string rotateLinkMaid = string.Empty;
  2759. private Dictionary<string, MaidProp> m_dicMaidProp = new Dictionary<string, MaidProp>();
  2760. private MaidProp[] m_aryMaidProp;
  2761. private Hashtable m_hashMaidPropLower = new Hashtable();
  2762. private int m_nActiveSlotNo = -1;
  2763. private string m_strThumCardTime = string.Empty;
  2764. private Texture2D m_texIcon;
  2765. private Color m_colMan = new Color(0f, 0.09f, 1f, 1f);
  2766. private int m_nVoicePitch = 50;
  2767. private bool boModelChg;
  2768. public bool boAllProcPropBUSY;
  2769. private int AllProcProp2Fase;
  2770. private int AllProcProp2Cnt;
  2771. public bool boLookTooth;
  2772. public bool boBallGAG;
  2773. public bool boMouthOpen;
  2774. public bool boNoseFook;
  2775. private float m_fKuchipakuPatternOffsetTime;
  2776. public byte[] m_baKuchipakuPattern;
  2777. private bool m_bFoceKuchipakuSelfUpdateTime;
  2778. [Header("音声入力用コンポーネント")]
  2779. public Maid.LipSyncComp MicLipData = new Maid.LipSyncComp();
  2780. private bool m_MicLipSync;
  2781. private bool boAutoFace;
  2782. private float NextMabatakiTime;
  2783. private float MabatakiVal;
  2784. private string FaceName = string.Empty;
  2785. private string FaceName2 = string.Empty;
  2786. public string FaceName3 = string.Empty;
  2787. private float FaceTime;
  2788. private float FacePlus;
  2789. public string ActiveFace = string.Empty;
  2790. public int FaceAnimeChkCode;
  2791. public bool boFaceAnime;
  2792. public int OldFaceAtr;
  2793. public bool boShitakaraNozoku;
  2794. public bool boVisibleBottom;
  2795. public int AutoFaceLV_old;
  2796. public float Hazukashi;
  2797. public bool boChkEye_old;
  2798. public GameObject m_goTestAnim;
  2799. public float voice_time;
  2800. public float voice_avg1;
  2801. public float voice_avg2;
  2802. public float voice_avg1_old;
  2803. public float voice_avg2_old;
  2804. public float voice_avg1D;
  2805. public float voice_avg2D;
  2806. public int voice_ao;
  2807. public float voice_ao_f;
  2808. public float voice_ao_f2;
  2809. public float voice_ao_time;
  2810. public float voice_ao_chk0;
  2811. public float voice_ao_chk1;
  2812. public float voice_lf1;
  2813. public float voice_lf2;
  2814. public float voice_lf3;
  2815. public float VoicePara_1 = 0.5f;
  2816. public float VoicePara_2 = 0.074f;
  2817. public float VoicePara_3 = 0.5f;
  2818. public float VoicePara_4 = 0.05f;
  2819. private bool lipSyncEnabled = true;
  2820. private bool boLipsync;
  2821. private bool boLipsync_old;
  2822. private float LipsyncT1;
  2823. private float LipsyncT2;
  2824. public bool boMabataki = true;
  2825. public bool MabatakiUpdateStop;
  2826. private Vector3 m_vOffsetPostion = Vector3.zero;
  2827. public static int changetest;
  2828. private int m_MotionLoad = 1;
  2829. [Serializable]
  2830. public class LipSyncComp
  2831. {
  2832. [HideInInspector]
  2833. public bool IsInit = true;
  2834. public LowLatencyLipSyncContext Context;
  2835. public OVRLipSyncContextMorphTarget MorphTarget;
  2836. public OVRLipSyncMicInput MicInput;
  2837. }
  2838. public enum EyeMoveType
  2839. {
  2840. 無し,
  2841. 無視する,
  2842. 顔を向ける,
  2843. 顔だけ動かす,
  2844. 顔をそらす,
  2845. 目と顔を向ける,
  2846. 目だけ向ける,
  2847. 目だけそらす
  2848. }
  2849. public enum AutoTwist
  2850. {
  2851. ShoulderL,
  2852. ShoulderR,
  2853. WristL,
  2854. WristR,
  2855. ThighL,
  2856. ThighR
  2857. }
  2858. }