123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using MaidStatus;
- using UnityEngine;
- using XVI.AniLipSync;
- public class Maid : MonoBehaviour
- {
- public bool Visible
- {
- get
- {
- return this.m_visible;
- }
- set
- {
- GameObject gameObject = base.gameObject;
- this.m_visible = value;
- gameObject.SetActive(value);
- }
- }
- public MaidParts Parts
- {
- get
- {
- return this.m_Parts;
- }
- }
- public Status status
- {
- get
- {
- return this.m_Status;
- }
- }
- public AudioSourceMgr AudioMan
- {
- get
- {
- return (!(this.body0 != null)) ? null : this.body0.AudioMan;
- }
- }
- public bool IsBusy
- {
- get
- {
- return this.IsAllProcPropBusy && this.Visible;
- }
- }
- public bool IsAllProcPropBusy
- {
- get
- {
- return this.boAllProcPropBUSY;
- }
- }
- public FullBodyIKCtrl IKCtrl
- {
- get
- {
- return this.body0.IKCtrl;
- }
- }
- public int ActiveSlotNo
- {
- get
- {
- return this.m_nActiveSlotNo;
- }
- set
- {
- this.m_nActiveSlotNo = value;
- }
- }
- public Color ManColor
- {
- get
- {
- return this.m_colMan;
- }
- set
- {
- this.m_colMan = value;
- }
- }
- public int VoicePitch
- {
- get
- {
- return this.m_nVoicePitch;
- }
- set
- {
- if (this.body0 != null)
- {
- TBody tbody = this.body0;
- this.m_nVoicePitch = value;
- tbody.SetVoicePitch(value);
- }
- }
- }
- public static void UpdateMaidRanking()
- {
- if (!GameMain.Instance.CharacterMgr.status.isAvailableRanking)
- {
- Debug.Log("メイドランキングは未開放なので更新されませんでした");
- return;
- }
- List<KeyValuePair<long, Maid>> list = new List<KeyValuePair<long, Maid>>();
- CharacterMgr characterMgr = GameMain.Instance.CharacterMgr;
- for (int i = 0; i < characterMgr.GetStockMaidCount(); i++)
- {
- Maid stockMaid = characterMgr.GetStockMaid(i);
- if (!(stockMaid == null))
- {
- stockMaid.status.popularRank = 0;
- long key = (long)stockMaid.status.evaluation + stockMaid.status.sales;
- list.Add(new KeyValuePair<long, Maid>(key, stockMaid));
- }
- }
- list.Sort(delegate(KeyValuePair<long, Maid> a, KeyValuePair<long, Maid> b)
- {
- long num3 = b.Key - a.Key;
- return (num3 != 0L) ? ((0L >= num3) ? -1 : 1) : 0;
- });
- long num = -1L;
- int num2 = 0;
- foreach (KeyValuePair<long, Maid> keyValuePair in list)
- {
- if (keyValuePair.Key == 0L)
- {
- break;
- }
- if (keyValuePair.Key != num)
- {
- num2++;
- }
- keyValuePair.Value.status.popularRank = num2;
- num = keyValuePair.Key;
- }
- }
- private void Awake()
- {
- }
- public void OnMouseUp()
- {
- if (this.IsBusy || this.body0 == null || this.onMouseUpEvent == null)
- {
- return;
- }
- this.onMouseUpEvent(this);
- }
- public void Initialize(string f_strTypeName, bool f_bMan)
- {
- this.m_Parts = base.gameObject.AddComponent<MaidParts>();
- this.m_goOffset = new GameObject("Offset");
- this.m_goOffset.transform.parent = base.gameObject.transform;
- this.TypeName = f_strTypeName;
- this.boMAN = f_bMan;
- this.boOffsetY = true;
- this.body0 = base.gameObject.AddComponent<TBody>();
- this.body0.Init(this, f_bMan);
- int length = Enum.GetValues(typeof(MPN)).Length;
- this.m_aryMaidProp = new MaidProp[length];
- List<MaidProp> list = Maid.CreateInitMaidPropList();
- foreach (MaidProp mp in list)
- {
- this.AddProp(mp);
- }
- this.InitializeStatus();
- this.m_Parts.Initialize(base.gameObject, this);
- this.DelPrefabAll();
- if (this.boMAN)
- {
- this.SetUpModel("_I_man.menu");
- }
- else
- {
- this.SetUpModel("_I_default.menu");
- }
- }
- public void InitializeStatus()
- {
- if (this.m_Status == null)
- {
- this.m_Status = new Status();
- this.m_Status.Initialize(this);
- }
- }
- public static List<MaidProp> CreateInitMaidPropList()
- {
- return new List<MaidProp>
- {
- Maid.CreateProp(0, int.MaxValue, 0, MPN.null_mpn, 0),
- Maid.CreateProp(0, 130, 10, MPN.MuneL, 1),
- Maid.CreateProp(0, 100, 0, MPN.MuneS, 1),
- Maid.CreateProp(0, 130, 10, MPN.MuneTare, 1),
- Maid.CreateProp(0, 100, 40, MPN.RegFat, 1),
- Maid.CreateProp(0, 100, 20, MPN.ArmL, 1),
- Maid.CreateProp(0, 100, 20, MPN.Hara, 1),
- Maid.CreateProp(0, 100, 40, MPN.RegMeet, 1),
- Maid.CreateProp(20, 80, 50, MPN.KubiScl, 2),
- Maid.CreateProp(0, 100, 50, MPN.UdeScl, 2),
- Maid.CreateProp(0, 100, 50, MPN.EyeScl, 2),
- Maid.CreateProp(0, 100, 50, MPN.EyeSclX, 2),
- Maid.CreateProp(0, 100, 50, MPN.EyeSclY, 2),
- Maid.CreateProp(0, 100, 50, MPN.EyePosX, 2),
- Maid.CreateProp(0, 100, 50, MPN.EyePosY, 2),
- Maid.CreateProp(0, 100, 0, MPN.EyeClose, 2),
- Maid.CreateProp(0, 100, 50, MPN.EyeBallPosX, 2),
- Maid.CreateProp(0, 100, 50, MPN.EyeBallPosY, 2),
- Maid.CreateProp(0, 100, 50, MPN.EyeBallSclX, 2),
- Maid.CreateProp(0, 100, 50, MPN.EyeBallSclY, 2),
- Maid.CreateProp(0, 1, 0, MPN.EarNone, 2),
- Maid.CreateProp(0, 100, 0, MPN.EarElf, 2),
- Maid.CreateProp(0, 100, 50, MPN.EarRot, 2),
- Maid.CreateProp(0, 100, 50, MPN.EarScl, 2),
- Maid.CreateProp(0, 100, 50, MPN.NosePos, 2),
- Maid.CreateProp(0, 100, 50, MPN.NoseScl, 2),
- Maid.CreateProp(0, 100, 0, MPN.FaceShape, 2),
- Maid.CreateProp(0, 100, 0, MPN.FaceShapeSlim, 2),
- Maid.CreateProp(0, 100, 50, MPN.MayuShapeIn, 2),
- Maid.CreateProp(0, 100, 50, MPN.MayuShapeOut, 2),
- Maid.CreateProp(0, 100, 50, MPN.MayuX, 2),
- Maid.CreateProp(0, 100, 50, MPN.MayuY, 2),
- Maid.CreateProp(0, 100, 50, MPN.MayuRot, 2),
- Maid.CreateProp(0, 100, 50, MPN.HeadX, 2),
- Maid.CreateProp(0, 100, 50, MPN.HeadY, 2),
- Maid.CreateProp(20, 80, 50, MPN.DouPer, 2),
- Maid.CreateProp(20, 80, 50, MPN.sintyou, 2),
- Maid.CreateProp(0, 100, 50, MPN.koshi, 2),
- Maid.CreateProp(0, 100, 50, MPN.kata, 2),
- Maid.CreateProp(0, 100, 50, MPN.west, 2),
- Maid.CreateProp(0, 100, 10, MPN.MuneUpDown, 2),
- Maid.CreateProp(0, 100, 40, MPN.MuneYori, 2),
- Maid.CreateProp(0, 100, 50, MPN.MuneYawaraka, 2),
- Maid.CreateProp(string.Empty, MPN.body, 3),
- Maid.CreateProp(string.Empty, MPN.head, 3),
- Maid.CreateProp(string.Empty, MPN.hairf, 3),
- Maid.CreateProp(string.Empty, MPN.hairr, 3),
- Maid.CreateProp(string.Empty, MPN.hairt, 3),
- Maid.CreateProp(string.Empty, MPN.hairs, 3),
- Maid.CreateProp(string.Empty, MPN.wear, 3),
- Maid.CreateProp(string.Empty, MPN.skirt, 3),
- Maid.CreateProp(string.Empty, MPN.mizugi, 3),
- Maid.CreateProp(string.Empty, MPN.bra, 3),
- Maid.CreateProp(string.Empty, MPN.panz, 3),
- Maid.CreateProp(string.Empty, MPN.stkg, 3),
- Maid.CreateProp(string.Empty, MPN.shoes, 3),
- Maid.CreateProp(string.Empty, MPN.headset, 3),
- Maid.CreateProp(string.Empty, MPN.glove, 3),
- Maid.CreateProp(string.Empty, MPN.acchead, 3),
- Maid.CreateProp(string.Empty, MPN.hairaho, 3),
- Maid.CreateProp(string.Empty, MPN.accha, 3),
- Maid.CreateProp(string.Empty, MPN.acchana, 3),
- Maid.CreateProp(string.Empty, MPN.acckamisub, 3),
- Maid.CreateProp(string.Empty, MPN.acckami, 3),
- Maid.CreateProp(string.Empty, MPN.accmimi, 3),
- Maid.CreateProp(string.Empty, MPN.accnip, 3),
- Maid.CreateProp(string.Empty, MPN.acckubi, 3),
- Maid.CreateProp(string.Empty, MPN.acckubiwa, 3),
- Maid.CreateProp(string.Empty, MPN.accheso, 3),
- Maid.CreateProp(string.Empty, MPN.accude, 3),
- Maid.CreateProp(string.Empty, MPN.accashi, 3),
- Maid.CreateProp(string.Empty, MPN.accsenaka, 3),
- Maid.CreateProp(string.Empty, MPN.accshippo, 3),
- Maid.CreateProp(string.Empty, MPN.accanl, 3),
- Maid.CreateProp(string.Empty, MPN.accvag, 3),
- Maid.CreateProp(string.Empty, MPN.megane, 3),
- Maid.CreateProp(string.Empty, MPN.accxxx, 3),
- Maid.CreateProp(string.Empty, MPN.handitem, 3),
- Maid.CreateProp(string.Empty, MPN.acchat, 3),
- Maid.CreateProp(string.Empty, MPN.haircolor, 3),
- Maid.CreateProp(string.Empty, MPN.skin, 3),
- Maid.CreateProp(string.Empty, MPN.acctatoo, 3),
- Maid.CreateProp(string.Empty, MPN.accnail, 3),
- Maid.CreateProp(string.Empty, MPN.underhair, 3),
- Maid.CreateProp(string.Empty, MPN.hokuro, 3),
- Maid.CreateProp(string.Empty, MPN.mayu, 3),
- Maid.CreateProp(string.Empty, MPN.lip, 3),
- Maid.CreateProp(string.Empty, MPN.eye, 3),
- Maid.CreateProp(string.Empty, MPN.eye_hi, 3),
- Maid.CreateProp(string.Empty, MPN.eye_hi_r, 3),
- Maid.CreateProp(string.Empty, MPN.chikubi, 3),
- Maid.CreateProp(string.Empty, MPN.chikubicolor, 3),
- Maid.CreateProp(string.Empty, MPN.eyewhite, 3),
- Maid.CreateProp(string.Empty, MPN.nose, 3),
- Maid.CreateProp(string.Empty, MPN.facegloss, 3),
- Maid.CreateProp(string.Empty, MPN.moza, 3),
- Maid.CreateProp(string.Empty, MPN.onepiece, 3),
- Maid.CreateProp(string.Empty, MPN.set_maidwear, 3),
- Maid.CreateProp(string.Empty, MPN.set_mywear, 3),
- Maid.CreateProp(string.Empty, MPN.set_underwear, 3),
- Maid.CreateProp(string.Empty, MPN.set_body, 3),
- Maid.CreateProp(string.Empty, MPN.folder_eye, 3),
- Maid.CreateProp(string.Empty, MPN.folder_mayu, 3),
- Maid.CreateProp(string.Empty, MPN.folder_underhair, 3),
- Maid.CreateProp(string.Empty, MPN.folder_skin, 3),
- Maid.CreateProp(string.Empty, MPN.folder_eyewhite, 3),
- Maid.CreateProp(string.Empty, MPN.kousoku_upper, 3),
- Maid.CreateProp(string.Empty, MPN.kousoku_lower, 3),
- Maid.CreateProp(string.Empty, MPN.seieki_naka, 3),
- Maid.CreateProp(string.Empty, MPN.seieki_hara, 3),
- Maid.CreateProp(string.Empty, MPN.seieki_face, 3),
- Maid.CreateProp(string.Empty, MPN.seieki_mune, 3),
- Maid.CreateProp(string.Empty, MPN.seieki_hip, 3),
- Maid.CreateProp(string.Empty, MPN.seieki_ude, 3),
- Maid.CreateProp(string.Empty, MPN.seieki_ashi, 3)
- };
- }
- public void Uninit()
- {
- this.Visible = false;
- this.boOffsetY = true;
- this.DelPrefabAll();
- Debug.Log("Uninit " + this.status.firstName);
- this.body0.UnInit();
- }
- private void OnDestroy()
- {
- this.DelPrefabAll();
- this.Uninit();
- }
- public void ManColorUpdate()
- {
- if (this.body0 != null)
- {
- this.body0.ManColorUpdate();
- }
- }
- public void ClearPropValueDefault()
- {
- foreach (MaidProp maidProp in this.m_aryMaidProp)
- {
- if (!(maidProp.name == "body"))
- {
- maidProp.temp_value = (maidProp.value = maidProp.value_Default);
- }
- }
- }
- public MaidProp GetProp(string tag)
- {
- return this.m_dicMaidProp[tag];
- }
- public MaidProp GetPropLower(string tagLower)
- {
- return (MaidProp)this.m_hashMaidPropLower[tagLower];
- }
- public MaidProp GetProp(MPN mpn)
- {
- return this.m_aryMaidProp[(int)mpn];
- }
- public static MaidProp CreateProp(string f_strDefFileName, MPN mpn, int type)
- {
- NDebug.Assert(type == 3, "プロパティオブジェクトのタイプが不正です。");
- MaidProp maidProp = new MaidProp();
- maidProp.name = mpn.ToString();
- maidProp.type = type;
- maidProp.listSubProp = null;
- maidProp.strFileName = f_strDefFileName;
- if (string.IsNullOrEmpty(maidProp.strFileName))
- {
- string strFileName = maidProp.strFileName;
- if (CM3.dicDelItem.TryGetValue(mpn, out strFileName))
- {
- maidProp.strFileName = strFileName;
- }
- }
- maidProp.nFileNameRID = maidProp.strFileName.ToLower().GetHashCode();
- maidProp.boDut = true;
- maidProp.boTempDut = false;
- maidProp.idx = (int)mpn;
- return maidProp;
- }
- public static MaidProp CreateProp(int minval, int maxval, int defval, MPN mpn, int type)
- {
- NDebug.Assert(type == 0 || type == 1 || type == 2, "プロパティオブジェクトのタイプが不正です。");
- MaidProp maidProp = new MaidProp();
- maidProp.name = mpn.ToString();
- maidProp.type = type;
- maidProp.min = minval;
- maidProp.max = maxval;
- if (defval < minval)
- {
- defval = minval;
- }
- if (defval > maxval)
- {
- defval = maxval;
- }
- maidProp.value_Default = defval;
- maidProp.listSubProp = null;
- maidProp.strFileName = string.Empty;
- maidProp.temp_value = (maidProp.value = defval);
- maidProp.idx = (int)mpn;
- maidProp.boDut = true;
- maidProp.boTempDut = false;
- return maidProp;
- }
- private void AddProp(MaidProp mp)
- {
- MPN idx = (MPN)mp.idx;
- this.m_dicMaidProp[idx.ToString()] = mp;
- this.m_aryMaidProp[(int)idx] = mp;
- this.m_hashMaidPropLower[idx.ToString().ToLower()] = mp;
- }
- private void AddProp(string f_strDefFileName, MPN mpn, int type)
- {
- this.AddProp(Maid.CreateProp(f_strDefFileName, mpn, type));
- }
- private void AddProp(int minval, int maxval, int defval, MPN mpn, int type)
- {
- this.AddProp(Maid.CreateProp(minval, maxval, defval, mpn, type));
- }
- public void Prop_AddValue(string tag, int val)
- {
- NDebug.Assert(this.m_dicMaidProp.ContainsKey(tag), "指定されたプロパティ名がありません。");
- this.Prop_AddValue(this.m_dicMaidProp[tag].idx, val);
- }
- public void Prop_AddValue(int idx, int val)
- {
- val += this.m_aryMaidProp[idx].value;
- if (this.m_aryMaidProp[idx].min > val)
- {
- val = this.m_aryMaidProp[idx].min;
- }
- if (this.m_aryMaidProp[idx].max < val)
- {
- val = this.m_aryMaidProp[idx].max;
- }
- if (this.m_aryMaidProp[idx].value_LinkMAX != 0 && this.m_aryMaidProp[this.m_aryMaidProp[idx].value_LinkMAX].value < val)
- {
- val = this.m_aryMaidProp[this.m_aryMaidProp[idx].value_LinkMAX].value;
- }
- if (this.m_aryMaidProp[idx].value != val)
- {
- this.m_aryMaidProp[idx].value = val;
- }
- this.m_aryMaidProp[idx].boDut = true;
- this.m_aryMaidProp[idx].boTempDut = false;
- }
- public void SetProp(string tag, int val, bool f_bTemp = false)
- {
- MPN idx = MPN.null_mpn;
- try
- {
- idx = (MPN)Enum.Parse(typeof(MPN), tag);
- }
- catch
- {
- NDebug.Assert("指定されたプロパティ名がありません。" + tag, false);
- }
- this.SetProp(idx, val, f_bTemp);
- }
- public void SetProp(MPN idx, int val, bool f_bTemp = false)
- {
- NDebug.Assert(idx != MPN.null_mpn, "指定されたプロパティ名がありません。" + base.tag);
- MaidProp maidProp = this.m_aryMaidProp[(int)idx];
- if (maidProp.min > val)
- {
- val = maidProp.min;
- }
- if (maidProp.max < val)
- {
- val = maidProp.max;
- }
- if (f_bTemp)
- {
- maidProp.temp_value = val;
- maidProp.boTempDut = true;
- }
- else
- {
- maidProp.value = val;
- maidProp.boDut = true;
- maidProp.boTempDut = false;
- }
- }
- public void SetProp(string tag, string filename, int f_nFileNameRID, bool f_bTemp = false, bool f_bNoScale = false)
- {
- NDebug.Assert(this.m_dicMaidProp.ContainsKey(tag), "指定されたプロパティ名がありません。" + tag);
- MaidProp mp = this.m_dicMaidProp[tag];
- this.SetProp(mp, filename, f_nFileNameRID, f_bTemp, f_bNoScale);
- }
- public void SetProp(MPN idx, string filename, int f_nFileNameRID, bool f_bTemp = false, bool f_bNoScale = false)
- {
- MaidProp mp = this.m_aryMaidProp[(int)idx];
- this.SetProp(mp, filename, f_nFileNameRID, f_bTemp, f_bNoScale);
- }
- public void SetProp(MaidProp mps)
- {
- bool flag = false;
- bool flag2 = false;
- bool flag3 = false;
- MaidProp prop = this.GetProp((MPN)mps.idx);
- bool flag4 = prop.m_dicTBodySkinPos.Count != 0;
- flag = (prop.m_dicTBodyAttachPos.Count != 0);
- flag2 = (prop.m_dicMaterialProp.Count != 0);
- flag3 = (prop.m_dicBoneLength.Count != 0);
- if (mps.idx != 43)
- {
- this.SetProp((MPN)mps.idx, mps.strFileName, mps.nFileNameRID, false, false);
- }
- if (flag4 || mps.m_dicTBodySkinPos.Count != 0)
- {
- MaidProp prop2 = this.GetProp((MPN)mps.idx);
- prop2.m_dicTBodySkinPos.Clear();
- foreach (KeyValuePair<TBody.SlotID, KeyValuePair<int, BoneAttachPos>> keyValuePair in mps.m_dicTBodySkinPos)
- {
- prop2.m_dicTBodySkinPos[keyValuePair.Key] = new KeyValuePair<int, BoneAttachPos>(keyValuePair.Value.Key, new BoneAttachPos(keyValuePair.Value.Value));
- }
- if (mps.idx != 43)
- {
- prop2.boDut = true;
- }
- prop2.boAdjustDut = true;
- }
- if (flag || mps.m_dicTBodyAttachPos.Count != 0)
- {
- MaidProp prop3 = this.GetProp((MPN)mps.idx);
- prop3.m_dicTBodyAttachPos.Clear();
- foreach (KeyValuePair<TBody.SlotID, Dictionary<string, KeyValuePair<int, VtxAttachPos>>> keyValuePair2 in mps.m_dicTBodyAttachPos)
- {
- Dictionary<string, KeyValuePair<int, VtxAttachPos>> dictionary = new Dictionary<string, KeyValuePair<int, VtxAttachPos>>();
- foreach (KeyValuePair<string, KeyValuePair<int, VtxAttachPos>> keyValuePair3 in keyValuePair2.Value)
- {
- dictionary[keyValuePair3.Key] = new KeyValuePair<int, VtxAttachPos>(keyValuePair3.Value.Key, new VtxAttachPos(keyValuePair3.Value.Value));
- }
- prop3.m_dicTBodyAttachPos[keyValuePair2.Key] = dictionary;
- }
- if (mps.idx != 43)
- {
- prop3.boDut = true;
- }
- prop3.boAdjustDut = true;
- }
- if (flag2 || mps.m_dicMaterialProp.Count != 0)
- {
- MaidProp prop4 = this.GetProp((MPN)mps.idx);
- prop4.m_dicMaterialProp.Clear();
- foreach (KeyValuePair<TBody.SlotID, KeyValuePair<int, MatPropSave>> keyValuePair4 in mps.m_dicMaterialProp)
- {
- prop4.m_dicMaterialProp[keyValuePair4.Key] = new KeyValuePair<int, MatPropSave>(keyValuePair4.Value.Key, new MatPropSave(keyValuePair4.Value.Value));
- }
- if (mps.idx != 43)
- {
- prop4.boDut = true;
- }
- prop4.boAdjustDut = true;
- }
- if (flag3 || mps.m_dicBoneLength.Count != 0)
- {
- MaidProp prop5 = this.GetProp((MPN)mps.idx);
- prop5.m_dicBoneLength.Clear();
- foreach (KeyValuePair<TBody.SlotID, KeyValuePair<int, Dictionary<string, float>>> keyValuePair5 in mps.m_dicBoneLength)
- {
- Dictionary<string, float> dictionary2 = new Dictionary<string, float>();
- foreach (KeyValuePair<string, float> keyValuePair6 in keyValuePair5.Value.Value)
- {
- dictionary2[keyValuePair6.Key] = keyValuePair6.Value;
- }
- prop5.m_dicBoneLength[keyValuePair5.Key] = new KeyValuePair<int, Dictionary<string, float>>(keyValuePair5.Value.Key, dictionary2);
- }
- if (mps.idx != 43)
- {
- prop5.boDut = true;
- }
- prop5.boAdjustDut = true;
- }
- }
- private void SetProp(MaidProp mp, string filename, int f_nFileNameRID, bool f_bTemp, bool f_bNoScale = false)
- {
- if (f_bTemp)
- {
- if (filename != mp.strTempFileName)
- {
- mp.boTempDut = true;
- mp.strTempFileName = filename;
- mp.bNoScale = f_bNoScale;
- if (f_nFileNameRID == 0)
- {
- mp.nTempFileNameRID = filename.ToLower().GetHashCode();
- }
- else
- {
- mp.nTempFileNameRID = f_nFileNameRID;
- }
- }
- }
- else
- {
- if (mp.strFileName != filename || mp.bSubDut || (97 <= mp.idx && mp.idx <= 100))
- {
- mp.boDut = true;
- }
- mp.strFileName = filename;
- mp.bNoScale = f_bNoScale;
- if (f_nFileNameRID == 0)
- {
- mp.nFileNameRID = filename.ToLower().GetHashCode();
- }
- else
- {
- mp.nFileNameRID = f_nFileNameRID;
- }
- mp.strTempFileName = string.Empty;
- mp.nTempFileNameRID = 0;
- if (mp.listSubProp != null)
- {
- mp.listSubProp.Clear();
- }
- mp.bSubDut = false;
- mp.m_dicTBodySkinPos.Clear();
- mp.m_dicTBodyAttachPos.Clear();
- mp.m_dicMaterialProp.Clear();
- mp.m_dicBoneLength.Clear();
- }
- if (mp.boTempDut && mp.boDut)
- {
- string[] array = new string[6];
- array[0] = "SetProp:本元とTempのどうちらにも更新フラグが付いています。";
- int num = 1;
- MPN idx = (MPN)mp.idx;
- array[num] = idx.ToString();
- array[2] = " 元=";
- array[3] = mp.strFileName;
- array[4] = " Temp=";
- array[5] = mp.strTempFileName;
- Debug.LogWarning(string.Concat(array));
- }
- }
- public bool DelProp(MPN idx, bool f_bTemp = false)
- {
- string empty = string.Empty;
- if (CM3.dicDelItem.TryGetValue(idx, out empty))
- {
- this.SetProp(idx, empty, 0, f_bTemp, false);
- return true;
- }
- return false;
- }
- public void SetSubProp(MPN idx, int subno, string filename, int f_nFileNameRID = 0)
- {
- MaidProp maidProp = this.m_aryMaidProp[(int)idx];
- if (maidProp.listSubProp == null)
- {
- maidProp.listSubProp = new List<SubProp>();
- }
- if (maidProp.listSubProp.Count<SubProp>() < subno + 1)
- {
- int num = maidProp.listSubProp.Count<SubProp>();
- for (int i = num; i < subno + 1; i++)
- {
- maidProp.listSubProp.Add(null);
- }
- }
- SubProp subProp = maidProp.listSubProp[subno];
- if (subProp == null)
- {
- SubProp subProp2 = new SubProp();
- maidProp.listSubProp[subno] = subProp2;
- subProp = subProp2;
- }
- subProp.bDut = true;
- subProp.strFileName = filename;
- if (f_nFileNameRID == 0)
- {
- subProp.nFileNameRID = filename.ToLower().GetHashCode();
- }
- else
- {
- subProp.nFileNameRID = f_nFileNameRID;
- }
- maidProp.bSubDut = true;
- }
- public SubProp GetSubProp(MPN idx, int subno)
- {
- MaidProp maidProp = this.m_aryMaidProp[(int)idx];
- SubProp result = null;
- if (maidProp.listSubProp != null && subno < maidProp.listSubProp.Count)
- {
- result = maidProp.listSubProp[subno];
- }
- return result;
- }
- public void DelSubProp(MPN idx, int subno = -1)
- {
- MaidProp maidProp = this.m_aryMaidProp[(int)idx];
- if (maidProp.listSubProp != null)
- {
- if (subno == -1)
- {
- maidProp.listSubProp.Clear();
- }
- else if (maidProp.listSubProp.Count > subno)
- {
- SubProp subProp = maidProp.listSubProp[subno];
- if (subProp != null)
- {
- subProp.strFileName = string.Empty;
- subProp.nFileNameRID = 0;
- subProp.bDut = false;
- }
- }
- }
- maidProp.bSubDut = true;
- }
- public void ResetProp(string mpn, bool force_reset = false)
- {
- NDebug.Assert(this.m_dicMaidProp.ContainsKey(mpn), "指定されたプロパティ名がありません。" + base.tag);
- MaidProp mp = this.m_dicMaidProp[mpn];
- this.ResetProp(mp, force_reset);
- }
- public void ResetProp(MPN idx, bool force_reset = false)
- {
- MaidProp mp = this.m_aryMaidProp[(int)idx];
- this.ResetProp(mp, force_reset);
- }
- public void ResetProp(MaidProp mp, bool force_reset = false)
- {
- if ((mp.nTempFileNameRID != 0 && mp.nFileNameRID != mp.nTempFileNameRID) || mp.temp_value != mp.value || force_reset)
- {
- mp.boDut = true;
- mp.strTempFileName = string.Empty;
- mp.nTempFileNameRID = 0;
- mp.temp_value = 0;
- mp.boTempDut = false;
- }
- }
- public void ItemChangeTemp(string mpn, string name)
- {
- MaidProp prop = this.GetProp(mpn);
- SortedDictionary<string, string> sortedDictionary;
- string filename;
- if (prop.nFileNameRID != 0 && Menu.m_dicResourceRef.TryGetValue(prop.nFileNameRID, out sortedDictionary) && sortedDictionary.TryGetValue(name, out filename))
- {
- this.SetProp(mpn, filename, 0, true, false);
- }
- }
- public bool IsItemChange(string mpn, string name)
- {
- MaidProp prop = this.GetProp(mpn);
- 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];
- }
- public bool IsItemChangeEnabled(string mpn, string name)
- {
- MaidProp prop = this.GetProp(mpn);
- return prop.nFileNameRID != 0 && Menu.m_dicResourceRef.ContainsKey(prop.nFileNameRID) && Menu.m_dicResourceRef[prop.nFileNameRID].ContainsKey(name);
- }
- public void DutPropAll()
- {
- for (int i = 0; i < this.m_aryMaidProp.Length; i++)
- {
- MaidProp maidProp = this.m_aryMaidProp[i];
- maidProp.boDut = true;
- if (maidProp.listSubProp != null)
- {
- for (int j = 0; j < maidProp.listSubProp.Count; j++)
- {
- if (maidProp.listSubProp[j] != null)
- {
- maidProp.listSubProp[j].bDut = true;
- }
- }
- }
- }
- }
- public void SetUpModel(string f_strPresetMenuFileName)
- {
- Menu.ProcScript(this, f_strPresetMenuFileName, false, null);
- this.body0.FixMaskFlag();
- this.body0.FixVisibleFlag(false);
- this.AllProcPropSeqStart();
- if (!this.boMAN)
- {
- }
- }
- public void AllProcPropSeqStart()
- {
- this.boAllProcPropBUSY = true;
- this.boModelChg = false;
- this.AllProcProp2Fase = 0;
- this.AllProcProp2Cnt = 0;
- }
- private void AllProcPropSeq()
- {
- if (this.AllProcProp2Fase == 0)
- {
- while (this.AllProcProp2Fase == 0)
- {
- MaidProp maidProp = this.m_aryMaidProp[this.AllProcProp2Cnt];
- this.AllProcProp2Cnt++;
- if (this.m_aryMaidProp.Length == this.AllProcProp2Cnt)
- {
- this.AllProcProp2Cnt = 0;
- if (Array.Find<MaidProp>(this.m_aryMaidProp, (MaidProp m) => m.type == 3 && (m.boDut || m.boTempDut)) == null)
- {
- this.AllProcProp2Fase++;
- }
- }
- if (maidProp == null)
- {
- string str = "AllProcProp2_Proc MPNがNULLです。";
- MPN allProcProp2Cnt = (MPN)this.AllProcProp2Cnt;
- NDebug.Assert(str + allProcProp2Cnt.ToString(), false);
- }
- if (maidProp.type == 3 && this.ProcItem(this.m_dicMaidProp[maidProp.name]))
- {
- if (!this.boModelChg)
- {
- this.body0.FixVisibleFlag(true);
- this.boModelChg = true;
- }
- if (this.boMAN && maidProp.idx == 43)
- {
- for (int i = 44; i <= 100; i++)
- {
- this.GetProp((MPN)i).boDut = true;
- }
- this.GetProp(MPN.moza).boDut = true;
- }
- else if (maidProp.idx == 50 || maidProp.idx == 46 || maidProp.idx == 47 || maidProp.idx == 49 || maidProp.idx == 48)
- {
- this.GetProp(MPN.haircolor).boDut = true;
- }
- else if (maidProp.idx == 45)
- {
- MPN[] array = new MPN[]
- {
- MPN.skin,
- MPN.eye,
- MPN.mayu,
- MPN.eye_hi,
- MPN.eye_hi_r,
- MPN.EyeClose,
- MPN.EarNone,
- MPN.EarElf,
- MPN.EarRot,
- MPN.EarScl,
- MPN.NosePos,
- MPN.NoseScl,
- MPN.FaceShape,
- MPN.FaceShapeSlim,
- MPN.MayuShapeIn,
- MPN.MayuShapeOut,
- MPN.MayuX,
- MPN.MayuY,
- MPN.MayuRot,
- MPN.eye_hi_r,
- MPN.eyewhite,
- MPN.nose,
- MPN.facegloss
- };
- foreach (MPN mpn in array)
- {
- this.GetProp(mpn).boDut = true;
- }
- }
- else if (maidProp.idx == 52)
- {
- MaidProp prop = this.GetProp(MPN.acctatoo);
- prop.boDut = true;
- if (prop.listSubProp != null)
- {
- for (int k = 0; k < prop.listSubProp.Count; k++)
- {
- if (prop.listSubProp[k] != null)
- {
- prop.listSubProp[k].bDut = true;
- }
- }
- }
- prop = this.GetProp(MPN.hokuro);
- prop.boDut = true;
- if (prop.listSubProp != null)
- {
- for (int l = 0; l < prop.listSubProp.Count; l++)
- {
- if (prop.listSubProp[l] != null)
- {
- prop.listSubProp[l].bDut = true;
- }
- }
- }
- this.GetProp(MPN.lip).boDut = true;
- }
- break;
- }
- }
- }
- else if (this.AllProcProp2Fase == 1)
- {
- this.AllProcProp2Fase++;
- }
- else if (this.AllProcProp2Fase == 2)
- {
- bool flag = false;
- foreach (MaidProp maidProp2 in this.m_dicMaidProp.Values)
- {
- if (maidProp2.type != 3)
- {
- flag |= this.ProcItem(maidProp2);
- }
- }
- if (flag)
- {
- this.body0.ItemScaleReset();
- }
- this.AllProcProp2Fase++;
- }
- else if (this.AllProcProp2Fase == 3)
- {
- if (this.boModelChg)
- {
- this.body0.MulTexProc();
- this.body0.FixMaskFlag();
- this.body0.FixVisibleFlag(false);
- }
- this.AllProcProp2Fase++;
- }
- else if (this.AllProcProp2Fase == 4)
- {
- this.ProcSSParam();
- this.AllProcProp2Fase++;
- }
- else if (this.AllProcProp2Fase == 5)
- {
- this.boAllProcPropBUSY = false;
- }
- }
- public void AllProcProp()
- {
- this.boModelChg = false;
- float realtimeSinceStartup = Time.realtimeSinceStartup;
- for (;;)
- {
- if (Array.Find<MaidProp>(this.m_aryMaidProp, (MaidProp m) => m.type == 3 && (m.boDut || m.boTempDut)) == null)
- {
- break;
- }
- for (int i = 0; i < this.m_aryMaidProp.Length; i++)
- {
- MaidProp maidProp = this.m_aryMaidProp[i];
- string name = maidProp.name;
- if (maidProp.type == 3 && this.ProcItem(this.m_dicMaidProp[name]))
- {
- if (!this.boModelChg)
- {
- this.body0.FixVisibleFlag(true);
- this.boModelChg = true;
- }
- if (this.boMAN && maidProp.idx == 43)
- {
- for (int j = 44; j <= 100; j++)
- {
- this.GetProp((MPN)j).boDut = true;
- }
- this.GetProp(MPN.moza).boDut = true;
- }
- else if (maidProp.idx == 50 || maidProp.idx == 46 || maidProp.idx == 47 || maidProp.idx == 49 || maidProp.idx == 48)
- {
- this.GetProp(MPN.haircolor).boDut = true;
- }
- else if (maidProp.idx == 45)
- {
- MPN[] array = new MPN[]
- {
- MPN.skin,
- MPN.eye,
- MPN.mayu,
- MPN.eye_hi,
- MPN.eye_hi_r,
- MPN.EyeClose,
- MPN.EarNone,
- MPN.EarElf,
- MPN.EarRot,
- MPN.EarScl,
- MPN.NosePos,
- MPN.NoseScl,
- MPN.FaceShape,
- MPN.FaceShapeSlim,
- MPN.MayuShapeIn,
- MPN.MayuShapeOut,
- MPN.MayuX,
- MPN.MayuY,
- MPN.MayuRot,
- MPN.eye_hi_r,
- MPN.eyewhite,
- MPN.nose,
- MPN.facegloss
- };
- foreach (MPN mpn in array)
- {
- this.GetProp(mpn).boDut = true;
- }
- }
- else if (maidProp.idx == 52)
- {
- MaidProp prop = this.GetProp(MPN.acctatoo);
- prop.boDut = true;
- if (prop.listSubProp != null)
- {
- for (int l = 0; l < prop.listSubProp.Count; l++)
- {
- if (prop.listSubProp[l] != null)
- {
- prop.listSubProp[l].bDut = true;
- }
- }
- }
- prop = this.GetProp(MPN.hokuro);
- prop.boDut = true;
- if (prop.listSubProp != null)
- {
- for (int n = 0; n < prop.listSubProp.Count; n++)
- {
- if (prop.listSubProp[n] != null)
- {
- prop.listSubProp[n].bDut = true;
- }
- }
- }
- this.GetProp(MPN.lip).boDut = true;
- }
- }
- }
- }
- realtimeSinceStartup = Time.realtimeSinceStartup;
- bool flag = false;
- foreach (MaidProp maidProp2 in this.m_dicMaidProp.Values)
- {
- if (maidProp2.type != 3)
- {
- flag |= this.ProcItem(maidProp2);
- }
- }
- if (flag)
- {
- this.body0.ItemScaleReset();
- }
- realtimeSinceStartup = Time.realtimeSinceStartup;
- if (this.boModelChg)
- {
- this.body0.MulTexProc();
- this.body0.FixMaskFlag();
- this.body0.FixVisibleFlag(false);
- }
- realtimeSinceStartup = Time.realtimeSinceStartup;
- this.ProcSSParam();
- }
- private bool ProcItem(MaidProp mp)
- {
- bool result = false;
- string name = mp.name;
- if (mp.type == 1)
- {
- if (mp.boTempDut)
- {
- mp.boTempDut = false;
- this.body0.VertexMorph_FromProcItem(name, (float)mp.temp_value / 100f);
- result = true;
- }
- if (mp.boDut)
- {
- mp.boDut = false;
- this.body0.VertexMorph_FromProcItem(name, (float)mp.value / 100f);
- result = true;
- }
- }
- else if (mp.type == 2)
- {
- if (mp.boTempDut)
- {
- mp.boTempDut = false;
- this.body0.BoneMorph_FromProcItem(name, (float)mp.temp_value / 100f);
- result = true;
- }
- if (mp.boDut)
- {
- mp.boDut = false;
- this.body0.BoneMorph_FromProcItem(name, (float)mp.value / 100f);
- result = true;
- }
- }
- else if (mp.type == 3)
- {
- if (mp.boTempDut && mp.boDut)
- {
- string[] array = new string[6];
- array[0] = "Item実行を、本元とTempを同時に更新しようとしました。";
- int num = 1;
- MPN idx = (MPN)mp.idx;
- array[num] = idx.ToString();
- array[2] = " 元=";
- array[3] = mp.strFileName;
- array[4] = " Temp=";
- array[5] = mp.strTempFileName;
- Debug.LogWarning(string.Concat(array));
- }
- if (mp.boTempDut)
- {
- if (!string.IsNullOrEmpty(mp.strTempFileName) && !Menu.ProcScript(this, mp, true, null))
- {
- Debug.LogWarning("メニューファイル " + mp.strFileName + " が開けませんでした。");
- mp.nTempFileNameRID = 0;
- mp.strTempFileName = string.Empty;
- }
- result = true;
- mp.boTempDut = false;
- if (97 <= mp.idx && mp.idx <= 100)
- {
- mp.nTempFileNameRID = 0;
- mp.strTempFileName = string.Empty;
- }
- }
- if (mp.boDut)
- {
- if (!string.IsNullOrEmpty(mp.strFileName) && !Menu.ProcScript(this, mp, false, null))
- {
- Debug.LogWarning("メニューファイル " + mp.strFileName + " が開けませんでした。");
- if (this.DelProp((MPN)mp.idx, false))
- {
- Menu.ProcScript(this, mp, false, null);
- }
- }
- result = true;
- mp.boDut = false;
- if (97 <= mp.idx && mp.idx <= 100)
- {
- mp.nFileNameRID = 0;
- mp.strFileName = string.Empty;
- }
- }
- if (mp.listSubProp != null)
- {
- for (int i = 0; i < mp.listSubProp.Count; i++)
- {
- SubProp subProp = mp.listSubProp[i];
- if (subProp != null && subProp.bDut)
- {
- if (!Menu.ProcScript(this, subProp.strFileName, false, subProp))
- {
- Debug.LogWarning("サブメニューファイル " + subProp.strFileName + " が開けませんでした。");
- mp.listSubProp[i] = null;
- }
- result = true;
- subProp.bDut = false;
- }
- }
- }
- if (mp.boAdjustDut)
- {
- if (this.body0.isLoadedBody)
- {
- foreach (KeyValuePair<TBody.SlotID, Dictionary<string, KeyValuePair<int, VtxAttachPos>>> keyValuePair in mp.m_dicTBodyAttachPos)
- {
- TBodySkin tbodySkin = this.body0.goSlot[(int)keyValuePair.Key];
- if (tbodySkin.morph != null)
- {
- foreach (KeyValuePair<string, KeyValuePair<int, VtxAttachPos>> keyValuePair2 in keyValuePair.Value)
- {
- tbodySkin.morph.SetAttachPointOffsetLocal(keyValuePair2.Key, keyValuePair2.Value.Value);
- result = true;
- }
- }
- }
- }
- mp.boAdjustDut = false;
- }
- }
- return result;
- }
- public bool MayuDrawPriority
- {
- get
- {
- string materialProperty = this.body0.GetMaterialProperty("head", 3, "_ZTest2", "AUTO");
- if (!string.IsNullOrEmpty(materialProperty))
- {
- float num = 0f;
- if (float.TryParse(materialProperty, out num))
- {
- if ((int)(num + 0.5f) == 1)
- {
- return false;
- }
- if ((int)(num + 0.5f) == 7)
- {
- return true;
- }
- }
- }
- return false;
- }
- set
- {
- this.body0.SetMaterialProperty("mayu", "head", 3, "_ZTest2", "UnityEngine.Rendering.CompareFunction", (!value) ? "1" : "7", true);
- }
- }
- public void SubPropAlpha(MPN f_mpn, int f_nSubNo, float f_fTexMulAlpha)
- {
- MaidProp maidProp = this.m_aryMaidProp[(int)f_mpn];
- if (maidProp.listSubProp.Count <= f_nSubNo)
- {
- Debug.LogError("listSubProp の範囲を超えています。");
- return;
- }
- SubProp subProp = maidProp.listSubProp[f_nSubNo];
- if (subProp == null)
- {
- Debug.LogError("listSubProp に " + f_nSubNo + " 番はありません。");
- return;
- }
- subProp.fTexMulAlpha = f_fTexMulAlpha;
- }
- public bool SerializeProp(BinaryWriter f_bwWrite)
- {
- f_bwWrite.Write("CM3D2_MPROP_LIST");
- f_bwWrite.Write(1230);
- f_bwWrite.Write(this.m_dicMaidProp.Count);
- int num = 0;
- foreach (KeyValuePair<string, MaidProp> keyValuePair in this.m_dicMaidProp)
- {
- f_bwWrite.Write(keyValuePair.Key);
- keyValuePair.Value.Serialize(f_bwWrite);
- num++;
- }
- return true;
- }
- public bool SerializePropLowCapacity(BinaryWriter writer)
- {
- NDebug.Assert(this.m_dicMaidProp.Count < 65535, "容量over");
- writer.Write((char)this.m_dicMaidProp.Count);
- NDebug.Assert(true, "MPN容量over");
- foreach (KeyValuePair<string, MaidProp> keyValuePair in this.m_dicMaidProp)
- {
- MPN mpn = (MPN)Enum.Parse(typeof(MPN), keyValuePair.Key);
- writer.Write((char)mpn);
- keyValuePair.Value.SerializeLowCapacity(writer);
- }
- return true;
- }
- public bool SerializeMultiColor(BinaryWriter f_bwWrite)
- {
- return this.m_Parts.Serialize(f_bwWrite);
- }
- public bool SerializeMisc(BinaryWriter f_bwWrite)
- {
- f_bwWrite.Write("CM3D2_MAID_MISC");
- f_bwWrite.Write(1230);
- f_bwWrite.Write(this.m_nActiveSlotNo);
- if (this.m_texIcon != null)
- {
- byte[] array = this.m_texIcon.EncodeToPNG();
- f_bwWrite.Write(array.Length);
- f_bwWrite.Write(array);
- }
- else
- {
- f_bwWrite.Write(0);
- }
- f_bwWrite.Write(this.m_strThumCardTime);
- f_bwWrite.Write(this.m_colMan.r);
- f_bwWrite.Write(this.m_colMan.g);
- f_bwWrite.Write(this.m_colMan.b);
- f_bwWrite.Write(this.m_colMan.a);
- f_bwWrite.Write(this.m_nVoicePitch);
- this.FixThumCard();
- return true;
- }
- public bool SerializeBody(BinaryWriter f_bwWrite)
- {
- f_bwWrite.Write("CM3D2_MAID_BODY");
- f_bwWrite.Write(1230);
- return true;
- }
- public bool DeserializeProp(BinaryReader f_brRead)
- {
- string a = f_brRead.ReadString();
- NDebug.Assert(a == "CM3D2_MPROP_LIST", "メイドプロパティリストのヘッダーが不正です。");
- int num = f_brRead.ReadInt32();
- int num2 = f_brRead.ReadInt32();
- for (int i = 0; i < num2; i++)
- {
- string tag = f_brRead.ReadString();
- MaidProp prop = this.GetProp(tag);
- prop.Deserialize(f_brRead);
- if (num <= 135 && prop.idx == 83 && Path.GetFileNameWithoutExtension(prop.strFileName.ToLower()) == "acckubi007_i_")
- {
- prop.boDut = true;
- prop.strFileName = CM3.dicDelItem[MPN.acckubi];
- prop.nFileNameRID = prop.strFileName.ToLower().GetHashCode();
- prop.strTempFileName = string.Empty;
- prop.nTempFileNameRID = 0;
- }
- }
- if (num <= 110)
- {
- MaidProp prop2 = this.GetProp(MPN.EyeScl);
- MaidProp prop3 = this.GetProp(MPN.EyeSclX);
- prop3.value = prop2.value;
- MaidProp prop4 = this.GetProp(MPN.EyeSclY);
- prop4.value = prop2.value;
- }
- this.AllProcPropSeqStart();
- return true;
- }
- public void DeserializeOldData(OldDataConverter.MaidData data, bool statusOnly = false)
- {
- NDebug.AssertNull(data != null);
- this.status.Deserialize(data.statusReader, true);
- using (MemoryStream memoryStream = new MemoryStream(data.ReadAppearanceByte()))
- {
- using (BinaryReader binaryReader = new BinaryReader(memoryStream))
- {
- this.DeserializeProp(binaryReader);
- this.DeserializeMultiColor(binaryReader);
- }
- }
- if (!statusOnly)
- {
- Texture2D texture2D = new Texture2D(1, 1, TextureFormat.ARGB32, false);
- texture2D.LoadImage(data.ReadThumbnailByte());
- byte[] array = data.ReadAppearanceByte();
- this.SetThumIcon(texture2D);
- string text = GameMain.Instance.CMSystem.CM3D2Path + "\\Thumb\\" + this.status.guid + ".png";
- if (File.Exists(text))
- {
- string text2 = Path.GetFullPath(".\\") + "Thumb\\" + this.status.guid + ".png";
- if (!File.Exists(text2))
- {
- File.Copy(text, text2);
- }
- }
- }
- }
- public static List<MaidProp> DeserializePropPre(BinaryReader f_brRead)
- {
- List<MaidProp> list = new List<MaidProp>();
- string a = f_brRead.ReadString();
- NDebug.Assert(a == "CM3D2_MPROP_LIST", "メイドプロパティリストのヘッダーが不正です。");
- int num = f_brRead.ReadInt32();
- int num2 = f_brRead.ReadInt32();
- HashSet<MPN> hashSet = new HashSet<MPN>();
- for (int i = 0; i < num2; i++)
- {
- if (4 <= num)
- {
- string text = f_brRead.ReadString();
- }
- MaidProp maidProp = new MaidProp();
- maidProp.Deserialize(f_brRead);
- hashSet.Add((MPN)maidProp.idx);
- list.Add(maidProp);
- if (num <= 110 && maidProp.idx == 10)
- {
- list.Add(new MaidProp
- {
- type = maidProp.type,
- idx = 11,
- name = MPN.EyeSclX.ToString(),
- value = maidProp.value,
- min = maidProp.min,
- max = maidProp.max,
- boDut = true
- });
- list.Add(new MaidProp
- {
- type = maidProp.type,
- idx = 12,
- name = MPN.EyeSclY.ToString(),
- value = maidProp.value,
- min = maidProp.min,
- max = maidProp.max,
- boDut = true
- });
- }
- }
- if (num < 200)
- {
- list.Add(Maid.CreateProp(0, 100, 0, MPN.EyeClose, 2));
- list.Add(Maid.CreateProp(0, 100, 0, MPN.FaceShape, 2));
- list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuX, 2));
- list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuY, 2));
- }
- if (num < 210)
- {
- list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallPosX, 2));
- list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallPosY, 2));
- list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallSclX, 2));
- list.Add(Maid.CreateProp(0, 100, 50, MPN.EyeBallSclY, 2));
- }
- if (!hashSet.Contains(MPN.FaceShapeSlim))
- {
- list.Add(Maid.CreateProp(0, 100, 0, MPN.FaceShapeSlim, 2));
- }
- if (!hashSet.Contains(MPN.EarNone))
- {
- list.Add(Maid.CreateProp(0, 1, 0, MPN.EarNone, 2));
- }
- if (!hashSet.Contains(MPN.EarElf))
- {
- list.Add(Maid.CreateProp(0, 100, 0, MPN.EarElf, 2));
- }
- if (!hashSet.Contains(MPN.EarRot))
- {
- list.Add(Maid.CreateProp(0, 100, 50, MPN.EarRot, 2));
- }
- if (!hashSet.Contains(MPN.EarScl))
- {
- list.Add(Maid.CreateProp(0, 100, 50, MPN.EarScl, 2));
- }
- if (!hashSet.Contains(MPN.NosePos))
- {
- list.Add(Maid.CreateProp(0, 100, 50, MPN.NosePos, 2));
- }
- if (!hashSet.Contains(MPN.NoseScl))
- {
- list.Add(Maid.CreateProp(0, 100, 50, MPN.NoseScl, 2));
- }
- if (!hashSet.Contains(MPN.MayuShapeIn))
- {
- list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuShapeIn, 2));
- }
- if (!hashSet.Contains(MPN.MayuShapeOut))
- {
- list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuShapeOut, 2));
- }
- if (!hashSet.Contains(MPN.MayuRot))
- {
- list.Add(Maid.CreateProp(0, 100, 50, MPN.MayuRot, 2));
- }
- return list;
- }
- public static List<MaidProp> DeserializePropLowCapacity(BinaryReader reader)
- {
- List<MaidProp> list = Maid.CreateInitMaidPropList();
- Dictionary<int, MaidProp> dictionary = new Dictionary<int, MaidProp>();
- for (int i = 0; i < list.Count; i++)
- {
- dictionary.Add(list[i].idx, list[i]);
- }
- int num = (int)reader.ReadChar();
- for (int j = 0; j < num; j++)
- {
- int key = (int)reader.ReadChar();
- MaidProp maidProp = dictionary[key];
- maidProp.DeserializeLowCapacity(reader);
- }
- return list;
- }
- public static MaidParts.PartsColor[] DeserializeMultiColorPre(BinaryReader f_brRead)
- {
- return MaidParts.DeserializePre(f_brRead);
- }
- public bool DeserializeMultiColor(BinaryReader f_brRead)
- {
- MaidParts.PartsColor[] array = MaidParts.DeserializePre(f_brRead);
- for (int i = 0; i < array.Length; i++)
- {
- this.Parts.SetPartsColor((MaidParts.PARTS_COLOR)i, array[i]);
- }
- return true;
- }
- public bool DeserializeMisc(BinaryReader f_brRead)
- {
- string a = f_brRead.ReadString();
- NDebug.Assert(a == "CM3D2_MAID_MISC", "メイドその他のヘッダーが不正です。");
- int num = f_brRead.ReadInt32();
- this.m_nActiveSlotNo = f_brRead.ReadInt32();
- int num2 = f_brRead.ReadInt32();
- if (num2 != 0)
- {
- byte[] data = f_brRead.ReadBytes(num2);
- UnityEngine.Object.Destroy(this.m_texIcon);
- this.m_texIcon = new Texture2D(1, 1, TextureFormat.ARGB32, false);
- this.m_texIcon.LoadImage(data);
- }
- if (8 <= num)
- {
- this.m_strThumCardTime = f_brRead.ReadString();
- }
- this.m_colMan.r = f_brRead.ReadSingle();
- this.m_colMan.g = f_brRead.ReadSingle();
- this.m_colMan.b = f_brRead.ReadSingle();
- this.m_colMan.a = f_brRead.ReadSingle();
- if (202 <= num)
- {
- this.m_nVoicePitch = f_brRead.ReadInt32();
- }
- this.CheckOldThumCard();
- return true;
- }
- public static bool DeserializeBodyPre(BinaryReader f_brRead)
- {
- return Maid.DeserializeBodyRead(f_brRead);
- }
- public bool DeserializeBody(BinaryReader f_brRead)
- {
- return Maid.DeserializeBodyRead(f_brRead);
- }
- public static bool DeserializeBodyRead(BinaryReader f_brRead)
- {
- string a = f_brRead.ReadString();
- NDebug.Assert(a == "CM3D2_MAID_BODY", "メイドBodyヘッダーが不正です。");
- int num = f_brRead.ReadInt32();
- return true;
- }
- public void SetTBodySkinPos(MPN m_mpn, TBody.SlotID f_slot, Vector3 f_vPosLocal, Quaternion f_qRotLocal, Vector3 f_vScaleRate, bool f_bEnable)
- {
- MaidProp prop = this.GetProp(m_mpn);
- BoneAttachPos boneAttachPos = new BoneAttachPos();
- boneAttachPos.bEnable = f_bEnable;
- boneAttachPos.pss.position = f_vPosLocal;
- boneAttachPos.pss.rotation = f_qRotLocal;
- boneAttachPos.pss.scale = f_vScaleRate;
- prop.m_dicTBodySkinPos[f_slot] = new KeyValuePair<int, BoneAttachPos>(prop.nFileNameRID, boneAttachPos);
- }
- public BoneAttachPos GetTBodySkinPos(MPN m_mpn, TBody.SlotID f_slot)
- {
- BoneAttachPos result = null;
- MaidProp prop = this.GetProp(m_mpn);
- KeyValuePair<int, BoneAttachPos> keyValuePair;
- if (prop.m_dicTBodySkinPos.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID)
- {
- result = keyValuePair.Value;
- }
- return result;
- }
- public void ClearTBodySkinPos(MPN m_mpn, TBody.SlotID f_slot)
- {
- MaidProp prop = this.GetProp(m_mpn);
- prop.m_dicTBodySkinPos.Remove(f_slot);
- }
- 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)
- {
- MaidProp prop = this.GetProp(m_mpn);
- Dictionary<string, KeyValuePair<int, VtxAttachPos>> dictionary;
- if (!prop.m_dicTBodyAttachPos.TryGetValue(f_slot, out dictionary))
- {
- dictionary = (prop.m_dicTBodyAttachPos[f_slot] = new Dictionary<string, KeyValuePair<int, VtxAttachPos>>());
- }
- VtxAttachPos vtxAttachPos = new VtxAttachPos();
- vtxAttachPos.vtxcount = f_vtxcount;
- vtxAttachPos.vidx = f_vidx;
- vtxAttachPos.prs.position = f_vPosLocal;
- vtxAttachPos.prs.rotation = f_qRotLocal;
- vtxAttachPos.prs.scale = f_vScaleRate;
- vtxAttachPos.bEnable = f_bEnable;
- dictionary[f_apname] = new KeyValuePair<int, VtxAttachPos>(prop.nFileNameRID, vtxAttachPos);
- }
- public VtxAttachPos GetAttachPointPos(MPN m_mpn, TBody.SlotID f_slot, int f_vtxcount, string f_apname)
- {
- VtxAttachPos result = null;
- MaidProp prop = this.GetProp(m_mpn);
- Dictionary<string, KeyValuePair<int, VtxAttachPos>> dictionary;
- KeyValuePair<int, VtxAttachPos> keyValuePair;
- if (prop.m_dicTBodyAttachPos.TryGetValue(f_slot, out dictionary) && dictionary.TryGetValue(f_apname, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID && keyValuePair.Value.vtxcount == f_vtxcount)
- {
- result = keyValuePair.Value;
- }
- return result;
- }
- public void ClearAttachPointPos(MPN m_mpn, TBody.SlotID f_slot, string f_apname)
- {
- MaidProp prop = this.GetProp(m_mpn);
- Dictionary<string, KeyValuePair<int, VtxAttachPos>> dictionary;
- if (prop.m_dicTBodyAttachPos.TryGetValue(f_slot, out dictionary))
- {
- dictionary.Remove(f_apname);
- }
- }
- public void SetMaterialProperty(MPN m_mpn, TBody.SlotID f_slot, int f_nMatNo, string f_strPropName, string f_strTypeName, string f_strValue)
- {
- MaidProp prop = this.GetProp(m_mpn);
- prop.m_dicMaterialProp[f_slot] = new KeyValuePair<int, MatPropSave>(prop.nFileNameRID, new MatPropSave(f_nMatNo, f_strPropName, f_strTypeName, f_strValue));
- }
- public MatPropSave GetMaterialProperty(MPN m_mpn, TBody.SlotID f_slot)
- {
- MaidProp prop = this.GetProp(m_mpn);
- KeyValuePair<int, MatPropSave> keyValuePair;
- if (prop.m_dicMaterialProp.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID)
- {
- return keyValuePair.Value;
- }
- return null;
- }
- public void SetHairLengthSaveToMP(MPN f_mpn, TBody.SlotID f_slot, string f_strName, float f_fValue)
- {
- MaidProp prop = this.GetProp(f_mpn);
- KeyValuePair<int, Dictionary<string, float>> value;
- if (!prop.m_dicBoneLength.TryGetValue(f_slot, out value))
- {
- Dictionary<TBody.SlotID, KeyValuePair<int, Dictionary<string, float>>> dicBoneLength = prop.m_dicBoneLength;
- value = new KeyValuePair<int, Dictionary<string, float>>(prop.nFileNameRID, new Dictionary<string, float>());
- dicBoneLength[f_slot] = value;
- }
- value.Value[f_strName] = f_fValue;
- }
- public bool GetHairLengthFromMP(MPN f_mpn, TBody.SlotID f_slot, string f_strName, out float f_fOutValue)
- {
- MaidProp prop = this.GetProp(f_mpn);
- KeyValuePair<int, Dictionary<string, float>> keyValuePair;
- if (prop.m_dicBoneLength.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key == prop.nFileNameRID && keyValuePair.Value.TryGetValue(f_strName, out f_fOutValue))
- {
- return true;
- }
- f_fOutValue = 0.5f;
- return false;
- }
- public void ClearHairLengthMP(MPN f_mpn, TBody.SlotID f_slot)
- {
- MaidProp prop = this.GetProp(f_mpn);
- if (prop.m_dicBoneLength != null && prop.m_dicBoneLength.ContainsKey(f_slot))
- {
- prop.m_dicBoneLength.Remove(f_slot);
- }
- }
- public bool NotExistThenClearHairLengthMP(MPN f_mpn, TBody.SlotID f_slot)
- {
- MaidProp prop = this.GetProp(f_mpn);
- KeyValuePair<int, Dictionary<string, float>> keyValuePair;
- if (prop.m_dicBoneLength.TryGetValue(f_slot, out keyValuePair) && keyValuePair.Key != prop.nFileNameRID)
- {
- prop.m_dicBoneLength.Remove(f_slot);
- return true;
- }
- return false;
- }
- public void ThumShotCamMove()
- {
- GameMain.Instance.ThumCamera.GetComponent<ThumShot>().MoveTargetCard(this);
- GameMain.Instance.ThumCamera.GetComponent<ThumShot>().MoveTargetThum(this);
- }
- public void ThumShot()
- {
- UnityEngine.Object.Destroy(this.m_texIcon);
- this.m_texIcon = GameMain.Instance.ThumCamera.GetComponent<ThumShot>().ShotThumIcon(this);
- this.SetThumCard(GameMain.Instance.ThumCamera.GetComponent<ThumShot>().ShotThumCard(this));
- }
- public void ThumShotCustom(string saveFileName, bool adjustmentCameraTransform)
- {
- ThumShot component = GameMain.Instance.ThumCamera.GetComponent<ThumShot>();
- Texture2D texture2D;
- if (adjustmentCameraTransform)
- {
- texture2D = component.ShotThumCard(this);
- }
- else
- {
- texture2D = component.ShotThumCardOriginal();
- }
- string fullPath = Path.GetFullPath(".\\");
- string text = fullPath + "Thumb";
- if (!Directory.Exists(text))
- {
- Directory.CreateDirectory(text);
- }
- text = text + "/" + saveFileName;
- UTY.SaveImage(texture2D, text);
- UnityEngine.Object.Destroy(texture2D);
- }
- public void SetThumCard(Texture2D tex)
- {
- string fullPath = Path.GetFullPath(".\\");
- string text = fullPath + "Thumb";
- if (!Directory.Exists(text))
- {
- Directory.CreateDirectory(text);
- }
- string f_strFileName = string.Empty;
- this.m_strThumCardTime = DateTime.Now.ToString("yyyyMMddHHmmssfff");
- f_strFileName = text + "/_tmp_thum_" + this.status.guid + ".png";
- UTY.SaveImage(tex, f_strFileName);
- UnityEngine.Object.Destroy(tex);
- Texture2D thumIcon = this.GetThumIcon();
- f_strFileName = text + "/icon_thum_" + this.status.guid + ".png";
- UTY.SaveImage(thumIcon, f_strFileName);
- }
- public void SetThumIcon(Texture2D icon_tex)
- {
- this.m_texIcon = icon_tex;
- }
- public Texture2D GetThumIcon()
- {
- return this.m_texIcon;
- }
- public Texture2D GetThumCard()
- {
- Texture2D result = null;
- string fullPath = Path.GetFullPath(".\\");
- string text = fullPath + "Thumb";
- if (!Directory.Exists(text))
- {
- Directory.CreateDirectory(text);
- }
- string text2 = text + "/_tmp_thum_" + this.status.guid + ".png";
- if (File.Exists(text2))
- {
- result = UTY.LoadTexture(text2);
- }
- else
- {
- text2 = text + "/" + this.status.guid + ".png";
- if (File.Exists(text2))
- {
- result = UTY.LoadTexture(text2);
- }
- }
- return result;
- }
- public static void DeletedTmpThumCards()
- {
- string fullPath = Path.GetFullPath(".\\");
- string text = fullPath + "Thumb";
- if (!Directory.Exists(text))
- {
- return;
- }
- string[] files = Directory.GetFiles(text, "*", SearchOption.TopDirectoryOnly);
- for (int i = 0; i < files.Length; i++)
- {
- string text2 = text + "\\";
- int num = files[i].IndexOf(text2);
- if (num != 0)
- {
- files[i] = string.Empty;
- }
- else
- {
- string text3 = string.Empty;
- try
- {
- text3 = files[i].Substring(text2.Length, files[i].Length - text2.Length);
- }
- catch
- {
- }
- if (string.IsNullOrEmpty(text3))
- {
- files[i] = string.Empty;
- }
- else if (0 > text3.IndexOf(".png") || text3.IndexOf("_tmp_thum_") != 0)
- {
- files[i] = string.Empty;
- }
- }
- }
- for (int j = 0; j < files.Length; j++)
- {
- if (!string.IsNullOrEmpty(files[j]))
- {
- try
- {
- File.Delete(files[j]);
- }
- catch
- {
- }
- }
- }
- }
- private void FixThumCard()
- {
- string fullPath = Path.GetFullPath(".\\");
- string text = fullPath + "Thumb";
- if (!Directory.Exists(text))
- {
- return;
- }
- string text2 = text + "/_tmp_thum_" + this.status.guid + ".png";
- if (!File.Exists(text2))
- {
- return;
- }
- string text3 = text + "/" + this.status.guid + ".png";
- try
- {
- if (File.Exists(text3))
- {
- File.Delete(text3);
- }
- File.Move(text2, text3);
- }
- catch
- {
- }
- }
- private void CheckOldThumCard()
- {
- string fullPath = Path.GetFullPath(".\\");
- string text = fullPath + "Thumb";
- if (!Directory.Exists(text))
- {
- return;
- }
- string text2 = string.Concat(new string[]
- {
- text,
- "/",
- this.status.guid,
- this.m_strThumCardTime,
- ".png"
- });
- if (!File.Exists(text2))
- {
- return;
- }
- File.Move(text2, text + "/" + this.status.guid + ".png");
- }
- public void ProcSSParam()
- {
- this.boBallGAG = (this.body0.GetSlotUserParam("accHa", "口枷") > 0);
- this.boNoseFook = (this.body0.GetSlotUserParam("accHana", "鼻フック") > 0);
- }
- public void StopAnime(string fn = "")
- {
- this.body0.StopAnime(fn);
- }
- public string CrossFade(string fn, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f)
- {
- return this.CrossFade(fn, GameUty.FileSystem, additive, loop, boAddQue, val, weight);
- }
- public string CrossFade(string fn, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f)
- {
- return this.body0.CrossFade(fn, fileSystem, additive, loop, boAddQue, val, weight);
- }
- public string CrossFadeAbsolute(string fn, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f)
- {
- return this.CrossFadeAbsolute(fn, GameUty.FileSystem, additive, loop, boAddQue, val, weight);
- }
- public string CrossFadeAbsolute(string fn, AFileSystemBase fileSystem, bool additive = false, bool loop = false, bool boAddQue = false, float val = 0.5f, float weight = 1f)
- {
- return this.body0.CrossFadeAbsolute(fn, fileSystem, additive, loop, boAddQue, val, weight);
- }
- public Animation GetAnimation()
- {
- return this.body0.GetAnimation();
- }
- private void Start()
- {
- }
- public void ResetAll()
- {
- this.FaceAnime("通常", 0f, 0);
- this.FaceBlend("無し");
- this.OpenMouth(false);
- this.EyeToReset(0f);
- this.DelPrefabAll();
- string[] array = new string[]
- {
- "handitem",
- "kousoku_upper",
- "kousoku_lower",
- "eye_hi",
- "skirt",
- "panz",
- "mizugi",
- "onepiece",
- "accanl",
- "accvag",
- "KubiScl",
- "UdeScl",
- "DouPer",
- "sintyou",
- "kata",
- "seieki_naka"
- };
- for (int i = 0; i < array.Length; i++)
- {
- this.ResetProp(array[i], false);
- }
- if (this.body0 != null && this.body0.isLoadedBody)
- {
- this.body0.SetMaskMode(TBody.MaskMode.None);
- for (int j = 10; j <= 20; j++)
- {
- this.body0.MulTexRemove("body", 0, "_MainTex", j);
- this.body0.MulTexRemove("body", 0, "_ShadowTex", j);
- this.body0.MulTexRemove("head", 5, "_MainTex", j);
- this.body0.MulTexRemove("head", 5, "_ShadowTex", j);
- }
- this.body0.MulTexProc("body");
- this.body0.MulTexProc("head");
- this.SetModeHairR(TBody.ModeHirR.Normal);
- if (this.body0.isLoadedBody)
- {
- this.body0.MuneYureL(1f);
- this.body0.MuneYureR(1f);
- this.IKTargetToBone("左手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
- this.IKTargetToBone("右手", null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
- }
- }
- }
- public void Lipsync(bool f_bEnable)
- {
- this.boLipsync = f_bEnable;
- }
- public void LipSyncEnabled(bool enabled)
- {
- this.lipSyncEnabled = enabled;
- }
- public bool MicLipSync
- {
- get
- {
- return this.m_MicLipSync;
- }
- }
- public void SetMicLipSync(bool is_start)
- {
- if (!this.AudioMan)
- {
- Debug.LogError("AudioManが見つかりません");
- return;
- }
- this.m_MicLipSync = is_start;
- this.m_bFoceKuchipakuSelfUpdateTime = is_start;
- if (is_start)
- {
- if (!this.MicLipData.Context)
- {
- this.MicLipData.Context = this.AudioMan.gameObject.AddComponent<LowLatencyLipSyncContext>();
- }
- if (!this.MicLipData.MorphTarget)
- {
- this.MicLipData.MorphTarget = this.AudioMan.gameObject.AddComponent<OVRLipSyncContextMorphTarget>();
- }
- if (!this.MicLipData.MicInput)
- {
- this.MicLipData.MicInput = this.AudioMan.gameObject.AddComponent<OVRLipSyncMicInput>();
- }
- this.MicLipData.Context.Init();
- this.MicLipData.MorphTarget.Init(this);
- this.MicLipData.MicInput.Init(this);
- this.MicLipData.MicInput.StartMicrophone();
- }
- else
- {
- if (this.MicLipData.MicInput)
- {
- this.MicLipData.MicInput.StopMicrophone();
- }
- this.AudioMan.audiosource.clip = null;
- UnityEngine.Object.Destroy(this.MicLipData.Context);
- UnityEngine.Object.Destroy(this.MicLipData.MorphTarget);
- UnityEngine.Object.Destroy(this.MicLipData.MicInput);
- }
- }
- public void StartKuchipakuPattern(float f_fOffsetTime, string f_strPattern, bool f_bSelfUpdateTime = false)
- {
- this.m_fKuchipakuPatternOffsetTime = f_fOffsetTime;
- this.m_baKuchipakuPattern = Convert.FromBase64String(f_strPattern);
- this.m_bFoceKuchipakuSelfUpdateTime = f_bSelfUpdateTime;
- }
- public void StopKuchipakuPattern()
- {
- this.m_fKuchipakuPatternOffsetTime = 0f;
- this.m_baKuchipakuPattern = null;
- this.m_bFoceKuchipakuSelfUpdateTime = false;
- }
- public void IKTargetToAttachPoint(string tag, Maid tgt_maid, string tgt_name, string attachpoint_name, Vector3 f_vecOffset, IKCtrlData.IKAttachType attach_type = IKCtrlData.IKAttachType.Point, string axisbone = "", bool do_animation = false, bool is_next = false)
- {
- IKCtrlData ikdata = this.body0.IKCtrl.GetIKData(tag, true);
- Transform axis_bone = null;
- if (attach_type != IKCtrlData.IKAttachType.Rotate && !string.IsNullOrEmpty(axisbone))
- {
- axis_bone = CMT.SearchObjName(tgt_maid.body0.m_trBones, axisbone, true);
- }
- ikdata.SetIKSetting(attach_type, is_next, tgt_maid, this.body0.GetSlotNo(tgt_name), attachpoint_name, axis_bone, f_vecOffset, do_animation);
- }
- public void IKTargetToBone(string tag, Maid tgt_maid, string tgtbone_name, Vector3 f_vecOffset, IKCtrlData.IKAttachType attach_type = IKCtrlData.IKAttachType.Point, bool search_sm = false, bool do_animation = false, bool is_next = false)
- {
- IKCtrlData ikdata = this.IKCtrl.GetIKData(tag, true);
- if (tgtbone_name != "無し")
- {
- Transform target;
- if (!search_sm)
- {
- target = CMT.SearchObjName(tgt_maid.body0.m_trBones, tgtbone_name, true);
- }
- else
- {
- target = CMT.SearchObjName(tgt_maid.body0.SmBody, tgtbone_name, false);
- }
- ikdata.SetIKSetting(attach_type, is_next, tgt_maid, target, f_vecOffset, do_animation);
- }
- else
- {
- ikdata.Detach(IKCtrlData.IKAttachType.NewPoint);
- ikdata.Detach(IKCtrlData.IKAttachType.Rotate);
- }
- }
- public void IKTargetToOdogu(string tag, string odogu_name, string tgt_name, Vector3 f_vecOffset, IKCtrlData.IKAttachType attach_type = IKCtrlData.IKAttachType.Point, bool do_animation = false, bool is_next = false)
- {
- Transform transform = null;
- GameObject prefabFromBg = GameMain.Instance.BgMgr.GetPrefabFromBg(odogu_name);
- if (!prefabFromBg)
- {
- Debug.LogErrorFormat("現在の背景に大道具「{0}」は存在しません", new object[]
- {
- odogu_name
- });
- }
- else if (prefabFromBg.transform.childCount == 0 || string.IsNullOrEmpty(tgt_name))
- {
- transform = prefabFromBg.transform;
- }
- else
- {
- for (int i = 0; i < prefabFromBg.transform.childCount; i++)
- {
- Transform child = prefabFromBg.transform.GetChild(i);
- if (child && !(child.name != tgt_name))
- {
- transform = prefabFromBg.transform.GetChild(i);
- break;
- }
- }
- if (!transform)
- {
- Debug.LogErrorFormat("大道具「{0}」にターゲット「{1}」は存在しません", new object[]
- {
- odogu_name,
- tgt_name
- });
- }
- }
- IKCtrlData ikdata = this.IKCtrl.GetIKData(tag, true);
- ikdata.SetIKSetting(attach_type, is_next, transform, f_vecOffset, do_animation);
- }
- public void IKTargetToIKBone(string my_tag, Maid f_maidTarget, string bone_name, Vector3 f_vecOffset, IKCtrlData.IKAttachType attach_type = IKCtrlData.IKAttachType.Point, bool do_animation = false, bool is_next = false)
- {
- IKCtrlData ikdata = f_maidTarget.IKCtrl.GetIKData(bone_name, true);
- if (!ikdata)
- {
- return;
- }
- Transform targetBone = ikdata.TargetBone;
- IKCtrlData ikdata2 = this.IKCtrl.GetIKData(my_tag, true);
- ikdata2.SetIKSetting(attach_type, is_next, f_maidTarget, bone_name, targetBone, f_vecOffset, do_animation);
- }
- public void IKDetach(string name)
- {
- this.IKTargetToBone(name, null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
- }
- public void AllIKDetach(float blendtime = 0f)
- {
- this.IKCtrl.BlendTime = blendtime;
- this.IKCtrl.IKActive = (blendtime > 0f);
- this.IKCtrl.AllForceIK = false;
- foreach (string tag in this.IKCtrl.strIKDataPair.Keys)
- {
- this.IKTargetToBone(tag, null, "無し", Vector3.zero, IKCtrlData.IKAttachType.Point, false, false, false);
- }
- }
- public void OpenMouth(bool f_bOpen)
- {
- this.boMouthOpen = f_bOpen;
- }
- public void OpenMouthLookTooth(bool f_bOpen)
- {
- this.boLookTooth = f_bOpen;
- }
- public void EyeToPosition(Vector3 f_vecTargetPos, float f_fFadeTime = 0f)
- {
- if (f_fFadeTime <= 0f)
- {
- f_fFadeTime = 0.001f;
- }
- this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime;
- this.body0.trsLookTarget = null;
- this.body0.offsetLookTarget = f_vecTargetPos;
- this.body0.boHeadToCam = true;
- this.body0.boEyeToCam = true;
- this.body0.boEyeSorashi = false;
- }
- public void EyeToTargetObject(Transform target_trans, float f_fFadeTime = 0f)
- {
- this.body0.trsLookTarget = target_trans;
- if (this.body0.trsLookTarget == null)
- {
- this.body0.offsetLookTarget = new Vector3(0f, 1f, 0f);
- }
- if (f_fFadeTime <= 0f)
- {
- f_fFadeTime = 0.001f;
- }
- this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime;
- this.body0.boHeadToCam = true;
- this.body0.boEyeToCam = true;
- this.body0.boEyeSorashi = false;
- }
- public void EyeToTarget(Maid f_maidTarget, float f_fFadeTime = 0f, string f_strBoneName = "Bip01 Head")
- {
- Transform transform = CMT.SearchObjName(f_maidTarget.body0.m_trBones, f_strBoneName, true);
- this.body0.trsLookTarget = transform;
- if (transform == null)
- {
- this.body0.offsetLookTarget = new Vector3(0f, 1f, 0f);
- }
- if (f_fFadeTime <= 0f)
- {
- f_fFadeTime = 0.001f;
- }
- this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime;
- this.body0.boHeadToCam = true;
- this.body0.boEyeToCam = true;
- this.body0.boEyeSorashi = false;
- }
- public void EyeToCamera(Maid.EyeMoveType f_eType, float f_fFadeTime = 0f)
- {
- this.body0.boHeadToCam = false;
- this.body0.boEyeToCam = true;
- this.body0.boEyeSorashi = false;
- if (f_fFadeTime <= 0f)
- {
- f_fFadeTime = 0.001f;
- }
- this.body0.HeadToCamFadeSpeed = 1f / f_fFadeTime;
- if (GameMain.Instance.VRMode)
- {
- if (GameMain.Instance.OvrMgr != null)
- {
- this.body0.trsLookTarget = GameMain.Instance.OvrMgr.EyeAnchor;
- }
- if (GameMain.Instance.OvrIK != null && OvrIK.IsVRIKMode && GameMain.Instance.OvrIK.NowMaid == this)
- {
- this.body0.trsLookTarget = GameMain.Instance.OvrIK.EyeTargetTrs;
- }
- }
- else if (GameMain.Instance.MainCamera != null)
- {
- this.body0.trsLookTarget = GameMain.Instance.MainCamera.transform;
- }
- if (f_eType == Maid.EyeMoveType.無し)
- {
- this.body0.boEyeToCam = false;
- }
- if (f_eType == Maid.EyeMoveType.無視する)
- {
- this.body0.boEyeToCam = false;
- }
- if (f_eType == Maid.EyeMoveType.顔を向ける)
- {
- this.body0.boHeadToCam = true;
- }
- if (f_eType == Maid.EyeMoveType.顔だけ動かす)
- {
- this.body0.boHeadToCam = true;
- this.body0.boEyeToCam = false;
- }
- if (f_eType == Maid.EyeMoveType.顔をそらす)
- {
- this.body0.trsLookTarget = null;
- this.body0.boEyeSorashi = true;
- this.body0.boEyeToCam = true;
- this.body0.boHeadToCam = true;
- }
- if (f_eType == Maid.EyeMoveType.目と顔を向ける)
- {
- this.body0.boHeadToCam = true;
- this.body0.boEyeToCam = true;
- }
- if (f_eType == Maid.EyeMoveType.目だけ向ける)
- {
- this.body0.boHeadToCam = false;
- this.body0.boEyeToCam = true;
- }
- if (f_eType == Maid.EyeMoveType.目だけそらす)
- {
- this.body0.trsLookTarget = null;
- this.body0.boEyeSorashi = true;
- this.body0.boEyeToCam = true;
- this.body0.boHeadToCam = false;
- }
- }
- public void EyeToReset(float f_fFadeTime = 0f)
- {
- this.EyeToCamera(Maid.EyeMoveType.無し, f_fFadeTime);
- }
- public void LockHeadAndEye(bool toLock)
- {
- this.body0.boLockHeadAndEye = toLock;
- }
- public bool GetLockHeadAndEye()
- {
- return this.body0.boLockHeadAndEye;
- }
- public void SetModeHairR(TBody.ModeHirR f_eMode)
- {
- this.body0.Mode_HairR = f_eMode;
- }
- public void SetAutoTwist(Maid.AutoTwist f_eType, bool f_bEnable)
- {
- switch (f_eType)
- {
- case Maid.AutoTwist.ShoulderL:
- this.body0.boAutoTwistShoulderL = f_bEnable;
- break;
- case Maid.AutoTwist.ShoulderR:
- this.body0.boAutoTwistShoulderR = f_bEnable;
- break;
- case Maid.AutoTwist.WristL:
- this.body0.boAutoTwistWristL = f_bEnable;
- break;
- case Maid.AutoTwist.WristR:
- this.body0.boAutoTwistWristR = f_bEnable;
- break;
- case Maid.AutoTwist.ThighL:
- this.body0.boAutoTwistThighL = f_bEnable;
- break;
- case Maid.AutoTwist.ThighR:
- this.body0.boAutoTwistThighR = f_bEnable;
- break;
- }
- }
- public void SetAutoTwistAll(bool f_bEnable)
- {
- this.body0.boAutoTwistShoulderL = f_bEnable;
- this.body0.boAutoTwistShoulderR = f_bEnable;
- this.body0.boAutoTwistWristL = f_bEnable;
- this.body0.boAutoTwistWristR = f_bEnable;
- this.body0.boAutoTwistThighL = f_bEnable;
- this.body0.boAutoTwistThighR = f_bEnable;
- }
- public void FaceAnime(string tag, float t = 1f, int chkcode = 0)
- {
- this.FaceAnimeChkCode = chkcode;
- this.ActiveFace = tag;
- 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 + "〓通常"))
- {
- tag += "〓通常";
- }
- if (t == 0f)
- {
- this.boFaceAnime = false;
- this.FaceName = tag;
- this.FaceName2 = string.Empty;
- return;
- }
- this.boFaceAnime = true;
- if (this.FaceName2 != string.Empty)
- {
- this.FaceName = this.FaceName2;
- this.FaceName2 = string.Empty;
- }
- if (this.FaceName == string.Empty)
- {
- this.FaceName = "デフォ";
- }
- this.FaceName2 = tag;
- this.FacePlus = 1f / t;
- this.FaceTime = this.FacePlus * 0.0166666675f;
- }
- public void FaceBlend(string tag)
- {
- if (this.body0 == null)
- {
- Debug.LogError("Bodyが読み込まれる前に、表情ブレンドが呼ばれました。" + tag);
- return;
- }
- if (tag == "無し")
- {
- tag = string.Empty;
- }
- this.FaceName3 = tag;
- }
- public void ChangeAutoFace(bool bo)
- {
- if (this.boAutoFace != bo)
- {
- this.AutoFaceLV_old = 0;
- this.Hazukashi = 0f;
- }
- this.boAutoFace = bo;
- }
- public void AddPrefab(string f_strPrefab, string f_strName, string f_strDestBone, Vector3 f_vOffsetLocalPos, Vector3 f_vOffsetLocalRot)
- {
- UnityEngine.Object @object = Resources.Load("Prefab/" + f_strPrefab);
- if (@object != null)
- {
- Transform transform = null;
- if (this.body0 != null && this.body0.isLoadedBody)
- {
- transform = CMT.SearchObjName(this.body0.m_trBones, f_strDestBone, true);
- }
- if (transform != null)
- {
- GameObject goItem = UnityEngine.Object.Instantiate(@object) as GameObject;
- goItem.AddComponent<AttachPrefab>();
- goItem.name = goItem.name.Replace("(Clone)", string.Empty);
- if (!string.IsNullOrEmpty(f_strName))
- {
- goItem.name = f_strName;
- }
- AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren<AttachPrefab>(true);
- AttachPrefab[] array = (from a in componentsInChildren
- where a.name == goItem.name
- select a).ToArray<AttachPrefab>();
- for (int i = 0; i < array.Length; i++)
- {
- UnityEngine.Object.DestroyImmediate(array[i].gameObject);
- }
- goItem.transform.SetParent(transform, false);
- goItem.transform.localPosition = f_vOffsetLocalPos;
- goItem.transform.localRotation = Quaternion.Euler(f_vOffsetLocalRot);
- }
- else
- {
- Debug.LogError("人物にプレハブ追加で、ボーン名が見つかりません。" + f_strDestBone);
- }
- }
- else
- {
- Debug.LogError("人物にプレハブ追加で、プレハブが見つかりません。Prefab/" + f_strPrefab);
- }
- }
- public void DelPrefab(string f_strName)
- {
- if (this.body0 == null || !this.body0.isLoadedBody)
- {
- return;
- }
- AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren<AttachPrefab>(true);
- AttachPrefab[] array = (from a in componentsInChildren
- where a.name == f_strName
- select a).ToArray<AttachPrefab>();
- for (int i = 0; i < array.Length; i++)
- {
- UnityEngine.Object.DestroyImmediate(array[i].gameObject);
- }
- }
- public void DelPrefabAll()
- {
- if (this.body0 == null || !this.body0.isLoadedBody)
- {
- return;
- }
- AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren<AttachPrefab>(true);
- for (int i = 0; i < componentsInChildren.Length; i++)
- {
- UnityEngine.Object.DestroyImmediate(componentsInChildren[i].gameObject);
- }
- }
- public GameObject GetPrefab(string f_strName)
- {
- if (this.body0 == null || !this.body0.isLoadedBody)
- {
- return null;
- }
- AttachPrefab[] componentsInChildren = this.body0.m_Bones.GetComponentsInChildren<AttachPrefab>(true);
- AttachPrefab[] array = (from a in componentsInChildren
- where a.name == f_strName
- select a).ToArray<AttachPrefab>();
- return (0 >= array.Length) ? null : array[0].gameObject;
- }
- public void AnimationObject(string f_strName, string f_strAnimName, bool f_bNowPlay, bool f_bLoop)
- {
- Transform transform;
- if ((transform = CMT.SearchObjName(this.body0.m_trBones, f_strName, false)) != null)
- {
- Animation animation = transform.gameObject.GetComponent<Animation>();
- if (animation == null)
- {
- animation = transform.gameObject.AddComponent<Animation>();
- }
- AnimationClip animationClip = ImportCM.LoadAniClipNative(GameUty.FileSystem, f_strAnimName, true, true, true);
- if (animationClip == null)
- {
- NDebug.Assert("アニメーション " + f_strAnimName + " が見つかりません。", false);
- }
- animation.AddClip(animationClip, f_strAnimName);
- animation.clip = animationClip;
- animation.playAutomatically = true;
- animation.wrapMode = ((!f_bLoop) ? WrapMode.Once : WrapMode.Loop);
- if (f_bNowPlay)
- {
- animation.PlayQueued(f_strAnimName, QueueMode.PlayNow);
- }
- this.m_goTestAnim = transform.gameObject;
- }
- else
- {
- NDebug.Assert("人物に追加した " + f_strName + " は見つかりませんでした。", false);
- }
- }
- public void SetPos(Vector3 f_vecLocalPos)
- {
- base.gameObject.transform.localPosition = f_vecLocalPos;
- }
- public void SetRot(Vector3 f_vecLocalRot)
- {
- base.gameObject.transform.localRotation = Quaternion.Euler(f_vecLocalRot);
- }
- public Vector3 GetPos()
- {
- return base.gameObject.transform.localPosition;
- }
- public Vector3 GetRot()
- {
- return base.gameObject.transform.localRotation.eulerAngles;
- }
- public Vector3 GetWorldRot()
- {
- return base.gameObject.transform.rotation.eulerAngles;
- }
- public void SetPosOffset(Vector3 f_vecLocalPos)
- {
- this.m_vOffsetPostion = f_vecLocalPos;
- }
- public void UpdateTransformData()
- {
- this.SetPos(this.baseOffset + this.motionOffset);
- if (this.boMAN)
- {
- if (!string.IsNullOrEmpty(this.rotateLinkMaid))
- {
- for (int i = 0; i < GameMain.Instance.CharacterMgr.GetMaidCount(); i++)
- {
- Maid maid = GameMain.Instance.CharacterMgr.GetMaid(i);
- if (maid != null && maid.status.guid == this.rotateLinkMaid)
- {
- maid.UpdateTransformData();
- break;
- }
- }
- }
- return;
- }
- Vector3 position = base.transform.position;
- base.transform.localRotation = Quaternion.identity;
- if (!Mathf.Approximately(0f, this.baseEulerAngles.x))
- {
- base.transform.RotateAround(position, Vector3.right, this.baseEulerAngles.x);
- }
- if (!Mathf.Approximately(0f, this.baseEulerAngles.y))
- {
- base.transform.RotateAround(position, Vector3.up, this.baseEulerAngles.y);
- }
- if (!Mathf.Approximately(0f, this.baseEulerAngles.z))
- {
- base.transform.RotateAround(position, Vector3.forward, this.baseEulerAngles.z);
- }
- for (int j = 0; j < GameMain.Instance.CharacterMgr.GetManCount(); j++)
- {
- Maid man = GameMain.Instance.CharacterMgr.GetMan(j);
- if (man != null && man.status.guid == this.rotateLinkMaid)
- {
- man.SetPos(man.baseOffset + man.motionOffset);
- man.transform.localRotation = Quaternion.identity;
- if (!Mathf.Approximately(0f, this.baseEulerAngles.x))
- {
- man.transform.RotateAround(position, Vector3.right, this.baseEulerAngles.x);
- }
- if (!Mathf.Approximately(0f, this.baseEulerAngles.y))
- {
- man.transform.RotateAround(position, Vector3.up, this.baseEulerAngles.y);
- }
- if (!Mathf.Approximately(0f, this.baseEulerAngles.z))
- {
- man.transform.RotateAround(position, Vector3.forward, this.baseEulerAngles.z);
- }
- break;
- }
- }
- }
- public void SetPosOffsetFromUdeSclX(string category, float val)
- {
- this.m_vOffsetPostion.x = ((float)this.GetProp(category).value - 50f) * (val / 50f);
- }
- public void SetPosOffsetFromUdeSclY(string category, float val)
- {
- this.m_vOffsetPostion.y = ((float)this.GetProp(category).value - 50f) * (val / 50f);
- }
- public void SetPosOffsetFromUdeSclZ(string category, float val)
- {
- this.m_vOffsetPostion.z = ((float)this.GetProp(category).value - 50f) * (val / 50f);
- }
- public void ExportModBaseMenu(MPN f_mpn)
- {
- MaidProp prop = this.GetProp(f_mpn);
- if (string.IsNullOrEmpty(prop.strFileName))
- {
- NUty.WinMessageBox(NUty.GetWindowHandle(), "現在このスロットにはパーツが設定されていません。", "MOD Export Error", 0);
- return;
- }
- Menu.ExportModScript(this, prop.strFileName, false);
- }
- public void ExportModBaseMqo(MPN f_mpn, string f_strOutFileName)
- {
- MaidProp prop = this.GetProp(f_mpn);
- if (string.IsNullOrEmpty(prop.strFileName))
- {
- NUty.WinMessageBox(NUty.GetWindowHandle(), "現在このスロットにはパーツが設定されていません。", "MQO Export Error", 0);
- return;
- }
- }
- public void FoceKuchipakuUpdate(float f_fNowTime)
- {
- if (this.m_baKuchipakuPattern != null)
- {
- int num = (int)((this.m_fKuchipakuPatternOffsetTime + f_fNowTime) * 30f);
- int num2 = this.m_baKuchipakuPattern.Length / 3;
- if (0 < num && num < num2)
- {
- this.body0.Face.morph.boLipSync = true;
- this.body0.Face.morph.LipSync1 = this.body0.Face.morph.LipSync1 * 0.15f + (float)this.m_baKuchipakuPattern[num * 3] / 255f * 0.85f * 3f;
- this.body0.Face.morph.LipSync2 = this.body0.Face.morph.LipSync2 * 0.15f + (float)this.m_baKuchipakuPattern[num * 3 + 1] / 255f * 0.85f * 3f;
- this.body0.Face.morph.LipSync3 = this.body0.Face.morph.LipSync3 * 0.15f + (float)this.m_baKuchipakuPattern[num * 3 + 2] / 255f * 0.85f * 3f;
- }
- else
- {
- this.body0.Face.morph.boLipSync = false;
- }
- }
- }
- private void Update()
- {
- if (this.boAllProcPropBUSY)
- {
- this.AllProcPropSeq();
- return;
- }
- if (this.boMAN)
- {
- this.m_goOffset.transform.localPosition = this.m_vOffsetPostion;
- return;
- }
- if (!this.body0.isLoadedBody)
- {
- return;
- }
- if (this.boOffsetY)
- {
- float num = this.body0.ToeL.position.y;
- if (this.body0.ToeR.position.y < num)
- {
- num = this.body0.ToeR.position.y;
- }
- num = this.body0.CenterBone.position.y;
- num *= 0.8f;
- float num2 = this.body0.Pelvis.position.y - this.body0.CenterBone.position.y;
- this.m_goOffset.transform.localPosition = new Vector3(0f, -num2 + num2 * this.body0.bonemorph.SnityouOutScale, 0f) + this.m_vOffsetPostion;
- }
- this.body0.Face.morph.boLookTooth = this.boLookTooth;
- this.body0.Face.morph.boBallGAG = (this.boBallGAG | this.boMouthOpen);
- this.body0.Face.morph.boNoseFook = this.boNoseFook;
- if (this.AudioMan != null && !this.m_bFoceKuchipakuSelfUpdateTime)
- {
- this.body0.Face.morph.boLipSync = this.AudioMan.audiosource.isPlaying;
- if (!this.lipSyncEnabled)
- {
- this.body0.Face.morph.boLipSync = false;
- }
- float voicePara_ = this.VoicePara_1;
- float voicePara_2 = this.VoicePara_3;
- float vol = this.AudioMan.GetVol();
- this.voice_avg1 = this.voice_avg1 * (1f - voicePara_) + vol * voicePara_;
- this.voice_avg2 = this.voice_avg2 * (1f - voicePara_) + this.AudioMan.VAvgMax * voicePara_;
- this.voice_avg1D = this.voice_avg1D * (1f - voicePara_2) + (vol - this.voice_avg1_old) * voicePara_2;
- this.voice_avg2D = this.voice_avg2D * (1f - voicePara_2) + (this.AudioMan.VAvgMax - this.voice_avg2_old) * voicePara_2;
- this.voice_avg1_old = vol;
- this.voice_avg2_old = this.AudioMan.VAvgMax;
- this.voice_ao_time -= Time.deltaTime;
- if (this.voice_ao_time < 0f && this.voice_avg1D > 0f && this.voice_ao_chk0 < -0.05f && this.voice_ao_chk1 > 0.1f)
- {
- this.voice_ao_time = 0.05f;
- this.voice_ao = (this.voice_ao + 1) % 8;
- this.voice_ao_chk0 = 0f;
- this.voice_ao_chk1 = 0f;
- }
- if (this.voice_ao_chk1 < this.voice_avg1D)
- {
- this.voice_ao_chk1 = this.voice_avg1D;
- }
- if (0.1f < this.voice_avg1D)
- {
- this.voice_ao_chk0 = 0f;
- }
- if (this.voice_ao_chk0 > this.voice_avg1D)
- {
- this.voice_ao_chk0 = this.voice_avg1D;
- }
- float num3 = Mathf.Pow(this.voice_avg1, 1f) * 10f * this.VoicePara_2;
- if (this.voice_ao % 2 == 0)
- {
- this.voice_ao_f *= 0.5f;
- }
- else
- {
- this.voice_ao_f = this.voice_ao_f * 0.5f + 0.5f;
- }
- this.voice_lf2 = num3 * this.voice_ao_f;
- this.voice_lf3 = num3 * (1f - this.voice_ao_f);
- this.body0.Face.morph.LipSync2 = this.voice_lf2;
- this.body0.Face.morph.LipSync3 = this.voice_lf3;
- float num4 = Mathf.Pow(this.voice_avg2, 0.5f) * (this.voice_avg2D * 30f * this.VoicePara_4 + 0.5f);
- this.voice_lf1 = num4;
- this.body0.Face.morph.LipSync1 = this.voice_lf1;
- if (this.voice_ao % 4 < 2)
- {
- this.voice_ao_f2 *= 0.5f;
- }
- else
- {
- this.voice_ao_f2 = this.voice_ao_f2 * 0.5f + 0.5f;
- }
- this.body0.Face.morph.LipSync1 *= this.voice_ao_f2;
- this.body0.Face.morph.LipSync2 *= 1f - this.voice_ao_f2;
- this.body0.Face.morph.LipSync3 *= 1f - this.voice_ao_f2;
- this.body0.Face.morph.LipSync1 = Mathf.Clamp01(this.body0.Face.morph.LipSync1 * 0.5f);
- this.body0.Face.morph.LipSync2 = Mathf.Clamp01(this.body0.Face.morph.LipSync2 * 0.5f);
- this.body0.Face.morph.LipSync3 = Mathf.Clamp01(this.body0.Face.morph.LipSync3 * 0.5f);
- }
- if (this.m_baKuchipakuPattern != null && this.lipSyncEnabled && !this.m_bFoceKuchipakuSelfUpdateTime && this.AudioMan != null)
- {
- this.FoceKuchipakuUpdate(this.AudioMan.audiosource.time);
- }
- if (this.boLipsync && this.lipSyncEnabled)
- {
- this.body0.Face.morph.boLipSync = true;
- this.LipsyncT1 += Mathf.Sin(Time.time * 10f) * 0.5f + Mathf.Cos(Time.time * 5.55f) * 0.1f * 0.2f;
- this.LipsyncT2 += Mathf.Sin(Time.time * 5f) * 0.1f + Mathf.Cos(Time.time * 5.55f) * 0.1f * 0.2f;
- float num5 = (1f + Mathf.Sin(Time.time * 4f + this.LipsyncT1)) * 0.5f * 0.98f + 0.1f;
- float num6 = (Mathf.Sin(this.LipsyncT1) + 1f) * 0.5f;
- float num7 = (Mathf.Sin(this.LipsyncT2) + 1f) * 0.5f;
- this.body0.Face.morph.LipSync1 = num5 * num6 * num7 * 0.5f;
- this.body0.Face.morph.LipSync3 = num5 * (1f - num6) * num7 * 0.5f;
- this.body0.Face.morph.LipSync2 = num5 * (1f - num7) * 0.5f;
- }
- else if (this.boLipsync_old)
- {
- this.body0.Face.morph.LipSync1 = 0f;
- this.body0.Face.morph.LipSync3 = 0f;
- this.body0.Face.morph.LipSync2 = 0f;
- }
- this.boLipsync_old = this.boLipsync;
- if (this.boMabataki)
- {
- this.body0.Face.morph.ClearBlendValues();
- if (this.FaceName != string.Empty)
- {
- this.body0.Face.morph.MulBlendValues(this.FaceName, 1f);
- }
- if (this.FaceName2 != string.Empty)
- {
- this.body0.Face.morph.MulBlendValues(this.FaceName2, UTY.COSS2(Mathf.Pow(this.FaceTime, 0.4f), 4f));
- this.FaceTime += Time.deltaTime * this.FacePlus;
- if (this.FaceTime >= 1f)
- {
- this.boFaceAnime = false;
- this.FaceName = this.FaceName2;
- this.FaceName2 = string.Empty;
- }
- }
- if (this.FaceName3 != string.Empty)
- {
- this.body0.Face.morph.AddBlendValues(this.FaceName3, 1f);
- }
- if (this.MabatakiVal > 0f)
- {
- float num8 = this.MabatakiVal * this.MabatakiVal;
- num8 = Mathf.Sin(num8 * 3.14159274f);
- this.body0.Face.morph.EyeMabataki = num8;
- }
- else
- {
- this.body0.Face.morph.EyeMabataki = 0f;
- }
- if (!this.MabatakiUpdateStop)
- {
- this.MabatakiVal -= Time.deltaTime * 2f;
- }
- this.body0.Face.morph.FixBlendValues_Face();
- if (!this.boFaceAnime && this.NextMabatakiTime < Time.time && !this.MabatakiUpdateStop)
- {
- float num9 = 0.5f + (float)UTY.GetRnd(80) * 0.1f;
- this.NextMabatakiTime = Time.time + num9;
- this.MabatakiVal = 1f;
- }
- }
- else if (this.FaceName2 != string.Empty)
- {
- this.body0.Face.morph.ClearBlendValues();
- if (this.FaceName != string.Empty)
- {
- this.body0.Face.morph.MulBlendValues(this.FaceName, 1f);
- }
- this.body0.Face.morph.MulBlendValues(this.FaceName2, UTY.COSS2(Mathf.Pow(this.FaceTime, 0.4f), 4f));
- this.FaceTime += Time.deltaTime * this.FacePlus;
- if (this.FaceTime >= 1f)
- {
- this.boFaceAnime = false;
- this.FaceName = this.FaceName2;
- this.FaceName2 = string.Empty;
- }
- this.MabatakiVal = 0f;
- this.body0.Face.morph.FixBlendValues_Face();
- }
- }
- private void LateUpdate()
- {
- if (this.boAllProcPropBUSY)
- {
- return;
- }
- if (!this.body0.isLoadedBody)
- {
- return;
- }
- if (this.m_MotionLoad == 1)
- {
- this.m_MotionLoad = 0;
- if (!this.boMAN)
- {
- this.CrossFade("maid_stand01.anm", false, true, false, 0.5f, 1f);
- this.FaceAnime("通常", 1f, 0);
- if (GameMain.Instance.VRMode)
- {
- if (GameMain.Instance.OvrMgr != null)
- {
- this.body0.trsLookTarget = GameMain.Instance.OvrMgr.EyeAnchor;
- }
- }
- else if (GameMain.Instance.MainCamera != null)
- {
- this.body0.trsLookTarget = GameMain.Instance.MainCamera.transform;
- }
- }
- }
- }
- public GameObject m_goOffset;
- private Status m_Status;
- private MaidParts m_Parts;
- private bool m_visible;
- public Action<Maid> onMouseUpEvent;
- public string TypeName = string.Empty;
- public TBody body0;
- public bool boMAN;
- public bool boNPC;
- public bool boOffsetY = true;
- public Vector3 baseOffset = Vector3.zero;
- public Vector3 motionOffset = Vector3.zero;
- public Vector3 baseEulerAngles = Vector3.zero;
- public string rotateLinkMaid = string.Empty;
- private Dictionary<string, MaidProp> m_dicMaidProp = new Dictionary<string, MaidProp>();
- private MaidProp[] m_aryMaidProp;
- private Hashtable m_hashMaidPropLower = new Hashtable();
- private int m_nActiveSlotNo = -1;
- private string m_strThumCardTime = string.Empty;
- private Texture2D m_texIcon;
- private Color m_colMan = new Color(0f, 0.09f, 1f, 1f);
- private int m_nVoicePitch = 50;
- private bool boModelChg;
- public bool boAllProcPropBUSY;
- private int AllProcProp2Fase;
- private int AllProcProp2Cnt;
- public bool boLookTooth;
- public bool boBallGAG;
- public bool boMouthOpen;
- public bool boNoseFook;
- private float m_fKuchipakuPatternOffsetTime;
- public byte[] m_baKuchipakuPattern;
- private bool m_bFoceKuchipakuSelfUpdateTime;
- [Header("音声入力用コンポーネント")]
- public Maid.LipSyncComp MicLipData = new Maid.LipSyncComp();
- private bool m_MicLipSync;
- private bool boAutoFace;
- private float NextMabatakiTime;
- private float MabatakiVal;
- private string FaceName = string.Empty;
- private string FaceName2 = string.Empty;
- public string FaceName3 = string.Empty;
- private float FaceTime;
- private float FacePlus;
- public string ActiveFace = string.Empty;
- public int FaceAnimeChkCode;
- public bool boFaceAnime;
- public int OldFaceAtr;
- public bool boShitakaraNozoku;
- public bool boVisibleBottom;
- public int AutoFaceLV_old;
- public float Hazukashi;
- public bool boChkEye_old;
- public GameObject m_goTestAnim;
- public float voice_time;
- public float voice_avg1;
- public float voice_avg2;
- public float voice_avg1_old;
- public float voice_avg2_old;
- public float voice_avg1D;
- public float voice_avg2D;
- public int voice_ao;
- public float voice_ao_f;
- public float voice_ao_f2;
- public float voice_ao_time;
- public float voice_ao_chk0;
- public float voice_ao_chk1;
- public float voice_lf1;
- public float voice_lf2;
- public float voice_lf3;
- public float VoicePara_1 = 0.5f;
- public float VoicePara_2 = 0.074f;
- public float VoicePara_3 = 0.5f;
- public float VoicePara_4 = 0.05f;
- private bool lipSyncEnabled = true;
- private bool boLipsync;
- private bool boLipsync_old;
- private float LipsyncT1;
- private float LipsyncT2;
- public bool boMabataki = true;
- public bool MabatakiUpdateStop;
- private Vector3 m_vOffsetPostion = Vector3.zero;
- public static int changetest;
- private int m_MotionLoad = 1;
- [Serializable]
- public class LipSyncComp
- {
- [HideInInspector]
- public bool IsInit = true;
- public LowLatencyLipSyncContext Context;
- public OVRLipSyncContextMorphTarget MorphTarget;
- public OVRLipSyncMicInput MicInput;
- }
- public enum EyeMoveType
- {
- 無し,
- 無視する,
- 顔を向ける,
- 顔だけ動かす,
- 顔をそらす,
- 目と顔を向ける,
- 目だけ向ける,
- 目だけそらす
- }
- public enum AutoTwist
- {
- ShoulderL,
- ShoulderR,
- WristL,
- WristR,
- ThighL,
- ThighR
- }
- }
|