12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176 |
- 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");
- if (Product.VBA)
- {
- this.SetProp(MPN.bra, "bra030_i_.menu", 0, false, false);
- this.SetProp(MPN.panz, "Pants030_i_.menu", 0, false, false);
- }
- }
- }
- 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 (Product.VBA)
- {
- f_nFileNameRID = mp.nFileNameRID;
- if (filename.Contains("_del"))
- {
- f_nFileNameRID = 0;
- }
- if (mp.idx == 96)
- {
- this.m_strBefOnepiceFileName = filename;
- this.m_nBefOnepiceRID = f_nFileNameRID;
- if (f_nFileNameRID != 0)
- {
- MaidProp prop = this.GetProp(MPN.wear);
- if (!prop.strFileName.Contains("_del"))
- {
- this.m_strBefWearFileName = prop.strFileName;
- this.m_nBefWearRID = prop.nFileNameRID;
- }
- MaidProp prop2 = this.GetProp(MPN.skirt);
- if (!prop2.strFileName.Contains("_del"))
- {
- this.m_strBefSkirtFileName = prop2.strFileName;
- this.m_nBefSkirtRID = prop2.nFileNameRID;
- }
- }
- }
- else if (mp.idx == 67)
- {
- this.m_strBefWearFileName = filename;
- this.m_nBefWearRID = f_nFileNameRID;
- if (f_nFileNameRID != 0 && this.m_nBefOnepiceRID != 0)
- {
- this.m_nBefOnepiceRID = 0;
- if (this.m_nBefSkirtRID != 0)
- {
- this.SetProp(MPN.skirt, this.m_strBefSkirtFileName, this.m_nBefSkirtRID, false, false);
- }
- }
- }
- else if (mp.idx == 68)
- {
- this.m_strBefSkirtFileName = filename;
- this.m_nBefSkirtRID = f_nFileNameRID;
- if (f_nFileNameRID != 0 && this.m_nBefOnepiceRID != 0)
- {
- this.m_nBefOnepiceRID = 0;
- if (this.m_nBefWearRID != 0)
- {
- this.SetProp(MPN.wear, this.m_strBefWearFileName, this.m_nBefWearRID, false, false);
- }
- }
- }
- }
- }
- 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,
- MPN.lip
- };
- 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;
- this.GetProp(MPN.nose).boDut = true;
- this.GetProp(MPN.facegloss).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,
- MPN.lip
- };
- 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;
- this.GetProp(MPN.nose).boDut = true;
- this.GetProp(MPN.facegloss).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 (Product.VBA && (mp.boTempDut || mp.boDut) && (mp.idx == 44 || mp.idx == 55 || mp.idx == 62 || mp.idx == 63 || mp.idx == 44 || mp.idx == 82 || mp.idx == 90 || mp.idx == 91 || mp.idx == 93))
- {
- mp.boDut = false;
- mp.boTempDut = false;
- }
- 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(1270);
- 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(1270);
- 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(1270);
- 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;
- }
- if (!this.boMAN && Product.VBA)
- {
- this.SetProp(MPN.bra, "bra030_i_.menu", 0, false, false);
- this.SetProp(MPN.panz, "Pants030_i_.menu", 0, false, false);
- }
- 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 void CacheAnime(string fn, bool loadMuneL = false, bool loadMuneR = false)
- {
- this.body0.CacheLoadAnime(GameUty.FileSystem, Path.ChangeExtension(fn, ".anm"), loadMuneL, loadMuneR);
- }
- 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 string m_strBefOnepiceFileName;
- private int m_nBefOnepiceRID;
- private string m_strBefWearFileName;
- private int m_nBefWearRID;
- private string m_strBefSkirtFileName;
- private int m_nBefSkirtRID;
- 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
- }
- }
|