Maid.cs 90 KB

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