Maid.cs 85 KB

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