CM3D2.XTMasterSlave.Plugin.cs 657 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920
  1. //#define COM3D2
  2. #define IK159
  3. #define COM3D2only
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Diagnostics;
  7. using System.Linq;
  8. using System.Reflection;
  9. using System.Text.RegularExpressions;
  10. //
  11. using UnityEngine;
  12. using UnityInjector.Attributes;
  13. using PluginExt;
  14. using CM3D2.XtMasterSlave.Plugin;
  15. using VYMModule;
  16. using ExtensionMethods;
  17. using static ExtensionMethods.MyExtensions;
  18. using static ExtensionMethods.ComExt;
  19. using System.IO;
  20. using UnityEngine.SceneManagement;
  21. // コンパイル用コマンド 同梱のbat参照 ※要VS2017(C#7.0)
  22. namespace CM3D2.XtMasterSlave.Plugin
  23. {
  24. #if COM3D2
  25. [PluginFilter("COM3D2x64"), PluginFilter("COM3D2OHx64"),
  26. PluginName("COM3D2.XtMasterSlave.Plugin"), PluginVersion("0.0.5.0")]
  27. #else
  28. [PluginFilter("CM3D2x64"), PluginFilter("CM3D2x86"), PluginFilter("CM3D2VRx64"),
  29. PluginFilter("CM3D2OHx64"), PluginFilter("CM3D2OHx86"), PluginFilter("CM3D2OHVRx64"),
  30. PluginName("CM3D2.XtMasterSlave.Plugin"), PluginVersion("0.0.5.0")]
  31. #endif
  32. public class XtMasterSlave : ExPluginBase
  33. {
  34. #region 定数宣言
  35. public readonly static string PLUGIN_NAME = "XtMasterSlave";
  36. public readonly static string PLUGIN_VERSION = "0.0.5.0";
  37. private const int WINID_COFIG = 99101;
  38. const string PluginCfgFN = "XtMasterSlave.ini";
  39. const string YotogiCfgFN = "XtMasterSlave_Yotogi.ini";
  40. public const int MAX_PAGENUM = 5;
  41. //private readonly float WaitForInitialize = 5.0f; // 初期化遅延秒数
  42. //private readonly float WaitMaidInfoFind = 3.0f; // メイド検索開始遅延秒数
  43. // 処理を行わないシーン
  44. // 1 メイド選択
  45. // 6 メーカーロゴ
  46. // 7 メイド管理
  47. // 9 タイトル
  48. // 13 起動時警告
  49. // 16 日付
  50. // 17 タイトルに戻る
  51. // 19 スタッフロール
  52. // 23 デスクトップカスタム
  53. private readonly static int[] cIgnoreSceneLevel = new int[] { 1, 6, 7, 9, 13, 16, 17, 19, 23 };
  54. private readonly static string[] MaskItems =
  55. {
  56. "accashi", "bra",
  57. "chikubi",
  58. "head",
  59. "accanl",
  60. "accsenaka",
  61. "accha",
  62. "acchana",
  63. "acchat",
  64. "acchead",
  65. "accheso",
  66. "accKami_1_",
  67. "accKami_2_",
  68. "accKami_3_",
  69. "accKamiSubR",
  70. "accKamiSubL",
  71. "acckubi",
  72. "acckubiwa",
  73. "accMiMiR",
  74. "accMiMiL",
  75. "accNipR",
  76. "accNipL",
  77. "onepiece",
  78. "accshippo",
  79. "acctatoo",
  80. "accude",
  81. "accvag",
  82. "accxxx",
  83. "bra",
  84. "glove",
  85. "headset",
  86. "kousoku",
  87. "megane",
  88. "mizugi",
  89. "moza",
  90. "wear",
  91. "panz",
  92. "shoes",
  93. "skirt",
  94. "stkg",
  95. "hairaho",
  96. "hairf",
  97. "hairr",
  98. "hairp",
  99. "hairs",
  100. "hairt",
  101. "underhair",
  102. };
  103. private readonly static string[] HiddenNode =
  104. {
  105. "Spine",
  106. "Clavicle",
  107. "Mune",
  108. "Pelvis",
  109. };
  110. #endregion
  111. #region 変数宣言・シーン
  112. //VYMより
  113. private static int vSceneLevel = 0;
  114. public static bool SceneLevelEnable = false;
  115. static bool bIsYotogiScene = false;
  116. public static bool maidActive = false;
  117. //private Maid maid;
  118. static bool bIsVymPlg = false;
  119. //static bool bVoicePlaying = false;
  120. //static bool bHitChkResized = false;
  121. //回想モード
  122. static bool vIsKaisouScene = false;
  123. static bool vacationEnabled = false;
  124. //脱衣設定
  125. public readonly static Dictionary<string, TBody.SlotID[]> dicMaskItems = new Dictionary<string, TBody.SlotID[]>
  126. {
  127. {"トップス/ワンピ", new TBody.SlotID[] { TBody.SlotID.wear,TBody.SlotID.onepiece } },
  128. {"水着", new TBody.SlotID[] { TBody.SlotID.mizugi } },
  129. {"スカート", new TBody.SlotID[] { TBody.SlotID.skirt } },
  130. {"ストッキング", new TBody.SlotID[] { TBody.SlotID.stkg } },
  131. {"ブラ", new TBody.SlotID[] { TBody.SlotID.bra } },
  132. {"パンツ", new TBody.SlotID[] { TBody.SlotID.panz } },
  133. {"グローブ", new TBody.SlotID[] { TBody.SlotID.glove } },
  134. {"シューズ", new TBody.SlotID[] { TBody.SlotID.shoes } },
  135. {"帽子/ヘッドセット", new TBody.SlotID[] { TBody.SlotID.accHat, TBody.SlotID.headset } },
  136. {"メガネ", new TBody.SlotID[] { TBody.SlotID.megane } },
  137. {"チョーカー", new TBody.SlotID[] { TBody.SlotID.accKubi } },
  138. {"首輪", new TBody.SlotID[] { TBody.SlotID.accKubiwa } },
  139. {"アクセ鼻", new TBody.SlotID[] { TBody.SlotID.accHana } },
  140. {"アクセ耳", new TBody.SlotID[] { TBody.SlotID.accMiMiL, TBody.SlotID.accMiMiR } },
  141. {"アクセ腕", new TBody.SlotID[] { TBody.SlotID.accUde } },
  142. {"アクセ足", new TBody.SlotID[] { TBody.SlotID.accAshi } },
  143. {"へそ", new TBody.SlotID[] { TBody.SlotID.accHeso } },
  144. {"前穴", new TBody.SlotID[] { TBody.SlotID.accXXX } },
  145. {"背中", new TBody.SlotID[] { TBody.SlotID.accSenaka } },
  146. {"しっぽ", new TBody.SlotID[] { TBody.SlotID.accShippo } },
  147. };
  148. #endregion
  149. #region ギズモ関係
  150. /// <summary>
  151. /// 公式ギズモを使いやすくするためのクラス
  152. /// </summary>
  153. class OhMyGizmo : GizmoRender
  154. {
  155. public GameObject gameObject_ = null;
  156. public bool eDragUndo = false;
  157. FieldInfo _fi = null;
  158. FieldInfo _fi_beSelectedType = null;
  159. bool _isdrag_bk = false;
  160. //差分計算用
  161. public Vector3 _backup_pos = Vector3.zero;
  162. public Quaternion _backup_rot = Quaternion.identity;
  163. public Vector3 _backup_pos_u1 = Vector3.zero;
  164. public Quaternion _backup_rot_u1 = Quaternion.identity;
  165. public Vector3 _backup_posLocal_u1 = Vector3.zero;
  166. public Quaternion _backup_rotLocal_u1 = Quaternion.identity;
  167. //ギズモ位置
  168. public Vector3 position
  169. {
  170. get { return this.transform.position; }
  171. set { this.transform.position = value; }
  172. }
  173. //ギズモ回転
  174. public Quaternion rotation
  175. {
  176. get { return this.transform.rotation; }
  177. set { this.transform.rotation = value; }
  178. }
  179. //差分計算用
  180. public void BkupPos() { _backup_pos = this.position; }
  181. public void BkupRot() { _backup_rot = this.rotation; }
  182. public void BkupPosAndRot() { this.BkupPos(); this.BkupRot(); }
  183. //public void BkupPosAndRotLocal() { _backup_pos = this.transform.localPosition; _backup_rot = this.transform.localRotation; }
  184. public void BkupPosAndRotU1() { _backup_pos_u1 = this.transform.position; _backup_rot_u1 = this.transform.rotation; }
  185. public void BkupPosAndRotLocalU1() { _backup_posLocal_u1 = this.transform.localPosition; _backup_rotLocal_u1 = this.transform.localRotation; }
  186. //差分計算用
  187. public Vector3 _predrag_pos = Vector3.zero;
  188. public Quaternion _predrag_rot = Quaternion.identity;
  189. public bool _predrag_state = false;
  190. public override void Update()
  191. {
  192. bool dragnow = this.isDrag;
  193. if (dragnow != _predrag_state)
  194. {
  195. if (eDragUndo && !_predrag_state)
  196. {
  197. _predrag_pos = this.position;
  198. _predrag_rot = this.rotation;
  199. }
  200. _predrag_state = dragnow;
  201. }
  202. if (eDragUndo && dragnow)
  203. {
  204. if (this.isDragUndo)
  205. {
  206. //右クリックかESCでポジション復帰
  207. this.position = _predrag_pos;
  208. this.rotation = _predrag_rot;
  209. }
  210. }
  211. base.Update();
  212. }
  213. public bool isDragUndo
  214. {
  215. get
  216. {
  217. if (!_predrag_state)
  218. return false;
  219. return Input.GetMouseButton(1) || Input.GetKey(KeyCode.Escape);
  220. }
  221. }
  222. //ドラッグ判定、複数ギズモを表示中でも個別判定できるようにした
  223. public bool isDrag
  224. {
  225. get
  226. {
  227. if (!this.Visible)
  228. return false;
  229. if (_fi != null && _fi_beSelectedType != null)
  230. {
  231. object obj = _fi.GetValue(this);
  232. if (obj is bool && (bool)obj)
  233. {
  234. //ギズモをドラッグ中(どれかは不明)
  235. /*上手く行かないので没
  236. RaycastHit hit = new RaycastHit();
  237. Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
  238. if (Physics.Raycast(ray, out hit))
  239. {
  240. debugPrintConsole("hit: name:" + hit.collider.gameObject.name + " tag:" + hit.collider.gameObject.tag);
  241. if (hit.collider.gameObject.name == this.name)
  242. {
  243. }
  244. }*/
  245. object obj2 = _fi_beSelectedType.GetValue(this);
  246. if (obj2 is Enum && (int)obj2 != 0)
  247. {
  248. //GizmoRender.MOVETYPE.NONE以外ならこのギズモのどこかをドラッグ中
  249. return true;
  250. }
  251. }
  252. }
  253. return false;
  254. }
  255. }
  256. public void ClearSelectedType()
  257. {
  258. _fi_beSelectedType.SetValue(this, 0);
  259. }
  260. //ドラッグエンド判定用(変化を見るだけなので毎フレーム呼び出す必要あり)
  261. public bool isDragEnd
  262. {
  263. get
  264. {
  265. bool drag = this.isDrag;
  266. if (drag != _isdrag_bk)
  267. {
  268. _isdrag_bk = drag;
  269. if (drag == false)
  270. return true;
  271. }
  272. return false;
  273. }
  274. }
  275. public void DragBkup()
  276. {
  277. {
  278. _isdrag_bk = this.isDrag;
  279. }
  280. }
  281. public OhMyGizmo()
  282. {
  283. //beSelectedType
  284. if (_fi_beSelectedType == null)
  285. _fi_beSelectedType = typeof(GizmoRender).GetField("beSelectedType", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
  286. if (_fi == null)
  287. _fi = typeof(GizmoRender).GetField("is_drag_", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.DeclaredOnly);
  288. }
  289. /*
  290. private Vector3 lastpos_orobj_ = Vector3.zero;
  291. private Quaternion lastrot_orobj_ = Quaternion.identity;
  292. public override void OnRenderObject()
  293. {
  294. if (_predrag_state && Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
  295. {
  296. //shift+ドラッグで微調整
  297. Vector3 dv = this.position - lastpos_orobj_;
  298. dv *= 0.1f;
  299. this.position = lastpos_orobj_ + dv;
  300. this.rotation = Quaternion.Slerp(lastrot_orobj_, this.rotation, 0.1f);
  301. }
  302. lastpos_orobj_ = this.position;
  303. lastrot_orobj_ = this.rotation;
  304. base.OnRenderObject();
  305. }*/
  306. //ギズモ作成補助
  307. static public List<GameObject> _gameObjects_ = new List<GameObject>();
  308. static public OhMyGizmo AddGizmo(Transform parent_tr, string gizmo_name)
  309. {
  310. GameObject go = new GameObject();
  311. _gameObjects_.Add(go);
  312. go.transform.SetParent(parent_tr, true);
  313. go.name = gizmo_name;
  314. go.transform.localPosition = Vector3.zero;
  315. go.transform.localRotation = Quaternion.identity;
  316. GameObject go2 = new GameObject();
  317. go2.transform.SetParent(go.transform, true);
  318. go2.transform.localPosition = Vector3.zero;
  319. go2.transform.localRotation = Quaternion.identity;
  320. OhMyGizmo mg = go2.AddComponent<OhMyGizmo>();
  321. mg.gameObject_ = go2;
  322. //debugPrintConsole("test: " + (go != mg.gameObject));
  323. //mg.transform.SetParent(go.transform, false);
  324. mg.transform.parent = go2.transform;
  325. mg.name = gizmo_name + "_GR";
  326. return mg;
  327. }
  328. }
  329. static OhMyGizmo _Gizmo;
  330. //static OhMyGizmo _GizmoRot;
  331. static OhMyGizmo _Gizmo_HandR;
  332. static OhMyGizmo _Gizmo_HandL;
  333. #if DEBUG
  334. static OhMyGizmo _Gizmo_dbg;
  335. #endif
  336. Vector3 _gizmo_predrag_atcpos = Vector3.zero;
  337. Vector3 _gizmo_predrag_atcrot = Vector3.zero;
  338. static void GizmoVisible(bool visible)
  339. {
  340. _Gizmo.Visible = visible;
  341. }
  342. static void GizmoHsVisible(bool visible)
  343. {
  344. _Gizmo_HandR.Visible = visible;
  345. _Gizmo_HandL.Visible = visible;
  346. }
  347. static bool GetGizmoHsVisible()
  348. {
  349. if (_Gizmo_HandR.Visible || _Gizmo_HandL.Visible)
  350. return true;
  351. return false;
  352. }
  353. const float GIZMO_SLOWRATE = 0.2f;
  354. #endregion
  355. #region 設定ファイル定義
  356. // 設定クラス(Iniファイルで読み書きしたい変数はここに格納する)
  357. public class PluginConfig
  358. {
  359. // 一般設定
  360. public KeyCode hotkey_GUI = KeyCode.M; // プラグインの有効無効の切替キー
  361. public InputEx.ModifierKey hotkey_GUI_Modifier = InputEx.ModifierKey.Alt; // プラグインの有効無効の切替キー
  362. public float Scale_Min = 0.3f;
  363. public float Scale_Max = 2.0f;
  364. public bool boNameSelectAndLoad = true;
  365. public bool DlgShow_Hint001 = true;
  366. #if DEBUG
  367. public bool boMasterMotionLog = true;
  368. #else
  369. public bool boMasterMotionLog = false;
  370. #endif
  371. //無効シーン
  372. public int[] IgnoreSceneLevel = cIgnoreSceneLevel;
  373. public bool hideHitScaleDef = true;
  374. public bool doHitScaleDef = false;
  375. public float[] HitScaleDef = new float[(int)HitCheckTgt.Bip01 + 1] {
  376. 1f, 1f, 1f, 1f, 1f,
  377. };
  378. public bool AdjustBoneHitHeightY = true;
  379. // v0030
  380. public string[][] customNames = new string[][]
  381. {
  382. new string[] { VymModule.VoiceMode.カスタム1.ToString(), "カスタム1" },
  383. new string[] { VymModule.VoiceMode.カスタム2.ToString(), "カスタム2" },
  384. new string[] { VymModule.VoiceMode.カスタム3.ToString(), "カスタム3" },
  385. new string[] { VymModule.VoiceMode.カスタム4.ToString(), "カスタム4" },
  386. };
  387. //public bool HandIKsp_UseVechand = false; //IKフィードバック有無
  388. }
  389. public static PluginConfig cfg = new PluginConfig();
  390. public enum ATgtChar
  391. {
  392. None = 0,
  393. Self = 1,
  394. Master = 2,
  395. Maid0 = 3,
  396. Maid1 = 4,
  397. Maid2 = 5,
  398. Maid3 = 6,
  399. Maid4 = 7, // とりあえずスロット数と同じ5人まで
  400. }
  401. public bool ATgtStr_IsNullOrEmpty(string s)
  402. {
  403. if (string.IsNullOrEmpty(s))
  404. return true;
  405. if (s == "無し")
  406. return true;
  407. return false;
  408. }
  409. public class MsLinkConfig
  410. {
  411. //位置合わせ
  412. public bool doStackSlave = true;
  413. public bool doStackSlave_Pelvis = false;
  414. public bool doStackSlave_CliCnk = true;
  415. public float[] v3StackOffsetFA = new float[] { 0, 0, 0 };
  416. public float[] v3StackOffsetRotFA = new float[] { 0, 0, 0 };
  417. public float[] v3HandROffsetFA = new float[] { 0, 0, 0 };
  418. public float[] v3HandLOffsetFA = new float[] { 0, 0, 0 };
  419. public float[] v3HandROffsetRotFA = new float[] { 0, 0, 0 };
  420. public float[] v3HandLOffsetRotFA = new float[] { 0, 0, 0 };
  421. public float[][] customHandRfa = new float[2][] { new float[] { 0, 0, 0 }, new float[] { 0, 0, 0 } };
  422. public float[][] customHandLfa = new float[2][] { new float[] { 0, 0, 0 }, new float[] { 0, 0, 0 } };
  423. //位置調整のみ
  424. public bool doStackSlave_PosSyncMode = false;
  425. public bool doStackSlave_PosSyncModeV2 = false; //基準を原点に
  426. public bool doStackSlave_PosSyncModeSp = false; //アタッチ先を任意ボーン
  427. public string doStackSlave_PosSyncModeSp_TgtBone = string.Empty; //アタッチ先を任意ボーン
  428. //IK
  429. public bool doCopyIKTarget = true;
  430. public bool doIKTargetMHand = true;
  431. public bool doIKTargetMHandSpCustom = false; // アタッチ先変更
  432. public bool doIKTargetMHandSpCustom_v2 = true; // v5.0 アタッチ先変更2(角度指定バージョン2)
  433. public bool chkIkSpCustomR_v2()
  434. {
  435. return doIKTargetMHandSpCustom && doIKTargetMHandSpCustom_v2 && doIKTargetMHandSpR_TgtChar != ATgtChar.None;
  436. }
  437. public bool chkIkSpCustomL_v2()
  438. {
  439. return doIKTargetMHandSpCustom && doIKTargetMHandSpCustom_v2 && doIKTargetMHandSpL_TgtChar != ATgtChar.None;
  440. }
  441. public ATgtChar doIKTargetMHandSpR_TgtChar = ATgtChar.None;
  442. public ATgtChar doIKTargetMHandSpL_TgtChar = ATgtChar.None;
  443. public string doIKTargetMHandSpR_TgtBone = string.Empty;
  444. public string doIKTargetMHandSpL_TgtBone = string.Empty;
  445. public bool doIKTargetMHandSpCustomAltRotR = true; // アタッチポイントとの相対角度 v5.0でtrueに
  446. public bool doIKTargetMHandSpCustomAltRotL = true; // アタッチポイントとの相対角度 v5.0でtrueに
  447. // v0026
  448. public bool doIK159NewPointToDef = false; //v5.0ギリギリ使えるレベルに //v4.0β※com1.17で不具合が出る true; // 159以降の新IKをデフォルトに使うか
  449. public bool doIK159RotateToHands = true; // 159以降のRotateIKを両手にアタッチに使うか
  450. // v5.0
  451. public bool doFinalIKShoulderMove = false; // 肩位置への影響
  452. public bool doFinalIKThighMove = false; // もも位置への影響
  453. public float fFinalIKLegWeight = 1f; // 足への影響
  454. // 手のブレンド v0030
  455. public bool doBlendHandR = false;
  456. public bool doBlendHandL = false;
  457. public float fBlendHandROpen = 0f;
  458. public float fBlendHandLOpen = 0f;
  459. public float fBlendHandRGrip = 0f;
  460. public float fBlendHandLGrip = 0f;
  461. public float fBlendHandR = 0f;
  462. public float fBlendHandL = 0f;
  463. public bool doAnimeHandR = false;
  464. public bool doAnimeHandL = false;
  465. public float fAnimeHandRMove = 0f;
  466. public float fAnimeHandLMove = 0f;
  467. public float fAnimeHandRSpeed = 0f;
  468. public float fAnimeHandLSpeed = 0f;
  469. // 絶頂痙攣β v0030
  470. public bool doZecchoKeiren = true;
  471. public float fZecchoKeirenParam = 0.06f;
  472. //表情同期
  473. public bool doFaceSync = false;
  474. public bool doVoiceAndFacePlay = true;
  475. #if COM3D2
  476. public bool doVoiceDisabled = false; // 新性格に未対応 -> v5.0で変更
  477. #else
  478. public bool doVoiceDisabled = false;
  479. #endif
  480. //VYM連動設定
  481. public bool doVoiceAndFacePlayOnVYM = true;
  482. public bool doVoiceAndFacePlayOnVYM_Zeccho = false; //絶頂同期
  483. //マニュアルモード
  484. public bool doManualVfPlay = false;
  485. //マニュアルモード用
  486. public int manuVf_iExcite = 0;
  487. public int manuVf_mState = 10;
  488. public int manuVf_mOrgcmb = -1;
  489. //夜伽モードでSlaveを維持
  490. public bool doKeepSlaveYotogi = true;
  491. //ヒットチェックスケール
  492. public float Scale_HitCheckEffect = 1f;
  493. public bool Scale_HitCheckDetail = true;
  494. public float Scale_HitCheckDetail_Momo = 1f;
  495. public float Scale_HitCheckDetail_Thigh = 1f;
  496. public float Scale_HitCheckDetail_Hip = 1f;
  497. public float Scale_HitCheckDetail_Spine = 1f;
  498. public float Scale_HitCheckDetail_Bip01 = 1f;
  499. public bool Adjust_doHitHeightYOffset = false;
  500. public float Adjust_HitHeightYOffset = 0f;
  501. public ref float GetHitDetail(HitCheckTgt h)
  502. {
  503. switch (h)
  504. {
  505. case HitCheckTgt.Hip:
  506. return ref this.Scale_HitCheckDetail_Hip;
  507. case HitCheckTgt.Momo:
  508. return ref this.Scale_HitCheckDetail_Momo;
  509. case HitCheckTgt.Spine:
  510. return ref this.Scale_HitCheckDetail_Spine;
  511. case HitCheckTgt.Thigh:
  512. return ref this.Scale_HitCheckDetail_Thigh;
  513. default:
  514. return ref this.Scale_HitCheckDetail_Bip01;
  515. }
  516. }
  517. }
  518. public static MsLinkConfig[] cfgs = new MsLinkConfig[MAX_PAGENUM] { new MsLinkConfig(), new MsLinkConfig(), new MsLinkConfig(), new MsLinkConfig(), new MsLinkConfig() };
  519. public class PosRot
  520. {
  521. public Vector3 pos;
  522. public Vector3 rot;
  523. public PosRot()
  524. {
  525. pos = Vector3.zero;
  526. rot = Vector3.zero;
  527. }
  528. public PosRot(Vector3 position, Quaternion rotation)
  529. {
  530. pos = position;
  531. rot = rotation.eulerAngles;
  532. }
  533. public PosRot(float[][] faa) : this()
  534. {
  535. if (faa.Length == 2)
  536. {
  537. pos = faTov3(faa[0]);
  538. rot = faTov3(faa[1]);
  539. }
  540. }
  541. public float[][] ToFloatArray()
  542. {
  543. float[][] faa = new float[2][];
  544. faa[0] = v3Tofa(pos);
  545. faa[1] = v3Tofa(rot);
  546. return faa;
  547. }
  548. public float[] PosFA()
  549. {
  550. return v3Tofa(pos);
  551. }
  552. public float[] RotFA()
  553. {
  554. return v3Tofa(rot);
  555. }
  556. }
  557. public class v3OffsetsV2
  558. {
  559. v3Offsets v3o;
  560. public bool isV2 { get; private set; }
  561. public v3OffsetsV2(v3Offsets v3o, MsLinkConfig cfg)
  562. {
  563. this.v3o = v3o;
  564. this.isV2 = cfg.doIKTargetMHandSpCustom_v2;
  565. }
  566. public v3OffsetsV2(v3Offsets v3o, bool useV2)
  567. {
  568. this.v3o = v3o;
  569. this.isV2 = useV2;
  570. }
  571. public Vector3 v3StackOffset { get { return v3o.v3StackOffset; } set { v3o.v3StackOffset = value; } }
  572. public Vector3 v3StackOffsetRot { get { return v3o.v3StackOffsetRot; } set { v3o.v3StackOffsetRot = value; } }
  573. public Vector3 v3HandROffset
  574. {
  575. get { return !isV2 ? v3o.v3HandROffset : v3o.customHandR.pos; }
  576. set {
  577. if (!isV2) v3o.v3HandROffset = value;
  578. else v3o.customHandR.pos = value;
  579. }
  580. }
  581. public Vector3 v3HandLOffset
  582. {
  583. get { return !isV2 ? v3o.v3HandLOffset : v3o.customHandL.pos; }
  584. set {
  585. if (!isV2) v3o.v3HandLOffset = value;
  586. else v3o.customHandL.pos = value;
  587. }
  588. }
  589. public Vector3 v3HandROffsetRot
  590. {
  591. get { return !isV2 ? v3o.v3HandROffsetRot : v3o.customHandR.rot; }
  592. set {
  593. if (!isV2) v3o.v3HandROffsetRot = value;
  594. else v3o.customHandR.rot = value;
  595. }
  596. }
  597. public Vector3 v3HandLOffsetRot
  598. {
  599. get { return !isV2 ? v3o.v3HandLOffsetRot : v3o.customHandL.rot; }
  600. set {
  601. if (!isV2) v3o.v3HandLOffsetRot = value;
  602. else v3o.customHandL.rot = value;
  603. }
  604. }
  605. }
  606. public class v3Offsets
  607. {
  608. public Vector3 v3StackOffset = Vector3.zero;
  609. public Vector3 v3StackOffsetRot = Vector3.zero;
  610. public Vector3 v3HandROffset = Vector3.zero;
  611. public Vector3 v3HandLOffset = Vector3.zero;
  612. public Vector3 v3HandROffsetRot = Vector3.zero;
  613. public Vector3 v3HandLOffsetRot = Vector3.zero;
  614. public PosRot customHandR = new PosRot();
  615. public PosRot customHandL = new PosRot();
  616. /*
  617. public ref Vector3 refCustomRHpos(MsLinkConfig cfg)
  618. {
  619. if (cfg.doIKTargetMHandSpCustom_v2)
  620. {
  621. return ref customHandR.pos;
  622. }
  623. return ref v3HandROffset;
  624. }
  625. public ref Vector3 refCustomLHpos(MsLinkConfig cfg)
  626. {
  627. if (cfg.doIKTargetMHandSpCustom_v2)
  628. {
  629. return ref customHandL.pos;
  630. }
  631. return ref v3HandLOffset;
  632. }
  633. public ref Vector3 refCustomRHrot(MsLinkConfig cfg)
  634. {
  635. if (cfg.doIKTargetMHandSpCustom_v2)
  636. {
  637. return ref customHandR.rot;
  638. }
  639. return ref v3HandROffsetRot;
  640. }
  641. public ref Vector3 refCustomLHrot(MsLinkConfig cfg)
  642. {
  643. if (cfg.doIKTargetMHandSpCustom_v2)
  644. {
  645. return ref customHandL.rot;
  646. }
  647. return ref v3HandLOffsetRot;
  648. }
  649. */
  650. #if DEBUG
  651. private Vector3 old = Vector3.zero;
  652. #endif
  653. #if test
  654. public Vector3 v3StackOffset2Bip(Maid slave, bool trans)
  655. {
  656. //return Quaternion.Inverse(Quaternion.Euler(0, -90, -90)) * v3StackOffset;
  657. if (!trans)
  658. return v3StackOffset;
  659. var bp = _Gizmo.transform.position;
  660. var br = _Gizmo.transform.rotation;
  661. var sTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip"), true);
  662. _Gizmo.transform.position = sTr.position;
  663. _Gizmo.transform.rotation = sTr.rotation;
  664. _Gizmo.transform.rotation *= Quaternion.Euler(0, -90, -90);
  665. //var gv = _Gizmo.transform.TransformDirection(_Gizmo.transform.localRotation * v3StackOffset);
  666. //_Gizmo.transform.localPosition += _Gizmo.transform.localRotation * v3StackOffset;
  667. _Gizmo.transform.position += _Gizmo.transform.TransformDirection(v3StackOffset);
  668. #if false//DEBUG
  669. if (old != _Gizmo.transform.position)
  670. {
  671. old = _Gizmo.transform.position;
  672. debugPrintConsole("g_ pos: " + _Gizmo.transform.position + " dv: " + v3StackOffset + " lr: " + _Gizmo.transform.localRotation.eulerAngles.ToString());
  673. }
  674. #endif
  675. var dv = _Gizmo.transform.position - sTr.position;
  676. _Gizmo.transform.position = bp;
  677. _Gizmo.transform.rotation = br;
  678. //return sTr.InverseTransformDirection(dv);
  679. return dv;
  680. }
  681. #endif
  682. }
  683. public static v3Offsets[] v3ofs = new v3Offsets[MAX_PAGENUM] { new v3Offsets(), new v3Offsets(), new v3Offsets(), new v3Offsets(), new v3Offsets() };
  684. public class YotogiConfig
  685. {
  686. //絶頂判定用
  687. public string[] sMensZeccyouMotion = { /*"_zeccyou_m_once_",*/ "_shasei_naka_m_once_", "_shasei_soto_m_once_", "_shasei_kao_", "_shasei_kuti_", "2ana_shasei_.*_m2" }; /*"_seikantaizeccyou_m_once_",*/
  688. public string[] sMensZeccyouAfterMotion = { "_zeccyougo_m", "_shaseigo_naka_m", "_shaseigo_soto_m", "shaseigo" };
  689. public string[] sMensSexMotion = new string[] { "seijyoui_", "kouhaii_", "sokui_", "kijyoui_", "haimen_", "ekiben_", "sex_", "manguri_", "ritui_",
  690. "seijyouia_", "kouhaiia_", "sokuia_", "kijyouia_", "haimena_", "ekibena_", "sexa_", "manguria_", "rituia_", "ran3p_2ana", "ran4p_", "taimenkijyoui" };
  691. public string[] sMensKissMotion = new string[] { "sixnine", "^(?!.*fera).*kiss.*(?!.*fera)", "kunni", };
  692. public string[] sMensUkeMotion = new string[] { "fera", "_ir_", "siriname", "tikubiname", "tekoki", "paizuri", "kijyoui", "ran3p_housi", "harem_housi", "mp_arai_", "asikoki_" }; //_ir_イラマ
  693. public string[] sMensTaikiMotion = new string[] { "_taiki", "tekoki_nade" };
  694. public string[] sMensKousokuMotion = new string[] { "muri_3p_.*_m2", };
  695. public string[] sMensSemeMotion = new string[] { "_aibu_", };
  696. //モーションカテゴリ別レベルシフター
  697. public Dictionary<string, int> MotionEffect_ExciteLevelSift = new Dictionary<string, int>
  698. {
  699. {XtMasterSlave.AnimeState.State.none.ToString(), -2 },
  700. {XtMasterSlave.AnimeState.State.taiki.ToString(), -3 },
  701. {XtMasterSlave.AnimeState.State.kiss.ToString(), 0 },
  702. {XtMasterSlave.AnimeState.State.uke.ToString(), 0 },
  703. {XtMasterSlave.AnimeState.State.sex.ToString(), -1 },
  704. {XtMasterSlave.AnimeState.State.zeccho.ToString(), 0 },
  705. {XtMasterSlave.AnimeState.State.kousoku.ToString(), -3 },
  706. {XtMasterSlave.AnimeState.State.seme.ToString(), -2 },
  707. };
  708. //モーションカテゴリ別状態スイッチ 0で変更なし=興奮度によって切換え
  709. public Dictionary<string, int> MotionEffect_StateMajorSwitch = new Dictionary<string, int>
  710. {
  711. {XtMasterSlave.AnimeState.State.none.ToString(), 40 },
  712. {XtMasterSlave.AnimeState.State.taiki.ToString(), 10 },
  713. {XtMasterSlave.AnimeState.State.kiss.ToString(), 0 },
  714. {XtMasterSlave.AnimeState.State.uke.ToString(), 30 },
  715. {XtMasterSlave.AnimeState.State.sex.ToString(), 0 },
  716. {XtMasterSlave.AnimeState.State.zeccho.ToString(), 30 },
  717. {XtMasterSlave.AnimeState.State.yoin.ToString(), 40 },
  718. {XtMasterSlave.AnimeState.State.kousoku.ToString(), 10 },
  719. {XtMasterSlave.AnimeState.State.seme.ToString(), 40 },
  720. };
  721. }
  722. public static YotogiConfig ycfg = new YotogiConfig();
  723. #endregion
  724. #region 汎用クラス&メソッド
  725. static Vector3 v3limit(Vector3 v, float limit)
  726. {
  727. v.x = v.x > limit ? limit : v.x;
  728. v.y = v.y > limit ? limit : v.y;
  729. v.z = v.z > limit ? limit : v.z;
  730. v.x = v.x < -limit ? -limit : v.x;
  731. v.y = v.y < -limit ? -limit : v.y;
  732. v.z = v.z < -limit ? -limit : v.z;
  733. return v;
  734. }
  735. static int obj2int(object obj)
  736. {
  737. try
  738. {
  739. if (obj is int) return (int)obj;
  740. }
  741. catch { }
  742. return -1;
  743. }
  744. // TBody
  745. //public void ManColorUpdate(Maid man, int manAlpha)
  746. public static void SetManAlpha(Maid man, float manAlpha)
  747. {
  748. if (man.boMAN)
  749. {
  750. for (int i = 0; i < man.body0.goSlot.Count; i++)
  751. {
  752. TBodySkin tBodySkin = man.body0.goSlot[i];
  753. if (tBodySkin != null)
  754. {
  755. ManColorUpdate(tBodySkin, manAlpha);
  756. }
  757. }
  758. }
  759. }
  760. static FieldInfo fiml_ = typeof(TBodySkin).GetField("m_listManAlphaMat", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
  761. // TBodySkin
  762. public static void ManColorUpdate(TBodySkin tbs, float manAlpha)
  763. {
  764. var m_listManAlphaMat = fiml_.GetValue(tbs) as List<Material>;
  765. if (m_listManAlphaMat == null)
  766. {
  767. Console.WriteLine("m_listManAlphaMat取得エラー");
  768. return;
  769. }
  770. for (int i = 0; i < m_listManAlphaMat.Count; i++)
  771. {
  772. Material material = m_listManAlphaMat[i];
  773. //material.SetFloat("_FloatValue2", (float)GameMain.Instance.CMSystem.ManAlpha / 100f);
  774. //material.SetFloat("_FloatValue2", (float)manAlpha / 100f);
  775. material.SetFloat("_FloatValue2", manAlpha / 100f);
  776. //material.SetColor("_Color", tbs.body.maid.ManColor);
  777. }
  778. }
  779. public static float GetManAlpha(Maid man)
  780. {
  781. if (man.boMAN)
  782. {
  783. for (int i = 0; i < man.body0.goSlot.Count; i++)
  784. {
  785. TBodySkin tBodySkin = man.body0.goSlot[i];
  786. if (tBodySkin != null)
  787. {
  788. float a = GetManAlpha(tBodySkin);
  789. if (a >= 0)
  790. return a;
  791. }
  792. }
  793. }
  794. return GameMain.Instance.CMSystem.ManAlpha;
  795. }
  796. public static float GetManAlpha(TBodySkin tbs)
  797. {
  798. List<Material> m_listManAlphaMat = fiml_.GetValue(tbs) as List<Material>;
  799. if (m_listManAlphaMat == null)
  800. {
  801. Console.WriteLine("m_listManAlphaMat取得エラー");
  802. return -1;
  803. }
  804. for (int j = 0; j < m_listManAlphaMat.Count; j++)
  805. {
  806. Material material = m_listManAlphaMat[j];
  807. //material.SetFloat("_FloatValue2", (float)GameMain.Instance.CMSystem.ManAlpha / 100f);
  808. //material.SetFloat("_FloatValue2", (float)manAlpha / 100f);
  809. //material.SetColor("_Color", tbs.body.maid.ManColor);
  810. float a = (material.GetFloat("_FloatValue2") * 100f);
  811. if (a < 0)
  812. continue;
  813. return a;
  814. }
  815. return -1;
  816. }
  817. // TBodyより改造
  818. //static Dictionary<Maid, bool[]> boVisibleBkup = new Dictionary<Maid, bool[]>();
  819. static HashSet<Maid> maskedMaids = new HashSet<Maid>();
  820. static void MaskItemsAll(Maid m)
  821. {
  822. if (m.boMAN || m.IsBusy)
  823. return;
  824. //足首スロットで操作するために一時アイテムセット
  825. m.SetProp(MPN.accashi, "_I_accashi_del.menu", "_I_accashi_del.menu".ToLower().GetHashCode(), true);
  826. m.AllProcProp();
  827. maskedMaids.Add(m);
  828. //boVisibleBkup[m] = new bool[m.body0.goSlot.Count+]
  829. for (int i = 0; i < m.body0.goSlot.Count; i++)
  830. {
  831. m.body0.goSlot[i].boVisible = false;
  832. }
  833. m.body0.boVisible_NIP = false;
  834. m.body0.boVisible_HESO = false;
  835. m.body0.boVisible_XXX = false;
  836. m.body0.boVisible_BRA = false;
  837. m.body0.boVisible_PANZU = false;
  838. m.body0.boVisible_SKIRT = false;
  839. m.body0.boVisible_WEAR = false;
  840. m.body0.boMizugi_panz = false;
  841. //m.body0.slotno_accXXX = (int)TBody.hashSlotName["accXXX"];
  842. //消去ノード
  843. foreach (var s in HiddenNode)
  844. m.body0.goSlot[(int)TBody.SlotID.accAshi].SetVisibleFlag(false, s, m.body0.goSlot[0].obj_tr, false);
  845. m.body0.FixVisibleFlag(false);
  846. m.AllProcProp();
  847. }
  848. static void ResetMaskItemsAll(Maid m)
  849. {
  850. if (m.boMAN || m.IsBusy)
  851. return;
  852. MaidProp mp = m.GetProp(MPN.accashi);
  853. if (mp.boTempDut)
  854. {
  855. mp.boDut = true;
  856. mp.boTempDut = false;
  857. }
  858. m.ResetProp(MPN.accashi, true);
  859. if (maskedMaids.Contains(m))
  860. maskedMaids.Remove(m);
  861. m.body0.FixMaskFlag();
  862. m.body0.FixVisibleFlag(false);
  863. m.AllProcProp();
  864. }
  865. public static void SetStateMaskItemsAll(Maid m, bool mask)
  866. {
  867. if (mask)
  868. {
  869. MaskItemsAll(m);
  870. }
  871. else
  872. {
  873. ResetMaskItemsAll(m);
  874. }
  875. }
  876. public static bool GetStateMaskItemsAll(Maid m)
  877. {
  878. return maskedMaids.Contains(m);
  879. }
  880. // ヒットチェックのスケーリングが必要かの判定(本体1.54未満?)
  881. static bool NeedHitScaleCalc = typeof(TBodySkin).GetField("m_trMaid", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly) == null;
  882. public static void UpdateHitScale(Maid maid, float bodyScale, float scale)
  883. {
  884. if (!NeedHitScaleCalc)
  885. {
  886. bodyScale = 1f; //公式側対応済み
  887. }
  888. UpdateHitScale_(maid, scale * bodyScale);
  889. }
  890. static HashSet<Maid> HitScaleChangedMaids = new HashSet<Maid>();
  891. public static void UpdateHitScale_(Maid maid, float scale)
  892. {
  893. TBody body = maid.body0;
  894. if (scale != 1)
  895. {
  896. HitScaleChangedMaids.Add(maid);
  897. }
  898. else //if (HitScaleChangedMaids.Contains(maid))
  899. {
  900. HitScaleChangedMaids.Remove(maid);
  901. }
  902. for (int n = 0; n < body.goSlot.Count; n++)
  903. {
  904. var s = body.goSlot[n];
  905. if (s != null)
  906. {
  907. if (s.bonehair != null && s.bonehair.bodyhit != null)
  908. {
  909. PreUpdateSc(s.bonehair.bodyhit, scale);
  910. }
  911. }
  912. }
  913. UpdateHitScale_boneh2(maid, scale, scale);
  914. UpdateHitScale_boneh3(maid, scale, scale, scale);
  915. }
  916. // CM3D2.hitCheckResize.Managed.hitCheckResizeManagedより改造
  917. public static void PreUpdateSc(TBodyHit tbh, float scale)
  918. {
  919. for (int i = 0; i < tbh.spherelist.Count; i++)
  920. {
  921. //tbh.spherelist[i].wv_old = tbh.spherelist[i].wv;
  922. //Vector3 wv = tbh.spherelist[i].t.TransformPoint(tbh.spherelist[i].vs);
  923. //tbh.spherelist[i].wv = wv;
  924. Transform t = tbh.spherelist[i].t;
  925. //float num = Mathf.Pow(t.lossyScale.x * t.lossyScale.y * t.lossyScale.z, 0.333333343f);
  926. /*float num = (t.lossyScale.x + t.lossyScale.y + t.lossyScale.z) / 3f;
  927. bool flag = tbh.spherelist[i].pname == "Bip01 Spine0a";
  928. if (flag)
  929. {
  930. tbh.spherelist[i].len = tbh.spherelist[i].len_ * 0.1f;
  931. }
  932. else
  933. {
  934. tbh.spherelist[i].len = tbh.spherelist[i].len_ * num;
  935. }*/
  936. #if DEBUG
  937. if (UnityEngine.Input.GetKey(KeyCode.H) && true)
  938. {
  939. Console.WriteLine(tbh.spherelist[i].pname + " " + tbh.spherelist[i].len / tbh.spherelist[i].len_);
  940. }
  941. #endif
  942. tbh.spherelist[i].len = tbh.spherelist[i].len_ * scale;
  943. tbh.spherelist[i].lenxlen = tbh.spherelist[i].len * tbh.spherelist[i].len;
  944. #if COM3D2
  945. if (tbh.spherelist[i].tPtr != null)
  946. tbh.spherelist[i].tPtr.localScale = new Vector3(tbh.spherelist[i].len, tbh.spherelist[i].tPtr.localScale.y, tbh.spherelist[i].tPtr.localScale.z);
  947. #endif
  948. #if false
  949. if (UnityEngine.Input.GetKey(KeyCode.H))
  950. {
  951. Console.WriteLine(tbh.spherelist[i].pname);
  952. }
  953. #endif
  954. }
  955. }
  956. /*デフォルト
  957. momotwist2_R 1
  958. momotwist2_L 1
  959. momotwist2_R 1
  960. momotwist2_L 1
  961. momotwist2_R 1
  962. momotwist2_L 1
  963. Bip01 R Thigh 1
  964. Bip01 L Thigh 1
  965. Bip01 R Thigh 1
  966. Bip01 L Thigh 1
  967. Hip_R 1
  968. Hip_L 1
  969. Bip01 Spine0a 1
  970. Bip01 1
  971. */
  972. public enum HitCheckTgt
  973. {
  974. Momo = 0,
  975. Thigh = 1,
  976. Hip = 2,
  977. Spine = 3,
  978. Bip01 = 4, //最後にすること
  979. }
  980. public readonly static Dictionary<HitCheckTgt, string> HitCheckTgtStr = new Dictionary<HitCheckTgt, string>
  981. {
  982. { HitCheckTgt.Momo, "momotwist" },
  983. { HitCheckTgt.Thigh, "Thigh" },
  984. { HitCheckTgt.Hip, "Hip" },
  985. { HitCheckTgt.Spine, "Spine" },
  986. { HitCheckTgt.Bip01, "絶対ヒットさせない文字列はこちら" },
  987. };
  988. public static void UpdateHitScale(Maid maid, float bodyScale, MsLinkConfig mcfg)
  989. {
  990. if (!NeedHitScaleCalc)
  991. {
  992. bodyScale = 1f; //公式側対応済み
  993. }
  994. TBody body = maid.body0;
  995. if (!mcfg.Scale_HitCheckDetail)
  996. {
  997. UpdateHitScale_(maid, mcfg.Scale_HitCheckEffect * bodyScale);
  998. return;
  999. }
  1000. Dictionary<HitCheckTgt, float> hcscs = new Dictionary<HitCheckTgt, float>
  1001. {
  1002. { HitCheckTgt.Momo, mcfg.Scale_HitCheckDetail_Momo * bodyScale },
  1003. { HitCheckTgt.Thigh, mcfg.Scale_HitCheckDetail_Thigh * bodyScale },
  1004. { HitCheckTgt.Hip, mcfg.Scale_HitCheckDetail_Hip * bodyScale },
  1005. { HitCheckTgt.Spine, mcfg.Scale_HitCheckDetail_Spine * bodyScale },
  1006. { HitCheckTgt.Bip01, mcfg.Scale_HitCheckDetail_Bip01 * bodyScale },
  1007. };
  1008. UpdateHitScale_2(maid, hcscs);
  1009. UpdateHitScale_boneh2(maid, mcfg.Scale_HitCheckDetail_Bip01, mcfg.Scale_HitCheckDetail_Spine);
  1010. UpdateHitScale_boneh3(maid, mcfg.Scale_HitCheckDetail_Thigh, mcfg.Scale_HitCheckDetail_Hip, mcfg.Scale_HitCheckDetail_Momo);
  1011. }
  1012. public static void UpdateHitScaleDef(Maid maid, float bodyScale, float[] scales, bool needUpdate)
  1013. {
  1014. float scale = 1f;
  1015. foreach (var v in scales)
  1016. {
  1017. scale *= v;
  1018. }
  1019. if (scale == 1)
  1020. {
  1021. return; //不要
  1022. }
  1023. if (HitScaleChangedMaids.Contains(maid) && !needUpdate)
  1024. {
  1025. return; //変更済み
  1026. }
  1027. Dictionary<HitCheckTgt, float> hcscs = new Dictionary<HitCheckTgt, float>();
  1028. foreach (var v in HitCheckTgtStr)
  1029. {
  1030. hcscs.Add(v.Key, scales[(int)v.Key]);
  1031. }
  1032. UpdateHitScale_2(maid, hcscs);
  1033. UpdateHitScale_boneh2(maid, 1f, 1f);
  1034. UpdateHitScale_boneh3(maid, 1f, 1f, 1f);
  1035. }
  1036. private static Dictionary<object, float> listScaleBkup = new Dictionary<object, float>();
  1037. public static void UpdateHitScale_boneh2(Maid maid, float scale, float scaleMune)
  1038. {
  1039. #if COM3D2
  1040. TBody body = maid.body0;
  1041. for (int n = 0; n < body.goSlot.Count; n++)
  1042. {
  1043. var s = body.goSlot[n];
  1044. if (s != null)
  1045. {
  1046. if (s.bonehair2 != null)
  1047. {
  1048. List<DynamicBoneColliderBase> list;
  1049. if (IkXT.IsIkCtrlO132)
  1050. {
  1051. var db = s.bonehair2.GetType()
  1052. .GetField("m_db", BindingFlags.NonPublic | BindingFlags.Instance)
  1053. .GetValue(s.bonehair2) as DynamicBone;
  1054. if (db == null)
  1055. return;
  1056. list = db.m_Colliders;
  1057. }
  1058. else
  1059. list = s.bonehair2.GetType().GetField("m_listCollders", BindingFlags.NonPublic | BindingFlags.Instance)
  1060. .GetValue(s.bonehair2) as List<DynamicBoneColliderBase>;
  1061. if (list != null)
  1062. {
  1063. foreach (var c in list)
  1064. {
  1065. if (c.TypeName == "dbc")
  1066. {
  1067. //var dbc = (DynamicBoneCollider)c;
  1068. var sc = c.transform.localScale;
  1069. if (!listScaleBkup.ContainsKey(c))
  1070. {
  1071. //listScaleBkup.Add(c, dbc.m_Radius);
  1072. listScaleBkup.Add(c, sc.x);
  1073. }
  1074. //dbc.m_Radius = listScaleBkup[dbc] * scale;
  1075. c.transform.localScale = new Vector3(listScaleBkup[c] * scale, sc.y, sc.z);
  1076. if (scale == 1)
  1077. {
  1078. listScaleBkup.Remove(c);
  1079. }
  1080. }
  1081. else if (c.TypeName == "dbm")
  1082. {
  1083. var dbm = (DynamicBoneMuneCollider)c;
  1084. var sc = c.transform.localScale;
  1085. if (!listScaleBkup.ContainsKey(c))
  1086. {
  1087. //listScaleBkup.Add(c, dbm.m_Radius);
  1088. listScaleBkup.Add(c, sc.x);
  1089. }
  1090. //dbm.m_Radius = listScaleBkup[dbm] * scaleMune;
  1091. c.transform.localScale = new Vector3(listScaleBkup[c] * scaleMune, sc.y, sc.z);
  1092. if (scaleMune == 1)
  1093. {
  1094. listScaleBkup.Remove(c);
  1095. }
  1096. }
  1097. }
  1098. }
  1099. }
  1100. }
  1101. }
  1102. #endif
  1103. }
  1104. public static void UpdateHitScale_boneh3(Maid maid, float scaleReg, float scaleHip, float scaleVag)
  1105. {
  1106. #if COM3D2
  1107. TBody body = maid.body0;
  1108. for (int n = 0; n < body.goSlot.Count; n++)
  1109. {
  1110. var s = body.goSlot[n];
  1111. if (s != null)
  1112. {
  1113. if (s.bonehair3 != null)
  1114. {
  1115. DynamicSkirtBone bone = s.bonehair3.GetType().GetField("m_SkirtBone", BindingFlags.NonPublic | BindingFlags.Instance)
  1116. .GetValue(s.bonehair3) as DynamicSkirtBone;
  1117. if (bone)
  1118. bone.m_fRegDefaultRadius = 0.1f * scaleReg;
  1119. }
  1120. }
  1121. }
  1122. var objHit = FindChild(maid.body0.Pelvis.gameObject, "Hit_HipL");
  1123. if (objHit)
  1124. {
  1125. objHit.GetComponentInChildren<DynamicBoneCollider>().m_Radius = 0.09f * scaleHip;
  1126. }
  1127. objHit = FindChild(maid.body0.Pelvis.gameObject, "Hit_HipR");
  1128. if (objHit)
  1129. {
  1130. objHit.GetComponentInChildren<DynamicBoneCollider>().m_Radius = 0.09f * scaleHip;
  1131. }
  1132. objHit = FindChild(maid.body0.Pelvis.gameObject, "Hit_Vag");
  1133. if (objHit)
  1134. {
  1135. objHit.GetComponentInChildren<DynamicBoneCollider>().m_Radius = 0.09f * scaleVag;
  1136. }
  1137. #endif
  1138. }
  1139. public static GameObject FindChild(GameObject obj, string name)
  1140. {
  1141. var childrens = obj.GetComponentsInChildren<Transform>(false);
  1142. foreach (var tr in childrens)
  1143. {
  1144. if (tr.name == name)
  1145. {
  1146. return tr.gameObject;
  1147. }
  1148. }
  1149. return null;
  1150. }
  1151. public static void UpdateHitScale_2(Maid maid, Dictionary<HitCheckTgt, float> hcscs)
  1152. {
  1153. TBody body = maid.body0;
  1154. /*問題があるので廃止
  1155. float scale = 1f;
  1156. foreach (var v in hcscs)
  1157. {
  1158. scale *= v.Value;
  1159. }
  1160. if (scale != 1)
  1161. */
  1162. {
  1163. HitScaleChangedMaids.Add(maid);
  1164. }
  1165. /*else //if (HitScaleChangedMaids.Contains(maid))
  1166. {
  1167. HitScaleChangedMaids.Remove(maid);
  1168. }*/
  1169. for (int n = 0; n < body.goSlot.Count; n++)
  1170. {
  1171. var s = body.goSlot[n];
  1172. if (s != null)
  1173. {
  1174. if (s.bonehair != null && s.bonehair.bodyhit != null)
  1175. {
  1176. PreUpdateScDetail(s.bonehair.bodyhit, hcscs);
  1177. }
  1178. }
  1179. }
  1180. }
  1181. // CM3D2.hitCheckResize.Managed.hitCheckResizeManagedより改造
  1182. public static void PreUpdateScDetail(TBodyHit tbh, IDictionary<HitCheckTgt, float> scales)
  1183. {
  1184. for (int i = 0; i < tbh.spherelist.Count; i++)
  1185. {
  1186. //tbh.spherelist[i].wv_old = tbh.spherelist[i].wv;
  1187. //Vector3 wv = tbh.spherelist[i].t.TransformPoint(tbh.spherelist[i].vs);
  1188. //tbh.spherelist[i].wv = wv;
  1189. Transform t = tbh.spherelist[i].t;
  1190. //float num = Mathf.Pow(t.lossyScale.x * t.lossyScale.y * t.lossyScale.z, 0.333333343f);
  1191. /*float num = (t.lossyScale.x + t.lossyScale.y + t.lossyScale.z) / 3f;
  1192. bool flag = tbh.spherelist[i].pname == "Bip01 Spine0a";
  1193. if (flag)
  1194. {
  1195. tbh.spherelist[i].len = tbh.spherelist[i].len_ * 0.1f;
  1196. }
  1197. else
  1198. {
  1199. tbh.spherelist[i].len = tbh.spherelist[i].len_ * num;
  1200. }*/
  1201. #if DEBUG
  1202. if (UnityEngine.Input.GetKey(KeyCode.H) && true)
  1203. {
  1204. Console.WriteLine(tbh.spherelist[i].pname + " " + tbh.spherelist[i].len / tbh.spherelist[i].len_);
  1205. }
  1206. #endif
  1207. if (tbh.spherelist[i].len_ <= 0 || string.IsNullOrEmpty(tbh.spherelist[i].pname))
  1208. continue; //0は無視
  1209. bool hit = false;
  1210. foreach (var s in scales)
  1211. {
  1212. if (tbh.spherelist[i].pname.Contains(HitCheckTgtStr[s.Key]))
  1213. {
  1214. tbh.spherelist[i].len = tbh.spherelist[i].len_ * s.Value;
  1215. hit = true;
  1216. break;
  1217. }
  1218. }
  1219. if (!hit)
  1220. {
  1221. tbh.spherelist[i].len = tbh.spherelist[i].len_ * scales[HitCheckTgt.Bip01];
  1222. }
  1223. //tbh.spherelist[i].len = tbh.spherelist[i].len_ * scale;
  1224. tbh.spherelist[i].lenxlen = tbh.spherelist[i].len * tbh.spherelist[i].len;
  1225. #if COM3D2
  1226. if (tbh.spherelist[i].tPtr != null)
  1227. tbh.spherelist[i].tPtr.localScale = new Vector3(tbh.spherelist[i].len, tbh.spherelist[i].tPtr.localScale.y, tbh.spherelist[i].tPtr.localScale.z);
  1228. #endif
  1229. }
  1230. }
  1231. #region 保留
  1232. #if false//保留
  1233. // TBody node消去/node表示
  1234. public void SetVisibleNodeSlotEx(TBody tb, string slotname, bool boSetFlag, string name)
  1235. {
  1236. /*if (!tb.boMaid)
  1237. {
  1238. return;
  1239. }*/
  1240. if (!TBody.hashSlotName.ContainsKey(slotname))
  1241. {
  1242. NDebug.Assert("SetVisibleNodeSlot: not found slot name " + slotname);
  1243. return;
  1244. }
  1245. int index = (int)TBody.hashSlotName[slotname];
  1246. m_dicDelNodeBody_bkup.Clear();
  1247. SetVisibleFlagEx(tb.goSlot[index], boSetFlag, name, tb.goSlot[0].obj_tr, false);
  1248. }
  1249. Dictionary<string, bool> m_dicDelNodeBody_bkup = new Dictionary<string, bool>();
  1250. // TBodySkinより
  1251. public void SetVisibleFlagEx(TBodySkin tbs, bool boSetFlag, string name, Transform t = null, bool boTgt = false)
  1252. {
  1253. if (t.name.IndexOf(name) >= 0)
  1254. {
  1255. boTgt = true;
  1256. }
  1257. if (name == "_ALL_")
  1258. {
  1259. boTgt = true;
  1260. }
  1261. if (boTgt)
  1262. {
  1263. m_dicDelNodeBody_bkup[t.name] = tbs.m_dicDelNodeBody[t.name];
  1264. tbs.m_dicDelNodeBody[t.name] = boSetFlag;
  1265. }
  1266. foreach (Transform t2 in t)
  1267. {
  1268. SetVisibleFlagEx(tbs, boSetFlag, name, t2, boTgt);
  1269. }
  1270. }
  1271. //AccExプラグインより
  1272. public void FixFlag(Maid maid)
  1273. {
  1274. maid.body0.FixMaskFlag();
  1275. maid.body0.FixVisibleFlag(false);
  1276. maid.AllProcPropSeqStart();
  1277. }
  1278. #endif
  1279. #endregion
  1280. // TBodyよりmanでも動くように
  1281. static HashSet<Maid> hiddenMens_ = new HashSet<Maid>();
  1282. public static void FixVisibleFlagMan(Maid man, bool visible)
  1283. {
  1284. TBody body = man.body0;
  1285. if (!man.boMAN || body.goSlot[0].morph == null)
  1286. {
  1287. return;
  1288. }
  1289. if (!visible)
  1290. {
  1291. hiddenMens_.Add(man);
  1292. }
  1293. else //if(hiddenMens_.Contains(man))
  1294. {
  1295. hiddenMens_.Remove(man);
  1296. }
  1297. bool boTama = GetTamabkrVisible(man);
  1298. for (int i = 0; i < body.goSlot.Count; i++)
  1299. {
  1300. TBodySkin tBodySkin = body.goSlot[i];
  1301. if (tBodySkin.morph != null)
  1302. {
  1303. tBodySkin.morph.ClearAllVisibleFlag(visible);
  1304. for (int j = 0; j < tBodySkin.morph.BoneNames.Count; j++)
  1305. {
  1306. if (tBodySkin.morph.BoneNames[j].ToLower().Contains("chinko"))
  1307. tBodySkin.morph.BoneVisible[j] = true;
  1308. if (tBodySkin.morph.BoneNames[j].ToLower().Contains("tamabukuro"))
  1309. tBodySkin.morph.BoneVisible[j] = boTama;
  1310. }
  1311. }
  1312. }
  1313. for (int n = 0; n < body.goSlot.Count; n++)
  1314. {
  1315. TBodySkin tBodySkin4 = body.goSlot[n];
  1316. if (tBodySkin4.morph != null)
  1317. {
  1318. tBodySkin4.morph.FixVisibleFlag();
  1319. }
  1320. }
  1321. }
  1322. public static void SetManVisible(Maid man, bool visible)
  1323. {
  1324. FixVisibleFlagMan(man, visible);
  1325. man.AllProcProp();
  1326. }
  1327. public static bool GetManVisible(Maid man)
  1328. {
  1329. return !hiddenMens_.Contains(man);
  1330. }
  1331. //Cnkの表示非表示状態
  1332. static public void SetChinkoVisible(TBody body, bool visible)
  1333. {
  1334. body.SetChinkoVisible(visible);
  1335. // ボーンのスケーリングも直す
  1336. if (visible)
  1337. SetChinkoScale(body, 1f);
  1338. }
  1339. //Cnkの表示非表示状態取得
  1340. static public bool GetChinkoVisible(TBody body)
  1341. {
  1342. bool f_bVisibleGet = true;
  1343. Vector3 localScale = Vector3.zero; //new Vector3(0f, 0f, 0f);
  1344. /* v0030 公式の処理が変わって判定できなくなったので
  1345. if (body.trManChinko != null)
  1346. {
  1347. if (body.trManChinko.localScale == localScale)
  1348. {
  1349. f_bVisibleGet = false;
  1350. }
  1351. return f_bVisibleGet;
  1352. }
  1353. for (int i = 0; i < body.goSlot.Count; i++)
  1354. {
  1355. GameObject obj = body.goSlot[i].obj;
  1356. if (obj != null)
  1357. {
  1358. //v0030
  1359. //body.trManChinko = BoneLink.BoneLink.SearchObjName(obj.transform, "chinkoCenter", false);
  1360. var chinko = BoneLink.BoneLink.SearchObjName(obj.transform, "chinkoCenter", false);
  1361. if (chinko != null)
  1362. {
  1363. if (chinko.localScale == localScale)
  1364. {
  1365. f_bVisibleGet = false;
  1366. break; // v0030
  1367. }
  1368. }
  1369. }
  1370. }*/
  1371. for (int i = 0; i < body.goSlot.Count; i++)
  1372. {
  1373. GameObject obj = body.goSlot[i].obj;
  1374. if (obj != null)
  1375. {
  1376. Transform chinko = CMT.SearchObjName(obj.transform, "chinkoCenter", false);
  1377. if (chinko != null && chinko.localScale == Vector3.zero)
  1378. {
  1379. return false;
  1380. }
  1381. }
  1382. }
  1383. return f_bVisibleGet;
  1384. }
  1385. static public Vector3 GetChinkoScale(TBody body)
  1386. {
  1387. Vector3 localScale = Vector3.zero;
  1388. if (SetChinkoScaleMens.ContainsKey(body))
  1389. {
  1390. //v0030 スケーリング変更中はボーンのスケール表示を優先
  1391. Transform man_bone_tr = body.m_Bones.transform;
  1392. var size = BoneLink.BoneLink.SearchObjName(man_bone_tr, "chinkoCenter", true).localScale;
  1393. if (size != Vector3.one)
  1394. return size;
  1395. }
  1396. /* v0030
  1397. if (body.trManChinko != null)
  1398. {
  1399. return body.trManChinko.localScale;
  1400. }
  1401. */
  1402. for (int i = 0; i < body.goSlot.Count; i++)
  1403. {
  1404. GameObject obj = body.goSlot[i].obj;
  1405. if (obj != null)
  1406. {
  1407. //v0030
  1408. //body.trManChinko = BoneLink.BoneLink.SearchObjName(obj.transform, "chinkoCenter", false);
  1409. var chinko = CMT.SearchObjName(obj.transform, "chinkoCenter", false);
  1410. if (chinko != null)
  1411. {
  1412. localScale = chinko.localScale;
  1413. break; //v0030
  1414. }
  1415. }
  1416. }
  1417. return localScale;
  1418. }
  1419. /// <summary>
  1420. /// 後で戻すための書き換え男bodyリスト
  1421. /// ボーンのスケーリングはシーン変更などで勝手に戻らないのでメッシュと差異がでないように書き戻す必要がある
  1422. /// </summary>
  1423. static public Dictionary<TBody, float> SetChinkoScaleMens = new Dictionary<TBody, float>();
  1424. static public Dictionary<TBody, Vector3> SetChinkoPosMens = new Dictionary<TBody, Vector3>();
  1425. static public Dictionary<TBody, Vector3> LastMySetChinkoPosMens = new Dictionary<TBody, Vector3>();
  1426. //Cnkのサイズ調整
  1427. static public void SetChinkoScale(TBody body, float f/*, Vector3 dpos*/)
  1428. {
  1429. if (!body.boMAN)
  1430. return;
  1431. if (f != 1f)
  1432. SetChinkoScaleMens[body] = f;
  1433. else
  1434. SetChinkoScaleMens.Remove(body);
  1435. Vector3 scale = new Vector3(f, f, f);
  1436. for (int i = 0; i < body.goSlot.Count; i++)
  1437. {
  1438. GameObject obj = body.goSlot[i].obj;
  1439. if (obj != null)
  1440. {
  1441. //fix v0027 var//1.59で公式処理でも代入が消えたので chinko = body.trManChinko = CMT.SearchObjName(obj.transform, "chinkoCenter", false);
  1442. var chinko = CMT.SearchObjName(obj.transform, "chinkoCenter", false);
  1443. if (chinko != null)
  1444. {
  1445. chinko.localScale = scale;
  1446. //body.trManChinko.localPosition = dpos;
  1447. }
  1448. }
  1449. }
  1450. //ボーンもスケーリング
  1451. Transform man_bone_tr = body.m_Bones.transform;
  1452. // CMT.SearchObjNameが再帰メソッドで遅かったのでボーン情報をDictionaryでキャッシュするラッパーメソッド
  1453. BoneLink.BoneLink.SearchObjName(man_bone_tr, "chinkoCenter", true).localScale = scale;
  1454. }
  1455. //Cnkのサイズ調整を維持(ボーンスケールとのずれを防ぐ)
  1456. static public void FixChinkoScaleInUpdate(TBody body)
  1457. {
  1458. if (!body.boMAN)
  1459. return;
  1460. if (Time.frameCount % 6 != 0) // 6フレーム毎にチェック
  1461. return;
  1462. //Vector3 localScale = Vector3.zero;
  1463. if (SetChinkoScaleMens.ContainsKey(body))
  1464. {
  1465. //v0030 スケーリング変更中
  1466. Transform man_bone_tr = body.m_Bones.transform;
  1467. var size = BoneLink.BoneLink.SearchObjName(man_bone_tr, "chinkoCenter", true).localScale;
  1468. if (size != Vector3.one)
  1469. {
  1470. float f = size.x;
  1471. Vector3 scale = size;//new Vector3(f, f, f);
  1472. for (int i = 0; i < body.goSlot.Count; i++)
  1473. {
  1474. GameObject obj = body.goSlot[i].obj;
  1475. if (obj != null)
  1476. {
  1477. var chinko = CMT.SearchObjName(obj.transform, "chinkoCenter", false);
  1478. if (chinko != null)
  1479. {
  1480. if (chinko.localScale == scale)
  1481. return;
  1482. if (chinko.localScale == Vector3.zero)
  1483. return;
  1484. // 非表示でなければ適用
  1485. chinko.localScale = scale;
  1486. }
  1487. }
  1488. }
  1489. }
  1490. else
  1491. {
  1492. SetChinkoScaleMens.Remove(body);
  1493. }
  1494. }
  1495. }
  1496. //static FieldInfo fiChinkoOffsetOrg = typeof(TBody).GetField("vecChinkoOffset", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
  1497. //Cnkのサイズ調整
  1498. static public void SetChinkoPos(TBody body, Vector3 dpos)
  1499. {
  1500. if (!body.boMAN)
  1501. return;
  1502. //ボーン
  1503. Transform man_bone_tr = body.m_Bones.transform;
  1504. var cctr = BoneLink.BoneLink.SearchObjName(man_bone_tr, "chinkoCenter", true);
  1505. /* trManChinkoだと何故か動かない
  1506. var cctr = body.trManChinko;
  1507. if (!cctr)
  1508. cctr = BoneLink.BoneLink.SearchObjName(man_bone_tr, "chinkoCenter", true);
  1509. */
  1510. if (!SetChinkoPosMens.ContainsKey(body))
  1511. {
  1512. SetChinkoPosMens[body] = cctr.localPosition;
  1513. }
  1514. else if (LastMySetChinkoPosMens.ContainsKey(body)) //v0027 fix
  1515. {
  1516. if (cctr.localPosition != (LastMySetChinkoPosMens[body])
  1517. && body.vecChinkoOffset == cctr.localPosition)
  1518. { // 他で位置が変更されたら初期値をセットし直す(SetManOffsetPosなど)
  1519. SetChinkoPosMens[body] = cctr.localPosition;
  1520. }
  1521. }
  1522. //else if (SetChinkoPosMens[body] == dpos)
  1523. // SetChinkoPosMens.Remove(body);
  1524. cctr.localPosition = dpos + SetChinkoPosMens[body];
  1525. //v0027 fix body.vecChinkoOffset対応
  1526. LastMySetChinkoPosMens[body] = cctr.localPosition;
  1527. body.vecChinkoOffset = cctr.localPosition;
  1528. //if (fiChinkoOffsetOrg != null)
  1529. // fiChinkoOffsetOrg.SetValue(body, cctr.localPosition);
  1530. if (Vector3.zero == dpos)
  1531. {
  1532. SetChinkoPosMens.Remove(body);
  1533. LastMySetChinkoPosMens.Remove(body);
  1534. }
  1535. }
  1536. static public Vector3 GetInitChinkoPos(TBody body)
  1537. {
  1538. Vector3 v3 = Vector3.zero;
  1539. /*if (SetChinkoPosMens.TryGetValue(body, out v3))
  1540. {
  1541. return v3;
  1542. }*/
  1543. return Vector3.zero;
  1544. }
  1545. static public Vector3 GetChinkoPos(TBody body)
  1546. {
  1547. //ボーン
  1548. Transform man_bone_tr = body.m_Bones.transform;
  1549. var cctr = BoneLink.BoneLink.SearchObjName(man_bone_tr, "chinkoCenter", true);
  1550. if (!SetChinkoPosMens.ContainsKey(body))
  1551. SetChinkoPosMens[body] = cctr.localPosition;
  1552. return cctr.localPosition - SetChinkoPosMens[body];
  1553. }
  1554. static public void ResetChinkoAll()
  1555. {
  1556. //サイズ
  1557. bool chk = SetChinkoScaleMens.Count > 0;
  1558. foreach (var mandata in SetChinkoScaleMens.ToArray())
  1559. {
  1560. if (mandata.Key)
  1561. SetChinkoScale(mandata.Key, 1f);
  1562. }
  1563. if (chk && SetChinkoScaleMens.Count > 0)
  1564. Console.WriteLine("◆◆注意◆◆:Chinkoのスケーリング復元が不完全。動きや射精などがズレる場合は、男局部のスケーリングを一度1以外に設定後、1に戻してください");
  1565. else
  1566. SetChinkoScaleMens.Clear();
  1567. #if DEBUG
  1568. if (chk && SetChinkoScaleMens.Count == 0)
  1569. debugPrintConsole("◆Chinkoのスケーリング復元が正常に完了");
  1570. #endif
  1571. //位置
  1572. chk = SetChinkoPosMens.Count > 0;
  1573. foreach (var mandata in SetChinkoPosMens.ToArray())
  1574. {
  1575. if (mandata.Key)
  1576. SetChinkoPos(mandata.Key, Vector3.zero);
  1577. // SetChinkoPos(mandata.Key, mandata.Value);
  1578. }
  1579. if (chk && SetChinkoPosMens.Count > 0)
  1580. Console.WriteLine("◆◆注意◆◆:Chinkoの位置復元が不完全。動きや射精などがズレる場合は、男局部の位置調整を一度0以外に設定後、0に戻してください");
  1581. else
  1582. {
  1583. SetChinkoPosMens.Clear();
  1584. LastMySetChinkoPosMens.Clear();
  1585. }
  1586. }
  1587. #if false
  1588. static private bool GetTamabkrVisible(TBody body)
  1589. {
  1590. bool f_bVisibleGet = true;
  1591. Vector3 localScale = new Vector3(0f, 0f, 0f);
  1592. for (int i = 0; i < body.goSlot.Count; i++)
  1593. {
  1594. GameObject obj = body.goSlot[i].obj;
  1595. if (obj != null)
  1596. {
  1597. var tama = BoneLink.BoneLink.SearchObjName(obj.transform, "tamabukuro", false);
  1598. if (tama != null)
  1599. {
  1600. if (tama.localScale == localScale)
  1601. {
  1602. f_bVisibleGet = false;
  1603. }
  1604. }
  1605. }
  1606. }
  1607. return f_bVisibleGet;
  1608. }
  1609. static private bool SetTamabkrVisible(TBody body, bool visible)
  1610. {
  1611. bool f_bVisibleGet = true;
  1612. Vector3 localScale = visible ? new Vector3(1f, 1f, 1f) : new Vector3(0f, 0f, 0f);
  1613. for (int i = 0; i < body.goSlot.Count; i++)
  1614. {
  1615. GameObject obj = body.goSlot[i].obj;
  1616. if (obj != null)
  1617. {
  1618. var tama = BoneLink.BoneLink.SearchObjName(obj.transform, "tamabukuro", false);
  1619. if (tama != null)
  1620. {
  1621. tama.localScale = localScale;
  1622. }
  1623. }
  1624. }
  1625. return f_bVisibleGet;
  1626. }
  1627. #else
  1628. static private bool GetTamabkrVisible(Maid man)
  1629. {
  1630. bool f_bVisibleGet = true;
  1631. TBody body = man.body0;
  1632. if (!man.boMAN || body.goSlot[0].morph == null)
  1633. {
  1634. return f_bVisibleGet;
  1635. }
  1636. for (int i = 0; i < body.goSlot.Count; i++)
  1637. {
  1638. TBodySkin tBodySkin = body.goSlot[i];
  1639. if (tBodySkin.morph != null)
  1640. {
  1641. for (int j = 0; j < tBodySkin.morph.BoneNames.Count; j++)
  1642. {
  1643. if (tBodySkin.morph.BoneNames[j].ToLower().Contains("tamabukuro"))
  1644. f_bVisibleGet = tBodySkin.morph.BoneVisible[j];
  1645. }
  1646. }
  1647. }
  1648. for (int n = 0; n < body.goSlot.Count; n++)
  1649. {
  1650. TBodySkin tBodySkin4 = body.goSlot[n];
  1651. if (tBodySkin4.morph != null)
  1652. {
  1653. tBodySkin4.morph.FixVisibleFlag();
  1654. }
  1655. }
  1656. return f_bVisibleGet;
  1657. }
  1658. static private void SetTamabkrVisible(Maid man, bool visible)
  1659. {
  1660. TBody body = man.body0;
  1661. if (!man.boMAN || body.goSlot[0].morph == null)
  1662. {
  1663. return;
  1664. }
  1665. for (int i = 0; i < body.goSlot.Count; i++)
  1666. {
  1667. TBodySkin tBodySkin = body.goSlot[i];
  1668. if (tBodySkin.morph != null)
  1669. {
  1670. for (int j = 0; j < tBodySkin.morph.BoneNames.Count; j++)
  1671. {
  1672. if (tBodySkin.morph.BoneNames[j].ToLower().Contains("tamabukuro"))
  1673. {
  1674. tBodySkin.morph.BoneVisible[j] = visible;
  1675. tBodySkin.morph.GetType().InvokeMember("m_bDut", BindingFlags.NonPublic | BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.SetField,
  1676. null, tBodySkin.morph, new object[] { true });
  1677. }
  1678. }
  1679. }
  1680. }
  1681. for (int n = 0; n < body.goSlot.Count; n++)
  1682. {
  1683. TBodySkin tBodySkin4 = body.goSlot[n];
  1684. if (tBodySkin4.morph != null)
  1685. {
  1686. tBodySkin4.morph.FixVisibleFlag();
  1687. }
  1688. }
  1689. man.AllProcProp();
  1690. }
  1691. #endif
  1692. public static string V3Text(Vector3 v3)
  1693. {
  1694. //return "\t" + angle180d(v3.x) + "\r\n\t" + angle180d(v3.y) + "\r\n\t" + angle180d(v3.z) + "\r\n";
  1695. return string.Format("\t{0:0.#####}\r\n\t{1:0.#####}\r\n\t{2:0.#####}\r\n", v3v(v3.x), v3v(v3.y), v3v(v3.z));
  1696. }
  1697. public static string V3TextA(Vector3 v3)
  1698. {
  1699. //return "\t" + angle180d(v3.x) + "\r\n\t" + angle180d(v3.y) + "\r\n\t" + angle180d(v3.z) + "\r\n";
  1700. return string.Format("\t{0:0.####}\r\n\t{1:0.####}\r\n\t{2:0.####}\r\n", angle180d(v3.x), angle180d(v3.y), angle180d(v3.z));
  1701. }
  1702. static string V3S(Vector3 v3)
  1703. {
  1704. return "X:" + angle180d(v3.x) + " Y:" + angle180d(v3.y) + " Z:" + angle180d(v3.z);
  1705. }
  1706. static float v3v(float f)
  1707. {
  1708. f = (float)Math.Round(f, 5);
  1709. if (Math.Abs(f) < 0.00001)
  1710. f = 0;
  1711. return f;
  1712. }
  1713. static float angle180d(float f)
  1714. {
  1715. f = (float)Math.Round(f, 4);
  1716. if (Math.Abs(f) < 0.0001)
  1717. f = 0;
  1718. if (f > 180)
  1719. {
  1720. f -= 360;
  1721. }
  1722. else if (f < -180)
  1723. {
  1724. f += 360;
  1725. }
  1726. return f;
  1727. }
  1728. public static Vector3 va180(Vector3 v)
  1729. {
  1730. v.x = angle180d(v.x);
  1731. v.y = angle180d(v.y);
  1732. v.z = angle180d(v.z);
  1733. return v;
  1734. }
  1735. public static float[] v3Tofa(Vector3 v)
  1736. {
  1737. float[] fa = new float[3];
  1738. fa[0] = v.x;
  1739. fa[1] = v.y;
  1740. fa[2] = v.z;
  1741. return fa;
  1742. }
  1743. public static Vector3 faTov3(float[] fa)
  1744. {
  1745. if (fa.Length != 3)
  1746. {
  1747. Console.WriteLine("XtMS: インデックスエラー。float[]→Vector3の変換に失敗");
  1748. return Vector3.zero;
  1749. }
  1750. return new Vector3(fa[0], fa[1], fa[2]);
  1751. }
  1752. public static class InputEx
  1753. {
  1754. [FlagsAttribute]
  1755. public enum ModifierKey
  1756. {
  1757. None = 0x00,
  1758. Control = 0x01,
  1759. Alt = 0x02,
  1760. Shift = 0x04
  1761. }
  1762. //static int fCnt_last = -1;
  1763. static ModifierKey m_getMdfKeys = ModifierKey.None;
  1764. /*static public void GetModifierKeys(ModifierKey mdfkey)
  1765. {
  1766. GetModifierKeys(true, mdfkey);
  1767. }*/
  1768. static public void GetModifierKeys(/*bool ForceUpdate, */ModifierKey mdfkey)
  1769. {
  1770. ModifierKey getmdfkey = ModifierKey.None;
  1771. /*//基本的には毎フレームに一度だけチェック
  1772. if (Time.frameCount == fCnt_last && !ForceUpdate)
  1773. return;
  1774. fCnt_last = Time.frameCount;
  1775. */
  1776. if ((mdfkey & ModifierKey.Control) != 0)
  1777. {
  1778. if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
  1779. getmdfkey = getmdfkey | ModifierKey.Control;
  1780. }
  1781. if ((mdfkey & ModifierKey.Alt) != 0)
  1782. {
  1783. if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt))
  1784. getmdfkey = getmdfkey | ModifierKey.Alt;
  1785. }
  1786. if ((mdfkey & ModifierKey.Shift) != 0)
  1787. {
  1788. if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
  1789. getmdfkey = getmdfkey | ModifierKey.Shift;
  1790. }
  1791. m_getMdfKeys = getmdfkey;
  1792. }
  1793. static public bool GetKeyDownEx(KeyCode key, ModifierKey mdfkey)
  1794. {
  1795. GetModifierKeys(mdfkey);
  1796. if (m_getMdfKeys != mdfkey)
  1797. return false;
  1798. return Input.GetKeyDown(key);
  1799. }
  1800. static public bool GetModifierKey(ModifierKey mdfkey)
  1801. {
  1802. GetModifierKeys(mdfkey);
  1803. return m_getMdfKeys == mdfkey;
  1804. }
  1805. }
  1806. #endregion
  1807. public static bool IsKeepScene()
  1808. {
  1809. return vIsKaisouScene || bIsYotogiScene;
  1810. }
  1811. public class keepSlaveInfo
  1812. {
  1813. public string lastMotionFN = string.Empty;
  1814. public Vector3 lastPos = Vector3.zero;
  1815. private int pageNum;
  1816. public keepSlaveInfo(int index)
  1817. {
  1818. this.pageNum = index;
  1819. }
  1820. public void SaveLastInfo(Maid m)
  1821. {
  1822. lastMotionFN = m.body0.LastAnimeFN;
  1823. lastPos = m.gameObject.transform.position;
  1824. }
  1825. public bool CheckMoved(Maid m, int pageN)
  1826. {
  1827. if (lastMotionFN != m.body0.LastAnimeFN/* || lastPos != m.gameObject.transform.position*/)
  1828. {
  1829. debugPrintConsole(lastMotionFN + lastPos + " != " + m.body0.LastAnimeFN + m.gameObject.transform.position);
  1830. Console.WriteLine("[!] ゲームシステムによるキャラクター操作を検知したためM-Sリンク<" + this.pageNum + ">を中断");
  1831. //アタッチの解除
  1832. if (cfgs[pageN].doIKTargetMHand || cfgs[pageN].doCopyIKTarget)
  1833. {
  1834. m.IKTargetClear();
  1835. }
  1836. //ハーレムプレイなどで問題がでることがあるのでリンク中止
  1837. _MSlinks[pageN].doMasterSlave = false;
  1838. _MSlinks[pageN].maidKeepSlaveYotogi = null;
  1839. //モーションが変更されたらシステム側のキャラクター操作があったと判断
  1840. return true;
  1841. }
  1842. /* 中断されすぎるのでなし
  1843. Animation animation = m.body0.m_Bones.GetComponent<Animation>();
  1844. if (animation != null)
  1845. {
  1846. var anime_state = animation[m.body0.LastAnimeFN.ToLower()];
  1847. if (anime_state != null && anime_state.length != 0f)
  1848. {
  1849. //debugPrintConsole("anime_state = " + anime_state.enabled);
  1850. //アニメが再開されていたらtrue
  1851. return anime_state.enabled;
  1852. }
  1853. }*/
  1854. return false;
  1855. }
  1856. }
  1857. public static string pathConfig(string path)
  1858. {
  1859. {
  1860. if (IsCom3d2)
  1861. {
  1862. //if (!path.Contains("Config"))
  1863. {
  1864. path = Path.Combine("Config", path);
  1865. }
  1866. return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), path);
  1867. }
  1868. return path;
  1869. }
  1870. }
  1871. #region Config
  1872. // ExPluginBase (Copyright (c) 2015 asm__) より改造
  1873. public T ReadConfig<T>(string section, string dirPath) where T : new()
  1874. {
  1875. return SharedConfig.ReadConfig<T>("Config", Path.Combine(dirPath, GetType().Name + ".ini"));
  1876. }
  1877. public void SaveConfig<T>(T data, string section, string dirPath)
  1878. {
  1879. SharedConfig.SaveConfig("Config", Path.Combine(dirPath, GetType().Name + ".ini"), data);
  1880. }
  1881. #endregion
  1882. public void LoadMyConfigs()
  1883. {
  1884. // Iniファイル読み出し
  1885. //cfg = ReadConfig<PluginConfig>("Config");
  1886. /*
  1887. v3StackOffset = faTov3(cfg.v3StackOffsetFA);
  1888. v3StackOffsetRot = faTov3(cfg.v3StackOffsetRotFA);
  1889. v3HandLOffset = faTov3(cfg.v3HandLOffsetFA);
  1890. v3HandROffset = faTov3(cfg.v3HandROffsetFA);
  1891. */
  1892. cfg = ReadConfig<PluginConfig>("Config", pathConfig(""));
  1893. for (int i = 0; i < cfgs.Length; i++)
  1894. {
  1895. if (cfg.doHitScaleDef)
  1896. {
  1897. cfgs[i].Scale_HitCheckDetail = true;
  1898. foreach (var v in HitCheckTgtStr)
  1899. cfgs[i].GetHitDetail(v.Key) = cfg.HitScaleDef[(int)v.Key];
  1900. }
  1901. if (i == 0)
  1902. cfgs[i] = ReadConfig<MsLinkConfig>("Config", pathConfig(""));
  1903. else
  1904. cfgs[i] = SharedConfig.ReadConfig<MsLinkConfig>("Config-" + (i + 1).ToString(), pathConfig(PluginCfgFN));
  1905. }
  1906. for (int i = 0; i < cfgs.Length; i++)
  1907. {
  1908. IniCfgsTov3Offsets(ref v3ofs[i], cfgs[i]);
  1909. }
  1910. ycfg = PluginExt.SharedConfig.ReadConfig<YotogiConfig>("Config", pathConfig(YotogiCfgFN));
  1911. VYMModule.VymModule.cfg = PluginExt.SharedConfig.ReadConfig<VYMModule.VymModule.VibeYourMaidConfig>("VYMAsset", pathConfig(YotogiCfgFN));
  1912. // v0027
  1913. // ボイステーブルをini→CSVに
  1914. VymModule.voiceLegacy = SharedConfig.ReadConfig<VymModule.VoiceTableLegacy>("VYMAsset", pathConfig(YotogiCfgFN));
  1915. cnv2csv.SaveVoiceCsvFile();
  1916. // CSVロード
  1917. NewVoiceTable.LoadCsv();
  1918. }
  1919. public static void IniCfgsTov3Offsets(ref v3Offsets v3ofs, MsLinkConfig cfgs)
  1920. {
  1921. v3ofs.v3StackOffset = faTov3(cfgs.v3StackOffsetFA);
  1922. v3ofs.v3StackOffsetRot = faTov3(cfgs.v3StackOffsetRotFA);
  1923. v3ofs.v3HandLOffset = faTov3(cfgs.v3HandLOffsetFA);
  1924. v3ofs.v3HandROffset = faTov3(cfgs.v3HandROffsetFA);
  1925. v3ofs.v3HandLOffsetRot = faTov3(cfgs.v3HandLOffsetRotFA);
  1926. v3ofs.v3HandROffsetRot = faTov3(cfgs.v3HandROffsetRotFA);
  1927. // 5.0
  1928. v3ofs.customHandR = new PosRot(cfgs.customHandRfa);
  1929. v3ofs.customHandL = new PosRot(cfgs.customHandLfa);
  1930. }
  1931. public void SaveMyConfigs()
  1932. {
  1933. // Iniファイル書き出し
  1934. for (int i = 0; i < cfgs.Length; i++)
  1935. {
  1936. v3OffsetsToIniCfgs(ref cfgs[i], v3ofs[i]);
  1937. }
  1938. SaveConfig(cfg, "Config", pathConfig(""));
  1939. SaveConfig(cfgs[0], "Config", pathConfig(""));
  1940. for (int i = 1; i < cfgs.Length; i++)
  1941. SharedConfig.SaveConfig("Config-" + (i + 1).ToString(), pathConfig(PluginCfgFN), cfgs[i]);
  1942. PluginExt.SharedConfig.SaveConfig("Config", pathConfig(YotogiCfgFN), ycfg);
  1943. PluginExt.SharedConfig.SaveConfig("VYMAsset", pathConfig(YotogiCfgFN), VYMModule.VymModule.cfg);
  1944. }
  1945. public static void v3OffsetsToIniCfgs(ref MsLinkConfig cfgs, v3Offsets v3ofs)
  1946. {
  1947. cfgs.v3StackOffsetFA = v3Tofa(v3ofs.v3StackOffset);
  1948. cfgs.v3StackOffsetRotFA = v3Tofa(v3ofs.v3StackOffsetRot);
  1949. cfgs.v3HandLOffsetFA = v3Tofa(v3ofs.v3HandLOffset);
  1950. cfgs.v3HandROffsetFA = v3Tofa(v3ofs.v3HandROffset);
  1951. cfgs.v3HandLOffsetRotFA = v3Tofa(v3ofs.v3HandLOffsetRot);
  1952. cfgs.v3HandROffsetRotFA = v3Tofa(v3ofs.v3HandROffsetRot);
  1953. // v5.0
  1954. cfgs.customHandRfa = v3ofs.customHandR.ToFloatArray();
  1955. cfgs.customHandLfa = v3ofs.customHandL.ToFloatArray();
  1956. }
  1957. void Awake()
  1958. {
  1959. GameObject.DontDestroyOnLoad(this);
  1960. #if COM3D2
  1961. UnityEngine.SceneManagement.SceneManager.sceneLoaded += OnSceneLoaded;
  1962. #endif
  1963. #if true
  1964. if (NeedHitScaleCalc)
  1965. Console.WriteLine("XtMS: ヒットチェック計算を旧バージョン用に設定");
  1966. #endif
  1967. //位置補正座標
  1968. _Gizmo = OhMyGizmo.AddGizmo(base.transform, "XtMS_Gizmo");
  1969. _Gizmo.eRotate = true;
  1970. _Gizmo.eAxis = true;
  1971. _Gizmo.eScal = false;
  1972. _Gizmo.offsetScale = 1.0f;
  1973. //_Gizmo.lineRSelectedThick = 0.2f;
  1974. _Gizmo.Visible = false;
  1975. _Gizmo_HandR = OhMyGizmo.AddGizmo(base.transform, "XtMS_Gizmo_HR");
  1976. _Gizmo_HandR.eRotate = true;
  1977. _Gizmo_HandR.eAxis = true;
  1978. _Gizmo_HandR.eScal = false;
  1979. _Gizmo_HandR.offsetScale = 0.5f;
  1980. _Gizmo_HandR.Visible = false;
  1981. _Gizmo_HandR.lineSelectedThick = 0.2f;
  1982. _Gizmo_HandL = OhMyGizmo.AddGizmo(base.transform, "XtMS_Gizmo_HL");
  1983. _Gizmo_HandL.eRotate = true;
  1984. _Gizmo_HandL.eAxis = true;
  1985. _Gizmo_HandL.eScal = false;
  1986. _Gizmo_HandL.offsetScale = 0.5f;
  1987. _Gizmo_HandL.Visible = false;
  1988. _Gizmo_HandL.lineSelectedThick = 0.2f;
  1989. #if DEBUG
  1990. //位置補正座標
  1991. _Gizmo_dbg = OhMyGizmo.AddGizmo(base.transform, "XtMS_Gizmo_Dbg");
  1992. _Gizmo_dbg.eRotate = true;
  1993. _Gizmo_dbg.eAxis = true;
  1994. _Gizmo_dbg.eScal = false;
  1995. _Gizmo_dbg.offsetScale = 1.0f;
  1996. //_Gizmo.lineRSelectedThick = 0.2f;
  1997. _Gizmo_dbg.Visible = false;
  1998. cnv2csv.SaveVoiceCsvFile();
  1999. VYMModule.NewVoiceTable.LoadCsv();
  2000. /*if (Ik159.IsIkMgr159)
  2001. {
  2002. }*/
  2003. #endif
  2004. #if !DEBUG
  2005. // Iniファイル読み出し
  2006. LoadMyConfigs();
  2007. #endif
  2008. // Iniファイル書き出し
  2009. SaveMyConfigs();
  2010. }
  2011. public void Start()
  2012. {
  2013. }
  2014. public void OnApplicationQuit()
  2015. {
  2016. }
  2017. public void OnDestroy()
  2018. {
  2019. }
  2020. #if !COM3D2
  2021. void OnLevelWasLoaded(int level)
  2022. {
  2023. #else
  2024. void OnSceneLoaded(Scene scene, LoadSceneMode sceneMode)
  2025. {
  2026. int level = scene.buildIndex;
  2027. #endif
  2028. #if DEBUG
  2029. Console.WriteLine("Xtms: OnScene" + level);
  2030. new GameObject("xtms-onescene").AddComponent<OneScene>();
  2031. #endif
  2032. // レベルの取得
  2033. vSceneLevel = level;
  2034. SceneLevelEnable = true;
  2035. bIsYotogiScene = checkYotogiScene();
  2036. //以下のシーンにある場合、プラグインを有効化
  2037. //4:ドキドキ Fallin' Love 5:エディット
  2038. //15:コミュニケーション等
  2039. //20:entrance to you 22:scarlet leap
  2040. //26:stellar my tears 24:回想 27:撮影モード
  2041. if (0 <= Array.IndexOf(cfg.IgnoreSceneLevel, vSceneLevel) && !bIsYotogiScene)
  2042. SceneLevelEnable = false;
  2043. //回想モードの夜伽判定用
  2044. if (vSceneLevel == 24)
  2045. {
  2046. //if (!boIsKaisouScene)
  2047. // Console.WriteLine("VYM+夜伽リンク:回想モードに切り替えました");
  2048. vIsKaisouScene = true;
  2049. }
  2050. else if (vSceneLevel == 1 || vSceneLevel == 3)
  2051. { //1=夜伽、回想のメイド選択、3=昼/夜の自室メニュー
  2052. //if (boIsKaisouScene)
  2053. // Console.WriteLine("VYM+夜伽リンク:通常モードに切り替えました");
  2054. vIsKaisouScene = false;
  2055. }
  2056. //バケーションモードの切替チェック(vymより)
  2057. if (vSceneLevel == 43 && !vacationEnabled) vacationEnabled = true;
  2058. if (vSceneLevel == 3 && vacationEnabled) vacationEnabled = false;
  2059. //初期化
  2060. if (!vIsKaisouScene)
  2061. {
  2062. GuiFlag = false;
  2063. _pageNum = 0;
  2064. }
  2065. else
  2066. {
  2067. if (GuiFlag)
  2068. showWndMin = true;
  2069. }
  2070. XtMs2ndWnd.boShow = false;
  2071. //設定項目
  2072. showPosSliderHand = false;
  2073. showPosSliderHandR = true;
  2074. showChinkoSlider = false;
  2075. showSlaveEyeToTgt = false;
  2076. showSubMens = false;
  2077. showSlvMask = false;
  2078. showHandTTPosSlider = false;
  2079. GizmoVisible(false);
  2080. GizmoHsVisible(false);
  2081. //doMasterSlave = false;
  2082. BoneLink.BoneLink.ClearCache();
  2083. //ComboMaster.boPop = false;
  2084. //ComboSlave.boPop = false;
  2085. //ComboSubMaid.boPop = false;
  2086. CloseAllCombos();
  2087. _StockMaids.Clear();
  2088. _StockMaids_Visible.Clear();
  2089. VYMModule.VymModule.Reset();
  2090. if (!(vIsKaisouScene || bIsYotogiScene))
  2091. {
  2092. //maidKeepSlaveYotogi = null;
  2093. MsLinks.AllReset(true);
  2094. }
  2095. else
  2096. {
  2097. MsLinks.AllReset(false);
  2098. }
  2099. //lastSlaveStacked = null;
  2100. //モーション取得情報クリア
  2101. AnimeState.AllReset();
  2102. //男局部のスケーリングリセット
  2103. //(リセットしないとボーンだけ維持される)
  2104. ResetChinkoAll();
  2105. //リンク共通設定
  2106. CommonEdit.ResetAll();
  2107. //表示設定関係
  2108. try
  2109. {
  2110. //多分なくても平気
  2111. /*foreach (var m in maskedMaids.ToArray())
  2112. {
  2113. if (m && m.body0) ResetMaskItemsAll(m);
  2114. }*/
  2115. }
  2116. catch (Exception e)
  2117. {
  2118. debugPrintConsole("ResetMaskItemsAll例外:" + e);
  2119. }
  2120. maskedMaids.Clear();
  2121. try
  2122. {
  2123. foreach (var m in HitScaleChangedMaids.ToArray())
  2124. {
  2125. if (m && m.body0) UpdateHitScale_(m, 1f);
  2126. }
  2127. }
  2128. catch (Exception e)
  2129. {
  2130. debugPrintConsole("UpdateHitScale例外:" + e);
  2131. }
  2132. HitScaleChangedMaids.Clear();
  2133. try
  2134. {
  2135. foreach (var m in hiddenMens_.ToArray())
  2136. {
  2137. if (m && m.body0) SetManVisible(m, true);
  2138. }
  2139. }
  2140. catch (Exception e)
  2141. {
  2142. debugPrintConsole("SetManVisible例外:" + e);
  2143. }
  2144. hiddenMens_.Clear();
  2145. }
  2146. // 夜伽シーンにいるかをチェック
  2147. private bool checkYotogiScene()
  2148. {
  2149. // OH版は夜伽シーンでもSceneが14にならない(10のまま)ので、YotogiManagerの有無で判別する
  2150. int iYotogiManagerCount = FindObjectsOfType<YotogiManager>().Length;
  2151. if (iYotogiManagerCount > 0) { return true; }
  2152. return false;
  2153. }
  2154. //
  2155. // GUI用
  2156. //
  2157. private bool GuiFlag = false;
  2158. public const int GUI_WIDTH = 260;
  2159. public static int GUI_HIGHT = 640;
  2160. const int WIDTH_DPOS = -GUI_WIDTH - 30;
  2161. const int HEIGHT_DPOS = -685 - 35;
  2162. static Rect rc_stgw = new Rect(UnityEngine.Screen.width + WIDTH_DPOS, /*UnityEngine.Screen.height + HEIGHT_DPOS*/UnityEngine.Screen.height / 720 * 35, GUI_WIDTH, GUI_HIGHT);
  2163. static Rect rc_stgw_caption = new Rect(0, 0, rc_stgw.width, 20);
  2164. int ScWidth = 0, ScHeight = 0;
  2165. private static bool bGuiOnMouse = true;
  2166. void OnGUI()
  2167. {
  2168. // シーン有効チェック
  2169. if (!SceneLevelEnable)
  2170. {
  2171. return;
  2172. }
  2173. //if (_MaidList.Count <= 0 || _MensList.Count <= 0)
  2174. if (_MaidList.Count <= 0 /*|| _MensList.Count <= 0*/) //メイド単体稼働可に
  2175. {
  2176. return;
  2177. }
  2178. if (GuiFlag)
  2179. {
  2180. if (ScHeight != UnityEngine.Screen.height)
  2181. {
  2182. if (UnityEngine.Screen.height >= 720)
  2183. rc_stgw.y = (UnityEngine.Screen.height - 720) * 0.1f + 30;
  2184. else
  2185. rc_stgw.y = 0;
  2186. ScHeight = UnityEngine.Screen.height;
  2187. }
  2188. if (ScWidth != UnityEngine.Screen.width)
  2189. {
  2190. if (UnityEngine.Screen.width > 800)
  2191. rc_stgw.x = UnityEngine.Screen.width + WIDTH_DPOS;
  2192. else
  2193. rc_stgw.x = UnityEngine.Screen.width - rc_stgw.width;
  2194. ScWidth = UnityEngine.Screen.width;
  2195. }
  2196. GUIStyle gsWin = new GUIStyle("box")
  2197. {
  2198. fontSize = 12,
  2199. alignment = TextAnchor.UpperLeft
  2200. };
  2201. if (showWndMode == 1)
  2202. GUI_HIGHT = 110;
  2203. else if (showWndMode == 2)
  2204. GUI_HIGHT = 320;
  2205. else
  2206. GUI_HIGHT = 640;
  2207. rc_stgw.height = GUI_HIGHT;
  2208. if (showWndMin)
  2209. {
  2210. bool bdrag = false;
  2211. if (showWndMinHide)
  2212. {
  2213. rc_stgw.height = 20;
  2214. }
  2215. else
  2216. {
  2217. if (UnityEngine.Input.GetMouseButton(0))
  2218. {
  2219. bdrag = true;
  2220. }
  2221. }
  2222. if (rc_stgw.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)))
  2223. {
  2224. showWndMinHide = false;
  2225. }
  2226. else if (!bdrag)
  2227. {
  2228. showWndMinHide = true;
  2229. rc_stgw.height = 20;
  2230. }
  2231. }
  2232. //メイン画面
  2233. rc_stgw = GUI.Window(WINID_COFIG, rc_stgw, WindowCallback, PLUGIN_NAME + " " + PLUGIN_VERSION, gsWin);
  2234. if (rc_stgw.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)))
  2235. {
  2236. GameMain.Instance.MainCamera.SetControl(false);
  2237. bGuiOnMouse = true;
  2238. }
  2239. else
  2240. {
  2241. if (bGuiOnMouse)
  2242. GameMain.Instance.MainCamera.SetControl(true);
  2243. bGuiOnMouse = false;
  2244. }
  2245. }
  2246. else if (bGuiOnMouse)
  2247. {
  2248. GameMain.Instance.MainCamera.SetControl(true);
  2249. bGuiOnMouse = false;
  2250. }
  2251. }//OnGUI()
  2252. float btnset_LR(Rect rc, int bw, float f, float fd, GUIStyle gsButton, float min, float max)
  2253. {
  2254. f = btnset_LR(rc, bw, f, fd, gsButton);
  2255. if (f < min)
  2256. f = min;
  2257. if (f > max)
  2258. f = max;
  2259. return f;
  2260. }
  2261. float btnset_LR(Rect rc, int bw, float f, GUIStyle gsButton, float min, float max)
  2262. {
  2263. f = btnset_LR(rc, bw, f, gsButton);
  2264. if (f < min)
  2265. f = min;
  2266. if (f > max)
  2267. f = max;
  2268. return f;
  2269. }
  2270. float btnset_LR(Rect rc, int bw, float f, GUIStyle gsButton)
  2271. {
  2272. float fd = 0.001f;
  2273. f = btnset_LR(rc, bw, f, fd, gsButton);
  2274. return f;
  2275. }
  2276. float btnset_LR(Rect rc, int bw, float f, float fd, GUIStyle gsButton)
  2277. {
  2278. if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
  2279. fd *= 0.1f;
  2280. if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
  2281. fd *= 100f;
  2282. if (GUI.Button(rc, "<", gsButton))
  2283. {
  2284. f -= fd;
  2285. }
  2286. rc.x += bw;
  2287. if (GUI.Button(rc, ">", gsButton))
  2288. {
  2289. f += fd;
  2290. }
  2291. return f;
  2292. }
  2293. void WindowCallback(int id)
  2294. {
  2295. try
  2296. {
  2297. foreach (var v in _MSlinks)
  2298. {
  2299. v.MsUpdate(true, true);
  2300. if (v.maidKeepSlaveYotogi)
  2301. {
  2302. //リンク中断判定
  2303. v.keepSI.CheckMoved(v.maidKeepSlaveYotogi, v.num_);
  2304. }
  2305. }
  2306. if (!XtMs2ndWnd.boShow)
  2307. {
  2308. WindowCallback_proc(id);
  2309. }
  2310. else
  2311. {
  2312. XtMs2ndWnd.SaveWindowCallback_proc(id, this, ref showWndMode, ref _pageNum, _MSlinks, cfgs, v3ofs, out _WinprocPhase);
  2313. GetMens(); //キャラ数が変わってる可能性があるので
  2314. GetMaids(); //キャラ数が変わってる可能性があるので
  2315. }
  2316. foreach (var v in _MSlinks)
  2317. {
  2318. if (v.maidKeepSlaveYotogi)
  2319. v.keepSI.SaveLastInfo(v.maidKeepSlaveYotogi);
  2320. //キャラ選択を保持
  2321. //v.SaveMsLast();
  2322. }
  2323. }
  2324. catch (Exception e)
  2325. {
  2326. Console.WriteLine("XtMS: 設定画面での例外エラー 状況:{0}\r\n" + e, _WinprocPhase);
  2327. }
  2328. GUI.DragWindow(rc_stgw_caption);
  2329. }
  2330. const int ItemX = 5;
  2331. const int ItemWidth = GUI_WIDTH - 16 - 5;//- 10;
  2332. const int ItemHeight = 20;
  2333. const int ItemDw = 20;
  2334. static string _WinprocPhase = "";
  2335. public static Vector2 EditScroll_cfg = Vector2.zero;
  2336. static int EditScroll_cfg_sizeY = 0;
  2337. static EasyCombo ComboMaster = new EasyCombo("マスターを選択", 0);
  2338. static EasyCombo ComboSlave = new EasyCombo("スレイブを選択", 0);
  2339. static EasyCombo ComboSubMaid = new EasyCombo("サブメイドを選択", -1);
  2340. static EasyCombo ComboSubMaidV = new EasyCombo("サブメイドを選択", -1);
  2341. static EasyCombo ComboVoiceMode = new EasyCombo(VYMModule.VymModule.VoiceMode.オートモード.ToString(), 0);
  2342. static EasyCombo ComboPosLinkBone = new EasyCombo("アタッチ先ボーン", -1);
  2343. static EasyCombo ComboHandTgtBoneR = new EasyCombo("Handアタッチ先ボーン", -1);
  2344. static EasyCombo ComboHandTgtBoneL = new EasyCombo("Handアタッチ先ボーン", -1);
  2345. //static List<ManInfo> mdMasters = new List<ManInfo>();
  2346. //static List<ManInfo> mdSlaves = new List<ManInfo>();
  2347. static List<ManInfo> mdDummyMaidl = new List<ManInfo>();
  2348. //リンク共通設定
  2349. static public class CommonEdit
  2350. {
  2351. private static Dictionary<Maid, float> dicManAlpha = new Dictionary<Maid, float>();
  2352. public static void SaveManAlpha(Maid man, float f)
  2353. {
  2354. if (f >= 0)
  2355. dicManAlpha[man] = f;
  2356. else
  2357. dicManAlpha.Remove(man);
  2358. }
  2359. public static bool LoadManAlpha(Maid man, out float val)
  2360. {
  2361. return dicManAlpha.TryGetValue(man, out val);
  2362. }
  2363. public static void ProcManAlpha(bool needUpdate)
  2364. {
  2365. if (needUpdate || Time.frameCount % 24 == 0) //更新は24フレーム毎
  2366. {
  2367. foreach (var v in dicManAlpha.ToArray())
  2368. {
  2369. if (_MSlinks.Any(link => link.curMaster_ == v.Key
  2370. || (link.maidKeepSlaveYotogi && link.do_master == v.Key))) //どこかのページでマスターしてるか
  2371. {
  2372. if (v.Key && v.Key.Visible)
  2373. SetManAlpha(v.Key, v.Value);
  2374. }
  2375. else
  2376. {
  2377. dicManAlpha.Remove(v.Key);
  2378. }
  2379. }
  2380. }
  2381. }
  2382. public static void ResetAll()
  2383. {
  2384. dicManAlpha.Clear();
  2385. }
  2386. }
  2387. public class MsLinks
  2388. {
  2389. static List<MsLinks> list_ = new List<MsLinks>();
  2390. public int mdMaster_No = -1;
  2391. public int mdSlave_No = -1;
  2392. public bool Scc1_MasterMaid = false;
  2393. public List<ManInfo> mdMasters = new List<ManInfo>();
  2394. public List<ManInfo> mdSlaves = new List<ManInfo>();
  2395. //選択中のキャラクターインスタンス(msリンクがされているかは問わない)
  2396. public Maid curMaster_ { get; private set; } = null;
  2397. public Maid curSlave_ { get; private set; } = null;
  2398. public void FixMaster() { curMaster_ = (mdMaster_No >= 0) ? mdMasters[mdMaster_No].mem : null; }
  2399. public void FixSlave() { curSlave_ = (mdSlave_No >= 0) ? mdSlaves[mdSlave_No].mem : null; }
  2400. public Maid GetMaster()
  2401. {
  2402. return (mdMaster_No >= 0 && mdMasters.Count() > mdMaster_No) ? mdMasters[mdMaster_No].mem : null;
  2403. }
  2404. public Maid GetSlave()
  2405. {
  2406. return (mdSlave_No >= 0 && mdSlaves.Count() > mdSlave_No) ? mdSlaves[mdSlave_No].mem : null;
  2407. }
  2408. public Maid maidKeepSlaveYotogi = null;
  2409. public Maid lastSlaveStacked = null;
  2410. public int num_;
  2411. private BoneLink.BoneLink boneLink;
  2412. //マスク保持用
  2413. public bool holdSlvMask = false;
  2414. public Maid holdSlvMaskMaid = null;
  2415. public HashSet<string> holdSlvMaskItems = new HashSet<string>();
  2416. //透明度保持
  2417. //public float holdManAlpha = -1f;
  2418. public bool CheckSlvMaskSlave(Maid m)
  2419. {
  2420. if (!holdSlvMask)
  2421. return false;
  2422. if (holdSlvMaskMaid != m || holdSlvMaskMaid == null || !m)
  2423. {
  2424. holdSlvMask = false;
  2425. holdSlvMaskMaid = null;
  2426. holdSlvMaskItems.Clear();
  2427. return false;
  2428. }
  2429. return true;
  2430. }
  2431. // アタッチバックアップ用
  2432. public BkupHandsAtc bkupHandTgt = null;
  2433. //public Vector3 chinko_dpos = Vector3.zero;
  2434. private bool doMasterSlave_ = false;
  2435. public bool doMasterSlave
  2436. {
  2437. set
  2438. {
  2439. if (value)
  2440. {
  2441. debugPrintConsole("doMasterSlave set: " + mdMaster_No + " / " + mdSlave_No);
  2442. //情報の保持
  2443. do_master = mdMasters[mdMaster_No].mem;
  2444. do_slave = mdSlaves[mdSlave_No].mem;
  2445. do_masterName = GetMaidName(mdMasters[mdMaster_No]);
  2446. do_slaveName = GetMaidName(mdSlaves[mdSlave_No].mem);
  2447. }
  2448. else if (doMasterSlave_ && do_slave && lastSlaveStacked == do_slave)
  2449. {
  2450. if (cfgs[num_].doIKTargetMHand || cfgs[num_].doCopyIKTarget)
  2451. {
  2452. do_slave.IKTargetClear();
  2453. }
  2454. lastSlaveStacked = null;
  2455. }
  2456. doMasterSlave_ = value;
  2457. }
  2458. get { return doMasterSlave_; }
  2459. }
  2460. public Maid do_master { get; private set; } = null;
  2461. public Maid do_slave { get; private set; } = null;
  2462. public string do_masterName { get; private set; } = string.Empty;
  2463. public string do_slaveName { get; private set; } = string.Empty;
  2464. public keepSlaveInfo keepSI;
  2465. private int MouthMode = 0;
  2466. VymMouthAnime mouthAnime = new VymMouthAnime();
  2467. AnimeState animeState = new AnimeState();
  2468. public bool bVoicePlaying = false;
  2469. public int manuKyoseiZeccho = 0;
  2470. public XtHandMgr.BlendMgr blendHandL = null;
  2471. public XtHandMgr.BlendMgr blendHandR = null;
  2472. public MsLinks()
  2473. {
  2474. num_ = list_.Count;
  2475. list_.Add(this);
  2476. keepSI = new keepSlaveInfo(num_);
  2477. if (num_ == 0)
  2478. {
  2479. //1ページ目だけ選択状態にしておく
  2480. mdMaster_No = 0;
  2481. mdSlave_No = 0;
  2482. }
  2483. boneLink = new BoneLink.BoneLink(num_);
  2484. }
  2485. ~MsLinks()
  2486. {
  2487. //終了時のみのはず
  2488. if (list_.Contains(this))
  2489. list_.Remove(this);
  2490. }
  2491. //表情演出に必要なメイドが揃っているか確認(lateupdate用)
  2492. public bool CheckPlayMaids()
  2493. {
  2494. return (mdSlaves.Count > mdSlave_No) && (mdSlave_No > 0 || !bIsYotogiScene)
  2495. && mdSlaves[0].mem && !mdSlaves[0].mem.boMAN && mdSlaves[mdSlave_No].mem;
  2496. }
  2497. public void Init()
  2498. {
  2499. mdMaster_No = -1;
  2500. mdSlave_No = -1;
  2501. if (num_ == 0)
  2502. {
  2503. //1ページ目だけ選択状態にしておく
  2504. mdMaster_No = 0;
  2505. mdSlave_No = 0;
  2506. }
  2507. curMaster_ = null;
  2508. curSlave_ = null;
  2509. //holdManAlpha = -1f;
  2510. }
  2511. public static void AllReset(bool yotogiReset)
  2512. {
  2513. foreach (var v in list_)
  2514. {
  2515. v.doMasterSlave = false;
  2516. v.lastSlaveStacked = null;
  2517. if (yotogiReset)
  2518. {
  2519. v.maidKeepSlaveYotogi = null;
  2520. }
  2521. v.Init();
  2522. v.holdSlvMask = false;
  2523. v.holdSlvMaskMaid = null;
  2524. v.holdSlvMaskItems.Clear();
  2525. // シーン移動で解除
  2526. cfgs[v.num_].doIKTargetMHandSpCustom = false;
  2527. }
  2528. }
  2529. //キャラクタの増減に追従させる
  2530. //戻り値:継続可?
  2531. public static bool chkMemNo(List<ManInfo> list, ref int list_no, Maid tgt)
  2532. {
  2533. bool bContinue = true;
  2534. if (list_no >= list.Count)
  2535. {
  2536. list_no = -1;
  2537. if (list.Count <= 0)
  2538. return false;
  2539. }
  2540. if (list_no < 0 || tgt != list[list_no].mem)
  2541. {
  2542. for (int i = 0; i < list.Count; i++)
  2543. {
  2544. if (tgt == list[i].mem)
  2545. {
  2546. list_no = i;
  2547. break;
  2548. }
  2549. }
  2550. if (list_no < 0 || tgt != list[list_no].mem)
  2551. {
  2552. list_no = -1;
  2553. #if DEBUG
  2554. debugPrintConsole(GetMaidName(tgt) + " 追跡に失敗");
  2555. #endif
  2556. bContinue = false;
  2557. }
  2558. }
  2559. return bContinue;
  2560. }
  2561. /*
  2562. public void SaveMsLast()
  2563. {
  2564. if (mdMaster_No >= 0 && mdMasters.Count > mdMaster_No)
  2565. {
  2566. preMaster_ = mdMasters[mdMaster_No].mem;
  2567. }
  2568. else
  2569. {
  2570. mdMaster_No = -1;
  2571. preMaster_ = null;
  2572. }
  2573. if (mdSlave_No >= 0 && mdSlaves.Count > mdSlave_No)
  2574. {
  2575. preSlave_ = mdSlaves[mdSlave_No].mem;
  2576. }
  2577. else
  2578. {
  2579. mdSlave_No = -1;
  2580. preSlave_ = null;
  2581. }
  2582. }*/
  2583. /*
  2584. //キャラクター増減時の後処理用
  2585. public static void AllMsUpdateListChanged()
  2586. {
  2587. GetMens();
  2588. GetMaids();
  2589. foreach (var v in _MSlinks)
  2590. {
  2591. v.MsUpdateListChanged(v.preMaster_, v.preSlave_, false);
  2592. }
  2593. }*/
  2594. //cur=選択を維持したいキャラ
  2595. public void MsUpdateListChanged(bool boMasterMaid, Maid man, Maid maid, bool getlist = true)
  2596. {
  2597. Maid master, slave;
  2598. if (boMasterMaid)
  2599. {
  2600. master = maid;
  2601. slave = man;
  2602. }
  2603. else
  2604. {
  2605. master = man;
  2606. slave = maid;
  2607. }
  2608. if (master)
  2609. {
  2610. f(master);
  2611. }
  2612. if (slave)
  2613. {
  2614. f(slave);
  2615. }
  2616. void f(Maid cur)
  2617. {
  2618. if (cur.boMAN)
  2619. {
  2620. if (getlist)
  2621. GetMens();
  2622. if (Scc1_MasterMaid)
  2623. MsLinks.chkMemNo(_MensList, ref this.mdSlave_No, cur);
  2624. else
  2625. MsLinks.chkMemNo(_MensList, ref this.mdMaster_No, cur);
  2626. }
  2627. else
  2628. {
  2629. if (getlist)
  2630. GetMaids();
  2631. if (!Scc1_MasterMaid)
  2632. MsLinks.chkMemNo(_MaidList, ref this.mdSlave_No, cur);
  2633. else
  2634. MsLinks.chkMemNo(_MaidList, ref this.mdMaster_No, cur);
  2635. }
  2636. }
  2637. if (getlist)
  2638. {
  2639. if (Scc1_MasterMaid)
  2640. {
  2641. mdMasters = _MaidList;
  2642. mdSlaves = _MensList;
  2643. }
  2644. else
  2645. {
  2646. mdMasters = _MensList;
  2647. mdSlaves = _MaidList;
  2648. }
  2649. }
  2650. if (master)
  2651. {
  2652. FixMaster();
  2653. }
  2654. if (slave)
  2655. {
  2656. FixSlave();
  2657. }
  2658. //SaveMsLast();
  2659. //MsUpdate();
  2660. }
  2661. public bool MsUpdate(bool midcheck, bool fixMS)
  2662. {
  2663. bool linkok = true;
  2664. if (Scc1_MasterMaid)
  2665. {
  2666. mdMasters = _MaidList;
  2667. mdSlaves = _MensList;
  2668. }
  2669. else
  2670. {
  2671. mdMasters = _MensList;
  2672. mdSlaves = _MaidList;
  2673. }
  2674. if (mdMaster_No < 0)
  2675. {
  2676. doMasterSlave = false;
  2677. //return;
  2678. }
  2679. else if (mdMaster_No >= mdMasters.Count)
  2680. {
  2681. mdMaster_No = mdMasters.Count - 1;
  2682. if (mdMaster_No < 0)
  2683. {
  2684. mdMaster_No = -1;
  2685. doMasterSlave = false;
  2686. }
  2687. else
  2688. {
  2689. MsUpdate2();
  2690. }
  2691. //doMasterSlave = false;
  2692. }
  2693. if (mdSlave_No < 0)
  2694. {
  2695. doMasterSlave = false;
  2696. //return;
  2697. }
  2698. else if (mdSlave_No >= mdSlaves.Count)
  2699. {
  2700. mdSlave_No = mdSlaves.Count - 1;
  2701. if (mdSlave_No < 0)
  2702. {
  2703. mdSlave_No = -1;
  2704. doMasterSlave = false;
  2705. }
  2706. else
  2707. {
  2708. MsUpdate2();
  2709. }
  2710. //doMasterSlave = false;
  2711. }
  2712. /*未選択許容にしたので不要に
  2713. * if (mdMaster_No < 0)
  2714. mdMaster_No = 0;
  2715. if (mdSlave_No < 0)
  2716. mdSlave_No = 0;*/
  2717. if (mdMaster_No < 0 || mdSlave_No < 0)
  2718. {
  2719. linkok = false;
  2720. }
  2721. //キャラクター変更時の選択解除
  2722. if (midcheck)
  2723. {
  2724. if (mdMaster_No >= 0)
  2725. {
  2726. if (curMaster_ != null && mdMasters[mdMaster_No].mem != curMaster_)
  2727. {
  2728. //もう一度探す
  2729. if (!MsLinks.chkMemNo(mdMasters, ref this.mdMaster_No, curMaster_))
  2730. {
  2731. linkok = false;
  2732. mdMaster_No = -1;
  2733. curMaster_ = null;
  2734. }
  2735. }
  2736. }
  2737. if (mdSlave_No >= 0)
  2738. {
  2739. if (curSlave_ != null && mdSlaves[mdSlave_No].mem != curSlave_)
  2740. {
  2741. //もう一度探す
  2742. if (!MsLinks.chkMemNo(mdSlaves, ref this.mdSlave_No, curSlave_))
  2743. {
  2744. linkok = false;
  2745. mdSlave_No = -1;
  2746. curSlave_ = null;
  2747. }
  2748. }
  2749. }
  2750. }
  2751. //変更を保持
  2752. //SaveMsLast();
  2753. if (fixMS)
  2754. {
  2755. FixMaster();
  2756. FixSlave();
  2757. }
  2758. return linkok;
  2759. }
  2760. public void MsUpdate2(bool fixMS = false)
  2761. {
  2762. if (doMasterSlave)
  2763. {
  2764. //選択キャラクターの追従チェック
  2765. bool doflg = true;
  2766. int slaveno_bk = mdSlave_No;
  2767. doflg = chkMemNo(mdMasters, ref mdMaster_No, do_master) && doflg;
  2768. doflg = chkMemNo(mdSlaves, ref mdSlave_No, do_slave) && doflg;
  2769. if (doMasterSlave != doflg)
  2770. {
  2771. doMasterSlave = doflg;
  2772. if (fixMS)
  2773. {
  2774. FixMaster();
  2775. FixSlave();
  2776. }
  2777. }
  2778. if (doMasterSlave && (bIsYotogiScene || vIsKaisouScene) && slaveno_bk != mdSlave_No)
  2779. {
  2780. //繰り上げでカレントメイドになったら止める
  2781. if (mdSlave_No == 0)
  2782. doMasterSlave = false;
  2783. }
  2784. }
  2785. //変更を保持
  2786. //SaveMsLast();
  2787. }
  2788. public void lateUpdate()
  2789. {
  2790. if (!this.doMasterSlave || this.mdSlave_No < 0 || !this.CheckPlayMaids())
  2791. return;
  2792. //debugPrintConsole("LateUpdate2");
  2793. if (cfgs[this.num_].doFaceSync && !this.mdSlaves[0].mem.boMAN && this.mdSlave_No > 0)
  2794. {
  2795. if (this.mdSlaves[0].mem.FaceName3.Contains("オリジナル"))
  2796. {
  2797. //表情同期2
  2798. FaceBlend2Sync(this.mdSlaves[0].mem.body0.Face.morph, this.mdSlaves[this.mdSlave_No].mem.body0.Face.morph, true);
  2799. }
  2800. }
  2801. if (cfgs[this.num_].doVoiceAndFacePlay)
  2802. {
  2803. if (MouthMode != 0) //メイド以外は0以外にならない
  2804. {
  2805. //debugPrintConsole("MouthChange");
  2806. mouthAnime.MouthChange(this.mdSlaves[this.mdSlave_No].mem, MouthMode);
  2807. }
  2808. }
  2809. }
  2810. //メイド単独処理など毎回必ず実行される
  2811. public void inUpdate_HoldMask()
  2812. {
  2813. //#if false //動きがわかりにくくなるのでとりあえず止め?
  2814. if (!this.holdSlvMask)
  2815. return;
  2816. //this.MsUpdate();
  2817. Maid slave = null;
  2818. if (!this.Scc1_MasterMaid && this.mdSlaves.Count > 0 && this.mdSlave_No >= 0)
  2819. slave = this.mdSlaves[this.mdSlave_No].mem;
  2820. if (!slave || slave.boMAN) //null
  2821. return;
  2822. if (slave.IsBusy) //着替え中
  2823. return;
  2824. //マスク保持
  2825. if (this.CheckSlvMaskSlave(slave))
  2826. {
  2827. //debugPrintConsole("holdSlvMask");
  2828. foreach (var item in dicMaskItems)
  2829. {
  2830. if (!this.holdSlvMaskItems.Contains(item.Key))
  2831. {
  2832. continue;
  2833. }
  2834. bool nflg = false;
  2835. bool vflg = false;
  2836. foreach (var v in item.Value)
  2837. {
  2838. vflg |= slave.body0.GetMask(v);
  2839. }
  2840. if (vflg != nflg)
  2841. {
  2842. foreach (var v in item.Value)
  2843. {
  2844. slave.body0.SetMask(v, nflg);
  2845. }
  2846. }
  2847. }
  2848. }// if
  2849. //#endif
  2850. }
  2851. /*
  2852. public void keepManAlpha(Maid tgtman)
  2853. {
  2854. if (this.holdManAlpha >= 0 && (Time.frameCount % 24 == 0 || fioMgr.bUpdateRequest)) //更新は24フレーム毎
  2855. SetManAlpha(tgtman, this.holdManAlpha);
  2856. }
  2857. */
  2858. // 手のアタッチ上書き用
  2859. public void handsAtcpProc()
  2860. {
  2861. var p_mscfg = cfgs[num_];
  2862. if (!p_mscfg.doIKTargetMHandSpCustom)
  2863. return;
  2864. Maid master = (mdMaster_No >= 0 && mdMasters.Count() > mdMaster_No) ? mdMasters[mdMaster_No].mem : null;
  2865. Maid slave = (mdSlave_No >= 0 && mdSlaves.Count() > mdSlave_No) ? mdSlaves[mdSlave_No].mem : null;
  2866. if (!slave || !slave.body0)
  2867. return;
  2868. var p_v3of2 = new v3OffsetsV2(v3ofs[num_], p_mscfg);
  2869. if (p_mscfg.doIKTargetMHandSpR_TgtChar != ATgtChar.None)
  2870. {
  2871. if (IkXT.IsNewIK)
  2872. IkXT.IkClear(slave, new List<string> { "右手" }, p_mscfg/*null, Ik159.GetDefType(p_mscfg)*/);
  2873. Maid tgt = GetHandAtcTgt(true, slave, master, p_mscfg);
  2874. AtccHand1R(slave, tgt, p_mscfg.doIKTargetMHandSpR_TgtBone, p_v3of2.v3HandROffset);
  2875. }
  2876. if (p_mscfg.doIKTargetMHandSpL_TgtChar != ATgtChar.None)
  2877. {
  2878. if (IkXT.IsNewIK)
  2879. IkXT.IkClear(slave, new List<string> { "左手" }, p_mscfg/*null, Ik159.GetDefType(p_mscfg)*/);
  2880. Maid tgt = GetHandAtcTgt(false, slave, master, p_mscfg);
  2881. AtccHand1L(slave, tgt, p_mscfg.doIKTargetMHandSpL_TgtBone, p_v3of2.v3HandLOffset);
  2882. }
  2883. }
  2884. #if false
  2885. bool bkupHandRotR, bkupHandRotL = false;
  2886. Quaternion bkupHandRotRq, bkupHandRotLq;
  2887. IkMini _ikR = new IkMini();
  2888. IkMini _ikL = new IkMini();
  2889. public void setupIkMIni()
  2890. {
  2891. var p_mscfg = cfgs[num_];
  2892. if (!p_mscfg.doIKTargetMHandSpCustom)
  2893. return;
  2894. Maid slave = (mdSlave_No >= 0 && mdSlaves.Count() > mdSlave_No) ? mdSlaves[mdSlave_No].mem : null;
  2895. if (!slave || !slave.body0)
  2896. return;
  2897. string str = "Bip01";
  2898. if (slave.boMAN)
  2899. {
  2900. str = "ManBip";
  2901. }
  2902. var body = slave.body0;
  2903. var trb = slave.body0.m_Bones.transform;
  2904. _ikR.UpperArm = BoneLink.BoneLink.SearchObjName(trb, str + " R UpperArm", true);
  2905. _ikL.UpperArm = BoneLink.BoneLink.SearchObjName(trb, str + " L UpperArm", true);
  2906. _ikR.Forearm = BoneLink.BoneLink.SearchObjName(trb, str + " R Forearm", true);
  2907. _ikL.Forearm = BoneLink.BoneLink.SearchObjName(trb, str + " L Forearm", true);
  2908. _ikR.Hand = BoneLink.BoneLink.SearchObjName(trb, str + " L Hand", true);
  2909. _ikL.Hand = BoneLink.BoneLink.SearchObjName(trb, str + " L Hand", true);
  2910. trb = slave.body0.m_Bones2.transform; // 元の角度
  2911. _ikR.UpperArm2 = BoneLink.BoneLink.SearchObjName(trb, str + " R UpperArm", true);
  2912. _ikL.UpperArm2 = BoneLink.BoneLink.SearchObjName(trb, str + " L UpperArm", true);
  2913. _ikR.Forearm2 = BoneLink.BoneLink.SearchObjName(trb, str + " R Forearm", true);
  2914. _ikL.Forearm2 = BoneLink.BoneLink.SearchObjName(trb, str + " L Forearm", true);
  2915. _ikR.Hand2 = BoneLink.BoneLink.SearchObjName(trb, str + " L Hand", true);
  2916. _ikL.Hand2 = BoneLink.BoneLink.SearchObjName(trb, str + " L Hand", true);
  2917. _ikR.IkPreProc();
  2918. _ikL.IkPreProc();
  2919. }
  2920. class IkMini
  2921. {
  2922. public Transform UpperArm;
  2923. public Transform Forearm;
  2924. public Transform Hand;
  2925. public Transform UpperArm2;
  2926. public Transform Forearm2;
  2927. public Transform Hand2;
  2928. class boneProp
  2929. {
  2930. public Vector3 position;
  2931. public Vector3 localPosision;
  2932. public Quaternion rotation;
  2933. public Quaternion localRotation;
  2934. public void Set(Transform t)
  2935. {
  2936. this.position = t.position;
  2937. this.localPosision = t.localPosition;
  2938. this.rotation = t.rotation;
  2939. this.localRotation = t.localRotation;
  2940. }
  2941. }
  2942. boneProp _kata = new boneProp();
  2943. //boneProp _hiji = new boneProp();
  2944. //boneProp _tekubi = new boneProp();
  2945. public void IkPreProc()
  2946. {
  2947. IkPreProc(this.UpperArm, this.Forearm, this.Hand);
  2948. }
  2949. public void IkPreProc(Transform shoulder, Transform elbow, Transform hand)
  2950. {
  2951. _kata.Set(shoulder);
  2952. //_hiji.Set(elbow);
  2953. //_tekubi.Set(hand);
  2954. }
  2955. public void IkProc(Vector3 tgt, Vector3 vechand_offset)
  2956. {
  2957. IkProc2(this.UpperArm, this.Forearm, this.Hand, tgt, vechand_offset);
  2958. }
  2959. public void IkProc1(Transform shoulder, Transform elbow, Transform hand, Vector3 tgt, Vector3 vechand_offset)
  2960. {
  2961. tgt += hand.rotation * vechand_offset;
  2962. Vector3 tgtv = tgt - _kata.position;
  2963. float tgtd2 = tgtv.sqrMagnitude;
  2964. var b2 = (elbow.position - shoulder.position).sqrMagnitude;
  2965. var c2 = (elbow.position - hand.position).sqrMagnitude;
  2966. if ((hand.position - shoulder.position).sqrMagnitude >= tgtd2)
  2967. {
  2968. // 手が届かない
  2969. elbow.transform.rotation = Quaternion.identity;
  2970. }
  2971. else {
  2972. //float tgtd = Mathf.Sqrt( tgtd2 );
  2973. var b = Mathf.Sqrt(b2);
  2974. var c = Mathf.Sqrt(c2);
  2975. // 肘の角度を求める
  2976. var A = Mathf.Rad2Deg * Mathf.Acos((b2 + c2 - tgtd2) / (2 * b * c));
  2977. elbow.localRotation = Quaternion.Euler(0f, elbow.localRotation.y, A);
  2978. }
  2979. shoulder.transform.rotation = _kata.rotation;
  2980. var vectgt = tgt - hand.position;
  2981. shoulder.rotation = Quaternion.FromToRotation(vectgt.normalized, tgt.normalized) * shoulder.rotation;
  2982. return;
  2983. }
  2984. public void IkProc2(Transform shoulder, Transform elbow, Transform hand, Vector3 tgt, Vector3 vechand_offset)
  2985. {
  2986. //tgt += hand.rotation * vechand_offset;
  2987. tgt += vechand_offset;
  2988. Vector3 tgtv = tgt - shoulder.position;
  2989. float tgtd2 = tgtv.sqrMagnitude;
  2990. float tgtd = Mathf.Sqrt(tgtv.sqrMagnitude);
  2991. var b2 = (elbow.position - shoulder.position).sqrMagnitude;
  2992. var c2 = (elbow.position - hand.position).sqrMagnitude;
  2993. // 手首に合わせて前腕を捻る
  2994. var hiji = Forearm2.localRotation.eulerAngles;
  2995. /*var hiji2 = Forearm2.localRotation.eulerAngles;
  2996. var te = hand.localRotation.eulerAngles;
  2997. var te2 = Hand2.localRotation.eulerAngles;
  2998. hiji.y = (hiji.y - hiji2.y) * 0.5f + (te.y - te2.y) * 0.5f + hiji2.y;
  2999. */
  3000. // 肘ピンから計算
  3001. elbow.localRotation = Quaternion.Euler(hiji.x, hiji.y, 0f);
  3002. if (((hand.position - shoulder.position).sqrMagnitude) <= tgtd2)
  3003. {
  3004. // 手が届かない
  3005. //elbow.transform.rotation = Quaternion.identity;
  3006. //elbow.localRotation = Quaternion.Euler(0f, elbow.localRotation.y, 0f);
  3007. }
  3008. else
  3009. {
  3010. //float tgtd = Mathf.Sqrt( tgtd2 );
  3011. var b = Mathf.Sqrt(b2);
  3012. var c = Mathf.Sqrt(c2);
  3013. // 肘の角度を求める
  3014. var A = Mathf.Rad2Deg * Mathf.Acos((b2 + c2 - tgtd2) / (2 * b * c));
  3015. elbow.localRotation = Quaternion.Euler(hiji.x, hiji.y, A);
  3016. }
  3017. shoulder.localRotation = UpperArm2.localRotation;
  3018. var vechnd = hand.position - shoulder.position;
  3019. shoulder.rotation = Quaternion.FromToRotation(vechnd.normalized, tgtv.normalized) * shoulder.rotation;
  3020. var q = Quaternion.FromToRotation((elbow.position - shoulder.position).normalized, vechnd.normalized) * shoulder.rotation;
  3021. var q1 = Quaternion.Inverse( shoulder.parent.rotation ) * q;
  3022. var q2 = Quaternion.Inverse( shoulder.rotation ) * q;
  3023. #if DEBUG
  3024. _Gizmo_dbg.Visible = true;
  3025. _Gizmo_dbg.transform.rotation = shoulder.rotation;
  3026. _Gizmo_dbg.transform.localRotation = q2;
  3027. _Gizmo_dbg.transform.position = shoulder.position + (vechnd / 2);
  3028. //_Gizmo_dbg.transform.LookAt(elbow, _Gizmo_dbg.transform.up);
  3029. debugPrintConsoleSp(string.Format("q2: {0}, {1}, {2}", q1.eulerAngles.x, q1.eulerAngles.y, q1.eulerAngles.z));
  3030. #endif
  3031. return;
  3032. }
  3033. }
  3034. #endif
  3035. // 手指のブレンド v0030
  3036. public void lateBlendHand()
  3037. {
  3038. Maid slave = (mdSlave_No >= 0 && mdSlaves.Count() > mdSlave_No) ? mdSlaves[mdSlave_No].mem : null;
  3039. if (!slave || !slave.body0)
  3040. return;
  3041. var p_mscfg = cfgs[num_];
  3042. if (p_mscfg.doBlendHandR)
  3043. {
  3044. if (blendHandR == null || blendHandR.maid != slave)
  3045. {
  3046. blendHandR = new XtHandMgr.BlendMgr(slave, true);
  3047. }
  3048. blendHandR.fBlend = p_mscfg.fBlendHandR;
  3049. blendHandR.fOpen = p_mscfg.fBlendHandROpen;
  3050. blendHandR.fGrip = p_mscfg.fBlendHandRGrip;
  3051. blendHandR.animOn = p_mscfg.doAnimeHandR;
  3052. blendHandR.animRange = p_mscfg.fAnimeHandRMove;
  3053. blendHandR.animSpeed = p_mscfg.fAnimeHandRSpeed;
  3054. blendHandR.Apply(p_mscfg.doBlendHandR);
  3055. }
  3056. if (p_mscfg.doBlendHandL)
  3057. {
  3058. if (blendHandL == null || blendHandL.maid != slave)
  3059. {
  3060. blendHandL = new XtHandMgr.BlendMgr(slave, false);
  3061. }
  3062. blendHandL.fBlend = p_mscfg.fBlendHandL;
  3063. blendHandL.fOpen = p_mscfg.fBlendHandLOpen;
  3064. blendHandL.fGrip = p_mscfg.fBlendHandLGrip;
  3065. blendHandL.animOn = p_mscfg.doAnimeHandL;
  3066. blendHandL.animRange = p_mscfg.fAnimeHandLMove;
  3067. blendHandL.animSpeed = p_mscfg.fAnimeHandLSpeed;
  3068. blendHandL.Apply(p_mscfg.doBlendHandL);
  3069. }
  3070. /*足の痙攣テスト
  3071. if (p_mscfg.doAnimeHandR)
  3072. {
  3073. var trTh = BoneLink.BoneLink.SearchObjName(slave.body0.m_trBones.transform, "Bip01 R Thigh", true);
  3074. if (trTh)
  3075. {
  3076. var rot_ = rot.eulerAngles;
  3077. var dx = Mathf.SmoothStep(0, Mathf.Clamp01(p_mscfg.fBlendHandLOpen), UnityEngine.Random.Range(0f, 1f)) * UnityEngine.Random.Range(0, 120f);
  3078. var dy = Mathf.SmoothStep(0, Mathf.Clamp01(p_mscfg.fBlendHandLGrip), UnityEngine.Random.Range(0f, 1f)) * UnityEngine.Random.Range(0, 120f);
  3079. trTh.localRotation = Quaternion.Euler(rot_.x + dx, rot_.y + dy, rot_.z);
  3080. trTh = BoneLink.BoneLink.SearchObjName(slave.body0.m_trBones.transform, "Bip01 L Thigh", true);
  3081. rot_ = trTh.localRotation.eulerAngles;
  3082. trTh.localRotation = Quaternion.Euler(rot_.x - dx, rot_.y - dy, rot_.z);
  3083. slave.body0.AutoTwist();
  3084. }
  3085. }
  3086. if (p_mscfg.doAnimeHandR)
  3087. {
  3088. float paramX = 0; // 痙攣の大きさX
  3089. float paramY = 0; // 痙攣の大きさY
  3090. paramX = p_mscfg.fBlendHandLOpen; // 痙攣の大きさX
  3091. paramY = p_mscfg.fBlendHandLGrip; // 痙攣の大きさY
  3092. var dx = Mathf.SmoothStep(0, Mathf.Clamp01(p_mscfg.fBlendHandLOpen), UnityEngine.Random.Range(0f, 1f)) * UnityEngine.Random.Range(0, 90f);
  3093. var dy = Mathf.SmoothStep(0, Mathf.Clamp01(p_mscfg.fBlendHandLGrip), UnityEngine.Random.Range(0f, 1f)) * UnityEngine.Random.Range(0, 90f);
  3094. var trTh = CMT.SearchObjName(slave.body0.m_trBones.transform, "Bip01 R Thigh", true);
  3095. var rot = trTh.localRotation.eulerAngles;
  3096. trTh.localRotation = Quaternion.Euler(rot.x + dx, rot.y + dy, rot.z);
  3097. trTh = CMT.SearchObjName(slave.body0.m_trBones.transform, "Bip01 L Thigh", true);
  3098. rot = trTh.localRotation.eulerAngles;
  3099. trTh.localRotation = Quaternion.Euler(rot.x - dx, rot.y - dy, rot.z);
  3100. slave.body0.AutoTwist();
  3101. }*/
  3102. }
  3103. public void lateHandsAtcpProc()
  3104. {
  3105. Maid slave = this.GetSlave();
  3106. if (!slave || !slave.body0)
  3107. return;
  3108. if (lateHandsAtcpProc2(slave) && !IsHookAutoTwist)
  3109. {
  3110. #if DEBUG
  3111. if (Input.GetKey(KeyCode.RightAlt))
  3112. slave.body0.AutoTwist();
  3113. #endif
  3114. }
  3115. }
  3116. // 戻り値: ツイスト必要か
  3117. public bool lateHandsAtcpProc2(Maid slave)
  3118. {
  3119. bool needTwist = false;
  3120. //bkupHandRotR = false;
  3121. //bkupHandRotL = false;
  3122. var p_mscfg = cfgs[num_];
  3123. var p_v3of = v3ofs[num_];
  3124. var p_v3of2 = new v3OffsetsV2(v3ofs[num_], p_mscfg);
  3125. Maid master = null;
  3126. if (doMasterSlave)
  3127. master = this.GetMaster();
  3128. if (!p_mscfg.doIKTargetMHandSpCustom)
  3129. {
  3130. if (master && p_mscfg.doIKTargetMHand) // v5.0
  3131. {
  3132. if (!p_mscfg.doIK159NewPointToDef && p_mscfg.doIK159RotateToHands)
  3133. {
  3134. // v5.0 SetHandIKRotate同様のグローバル角度での調整
  3135. Transform trh0 = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, GetHandBnR(master), true);
  3136. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnR(slave), true);
  3137. if (!IsHookActive && !IkXT.IsNewPointIK(slave, "右手") && IkXT._inst.IKCmoUpdate(slave.body0, trh, p_v3of.v3HandROffset, "右手"))
  3138. {
  3139. trh.rotation = trh0.rotation * Quaternion.Euler(p_v3of.v3HandROffsetRot);
  3140. slave.body0.setR_vechand(trh0.rotation * p_v3of.v3HandROffset);
  3141. // IK適用済みのはずなので解除
  3142. slave.body0._ikp().tgtMaidR = null;
  3143. slave.body0._ikp().tgtHandR = null;
  3144. }
  3145. else if (IsHookActive)
  3146. {
  3147. trh.rotation = trh0.rotation * Quaternion.Euler(p_v3of.v3HandROffsetRot);
  3148. slave.body0.setR_vechand(trh0.rotation * p_v3of.v3HandROffset);
  3149. }
  3150. trh0 = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, GetHandBnL(master), true);
  3151. trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnL(slave), true);
  3152. if (!IsHookActive && !IkXT.IsNewPointIK(slave, "左手") && IkXT._inst.IKCmoUpdate(slave.body0, trh, p_v3of.v3HandLOffset, "左手"))
  3153. {
  3154. trh.rotation = trh0.rotation * Quaternion.Euler(p_v3of.v3HandLOffsetRot);
  3155. slave.body0.setL_vechand(trh0.rotation * p_v3of.v3HandLOffset);
  3156. // IK適用済みのはずなので解除
  3157. slave.body0._ikp().tgtMaidL = null;
  3158. slave.body0._ikp().tgtHandL = null;
  3159. }
  3160. else if (IsHookActive)
  3161. {
  3162. trh.rotation = trh0.rotation * Quaternion.Euler(p_v3of.v3HandLOffsetRot);
  3163. slave.body0.setL_vechand(trh0.rotation * p_v3of.v3HandLOffset);
  3164. }
  3165. //slave.body0.AutoTwist();
  3166. needTwist = true;
  3167. }
  3168. }
  3169. return needTwist;
  3170. }
  3171. // ここからカスタムアタッチ
  3172. //debugPrintConsole("cus-1");
  3173. //if (!doMasterSlave || cfgs[num_].doStackSlave_PosSyncMode)
  3174. {
  3175. // v0025 手の角度調整(アタッチ版)
  3176. //if (p_v3of.v3HandROffsetRot != Vector3.zero)
  3177. {
  3178. var ikp = slave.body0._ikp();
  3179. if (p_mscfg.doIKTargetMHandSpR_TgtChar != ATgtChar.None
  3180. && ikp.tgtMaidR && ikp.tgtHandR_AttachSlot >= 0 && !string.IsNullOrEmpty(ikp.tgtHandR_AttachName))
  3181. {
  3182. //debugPrintConsole("cus-2 " + ikp.tgtHandR_AttachSlot + " " + ikp.tgtHandR_AttachName);
  3183. // 右手
  3184. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnR(slave), true);
  3185. //bkupHandRotR = true;
  3186. //bkupHandRotRq = trh.rotation;
  3187. if (p_mscfg.doIKTargetMHandSpCustomAltRotR)
  3188. {
  3189. var iks = slave.body0._ikp();
  3190. //if (true/*iks.tgtHandR_AttachName != string.Empty && slave.body0.goSlot[iks.tgtHandR_AttachSlot].morph != null*/)
  3191. if (iks != null && iks.tgtHandR_AttachSlot >= 0)
  3192. {
  3193. if (iks.tgtMaidR != null && iks.tgtMaidR.body0 != null && iks.tgtMaidR.body0.goSlot[iks.tgtHandR_AttachSlot].morph != null)
  3194. {
  3195. Vector3 vector2;
  3196. Quaternion rotation2;
  3197. iks.tgtMaidR.body0.goSlot[iks.tgtHandR_AttachSlot].morph.GetAttachPoint(iks.tgtHandR_AttachName, out vector2, out rotation2);
  3198. if (p_mscfg.doIKTargetMHandSpCustom_v2 && !p_mscfg.doIK159NewPointToDef)
  3199. {
  3200. if (!IsHookActive && IkXT._inst.IKCmoUpdate(slave.body0, trh, p_v3of2.v3HandROffset, "右手"))
  3201. {
  3202. // IK適用済みのはずなので解除
  3203. slave.body0._ikp().tgtMaidR = null;
  3204. slave.body0._ikp().tgtHandR = null;
  3205. AtccHand1R(slave, null, null, Vector3.zero);
  3206. }
  3207. }
  3208. // アタッチポイント基準角度
  3209. trh.rotation = rotation2 * Quaternion.Euler(p_v3of2.v3HandROffsetRot);
  3210. /*// アタッチポイント基準
  3211. var q0 = rotation2;
  3212. var q1 = q0 * Quaternion.Euler(p_v3of.v3HandROffsetRot);
  3213. q0 = Quaternion.Inverse(trh.parent.rotation) * q0;
  3214. // 目的の角度に
  3215. trh.rotation = q1 * Quaternion.Inverse(q0);
  3216. */
  3217. // IKリミットチェック
  3218. var rm = trh.gameObject.transform.gameObject.GetComponent<RootMotion.FinalIK.RotationLimit>();
  3219. if (rm)
  3220. {
  3221. bool flag;
  3222. var q = rm.GetLimitedLocalRotation(trh.localRotation, out flag);
  3223. if (flag)
  3224. {
  3225. trh.localRotation = q;
  3226. }
  3227. //slave.body0.setR_vechand(trh.rotation * p_v3of.v3HandROffset);
  3228. //slave.body0.setR_vechand(rotation2 * p_v3of.v3HandROffset);
  3229. }
  3230. /*else
  3231. {
  3232. //モーションチェック
  3233. bool motion_stop = true;
  3234. Animation animation = slave.body0.m_Bones.GetComponent<Animation>();
  3235. if (animation != null)
  3236. {
  3237. var anime_state = animation[slave.body0.LastAnimeFN.ToLower()];
  3238. if (anime_state != null && anime_state.length != 0f)
  3239. {
  3240. motion_stop = !anime_state.enabled;
  3241. }
  3242. }
  3243. if (!motion_stop)
  3244. {
  3245. _ikR.IkProc(vector2, rotation2 * p_v3of.v3HandROffset);
  3246. // パラメータ上書き
  3247. //slave.body0.owIkParam(true, trh.rotation * p_v3of.v3HandROffset, _ikR.Forearm.position);
  3248. slave.body0.owIkParam(true, rotation2 * p_v3of.v3HandROffset, _ikR.Forearm.position);
  3249. }
  3250. else
  3251. {
  3252. // モーション停止中は使えない
  3253. //slave.body0.setR_vechand(trh.rotation * p_v3of.v3HandROffset);
  3254. slave.body0.setR_vechand(rotation2 * p_v3of.v3HandROffset);
  3255. }
  3256. }*/
  3257. //slave.body0.setR_vechand(trh.rotation * p_v3of.v3HandROffset);
  3258. // IK補正上書き
  3259. slave.body0.setR_vechand(rotation2 * p_v3of2.v3HandROffset);
  3260. //slave.body0.setR_vechand(rotation2 * p_v3of.v3HandROffset);
  3261. needTwist = true;
  3262. //slave.body0.AutoTwist();
  3263. //if (cfg.HandIKsp_UseVechand)
  3264. // slave.body0.setR_vechand(trh.rotation * p_v3of.v3HandROffset);
  3265. }
  3266. }
  3267. }
  3268. else if (p_mscfg.doIKTargetMHandSpCustom_v2) // v5.0
  3269. {
  3270. var iks = slave.body0._ikp();
  3271. if (iks.tgtMaidR != null && iks.tgtMaidR.body0 != null && iks.tgtMaidR.body0.goSlot[iks.tgtHandR_AttachSlot].morph != null)
  3272. {
  3273. Vector3 vector;
  3274. Quaternion rotation;
  3275. iks.tgtMaidR.body0.goSlot[iks.tgtHandR_AttachSlot].morph.GetAttachPoint(iks.tgtHandR_AttachName, out vector, out rotation);
  3276. if (!p_mscfg.doIK159NewPointToDef)
  3277. {
  3278. if (!IsHookActive && IkXT._inst.IKCmoUpdate(slave.body0, trh, p_v3of2.v3HandROffset, "右手"))
  3279. {
  3280. // IK適用済みのはずなので解除
  3281. slave.body0._ikp().tgtMaidR = null;
  3282. slave.body0._ikp().tgtHandR = null;
  3283. AtccHand1R(slave, null, null, Vector3.zero);
  3284. }
  3285. }
  3286. trh.LookAt(vector, trh.transform.parent.up);
  3287. //trh.LookAt(vector, trh.transform.parent.position - trh.transform.position);
  3288. trh.rotation *= Quaternion.Euler(p_v3of2.v3HandROffsetRot);
  3289. /*if (!p_mscfg.doIK159NewPointToDef)
  3290. slave.body0.setR_vechand(trh.rotation * p_v3of.v3HandROffset);*/
  3291. //slave.body0.AutoTwist();
  3292. needTwist = true;
  3293. }
  3294. }
  3295. else if (doMasterSlave && p_mscfg.doIK159NewPointToDef && p_mscfg.doIK159RotateToHands) // v5.0
  3296. {
  3297. trh.localRotation *= Quaternion.Euler(p_v3of2.v3HandROffsetRot);
  3298. //slave.body0.AutoTwist();
  3299. needTwist = true;
  3300. }
  3301. else if (!doMasterSlave || !cfgs[num_].doStackSlave || !cfgs[num_].doIKTargetMHand) // ボーンリンク中は二重補正になるのでしない
  3302. {
  3303. slave.body0.setR_vechand(trh.rotation * p_v3of2.v3HandROffset);
  3304. trh.localRotation *= Quaternion.Euler(p_v3of2.v3HandROffsetRot);
  3305. // IK補正上書き
  3306. //if (cfg.HandIKsp_UseVechand)
  3307. needTwist = true;
  3308. }
  3309. }
  3310. else if (ikp.tgtHandR && p_mscfg.doIKTargetMHandSpR_TgtChar != ATgtChar.None) // v5.0
  3311. {
  3312. //debugPrintConsole("cus-3");
  3313. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnR(slave), true);
  3314. bool reset = !IsHookActive && IkXT._inst.IKCmoUpdate(slave.body0, trh, p_v3of2.v3HandROffset, "右手");
  3315. if (p_mscfg.doIKTargetMHandSpCustomAltRotR)
  3316. {
  3317. //debugPrintConsole("cus-3a");
  3318. Transform trh0 = ikp.tgtHandR;
  3319. trh.rotation = trh0.rotation * Quaternion.Euler(p_v3of2.v3HandROffsetRot);
  3320. slave.body0.setR_vechand(trh0.rotation * p_v3of2.v3HandROffset);
  3321. }
  3322. else
  3323. {
  3324. slave.body0.setR_vechand(trh.rotation * p_v3of2.v3HandROffset);
  3325. trh.localRotation *= Quaternion.Euler(p_v3of2.v3HandROffsetRot);
  3326. }
  3327. needTwist = true;
  3328. if (reset)
  3329. {
  3330. // IK適用済みのはずなので解除
  3331. AtccHand1R(slave, null, null, Vector3.zero);
  3332. }
  3333. }
  3334. else if (IsHookActive && master && p_mscfg.doIKTargetMHand) // v5.0
  3335. {
  3336. Transform trh0 = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, GetHandBnR(master), true);
  3337. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnR(slave), true);
  3338. trh.rotation = trh0.rotation * Quaternion.Euler(p_v3of.v3HandROffsetRot);
  3339. slave.body0.setR_vechand(trh0.rotation * p_v3of.v3HandROffset);
  3340. needTwist = true;
  3341. }
  3342. }
  3343. //if (p_v3of.v3HandLOffsetRot != Vector3.zero)
  3344. {
  3345. var ikp = slave.body0._ikp();
  3346. if (p_mscfg.doIKTargetMHandSpL_TgtChar != ATgtChar.None
  3347. && ikp.tgtMaidL && ikp.tgtHandL_AttachSlot >= 0 && !string.IsNullOrEmpty(ikp.tgtHandL_AttachName))
  3348. {
  3349. // 左手
  3350. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnL(slave), true);
  3351. //bkupHandRotL = true;
  3352. //bkupHandRotLq = trh.rotation;
  3353. if (p_mscfg.doIKTargetMHandSpCustomAltRotL)
  3354. {
  3355. var iks = slave.body0._ikp();
  3356. //if (true/*iks.tgtHandL_AttachName != string.Empty && slave.body0.goSlot[iks.tgtHandL_AttachSlot].morph != null*/)
  3357. if (iks != null && iks.tgtHandL_AttachSlot >= 0)
  3358. {
  3359. if (iks.tgtMaidL != null && iks.tgtMaidL.body0 != null && iks.tgtMaidL.body0.goSlot[iks.tgtHandL_AttachSlot].morph != null)
  3360. {
  3361. Vector3 vector;
  3362. Quaternion rotation;
  3363. iks.tgtMaidL.body0.goSlot[iks.tgtHandL_AttachSlot].morph.GetAttachPoint(iks.tgtHandL_AttachName, out vector, out rotation);
  3364. if (p_mscfg.doIKTargetMHandSpCustom_v2 && !p_mscfg.doIK159NewPointToDef)
  3365. {
  3366. if (!IsHookActive && IkXT._inst.IKCmoUpdate(slave.body0, trh, p_v3of2.v3HandLOffset, "左手"))
  3367. {
  3368. // IK適用済みのはずなので解除
  3369. slave.body0._ikp().tgtMaidL = null;
  3370. slave.body0._ikp().tgtHandL = null;
  3371. AtccHand1L(slave, null, null, Vector3.zero);
  3372. }
  3373. }
  3374. // アタッチポイント基準角度
  3375. trh.rotation = rotation * Quaternion.Euler(p_v3of2.v3HandLOffsetRot);
  3376. // IKリミットチェック
  3377. var rm = trh.gameObject.transform.gameObject.GetComponent<RootMotion.FinalIK.RotationLimit>();
  3378. if (rm)
  3379. {
  3380. bool flag;
  3381. var q = rm.GetLimitedLocalRotation(trh.localRotation, out flag);
  3382. if (flag)
  3383. {
  3384. trh.localRotation = q;
  3385. }
  3386. }
  3387. // IK補正上書き
  3388. slave.body0.setL_vechand(rotation * p_v3of2.v3HandLOffset);
  3389. //slave.body0.AutoTwist();
  3390. needTwist = true;
  3391. //if (cfg.HandIKsp_UseVechand)
  3392. // slave.body0.setL_vechand(trh.rotation * p_v3of.v3HandLOffset);
  3393. }
  3394. }
  3395. }
  3396. else if (p_mscfg.doIKTargetMHandSpCustom_v2) // v5.0
  3397. {
  3398. var iks = slave.body0._ikp();
  3399. if (iks.tgtMaidL != null && iks.tgtMaidL.body0 != null && iks.tgtMaidL.body0.goSlot[iks.tgtHandL_AttachSlot].morph != null)
  3400. {
  3401. Vector3 vector;
  3402. Quaternion rotation;
  3403. iks.tgtMaidL.body0.goSlot[iks.tgtHandL_AttachSlot].morph.GetAttachPoint(iks.tgtHandL_AttachName, out vector, out rotation);
  3404. if (!p_mscfg.doIK159NewPointToDef)
  3405. {
  3406. if (!IsHookActive && IkXT._inst.IKCmoUpdate(slave.body0, trh, p_v3of2.v3HandLOffset, "左手"))
  3407. {
  3408. // IK適用済みのはずなので解除
  3409. slave.body0._ikp().tgtMaidL = null;
  3410. slave.body0._ikp().tgtHandL = null;
  3411. AtccHand1L(slave, null, null, Vector3.zero);
  3412. }
  3413. }
  3414. trh.LookAt(vector, trh.transform.parent.up);
  3415. //trh.LookAt(vector, trh.transform.parent.position - trh.transform.position);
  3416. trh.rotation *= Quaternion.Euler(p_v3of2.v3HandLOffsetRot);
  3417. /*
  3418. if (!p_mscfg.doIK159NewPointToDef)
  3419. slave.body0.setL_vechand(trh.rotation * p_v3of.v3HandLOffset);*/
  3420. //slave.body0.AutoTwist();
  3421. needTwist = true;
  3422. }
  3423. }
  3424. else if (doMasterSlave && p_mscfg.doIK159NewPointToDef && p_mscfg.doIK159RotateToHands) // v5.0
  3425. {
  3426. trh.localRotation *= Quaternion.Euler(p_v3of2.v3HandLOffsetRot);
  3427. //slave.body0.AutoTwist();
  3428. needTwist = true;
  3429. }
  3430. else if (!doMasterSlave || !cfgs[num_].doStackSlave || !cfgs[num_].doIKTargetMHand) // ボーンリンク中は二重補正になるのでしない
  3431. {
  3432. slave.body0.setL_vechand(trh.rotation * p_v3of2.v3HandLOffset);
  3433. trh.localRotation *= Quaternion.Euler(p_v3of2.v3HandLOffsetRot);
  3434. // IK補正上書き
  3435. //if (cfg.HandIKsp_UseVechand)
  3436. needTwist = true;
  3437. }
  3438. }
  3439. else if (ikp.tgtHandL && p_mscfg.doIKTargetMHandSpL_TgtChar != ATgtChar.None) // v5.0
  3440. {
  3441. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnL(slave), true);
  3442. bool reset = !IsHookActive && IkXT._inst.IKCmoUpdate(slave.body0, trh, p_v3of2.v3HandLOffset, "左手");
  3443. if (p_mscfg.doIKTargetMHandSpCustomAltRotL)
  3444. {
  3445. Transform trh0 = ikp.tgtHandL;
  3446. /*
  3447. Maid tgt = GetHandAtcTgt(true, slave, master, p_mscfg);
  3448. if (tgt && !string.IsNullOrEmpty(p_mscfg.doIKTargetMHandSpL_TgtBone))
  3449. {
  3450. var tgtm = tgt;
  3451. var atcpTgt = p_mscfg.doIKTargetMHandSpL_TgtBone;
  3452. trh0 = BoneLink.BoneLink.SearchObjName(tgtm.body0.m_Bones.transform, atcpTgt.Remove(0, Defines.data.comboBonePrefix.Length), true);
  3453. }*/
  3454. trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnL(slave), true);
  3455. trh.rotation = trh0.rotation * Quaternion.Euler(p_v3of2.v3HandLOffsetRot);
  3456. slave.body0.setL_vechand(trh0.rotation * p_v3of2.v3HandLOffset);
  3457. }
  3458. else
  3459. {
  3460. slave.body0.setL_vechand(trh.rotation * p_v3of2.v3HandLOffset);
  3461. trh.localRotation *= Quaternion.Euler(p_v3of2.v3HandLOffsetRot);
  3462. }
  3463. needTwist = true;
  3464. if (reset)
  3465. {
  3466. // IK適用済みのはずなので解除
  3467. AtccHand1L(slave, null, null, Vector3.zero);
  3468. }
  3469. }
  3470. else if (IsHookActive && master && p_mscfg.doIKTargetMHand)
  3471. {
  3472. Transform trh0 = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, GetHandBnL(master), true);
  3473. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnL(slave), true);
  3474. trh.rotation = trh0.rotation * Quaternion.Euler(p_v3of.v3HandLOffsetRot);
  3475. slave.body0.setL_vechand(trh0.rotation * p_v3of.v3HandLOffset);
  3476. needTwist = true;
  3477. }
  3478. }
  3479. }
  3480. return needTwist;
  3481. }
  3482. /*
  3483. internal void postHandsAtcpProc()
  3484. {
  3485. Maid slave = (mdSlave_No >= 0 && mdSlaves.Count() > mdSlave_No) ? mdSlaves[mdSlave_No].mem : null;
  3486. if (!slave || !slave.body0)
  3487. return;
  3488. debugPrintConsoleSp("復元");
  3489. // 右手
  3490. if (bkupHandRotR)
  3491. {
  3492. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnR(slave), true);
  3493. trh.rotation = bkupHandRotRq;
  3494. }
  3495. // 左手
  3496. if (bkupHandRotL)
  3497. {
  3498. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnL(slave), true);
  3499. trh.rotation = bkupHandRotLq;
  3500. }
  3501. }*/
  3502. //リンク可能な場面のみ
  3503. public void linkProc()
  3504. {
  3505. //更新
  3506. MsUpdate(true, true);
  3507. //現ページのMSコンフィグ
  3508. var cfg_ = cfgs[num_];
  3509. //回想・夜伽モード中のサブメイドキープ
  3510. if (XtMasterSlave.IsKeepScene()/*(vIsKaisouScene || bIsYotogiScene)*/ && maidKeepSlaveYotogi && !Scc1_MasterMaid && cfg_.doKeepSlaveYotogi
  3511. && GameMain.Instance.CharacterMgr.GetMaid(0) != maidKeepSlaveYotogi)
  3512. {
  3513. if (/*maidKeepSlaveKaisou != null && */!doMasterSlave && do_master && do_master.Visible)
  3514. {
  3515. if (mdSlave_No < 0 || mdSlaves[mdSlave_No].mem != maidKeepSlaveYotogi)
  3516. {
  3517. //指定メイドがロードされてなければ読み込み
  3518. bool loaded = false;
  3519. int num = 0;
  3520. foreach (var mt in mdSlaves)
  3521. {
  3522. if (mt.mem == maidKeepSlaveYotogi && mt.mem.Visible)
  3523. {
  3524. loaded = true;
  3525. break;
  3526. }
  3527. num++;
  3528. }
  3529. if (!loaded)
  3530. {
  3531. if (!GameMain.Instance.CharacterMgr.IsBusy() && GameMain.Instance.CharacterMgr.GetMaid(0) != null)
  3532. {
  3533. if (LoadMaid(maidKeepSlaveYotogi))
  3534. {
  3535. debugPrintConsole("きーぷめいどろーど完了・・・@link " + num_ + " mid:" + do_master.GetInstanceID());
  3536. //表情、モーションの初期化(モーション変化検出用)
  3537. if (!bIsYotogiScene) //回想モード対応(夜伽はLoadMaidで変更される)
  3538. maidKeepSlaveYotogi.FaceAnime(VymModule.cfg.sFaceAnimeYotogiDefault, 0f);
  3539. //maidKeepSlaveYotogi.CrossFadeAbsolute("maid_stand01.anm", false, true, false, 0f, 1f); //一応
  3540. this.keepSI.SaveLastInfo(maidKeepSlaveYotogi);
  3541. _StockMaids_Visible.Add(maidKeepSlaveYotogi);
  3542. _YtgKeepMaids_Visible.Add(maidKeepSlaveYotogi);
  3543. }
  3544. else
  3545. {
  3546. Console.WriteLine("XtMasterSlave : サブメイドのロードに失敗しました");
  3547. maidKeepSlaveYotogi = null;
  3548. }
  3549. /*
  3550. GetMaids();
  3551. num = 0;
  3552. foreach (var m in MaidList)
  3553. {
  3554. if (m.mem == maidKeepSlaveKaisou)
  3555. {
  3556. mdSlave_No = num;
  3557. doMasterSlave = true;
  3558. }
  3559. num++;
  3560. }*/
  3561. }
  3562. else
  3563. {
  3564. if (Time.frameCount % 30 == 0) //30フレームに1回表示
  3565. Console.WriteLine("XtMasterSlave : CharacterMgrがBusyのため待機中");
  3566. }
  3567. return;
  3568. }
  3569. else
  3570. {
  3571. if (do_master && do_master.Visible)
  3572. {
  3573. if (mdMaster_No < 0)
  3574. { //マスターを探す
  3575. debugPrintConsole("マスター捜索: " + num_);
  3576. if (chkMemNo(mdMasters, ref mdMaster_No, do_master))
  3577. FixMaster();
  3578. }
  3579. if (mdMaster_No >= 0)
  3580. {
  3581. debugPrintConsole("スレイブセット: " + num_);
  3582. mdSlave_No = num;
  3583. doMasterSlave = true;
  3584. //変更を保持
  3585. //SaveMsLast();
  3586. FixSlave();
  3587. }
  3588. }
  3589. }
  3590. }
  3591. #if DEBUG
  3592. else if (!doMasterSlave)
  3593. {
  3594. if (do_master && !do_master.Visible)
  3595. {
  3596. debugPrintConsole("ますたーみえない・・・@link " + num_ + " mid:" + do_master.GetInstanceID());
  3597. }
  3598. if (_MensList.Count > 1)
  3599. {
  3600. debugPrintConsole("これはだれ?・・・@link " + num_ + " mid1:" + _MensList[1].mem.GetInstanceID());
  3601. }
  3602. if (_MensList.Count > 2)
  3603. {
  3604. debugPrintConsole("これはだれ?・・・@link " + num_ + " mid2:" + _MensList[2].mem.GetInstanceID());
  3605. }
  3606. }
  3607. #endif
  3608. }
  3609. else if (do_master && !do_master.Visible)
  3610. {
  3611. //maidKeepSlaveYotogi.Visible = false;
  3612. if (doMasterSlave || maidKeepSlaveYotogi.Visible)
  3613. {
  3614. debugPrintConsole("ますたーいなくなった・・・@link " + num_ + " mid:" + do_master.GetInstanceID());
  3615. if (maidKeepSlaveYotogi.Visible && !keepSI.CheckMoved(maidKeepSlaveYotogi, num_))
  3616. {
  3617. if (_YtgKeepMaids_Visible.Contains(maidKeepSlaveYotogi))
  3618. {
  3619. Console.WriteLine("Link:{0} Masterが非表示になったため、Slaveを表示解除", num_);
  3620. maidKeepSlaveYotogi.Visible = false; //スレイブキーパーが表示させた場合
  3621. }
  3622. else
  3623. {
  3624. Console.WriteLine("[!] ゲームシステムによる表示変更を検知したためM-Sリンク<" + num_ + ">を中断");
  3625. maidKeepSlaveYotogi = null;
  3626. }
  3627. }
  3628. doMasterSlave = false;
  3629. }
  3630. else if (keepSI.CheckMoved(maidKeepSlaveYotogi, num_))
  3631. {
  3632. //リンク中断?
  3633. if (!maidKeepSlaveYotogi.Visible)
  3634. {
  3635. debugPrintConsole("もどらないと・・・@link " + num_);
  3636. maidKeepSlaveYotogi.Visible = true;
  3637. }
  3638. }
  3639. //mdSlave_No = -1;
  3640. //FixSlave();
  3641. //このまま進むとキープ解除されるので戻る
  3642. return;
  3643. }
  3644. if (keepSI.CheckMoved(maidKeepSlaveYotogi, num_))
  3645. {
  3646. //リンク中断?
  3647. }
  3648. }
  3649. else
  3650. {
  3651. if (maidKeepSlaveYotogi != null)
  3652. maidKeepSlaveYotogi = null;
  3653. }
  3654. //マスタースレイブの更新
  3655. MsUpdate2(true);
  3656. //未選択状態のチェック
  3657. if (mdMaster_No < 0 || mdSlave_No < 0)
  3658. {
  3659. if (doMasterSlave)
  3660. {
  3661. debugPrintConsole("未選択状態 Link解消 " + num_);
  3662. doMasterSlave = false;
  3663. }
  3664. if (maidKeepSlaveYotogi != null)
  3665. {
  3666. debugPrintConsole("未選択状態 Keep解消 " + num_);
  3667. maidKeepSlaveYotogi = null;
  3668. }
  3669. return;
  3670. }
  3671. Maid master = mdMasters[mdMaster_No].mem;
  3672. //if (master)
  3673. // keepManAlpha(master);
  3674. Maid slave = mdSlaves[mdSlave_No].mem;
  3675. if (!master || !slave || !master.body0 || !slave.body0 || !master.body0.m_Bones || !slave.body0.m_Bones)
  3676. return;
  3677. //v0031 局部サイズチェック
  3678. if (master.boMAN)
  3679. FixChinkoScaleInUpdate(master.body0);
  3680. else if (slave.boMAN)
  3681. FixChinkoScaleInUpdate(slave.body0);
  3682. //ボーンリンク実行
  3683. #if DEBUG
  3684. if (!cfg_.doStackSlave_PosSyncMode && !Input.GetKey(KeyCode.U))
  3685. #else
  3686. if (!cfg_.doStackSlave_PosSyncMode)
  3687. #endif
  3688. {
  3689. boneLink.Try(master, slave, doMasterSlave,
  3690. (cfg_.doStackSlave && cfg_.doStackSlave_Pelvis), //骨盤補正
  3691. (cfg_.doStackSlave && cfg_.doStackSlave_CliCnk), //局部補正
  3692. Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffset, //補正座標
  3693. v3ofs[num_], cfg_); //手のアタッチ調整用
  3694. //v3ofs[num_].v3StackOffset2Bip(slave, cfg_.doStackSlave && (cfg_.doStackSlave_Pelvis || cfg_.doStackSlave_CliCnk))); //補正座標
  3695. }
  3696. //else
  3697. // BoneLink.BoneLink.TryPos(master, slave, doMasterSlave, (cfg_.doStackSlave && cfg_.doStackSlave_Pelvis));
  3698. //後処理もあるのでtry後に戻る
  3699. if (!doMasterSlave)
  3700. return;
  3701. //ボイスプレイ
  3702. if (cfg_.doVoiceAndFacePlay && (bIsYotogiScene || (bIsVymPlg && cfg_.doVoiceAndFacePlayOnVYM) || cfg_.doManualVfPlay) && CheckPlayMaids())
  3703. {
  3704. if (!slave.boMAN)
  3705. {
  3706. //Maid vm = mdSlaves[0].mem;
  3707. bool motionChanged;
  3708. var stat = animeState.chk_motion_state(master.body0, false, out motionChanged);
  3709. int iExcite = GetExciteCurMaid();
  3710. if (cfg_.doManualVfPlay)
  3711. {
  3712. iExcite = cfg_.manuVf_iExcite;
  3713. if (this.manuKyoseiZeccho > 0)
  3714. {
  3715. if (slave.AudioMan.audiosource.loop || (!slave.AudioMan.audiosource.loop && !slave.AudioMan.audiosource.isPlaying))
  3716. {
  3717. //音声割り込みタイミングで絶頂させる
  3718. stat = AnimeState.State.zeccho;
  3719. motionChanged = true;
  3720. this.manuKyoseiZeccho--;
  3721. }
  3722. }
  3723. }
  3724. //VYMModule.VymModule.MaidVoicePlay(slave, vm.Param.status.cur_excite, stat, motionChanged, !cfg_.doFaceSync);
  3725. VYMModule.VymModule.MaidVoicePlay(slave, iExcite, stat, motionChanged, !cfg_.doFaceSync, !cfg_.doVoiceDisabled, (!bIsYotogiScene && bIsVymPlg),
  3726. cfg_.doManualVfPlay, cfg_, ref bVoicePlaying);
  3727. MouthMode = 0;
  3728. if (stat == AnimeState.State.kiss)
  3729. {
  3730. MouthMode = 1;//kiss
  3731. //debugPrintConsole("stat = kiss");
  3732. }
  3733. // 絶頂痙攣β
  3734. if (cfg_.doZecchoKeiren && (stat == AnimeState.State.zeccho || this.manuKyoseiZeccho > 0))
  3735. {
  3736. float paramX = cfg_.fZecchoKeirenParam; // 痙攣の大きさX
  3737. //float paramY = cfg_.fZecchoKeirenParam; // 痙攣の大きさY
  3738. var dy = Mathf.SmoothStep(0, Mathf.Clamp01(paramX), UnityEngine.Random.Range(0f, 1f)) * UnityEngine.Random.Range(0, 30f);
  3739. //var dy = Mathf.SmoothStep(0, Mathf.Clamp01(paramY), UnityEngine.Random.Range(0f, 1f)) * UnityEngine.Random.Range(0, 90f);
  3740. var dx = dy / 2;
  3741. var trTh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, "Bip01 R Thigh", true);
  3742. var rot = trTh.localRotation.eulerAngles;
  3743. trTh.localRotation = Quaternion.Euler(rot.x + dx, rot.y + dy, rot.z);
  3744. trTh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, "Bip01 L Thigh", true);
  3745. rot = trTh.localRotation.eulerAngles;
  3746. trTh.localRotation = Quaternion.Euler(rot.x - dx, rot.y - dy, rot.z);
  3747. //不要 v5.0 slave.body0.AutoTwist();
  3748. }
  3749. }
  3750. }
  3751. //表情同期
  3752. if (cfg_.doFaceSync && !slave.boMAN && mdSlave_No > 0)
  3753. {
  3754. slave.FaceAnime(mdSlaves[0].mem.ActiveFace, 1, 0);
  3755. slave.FaceBlend(mdSlaves[0].mem.FaceName3);
  3756. if (mdSlaves[0].mem.FaceName3.Contains("オリジナル"))
  3757. {
  3758. FaceBlend2Sync(mdSlaves[0].mem.body0.Face.morph, mdSlaves[mdSlave_No].mem.body0.Face.morph, false);
  3759. }
  3760. }
  3761. //位置合わせ
  3762. if (cfg_.doStackSlave)
  3763. {
  3764. if (lastSlaveStacked != slave)
  3765. {
  3766. //アタッチの解除
  3767. if (lastSlaveStacked && (cfg_.doIKTargetMHand || cfg_.doCopyIKTarget))
  3768. {
  3769. lastSlaveStacked.IKTargetClear();
  3770. }
  3771. lastSlaveStacked = slave;
  3772. }
  3773. //地面高さ
  3774. if (ComExt.IsCom3d2)
  3775. {
  3776. #if COM3D2
  3777. if (cfg.AdjustBoneHitHeightY)
  3778. {
  3779. //オフセット設定有り
  3780. Transform trFloor;
  3781. if ((vSceneLevel == 15 || vIsKaisouScene || bIsYotogiScene) && (mdSlave_No > 0 && mdSlaves[0].mem && !mdSlaves[0].mem.boMAN))
  3782. {
  3783. //イベントシーンかつカレントメイドが別にいる
  3784. trFloor = mdSlaves[0].mem.body0.m_trFloorPlane;
  3785. }
  3786. else
  3787. {
  3788. trFloor = master.body0.m_trFloorPlane;
  3789. }
  3790. float posY = 0f;
  3791. if (trFloor)
  3792. {
  3793. // COMでのBoneHitHeightY取得処理
  3794. // MANではm_trFloorPlaneがnullの場合もあるぽいのでgetが使えないことがある
  3795. posY = trFloor.position.y;
  3796. }
  3797. if (posY > (master.gameObject.transform.position.y))
  3798. {
  3799. //ソファー対策
  3800. posY = master.gameObject.transform.position.y;
  3801. }
  3802. if (cfg_.Adjust_doHitHeightYOffset)
  3803. {
  3804. //オフセット設定有り
  3805. posY += cfg_.Adjust_HitHeightYOffset;
  3806. }
  3807. slave.body0.SetBoneHitHeightY(posY);
  3808. }
  3809. #endif
  3810. }
  3811. else if (cfg.AdjustBoneHitHeightY)
  3812. {
  3813. slave.body0.SetBoneHitHeightY(master.body0.BoneHitHeightY);
  3814. if ((vSceneLevel == 15 || vIsKaisouScene || bIsYotogiScene) && (mdSlave_No > 0 && mdSlaves[0].mem && !mdSlaves[0].mem.boMAN))
  3815. {
  3816. //イベントシーンかつカレントメイドが別にいる
  3817. slave.body0.BoneHitHeightY = mdSlaves[0].mem.body0.BoneHitHeightY;
  3818. }
  3819. if (slave.body0.BoneHitHeightY > (master.gameObject.transform.position.y))
  3820. {
  3821. //ソファー対策
  3822. //debugPrintConsole("slave.body0.BoneHitHeightY:" + slave.body0.BoneHitHeightY + " > (master.gameObject.transform.position.y:" + master.gameObject.transform.position.y + ")");
  3823. slave.body0.SetBoneHitHeightY(master.gameObject.transform.position.y);
  3824. }
  3825. if (cfg_.Adjust_doHitHeightYOffset)
  3826. {
  3827. //オフセット設定有り
  3828. slave.body0.SetBoneHitHeightY(master.gameObject.transform.position.y + cfg_.Adjust_HitHeightYOffset);
  3829. //debugPrintConsole("slave.body0.BoneHitHeightY:" + slave.body0.BoneHitHeightY + " / (master.gameObject.transform.position.y:" + master.gameObject.transform.position.y + ")");
  3830. }
  3831. }
  3832. // 角度オフセットを位置位置オフセット前に持ってきてみる ver0025
  3833. if (cfg_.doStackSlave_PosSyncMode && cfg_.doStackSlave_PosSyncModeSp && !string.IsNullOrEmpty(cfg_.doStackSlave_PosSyncModeSp_TgtBone))
  3834. {
  3835. //if (cfg_.doStackSlave_PosSyncModeSp && !string.IsNullOrEmpty(cfg_.doStackSlave_PosSyncModeSp_TgtBone))
  3836. {
  3837. // マスターの性転換チェック用
  3838. string[] bnames = master.boMAN ? Defines.data.ManBones : Defines.data.MaidBones;
  3839. if (!bnames.Contains(cfg_.doStackSlave_PosSyncModeSp_TgtBone))
  3840. {
  3841. cfg_.doStackSlave_PosSyncModeSp_TgtBone = string.Empty;
  3842. cfg_.doStackSlave_PosSyncModeSp = false;
  3843. }
  3844. }
  3845. if (cfg_.doStackSlave_PosSyncModeSp)
  3846. {
  3847. //角度オフセット
  3848. Transform slvTr;
  3849. slvTr = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, (cfg_.doStackSlave_PosSyncModeSp_TgtBone), true);
  3850. /*if (cfg_.doStackSlave_CliCnk || cfg_.doStackSlave_Pelvis)
  3851. slave.transform.rotation = slvTr.rotation * Quaternion.Euler(0, -90, -90);
  3852. else*/
  3853. slave.transform.rotation = slvTr.rotation;
  3854. slave.transform.localRotation *= Quaternion.Euler(v3ofs[num_].v3StackOffsetRot);
  3855. }
  3856. }
  3857. else if (cfg_.doStackSlave_PosSyncMode && (cfg_.doStackSlave_CliCnk || cfg_.doStackSlave_Pelvis))
  3858. {
  3859. //slave.gameObject.transform.localRotation = master.gameObject.transform.localRotation;
  3860. //角度オフセット
  3861. Transform slvTr;
  3862. slvTr = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, (!master.boMAN ? "Bip01" : "ManBip"), true);
  3863. //var q = Quaternion.Inverse(master.gameObject.transform.rotation) * slvTr.rotation;
  3864. //slave.gameObject.transform.rotation *= Quaternion.Euler(q * (Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffsetRot));
  3865. slave.transform.rotation = slvTr.rotation * Quaternion.Euler(0, -90, -90);
  3866. slave.transform.localRotation *= Quaternion.Euler(v3ofs[num_].v3StackOffsetRot);
  3867. }
  3868. else if (/*!cfg_.doStackSlave_PosSyncMode && */(cfg_.doStackSlave_CliCnk || cfg_.doStackSlave_Pelvis))
  3869. {
  3870. slave.gameObject.transform.localRotation = master.gameObject.transform.localRotation;
  3871. //角度オフセット
  3872. Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip"), true);
  3873. // bip基準
  3874. //var q = Quaternion.Inverse(slave.transform.rotation) * slvTr.rotation;
  3875. //var q1 = q * Quaternion.Euler((Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffsetRot));
  3876. #if true
  3877. // gizmo基準
  3878. var q = slvTr.rotation * Quaternion.Euler(0, -90, -90);
  3879. var q1 = q * Quaternion.Euler(v3ofs[num_].v3StackOffsetRot);
  3880. q = Quaternion.Inverse(slave.transform.rotation) * q;
  3881. // 目的の角度に
  3882. slave.transform.rotation = q1 * Quaternion.Inverse(q);
  3883. #else
  3884. var q = Quaternion.Inverse(slave.transform.rotation) * slvTr.rotation * Quaternion.Euler(0, -90, -90);
  3885. var q1 = q * Quaternion.Euler(v3ofs[num_].v3StackOffsetRot);
  3886. // 目的の角度に
  3887. slave.transform.localRotation *= q1 * Quaternion.Inverse(q);
  3888. #endif
  3889. //slave.transform.rotation *= Quaternion.Euler(q * (Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffsetRot));
  3890. //slave.transform.localRotation *= Quaternion.Euler(slvTr.localRotation * Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffsetRot);
  3891. //slave.transform.localRotation *= Quaternion.Euler(slave.transform.InverseTransformVector(((slvTr.rotation * Quaternion.Euler(0, -90, -90)) * v3ofs[num_].v3StackOffsetRot)));
  3892. }
  3893. else
  3894. {
  3895. slave.gameObject.transform.localRotation = master.gameObject.transform.localRotation * Quaternion.Euler(v3ofs[num_].v3StackOffsetRot);
  3896. }
  3897. // 位置オフセット
  3898. if (cfg_.doStackSlave_PosSyncMode)
  3899. {
  3900. //位置のみ
  3901. if (!cfg_.doStackSlave_Pelvis && !cfg_.doStackSlave_CliCnk && !cfg_.doStackSlave_PosSyncModeSp)
  3902. {
  3903. //slave.gameObject.transform.localPosition += slave.gameObject.transform.InverseTransformDirection(v3ofs[num_].v3StackOffset);
  3904. slave.SetPos(master.gameObject.transform.localPosition
  3905. + (slave.gameObject.transform.localRotation * v3ofs[num_].v3StackOffset));
  3906. }
  3907. #if true
  3908. else
  3909. {
  3910. Vector3 v3d = Vector3.zero;
  3911. v3d = BoneLink.BoneLink.TryPosSp(master, slave, doMasterSlave,
  3912. (cfg_.doStackSlave && cfg_.doStackSlave_Pelvis), //骨盤補正
  3913. (cfg_.doStackSlave && cfg_.doStackSlave_CliCnk), //局部補正
  3914. cfg_.doStackSlave_PosSyncModeV2,
  3915. cfg_.doStackSlave_PosSyncModeSp ? cfg_.doStackSlave_PosSyncModeSp_TgtBone : null,
  3916. v3ofs[num_].v3StackOffset, v3ofs[num_].v3StackOffsetRot); //補正座標
  3917. //Quaternion.Euler(0, -90, -90) * Quaternion.Euler(v3ofs[num_].v3StackOffsetRot) * v3ofs[num_].v3StackOffset); //補正座標
  3918. //slave.SetPos(master.gameObject.transform.localPosition
  3919. // + slave.gameObject.transform.InverseTransformDirection(v3d));
  3920. slave.SetPos(master.gameObject.transform.localPosition);
  3921. slave.gameObject.transform.position += v3d;
  3922. //slave.SetPos(slave.gameObject.transform.localPosition
  3923. // + (slave.gameObject.transform.localRotation * v3ofs[num_].v3StackOffset));
  3924. /*
  3925. if (v3ofs[num_].v3StackOffset != Vector3.zero)
  3926. {
  3927. Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip"), true);
  3928. slave.gameObject.transform.position += slvTr.TransformDirection(Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffset);
  3929. }*/
  3930. }
  3931. #else
  3932. else
  3933. {
  3934. Vector3 v3d = Vector3.zero;
  3935. v3d = BoneLink.BoneLink.TryPos(master, slave, doMasterSlave,
  3936. (cfg_.doStackSlave && cfg_.doStackSlave_Pelvis), //骨盤補正
  3937. (cfg_.doStackSlave && cfg_.doStackSlave_CliCnk), //局部補正
  3938. Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffset); //補正座標
  3939. //slave.SetPos(master.gameObject.transform.localPosition
  3940. // + slave.gameObject.transform.InverseTransformDirection(v3d));
  3941. slave.SetPos(master.gameObject.transform.localPosition);
  3942. slave.gameObject.transform.position += v3d;
  3943. /*
  3944. if (v3ofs[num_].v3StackOffset != Vector3.zero)
  3945. {
  3946. Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip"), true);
  3947. slave.gameObject.transform.position += slvTr.TransformDirection(Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffset);
  3948. }*/
  3949. }
  3950. #endif
  3951. }
  3952. else
  3953. {
  3954. //通常
  3955. //fix? slave.SetPos(master.gameObject.transform.localPosition + v3ofs[num_].v3StackOffset + v3d);
  3956. if (!cfg_.doStackSlave_Pelvis && !cfg_.doStackSlave_CliCnk)
  3957. {
  3958. //slave.SetPos(master.gameObject.transform.localPosition
  3959. // + slave.gameObject.transform.InverseTransformDirection(v3ofs[num_].v3StackOffset));
  3960. slave.SetPos(master.gameObject.transform.localPosition
  3961. + (slave.gameObject.transform.localRotation * v3ofs[num_].v3StackOffset));
  3962. }
  3963. else
  3964. {
  3965. slave.SetPos(master.gameObject.transform.localPosition);
  3966. }
  3967. }
  3968. //slave.SetRot((master.gameObject.transform.localRotation * Quaternion.Euler(v3StackOffsetRot)).eulerAngles);
  3969. #if OldVer
  3970. if (cfg_.doStackSlave_CliCnk)
  3971. {
  3972. slave.gameObject.transform.localRotation = master.gameObject.transform.localRotation;
  3973. //Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01 Pelvis" : "chinkoCenter"), true);
  3974. Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip"), true);
  3975. slave.gameObject.transform.rotation *= (Quaternion.Euler(slvTr.TransformDirection(Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffsetRot)));
  3976. #if DEBUG
  3977. //debugPrintConsole("Q: " + slvTr.TransformDirection(v3ofs[num_].v3StackOffsetRot));
  3978. #endif
  3979. }
  3980. else if (cfg_.doStackSlave_Pelvis)
  3981. {
  3982. slave.gameObject.transform.localRotation = master.gameObject.transform.localRotation;
  3983. //Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " Pelvis", true);
  3984. Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip"), true);
  3985. slave.gameObject.transform.rotation *= (Quaternion.Euler(slvTr.TransformDirection(Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffsetRot)));
  3986. }
  3987. else
  3988. #endif //#else
  3989. /*if (cfg_.doStackSlave_CliCnk)
  3990. {
  3991. slave.gameObject.transform.localRotation = master.gameObject.transform.localRotation;
  3992. //Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " Pelvis", true);
  3993. Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip"), true);
  3994. slave.gameObject.transform.rotation *= Quaternion.Euler(slave.gameObject.transform.InverseTransformDirection(slvTr.TransformDirection(v3ofs[num_].v3StackOffsetRot)));
  3995. }
  3996. else*/
  3997. #if pre0024
  3998. if (cfg_.doStackSlave_PosSyncMode && (cfg_.doStackSlave_CliCnk || cfg_.doStackSlave_Pelvis))
  3999. {
  4000. //slave.gameObject.transform.localRotation = master.gameObject.transform.localRotation;
  4001. //角度オフセット
  4002. Transform slvTr;
  4003. slvTr = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, (!master.boMAN ? "Bip01" : "ManBip"), true);
  4004. //var q = Quaternion.Inverse(master.gameObject.transform.rotation) * slvTr.rotation;
  4005. //slave.gameObject.transform.rotation *= Quaternion.Euler(q * (Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffsetRot));
  4006. slave.transform.rotation = slvTr.rotation * Quaternion.Euler(0, -90, -90);
  4007. slave.transform.localRotation *= Quaternion.Euler(v3ofs[num_].v3StackOffsetRot);
  4008. }
  4009. else if (/*!cfg_.doStackSlave_PosSyncMode && */(cfg_.doStackSlave_CliCnk || cfg_.doStackSlave_Pelvis))
  4010. {
  4011. slave.gameObject.transform.localRotation = master.gameObject.transform.localRotation;
  4012. //角度オフセット
  4013. Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip"), true);
  4014. // bip基準
  4015. //var q = Quaternion.Inverse(slave.transform.rotation) * slvTr.rotation;
  4016. //var q1 = q * Quaternion.Euler((Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffsetRot));
  4017. #if true
  4018. // gizmo基準
  4019. var q = slvTr.rotation * Quaternion.Euler(0, -90, -90);
  4020. var q1 = q * Quaternion.Euler(v3ofs[num_].v3StackOffsetRot);
  4021. q = Quaternion.Inverse(slave.transform.rotation) * q;
  4022. // 目的の角度に
  4023. slave.transform.rotation = q1 * Quaternion.Inverse(q);
  4024. #else
  4025. var q = Quaternion.Inverse(slave.transform.rotation) * slvTr.rotation * Quaternion.Euler(0, -90, -90);
  4026. var q1 = q * Quaternion.Euler(v3ofs[num_].v3StackOffsetRot);
  4027. // 目的の角度に
  4028. slave.transform.localRotation *= q1 * Quaternion.Inverse(q);
  4029. #endif
  4030. //slave.transform.rotation *= Quaternion.Euler(q * (Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffsetRot));
  4031. //slave.transform.localRotation *= Quaternion.Euler(slvTr.localRotation * Quaternion.Euler(0, -90, -90) * v3ofs[num_].v3StackOffsetRot);
  4032. //slave.transform.localRotation *= Quaternion.Euler(slave.transform.InverseTransformVector(((slvTr.rotation * Quaternion.Euler(0, -90, -90)) * v3ofs[num_].v3StackOffsetRot)));
  4033. }
  4034. else
  4035. //#endif
  4036. {
  4037. slave.gameObject.transform.localRotation = master.gameObject.transform.localRotation * Quaternion.Euler(v3ofs[num_].v3StackOffsetRot);
  4038. }
  4039. #endif
  4040. // IK初期化
  4041. if (IkXT.IsNewIK)
  4042. {
  4043. IkXT.IkClear(slave, cfg_);
  4044. }
  4045. if (doMasterSlave && cfg_.doCopyIKTarget)
  4046. {
  4047. // 1.59 IKコピー
  4048. if (IkXT.IsNewIK)
  4049. {
  4050. IkXT.CopyHandIK(master, slave, v3ofs, num_);
  4051. }
  4052. else
  4053. {
  4054. //Maid.IKTargetToAttachPointより
  4055. //if (slave.body0.tgtHandL_AttachName != master.body0.tgtHandL_AttachName)
  4056. {
  4057. slave.body0._ikp().tgtMaidL = master.body0._ikp().tgtMaidL;
  4058. slave.body0._ikp().tgtHandL_AttachSlot = master.body0._ikp().tgtHandL_AttachSlot;
  4059. slave.body0._ikp().tgtHandL_AttachName = master.body0._ikp().tgtHandL_AttachName;
  4060. slave.body0._ikp().tgtHandL = master.body0._ikp().tgtHandL;
  4061. slave.body0._ikp().tgtHandL_offset = master.body0._ikp().tgtHandL_offset;
  4062. }
  4063. //if (slave.body0.tgtHandR_AttachName != master.body0.tgtHandR_AttachName)
  4064. {
  4065. slave.body0._ikp().tgtMaidR = master.body0._ikp().tgtMaidR;
  4066. slave.body0._ikp().tgtHandR_AttachSlot = master.body0._ikp().tgtHandR_AttachSlot;
  4067. slave.body0._ikp().tgtHandR_AttachName = master.body0._ikp().tgtHandR_AttachName;
  4068. slave.body0._ikp().tgtHandR = master.body0._ikp().tgtHandR;
  4069. slave.body0._ikp().tgtHandR_offset = master.body0._ikp().tgtHandR_offset;
  4070. }
  4071. }
  4072. if (cfg_.doIKTargetMHand)
  4073. {
  4074. if (string.IsNullOrEmpty(slave.body0._ikp().tgtHandR_AttachName) && slave.body0._ikp().tgtHandR == null)
  4075. {
  4076. if (!cfg_.chkIkSpCustomR_v2())
  4077. AtccHand2HandR2(master, slave, v3ofs[num_].v3HandROffset, v3ofs[num_].v3HandROffsetRot, cfg_);
  4078. }
  4079. if (string.IsNullOrEmpty(slave.body0._ikp().tgtHandL_AttachName) && slave.body0._ikp().tgtHandL == null)
  4080. {
  4081. if (!cfg_.chkIkSpCustomL_v2())
  4082. AtccHand2HandL2(master, slave, v3ofs[num_].v3HandLOffset, v3ofs[num_].v3HandLOffsetRot, cfg_);
  4083. }
  4084. }
  4085. }
  4086. else if (doMasterSlave && cfg_.doIKTargetMHand)
  4087. {
  4088. if (!cfg_.chkIkSpCustomL_v2())
  4089. AtccHand2HandL2(master, slave, v3ofs[num_].v3HandLOffset, v3ofs[num_].v3HandLOffsetRot, cfg_);
  4090. if (!cfg_.chkIkSpCustomR_v2())
  4091. AtccHand2HandR2(master, slave, v3ofs[num_].v3HandROffset, v3ofs[num_].v3HandROffsetRot, cfg_);
  4092. }
  4093. else
  4094. {
  4095. slave.body0._ikp().tgtHandL_AttachName = string.Empty;
  4096. slave.body0._ikp().tgtHandR_AttachName = string.Empty;
  4097. slave.body0._ikp().tgtHandL = null;
  4098. slave.body0._ikp().tgtHandR = null;
  4099. }
  4100. }
  4101. else
  4102. {
  4103. if (lastSlaveStacked)
  4104. {
  4105. //アタッチの解除
  4106. if (lastSlaveStacked && (cfg_.doIKTargetMHand || cfg_.doCopyIKTarget))
  4107. {
  4108. lastSlaveStacked.IKTargetClear();
  4109. }
  4110. lastSlaveStacked = null;
  4111. }
  4112. }
  4113. //最終値の保持
  4114. if (maidKeepSlaveYotogi)
  4115. keepSI.SaveLastInfo(maidKeepSlaveYotogi);
  4116. //SaveMsLast();
  4117. }
  4118. private int GetExciteCurMaid()
  4119. {
  4120. if (bIsYotogiScene)
  4121. {
  4122. Maid vm = mdSlaves[0].mem;
  4123. return vm.XtParam().status.cur_excite;
  4124. }
  4125. else if (bIsVymPlg)
  4126. {
  4127. int elv = obj2int(VYM.API.GetVYM_Value(VYM.API.VYM_IO_ID.i_vExciteLevel));
  4128. // 興奮度の判定(しきい値を合わせるためにLv→興奮度に変換する)
  4129. int ext = 0;
  4130. switch (elv)
  4131. {
  4132. case 1:
  4133. ext = 0;
  4134. break;
  4135. case 2:
  4136. ext = VYMModule.VymModule.cfg.vExciteLevelThresholdV1 + 1;
  4137. break;
  4138. case 3:
  4139. ext = VYMModule.VymModule.cfg.vExciteLevelThresholdV2 + 1;
  4140. break;
  4141. case 4:
  4142. ext = VYMModule.VymModule.cfg.vExciteLevelThresholdV3 + 1;
  4143. break;
  4144. }
  4145. if (ext > 300)
  4146. ext = 300;
  4147. return ext;
  4148. }
  4149. return 0;
  4150. }
  4151. private bool msCheck(Maid master, Maid slave)
  4152. {
  4153. return msCheck(master, slave, 0);
  4154. }
  4155. private bool msCheck(Maid master, Maid me, int count)
  4156. {
  4157. if (count > MAX_PAGENUM * 2)
  4158. {
  4159. debugPrintConsole("ターン" + count + " もう…ダメなのね…");
  4160. return true;
  4161. }
  4162. for (int i = 0; i < _MSlinks.Length; i++)
  4163. {
  4164. var m = _MSlinks[i];
  4165. if (m == this)
  4166. continue; //自分は無視
  4167. if (m.doMasterSlave)
  4168. {
  4169. //別のカップルを発見
  4170. //debugPrintConsole("ターン" + count + " カップル発見 Link" + i);
  4171. if (m.mdSlaves[m.mdSlave_No].mem == master)
  4172. {
  4173. //よそではマスターがスレイブだった…
  4174. debugPrintConsole("ターン" + count + " !?マスターがそんな…" + i);
  4175. if (m.mdMasters[m.mdMaster_No].mem == me)
  4176. {
  4177. //主従逆転…ワタシがマスター?
  4178. debugPrintConsole("orz...");
  4179. return true;
  4180. }
  4181. else
  4182. {
  4183. //調査続行
  4184. if (msCheck(m.mdMasters[m.mdMaster_No].mem, me, count + 1))
  4185. return true;
  4186. }
  4187. }
  4188. }
  4189. }
  4190. //イベント不発
  4191. return false;
  4192. }
  4193. //ループになるリンクをチェックする
  4194. public bool testLoopLink()
  4195. {
  4196. if (doMasterSlave)
  4197. return false; //実行中なら無視
  4198. return msCheck(mdMasters[mdMaster_No].mem, mdSlaves[mdSlave_No].mem);
  4199. }
  4200. //重複リンクをチェックする
  4201. public bool testSlaved(Maid test, out int slot)
  4202. {
  4203. slot = -1;
  4204. if (test == null)
  4205. {
  4206. test = mdSlaves[mdSlave_No].mem;
  4207. }
  4208. for (int i = 0; i < _MSlinks.Length; i++)
  4209. {
  4210. var m = _MSlinks[i];
  4211. if (m == this)
  4212. continue; //自分は無視
  4213. if (m.mdSlave_No >= 0 && m.mdSlaves[m.mdSlave_No].mem == test)
  4214. {
  4215. slot = m.num_ + 1;
  4216. return true;
  4217. }
  4218. }
  4219. return false;
  4220. }
  4221. //重複リンクをチェックする
  4222. public bool testOverlapedLink(Maid me = null)
  4223. {
  4224. //リンク実行前チェック
  4225. if (doMasterSlave)
  4226. return false;
  4227. if (me == null)
  4228. {
  4229. me = mdSlaves[mdSlave_No].mem;
  4230. }
  4231. for (int i = 0; i < _MSlinks.Length; i++)
  4232. {
  4233. var m = _MSlinks[i];
  4234. if (m == this)
  4235. continue; //自分は無視
  4236. if (m.doMasterSlave)
  4237. {
  4238. //別のカップルを発見
  4239. if (m.mdSlaves[m.mdSlave_No].mem == me)
  4240. {
  4241. //Slaveの重複を検出
  4242. return true;
  4243. /*
  4244. if (m.mdMasters[m.mdMaster_No].mem == mdMasters[mdMaster_No].mem)
  4245. {
  4246. //重複を検出
  4247. return true;
  4248. }*/
  4249. }
  4250. }
  4251. }
  4252. return false;
  4253. }
  4254. }
  4255. static MsLinks[] _MSlinks = new MsLinks[MAX_PAGENUM] { new MsLinks(), new MsLinks(), new MsLinks(), new MsLinks(), new MsLinks() };
  4256. string getMSState(Maid MaidOrMan)
  4257. {
  4258. string state = string.Empty;
  4259. for (int i = 0; i < _MSlinks.Length; i++)
  4260. {
  4261. var m = _MSlinks[i];
  4262. if (m.doMasterSlave)
  4263. {
  4264. if (m.mdMasters[m.mdMaster_No].mem == MaidOrMan)
  4265. {
  4266. state = state + "*m" + (i + 1);
  4267. }
  4268. if (m.mdSlaves[m.mdSlave_No].mem == MaidOrMan)
  4269. {
  4270. state = state + "*s" + (i + 1);
  4271. }
  4272. }
  4273. }
  4274. if (state.Length > 0)
  4275. state = " " + state;
  4276. return state;
  4277. }
  4278. void showSlidersHint()
  4279. {
  4280. if (cfg.DlgShow_Hint001)
  4281. {
  4282. var msg = "【ヒント】\r\nスライダー上の「<」「>」ボタンは、キーボードのCtrlを押しながらで100倍、" +
  4283. "Shiftを押しながらで0.1倍、Ctrl+Shift同時押しで10倍に変化量が変わります。\r\n" +
  4284. "微調整などにご使用下さい。\r\n" +
  4285. "一部、スライダーの限界値を超えて設定可能な項目もあります。\r\n\r\n" +
  4286. "次回以降、このヒントを表示しない?\r\n" +
  4287. "(次回起動時からも非表示にするには、設定保存が必要です)";
  4288. var ret = NUty.WinMessageBox(NUty.GetWindowHandle(), msg, "( i )", NUty.MSGBOX.MB_YESNO | NUty.MSGBOX.MB_ICONINFORMATION);
  4289. if (ret == (int)System.Windows.Forms.DialogResult.Yes)
  4290. {
  4291. cfg.DlgShow_Hint001 = false;
  4292. }
  4293. }
  4294. }
  4295. void showHintMsg(string msg)
  4296. {
  4297. NUty.WinMessageBox(NUty.GetWindowHandle(), msg, "( i )", NUty.MSGBOX.MB_OK | NUty.MSGBOX.MB_ICONINFORMATION);
  4298. }
  4299. //ページ
  4300. static int _pageNum = 0;
  4301. //表示関係
  4302. bool showPosSlider = false;
  4303. bool showPosSliderHand = false;
  4304. bool showPosSliderHandR = true;
  4305. bool showChinkoSlider = false;
  4306. bool showSlaveEyeToTgt = false;
  4307. bool showVymPlaySet = false;
  4308. int showWndMode = 0;
  4309. bool showWndMin = false;
  4310. bool showWndMinHide = false;
  4311. bool showSubMens = false;
  4312. bool showSlvMask = false;
  4313. // 手のアタッチカスタム
  4314. //bool showHandsToTgt = false;
  4315. bool showHandTTPosSlider = false;
  4316. float hsldPreHeight = 0f;
  4317. GUIStyle gsLabel = new GUIStyle("label");
  4318. GUIStyle gsButton = new GUIStyle("button");
  4319. GUIStyle gsToggle = new GUIStyle("toggle");
  4320. GUIStyle gsText = new GUIStyle("textfield");
  4321. GUIStyle gsTextAr = new GUIStyle("textArea");
  4322. GUIStyle gsCombo = new GUIStyle("button");
  4323. void WindowCallback_proc(int id)
  4324. {
  4325. _WinprocPhase = "[start]";
  4326. bool SlaveRusubanMode = false; //マスター待機モード
  4327. //bool boChrCng = false;
  4328. MsLinks ms_ = _MSlinks[_pageNum];
  4329. //ms_.MsUpdate(true, true); //リンクをチェック->前メソッドに移動
  4330. _WinprocPhase = "[init]";
  4331. //GUIStyle gsLabel = new GUIStyle("label");
  4332. gsLabel.fontSize = 12;
  4333. gsLabel.alignment = TextAnchor.MiddleLeft;
  4334. //GUIStyle gsButton = new GUIStyle("button");
  4335. gsButton.fontSize = 12;
  4336. gsButton.alignment = TextAnchor.MiddleCenter;
  4337. //GUIStyle gsToggle = new GUIStyle("toggle");
  4338. gsToggle.fontSize = 12;
  4339. gsToggle.alignment = TextAnchor.MiddleLeft;
  4340. //GUIStyle gsText = new GUIStyle("textfield");
  4341. gsText.fontSize = 12;
  4342. gsText.alignment = TextAnchor.UpperLeft;
  4343. //GUIStyle gsTextAr = new GUIStyle("textArea");
  4344. gsTextAr.fontSize = 12;
  4345. gsTextAr.alignment = TextAnchor.UpperLeft;
  4346. gsTextAr.wordWrap = true;
  4347. //GUIStyle gsCombo = new GUIStyle("button");
  4348. gsCombo.fontSize = 12;
  4349. gsCombo.alignment = TextAnchor.MiddleLeft;
  4350. gsCombo.hover.textColor = Color.cyan;
  4351. gsCombo.onHover.textColor = Color.cyan;
  4352. gsCombo.onActive.textColor = Color.cyan;
  4353. //GUIStyle gsScView = new GUIStyle("scrollView");
  4354. _WinprocPhase = "[ctrl-1]";
  4355. GUI.enabled = true;
  4356. if (GUI.Button(new Rect(240, 0, 20, 20), "x", gsButton))
  4357. {
  4358. GizmoVisible(false);
  4359. GizmoHsVisible(false);
  4360. CloseAllCombos();
  4361. GuiFlag = false;
  4362. return;
  4363. }
  4364. if (GUI.Button(new Rect(240 - 90, 0, 20, 20), (showWndMin ? "▼" : "▽"), gsButton))
  4365. {
  4366. showWndMin = !showWndMin;
  4367. if (showWndMin)
  4368. {
  4369. //GizmoVisible(false);
  4370. GizmoHsVisible(false);
  4371. }
  4372. }
  4373. //GUI.enabled = true;
  4374. if (showWndMode == 1)
  4375. GUI.enabled = false;
  4376. if (GUI.Button(new Rect(240 - 70, 0, 20, 20), "-", gsButton))
  4377. {
  4378. showWndMode = 1;
  4379. }
  4380. GUI.enabled = true;
  4381. if (showWndMode == 2)
  4382. GUI.enabled = false;
  4383. if (GUI.Button(new Rect(240 - 50, 0, 20, 20), "=", gsButton))
  4384. {
  4385. showWndMode = 2;
  4386. }
  4387. GUI.enabled = true;
  4388. if (showWndMode == 0)
  4389. GUI.enabled = false;
  4390. if (GUI.Button(new Rect(240 - 30, 0, 20, 20), "□", gsButton))
  4391. {
  4392. showWndMode = 0;
  4393. }
  4394. GUI.enabled = true;
  4395. //最小化時
  4396. if (showWndMin && showWndMinHide)
  4397. {
  4398. if (showWndMin)
  4399. {
  4400. //GizmoVisible(false);
  4401. GizmoHsVisible(false); //手ギズモは危険物なので消す
  4402. }
  4403. //位置ギズモだけは処理
  4404. if (ms_.doMasterSlave)
  4405. PosGizmoProc(ms_);
  4406. else
  4407. GizmoVisible(false);
  4408. return;
  4409. }
  4410. EditScroll_cfg = GUI.BeginScrollView(new Rect(0, 20, GUI_WIDTH, GUI_HIGHT - 30), EditScroll_cfg, new Rect(0, 0, GUI_WIDTH - 16, EditScroll_cfg_sizeY));
  4411. try
  4412. {
  4413. MsLinkConfig p_mscfg = cfgs[_pageNum];
  4414. v3Offsets p_v3of = v3ofs[_pageNum];
  4415. int pos_y = 0;
  4416. if (_MensList.Count <= 0)
  4417. GUI.Label(new Rect(5, pos_y, 200, ItemHeight), "【Master-Slave無効中】", gsLabel);
  4418. else
  4419. GUI.Label(new Rect(5, pos_y, 200, ItemHeight), "【Master-Slave切替】", gsLabel);
  4420. GUI.Label(new Rect(5 + ItemWidth - 25 - 35 - 35, pos_y, 25, ItemHeight), "設定", gsLabel);
  4421. if (GUI.Button(new Rect(5 + ItemWidth - 35 - 35, pos_y, 35 * 2, 20), "保存/読込", gsButton))
  4422. {
  4423. // Iniファイル設定画面へ
  4424. XtMs2ndWnd.Init();
  4425. XtMs2ndWnd.boShow = true;
  4426. GizmoVisible(false);
  4427. GizmoHsVisible(false);
  4428. }
  4429. /*
  4430. if (GUI.Button(new Rect(5 + ItemWidth - 35 - 35, pos_y, 35, 20), "保存", gsButton))
  4431. {
  4432. // Iniファイル書き出し
  4433. SaveMyConfigs();
  4434. }
  4435. if (GUI.Button(new Rect(5 + ItemWidth - 35, pos_y, 35, 20), "読込", gsButton))
  4436. {
  4437. // Iniファイル読み出し
  4438. LoadMyConfigs();
  4439. }*/
  4440. if (ms_.maidKeepSlaveYotogi)
  4441. {
  4442. GUI.enabled = false;
  4443. GUI.Label(new Rect(ItemX, pos_y += ItemHeight, ItemWidth, ItemHeight), "夜伽Slave-Keeper 作動中", gsButton);
  4444. GUI.enabled = true;
  4445. }
  4446. else
  4447. {
  4448. if (_MensList.Count <= 0)
  4449. { //男性不在
  4450. ms_.Scc1_MasterMaid = false;
  4451. GizmoVisible(false);
  4452. GizmoHsVisible(false);
  4453. }
  4454. else
  4455. {
  4456. //マスターモード選択
  4457. if (!ms_.Scc1_MasterMaid)
  4458. {
  4459. GUI.enabled = false;
  4460. }
  4461. if (GUI.Button(new Rect(ItemX, pos_y += ItemHeight, ItemWidth / 2, ItemHeight), "Man⇒Maid", gsButton))
  4462. {
  4463. // モード変更
  4464. MsUtil.ChangeMsMode(_pageNum, false);
  4465. }
  4466. GUI.enabled = true;
  4467. if (ms_.Scc1_MasterMaid)
  4468. {
  4469. GUI.enabled = false;
  4470. }
  4471. if (GUI.Button(new Rect(ItemX + ItemWidth / 2, pos_y, ItemWidth / 2, ItemHeight), "Maid⇒Man", gsButton))
  4472. {
  4473. // モード変更
  4474. MsUtil.ChangeMsMode(_pageNum, true);
  4475. }
  4476. GUI.enabled = true;
  4477. }
  4478. //更新
  4479. ms_.MsUpdate(false, true);
  4480. }
  4481. //ページ選択
  4482. _WinprocPhase = "[page-sel]";
  4483. pos_y += ItemHeight;
  4484. int oldPageNum = _pageNum;
  4485. //GUI.Label(new Rect(5 + ItemWidth - 25 - 35 - 35, pos_y, 25, ItemHeight), "Slot", gsLabel);
  4486. for (int i = 0; i < MAX_PAGENUM; i++)
  4487. {
  4488. if (_pageNum == i)
  4489. GUI.enabled = false;
  4490. Color c = GUI.color;
  4491. if (_MSlinks[i].doMasterSlave)
  4492. GUI.color = Color.yellow;
  4493. else if (_MSlinks[i].maidKeepSlaveYotogi)
  4494. GUI.color = Color.cyan;
  4495. if (GUI.Button(new Rect(ItemX + ItemWidth - (5 + 20 * (MAX_PAGENUM - i)), pos_y, 20, 20), (i + 1).ToString(), gsButton))
  4496. {
  4497. _pageNum = i;
  4498. }
  4499. GUI.color = c;
  4500. GUI.enabled = true;
  4501. }
  4502. /*
  4503. if (GUI.Button(new Rect(ItemX + ItemWidth - (10 + 20 * 5), pos_y, 20, 20), "1", gsButton))
  4504. {
  4505. _pageNum = 0;
  4506. }
  4507. */
  4508. GUI.enabled = true;
  4509. if (_pageNum != oldPageNum)
  4510. {
  4511. //ページ変更有
  4512. p_mscfg = cfgs[_pageNum];
  4513. ms_ = _MSlinks[_pageNum];
  4514. //コンボ閉じる
  4515. CloseAllCombos();
  4516. return;
  4517. }
  4518. if (_MensList.Count <= 0)
  4519. {//男性不在
  4520. ComboMaster.boPop = false;
  4521. ms_.doMasterSlave = false;
  4522. ms_.Scc1_MasterMaid = false;
  4523. }
  4524. Rect rcItem = new Rect(ItemX, pos_y/* += ItemHeight*/, ItemWidth, ItemHeight);
  4525. if (ms_.maidKeepSlaveYotogi)
  4526. {
  4527. _WinprocPhase = "[keeperview]";
  4528. GUI.Label(rcItem, "【Master】 (リンク元)", gsLabel);
  4529. rcItem.y += ItemHeight;
  4530. GUI.Label(rcItem, (!ms_.do_master || !ms_.do_master.Visible ? " [待機中]" : " [⇔]") + " " + ms_.do_masterName, gsText);
  4531. rcItem.y += ItemHeight;
  4532. GUI.Label(rcItem, "【Slave】 (リンク先)", gsLabel);
  4533. rcItem.y += ItemHeight;
  4534. GUI.Label(rcItem, (!ms_.do_slave || !ms_.do_slave.Visible ? " [待機中]" : " [⇔]") + " " + ms_.do_slaveName, gsText);
  4535. rcItem.y += ItemHeight;
  4536. GUI.enabled = true;
  4537. if (!ms_.doMasterSlave)
  4538. {
  4539. Color cbk = GUI.color;
  4540. if (ms_.doMasterSlave)
  4541. GUI.color = Color.yellow;
  4542. else
  4543. GUI.color = Color.cyan;
  4544. if (GUI.Button(rcItem, "夜伽Slave-Keeper 解除", gsButton))
  4545. {
  4546. ms_.maidKeepSlaveYotogi = null;
  4547. }
  4548. GUI.color = cbk;
  4549. rcItem.y += ItemHeight;
  4550. }
  4551. }
  4552. else
  4553. {
  4554. _WinprocPhase = "[chr-sel]";
  4555. List<string> m_names;
  4556. if (ms_.mdMasters.Count > 0)
  4557. {
  4558. GUI.Label(rcItem, "【Master】 (リンク元)", gsLabel);
  4559. rcItem.y += ItemHeight;
  4560. string master_name = "未選択";
  4561. if (ms_.mdMaster_No >= 0)
  4562. master_name = GetMaidName(ms_.mdMasters[ms_.mdMaster_No], true) + getMSState(ms_.mdMasters[ms_.mdMaster_No].mem);
  4563. m_names = new List<string>();
  4564. if (ms_.doMasterSlave)
  4565. {
  4566. ComboMaster.boPop = false;
  4567. GUI.enabled = false;
  4568. }
  4569. else
  4570. {
  4571. foreach (var vm in ms_.mdMasters)
  4572. m_names.Add(GetMaidName(vm, true) + getMSState(vm.mem));
  4573. m_names.Add("*** 選択解除 ***");
  4574. }
  4575. if (ComboMaster.Show(rcItem, ItemHeight, ItemHeight * 4, m_names, master_name, gsButton, gsButton))
  4576. {
  4577. int memNum = ms_.mdMaster_No;
  4578. if (ComboMaster.sIndex >= 0)
  4579. {
  4580. memNum = ComboMaster.sIndex;
  4581. }
  4582. MsUtil.SelectMaster(_pageNum, memNum);
  4583. }
  4584. GUI.enabled = true;
  4585. pos_y = (int)rcItem.y + ItemHeight;
  4586. if (ComboMaster.boPop)
  4587. {
  4588. pos_y += ItemHeight * 4;
  4589. }
  4590. }
  4591. _WinprocPhase = "[chr-sel2]";
  4592. rcItem.y = pos_y;
  4593. if (_MensList.Count > 0)
  4594. GUI.Label(rcItem, "【Slave】 (リンク先)", gsLabel);
  4595. else
  4596. GUI.Label(rcItem, "【Slave】(Maid)", gsLabel);
  4597. rcItem.y += ItemHeight;
  4598. string slave_name = "未選択";
  4599. if (ms_.mdSlave_No >= 0)
  4600. slave_name = GetMaidName(ms_.mdSlaves[ms_.mdSlave_No], true) + getMSState(ms_.mdSlaves[ms_.mdSlave_No].mem);
  4601. m_names = new List<string>();
  4602. bool[] disables = new bool[ms_.mdSlaves.Count + 2];
  4603. if (ms_.doMasterSlave)
  4604. {
  4605. ComboSlave.boPop = false;
  4606. GUI.enabled = false;
  4607. }
  4608. else
  4609. {
  4610. int i = 0;
  4611. foreach (var vm in ms_.mdSlaves)
  4612. {
  4613. string name = GetMaidName(vm, true);
  4614. if (ms_.testSlaved(vm.mem, out int slot))
  4615. {
  4616. if (!vm.mem.boMAN)
  4617. name = name.Substring(0, 7);
  4618. name = name + " <Slave " + slot.ToString() + ">";
  4619. disables[i] = true;
  4620. }
  4621. m_names.Add(name + getMSState(vm.mem));
  4622. i++;
  4623. }
  4624. m_names.Add("*** 選択解除 ***");
  4625. }
  4626. // Slave選択
  4627. if (ComboSlave.Show(rcItem, ItemHeight, ItemHeight * 4, m_names, slave_name, gsButton, gsButton, disables))
  4628. {
  4629. if (ComboSlave.sIndex >= 0)
  4630. {
  4631. // Slave変更
  4632. MsUtil.SelectSlave(_pageNum, ComboSlave.sIndex);
  4633. }
  4634. }
  4635. GUI.enabled = true;
  4636. pos_y = (int)rcItem.y + ItemHeight;
  4637. if (ComboSlave.boPop)
  4638. {
  4639. pos_y += ItemHeight * 4;
  4640. }
  4641. rcItem.y = pos_y;
  4642. }
  4643. //留守番モードチェック
  4644. if (_MensList.Count > 0 && ms_.mdMaster_No < 0 && !ms_.Scc1_MasterMaid && ms_.mdSlave_No >= 0
  4645. && ms_.mdSlaves[ms_.mdSlave_No].mem && !ms_.mdSlaves[ms_.mdSlave_No].mem.boMAN)
  4646. {
  4647. //マスター待機モード
  4648. ms_.Scc1_MasterMaid = false;
  4649. SlaveRusubanMode = true;
  4650. ms_.doMasterSlave = false;
  4651. GizmoVisible(false);
  4652. GizmoHsVisible(false);
  4653. }
  4654. //未選択チェック
  4655. if (ms_.mdSlave_No < 0 || (ms_.mdMaster_No < 0 && _MensList.Count > 0 && !SlaveRusubanMode))
  4656. {
  4657. //未選択状態
  4658. //EditScroll_cfg_sizeY = pos_y;
  4659. //return;
  4660. if (ms_.mdSlaves.Count > 0)
  4661. {
  4662. Maid slave0 = ms_.mdSlaves[0].mem;
  4663. //サブメンバーコントロール
  4664. if (ProcSubMemberCtrls(ref pos_y, ref rcItem, ms_, slave0, p_mscfg))
  4665. {
  4666. //メンバー変更有
  4667. //この後なにもないのでスルー//return;
  4668. }
  4669. }
  4670. pos_y = (int)(rcItem.y += ItemHeight / 2);
  4671. pos_y = (int)(rcItem.y += ItemHeight);
  4672. EditScroll_cfg_sizeY = pos_y + ItemHeight;
  4673. return;
  4674. }
  4675. _WinprocPhase = "[ms-set]";
  4676. Maid master = (ms_.mdMasters.Count > 0 && !SlaveRusubanMode) ? ms_.mdMasters[ms_.mdMaster_No].mem : null;
  4677. Maid slave = ms_.mdSlaves[ms_.mdSlave_No].mem;
  4678. //if (!master || !slave || !master.body0 || !slave.body0)
  4679. if (!slave || !slave.body0 || (master && !master.body0)) //メイド単体稼働可に
  4680. {
  4681. //ここは基本来ないはず(bodyロード中くらい?)
  4682. EditScroll_cfg_sizeY = pos_y;
  4683. debugPrintConsole("エラー:slave = null");
  4684. return;
  4685. }
  4686. if (master != null)
  4687. {
  4688. Color cbk = GUI.color;
  4689. if (ms_.doMasterSlave)
  4690. GUI.color = Color.yellow;
  4691. //リンク実行ボタン
  4692. #if false
  4693. if (ms_.maidKeepSlaveYotogi)
  4694. {
  4695. /*移設
  4696. * GUI.enabled = true;
  4697. if (GUI.Button(rcItem, "夜伽Slave-Keeper 解除", gsButton) )
  4698. {
  4699. ms_.maidKeepSlaveYotogi = null;
  4700. }*/
  4701. }
  4702. else
  4703. #endif
  4704. if (ms_.testLoopLink())
  4705. {
  4706. //リンクの無限ループを防止
  4707. GUI.enabled = false;
  4708. GUI.Button(rcItem, "× リンクに無限ループを検出 ×", gsButton);
  4709. }
  4710. else if (ms_.testOverlapedLink())
  4711. {
  4712. //リンクのダブりを防止
  4713. GUI.enabled = false;
  4714. GUI.Button(rcItem, "× 既存リンクに同Slaveを検出 ×", gsButton);
  4715. }
  4716. else if (GUI.Button(rcItem, "Master-Slave *" + (_pageNum + 1) + " リンク" + (!ms_.doMasterSlave ? "実行" : "停止"), gsButton))
  4717. {
  4718. // リンクスタートか停止
  4719. MsUtil.StartMsLink(_pageNum, ms_.doMasterSlave, false, slave);
  4720. }
  4721. GUI.color = cbk;
  4722. GUI.enabled = true;
  4723. pos_y = (int)(rcItem.y += ItemHeight);
  4724. pos_y = (int)(rcItem.y += ItemHeight / 2);
  4725. GUI.Label(rcItem, "【配置設定】", gsLabel);
  4726. pos_y = (int)(rcItem.y += ItemHeight);
  4727. p_mscfg.doStackSlave = GUI.Toggle(rcItem, p_mscfg.doStackSlave, "Master座標にSlaveを重ねる", gsToggle);
  4728. pos_y = (int)(rcItem.y += ItemHeight);
  4729. _WinprocPhase = "[sliders]";
  4730. if (p_mscfg.doStackSlave)
  4731. {
  4732. const int SLDW = 220;
  4733. const int LX = ItemX + 10;
  4734. const int BW = 25;
  4735. const int LW = SLDW - BW * 3 - 5;
  4736. const int EDTW = LW + BW * 2 + 5;
  4737. //pos_y += ItemHeight;
  4738. //ギズモ表示設定
  4739. if (!ms_.doMasterSlave)
  4740. {
  4741. GUI.enabled = false;
  4742. _Gizmo.Visible = false;
  4743. }
  4744. _Gizmo.Visible = GUI.Toggle(new Rect(LX, (pos_y), ItemWidth - 70, ItemHeight), _Gizmo.Visible, "Slave重ね位置調整(Gizmo)", gsToggle);
  4745. GUI.enabled = true;
  4746. /*if (GUI.Button(new Rect(rcItem.x + rcItem.width -20, rcItem.y, 20, ItemHeight), "C", gsButton))
  4747. {
  4748. v3StackOffset = Vector3.zero;
  4749. }*/
  4750. //pos_y = (int)(rcItem.y += ItemHeight);
  4751. GizmoVisible(_Gizmo.Visible);
  4752. GUI.Label(new Rect(LX + ItemWidth - 70 + 15, pos_y, 25, ItemHeight), "詳細", gsLabel);
  4753. if (GUI.Button(new Rect(LX + ItemWidth - 70 + 40, (pos_y), 20, 20), (showPosSlider ? "-" : "+"), gsButton))
  4754. {
  4755. showPosSlider = !showPosSlider;
  4756. if (showPosSlider)
  4757. {
  4758. showSlidersHint();
  4759. }
  4760. }
  4761. if (showPosSlider)
  4762. {
  4763. Vector3 _v = p_v3of.v3StackOffset;
  4764. GUI.Label(new Rect(LX, (pos_y += ItemHeight), 122, ItemHeight), " +X: " + Math.Round(_v.x, 4), gsLabel);
  4765. _v.x = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.x, gsButton);
  4766. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  4767. {
  4768. _v.x = 0;
  4769. }
  4770. _v.x = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.x, -1f, 1f);
  4771. GUI.Label(new Rect(LX, (pos_y += ItemHeight - 5), 122, ItemHeight), " +Y: " + Math.Round(_v.y, 4), gsLabel);
  4772. _v.y = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.y, gsButton);
  4773. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  4774. {
  4775. _v.y = 0;
  4776. }
  4777. _v.y = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.y, -1f, 1f);
  4778. GUI.Label(new Rect(LX, (pos_y += ItemHeight - 5), 122, ItemHeight), " +Z: " + Math.Round(_v.z, 4), gsLabel);
  4779. _v.z = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.z, gsButton);
  4780. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  4781. {
  4782. _v.z = 0;
  4783. }
  4784. _v.z = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.z, -1f, 1f);
  4785. p_v3of.v3StackOffset = _v;
  4786. }
  4787. if (showPosSlider)
  4788. {
  4789. Vector3 _v = va180(p_v3of.v3StackOffsetRot);
  4790. GUI.Label(new Rect(LX, (pos_y += ItemHeight), 122, ItemHeight), " +回転X: " + Math.Round(_v.x, 4), gsLabel);
  4791. _v.x = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.x, gsButton);
  4792. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  4793. {
  4794. _v.x = 0;
  4795. }
  4796. _v.x = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.x, -180f, 180f);
  4797. GUI.Label(new Rect(LX, (pos_y += ItemHeight - 5), 122, ItemHeight), " +回転Y: " + Math.Round(_v.y, 4), gsLabel);
  4798. _v.y = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.y, gsButton);
  4799. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  4800. {
  4801. _v.y = 0;
  4802. }
  4803. _v.y = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.y, -180f, 180f);
  4804. GUI.Label(new Rect(LX, (pos_y += ItemHeight - 5), 122, ItemHeight), " +回転Z: " + Math.Round(_v.z, 4), gsLabel);
  4805. _v.z = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.z, gsButton);
  4806. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  4807. {
  4808. _v.z = 0;
  4809. }
  4810. _v.z = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.z, -180f, 180f);
  4811. p_v3of.v3StackOffsetRot = _v;
  4812. rcItem.y = (pos_y += 20);
  4813. p_mscfg.doStackSlave_Pelvis = GUI.Toggle(new Rect(LX, (pos_y), ItemWidth - LX, ItemHeight), p_mscfg.doStackSlave_Pelvis, "骨盤ボーンでの位置補正を行う", gsToggle);
  4814. if (p_mscfg.doStackSlave_Pelvis) p_mscfg.doStackSlave_CliCnk = false;
  4815. rcItem.y = (pos_y += 20);
  4816. p_mscfg.doStackSlave_CliCnk = GUI.Toggle(new Rect(LX, (pos_y), ItemWidth - LX, ItemHeight), p_mscfg.doStackSlave_CliCnk, "局部で位置補正(chinkoCenter)", gsToggle);
  4817. if (p_mscfg.doStackSlave_CliCnk) p_mscfg.doStackSlave_Pelvis = false;
  4818. //地面の当たり判定位置オフセット
  4819. if (!cfg.AdjustBoneHitHeightY)
  4820. {
  4821. GUI.enabled = false;
  4822. p_mscfg.Adjust_doHitHeightYOffset = false;
  4823. }
  4824. rcItem.y = (pos_y += 20);
  4825. p_mscfg.Adjust_doHitHeightYOffset = GUI.Toggle(new Rect(LX, (pos_y), ItemWidth - LX, ItemHeight), p_mscfg.Adjust_doHitHeightYOffset, "Slave HitHeight調整(接地判定高さ)", gsToggle);
  4826. GUI.enabled = true;
  4827. if (p_mscfg.Adjust_doHitHeightYOffset)
  4828. {
  4829. rcItem.y = (pos_y += 20);
  4830. ref float refsc = ref p_mscfg.Adjust_HitHeightYOffset; //オフセット値
  4831. float newsc_h = refsc;
  4832. GUI.Label(new Rect(LX, (pos_y), LW, ItemHeight), "+Y Offset: " + Math.Round(refsc, 3), gsLabel);
  4833. if (master && GUI.Button(new Rect(LX + LW - 30, (pos_y), 28, 20), "=M", gsButton))
  4834. {
  4835. newsc_h = master.body0.BoneHitHeightY - master.gameObject.transform.position.y;
  4836. }
  4837. newsc_h = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, newsc_h, 0.01f, gsButton, -2000f, 2000f);
  4838. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "|", gsButton))
  4839. {
  4840. newsc_h = 0;
  4841. }
  4842. if (!(Input.GetMouseButton(0) || Input.GetMouseButton(1) || Input.GetMouseButton(2)))
  4843. hsldPreHeight = newsc_h;
  4844. newsc_h = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), newsc_h, -2f + hsldPreHeight, 2f + hsldPreHeight);
  4845. if (newsc_h != refsc)
  4846. {
  4847. refsc = newsc_h;
  4848. }
  4849. //rcItem.y = (pos_y += 15);
  4850. }
  4851. rcItem.y = (pos_y += 10);
  4852. }
  4853. rcItem.y = (pos_y += 20);
  4854. p_mscfg.doIKTargetMHand = GUI.Toggle(new Rect(LX, (pos_y), ItemWidth - LX - 70, ItemHeight), p_mscfg.doIKTargetMHand, "Masterの両手にアタッチ", gsToggle);
  4855. //pos_y = (int)(rcItem.y += ItemHeight);
  4856. if (ms_.doMasterSlave)
  4857. {
  4858. GUI.Label(new Rect(LX + ItemWidth - 70 + 15, pos_y, 25, ItemHeight), "調整", gsLabel);
  4859. if (GUI.Button(new Rect(LX + ItemWidth - 70 + 40, (pos_y), 20, 20), (showPosSliderHand ? "-" : "+"), gsButton))
  4860. {
  4861. showPosSliderHand = !showPosSliderHand;
  4862. GizmoHsVisible(showPosSliderHand);
  4863. if (showPosSliderHand)
  4864. {
  4865. showSlidersHint();
  4866. }
  4867. if (showHandTTPosSlider)
  4868. {
  4869. // どちらもONなら切り替え
  4870. showHandTTPosSlider = false;
  4871. }
  4872. }
  4873. }
  4874. else
  4875. {
  4876. if (showPosSliderHand)
  4877. {
  4878. showPosSliderHand = false;
  4879. GizmoHsVisible(false);
  4880. }
  4881. }
  4882. if (showPosSliderHand)
  4883. {
  4884. //ギズモとスライダー調整
  4885. ProcHandGizmo(slave, ref rcItem, ref pos_y, p_mscfg, p_v3of);
  4886. }
  4887. rcItem.y = (pos_y += 20);
  4888. p_mscfg.doCopyIKTarget = GUI.Toggle(new Rect(LX, (pos_y), ItemWidth - LX, ItemHeight), p_mscfg.doCopyIKTarget, "Masterの手のIKターゲットを複製", gsToggle);
  4889. rcItem.y = (pos_y += 20);
  4890. p_mscfg.doStackSlave_PosSyncMode = GUI.Toggle(new Rect(LX, (pos_y), ItemWidth - LX - 30, ItemHeight), p_mscfg.doStackSlave_PosSyncMode, "位置のみリンク(ポーズ同期OFF)", gsToggle);
  4891. if (p_mscfg.doStackSlave_PosSyncMode)
  4892. {
  4893. p_mscfg.doStackSlave_PosSyncModeV2 = GUI.Toggle(new Rect(LX + ItemWidth - LX - 30, (pos_y), 40, ItemHeight), p_mscfg.doStackSlave_PosSyncModeV2, "v2", gsToggle);
  4894. rcItem.y = (pos_y += 20);
  4895. p_mscfg.doStackSlave_PosSyncModeSp = GUI.Toggle(new Rect(LX, (pos_y), ItemWidth - LX - 30, ItemHeight), p_mscfg.doStackSlave_PosSyncModeSp, "リンク先ボーン指定変更", gsToggle);
  4896. if (p_mscfg.doStackSlave_PosSyncModeSp)
  4897. {
  4898. rcItem.y = (pos_y += 20);
  4899. string[] e_names = master.boMAN ? Defines.data.ManBones : Defines.data.MaidBones;
  4900. Rect rctmp = new Rect(LX, pos_y, ItemWidth - LX, ItemHeight);
  4901. if (ComboPosLinkBone.Show(rctmp, ItemHeight, ItemHeight * 4, e_names, p_mscfg.doStackSlave_PosSyncModeSp_TgtBone, gsButton, gsButton))
  4902. {
  4903. if (ComboPosLinkBone.sIndex >= 0)
  4904. {
  4905. p_mscfg.doStackSlave_PosSyncModeSp_TgtBone = ComboPosLinkBone.sSelected;
  4906. }
  4907. }
  4908. pos_y = (int)(rcItem.y += ItemHeight);
  4909. if (ComboPosLinkBone.boPop)
  4910. {
  4911. pos_y = (int)(rcItem.y += (ItemHeight * 4));
  4912. }
  4913. }
  4914. }
  4915. pos_y = (int)(rcItem.y += ItemHeight);
  4916. }
  4917. else
  4918. {
  4919. GizmoVisible(false);
  4920. GizmoHsVisible(false);
  4921. }
  4922. }//master!=null
  4923. else
  4924. { //master == null
  4925. ms_.doMasterSlave = false;
  4926. ms_.maidKeepSlaveYotogi = null;
  4927. }
  4928. const int SSLDW = ItemWidth;
  4929. const int SLX = ItemX;
  4930. const int SBW = 25;
  4931. const int SLW = SSLDW - SBW * 3 - 5;
  4932. const int SEDTW = SLW + SBW * 2 + 5;
  4933. //v0011追加
  4934. float sc_m = 1f;
  4935. float newsc_m = 1f;
  4936. if (master != null)
  4937. {
  4938. sc_m = (master.gameObject.transform.localScale.x + master.gameObject.transform.localScale.y + master.gameObject.transform.localScale.z) / 3;
  4939. newsc_m = sc_m;
  4940. rcItem.y = (pos_y += 15);
  4941. GUI.Label(new Rect(SLX, (pos_y), SLW, ItemHeight), "Masterサイズ調整: " + Math.Round(newsc_m, 3), gsLabel);
  4942. newsc_m = btnset_LR(new Rect(SLX + SLW, (pos_y), SBW, 20), SBW, newsc_m, gsButton/*, cfg.Scale_Min, cfg.Scale_Max*/, 0.01f, 100f);
  4943. if (GUI.Button(new Rect(SLX + SEDTW, (pos_y), 28, 20), "|", gsButton))
  4944. {
  4945. newsc_m = 1f;
  4946. }
  4947. newsc_m = GUI.HorizontalSlider(new Rect(SLX, (pos_y += 20), SSLDW, 15), newsc_m, cfg.Scale_Min, cfg.Scale_Max);
  4948. if (newsc_m != sc_m)
  4949. {
  4950. master.gameObject.transform.localScale = new Vector3(newsc_m, newsc_m, newsc_m);
  4951. if (!master.boMAN)
  4952. UpdateHitScale(master, newsc_m, p_mscfg);
  4953. //UpdateHitScale(master, newsc_m * p_mscfg.Scale_HitCheckEffect);
  4954. }
  4955. //rcItem.y = (pos_y += 20);
  4956. }//master!=null
  4957. float sc = (slave.gameObject.transform.localScale.x + slave.gameObject.transform.localScale.y + slave.gameObject.transform.localScale.z) / 3;
  4958. float newsc = sc;
  4959. rcItem.y = (pos_y += 15);
  4960. //GUI.Label(rcItem, "Slaveサイズ調整", gsLabel);
  4961. GUI.Label(new Rect(SLX, (pos_y), SLW, ItemHeight), "Slaveサイズ調整: " + Math.Round(newsc, 3), gsLabel);
  4962. newsc = btnset_LR(new Rect(SLX + SLW, (pos_y), SBW, 20), SBW, newsc, gsButton/*, cfg.Scale_Min, cfg.Scale_Max*/, 0.01f, 100f);
  4963. if (GUI.Button(new Rect(SLX + SEDTW, (pos_y), 28, 20), "|", gsButton))
  4964. {
  4965. newsc = 1f;
  4966. }
  4967. newsc = GUI.HorizontalSlider(new Rect(SLX, (pos_y += 20), SSLDW, 15), newsc, cfg.Scale_Min, cfg.Scale_Max);
  4968. if (newsc != sc)
  4969. {
  4970. slave.gameObject.transform.localScale = new Vector3(newsc, newsc, newsc);
  4971. if (!slave.boMAN)
  4972. UpdateHitScale(slave, newsc, p_mscfg);
  4973. // UpdateHitScale(slave, newsc * p_mscfg.Scale_HitCheckEffect);
  4974. }
  4975. rcItem.y = (pos_y += 15);
  4976. //GUI.Label(new Rect(SLX, (pos_y), SLW, ItemHeight), "ヒットチェック倍率: " + Math.Round(p_mscfg.Scale_HitCheckEffect, 2), gsLabel);
  4977. if (!p_mscfg.Scale_HitCheckDetail)
  4978. GUI.Label(new Rect(SLX, (pos_y), SLW - 45, ItemHeight), "HitCheck倍率: " + Math.Round(p_mscfg.Scale_HitCheckEffect, 2), gsLabel);
  4979. else
  4980. GUI.Label(new Rect(SLX, (pos_y), SLW - 45, ItemHeight), "HitCheck倍率: ", gsLabel);
  4981. if (GUI.Button(new Rect(SLX + SLW - 52, (pos_y), 48, ItemHeight), "再適用", gsButton))
  4982. {
  4983. if (master && !master.boMAN)
  4984. UpdateHitScale(master, newsc_m, p_mscfg);
  4985. //UpdateHitScale(master, newsc_m * p_mscfg.Scale_HitCheckEffect);
  4986. if (!slave.boMAN)
  4987. UpdateHitScale(slave, newsc, p_mscfg);
  4988. //UpdateHitScale(slave, newsc * p_mscfg.Scale_HitCheckEffect);
  4989. }
  4990. if (!p_mscfg.Scale_HitCheckDetail)
  4991. {
  4992. float newsc_h = p_mscfg.Scale_HitCheckEffect;
  4993. newsc_h = btnset_LR(new Rect(SLX + SLW, (pos_y), SBW, 20), SBW, newsc_h, 0.01f, gsButton, 0f, 2.0f);
  4994. if (GUI.Button(new Rect(SLX + SEDTW, (pos_y), 28, 20), "|", gsButton))
  4995. {
  4996. newsc_h = 1f;
  4997. }
  4998. newsc_h = GUI.HorizontalSlider(new Rect(SLX, (pos_y += 20), SSLDW, 15), newsc_h, 0f, 2.0f);
  4999. if (newsc_h != p_mscfg.Scale_HitCheckEffect)
  5000. {
  5001. p_mscfg.Scale_HitCheckEffect = newsc_h;
  5002. if (master && !master.boMAN)
  5003. UpdateHitScale(master, newsc_m, newsc_h);
  5004. if (!slave.boMAN)
  5005. UpdateHitScale(slave, newsc, newsc_h);
  5006. }
  5007. rcItem.y = (pos_y += 15);
  5008. }
  5009. else
  5010. {
  5011. if (GUI.Button(new Rect(SLX + SLW, (pos_y), 50, ItemHeight), (cfg.hideHitScaleDef ? "+ 開く" : "- 隠す"), gsButton))
  5012. {
  5013. cfg.hideHitScaleDef = !cfg.hideHitScaleDef;
  5014. }
  5015. rcItem.y = (pos_y += 20);
  5016. if (!cfg.hideHitScaleDef)
  5017. {
  5018. ref float f(HitCheckTgt h)
  5019. {
  5020. switch (h)
  5021. {
  5022. case HitCheckTgt.Hip:
  5023. return ref p_mscfg.Scale_HitCheckDetail_Hip;
  5024. case HitCheckTgt.Momo:
  5025. return ref p_mscfg.Scale_HitCheckDetail_Momo;
  5026. case HitCheckTgt.Spine:
  5027. return ref p_mscfg.Scale_HitCheckDetail_Spine;
  5028. case HitCheckTgt.Thigh:
  5029. return ref p_mscfg.Scale_HitCheckDetail_Thigh;
  5030. default:
  5031. return ref p_mscfg.Scale_HitCheckDetail_Bip01;
  5032. }
  5033. }
  5034. string fixHitNames(string str)
  5035. {
  5036. #if COM3D2
  5037. if (str == "Momo")
  5038. return "Momo+dVag";
  5039. if (str == "Thigh")
  5040. return "Thigh+dReg";
  5041. if (str == "Spine")
  5042. return "Spine+dMune";
  5043. if (str == "Bip01")
  5044. return "Bip01+dbc";
  5045. if (str == "Hip")
  5046. return "Hip+dHipLR";
  5047. #endif
  5048. return str;
  5049. }
  5050. foreach (var h in HitCheckTgtStr)
  5051. {
  5052. ref float refsc = ref f(h.Key);
  5053. float newsc_h = refsc;
  5054. GUI.Label(new Rect(SLX, (pos_y), SLW - 45, ItemHeight), fixHitNames(h.Key.ToString()) + ": " + Math.Round(refsc, 3), gsLabel);
  5055. newsc_h = btnset_LR(new Rect(SLX + SLW, (pos_y), SBW, 20), SBW, newsc_h, 0.01f, gsButton, 0f, 6.0f);
  5056. if (GUI.Button(new Rect(SLX + SEDTW, (pos_y), 28, 20), "|", gsButton))
  5057. {
  5058. if (cfg.doHitScaleDef)
  5059. {
  5060. newsc_h = cfg.HitScaleDef[(int)h.Key];
  5061. }
  5062. else
  5063. {
  5064. newsc_h = 1f;
  5065. }
  5066. }
  5067. newsc_h = GUI.HorizontalSlider(new Rect(SLX, (pos_y += 20), SSLDW, 15), newsc_h, 0f, 3.5f);
  5068. if (newsc_h != refsc)
  5069. {
  5070. refsc = newsc_h;
  5071. if (master && !master.boMAN)
  5072. UpdateHitScale(master, newsc_m, p_mscfg);
  5073. if (!slave.boMAN)
  5074. UpdateHitScale(slave, newsc, p_mscfg);
  5075. }
  5076. rcItem.y = (pos_y += 15);
  5077. }
  5078. if (p_mscfg.Scale_HitCheckDetail)
  5079. {
  5080. Color cbk = GUI.color;
  5081. if (cfg.doHitScaleDef)
  5082. {
  5083. GUI.color = Color.yellow;
  5084. }
  5085. if (GUI.Button(new Rect(SLX, (pos_y), SSLDW - 80, 20), "全メイドの基本値に" + (cfg.doHitScaleDef ? "上書き" : "登録"), gsButton))
  5086. {
  5087. cfg.doHitScaleDef = true;
  5088. foreach (var h in HitCheckTgtStr)
  5089. {
  5090. cfg.HitScaleDef[(int)h.Key] = f(h.Key);
  5091. }
  5092. }
  5093. GUI.color = cbk;
  5094. if (!cfg.doHitScaleDef)
  5095. {
  5096. GUI.enabled = false;
  5097. }
  5098. if (GUI.Button(new Rect(SLX + (SSLDW - 80), (pos_y), 40, 20), "取得", gsButton))
  5099. {
  5100. foreach (var h in HitCheckTgtStr)
  5101. {
  5102. f(h.Key) = cfg.HitScaleDef[(int)h.Key];
  5103. }
  5104. }
  5105. if (GUI.Button(new Rect(SLX + (SSLDW - 40), (pos_y), 40, 20), "解除", gsButton))
  5106. {
  5107. cfg.doHitScaleDef = false;
  5108. }
  5109. GUI.enabled = true;
  5110. }
  5111. rcItem.y = (pos_y += 20);
  5112. }
  5113. }
  5114. p_mscfg.Scale_HitCheckDetail = GUI.Toggle(new Rect(SLX, (pos_y), ItemWidth - 120, ItemHeight), p_mscfg.Scale_HitCheckDetail, "HitCheck詳細設定", gsToggle);
  5115. if (cfg.doHitScaleDef)
  5116. {
  5117. Color cbk = GUI.color;
  5118. GUI.color = Color.yellow;
  5119. GUIStyle gsLabel2 = new GUIStyle(gsLabel);
  5120. gsLabel2.alignment = TextAnchor.LowerLeft;
  5121. GUI.Label(new Rect(SLX + (ItemWidth - 125), (pos_y + 2), 120, ItemHeight), "《登録有り》", gsLabel2);
  5122. if (GUI.Button(new Rect(SLX + (ItemWidth - 55), (pos_y + 2), 50, ItemHeight), "→適用", gsButton))
  5123. {
  5124. foreach (var h in HitCheckTgtStr)
  5125. {
  5126. p_mscfg.GetHitDetail(h.Key) = cfg.HitScaleDef[(int)h.Key];
  5127. }
  5128. if (master && !master.boMAN)
  5129. UpdateHitScaleDef(master, newsc_m, cfg.HitScaleDef, true);
  5130. if (!slave.boMAN)
  5131. UpdateHitScaleDef(slave, newsc, cfg.HitScaleDef, true);
  5132. }
  5133. GUI.color = cbk;
  5134. }
  5135. #if false //操作時のみに変更
  5136. else if (p_mscfg.Scale_HitCheckEffect != 1f)
  5137. {
  5138. //初回適用
  5139. if (master && !master.boMAN /*&& !HitScaleChangedMaids.Contains(master)*/)
  5140. UpdateHitScale(master, newsc_m * newsc_h);
  5141. if (!slave.boMAN /*&& !HitScaleChangedMaids.Contains(slave)*/)
  5142. UpdateHitScale(slave, newsc * newsc_h);
  5143. }
  5144. #endif
  5145. rcItem.y = (pos_y += 20);
  5146. rcItem.y = (pos_y += 20);
  5147. #if true
  5148. if (master != null)
  5149. {
  5150. GUI.Label(rcItem, "【表示設定】", gsLabel);
  5151. pos_y = (int)(rcItem.y += ItemHeight);
  5152. Maid tgtman = (master.boMAN ? master : slave);
  5153. FieldInfo fiml = typeof(TBodySkin).GetField("m_listManAlphaMat", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.DeclaredOnly);
  5154. if (fiml != null)
  5155. {
  5156. float manAlpha = GetManAlpha(tgtman);
  5157. bool holdAlphaBk = CommonEdit.LoadManAlpha(master, out float f);
  5158. if (holdAlphaBk)
  5159. manAlpha = f;
  5160. GUI.Label(rcItem, (master.boMAN ? "Master" : "Slave") + "の透明度: " + Math.Round(manAlpha, 1), gsLabel);
  5161. Color cbk = GUI.color;
  5162. if (holdAlphaBk)
  5163. GUI.color = Color.yellow;
  5164. bool holdAlpha = GUI.Toggle(new Rect(SLX + SEDTW - 60, (pos_y), 60, ItemHeight), holdAlphaBk, "Hold", gsToggle);
  5165. if (holdAlpha != holdAlphaBk)
  5166. {
  5167. if (holdAlpha)
  5168. CommonEdit.SaveManAlpha(master, manAlpha);
  5169. else
  5170. CommonEdit.SaveManAlpha(master, -1f);
  5171. }
  5172. GUI.color = cbk;
  5173. if (GUI.Button(new Rect(SLX + SEDTW, (pos_y), 28, 20), "|", gsButton))
  5174. {
  5175. manAlpha = GameMain.Instance.CMSystem.ManAlpha;
  5176. SetManAlpha(tgtman, manAlpha);
  5177. if (holdAlpha)
  5178. CommonEdit.SaveManAlpha(master, manAlpha);
  5179. //ms_.holdManAlpha = manAlpha;
  5180. }
  5181. pos_y = (int)(rcItem.y += ItemHeight);
  5182. int newA = (int)GUI.HorizontalSlider(new Rect(rcItem.x, rcItem.y, rcItem.width, 15), manAlpha, 0, 100);
  5183. if (newA != manAlpha)
  5184. {
  5185. SetManAlpha(tgtman, newA);
  5186. if (holdAlpha)
  5187. CommonEdit.SaveManAlpha(master, newA);
  5188. //ms_.holdManAlpha = manAlpha;
  5189. }
  5190. pos_y = (int)(rcItem.y += ItemHeight / 4 * 3);
  5191. }
  5192. }//master!=null
  5193. #else
  5194. GUI.Label(rcItem, "男モデルの透明度: " + GameMain.Instance.CMSystem.ManAlpha, gsLabel);
  5195. pos_y = (int)(rcItem.y += ItemHeight);
  5196. var manAlpha = (int)GUI.HorizontalSlider(rcItem, GameMain.Instance.CMSystem.ManAlpha, 0, 100);
  5197. if (manAlpha != GameMain.Instance.CMSystem.ManAlpha)
  5198. {
  5199. GameMain.Instance.CMSystem.ManAlpha = manAlpha;
  5200. //GameMain.Instance.CMSystem.ConfigScreenApply(); //bugfix v0011
  5201. if (GameMain.Instance.CharacterMgr != null) //bugfix v0011
  5202. {
  5203. GameMain.Instance.CharacterMgr.ManAlphaUpdate();
  5204. }
  5205. }
  5206. pos_y = (int)(rcItem.y += ItemHeight);
  5207. #endif
  5208. if (master != null)
  5209. {
  5210. if (!master.boMAN)
  5211. {
  5212. bool bochk = GetStateMaskItemsAll(master);
  5213. bool bonew = GUI.Toggle(rcItem, bochk, "Masterのメイドを隠す(Node消去&Mask)", gsToggle);
  5214. pos_y = (int)(rcItem.y += ItemHeight);
  5215. if (bochk != bonew)
  5216. {
  5217. if (bonew)
  5218. MaskItemsAll(master);
  5219. else
  5220. ResetMaskItemsAll(master);
  5221. }
  5222. }
  5223. else if (master.boMAN)
  5224. {
  5225. bool bochk = !GetManVisible(master);
  5226. bool bonew = GUI.Toggle(rcItem, bochk, "Masterの男を隠す(Node消去&Mask)", gsToggle);
  5227. pos_y = (int)(rcItem.y += ItemHeight);
  5228. if (bochk != bonew)
  5229. {
  5230. SetManVisible(master, !bonew);
  5231. }
  5232. }
  5233. //if (master.boMAN) m/s共通に
  5234. {
  5235. Maid tgtman = null;
  5236. bool bochk = false;
  5237. bool bocnk = false;
  5238. if (master.boMAN)
  5239. {
  5240. tgtman = master;
  5241. bochk = GetChinkoVisible(master.body0);
  5242. // v0031
  5243. Color cbk = GUI.color;
  5244. if (SetChinkoScaleMens.ContainsKey(master.body0))
  5245. {
  5246. GUI.color = Color.yellow;
  5247. }
  5248. bocnk = GUI.Toggle(new Rect(rcItem.x, rcItem.y, rcItem.width - 80, rcItem.height), bochk, "Masterの局部を表示", gsToggle);
  5249. pos_y = (int)(rcItem.y += ItemHeight);
  5250. GUI.color = cbk;
  5251. }
  5252. else if (slave.boMAN)
  5253. {
  5254. tgtman = slave;
  5255. bochk = GetChinkoVisible(slave.body0);
  5256. // v0031
  5257. Color cbk = GUI.color;
  5258. if (SetChinkoScaleMens.ContainsKey(slave.body0))
  5259. {
  5260. GUI.color = Color.yellow;
  5261. }
  5262. bocnk = GUI.Toggle(new Rect(rcItem.x, rcItem.y, rcItem.width - 80, rcItem.height), bochk, "Slaveの局部を表示", gsToggle);
  5263. pos_y = (int)(rcItem.y += ItemHeight);
  5264. GUI.color = cbk;
  5265. }
  5266. if (bochk != bocnk)
  5267. {
  5268. //SetTamabkrVisible(master, true);
  5269. //tgtman.body0.SetChinkoVisible(bocnk);
  5270. XtMasterSlave.SetChinkoVisible(tgtman.body0, bocnk); //v0030 fix
  5271. }
  5272. if (tgtman && /*master.body0.trManChinko != null && */(bocnk || showChinkoSlider))
  5273. {
  5274. //chkサイズスライダー
  5275. const int SLDW = 220;
  5276. const int LX = ItemX + 10;
  5277. const int BW = 25;
  5278. const int LW = SLDW - BW * 3 - 5;
  5279. const int EDTW = LW + BW * 2 + 5;
  5280. pos_y = (int)(rcItem.y -= ItemHeight);
  5281. {
  5282. GUI.Label(new Rect(LX + ItemWidth - 70 + 15, pos_y, 25, ItemHeight), "調整", gsLabel);
  5283. if (GUI.Button(new Rect(LX + ItemWidth - 70 + 40, (pos_y), 20, 20), (showChinkoSlider ? "-" : "+"), gsButton))
  5284. {
  5285. showChinkoSlider = !showChinkoSlider;
  5286. if (showChinkoSlider)
  5287. {
  5288. showSlidersHint();
  5289. }
  5290. }
  5291. }
  5292. pos_y = (int)(rcItem.y += ItemHeight);
  5293. if (showChinkoSlider)
  5294. {
  5295. float s = GetChinkoScale(tgtman.body0).x;
  5296. float _s = s;
  5297. GUI.Label(new Rect(LX, (pos_y), 122, ItemHeight), " サイズ: " + Math.Round(_s, 3), gsLabel);
  5298. _s = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _s, gsButton);
  5299. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "|", gsButton))
  5300. {
  5301. _s = 1f;
  5302. }
  5303. pos_y = (int)(rcItem.y += ItemHeight);
  5304. _s = GUI.HorizontalSlider(new Rect(LX, (pos_y), SLDW, 18), _s, 0f, 2f);
  5305. #if false
  5306. if (s != _s/* || _v != ms_.chinko_dpos*/)
  5307. {
  5308. /*if (_s != 1)
  5309. ms_.chinkoSizeChangedMan = tgtman;
  5310. else
  5311. ms_.chinkoSizeChangedMan = null;
  5312. */
  5313. SetChinkoScale(tgtman.body0, _s/*, _v*/);
  5314. //ms_.chinko_dpos = _v;
  5315. }
  5316. #else
  5317. Vector3 _v = GetChinkoPos(tgtman.body0);//ms_.chinko_dpos;
  5318. Vector3 v0 = _v;
  5319. {
  5320. GUI.Label(new Rect(LX, (pos_y += ItemHeight), 122, ItemHeight), " +X: " + Math.Round(_v.x, 4), gsLabel);
  5321. _v.x = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.x, gsButton);
  5322. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  5323. {
  5324. _v.x = GetInitChinkoPos(tgtman.body0).x;
  5325. }
  5326. _v.x = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.x, -0.15f, 0.15f);
  5327. GUI.Label(new Rect(LX, (pos_y += ItemHeight - 5), 122, ItemHeight), " +Y: " + Math.Round(_v.y, 4), gsLabel);
  5328. _v.y = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.y, gsButton);
  5329. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  5330. {
  5331. _v.y = GetInitChinkoPos(tgtman.body0).y;
  5332. }
  5333. _v.y = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.y, -0.15f, 0.15f);
  5334. GUI.Label(new Rect(LX, (pos_y += ItemHeight - 5), 122, ItemHeight), " +Z: " + Math.Round(_v.z, 4), gsLabel);
  5335. _v.z = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.z, gsButton);
  5336. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  5337. {
  5338. _v.z = GetInitChinkoPos(tgtman.body0).z;
  5339. }
  5340. _v.z = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.z, -0.15f, 0.15f);
  5341. rcItem.y = (pos_y);
  5342. //_v = v3limit(_v, 0.15f);
  5343. }
  5344. if (s != _s)
  5345. {
  5346. SetChinkoScale(tgtman.body0, _s);
  5347. }
  5348. if (_v != v0)
  5349. {
  5350. SetChinkoScale(tgtman.body0, _s);
  5351. SetChinkoPos(tgtman.body0, _v);
  5352. //ms_.chinko_dpos = _v;
  5353. }
  5354. #endif
  5355. pos_y = (int)(rcItem.y += ItemHeight);
  5356. }
  5357. /*モザイク対応が面倒なのでやめ
  5358. bool bochk2 = !GetTamabkrVisible(master);
  5359. bool bonew = GUI.Toggle(new Rect(rcItem.x + (rcItem.width - 80), rcItem.y - ItemHeight, 80, rcItem.height), bochk2, "玉を隠す", gsToggle);
  5360. if (bochk2 != bonew)
  5361. {
  5362. SetTamabkrVisible(master, !bonew);
  5363. }*/
  5364. }
  5365. }
  5366. /*共通処理化
  5367. * if (slave.boMAN)
  5368. {
  5369. bool bochk = GetChinkoVisible(slave.body0);
  5370. bool bocnk = GUI.Toggle(rcItem, bochk, "Slaveの局部を表示", gsToggle);
  5371. pos_y = (int)(rcItem.y += ItemHeight);
  5372. if (bochk != bocnk)
  5373. {
  5374. slave.body0.SetChinkoVisible(bocnk);
  5375. }
  5376. }*/
  5377. //pos_y = (int)(rcItem.y += ItemHeight / 2);
  5378. }
  5379. _WinprocPhase = "[masks]";
  5380. if (!slave.boMAN)
  5381. {
  5382. //pos_y = (int)(rcItem.y += ItemHeight / 2);
  5383. if (GUI.Button(new Rect(ItemX, (pos_y), 20, 20), (showSlvMask ? "-" : "+"), gsButton))
  5384. {
  5385. showSlvMask = !showSlvMask;
  5386. }
  5387. GUI.Label(new Rect(ItemX + 20, pos_y, ItemWidth - 20 - 90, ItemHeight), "Slave衣装表示設定", gsLabel);
  5388. ms_.CheckSlvMaskSlave(slave);
  5389. Color cbklt = GUI.color;
  5390. if (ms_.holdSlvMask && ms_.holdSlvMaskItems.Count > 0)
  5391. {
  5392. GUI.color = Color.yellow;
  5393. }
  5394. bool holdSlvMask_t = GUI.Toggle(new Rect(ItemX + 20 + (ItemWidth - 20 - 90), pos_y, 90, ItemHeight), ms_.holdSlvMask, "マスクを保持", gsToggle);
  5395. GUI.color = cbklt;
  5396. if (holdSlvMask_t != ms_.holdSlvMask)
  5397. {
  5398. ms_.holdSlvMask = holdSlvMask_t;
  5399. if (!ms_.holdSlvMask)
  5400. {
  5401. ms_.holdSlvMaskMaid = null;
  5402. ms_.holdSlvMaskItems.Clear();
  5403. }
  5404. else
  5405. {
  5406. ms_.holdSlvMaskMaid = slave;
  5407. foreach (var item in dicMaskItems)
  5408. {
  5409. bool vflg = false;
  5410. foreach (var v in item.Value)
  5411. {
  5412. vflg |= slave.body0.GetMask(v);
  5413. }
  5414. if (!vflg)
  5415. ms_.holdSlvMaskItems.Add(item.Key);
  5416. }
  5417. }
  5418. }
  5419. pos_y = (int)(rcItem.y += ItemHeight);
  5420. if (showSlvMask)
  5421. {
  5422. Rect rcbox = new Rect(rcItem);
  5423. rcbox.height = ((float)Math.Ceiling(dicMaskItems.Count / 2.0) + 0.5f) * ItemHeight;
  5424. GUI.Box(rcbox, "");
  5425. Rect rcman = new Rect(rcItem);
  5426. rcman.x = 0;
  5427. int i = 0;
  5428. foreach (var item in dicMaskItems)
  5429. {
  5430. bool vflg = false;
  5431. foreach (var v in item.Value)
  5432. {
  5433. vflg |= slave.body0.GetMask(v);
  5434. }
  5435. rcman.x = ((i % 2 == 0) ? rcItem.x : (rcItem.x + rcman.width)) + 10;
  5436. rcman.width = (i % 2 == 0) ? (rcItem.width / 2) : (rcItem.width / 2 - 10);
  5437. bool nflg0 = vflg;
  5438. Color cbkl = GUI.color;
  5439. if (ms_.holdSlvMask && ms_.holdSlvMaskItems.Contains(item.Key))
  5440. {
  5441. GUI.color = Color.yellow;
  5442. nflg0 = false;
  5443. }
  5444. bool nflg = GUI.Toggle(rcman, nflg0, item.Key, gsToggle);
  5445. GUI.color = cbkl;
  5446. if ((i % 2 == 1))
  5447. rcman.y += ItemHeight;
  5448. // rcman.y = pos_y = (int)(rcItem.y += ItemHeight);
  5449. if (ms_.holdSlvMask && nflg != nflg0)
  5450. {
  5451. if (nflg)
  5452. ms_.holdSlvMaskItems.Remove(item.Key);
  5453. else
  5454. ms_.holdSlvMaskItems.Add(item.Key);
  5455. }
  5456. if (vflg != nflg)
  5457. {
  5458. foreach (var v in item.Value)
  5459. {
  5460. slave.body0.SetMask(v, nflg);
  5461. }
  5462. }
  5463. i++;
  5464. }
  5465. pos_y = (int)(rcItem.y += rcbox.height);
  5466. }
  5467. }
  5468. if (master != null)
  5469. {
  5470. //pos_y = (int)(rcItem.y += ItemHeight /4*3);
  5471. pos_y = (int)(rcItem.y += ItemHeight);
  5472. _WinprocPhase = "[voice]";
  5473. if (!slave.boMAN)
  5474. {
  5475. GUI.Label(rcItem, "【演出設定】", gsLabel);
  5476. pos_y = (int)(rcItem.y += ItemHeight);
  5477. // if (ms_.mdSlave_No > 0)
  5478. if (ms_.mdSlave_No > 0 || !bIsYotogiScene) //v5.0
  5479. GUI.enabled = true;
  5480. else
  5481. GUI.enabled = false;
  5482. /*Color cbk = GUI.contentColor;
  5483. if (ms_.mdSlave_No > 0)
  5484. GUI.enabled = true;
  5485. else
  5486. GUI.contentColor = Color.gray;*/
  5487. Rect rctmp0 = new Rect(rcItem.x, rcItem.y, (rcItem.width - 65), rcItem.height);
  5488. p_mscfg.doVoiceAndFacePlay = GUI.Toggle(rctmp0, p_mscfg.doVoiceAndFacePlay, "Slaveサブメイド夜伽演出", gsToggle);
  5489. pos_y = (int)(rcItem.y += ItemHeight);
  5490. if (p_mscfg.doVoiceAndFacePlay)
  5491. {
  5492. rctmp0.x += rctmp0.width;
  5493. rctmp0.width = rcItem.width - rctmp0.width;
  5494. bool voiceStop = !GUI.Toggle(rctmp0, !p_mscfg.doVoiceDisabled, "ボイス", gsToggle);
  5495. if (voiceStop != p_mscfg.doVoiceDisabled)
  5496. {
  5497. p_mscfg.doVoiceDisabled = voiceStop;
  5498. if (voiceStop && ms_.bVoicePlaying)
  5499. {
  5500. slave.AudioMan.Stop(0f);
  5501. ms_.bVoicePlaying = false;
  5502. }
  5503. }
  5504. if (GUI.Button(new Rect(ItemX + 10, (pos_y), 20, 20), (showVymPlaySet ? "-" : "+"), gsButton))
  5505. {
  5506. showVymPlaySet = !showVymPlaySet;
  5507. }
  5508. GUI.Label(new Rect(ItemX + 20 + 10, pos_y, ItemWidth - 20 - 10, ItemHeight), "夜伽演出オプション", gsLabel);
  5509. pos_y = (int)(rcItem.y += ItemHeight);
  5510. if (showVymPlaySet)
  5511. {
  5512. Rect rctmp = new Rect(rcItem.x + 10, rcItem.y, (rcItem.width - 10) / 3, rcItem.height);
  5513. VYMModule.VymModule.cfg.HohoEnabled = GUI.Toggle(rctmp, VYMModule.VymModule.cfg.HohoEnabled, "頬染め", gsToggle);
  5514. rctmp.x += rctmp.width;
  5515. VYMModule.VymModule.cfg.YodareEnabled = GUI.Toggle(rctmp, VYMModule.VymModule.cfg.YodareEnabled, "ヨダレ", gsToggle);
  5516. rctmp.x += rctmp.width;
  5517. VYMModule.VymModule.cfg.NamidaEnabled = GUI.Toggle(rctmp, VYMModule.VymModule.cfg.NamidaEnabled, "ナミダ", gsToggle);
  5518. pos_y = (int)(rcItem.y += ItemHeight);
  5519. GUI.Label(new Rect(ItemX + 10, pos_y, ItemWidth - 20, ItemHeight), "【ボイスモード選択】", gsLabel);
  5520. pos_y = (int)(rcItem.y += ItemHeight);
  5521. string[] e_names = Enum.GetNames(typeof(VYMModule.VymModule.VoiceMode));
  5522. for (int j = 0; j < e_names.Length; j++)
  5523. {
  5524. // iniにカスタム名の指定があれば反映
  5525. var custom = cfg.customNames.FirstOrDefault(x => x[0] == e_names[j]);
  5526. if (custom != null)
  5527. e_names[j] = custom[1];
  5528. }
  5529. rctmp = new Rect(ItemX + 10, pos_y, ItemWidth - 10, ItemHeight);
  5530. if (ComboVoiceMode.Show(rctmp, ItemHeight, ItemHeight * 4, e_names, null, gsButton, gsButton))
  5531. {
  5532. if (ComboVoiceMode.sIndex >= 0)
  5533. {
  5534. VYMModule.VymModule.cfg.eVoiceMode = (VYMModule.VymModule.VoiceMode)ComboVoiceMode.sIndex;
  5535. }
  5536. }
  5537. pos_y = (int)(rcItem.y += ItemHeight);
  5538. if (ComboVoiceMode.boPop)
  5539. {
  5540. pos_y = (int)(rcItem.y += (ItemHeight * 4));
  5541. }
  5542. bool manu_e = GUI.Toggle(new Rect(ItemX + 10, pos_y, ItemWidth - 20, ItemHeight), p_mscfg.doManualVfPlay,
  5543. "マニュアルプレイモード", gsToggle);
  5544. pos_y = (int)(rcItem.y += ItemHeight);
  5545. if (manu_e != p_mscfg.doManualVfPlay)
  5546. {
  5547. //音声停止判定
  5548. p_mscfg.doManualVfPlay = manu_e;
  5549. if (!manu_e && ms_.bVoicePlaying)
  5550. {
  5551. slave.AudioMan.Stop(0f);
  5552. ms_.bVoicePlaying = false;
  5553. }
  5554. }
  5555. if (p_mscfg.doManualVfPlay)
  5556. {
  5557. GUI.Box(new Rect(ItemX + 10, pos_y, ItemWidth - 10, ItemHeight * 6), "");
  5558. const int MvpX = ItemX + 20;
  5559. if (p_mscfg.manuVf_iExcite >= 1000)
  5560. {
  5561. //拡張Lvスタン用
  5562. GUI.Label(new Rect(MvpX, pos_y, ItemWidth, ItemHeight), "興奮: - スタン状態 -", gsLabel);
  5563. }
  5564. else
  5565. {
  5566. var tsize = gsLabel.CalcSize(new GUIContent("興奮: "));
  5567. GUI.Label(new Rect(MvpX, pos_y, tsize.x, ItemHeight), "興奮: ", gsLabel);
  5568. Color cbk_mn = GUI.color;
  5569. if (p_mscfg.manuVf_iExcite < VymModule.cfg.vExciteLevelThresholdV1)
  5570. {
  5571. //vExciteLevel = 1;
  5572. //GUI.color = Color.white;
  5573. }
  5574. else if (p_mscfg.manuVf_iExcite < VymModule.cfg.vExciteLevelThresholdV2)
  5575. {
  5576. //vExciteLevel = 2;
  5577. GUI.color = Color.cyan;
  5578. }
  5579. else if (p_mscfg.manuVf_iExcite < VymModule.cfg.vExciteLevelThresholdV3)
  5580. {
  5581. //vExciteLevel = 3;
  5582. GUI.color = Color.yellow;
  5583. }
  5584. else if (VymModule.cfg.vExciteLevelThresholdV3 <= p_mscfg.manuVf_iExcite)
  5585. {
  5586. //vExciteLevel = 4;
  5587. GUI.color = Color.magenta;
  5588. }
  5589. GUI.Label(new Rect(MvpX + tsize.x, pos_y, ItemDw * 3, ItemHeight), "" + p_mscfg.manuVf_iExcite, gsLabel);
  5590. p_mscfg.manuVf_iExcite = (int)GUI.HorizontalSlider(new Rect(ItemX + 10 + ItemDw * 4 - 10, pos_y + 5, ItemWidth - ItemDw * 4 - 10 - 45, ItemHeight - 5), p_mscfg.manuVf_iExcite, 0, 300);
  5591. GUI.color = cbk_mn;
  5592. }
  5593. if (GUI.Toggle(new Rect(ItemX + 10 + ItemDw * 4 + (ItemWidth - ItemDw * 4 - 10 - 45), pos_y, 45, ItemHeight), (p_mscfg.manuVf_iExcite >= 1000), "Stun", gsToggle)/* && (p_mscfg.manuVf_iExcite < 1000)*/)
  5594. p_mscfg.manuVf_iExcite = 1000;
  5595. else if (p_mscfg.manuVf_iExcite >= 1000)
  5596. p_mscfg.manuVf_iExcite = 300;
  5597. pos_y = (int)(rcItem.y += ItemHeight);
  5598. const int MNTGL4 = (ItemWidth - 20) / 4;
  5599. Rect rctgl = new Rect(MvpX, pos_y, MNTGL4, ItemHeight);
  5600. if (GUI.Toggle(rctgl, (p_mscfg.manuVf_mState == 10), "止", gsToggle) && (p_mscfg.manuVf_mState != 10))
  5601. p_mscfg.manuVf_mState = 10;
  5602. rctgl.x += rctgl.width;
  5603. if (GUI.Toggle(rctgl, (p_mscfg.manuVf_mState == 20), "弱", gsToggle) && (p_mscfg.manuVf_mState != 20))
  5604. p_mscfg.manuVf_mState = 20;
  5605. rctgl.x += rctgl.width;
  5606. if (GUI.Toggle(rctgl, (p_mscfg.manuVf_mState == 30), "強", gsToggle) && (p_mscfg.manuVf_mState != 30))
  5607. p_mscfg.manuVf_mState = 30;
  5608. rctgl.x += rctgl.width;
  5609. if (GUI.Toggle(rctgl, (p_mscfg.manuVf_mState == 40), "余韻", gsToggle) && (p_mscfg.manuVf_mState != 40))
  5610. p_mscfg.manuVf_mState = 40;
  5611. rctgl.x += rctgl.width;
  5612. pos_y = (int)(rcItem.y += ItemHeight);
  5613. if (GUI.Button(new Rect(MvpX + 5, pos_y, ItemWidth - 30, ItemHeight), "強制絶頂の実行"
  5614. + (ms_.manuKyoseiZeccho <= 0 ? "" : " +" + ms_.manuKyoseiZeccho.ToString()), gsButton))
  5615. {
  5616. ms_.manuKyoseiZeccho++;
  5617. }
  5618. pos_y = (int)(rcItem.y += ItemHeight);
  5619. GUI.Label(new Rect(MvpX, pos_y, ItemWidth - 20, ItemHeight * 3), "※表情、ボイスは設定変更時やMasterのモーション変化時にini設定テーブルからランダム選択", gsLabel);
  5620. pos_y = (int)(rcItem.y += ItemHeight * 3);
  5621. }
  5622. VymModule.vMaidParam mp;
  5623. if (!VymModule.maidParam.TryGetValue(slave, out mp))
  5624. mp = new VymModule.vMaidParam();
  5625. bool mz = GUI.Toggle(new Rect(ItemX + 10, pos_y, ItemDw * 6, ItemHeight), p_mscfg.manuVf_mOrgcmb >= 0, "絶頂数ロック: " + mp.vOrgasmCmb.ToString(), gsToggle);
  5626. if (!mz)
  5627. {
  5628. GUI.enabled = false;
  5629. GUI.HorizontalSlider(new Rect(ItemX + 10 + ItemDw * 6, pos_y + 5, ItemWidth - ItemDw * 6 - 10, ItemHeight - 5), mp.vOrgasmCmb, 0, 5);
  5630. p_mscfg.manuVf_mOrgcmb = -1;
  5631. GUI.enabled = true;
  5632. }
  5633. else
  5634. {
  5635. if (p_mscfg.manuVf_mOrgcmb < 0)
  5636. p_mscfg.manuVf_mOrgcmb = mp.vOrgasmCmb;
  5637. p_mscfg.manuVf_mOrgcmb = (int)GUI.HorizontalSlider(new Rect(ItemX + 10 + ItemDw * 6, pos_y + 5, ItemWidth - ItemDw * 6 - 10, ItemHeight - 5), p_mscfg.manuVf_mOrgcmb, 0, 5);
  5638. }
  5639. pos_y = (int)(rcItem.y += ItemHeight);
  5640. p_mscfg.doZecchoKeiren = GUI.Toggle(new Rect(ItemX + 10, pos_y, ItemDw * 6, ItemHeight), p_mscfg.doZecchoKeiren, "絶頂痙攣 β: " + Math.Round(p_mscfg.fZecchoKeirenParam, 3), gsToggle);
  5641. if (p_mscfg.doZecchoKeiren)
  5642. p_mscfg.fZecchoKeirenParam = GUI.HorizontalSlider(new Rect(ItemX + 10 + ItemDw * 6, pos_y + 5, ItemWidth - ItemDw * 6 - 10, ItemHeight - 5), p_mscfg.fZecchoKeirenParam, 0, 0.5f);
  5643. pos_y = (int)(rcItem.y += ItemHeight);
  5644. }
  5645. }
  5646. bool guibk_01 = GUI.enabled;
  5647. if (ms_.mdSlave_No == 0 && !bIsYotogiScene) //v5.0
  5648. GUI.enabled = false;
  5649. p_mscfg.doFaceSync = GUI.Toggle(rcItem, p_mscfg.doFaceSync, "Slaveの表情をMaid0から複製", gsToggle);
  5650. if (ms_.mdSlave_No == 0 && !bIsYotogiScene) //v5.0
  5651. GUI.enabled = guibk_01;
  5652. pos_y = (int)(rcItem.y += ItemHeight);
  5653. if (bIsVymPlg && p_mscfg.doVoiceAndFacePlay)
  5654. {
  5655. Rect rcV = new Rect(rcItem);
  5656. rcV.width -= 56;
  5657. bool bo = GUI.Toggle(rcV, p_mscfg.doVoiceAndFacePlayOnVYM, "夜伽以外VibeYourMaidに連動", gsToggle);
  5658. if (bo != p_mscfg.doVoiceAndFacePlayOnVYM)
  5659. {
  5660. p_mscfg.doVoiceAndFacePlayOnVYM = bo;
  5661. //音声停止判定
  5662. if (!bo && ms_.bVoicePlaying)
  5663. {
  5664. slave.AudioMan.Stop(0f);
  5665. ms_.bVoicePlaying = false;
  5666. }
  5667. }
  5668. rcV.x += rcV.width;
  5669. rcV.width = 56;
  5670. p_mscfg.doVoiceAndFacePlayOnVYM_Zeccho = GUI.Toggle(rcV, p_mscfg.doVoiceAndFacePlayOnVYM_Zeccho, "⇔絶頂", gsToggle);
  5671. pos_y = (int)(rcItem.y += ItemHeight);
  5672. //GUI.enabled = true;
  5673. }
  5674. //pos_y = (int)(rcItem.y += ItemHeight);
  5675. GUI.enabled = true;
  5676. //GUI.contentColor = cbk;
  5677. }
  5678. else if (slave.boMAN)
  5679. {
  5680. GUI.Label(rcItem, "【演出設定】", gsLabel);
  5681. pos_y = (int)(rcItem.y += ItemHeight);
  5682. }
  5683. }//master!=null
  5684. if (!slave.boMAN)
  5685. {
  5686. if (GUI.Button(new Rect(ItemX, (pos_y), 20, 20), (showSlaveEyeToTgt ? "-" : "+"), gsButton))
  5687. {
  5688. showSlaveEyeToTgt = !showSlaveEyeToTgt;
  5689. }
  5690. GUI.Label(new Rect(ItemX + 20, pos_y, ItemWidth - 20, ItemHeight), "Slave視線制御 (標準⇒カメラ)", gsLabel);
  5691. pos_y = (int)(rcItem.y += ItemHeight);
  5692. if (showSlaveEyeToTgt)
  5693. {
  5694. const int LX = ItemX + 10;
  5695. {//Slave汎用
  5696. //Transform tgt_tr = GameMain.Instance.MainCamera.transform;
  5697. bool bochk = slave.body0.boHeadToCam;//(tgt_tr == slave.body0.trsLookTarget);
  5698. Rect rcb = new Rect(rcItem);
  5699. rcb.x = LX;
  5700. rcb.width -= 90;
  5701. bool bonew = GUI.Toggle(rcb, bochk, "Slaveの顔を向ける", gsToggle);
  5702. if (bochk != bonew)
  5703. {
  5704. slave.body0.boHeadToCam = bonew;
  5705. /*
  5706. if (bocnk)
  5707. slave.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, GameUty.MillisecondToSecond(500));
  5708. else
  5709. slave.EyeToReset(GameUty.MillisecondToSecond(500));
  5710. */
  5711. }
  5712. bochk = slave.body0.boEyeToCam;//(tgt_tr == slave.body0.trsLookTarget);
  5713. rcb.x += rcb.width;
  5714. rcb.width = 90;
  5715. bonew = GUI.Toggle(rcb, bochk, "目を向ける", gsToggle);
  5716. if (bochk != bonew)
  5717. {
  5718. slave.body0.boEyeToCam = bonew;
  5719. /*if (bonew)
  5720. slave.EyeToCamera(Maid.EyeMoveType.目と顔を向ける, GameUty.MillisecondToSecond(500));
  5721. else
  5722. slave.EyeToReset(GameUty.MillisecondToSecond(500));*/
  5723. }
  5724. }
  5725. Rect rcItem2 = new Rect(rcItem);
  5726. rcItem2.x = LX;
  5727. rcItem2.width -= LX;
  5728. //Slave二人目以降オプション
  5729. if (!slave.boMAN && ms_.mdSlave_No > 0 && ms_.mdSlaves[0].mem)
  5730. {
  5731. pos_y = (int)(rcItem.y += ItemHeight);
  5732. rcItem2.y = pos_y;
  5733. Maid tgt = ms_.mdSlaves[0].mem;
  5734. string tgtBoneName = "Bip01 Head";
  5735. Transform tgt_tr = BoneLink.BoneLink.SearchObjName(tgt.body0.m_Bones.transform, tgtBoneName, true);
  5736. bool bochk = (tgt_tr == slave.body0.trsLookTarget);
  5737. bool bocnk = GUI.Toggle(rcItem2, bochk, "Slaveの視線をMaid0の顔に向ける", gsToggle);
  5738. if (bochk != bocnk)
  5739. {
  5740. if (bocnk)
  5741. slave.EyeToTarget(tgt, GameUty.MillisecondToSecond(500), tgtBoneName);
  5742. else
  5743. slave.EyeToReset(GameUty.MillisecondToSecond(500));
  5744. }
  5745. }
  5746. //pos_y = (int)(rcItem.y += ItemHeight);
  5747. if (!slave.boMAN && ms_.mdSlave_No != 0 && ms_.mdSlaves[0].mem)
  5748. {
  5749. pos_y = (int)(rcItem.y += ItemHeight);
  5750. rcItem2.y = pos_y;
  5751. Maid tgt = ms_.mdSlaves[0].mem;
  5752. string tgtBoneName = "_IK_vagina";
  5753. Transform tgt_tr = BoneLink.BoneLink.SearchObjName(tgt.body0.m_Bones.transform, tgtBoneName, true);
  5754. bool bochk = (tgt_tr == slave.body0.trsLookTarget);
  5755. bool bocnk = GUI.Toggle(rcItem2, bochk, "Slaveの視線をMaid0の秘部に向ける", gsToggle);
  5756. if (bochk != bocnk)
  5757. {
  5758. if (bocnk)
  5759. slave.EyeToTarget(tgt, GameUty.MillisecondToSecond(500), tgtBoneName);
  5760. else
  5761. slave.EyeToReset(GameUty.MillisecondToSecond(500));
  5762. }
  5763. pos_y = (int)(rcItem.y += ItemHeight / 2);
  5764. }
  5765. //Slaveメイド時オプション
  5766. if (!slave.boMAN && master)
  5767. {
  5768. pos_y = (int)(rcItem.y += ItemHeight);
  5769. rcItem2.y = pos_y;
  5770. Maid tgt = master;
  5771. string tgtBoneName = "ManBip Head";
  5772. Transform tgt_tr = BoneLink.BoneLink.SearchObjName(tgt.body0.m_Bones.transform, tgtBoneName, true);
  5773. bool bochk = (tgt_tr == slave.body0.trsLookTarget);
  5774. bool bocnk = GUI.Toggle(rcItem2, bochk, "Slaveの視線をMasterの顔に向ける", gsToggle);
  5775. if (bochk != bocnk)
  5776. {
  5777. if (bocnk)
  5778. slave.EyeToTarget(tgt, GameUty.MillisecondToSecond(500), tgtBoneName);
  5779. else
  5780. slave.EyeToReset(GameUty.MillisecondToSecond(500));
  5781. }
  5782. }
  5783. if (!slave.boMAN && master)
  5784. {
  5785. pos_y = (int)(rcItem.y += ItemHeight);
  5786. rcItem2.y = pos_y;
  5787. Maid tgt = master;
  5788. string tgtBoneName = "chinko2";
  5789. Transform tgt_tr = BoneLink.BoneLink.SearchObjName(tgt.body0.m_Bones.transform, tgtBoneName, true);
  5790. bool bochk = (tgt_tr == slave.body0.trsLookTarget);
  5791. bool bocnk = GUI.Toggle(rcItem2, bochk, "Slaveの視線をMasterの局部に向ける", gsToggle);
  5792. if (bochk != bocnk)
  5793. {
  5794. if (bocnk)
  5795. slave.EyeToTarget(tgt, GameUty.MillisecondToSecond(500), tgtBoneName);
  5796. else
  5797. slave.EyeToReset(GameUty.MillisecondToSecond(500));
  5798. }
  5799. }
  5800. pos_y = (int)(rcItem.y += ItemHeight);
  5801. }
  5802. }
  5803. // ハンドアタッチカスタム
  5804. var bkflg = p_mscfg.doIKTargetMHandSpCustom;
  5805. p_mscfg.doIKTargetMHandSpCustom =
  5806. GUI.Toggle(new Rect(ItemX, pos_y, ItemWidth -60, ItemHeight), p_mscfg.doIKTargetMHandSpCustom,
  5807. "Slave 手のアタッチ先変更", gsToggle);
  5808. if (p_mscfg.doIKTargetMHandSpCustom)
  5809. {
  5810. p_mscfg.doIKTargetMHandSpCustom_v2 =
  5811. GUI.Toggle(new Rect(ItemX + (ItemWidth - 60), pos_y, 60, ItemHeight), p_mscfg.doIKTargetMHandSpCustom_v2,
  5812. "v2", gsToggle);
  5813. }
  5814. // アタッチ設定の変更チェック
  5815. if (p_mscfg.doIKTargetMHandSpCustom != bkflg)
  5816. {
  5817. if (p_mscfg.doIKTargetMHandSpCustom)
  5818. {
  5819. // 元の値をバックアップ
  5820. ms_.bkupHandTgt = new BkupHandsAtc(slave.body0);
  5821. }
  5822. else if (ms_.bkupHandTgt != null)
  5823. {
  5824. // アタッチの復元
  5825. if (!ms_.bkupHandTgt.RestoreAtc(ref slave.body0))
  5826. {
  5827. // 失敗ならアタッチの解除
  5828. slave.IKTargetClear();
  5829. }
  5830. ms_.bkupHandTgt = null;
  5831. }
  5832. }
  5833. if (p_mscfg.doIKTargetMHandSpCustom && ms_.bkupHandTgt != null
  5834. && ms_.bkupHandTgt.bkupbody != slave.body0)
  5835. {
  5836. // メイド変更あり、元の値を復元
  5837. ms_.bkupHandTgt.RestoreAtc(ref ms_.bkupHandTgt.bkupbody);
  5838. // メイド変更あり、元の値を再バックアップ
  5839. ms_.bkupHandTgt = new BkupHandsAtc(slave.body0);
  5840. }
  5841. pos_y = (int)(rcItem.y += ItemHeight);
  5842. if (!p_mscfg.doIKTargetMHandSpCustom)
  5843. {
  5844. // サブ項目無効
  5845. if (showHandTTPosSlider)
  5846. showHandTTPosSlider = false;
  5847. }
  5848. //if (p_mscfg.doIKTargetMHandSpCustom)
  5849. else
  5850. {
  5851. void change_tgt(bool boR, ref ATgtChar atgt, int inc)
  5852. {
  5853. atgt += inc;
  5854. chkatgt(ref atgt);
  5855. void chkatgt(ref ATgtChar atgt_)
  5856. {
  5857. if ((int)atgt_ < 0)
  5858. atgt_ = ATgtChar.None;
  5859. if ((int)atgt_ >= Enum.GetNames(typeof(ATgtChar)).Length)
  5860. atgt_ = ATgtChar.None;
  5861. }
  5862. while (GetHandAtcTgt(boR, slave, master, p_mscfg) == null) //居ないのは無視
  5863. {
  5864. if (atgt == ATgtChar.None)
  5865. break;
  5866. atgt += inc;
  5867. chkatgt(ref atgt);
  5868. }
  5869. chkatgt(ref atgt);
  5870. if (boR)
  5871. {
  5872. p_mscfg.doIKTargetMHandSpR_TgtBone = string.Empty;
  5873. if (atgt == ATgtChar.None)
  5874. {
  5875. //解除
  5876. AtccHand1R(slave, null, string.Empty, Vector3.zero);
  5877. }
  5878. }
  5879. else
  5880. {
  5881. p_mscfg.doIKTargetMHandSpL_TgtBone = string.Empty;
  5882. if (p_mscfg.doIKTargetMHandSpL_TgtChar == ATgtChar.None)
  5883. {
  5884. //解除
  5885. AtccHand1L(slave, null, string.Empty, Vector3.zero);
  5886. }
  5887. }
  5888. }
  5889. //rcItem.y = (pos_y += 20);
  5890. GUI.Label(new Rect(ItemX + 20, pos_y, 80, ItemHeight), "右手 対象:", gsLabel);
  5891. if (p_mscfg.doIKTargetMHandSpR_TgtChar != ATgtChar.None
  5892. && GUI.Button(new Rect(ItemX + 80, (pos_y), 20, 20), "<", gsButton))
  5893. {
  5894. change_tgt(true, ref p_mscfg.doIKTargetMHandSpR_TgtChar, -1);
  5895. }
  5896. if (GUI.Button(new Rect(ItemX + 100, (pos_y), ItemWidth - 100, 20), p_mscfg.doIKTargetMHandSpR_TgtChar.ToString(), gsButton))
  5897. {
  5898. change_tgt(true, ref p_mscfg.doIKTargetMHandSpR_TgtChar, +1);
  5899. }
  5900. rcItem.y = (pos_y += 20);
  5901. if (p_mscfg.doIKTargetMHandSpR_TgtChar != ATgtChar.None)
  5902. {
  5903. seth(true);
  5904. }
  5905. GUI.Label(new Rect(ItemX + 20, pos_y, 80, ItemHeight), "左手 対象:", gsLabel);
  5906. if (p_mscfg.doIKTargetMHandSpL_TgtChar != ATgtChar.None
  5907. && GUI.Button(new Rect(ItemX + 80, (pos_y), 20, 20), "<", gsButton))
  5908. {
  5909. change_tgt(false, ref p_mscfg.doIKTargetMHandSpL_TgtChar, -1);
  5910. }
  5911. if (GUI.Button(new Rect(ItemX + 100, (pos_y), ItemWidth - 100, 20), p_mscfg.doIKTargetMHandSpL_TgtChar.ToString(), gsButton))
  5912. {
  5913. change_tgt(false, ref p_mscfg.doIKTargetMHandSpL_TgtChar, +1);
  5914. }
  5915. rcItem.y = (pos_y += 20);
  5916. if (p_mscfg.doIKTargetMHandSpL_TgtChar != ATgtChar.None)
  5917. {
  5918. seth(false);
  5919. }
  5920. // 手のアタッチ変更と調整
  5921. void seth(bool boR)
  5922. {
  5923. Maid tgt = GetHandAtcTgt(boR, slave, master, p_mscfg);
  5924. if (!tgt)
  5925. {
  5926. return;
  5927. }
  5928. int LX = ItemX + 20;
  5929. string[] e_names; // = tgt.boMAN ? Defines.data.ManBones : Defines.data.MaidBones;
  5930. List<string> slist = new List<string>();
  5931. /*
  5932. TMorph t = tgt.body0.goSlot[(int)TBody.SlotID.body].morph;
  5933. if (t != null)
  5934. {
  5935. foreach (var p in t.dicAttachPoint)
  5936. {
  5937. slist.Add(p.Key);
  5938. }
  5939. }*/
  5940. // アタッチポイント一覧取得
  5941. slist.Add("無し");
  5942. for (int i = 0; i < tgt.body0.goSlot.Count; i++)
  5943. {
  5944. TMorph t = tgt.body0.goSlot[i].morph;
  5945. if (t == null)
  5946. {
  5947. continue;
  5948. }
  5949. foreach (var p in t.dicAttachPoint)
  5950. {
  5951. slist.Add(((TBody.SlotID)i).ToString() + "⇒" + p.Key);
  5952. }
  5953. // v5.0
  5954. string[] bone_names = tgt.boMAN ? Defines.data.ManBones : Defines.data.MaidBones;
  5955. foreach (var p in bone_names)
  5956. {
  5957. slist.Add(Defines.data.comboBonePrefix + p);
  5958. }
  5959. }
  5960. e_names = slist.ToArray();
  5961. // コンボボックス
  5962. var combo = boR ? ComboHandTgtBoneR : ComboHandTgtBoneL;
  5963. var selected = boR ? p_mscfg.doIKTargetMHandSpR_TgtBone : p_mscfg.doIKTargetMHandSpL_TgtBone;
  5964. if (string.IsNullOrEmpty(selected))
  5965. selected = "アタッチポイント選択";
  5966. Rect rctmp = new Rect(LX, pos_y, ItemWidth - 20 - 40, ItemHeight);
  5967. Rect rect_list = new Rect(rctmp);
  5968. rect_list.width = ItemWidth - 20;
  5969. rect_list.y += rctmp.height;
  5970. rect_list.height = ItemHeight * 4;
  5971. if (combo.Show(rctmp, ItemHeight, rect_list, e_names, selected, gsButton, gsButton))
  5972. {
  5973. v3OffsetsV2 v3of2 = new v3OffsetsV2(p_v3of, p_mscfg);
  5974. if (combo.sIndex >= 0)
  5975. {
  5976. if (boR)
  5977. {
  5978. p_mscfg.doIKTargetMHandSpR_TgtBone = combo.sSelected;
  5979. //AtccHand1R(slave, tgt, p_mscfg.doIKTargetMHandSpR_TgtBone, p_v3of.v3HandROffset);
  5980. AtccHand1R(slave, tgt, p_mscfg.doIKTargetMHandSpR_TgtBone, v3of2.v3HandROffset);
  5981. }
  5982. else
  5983. {
  5984. p_mscfg.doIKTargetMHandSpL_TgtBone = combo.sSelected;
  5985. //AtccHand1L(slave, tgt, p_mscfg.doIKTargetMHandSpL_TgtBone, p_v3of.v3HandLOffset);
  5986. AtccHand1L(slave, tgt, p_mscfg.doIKTargetMHandSpL_TgtBone, v3of2.v3HandLOffset);
  5987. }
  5988. }
  5989. }
  5990. var tgtstr = boR ? p_mscfg.doIKTargetMHandSpR_TgtBone : p_mscfg.doIKTargetMHandSpL_TgtBone;
  5991. bool open = showHandTTPosSlider && showPosSliderHandR == boR;
  5992. if (combo.boPop || (open && ATgtStr_IsNullOrEmpty(tgtstr)))
  5993. {
  5994. // 調整を一度閉じる
  5995. if (showHandTTPosSlider)
  5996. {
  5997. showHandTTPosSlider = false;
  5998. // Gizmo消す
  5999. GizmoHsVisible(showHandTTPosSlider);
  6000. }
  6001. }
  6002. if (ATgtStr_IsNullOrEmpty(tgtstr))
  6003. {
  6004. //if (showHandTTPosSlider)
  6005. // showHandTTPosSlider = false;
  6006. GUI.enabled = false;
  6007. if (GUI.Button(new Rect(LX + (ItemWidth - 20 - 40), pos_y, 40, ItemHeight), "調整", gsButton))
  6008. { }
  6009. GUI.enabled = true;
  6010. }
  6011. else
  6012. {
  6013. if (GUI.Button(new Rect(LX + (ItemWidth - 20 - 40), pos_y, 40, ItemHeight), (open ? "閉" : "調整"), gsButton))
  6014. {
  6015. showHandTTPosSlider = !open;
  6016. showPosSliderHandR = boR;
  6017. GizmoHsVisible(showHandTTPosSlider);
  6018. // コンボを一度閉じる
  6019. if (combo.boPop)
  6020. {
  6021. combo.boPop = false;
  6022. }
  6023. }
  6024. if (showHandTTPosSlider && showPosSliderHand)
  6025. {
  6026. // どちらもONならこっちを優先
  6027. showPosSliderHand = false;
  6028. }
  6029. }
  6030. if (showHandTTPosSlider && showPosSliderHandR == boR && !ATgtStr_IsNullOrEmpty(tgtstr))
  6031. {
  6032. v3OffsetsV2 v3of2 = new v3OffsetsV2(p_v3of, p_mscfg);
  6033. // 調整Gizmo&スライダー
  6034. if (ProcHandGizmo(slave, ref rcItem, ref pos_y, p_mscfg, p_v3of, false))
  6035. {
  6036. // 変化ありで反映
  6037. if (boR)
  6038. AtccHand1R(slave, tgt, p_mscfg.doIKTargetMHandSpR_TgtBone, v3of2.v3HandROffset);
  6039. else
  6040. AtccHand1L(slave, tgt, p_mscfg.doIKTargetMHandSpL_TgtBone, v3of2.v3HandLOffset);
  6041. }
  6042. //if (showHandTTPosSlider)
  6043. {
  6044. bool changeR = false, changeL = false;
  6045. pos_y = (int)(rcItem.y += ItemHeight);
  6046. if (boR)
  6047. {
  6048. changeR = p_mscfg.doIKTargetMHandSpCustomAltRotR;
  6049. p_mscfg.doIKTargetMHandSpCustomAltRotR =
  6050. GUI.Toggle(new Rect(ItemX + 10, pos_y, ItemWidth, ItemHeight), p_mscfg.doIKTargetMHandSpCustomAltRotR,
  6051. "アタッチ箇所からの角度指定(右手)", gsToggle);
  6052. changeR = changeR != p_mscfg.doIKTargetMHandSpCustomAltRotR;
  6053. }
  6054. else
  6055. {
  6056. changeL = p_mscfg.doIKTargetMHandSpCustomAltRotL;
  6057. p_mscfg.doIKTargetMHandSpCustomAltRotL =
  6058. GUI.Toggle(new Rect(ItemX + 10, pos_y, ItemWidth, ItemHeight), p_mscfg.doIKTargetMHandSpCustomAltRotL,
  6059. "アタッチ箇所からの角度指定(左手)", gsToggle);
  6060. changeL = changeL != p_mscfg.doIKTargetMHandSpCustomAltRotL;
  6061. }
  6062. #if DEBUG2
  6063. // MSリンク中にAltキー押しながら変更すると座標変換する v5.0
  6064. if (changeR && ms_.doMasterSlave && InputEx.GetModifierKey(InputEx.ModifierKey.Alt))
  6065. {
  6066. // 右手
  6067. //Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnR(slave), true);
  6068. Transform trh = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, GetHandBnR(master), true);
  6069. var iks = slave.body0._ikp();
  6070. var tgtMaid = iks.tgtMaidR;
  6071. if (tgtMaid != null && tgtMaid.body0 != null && tgtMaid.body0.goSlot[iks.tgtHandR_AttachSlot].morph != null)
  6072. {
  6073. Vector3 vector2;
  6074. Quaternion rotation2;
  6075. tgtMaid.body0.goSlot[iks.tgtHandR_AttachSlot].morph.GetAttachPoint(iks.tgtHandR_AttachName, out vector2, out rotation2);
  6076. // アタッチポイント基準角度
  6077. if (p_mscfg.doIKTargetMHandSpCustomAltRotR)
  6078. p_v3of.v3HandROffsetRot = (Quaternion.Inverse(rotation2) * trh.rotation * Quaternion.Euler(p_v3of.v3HandROffsetRot)).eulerAngles;
  6079. else
  6080. p_v3of.v3HandROffsetRot = (Quaternion.Inverse(trh.rotation) * rotation2 * Quaternion.Euler(p_v3of.v3HandROffsetRot)).eulerAngles;
  6081. }
  6082. }
  6083. if (changeL && ms_.doMasterSlave && InputEx.GetModifierKey(InputEx.ModifierKey.Alt))
  6084. {
  6085. // 左手
  6086. //Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnL(slave), true);
  6087. Transform trh = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, GetHandBnL(master), true);
  6088. var iks = slave.body0._ikp();
  6089. var tgtMaid = iks.tgtMaidL;
  6090. if (tgtMaid != null && tgtMaid.body0 != null && tgtMaid.body0.goSlot[iks.tgtHandL_AttachSlot].morph != null)
  6091. {
  6092. Vector3 vector2;
  6093. Quaternion rotation2;
  6094. tgtMaid.body0.goSlot[iks.tgtHandL_AttachSlot].morph.GetAttachPoint(iks.tgtHandL_AttachName, out vector2, out rotation2);
  6095. // アタッチポイント基準角度
  6096. if (p_mscfg.doIKTargetMHandSpCustomAltRotL)
  6097. p_v3of.v3HandLOffsetRot = (Quaternion.Inverse(rotation2) * trh.rotation * Quaternion.Euler(p_v3of.v3HandLOffsetRot)).eulerAngles;
  6098. else
  6099. p_v3of.v3HandLOffsetRot = (Quaternion.Inverse(trh.rotation) * rotation2 * Quaternion.Euler(p_v3of.v3HandLOffsetRot)).eulerAngles;
  6100. }
  6101. }
  6102. #endif
  6103. }
  6104. }
  6105. pos_y = (int)(rcItem.y += ItemHeight);
  6106. if (combo.boPop)
  6107. {
  6108. pos_y = (int)(rcItem.y += (ItemHeight * 4));
  6109. }
  6110. return; //seth
  6111. }
  6112. }
  6113. if (IkXT.IsNewIK)
  6114. {
  6115. // 新IKを使うか?
  6116. var bkflg2 = p_mscfg.doIK159NewPointToDef;
  6117. p_mscfg.doIK159NewPointToDef =
  6118. GUI.Toggle(new Rect(ItemX, pos_y, ItemWidth - 95, ItemHeight), p_mscfg.doIK159NewPointToDef,
  6119. "新IK有効(IKの複製以外)", gsToggle);
  6120. if (IkXT.IsIkCtrlO118)
  6121. {
  6122. var enabled = GUI.enabled;
  6123. if (!p_mscfg.doIK159NewPointToDef)
  6124. {
  6125. GUI.enabled = false;
  6126. }
  6127. p_mscfg.doFinalIKShoulderMove =
  6128. GUI.Toggle(new Rect(ItemX + (ItemWidth - 95), pos_y, 30, ItemHeight), p_mscfg.doFinalIKShoulderMove,
  6129. "肩", gsToggle);
  6130. p_mscfg.doFinalIKThighMove =
  6131. GUI.Toggle(new Rect(ItemX + (ItemWidth - 65), pos_y, 30, ItemHeight), p_mscfg.doFinalIKThighMove,
  6132. "腿", gsToggle);
  6133. p_mscfg.fFinalIKLegWeight =
  6134. GUI.Toggle(new Rect(ItemX + (ItemWidth - 35), pos_y, 30, ItemHeight), p_mscfg.fFinalIKLegWeight > 0f,
  6135. "足", gsToggle) ? 1.0f : 0.0f;
  6136. GUI.enabled = enabled;
  6137. }
  6138. pos_y = (int)(rcItem.y += ItemHeight);
  6139. p_mscfg.doIK159RotateToHands =
  6140. GUI.Toggle(new Rect(ItemX, pos_y, ItemWidth, ItemHeight), p_mscfg.doIK159RotateToHands,
  6141. "両手にアタッチでRotateIK有効(新IK2)", gsToggle);
  6142. pos_y = (int)(rcItem.y += ItemHeight);
  6143. // アタッチ設定の変更チェック
  6144. if (p_mscfg.doIK159NewPointToDef != bkflg2)
  6145. {
  6146. // 変更処理が必要になったら追加
  6147. // 毎フレームIKをセットしてるので現状無くても大丈夫なはず
  6148. }
  6149. }
  6150. p_mscfg.doBlendHandR =
  6151. GUI.Toggle(new Rect(ItemX, pos_y, ItemWidth, ItemHeight), p_mscfg.doBlendHandR,
  6152. "手指のブレンド(右手)", gsToggle);
  6153. pos_y = (int)(rcItem.y += ItemHeight);
  6154. if (p_mscfg.doBlendHandR)
  6155. {
  6156. const int SLDS = ItemX + 10 + 90 + 5;
  6157. const int SLDW = 220 - 10 - 90;
  6158. GUI.Label(new Rect(ItemX + 10, pos_y, 90, ItemHeight), "適用: " + Math.Round(p_mscfg.fBlendHandR, 2), gsLabel);
  6159. p_mscfg.fBlendHandR = GUI.HorizontalSlider(new Rect(SLDS, (pos_y), SLDW, ItemHeight), p_mscfg.fBlendHandR, 0f, 1f);
  6160. pos_y = (int)(rcItem.y += ItemHeight);
  6161. GUI.Label(new Rect(ItemX + 10, pos_y, 90, ItemHeight), "開度: " + Math.Round(p_mscfg.fBlendHandROpen, 2), gsLabel);
  6162. p_mscfg.fBlendHandROpen = GUI.HorizontalSlider(new Rect(SLDS, (pos_y), SLDW, ItemHeight), p_mscfg.fBlendHandROpen, 0f, 1f);
  6163. pos_y = (int)(rcItem.y += ItemHeight);
  6164. GUI.Label(new Rect(ItemX + 10, pos_y, 90, ItemHeight), "握り: " + Math.Round(p_mscfg.fBlendHandRGrip, 2), gsLabel);
  6165. p_mscfg.fBlendHandRGrip = GUI.HorizontalSlider(new Rect(SLDS, (pos_y), SLDW, ItemHeight), p_mscfg.fBlendHandRGrip, 0f, 1f);
  6166. pos_y = (int)(rcItem.y += ItemHeight);
  6167. p_mscfg.doAnimeHandR =
  6168. GUI.Toggle(new Rect(ItemX + 10, pos_y, ItemWidth, ItemHeight), p_mscfg.doAnimeHandR,
  6169. "アニメーション", gsToggle);
  6170. pos_y = (int)(rcItem.y += ItemHeight);
  6171. if (p_mscfg.doAnimeHandR)
  6172. {
  6173. {
  6174. ref var val = ref p_mscfg.fAnimeHandRSpeed;
  6175. GUI.Label(new Rect(ItemX + 10, pos_y, 90, ItemHeight), "速さ: " + Math.Round(val, 2), gsLabel);
  6176. val = GUI.HorizontalSlider(new Rect(SLDS, (pos_y), SLDW, ItemHeight), val, 0f, 15f);
  6177. pos_y = (int)(rcItem.y += ItemHeight);
  6178. }
  6179. {
  6180. ref var val = ref p_mscfg.fAnimeHandRMove;
  6181. GUI.Label(new Rect(ItemX + 10, pos_y, 90, ItemHeight), "握力: " + Math.Round(val, 2), gsLabel);
  6182. val = GUI.HorizontalSlider(new Rect(SLDS, (pos_y), SLDW, ItemHeight), val, 0f, 1f);
  6183. pos_y = (int)(rcItem.y += ItemHeight);
  6184. }
  6185. }
  6186. }
  6187. p_mscfg.doBlendHandL =
  6188. GUI.Toggle(new Rect(ItemX, pos_y, ItemWidth, ItemHeight), p_mscfg.doBlendHandL,
  6189. "手指のブレンド(左手)", gsToggle);
  6190. pos_y = (int)(rcItem.y += ItemHeight);
  6191. if (p_mscfg.doBlendHandL)
  6192. {
  6193. const int SLDS = ItemX + 10 + 90 + 5;
  6194. const int SLDW = 220 - 10 - 90;
  6195. GUI.Label(new Rect(ItemX + 10, pos_y, 90, ItemHeight), "適用: " + Math.Round(p_mscfg.fBlendHandL, 2), gsLabel);
  6196. p_mscfg.fBlendHandL = GUI.HorizontalSlider(new Rect(SLDS, (pos_y), SLDW, ItemHeight), p_mscfg.fBlendHandL, 0f, 1f);
  6197. pos_y = (int)(rcItem.y += ItemHeight);
  6198. GUI.Label(new Rect(ItemX + 10, pos_y, 90, ItemHeight), "開度: " + Math.Round(p_mscfg.fBlendHandLOpen, 2), gsLabel);
  6199. p_mscfg.fBlendHandLOpen = GUI.HorizontalSlider(new Rect(SLDS, (pos_y), SLDW, ItemHeight), p_mscfg.fBlendHandLOpen, 0f, 1f);
  6200. pos_y = (int)(rcItem.y += ItemHeight);
  6201. GUI.Label(new Rect(ItemX + 10, pos_y, 90, ItemHeight), "握り: " + Math.Round(p_mscfg.fBlendHandLGrip, 2), gsLabel);
  6202. p_mscfg.fBlendHandLGrip = GUI.HorizontalSlider(new Rect(SLDS, (pos_y), SLDW, ItemHeight), p_mscfg.fBlendHandLGrip, 0f, 1f);
  6203. pos_y = (int)(rcItem.y += ItemHeight);
  6204. p_mscfg.doAnimeHandL =
  6205. GUI.Toggle(new Rect(ItemX + 10, pos_y, ItemWidth, ItemHeight), p_mscfg.doAnimeHandL,
  6206. "アニメーション", gsToggle);
  6207. pos_y = (int)(rcItem.y += ItemHeight);
  6208. if (p_mscfg.doAnimeHandL)
  6209. {
  6210. {
  6211. ref var val = ref p_mscfg.fAnimeHandLSpeed;
  6212. GUI.Label(new Rect(ItemX + 10, pos_y, 90, ItemHeight), "速さ: " + Math.Round(val, 2), gsLabel);
  6213. val = GUI.HorizontalSlider(new Rect(SLDS, (pos_y), SLDW, ItemHeight), val, 0f, 15f);
  6214. pos_y = (int)(rcItem.y += ItemHeight);
  6215. }
  6216. {
  6217. ref var val = ref p_mscfg.fAnimeHandLMove;
  6218. GUI.Label(new Rect(ItemX + 10, pos_y, 90, ItemHeight), "握力: " + Math.Round(val, 2), gsLabel);
  6219. val = GUI.HorizontalSlider(new Rect(SLDS, (pos_y), SLDW, ItemHeight), val, 0f, 1f);
  6220. pos_y = (int)(rcItem.y += ItemHeight);
  6221. }
  6222. }
  6223. }
  6224. //サブメンバーコントロール
  6225. if (ProcSubMemberCtrls(ref pos_y, ref rcItem, ms_, slave, p_mscfg))
  6226. {
  6227. //メンバー変更有
  6228. return;
  6229. }
  6230. //手のGizmo無効チェック
  6231. if (GetGizmoHsVisible())
  6232. {
  6233. // 位置設定で使ってなければ消す
  6234. if (!showPosSliderHand && !showHandTTPosSlider)
  6235. GizmoHsVisible(false);
  6236. }
  6237. _WinprocPhase = "[last]";
  6238. pos_y = (int)(rcItem.y += ItemHeight / 2);
  6239. pos_y = (int)(rcItem.y += ItemHeight);
  6240. EditScroll_cfg_sizeY = pos_y + ItemHeight;
  6241. }
  6242. catch
  6243. {
  6244. throw;
  6245. }
  6246. finally
  6247. {
  6248. GUI.EndScrollView();
  6249. }
  6250. //ギズモ移動処理
  6251. PosGizmoProc(ms_);
  6252. }
  6253. // アタッチターゲット取得
  6254. static Maid GetHandAtcTgt(bool boR, Maid slave, Maid master, MsLinkConfig p_mscfg)
  6255. {
  6256. Maid tgt = null;
  6257. var chk = boR ? p_mscfg.doIKTargetMHandSpR_TgtChar
  6258. : p_mscfg.doIKTargetMHandSpL_TgtChar;
  6259. switch (chk)
  6260. {
  6261. case ATgtChar.Self:
  6262. tgt = slave;
  6263. break;
  6264. case ATgtChar.Master:
  6265. tgt = master;
  6266. break;
  6267. case ATgtChar.Maid0:
  6268. if (slave != _MaidList[0].mem && _MaidList[0].mem)
  6269. tgt = _MaidList[0].mem;
  6270. break;
  6271. }
  6272. if (chk >= ATgtChar.Maid1)
  6273. {
  6274. int i = chk - ATgtChar.Maid0;
  6275. if (i < _MaidList.Count())
  6276. {
  6277. if (slave != _MaidList[i].mem && _MaidList[i].mem)
  6278. tgt = _MaidList[i].mem;
  6279. }
  6280. }
  6281. return tgt;
  6282. }
  6283. // Gizmoの回転差分Vector3を得る
  6284. Vector3 CalcGizmoDvRot(OhMyGizmo gz)
  6285. {
  6286. if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
  6287. {
  6288. gz.transform.rotation = Quaternion.Slerp(gz._backup_rot, gz.rotation, GIZMO_SLOWRATE);
  6289. }
  6290. var q = (Quaternion.Inverse(gz._backup_rotLocal_u1) * gz.transform.localRotation);
  6291. var v3 = q.eulerAngles;
  6292. return va180(v3);
  6293. }
  6294. // 回転初期値
  6295. void BkupGizmoU1(OhMyGizmo gz, Vector3 dv)
  6296. {
  6297. // 開始角度を保持
  6298. gz.BkupPosAndRotLocalU1();
  6299. gz._backup_rotLocal_u1 = gz._backup_rotLocal_u1 * Quaternion.Inverse(Quaternion.Euler(dv));
  6300. }
  6301. // 手のアタッチ調整ギズモ&スライダー
  6302. private bool ProcHandGizmo(Maid slave, ref Rect rcItem, ref int pos_y, MsLinkConfig p_mscfg, v3Offsets p_v3of_org, bool boSelectLR = true)
  6303. {
  6304. bool bochg = false;
  6305. v3OffsetsV2 p_v3of2 = boSelectLR ? new v3OffsetsV2(p_v3of_org, false) : new v3OffsetsV2(p_v3of_org, p_mscfg); // v5.0
  6306. if (slave)
  6307. {
  6308. const int SLDW = 220;
  6309. const int LX = ItemX + 10;
  6310. const int BW = 25;
  6311. const int LW = SLDW - BW * 3 - 5;
  6312. const int EDTW = LW + BW * 2 + 5;
  6313. // v5.0 カスタムアタッチの座標ズレを防ぐために反映
  6314. bool cusR = false, cusL = false;
  6315. Quaternion qCusR = Quaternion.identity, qCusL = Quaternion.identity;
  6316. if (p_mscfg.doIKTargetMHandSpCustom && p_mscfg.doIKTargetMHandSpCustom_v2)
  6317. {
  6318. _MSlinks[_pageNum].handsAtcpProc();
  6319. // カスタムアタッチ
  6320. if (p_mscfg.doIKTargetMHandSpCustomAltRotR && p_mscfg.doIKTargetMHandSpR_TgtChar != ATgtChar.None)
  6321. {
  6322. // アタッチ先座標
  6323. var iks = slave.body0._ikp();
  6324. if (iks != null && iks.tgtMaidR != null && iks.tgtHandR_AttachSlot >= 0 && !string.IsNullOrEmpty(iks.tgtHandR_AttachName))
  6325. {
  6326. if (iks.tgtMaidR.body0 != null && iks.tgtMaidR.body0.goSlot[iks.tgtHandR_AttachSlot].morph != null)
  6327. {
  6328. Vector3 vector2;
  6329. Quaternion rotation2;
  6330. iks.tgtMaidR.body0.goSlot[iks.tgtHandR_AttachSlot].morph.GetAttachPoint(iks.tgtHandR_AttachName, out vector2, out rotation2);
  6331. //Console.WriteLine("g-r");
  6332. // アタッチポイント基準角度
  6333. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " R Hand", true);
  6334. //Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnR(slave), true);
  6335. qCusR = trh.rotation = rotation2 * Quaternion.Euler(p_v3of2.v3HandROffsetRot);
  6336. cusR = true;
  6337. }
  6338. }
  6339. else if (iks != null && iks.tgtHandR)
  6340. {
  6341. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " R Hand", true);
  6342. //Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnR(slave), true);
  6343. qCusR = trh.rotation = iks.tgtHandR.rotation * Quaternion.Euler(p_v3of2.v3HandROffsetRot);
  6344. cusR = true;
  6345. }
  6346. }
  6347. if (p_mscfg.doIKTargetMHandSpCustomAltRotL && p_mscfg.doIKTargetMHandSpL_TgtChar != ATgtChar.None)
  6348. {
  6349. // アタッチ先座標
  6350. var iks = slave.body0._ikp();
  6351. if (iks != null && iks.tgtMaidL != null && iks.tgtHandL_AttachSlot >= 0 && !string.IsNullOrEmpty(iks.tgtHandL_AttachName))
  6352. {
  6353. if (iks.tgtMaidL.body0 != null && iks.tgtMaidL.body0.goSlot[iks.tgtHandL_AttachSlot].morph != null)
  6354. {
  6355. //Console.WriteLine("g-l");
  6356. Vector3 vector2;
  6357. Quaternion rotation2;
  6358. iks.tgtMaidR.body0.goSlot[iks.tgtHandL_AttachSlot].morph.GetAttachPoint(iks.tgtHandL_AttachName, out vector2, out rotation2);
  6359. // アタッチポイント基準角度
  6360. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " L Hand", true);
  6361. //Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnL(slave), true);
  6362. qCusL = trh.rotation = rotation2 * Quaternion.Euler(p_v3of2.v3HandLOffsetRot);
  6363. cusL = true;
  6364. }
  6365. }
  6366. else if (iks != null && iks.tgtHandL)
  6367. {
  6368. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " L Hand", true);
  6369. //Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnR(slave), true);
  6370. qCusL = trh.rotation = iks.tgtHandL.rotation * Quaternion.Euler(p_v3of2.v3HandLOffsetRot);
  6371. cusL = true;
  6372. }
  6373. }
  6374. }
  6375. if (showPosSliderHandR)
  6376. {
  6377. _Gizmo_HandR.Visible = true;
  6378. _Gizmo_HandL.Visible = false;
  6379. }
  6380. else
  6381. {
  6382. _Gizmo_HandR.Visible = false;
  6383. _Gizmo_HandL.Visible = true;
  6384. }
  6385. #if false
  6386. if (showPosSliderHandR && _Gizmo_HandR.isDrag)
  6387. {
  6388. Vector3 dv = _Gizmo_HandR.transform.localPosition - _Gizmo_HandR._backup_pos;
  6389. if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
  6390. {
  6391. dv *= GIZMO_SLOWRATE;
  6392. _Gizmo_HandR.transform.localPosition = _Gizmo_HandR._backup_pos + dv;
  6393. }
  6394. p_v3of.v3HandROffset += dv;
  6395. p_v3of.v3HandROffset = v3limit(p_v3of.v3HandROffset, 0.15f);
  6396. _Gizmo_HandR.BkupPosAndRotLocal();
  6397. }
  6398. if (!showPosSliderHandR && _Gizmo_HandL.isDrag)
  6399. {
  6400. Vector3 dv = _Gizmo_HandL.transform.localPosition - _Gizmo_HandL._backup_pos;
  6401. if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
  6402. {
  6403. dv *= GIZMO_SLOWRATE;
  6404. _Gizmo_HandL.transform.localPosition = _Gizmo_HandL._backup_pos + dv;
  6405. }
  6406. p_v3of.v3HandLOffset += dv;
  6407. p_v3of.v3HandLOffset = v3limit(p_v3of.v3HandLOffset, 0.15f);
  6408. _Gizmo_HandL.BkupPosAndRotLocal();
  6409. }
  6410. #else
  6411. if (showPosSliderHandR && _Gizmo_HandR.isDrag)
  6412. {
  6413. Vector3 dv = _Gizmo_HandR.position - _Gizmo_HandR._backup_pos;
  6414. if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
  6415. {
  6416. dv *= GIZMO_SLOWRATE;
  6417. _Gizmo_HandR.position = _Gizmo_HandR._backup_pos + dv;
  6418. }
  6419. Transform slvR = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " R Hand", true);
  6420. //座標変換して加算
  6421. p_v3of2.v3HandROffset += Quaternion.Euler(p_v3of2.v3HandROffsetRot) * slvR.InverseTransformDirection(dv);
  6422. p_v3of2.v3HandROffset = v3limit(p_v3of2.v3HandROffset, 0.15f);
  6423. if (_Gizmo_HandR._backup_rot != _Gizmo_HandR.transform.rotation)
  6424. {
  6425. // 角度差分取得
  6426. p_v3of2.v3HandROffsetRot = CalcGizmoDvRot(_Gizmo_HandR);
  6427. }
  6428. _Gizmo_HandR.BkupPosAndRot();
  6429. bochg = true;
  6430. }
  6431. if (!showPosSliderHandR && _Gizmo_HandL.isDrag)
  6432. {
  6433. Vector3 dv = _Gizmo_HandL.position - _Gizmo_HandL._backup_pos;
  6434. if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
  6435. {
  6436. dv *= GIZMO_SLOWRATE;
  6437. _Gizmo_HandL.position = _Gizmo_HandL._backup_pos + dv;
  6438. }
  6439. Transform slvL = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " L Hand", true);
  6440. //座標変換して加算
  6441. p_v3of2.v3HandLOffset += Quaternion.Euler(p_v3of2.v3HandLOffsetRot) * slvL.InverseTransformDirection(dv);
  6442. p_v3of2.v3HandLOffset = v3limit(p_v3of2.v3HandLOffset, 0.15f);
  6443. if (_Gizmo_HandL._backup_rot != _Gizmo_HandL.transform.rotation)
  6444. {
  6445. // 角度差分取得
  6446. p_v3of2.v3HandLOffsetRot = CalcGizmoDvRot(_Gizmo_HandL);
  6447. }
  6448. _Gizmo_HandL.BkupPosAndRot();
  6449. bochg = true;
  6450. }
  6451. #endif
  6452. if (boSelectLR)
  6453. {
  6454. //Rect rctmp = new Rect(rcItem.x + 10, rcItem.y, (rcItem.width + 10) / 2, rcItem.height);
  6455. Rect rctmp = new Rect(LX, (pos_y += ItemHeight), SLDW / 2, ItemHeight);
  6456. showPosSliderHandR = GUI.Toggle(rctmp, showPosSliderHandR, "R(右手位置)", gsToggle);
  6457. rctmp.x += rctmp.width;
  6458. showPosSliderHandR = !GUI.Toggle(rctmp, !showPosSliderHandR, "L(左手位置)", gsToggle);
  6459. }
  6460. var cbk = GUI.contentColor;
  6461. if (p_v3of2.isV2)
  6462. {
  6463. GUI.contentColor = Color.yellow;
  6464. }
  6465. else if (p_mscfg.doIKTargetMHandSpCustom_v2)
  6466. {
  6467. GUI.contentColor = Color.cyan;
  6468. }
  6469. // 位置
  6470. {
  6471. Vector3 _v = p_v3of2.v3HandROffset;
  6472. if (!showPosSliderHandR)
  6473. _v = p_v3of2.v3HandLOffset;
  6474. var v_bk = _v;
  6475. GUI.Label(new Rect(LX, (pos_y += ItemHeight), 122, ItemHeight), " +X: " + Math.Round(_v.x, 4), gsLabel);
  6476. _v.x = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.x, gsButton);
  6477. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  6478. {
  6479. _v.x = 0;
  6480. }
  6481. _v.x = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.x, -0.15f, 0.15f);
  6482. GUI.Label(new Rect(LX, (pos_y += ItemHeight - 5), 122, ItemHeight), " +Y: " + Math.Round(_v.y, 4), gsLabel);
  6483. _v.y = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.y, gsButton);
  6484. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  6485. {
  6486. _v.y = 0;
  6487. }
  6488. _v.y = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.y, -0.15f, 0.15f);
  6489. GUI.Label(new Rect(LX, (pos_y += ItemHeight - 5), 122, ItemHeight), " +Z: " + Math.Round(_v.z, 4), gsLabel);
  6490. _v.z = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.z, gsButton);
  6491. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  6492. {
  6493. _v.z = 0;
  6494. }
  6495. _v.z = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.z, -0.15f, 0.15f);
  6496. _v = v3limit(_v, 0.15f);
  6497. if (v_bk != _v)
  6498. bochg = true;
  6499. if (showPosSliderHandR)
  6500. p_v3of2.v3HandROffset = _v;
  6501. else
  6502. p_v3of2.v3HandLOffset = _v;
  6503. }
  6504. // 回転
  6505. {
  6506. Vector3 _v = showPosSliderHandR ? va180(p_v3of2.v3HandROffsetRot)
  6507. : va180(p_v3of2.v3HandLOffsetRot);
  6508. GUI.Label(new Rect(LX, (pos_y += ItemHeight), 122, ItemHeight), " +回転X: " + Math.Round(_v.x, 4), gsLabel);
  6509. _v.x = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.x, gsButton);
  6510. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  6511. {
  6512. _v.x = 0;
  6513. }
  6514. _v.x = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.x, -180f, 180f);
  6515. GUI.Label(new Rect(LX, (pos_y += ItemHeight - 5), 122, ItemHeight), " +回転Y: " + Math.Round(_v.y, 4), gsLabel);
  6516. _v.y = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.y, gsButton);
  6517. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  6518. {
  6519. _v.y = 0;
  6520. }
  6521. _v.y = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.y, -180f, 180f);
  6522. GUI.Label(new Rect(LX, (pos_y += ItemHeight - 5), 122, ItemHeight), " +回転Z: " + Math.Round(_v.z, 4), gsLabel);
  6523. _v.z = btnset_LR(new Rect(LX + LW, (pos_y), BW, 20), BW, _v.z, gsButton);
  6524. if (GUI.Button(new Rect(LX + EDTW, (pos_y), 28, 20), "CL", gsButton))
  6525. {
  6526. _v.z = 0;
  6527. }
  6528. _v.z = GUI.HorizontalSlider(new Rect(LX, (pos_y += 20), SLDW, 15), _v.z, -180f, 180f);
  6529. if (showPosSliderHandR)
  6530. p_v3of2.v3HandROffsetRot = _v;
  6531. else
  6532. p_v3of2.v3HandLOffsetRot = _v;
  6533. }
  6534. GUI.contentColor = cbk;
  6535. #if true
  6536. if (!_Gizmo_HandR.isDrag)
  6537. {
  6538. Transform slvR = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " R Hand", true);
  6539. _Gizmo_HandR.position = slvR.position;
  6540. _Gizmo_HandR.rotation = slvR.rotation; //* Quaternion.Euler(180, 0, 0);
  6541. if (cusR)
  6542. _Gizmo_HandR.rotation = qCusR;
  6543. _Gizmo_HandR.BkupPosAndRot();
  6544. //回転保持
  6545. BkupGizmoU1(_Gizmo_HandR, p_v3of2.v3HandROffsetRot);
  6546. }
  6547. if (!_Gizmo_HandL.isDrag)
  6548. {
  6549. Transform slvL = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " L Hand", true);
  6550. _Gizmo_HandL.position = slvL.position;
  6551. _Gizmo_HandL.rotation = slvL.rotation; //* Quaternion.Euler(0, 0, 180);
  6552. if (cusL)
  6553. _Gizmo_HandL.rotation = qCusL;
  6554. _Gizmo_HandL.BkupPosAndRot();
  6555. //回転保持
  6556. BkupGizmoU1(_Gizmo_HandL, p_v3of2.v3HandLOffsetRot);
  6557. }
  6558. #else
  6559. if (!_Gizmo_HandR.isDrag)
  6560. {
  6561. Transform slvR = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " R Hand", true);
  6562. _Gizmo_HandR.transform.parent.transform.position = slvR.position;
  6563. _Gizmo_HandR.transform.parent.transform.rotation = slvR.rotation; //* Quaternion.Euler(180, 0, 0);
  6564. //_Gizmo_HandR.transform.localPosition = v3HandROffset;
  6565. _Gizmo_HandR.position = slvR.position;
  6566. _Gizmo_HandR.BkupPosAndRotLocal();
  6567. }
  6568. if (!_Gizmo_HandL.isDrag)
  6569. {
  6570. Transform slvL = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " L Hand", true);
  6571. _Gizmo_HandL.transform.parent.transform.position = slvL.position;
  6572. _Gizmo_HandL.transform.parent.transform.rotation = slvL.rotation; //* Quaternion.Euler(0, 0, 180);
  6573. //_Gizmo_HandL.transform.localPosition = v3HandLOffset;
  6574. _Gizmo_HandL.position = slvL.position;
  6575. _Gizmo_HandL.BkupPosAndRotLocal();
  6576. //_Gizmo_HandL.BkupPosAndRot();
  6577. }
  6578. #endif
  6579. rcItem.y = pos_y;
  6580. }
  6581. return bochg;
  6582. }
  6583. //サブメイド&男の表示/非表示コントロール達、メンバー数に変更が出たらtrue
  6584. private bool ProcSubMemberCtrls(ref int pos_y, ref Rect rcItem, MsLinks ms_, Maid slave, MsLinkConfig p_mscfg)
  6585. {
  6586. _WinprocPhase = "[subs]";
  6587. //サブメイド
  6588. GetStockMaids();
  6589. if (_StockMaids.Count > 0)
  6590. {
  6591. if (_MaidList.Count >= 20)
  6592. {
  6593. GUI.enabled = false;
  6594. ComboSubMaid.boPop = false;
  6595. }
  6596. //pos_y = (int)(rcItem.y += ItemHeight/2);
  6597. //pos_y = (int)(rcItem.y += ItemHeight / 4*3);
  6598. pos_y = (int)(rcItem.y += ItemHeight);
  6599. GUI.Label(rcItem, "【サブメイド呼び出し】", gsLabel);
  6600. pos_y = (int)(rcItem.y += ItemHeight);
  6601. List<string> s_names = new List<string>();
  6602. foreach (var vm in _StockMaids)
  6603. s_names.Add(GetMaidName(vm));
  6604. if (ComboSubMaid.Show(rcItem, ItemHeight, ItemHeight * 5, s_names.ToArray(), "サブメイドを選択", gsButton, gsButton))
  6605. {
  6606. if (ComboSubMaid.sIndex >= 0)
  6607. {
  6608. // 元のカーソルを保持
  6609. System.Windows.Forms.Cursor preCursor = System.Windows.Forms.Cursor.Current;
  6610. // カーソルを待機カーソルに変更
  6611. System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
  6612. try
  6613. {
  6614. //表示サブメイドリストに追加
  6615. _StockMaids_Visible.Add(_StockMaids[ComboSubMaid.sIndex].mem);
  6616. //if (GameMain.Instance.CharacterMgr.GetMaidCount() < 21) → 常に21になるっぽい//(vSceneLevel != 5)
  6617. if (LoadMaid(_StockMaids[ComboSubMaid.sIndex].mem))//(vSceneLevel != 5)
  6618. {
  6619. //Maid getmaid = _StockMaids[ComboSubMaid.sIndex].mem;
  6620. //LoadMaid(getmaid);
  6621. }
  6622. else
  6623. {
  6624. //アクティブメイドに登録不可 ボイスとかは再生できないかも
  6625. if (!_StockMaids[ComboSubMaid.sIndex].mem.body0.isLoadedBody)
  6626. {
  6627. _StockMaids[ComboSubMaid.sIndex].mem.DutPropAll();
  6628. _StockMaids[ComboSubMaid.sIndex].mem.AllProcPropSeqStart();
  6629. }
  6630. _StockMaids[ComboSubMaid.sIndex].mem.Visible = true;
  6631. }
  6632. Maid nm = _StockMaids[ComboSubMaid.sIndex].mem;
  6633. ComboSubMaid.sSelected = "サブメイドを選択";
  6634. ComboSubMaid.sIndex = -1;
  6635. //選択を変更
  6636. if (!ms_.doMasterSlave)
  6637. {
  6638. ms_.MsUpdateListChanged(ms_.Scc1_MasterMaid, null, nm);
  6639. }
  6640. /*
  6641. //スレイブ選択を変更
  6642. if (!slave.boMAN && !ms_.doMasterSlave)
  6643. {
  6644. //ms_.mdSlave_No = ms_.mdSlaves.Count();
  6645. //MsLinks.AllMsUpdateListChanged();
  6646. }*/
  6647. }
  6648. catch
  6649. {
  6650. throw;
  6651. }
  6652. finally
  6653. {
  6654. // カーソルを元に戻す
  6655. System.Windows.Forms.Cursor.Current = preCursor;
  6656. }
  6657. //メイドが変更されているので帰る
  6658. return true;
  6659. }
  6660. }
  6661. pos_y = (int)(rcItem.y += ItemHeight);
  6662. if (ComboSubMaid.boPop)
  6663. {
  6664. pos_y += ItemHeight * 5;
  6665. }
  6666. GUI.enabled = true;
  6667. }
  6668. _WinprocPhase = "[subs-hide]";
  6669. if (_StockMaids_Visible.Count > 0)
  6670. {
  6671. rcItem.y = (pos_y);
  6672. GUI.Label(rcItem, "【サブメイドを帰す】", gsLabel);
  6673. pos_y = (int)(rcItem.y += ItemHeight);
  6674. List<string> s_names = new List<string>();
  6675. foreach (var vm in _StockMaids_Visible.ToArray())
  6676. {
  6677. if (!vm.Visible)
  6678. _StockMaids_Visible.Remove(vm);
  6679. else
  6680. s_names.Add(GetMaidName(vm));
  6681. }
  6682. if (ComboSubMaidV.Show(rcItem, ItemHeight, ItemHeight * 3, s_names.ToArray(), "サブメイドを選択", gsButton, gsButton))
  6683. {
  6684. if (ComboSubMaidV.sIndex >= 0)
  6685. {
  6686. //選択中ならリンク中断
  6687. if (slave == _StockMaids_Visible[ComboSubMaidV.sIndex])
  6688. ms_.doMasterSlave = false;
  6689. if (ms_.maidKeepSlaveYotogi == _StockMaids_Visible[ComboSubMaidV.sIndex])
  6690. ms_.maidKeepSlaveYotogi = null;
  6691. //非表示
  6692. if (GetMaidName(_StockMaids_Visible[ComboSubMaidV.sIndex]) == ComboSubMaidV.sSelected)
  6693. _StockMaids_Visible[ComboSubMaidV.sIndex].Visible = false;
  6694. else
  6695. Console.WriteLine("メイドが一致しないため非表示をキャンセル。選択:" + GetMaidName(_StockMaids_Visible[ComboSubMaidV.sIndex]) + "/" + ComboSubMaidV.sSelected);
  6696. //if (_StockMaids_Visible[ComboSubMaidV.sIndex].Visible)
  6697. // return;
  6698. ComboSubMaidV.sSelected = "サブメイドを選択";
  6699. ComboSubMaidV.sIndex = -1;
  6700. //更新&チェック
  6701. //MsLinks.AllMsUpdateListChanged();
  6702. return true; // メイド数が変わってるので一度戻る
  6703. }
  6704. }
  6705. pos_y = (int)(rcItem.y += ItemHeight);
  6706. if (ComboSubMaidV.boPop)
  6707. {
  6708. pos_y += ItemHeight * 3;
  6709. }
  6710. }
  6711. rcItem.y = (pos_y);
  6712. {
  6713. //Color cbk = GUI.contentColor;
  6714. //if (!ms_.doMasterSlave)
  6715. // GUI.contentColor = Color.gray;
  6716. p_mscfg.doKeepSlaveYotogi = GUI.Toggle(rcItem, p_mscfg.doKeepSlaveYotogi, "夜伽中,サブメイドのSlaveリンク維持", gsToggle);
  6717. //GUI.contentColor = cbk;
  6718. }
  6719. pos_y = (int)(rcItem.y += ItemHeight);
  6720. pos_y = (int)(rcItem.y += ItemHeight / 2);
  6721. _WinprocPhase = "[mens]";
  6722. if (GameMain.Instance.CharacterMgr.GetManCount() > 0)
  6723. {
  6724. if (GUI.Button(new Rect(ItemX, (pos_y), 20, 20), (showSubMens ? "-" : "+"), gsButton))
  6725. {
  6726. showSubMens = !showSubMens;
  6727. }
  6728. GUI.Label(new Rect(ItemX + 20, pos_y, ItemWidth - 20, ItemHeight), "【男の表示設定/呼び出し】", gsLabel);
  6729. pos_y = (int)(rcItem.y += ItemHeight);
  6730. if (showSubMens)
  6731. {
  6732. Rect rcbox = new Rect(rcItem);
  6733. int mancnt = 0;
  6734. for (int i = 0; i < GameMain.Instance.CharacterMgr.GetManCount(); i++)
  6735. {
  6736. if (GameMain.Instance.CharacterMgr.GetMan(i) != null)
  6737. mancnt += 1;
  6738. }
  6739. rcbox.height = (mancnt + 0.5f) * ItemHeight;
  6740. GUI.Box(rcbox, "");
  6741. Rect rcman = new Rect(rcItem);
  6742. rcman.x += 10;
  6743. rcman.width -= 20;
  6744. for (int i = 0; i < GameMain.Instance.CharacterMgr.GetManCount(); i++)
  6745. {
  6746. Maid man = GameMain.Instance.CharacterMgr.GetMan(i);
  6747. if (man)
  6748. {
  6749. rcman.y = pos_y;
  6750. bool vflg = man.Visible;
  6751. if (vflg && !_StockMens_Called.Contains(man))
  6752. GUI.enabled = false;
  6753. bool nflg = GUI.Toggle(rcItem, vflg, GetMaidName(new ManInfo(man, i)), gsToggle);
  6754. GUI.enabled = true;
  6755. if (vflg != nflg)
  6756. {
  6757. if (nflg)
  6758. {
  6759. man.Visible = true;
  6760. _StockMens_Called.Add(man);
  6761. //選択変更
  6762. if (!ms_.doMasterSlave)
  6763. ms_.MsUpdateListChanged(ms_.Scc1_MasterMaid, man, null);
  6764. }
  6765. else
  6766. {
  6767. if (_StockMens_Called.Contains(man))
  6768. {
  6769. _StockMens_Called.Remove(man);
  6770. man.Visible = false;
  6771. }
  6772. else
  6773. {
  6774. Console.WriteLine("呼び出し済みリストにいない男のため非表示をキャンセル");
  6775. }
  6776. }
  6777. return true;
  6778. }
  6779. pos_y = (int)(rcItem.y += ItemHeight);
  6780. }
  6781. }
  6782. }
  6783. }
  6784. return false;
  6785. }
  6786. static void CloseAllCombos()
  6787. {
  6788. ComboMaster.boPop = false;
  6789. ComboSlave.boPop = false;
  6790. ComboSubMaid.boPop = false;
  6791. ComboSubMaidV.boPop = false;
  6792. ComboVoiceMode.boPop = false;
  6793. ComboPosLinkBone.boPop = false;
  6794. }
  6795. static void PosGizmoProc(MsLinks ms_)
  6796. {
  6797. if (/*_Gizmo.Visible && */_Gizmo.isDrag)
  6798. {
  6799. //debugPrintConsole("_Gizmo.isDrag");
  6800. if (_Gizmo._backup_pos != _Gizmo.transform.position)
  6801. {
  6802. Vector3 dv = _Gizmo.transform.position - _Gizmo._backup_pos;
  6803. //debugPrintConsole("_g pos: " + _Gizmo.transform.position);
  6804. if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
  6805. {
  6806. dv *= GIZMO_SLOWRATE;
  6807. _Gizmo.transform.position = _Gizmo._backup_pos + dv;
  6808. }
  6809. //アタッチポイント設定にギズモの移動を反映
  6810. if (cfgs[ms_.num_].doStackSlave_CliCnk)
  6811. {
  6812. //Maid slave = ms_.mdSlaves[ms_.mdSlave_No].mem;
  6813. //Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01 Pelvis" : "chinkoCenter"), true);
  6814. Transform slvTr = _Gizmo.transform;
  6815. v3ofs[_pageNum].v3StackOffset += slvTr.InverseTransformDirection(dv);
  6816. //v3ofs[_pageNum].v3StackOffset = slvTr.InverseTransformDirection(_Gizmo.transform.position - _Gizmo._backup_pos_u1);
  6817. }
  6818. else if (cfgs[ms_.num_].doStackSlave_Pelvis)
  6819. {
  6820. //Maid slave = ms_.mdSlaves[ms_.mdSlave_No].mem;
  6821. //Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " Pelvis", true);
  6822. //Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip"), true);
  6823. Transform slvTr = _Gizmo.transform;
  6824. v3ofs[_pageNum].v3StackOffset += slvTr.InverseTransformDirection(dv);
  6825. //v3ofs[_pageNum].v3StackOffset += _Gizmo.transform.InverseTransformDirection(dv);
  6826. }
  6827. else
  6828. {
  6829. v3ofs[_pageNum].v3StackOffset += _Gizmo.transform.InverseTransformDirection(dv);
  6830. }
  6831. }
  6832. else if (_Gizmo._backup_rot != _Gizmo.transform.rotation)
  6833. {
  6834. if (Input.GetKey(KeyCode.RightShift) || Input.GetKey(KeyCode.LeftShift))
  6835. {
  6836. _Gizmo.transform.rotation = Quaternion.Slerp(_Gizmo._backup_rot, _Gizmo.rotation, GIZMO_SLOWRATE);
  6837. }
  6838. #if false
  6839. if (cfgs[ms_.num_].doStackSlave_CliCnk)
  6840. {
  6841. //Maid slave = ms_.mdSlaves[ms_.mdSlave_No].mem;
  6842. //Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01 Pelvis" : "chinkoCenter"), true);
  6843. v3ofs[_pageNum].v3StackOffsetRot = (Quaternion.Inverse(_Gizmo._backup_rot_u1) * _Gizmo.transform.rotation).eulerAngles;
  6844. }
  6845. else if(cfgs[ms_.num_].doStackSlave_Pelvis)
  6846. {
  6847. //Maid slave = ms_.mdSlaves[ms_.mdSlave_No].mem;
  6848. //Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " Pelvis", true);
  6849. //v3ofs[_pageNum].v3StackOffsetRot = (Quaternion.Inverse(slvTr.rotation) * _Gizmo.transform.rotation).eulerAngles;
  6850. v3ofs[_pageNum].v3StackOffsetRot = (Quaternion.Inverse(_Gizmo._backup_rot_u1) * _Gizmo.transform.rotation).eulerAngles;
  6851. }
  6852. else
  6853. {
  6854. v3ofs[_pageNum].v3StackOffsetRot = (Quaternion.Inverse(ms_.mdMasters[ms_.mdMaster_No].mem.gameObject.transform.rotation) * _Gizmo.transform.rotation).eulerAngles;
  6855. }
  6856. //#else
  6857. if (cfgs[ms_.num_].doStackSlave_Pelvis || cfgs[ms_.num_].doStackSlave_CliCnk)
  6858. {
  6859. //v3ofs[_pageNum].v3StackOffsetRot = (Quaternion.Inverse(_Gizmo._backup_rot_u1) * (Quaternion.Inverse(Quaternion.Euler(0, -90, -90)) * _Gizmo.transform.rotation)).eulerAngles;
  6860. v3ofs[_pageNum].v3StackOffsetRot = (Quaternion.Inverse(_Gizmo._backup_rot_u1) * _Gizmo.transform.rotation).eulerAngles;
  6861. Maid slave = ms_.mdSlaves[ms_.mdSlave_No].mem;
  6862. Transform slvTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip"), true);
  6863. debugPrintConsole("bip rot: " + slvTr.localRotation.eulerAngles + " ofs: " + (Quaternion.Inverse(slave.gameObject.transform.rotation)* slvTr.rotation).eulerAngles);
  6864. if (cfgs[ms_.num_].doStackSlave_Pelvis)
  6865. {
  6866. //v3ofs[_pageNum].v3StackOffsetRot = Quaternion.Euler((Quaternion.Inverse(slave.gameObject.transform.rotation) * slvTr.rotation).eulerAngles - new Vector3(270.0f, 90.0f, 0.0f)) * v3ofs[_pageNum].v3StackOffsetRot;
  6867. debugPrintConsole("-ofs rot: " + ((Quaternion.Inverse(slave.gameObject.transform.rotation) * slvTr.rotation).eulerAngles - new Vector3(270.0f, 90.0f, 0.0f)));
  6868. v3ofs[_pageNum].v3StackOffsetRot = (Quaternion.Inverse(_Gizmo._backup_rot_u1) * _Gizmo.transform.rotation).eulerAngles;
  6869. }
  6870. else
  6871. {
  6872. v3ofs[_pageNum].v3StackOffsetRot = _Gizmo.transform.TransformDirection(v3ofs[_pageNum].v3StackOffsetRot);
  6873. slvTr = slave.gameObject.transform;
  6874. v3ofs[_pageNum].v3StackOffsetRot = slvTr.InverseTransformDirection(Quaternion.Euler(0, -90, -90)*v3ofs[_pageNum].v3StackOffsetRot);
  6875. }
  6876. }
  6877. else
  6878. {
  6879. v3ofs[_pageNum].v3StackOffsetRot = (Quaternion.Inverse(_Gizmo._backup_rot_u1) * _Gizmo.transform.rotation).eulerAngles;
  6880. }
  6881. #endif
  6882. //v3ofs[_pageNum].v3StackOffsetRot = (Quaternion.Inverse(_Gizmo._backup_rot_u1) * _Gizmo.transform.rotation).eulerAngles;
  6883. v3ofs[_pageNum].v3StackOffsetRot = (Quaternion.Inverse(_Gizmo._backup_rotLocal_u1) * _Gizmo.transform.localRotation).eulerAngles;
  6884. //_Gizmo.BkupPosAndRotLocalU1();
  6885. v3ofs[_pageNum].v3StackOffsetRot = va180(v3ofs[_pageNum].v3StackOffsetRot);
  6886. debugPrintConsole("_g rot: " + _Gizmo.transform.rotation.eulerAngles + " ofs: " + v3ofs[_pageNum].v3StackOffsetRot);
  6887. }
  6888. _Gizmo.BkupPosAndRot();
  6889. }
  6890. else if (_Gizmo.Visible)
  6891. {
  6892. Transform sTr = ms_.mdSlaves[ms_.mdSlave_No].mem.gameObject.transform;
  6893. Maid slave = ms_.mdSlaves[ms_.mdSlave_No].mem;
  6894. if (cfgs[ms_.num_].doStackSlave_CliCnk)
  6895. {
  6896. sTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01 Pelvis" : "chinkoCenter"), true);
  6897. }
  6898. else if (cfgs[ms_.num_].doStackSlave_Pelvis)
  6899. {
  6900. sTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip") + " Pelvis", true);
  6901. }
  6902. _Gizmo.transform.rotation = sTr.rotation;
  6903. _Gizmo.transform.position = sTr.position;
  6904. if (cfgs[ms_.num_].doStackSlave_PosSyncMode && cfgs[ms_.num_].doStackSlave_PosSyncModeSp && !string.IsNullOrEmpty(cfgs[ms_.num_].doStackSlave_PosSyncModeSp_TgtBone))
  6905. {
  6906. Maid master = ms_.mdMasters[ms_.mdMaster_No].mem;
  6907. sTr = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, (cfgs[ms_.num_].doStackSlave_PosSyncModeSp_TgtBone), true);
  6908. if (sTr)
  6909. {
  6910. _Gizmo.transform.rotation = sTr.rotation;
  6911. //if ((cfgs[ms_.num_].doStackSlave_Pelvis || cfgs[ms_.num_].doStackSlave_CliCnk))
  6912. // _Gizmo.transform.rotation *= Quaternion.Euler(0, -90, -90);
  6913. _Gizmo.transform.rotation *= Quaternion.Euler(v3ofs[_pageNum].v3StackOffsetRot);
  6914. }
  6915. }
  6916. else if (cfgs[ms_.num_].doStackSlave_PosSyncMode && (cfgs[ms_.num_].doStackSlave_Pelvis || cfgs[ms_.num_].doStackSlave_CliCnk))
  6917. {
  6918. Maid master = ms_.mdMasters[ms_.mdMaster_No].mem;
  6919. // 位置のみの場合はアタッチ先キャラクター座標を基準に
  6920. sTr = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, (!master.boMAN ? "Bip01" : "ManBip"), true);
  6921. //_Gizmo.transform.position = sTr.position;
  6922. _Gizmo.transform.rotation = sTr.rotation;
  6923. _Gizmo.transform.rotation *= Quaternion.Euler(0, -90, -90);
  6924. _Gizmo.transform.rotation *= Quaternion.Euler(v3ofs[_pageNum].v3StackOffsetRot);
  6925. }
  6926. else if (cfgs[ms_.num_].doStackSlave_Pelvis || cfgs[ms_.num_].doStackSlave_CliCnk)
  6927. {
  6928. sTr = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, (!slave.boMAN ? "Bip01" : "ManBip"), true);
  6929. //_Gizmo.transform.position = sTr.position;
  6930. _Gizmo.transform.rotation = sTr.rotation;
  6931. _Gizmo.transform.rotation *= Quaternion.Euler(0, -90, -90);
  6932. }
  6933. _Gizmo.BkupPos();
  6934. _Gizmo.BkupPosAndRotU1();
  6935. //_Gizmo._backup_rot_u1 = _Gizmo._backup_rot_u1 * Quaternion.Inverse(Quaternion.Euler(v3ofs[_pageNum].v3StackOffsetRot));
  6936. _Gizmo.BkupPosAndRotLocalU1();
  6937. _Gizmo._backup_rotLocal_u1 = _Gizmo._backup_rotLocal_u1 * Quaternion.Inverse(Quaternion.Euler(v3ofs[_pageNum].v3StackOffsetRot));
  6938. }
  6939. }
  6940. //メイド読み出し(夜伽のサブメイド読み込み&PlacementWindowのActiveMaidを参考にした)
  6941. static bool LoadMaid(Maid newmaid)
  6942. {
  6943. //空きスロットか登録済みスロットを探す
  6944. int k = 0;
  6945. while (k < GameMain.Instance.CharacterMgr.GetMaidCount())
  6946. {
  6947. if (GameMain.Instance.CharacterMgr.GetMaid(k) == null || GameMain.Instance.CharacterMgr.GetMaid(k) == newmaid)
  6948. {
  6949. break;
  6950. }
  6951. k++;
  6952. }
  6953. if (k > 20) //アクティブメイドの最大数は21
  6954. {
  6955. Console.WriteLine("アクティブメイド登録 インデックスエラー: " + k);
  6956. return false;
  6957. }
  6958. if (IkXT.IsIkCtrlO117 || IkXT.IsIkCtrlO118) //v5.0
  6959. {
  6960. // 撮影モードチェック → 撮影モードを抜ける時のエラー対策
  6961. var plw = GameObject.FindObjectOfType<PlacementWindow>();
  6962. if (plw)
  6963. {
  6964. plw.InvokeNonPublicMethod("ActiveMaid", new object[] { newmaid });
  6965. newmaid.Visible = true;
  6966. newmaid.AllProcProp();
  6967. return true;
  6968. }
  6969. }
  6970. //アクティブメイド登録
  6971. Console.WriteLine("アクティブメイド登録: " + GetMaidName(newmaid) + "⇒" + k + " / " + GameMain.Instance.CharacterMgr.GetMaidCount());
  6972. GameMain.Instance.CharacterMgr.SetActiveMaid(newmaid, k);
  6973. newmaid.Visible = true;
  6974. newmaid.AllProcProp();
  6975. //表情やポーズの設定
  6976. newmaid.boMabataki = true;
  6977. newmaid.CrossFadeAbsolute("maid_stand01.anm", false, true, false, 0.5f, 1f);
  6978. if (bIsYotogiScene)
  6979. newmaid.FaceAnime(VymModule.cfg.sFaceAnimeYotogiDefault, 0f);
  6980. return true;
  6981. }
  6982. //男の選択または読み込み(ユーザー設定ファイル読み出し時)
  6983. public static int SelectOrLoadMan(string name)
  6984. {
  6985. if (string.IsNullOrEmpty(name))
  6986. return -1;
  6987. for (int i = 0; i < _MensList.Count; i++)
  6988. {
  6989. if (name == GetMaidName(_MensList[i]))
  6990. return i;
  6991. }
  6992. for (int i = 0; i < GameMain.Instance.CharacterMgr.GetManCount(); i++)
  6993. {
  6994. Maid man = GameMain.Instance.CharacterMgr.GetMan(i);
  6995. if (man && name == GetMaidName(new ManInfo(man, i)))
  6996. {
  6997. if (!man.Visible)
  6998. _StockMens_Called.Add(man);
  6999. man.Visible = true;
  7000. GetMens();
  7001. break;
  7002. }
  7003. }
  7004. int vmaid_cnt = 0;
  7005. for (int i = 0; i < GameMain.Instance.CharacterMgr.GetManCount(); i++)
  7006. {
  7007. Maid man = GameMain.Instance.CharacterMgr.GetMan(i);
  7008. if (!ChkMaid(man, true))
  7009. continue;
  7010. if (name == GetMaidName(new ManInfo(man, i)))
  7011. return vmaid_cnt;
  7012. vmaid_cnt++;
  7013. }
  7014. return -1;
  7015. }
  7016. //メイドの選択または読み込み(ユーザー設定ファイル読み出し時)
  7017. public static int SelectOrLoadMaid(string name)
  7018. {
  7019. if (string.IsNullOrEmpty(name))
  7020. return -1;
  7021. for (int i = 0; i < _MaidList.Count; i++)
  7022. {
  7023. if (name == GetMaidName(_MaidList[i].mem))
  7024. return i;
  7025. }
  7026. debugPrintConsole("hit - i");
  7027. Maid hiddenMaid = null;
  7028. GetStockMaids();
  7029. foreach (var vm in _StockMaids)
  7030. {
  7031. debugPrintConsole(name + " / " + GetMaidName(vm.mem));
  7032. if (name == GetMaidName(vm.mem))
  7033. {
  7034. hiddenMaid = vm.mem;
  7035. debugPrintConsole("hit - s " + hiddenMaid);
  7036. break;
  7037. }
  7038. }
  7039. if (hiddenMaid != null)
  7040. {
  7041. //debugPrintConsole("hit - h0 " + !(hiddenMaid));
  7042. //if (GameMain.Instance.CharacterMgr.GetMaidCount() < 20)//(vSceneLevel != 5)
  7043. //表示サブメイドリストに追加
  7044. if (LoadMaid(hiddenMaid))//(vSceneLevel != 5)
  7045. {
  7046. debugPrintConsole("hit - h1");
  7047. _StockMaids_Visible.Add(hiddenMaid);
  7048. //LoadMaid(hiddenMaid);
  7049. GetMaids();
  7050. }
  7051. int vmaid_cnt = 0;
  7052. for (int i = 0; i < GameMain.Instance.CharacterMgr.GetMaidCount(); i++)
  7053. {
  7054. Maid maidt = GameMain.Instance.CharacterMgr.GetMaid(i);
  7055. if (!ChkMaid(maidt, true))
  7056. continue;
  7057. debugPrintConsole(name + " / " + GetMaidName(maidt));
  7058. if (name == GetMaidName(maidt))
  7059. return vmaid_cnt;
  7060. vmaid_cnt++;
  7061. }
  7062. }
  7063. return -1;
  7064. }
  7065. #region コンボボックス
  7066. //超簡単コンボボックス、範囲外を選択されたときに消すなんて便利機能もできた
  7067. class EasyCombo
  7068. {
  7069. static EasyCombo openCombo = null;
  7070. public Vector2 scrollPosition = Vector2.zero;
  7071. private bool boPop_ = false;
  7072. public bool boPop
  7073. {
  7074. get { return boPop_; }
  7075. set
  7076. {
  7077. if (value)
  7078. { //一つに抑制する
  7079. if (openCombo != null)
  7080. openCombo.boPop = false;
  7081. openCombo = this;
  7082. }
  7083. boPop_ = value;
  7084. }
  7085. }
  7086. public string sSelected = String.Empty;
  7087. public int sIndex { get; set; }
  7088. public bool boChanged { get; private set; }
  7089. //アウトカーソルクリッククローズ用
  7090. private Vector2 scrollPosition_bk = new Vector2(float.PositiveInfinity, float.PositiveInfinity);
  7091. private int closeCntdwn = 0; //マウスのボタンUPの次フレームあたりにボタンイベントが起きるようなので
  7092. public EasyCombo(string s, int i)
  7093. {
  7094. sSelected = s;
  7095. sIndex = i;
  7096. }
  7097. public bool Show(Rect rect, int itemH, int maxH, List<string> slist, string sBtn, GUIStyle gsBtn, GUIStyle gsLst, bool[] disables = null)
  7098. {
  7099. return Show(rect, itemH, maxH, slist.ToArray(), sBtn, gsBtn, gsLst, disables);
  7100. }
  7101. public bool Show(Rect rect, int itemH, int maxH, int Numbers, string sBtn, GUIStyle gsBtn, GUIStyle gsLst, bool[] disables = null)
  7102. {
  7103. List<string> list = new List<string>();
  7104. for (int i = 0; i < Numbers; i++)
  7105. list.Add(i.ToString());
  7106. return Show(rect, itemH, maxH, list.ToArray(), sBtn, gsBtn, gsLst, disables);
  7107. }
  7108. public bool Show(Rect rect_btn, int itemH, int maxH, string[] slist, string sBtn, GUIStyle gsBtn, GUIStyle gsLst, bool[] disables = null)
  7109. {
  7110. Rect rect_list = new Rect(rect_btn);
  7111. rect_list.y += rect_btn.height;
  7112. rect_list.height = maxH;
  7113. //スクロールバー分幅を足す
  7114. //rect_list.width += 16;
  7115. return Show(rect_btn, itemH, rect_list, slist, sBtn, gsBtn, gsLst, disables);
  7116. }
  7117. public bool Show(Rect rect_btn, int itemH, Rect rect_list, string[] slist, string sBtn, GUIStyle gsBtn, GUIStyle gsLst, bool[] disables = null)
  7118. {
  7119. int maxlen = 0;
  7120. boChanged = false;
  7121. Color cbk = GUI.color;
  7122. if (boPop)
  7123. GUI.color = Color.cyan;
  7124. string sText = sBtn;
  7125. if (sText == null)
  7126. sText = sSelected;
  7127. else
  7128. sSelected = sText;
  7129. if (GUI.Button(rect_btn, sText, gsBtn))
  7130. {
  7131. boPop = !boPop;
  7132. }
  7133. GUI.color = cbk;
  7134. if (boPop)
  7135. {
  7136. rect_btn = rect_list;
  7137. foreach (string s in slist)
  7138. {
  7139. /*if (maxlen < s.Length)
  7140. maxlen = s.Length;*/
  7141. int len = (int)gsLst.CalcSize(new GUIContent(s)).x;
  7142. if (maxlen < len)
  7143. maxlen = len;
  7144. }
  7145. int iw = /*(gsLst.fontSize+2) * */maxlen;
  7146. if (iw < (rect_btn.width - 16))
  7147. iw = (int)rect_btn.width - 16;//スクロールバー分幅を引く
  7148. GUI.Box(new Rect(rect_btn.x, rect_btn.y, rect_btn.width - 15, rect_btn.height), "");
  7149. scrollPosition = GUI.BeginScrollView(rect_btn, scrollPosition, new Rect(0, 0, iw, itemH * slist.Length), false, true);
  7150. try
  7151. {
  7152. int pos_y = 0;
  7153. int i = 0;
  7154. foreach (string s in slist)
  7155. {
  7156. if (disables != null && disables[i])
  7157. GUI.enabled = false;
  7158. if (GUI.Button(new Rect(0, pos_y, iw, itemH), s, gsLst))
  7159. {
  7160. if (sSelected != s)
  7161. boChanged = true;
  7162. sSelected = s;
  7163. sIndex = i;
  7164. boPop = false;
  7165. }
  7166. GUI.enabled = true;
  7167. i++;
  7168. pos_y += itemH;
  7169. }
  7170. }
  7171. finally
  7172. {
  7173. GUI.enabled = true;
  7174. GUI.EndScrollView();
  7175. }
  7176. if (boPop && !boChanged)
  7177. {
  7178. if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonUp(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonUp(1))
  7179. {
  7180. if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
  7181. scrollPosition_bk = scrollPosition;
  7182. if (Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1))
  7183. {
  7184. if (scrollPosition_bk == scrollPosition)
  7185. {
  7186. //スクロールドラッグなし
  7187. //マウスのボタンUPの次フレームあたりにボタンイベントが起きるようなので
  7188. closeCntdwn = 3;
  7189. }
  7190. }
  7191. }
  7192. else if (closeCntdwn > 0)
  7193. {
  7194. closeCntdwn--;
  7195. if (closeCntdwn == 0)
  7196. boPop = false;
  7197. }
  7198. }
  7199. }
  7200. else
  7201. {
  7202. if (scrollPosition_bk == scrollPosition) //開くときのクリックで閉じないように
  7203. scrollPosition_bk = new Vector2(float.PositiveInfinity, float.PositiveInfinity);
  7204. if (closeCntdwn > 0)
  7205. closeCntdwn = 0;
  7206. }
  7207. return boChanged;
  7208. }
  7209. }
  7210. #endregion
  7211. // デバッグ用コンソール出力メソッド
  7212. [Conditional("DEBUG")]
  7213. private static void debugPrintConsole(string s)
  7214. {
  7215. Console.WriteLine(s);
  7216. }
  7217. // デバッグ用コンソール出力メソッド
  7218. [Conditional("DEBUG")]
  7219. private static void debugPrintConsoleSp(string s)
  7220. {
  7221. if (Input.GetKey(KeyCode.Space))
  7222. Console.WriteLine(s);
  7223. }
  7224. #region メンズ&メイド一覧
  7225. public class ManInfo
  7226. {
  7227. public ManInfo(Maid m, int n)
  7228. {
  7229. mem = m;
  7230. mem_id = n;
  7231. }
  7232. public ManInfo(Maid m, int n, bool newman, string motion_bkup, bool chinkov_bkup)
  7233. {
  7234. mem = m;
  7235. mem_id = n;
  7236. }
  7237. public Maid mem = null;
  7238. public int mem_id = 0;
  7239. }
  7240. public static List<ManInfo> _MensList = new List<ManInfo>();
  7241. Maid GetM(List<ManInfo> list, ref int num)
  7242. {
  7243. if (list.Count <= 0)
  7244. return null;
  7245. if (list.Count <= num || num < 0)
  7246. num = 0;
  7247. return list[num].mem;
  7248. }
  7249. static int GetMens()
  7250. {
  7251. return GetMens(true);
  7252. }
  7253. static int GetMens(bool boChkVsbl)
  7254. {
  7255. int cnt = GameMain.Instance.CharacterMgr.GetManCount();
  7256. if (cnt <= 0)
  7257. {
  7258. if (_MensList.Count > 0)
  7259. _MensList.Clear();
  7260. return 0;
  7261. }
  7262. List<ManInfo> _maidList = new List<ManInfo>();
  7263. int vmaid_cnt = 0;
  7264. for (int i = 0; i < cnt; i++)
  7265. {
  7266. Maid maids = GameMain.Instance.CharacterMgr.GetMan(i);
  7267. if (!ChkMaid(maids, boChkVsbl))
  7268. continue;
  7269. vmaid_cnt++;
  7270. _maidList.Add(new ManInfo(maids, i));
  7271. }
  7272. _MensList = _maidList;
  7273. return vmaid_cnt;
  7274. }
  7275. public static List<ManInfo> _MaidList = new List<ManInfo>();
  7276. static int GetMaids()
  7277. {
  7278. return GetMaid(true);
  7279. }
  7280. static int GetMaid(bool boChkVsbl)
  7281. {
  7282. int cnt = GameMain.Instance.CharacterMgr.GetMaidCount();
  7283. if (cnt <= 0)
  7284. {
  7285. if (_MaidList.Count > 0)
  7286. _MaidList.Clear();
  7287. return 0;
  7288. }
  7289. List<ManInfo> _maidList = new List<ManInfo>();
  7290. int vmaid_cnt = 0;
  7291. for (int i = 0; i < cnt; i++)
  7292. {
  7293. Maid maids = GameMain.Instance.CharacterMgr.GetMaid(i);
  7294. if (!ChkMaid(maids, boChkVsbl))
  7295. continue;
  7296. vmaid_cnt++;
  7297. _maidList.Add(new ManInfo(maids, i));
  7298. }
  7299. _MaidList = _maidList;
  7300. return vmaid_cnt;
  7301. }
  7302. private static bool ChkMaid(Maid m, bool boChkVsbl)
  7303. {
  7304. if (boChkVsbl)
  7305. return m != null && m.Visible && m.body0 != null && m.body0.goSlot != null;
  7306. else
  7307. return m != null && m.GetProp(MPN.head) != null;
  7308. }
  7309. public static string GetMaidName(Maid m)
  7310. {
  7311. if (m.boMAN)
  7312. {
  7313. return "男 No.不明";
  7314. }
  7315. else
  7316. {
  7317. string maidname = (m.XtParam().status.last_name + " " + m.XtParam().status.first_name);
  7318. return maidname;
  7319. }
  7320. }
  7321. public static string GetMaidName(ManInfo m)
  7322. {
  7323. return GetMaidName(m, false);
  7324. }
  7325. public static string GetMaidName(ManInfo m, bool withMaidID)
  7326. {
  7327. if (m.mem.boMAN)
  7328. {
  7329. return "男 No." + m.mem_id;
  7330. }
  7331. else
  7332. {
  7333. string maidname = (m.mem.XtParam().status.last_name + " " + m.mem.XtParam().status.first_name);
  7334. if (withMaidID)
  7335. maidname = "Maid" + m.mem_id + ": " + maidname;
  7336. return maidname;
  7337. }
  7338. }
  7339. //サブメイド
  7340. static void GetStockMaids()
  7341. {
  7342. _StockMaids.Clear();
  7343. for (int j = 0; j < GameMain.Instance.CharacterMgr.GetStockMaidCount(); j++)
  7344. {
  7345. Maid ms = GameMain.Instance.CharacterMgr.GetStockMaid(j);
  7346. if (ms != null && !ms.Visible)
  7347. {
  7348. _StockMaids.Add(new ManInfo(ms, j));
  7349. }
  7350. }
  7351. }
  7352. static List<ManInfo> _StockMaids = new List<ManInfo>();
  7353. static List<Maid> _StockMaids_Visible = new List<Maid>();
  7354. static List<Maid> _StockMens_Called = new List<Maid>();
  7355. static HashSet<Maid> _YtgKeepMaids_Visible = new HashSet<Maid>();
  7356. #endregion
  7357. class FIOmgr
  7358. {
  7359. bool bFade = false;
  7360. public bool bFadeIn { get; private set; }
  7361. public bool bUpdateRequest { get; private set; }
  7362. public FIOmgr()
  7363. {
  7364. bUpdateRequest = false;
  7365. }
  7366. public void inUpdate()
  7367. {
  7368. bUpdateRequest = false;
  7369. bFadeIn = false;
  7370. if (GameMain.Instance.MainCamera.IsFadeProc())
  7371. {
  7372. if (!bFade)
  7373. bFadeIn = true;
  7374. bFade = true;
  7375. }
  7376. if (bFade && GameMain.Instance.MainCamera.IsFadeStateNon())
  7377. {
  7378. debugPrintConsole("Fade: UpdateRequest = true");
  7379. bFade = false;
  7380. bUpdateRequest = true;
  7381. }
  7382. }
  7383. }
  7384. static FIOmgr fioMgr = new FIOmgr();
  7385. void LateUpdate()
  7386. {
  7387. //_camera_num = Camera.allCamerasCount;
  7388. foreach (var m in _MSlinks)
  7389. {
  7390. m.lateUpdate();
  7391. }
  7392. VertexMorph_FixBlendValues();
  7393. // 手のアタッチ角度調整
  7394. foreach (var ms in _MSlinks)
  7395. {
  7396. if (!IsHookActive)
  7397. ms.lateHandsAtcpProc();
  7398. /*
  7399. #if DEBUG
  7400. if (ms.do_slave && Input.GetKey(KeyCode.Y))
  7401. IkXT._inst.NewIKReset(ms.do_slave);
  7402. #endif
  7403. */
  7404. // 手指のブレンド v0030
  7405. ms.lateBlendHand();
  7406. }
  7407. }
  7408. static bool IsHookActive = false;
  7409. static bool IsHookAutoTwist = false;
  7410. // AutoTwist前にフック
  7411. public void preTBodyAutoTwist(TBody tbody)
  7412. {
  7413. IsHookAutoTwist = true;
  7414. //Console.WriteLine("preTBodyAutoTwist " + (tbody.boMAN ? "男" : tbody.maid.XtParam().status.last_name));
  7415. // 手のアタッチ角度調整
  7416. foreach (var ms in _MSlinks)
  7417. {
  7418. var slave = ms.GetSlave();
  7419. if (slave && slave == tbody.maid)
  7420. {
  7421. IsHookActive = true;
  7422. //Console.WriteLine("latehook " + (slave.boMAN ? "男" : slave.XtParam().status.last_name));
  7423. ms.lateHandsAtcpProc();
  7424. }
  7425. }
  7426. }
  7427. /*
  7428. // IKCtrlのアップデート前にフックされる
  7429. public void postIKUpdate(object objIKCtrl)
  7430. {
  7431. // 手のアタッチ角度調整
  7432. foreach (var ms in _MSlinks)
  7433. {
  7434. var slave = ms.GetSlave();
  7435. if (slave && IkXT._inst.GetIkCtrl(slave) == objIKCtrl)
  7436. {
  7437. IsHookActive = true;
  7438. //Console.WriteLine("latehook " + (slave.boMAN ? "男" : slave.XtParam().status.last_name));
  7439. ms.lateHandsAtcpProc();
  7440. }
  7441. }
  7442. }*/
  7443. /*
  7444. int _camera_num = 0;
  7445. private void OnRenderObject()
  7446. {
  7447. _camera_num--;
  7448. if (_camera_num > 0)
  7449. return;
  7450. //if (Camera.current != GameMain.Instance.MainCamera.camera)
  7451. // return;
  7452. //カメラのレンダリング完了
  7453. // 手の角度復元
  7454. foreach (var ms in _MSlinks)
  7455. {
  7456. ms.postHandsAtcpProc();
  7457. }
  7458. }
  7459. */
  7460. void Update()
  7461. {
  7462. //maid = null;
  7463. foreach (var m in _MSlinks)
  7464. {
  7465. m.mdMasters = mdDummyMaidl;
  7466. m.mdSlaves = mdDummyMaidl;
  7467. }
  7468. if (!SceneLevelEnable /*|| VYM.API.GetPluginEnabled() != 1*/)
  7469. {
  7470. return;
  7471. }
  7472. //フェードアウトチェック
  7473. fioMgr.inUpdate();
  7474. //有効チェック
  7475. bool boEnabled = true;
  7476. // メイドさんの取得
  7477. if (GameMain.Instance.CharacterMgr.GetMaidCount() <= 0 || GameMain.Instance.CharacterMgr.GetManCount() <= 0)
  7478. {
  7479. boEnabled = false;
  7480. //return;
  7481. }
  7482. else
  7483. {
  7484. GetMaids();
  7485. if (cfg.doHitScaleDef)
  7486. {
  7487. //ヒットチェック初期値設定
  7488. foreach (var m in _MaidList)
  7489. {
  7490. if (m.mem.IsBusy)
  7491. continue;
  7492. //バケーションパック対応は想像で適当にやってるので問題あるかも
  7493. UpdateHitScaleDef(m.mem, 1f, cfg.HitScaleDef, fioMgr.bUpdateRequest && vacationEnabled);
  7494. }
  7495. foreach (var m in HitScaleChangedMaids.ToArray())
  7496. {
  7497. if (!ChkMaid(m, true))
  7498. HitScaleChangedMaids.Remove(m);
  7499. }
  7500. }
  7501. //if (GetMaid() > 0)
  7502. // maid = MaidList[0].mem;
  7503. GetMens();
  7504. if (_MaidList.Count <= 0 || _MensList.Count <= 0)
  7505. {
  7506. boEnabled = false;
  7507. //return;
  7508. }
  7509. }
  7510. if (!boEnabled)
  7511. {
  7512. //ご主人様かメイドが居ない
  7513. foreach (var ms in _MSlinks)
  7514. {
  7515. if (ms.maidKeepSlaveYotogi && ms.maidKeepSlaveYotogi.Visible)
  7516. {
  7517. //夜伽キープ中のメイドが残ってしまうのを防止
  7518. if (!ms.keepSI.CheckMoved(ms.maidKeepSlaveYotogi, ms.num_) && GameMain.Instance.CharacterMgr.GetMaidCount() > 0
  7519. && GameMain.Instance.CharacterMgr.GetMaid(0) != ms.maidKeepSlaveYotogi)
  7520. {
  7521. ms.maidKeepSlaveYotogi.Visible = false;
  7522. }
  7523. else
  7524. {
  7525. ms.maidKeepSlaveYotogi = null;
  7526. }
  7527. }
  7528. }
  7529. //メイド単体稼働可に// return;
  7530. if (_MaidList.Count <= 0)
  7531. return;
  7532. }
  7533. //フェードアウトによるクリア
  7534. if (fioMgr.bUpdateRequest)
  7535. {
  7536. if (vacationEnabled || bIsYotogiScene)
  7537. VymModule.Reset();
  7538. }
  7539. //ストックメイドから表示したメイドのチェック
  7540. if (_StockMaids_Visible.Count > 0)
  7541. {
  7542. foreach (var vm in _StockMaids_Visible.ToArray())
  7543. {
  7544. if (!vm.Visible)
  7545. _StockMaids_Visible.Remove(vm);
  7546. }
  7547. if (bIsYotogiScene && fioMgr.bUpdateRequest)
  7548. {
  7549. //夜伽中はフェードインごとにメイドがリセットされる
  7550. _YtgKeepMaids_Visible.Clear();
  7551. }
  7552. }
  7553. //キーチェック
  7554. if (InputEx.GetKeyDownEx(cfg.hotkey_GUI, cfg.hotkey_GUI_Modifier))
  7555. {
  7556. //GUIの切り替え
  7557. GuiFlag = !GuiFlag;
  7558. XtMs2ndWnd.boShow = false;
  7559. if (!GuiFlag && _Gizmo.Visible)
  7560. {
  7561. //_Gizmo.Visible = false;
  7562. GizmoVisible(false);
  7563. }
  7564. if (!GuiFlag)
  7565. {
  7566. GizmoHsVisible(false);
  7567. CloseAllCombos();
  7568. }
  7569. else
  7570. {
  7571. showWndMin = false;
  7572. }
  7573. }
  7574. if (GuiFlag)
  7575. {
  7576. //onguiだけだと無効化しきれない場合がある
  7577. if (rc_stgw.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y)))
  7578. {
  7579. GameMain.Instance.MainCamera.SetControl(false);
  7580. bGuiOnMouse = true;
  7581. }
  7582. }
  7583. //Slave単独処理など
  7584. foreach (var ms in _MSlinks)
  7585. {
  7586. ms.MsUpdate(true, true);
  7587. ms.inUpdate_HoldMask();
  7588. }
  7589. if (boEnabled)
  7590. {
  7591. //マスターが居なければリンク処理はない
  7592. //マスター透明度の設定
  7593. CommonEdit.ProcManAlpha(fioMgr.bUpdateRequest);
  7594. //VibeYourMaidチェック
  7595. bIsVymPlg = (VYM.API.GetPluginEnabled() == 1);
  7596. //リンク処理
  7597. foreach (var ms in _MSlinks)
  7598. {
  7599. ms.linkProc();
  7600. }
  7601. VertexMorph_FixBlendValues();
  7602. }
  7603. // 手のアタッチ変更
  7604. foreach (var ms in _MSlinks)
  7605. {
  7606. ms.handsAtcpProc();
  7607. //ms.setupIkMIni();
  7608. //v5.0
  7609. IkXT._inst.UpdateFinalIK(ms.GetSlave(), ms, cfgs[ms.num_]);
  7610. }
  7611. return;
  7612. }
  7613. #region アタッチ
  7614. /*void AtccHand2HandR(Maid master, Maid slave)
  7615. {
  7616. string bone_handR = "ManBip R Hand";
  7617. if (!master.boMAN)
  7618. {
  7619. bone_handR = "Bip01 R Hand";
  7620. }
  7621. //Maid.IKTargetToAttachPointより
  7622. if (bone2Atcp(master, bone_handR) &&
  7623. slave.body0.tgtHandR_AttachName != bone_handR)
  7624. {
  7625. slave.body0.tgtMaidR = master;
  7626. slave.body0.tgtHandR_AttachSlot = (int)TBody.SlotID.body;
  7627. slave.body0.tgtHandR_AttachName = bone_handR;
  7628. slave.body0.tgtHandR = null;
  7629. slave.body0.tgtHandR_offset = v3HandROffset;//Vector3.zero;
  7630. }
  7631. }*/
  7632. static string GetHandBnR(Maid m)
  7633. {
  7634. if (!m.boMAN)
  7635. {
  7636. return "Bip01 R Hand";
  7637. }
  7638. return "ManBip R Hand";
  7639. }
  7640. // 手と手のアタッチ
  7641. static void AtccHand2HandR2(Maid master, Maid slave, Vector3 v3HandROffset, Vector3 v3HandROffsetRot, MsLinkConfig mscfg)
  7642. {
  7643. string bone_handR = GetHandBnR(master);
  7644. Transform tgt = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, bone_handR, true);
  7645. if (tgt)
  7646. {
  7647. slave.body0._ikp().tgtMaidR = master;
  7648. slave.body0._ikp().tgtHandR_AttachSlot = (int)TBody.SlotID.body;
  7649. slave.body0._ikp().tgtHandR_AttachName = string.Empty;
  7650. slave.body0._ikp().tgtHandR = tgt;
  7651. slave.body0._ikp().tgtHandR_offset = v3HandROffset;//Vector3.zero;
  7652. if (IkXT.IsIkCtrlO117)
  7653. {
  7654. IkXT.SetHandIKTarget(mscfg, "右手", master, slave, (int)TBody.SlotID.body, string.Empty, tgt, v3HandROffset);
  7655. }
  7656. if (!mscfg.doIK159NewPointToDef && mscfg.doIK159RotateToHands)
  7657. {
  7658. // v5.0 SetHandIKRotate同様のグローバル角度での調整
  7659. Transform trh0 = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, GetHandBnR(master), true);
  7660. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnR(slave), true);
  7661. trh.rotation = trh0.rotation * Quaternion.Euler(v3HandROffsetRot);
  7662. }
  7663. else
  7664. if (IkXT.IsNewIK && mscfg.doIK159RotateToHands/*Ik159.IsNewPointIK(slave, "右手")*/) // 手首角度のアタッチ v0027
  7665. {
  7666. //slave.IKTargetToBone("右手", master, bone_handR, v3HandROffsetRot, IKMgrData.IKAttachType.Rotate, false);
  7667. IkXT.SetHandIKRotate("右手", master, slave, bone_handR, v3HandROffsetRot);
  7668. }
  7669. // v0025 手の角度調整
  7670. else if (v3HandROffsetRot != Vector3.zero)
  7671. {
  7672. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnR(slave), true);
  7673. trh.localRotation *= Quaternion.Euler(v3HandROffsetRot);
  7674. }
  7675. }
  7676. }
  7677. /*void AtccHand2HandL(Maid master, Maid slave)
  7678. {
  7679. string bone_handL = "ManBip L Hand";
  7680. if (!master.boMAN)
  7681. {
  7682. bone_handL = "Bip01 L Hand";
  7683. }
  7684. //Maid.IKTargetToAttachPointより
  7685. if (bone2Atcp(master, bone_handL) &&
  7686. slave.body0.tgtHandL_AttachName != bone_handL)
  7687. {
  7688. slave.body0.tgtMaidL = master;
  7689. slave.body0.tgtHandL_AttachSlot = (int)TBody.SlotID.body;
  7690. slave.body0.tgtHandL_AttachName = bone_handL;
  7691. slave.body0.tgtHandL = null;
  7692. slave.body0.tgtHandL_offset = v3HandLOffset;//Vector3.zero;
  7693. }
  7694. }*/
  7695. static string GetHandBnL(Maid m)
  7696. {
  7697. if (!m.boMAN)
  7698. {
  7699. return "Bip01 L Hand";
  7700. }
  7701. return "ManBip L Hand";
  7702. }
  7703. static string GetForearmBn(Maid m, bool boR)
  7704. {
  7705. if (boR)
  7706. {
  7707. if (!m.boMAN)
  7708. {
  7709. return "Bip01 R Forearm";
  7710. }
  7711. return "ManBip R Forearm";
  7712. }
  7713. if (!m.boMAN)
  7714. {
  7715. return "Bip01 L Forearm";
  7716. }
  7717. return "ManBip L Forearm";
  7718. }
  7719. static void AtccHand2HandL2(Maid master, Maid slave, Vector3 v3HandLOffset, Vector3 v3HandLOffsetRot, MsLinkConfig mscfg)
  7720. {
  7721. string bone_handL = GetHandBnL(master);
  7722. //Maid.IKTargetToAttachPointより
  7723. Transform tgt = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, bone_handL, true);
  7724. if (tgt)
  7725. {
  7726. slave.body0._ikp().tgtMaidL = master;
  7727. slave.body0._ikp().tgtHandL_AttachSlot = (int)TBody.SlotID.body;
  7728. slave.body0._ikp().tgtHandL_AttachName = string.Empty;
  7729. slave.body0._ikp().tgtHandL = tgt;
  7730. slave.body0._ikp().tgtHandL_offset = v3HandLOffset;//Vector3.zero;
  7731. if (IkXT.IsIkCtrlO117)
  7732. {
  7733. IkXT.SetHandIKTarget(mscfg, "左手", master, slave, (int)TBody.SlotID.body, string.Empty, tgt, v3HandLOffset);
  7734. }
  7735. if (!mscfg.doIK159NewPointToDef && mscfg.doIK159RotateToHands)
  7736. {
  7737. // v5.0 SetHandIKRotate同様のグローバル角度での調整
  7738. Transform trh0 = BoneLink.BoneLink.SearchObjName(master.body0.m_Bones.transform, GetHandBnL(master), true);
  7739. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnL(slave), true);
  7740. trh.rotation = Quaternion.Inverse(trh0.rotation) * Quaternion.Euler(v3HandLOffsetRot);
  7741. }
  7742. else
  7743. if (IkXT.IsNewIK && mscfg.doIK159RotateToHands/*Ik159.IsNewPointIK(slave, "左手")*/) // 手首角度のアタッチ v0027
  7744. {
  7745. //slave.IKTargetToBone("左手", master, bone_handL, v3HandLOffsetRot, IKMgrData.IKAttachType.Rotate, false);
  7746. IkXT.SetHandIKRotate("左手", master, slave, bone_handL, v3HandLOffsetRot);
  7747. }
  7748. // v0025 手の角度調整
  7749. else if (v3HandLOffsetRot != Vector3.zero)
  7750. {
  7751. Transform trh = BoneLink.BoneLink.SearchObjName(slave.body0.m_Bones.transform, GetHandBnL(slave), true);
  7752. trh.localRotation *= Quaternion.Euler(v3HandLOffsetRot);
  7753. }
  7754. }
  7755. }
  7756. // 手のアタッチのバックアップ用
  7757. public class BkupHandsAtc
  7758. {
  7759. public class Param
  7760. {
  7761. public Maid TgtMaid;
  7762. public int Tgt_AttachSlot = -1;
  7763. public string Tgt_AttachName = string.Empty;
  7764. public Transform TgtTr;
  7765. public Vector3 TgtOffset;
  7766. }
  7767. public Param pR = new Param();
  7768. public Param pL = new Param();
  7769. public TBody bkupbody = null;
  7770. public BkupHandsAtc(TBody body0)
  7771. {
  7772. this.bkupbody = body0;
  7773. pL.TgtMaid = body0._ikp().tgtMaidL;
  7774. pL.Tgt_AttachSlot = body0._ikp().tgtHandL_AttachSlot;
  7775. pL.Tgt_AttachName = body0._ikp().tgtHandL_AttachName;
  7776. pL.TgtTr = body0._ikp().tgtHandL;
  7777. pL.TgtOffset = body0._ikp().tgtHandL_offset;
  7778. pR.TgtMaid = body0._ikp().tgtMaidR;
  7779. pR.Tgt_AttachSlot = body0._ikp().tgtHandR_AttachSlot;
  7780. pR.Tgt_AttachName = body0._ikp().tgtHandR_AttachName;
  7781. pR.TgtTr = body0._ikp().tgtHandR;
  7782. pR.TgtOffset = body0._ikp().tgtHandR_offset;
  7783. }
  7784. public bool RestoreAtc(ref TBody body0)
  7785. {
  7786. if (!body0)
  7787. return true; // 居なかったら復元不要なので成功とする
  7788. if (this.bkupbody != body0)
  7789. return false; // 別人なら
  7790. body0._ikp().tgtMaidL = pL.TgtMaid;
  7791. body0._ikp().tgtHandL_AttachSlot = pL.Tgt_AttachSlot;
  7792. body0._ikp().tgtHandL_AttachName = pL.Tgt_AttachName;
  7793. body0._ikp().tgtHandL = pL.TgtTr;
  7794. body0._ikp().tgtHandL_offset = pL.TgtOffset;
  7795. body0._ikp().tgtMaidR = pR.TgtMaid;
  7796. body0._ikp().tgtHandR_AttachSlot = pR.Tgt_AttachSlot;
  7797. body0._ikp().tgtHandR_AttachName = pR.Tgt_AttachName;
  7798. body0._ikp().tgtHandR = pR.TgtTr;
  7799. body0._ikp().tgtHandR_offset = pR.TgtOffset;
  7800. return true;
  7801. }
  7802. }
  7803. static void AtccHand1R(Maid slave, Maid tgtm, string atcpTgt, Vector3 v3HandOffset)
  7804. {
  7805. //Maid.IKTargetToAttachPointより
  7806. int slotid = (int)TBody.SlotID.body;
  7807. string atcpName = string.Empty;
  7808. if (tgtm && !string.IsNullOrEmpty(atcpTgt))
  7809. {
  7810. // v5.0 ボーンにアタッチ
  7811. if (atcpTgt.StartsWith(Defines.data.comboBonePrefix, StringComparison.Ordinal))
  7812. {
  7813. var bonetgt = BoneLink.BoneLink.SearchObjName(tgtm.body0.m_Bones.transform, atcpTgt.Remove(0, Defines.data.comboBonePrefix.Length), true);
  7814. slave.body0._ikp().tgtMaidR = tgtm;
  7815. slave.body0._ikp().tgtHandR_AttachSlot = -1;
  7816. slave.body0._ikp().tgtHandR_AttachName = string.Empty;
  7817. slave.body0._ikp().tgtHandR = bonetgt;
  7818. slave.body0._ikp().tgtHandR_offset = v3HandOffset;//Vector3.zero;
  7819. return;
  7820. }
  7821. string[] sa = atcpTgt.Split('⇒');
  7822. if (sa.Length == 2)
  7823. {
  7824. try
  7825. {
  7826. slotid = (int)Enum.Parse(typeof(TBody.SlotID), sa[0]);
  7827. atcpName = sa[1];
  7828. }
  7829. catch (Exception e)
  7830. {
  7831. Console.WriteLine("XtMS-AtccHand1R:" + e);
  7832. }
  7833. }
  7834. }
  7835. slave.body0._ikp().tgtMaidR = tgtm ? tgtm : null;
  7836. slave.body0._ikp().tgtHandR_AttachSlot = slotid;
  7837. slave.body0._ikp().tgtHandR_AttachName = atcpName;
  7838. slave.body0._ikp().tgtHandR = null;
  7839. slave.body0._ikp().tgtHandR_offset = v3HandOffset;//Vector3.zero;
  7840. }
  7841. static void AtccHand1L(Maid slave, Maid tgtm, string atcpTgt, Vector3 v3HandLOffset)
  7842. {
  7843. //Maid.IKTargetToAttachPointより
  7844. int slotid = (int)TBody.SlotID.body;
  7845. string atcpName = string.Empty;
  7846. if (tgtm && !string.IsNullOrEmpty(atcpTgt))
  7847. {
  7848. // v5.0 ボーンにアタッチ
  7849. if (atcpTgt.StartsWith(Defines.data.comboBonePrefix, StringComparison.Ordinal))
  7850. {
  7851. var bonetgt = BoneLink.BoneLink.SearchObjName(tgtm.body0.m_Bones.transform, atcpTgt.Remove(0, Defines.data.comboBonePrefix.Length), true);
  7852. slave.body0._ikp().tgtMaidL = tgtm;
  7853. slave.body0._ikp().tgtHandL_AttachSlot = -1;
  7854. slave.body0._ikp().tgtHandL_AttachName = string.Empty;
  7855. slave.body0._ikp().tgtHandL = bonetgt;
  7856. slave.body0._ikp().tgtHandL_offset = v3HandLOffset;//Vector3.zero;
  7857. return;
  7858. }
  7859. string[] sa = atcpTgt.Split('⇒');
  7860. if (sa.Length == 2)
  7861. {
  7862. try
  7863. {
  7864. slotid = (int)Enum.Parse(typeof(TBody.SlotID), sa[0]);
  7865. atcpName = sa[1];
  7866. }
  7867. catch (Exception e)
  7868. {
  7869. Console.WriteLine("XtMS-AtccHand1L:" + e);
  7870. }
  7871. }
  7872. }
  7873. slave.body0._ikp().tgtMaidL = tgtm ? tgtm : null;
  7874. slave.body0._ikp().tgtHandL_AttachSlot = slotid;
  7875. slave.body0._ikp().tgtHandL_AttachName = atcpName;
  7876. slave.body0._ikp().tgtHandL = null;
  7877. slave.body0._ikp().tgtHandL_offset = v3HandLOffset;//Vector3.zero;
  7878. }
  7879. static void AtccHandR(Maid slave, Maid tgtm, string boneName, Vector3 v3HandLOffset)
  7880. {
  7881. //Maid.IKTargetToAttachPointより
  7882. //Transform tgt = BoneLink.BoneLink.SearchObjName(tgtm.body0.goSlot[(int)TBody.SlotID.body].obj.transform, boneName, true);
  7883. Transform tgt = BoneLink.BoneLink.SearchObjName(tgtm.body0.m_Bones.transform, boneName, true);
  7884. if (tgt)
  7885. {
  7886. slave.body0._ikp().tgtMaidR = tgtm;
  7887. slave.body0._ikp().tgtHandR_AttachSlot = (int)TBody.SlotID.body;
  7888. slave.body0._ikp().tgtHandR_AttachName = string.Empty;
  7889. slave.body0._ikp().tgtHandR = tgt;
  7890. slave.body0._ikp().tgtHandR_offset = v3HandLOffset;//Vector3.zero;
  7891. }
  7892. }
  7893. static void AtccHandL(Maid slave, Maid tgtm, string boneName, Vector3 v3HandLOffset)
  7894. {
  7895. //Maid.IKTargetToAttachPointより
  7896. //Transform tgt = BoneLink.BoneLink.SearchObjName(tgtm.body0.goSlot[(int)TBody.SlotID.body].obj.transform, boneName, true);
  7897. Transform tgt = BoneLink.BoneLink.SearchObjName(tgtm.body0.m_Bones.transform, boneName, true);
  7898. if (tgt)
  7899. {
  7900. slave.body0._ikp().tgtMaidL = tgtm;
  7901. slave.body0._ikp().tgtHandL_AttachSlot = (int)TBody.SlotID.body;
  7902. slave.body0._ikp().tgtHandL_AttachName = string.Empty;
  7903. slave.body0._ikp().tgtHandL = tgt;
  7904. slave.body0._ikp().tgtHandL_offset = v3HandLOffset;//Vector3.zero;
  7905. }
  7906. }
  7907. #if test_cm3d2
  7908. bool bone2Atcp(Maid maid, string bonename)
  7909. {
  7910. // とりあえずbody限定
  7911. int slotid = (int)TBody.SlotID.body; //Enum.Parse(typeof(TBody.SlotID), sa[0]);
  7912. string atcp_sName = bonename;
  7913. var bodytmph = maid.body0.goSlot[(int)TBody.SlotID.body].morph;
  7914. var bodyBindVert = maid.body0.goSlot[(int)TBody.SlotID.body].morph.BindVert;
  7915. if (bodytmph.dicAttachPoint.ContainsKey(atcp_sName))
  7916. return true;
  7917. var trs = CMT.SearchObjName(maid.body0.m_Bones.transform, bonename, true);
  7918. if (!trs)
  7919. return false;
  7920. var vc = trs.position;
  7921. var rot = trs.rotation;
  7922. Transform[] t_bones = bodytmph.GetType().InvokeMember("m_bones", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.NonPublic, null, bodytmph, null) as Transform[];
  7923. if (t_bones == null)
  7924. return false;
  7925. //Transform transform = this.m_bones[tmph.BindBone[vidx]].transform;
  7926. Transform transform = t_bones[bodytmph.BindBone[0]].transform;
  7927. //vector = transform.TransformPoint(vector);
  7928. float num = (vc - transform.TransformPoint(bodyBindVert[0])).sqrMagnitude;
  7929. int num2 = 0;
  7930. for (int i = 0; i < bodytmph.m_vOriVert.Length; i++)
  7931. {
  7932. //float sqrMagnitude = (vc - tmph.DefVert[i]).sqrMagnitude;
  7933. transform = t_bones[bodytmph.BindBone[i]].transform;
  7934. float sqrMagnitude = (vc - transform.TransformPoint(bodyBindVert[i])).sqrMagnitude;
  7935. if (num > sqrMagnitude)
  7936. {
  7937. num = sqrMagnitude;
  7938. num2 = i;
  7939. }
  7940. }
  7941. int vidx = num2;
  7942. var pos = bodytmph.DefVert[vidx];
  7943. Transform bone_tr = t_bones[bodytmph.BindBone[vidx]].transform;
  7944. Quaternion q = (Quaternion.Inverse(bone_tr.rotation) * rot);
  7945. SetAttachPoint(bodytmph, atcp_sName, pos, q, (TBody.SlotID)slotid);
  7946. return true;
  7947. }
  7948. // TMorphよりループ向けにするラッパー
  7949. public void SetAttachPoint(TMorph tm, string apname, Vector3 vc, Quaternion q, TBody.SlotID slot)
  7950. {
  7951. if (tm.dicAttachPoint.ContainsKey(apname))
  7952. {
  7953. TAttachPoint tAttachPoint = tm.dicAttachPoint[apname];
  7954. int vidx = tAttachPoint.vidx;
  7955. if (tm.DefVert[vidx] == vc)
  7956. {
  7957. tAttachPoint.q = q; //角度のみ書き込み
  7958. tm.dicAttachPoint[apname] = tAttachPoint;
  7959. return; //変更なしなら更新不要(全頂点検索しにいくっぽいので毎回は重そう)
  7960. }
  7961. }
  7962. tm.SetAttachPoint(apname, vc, q);
  7963. //BindVert更新
  7964. if (!RenewBindVert(slot, tm, apname))
  7965. {
  7966. Console.WriteLine("BindVertの更新に失敗しました。アタッチが正常に表示されない可能性があります");
  7967. }
  7968. }
  7969. #endif
  7970. class gaoo
  7971. {
  7972. static public Matrix4x4[] m_bindposes = null;
  7973. static public Vector3[] m_vTmpVert = null;
  7974. static public void reset()
  7975. {
  7976. m_bindposes = null;
  7977. m_vTmpVert = null;
  7978. }
  7979. }
  7980. public bool RenewBindVert(TBody.SlotID slotID, TMorph tm, string apname)
  7981. {
  7982. if (!tm.dicAttachPoint.ContainsKey(apname))
  7983. {
  7984. return false;
  7985. }
  7986. TAttachPoint tAttachPoint = tm.dicAttachPoint[apname];
  7987. //Vector3 vector = Vector3.zero;
  7988. int vidx = tAttachPoint.vidx;
  7989. //Transform[] _bones = tm.GetType().InvokeMember("m_bones", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.NonPublic, null, tm, null) as Transform[];
  7990. gaoo.m_bindposes = tm.GetType().InvokeMember("m_bindposes", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.NonPublic, null, tm, null) as Matrix4x4[];
  7991. gaoo.m_vTmpVert = tm.GetType().InvokeMember("m_vTmpVert", BindingFlags.GetField | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.NonPublic, null, tm, null) as Vector3[];
  7992. if (/*_bones == null ||*/ gaoo.m_bindposes == null || gaoo.m_vTmpVert == null)
  7993. {
  7994. return false;
  7995. }
  7996. if (slotID == TBody.SlotID.head)
  7997. {
  7998. //FixBlendValues_Faceより
  7999. Vector3 vector = Vector3.zero;
  8000. vector += gaoo.m_bindposes[tAttachPoint.bw.boneIndex0].MultiplyPoint3x4(gaoo.m_vTmpVert[vidx]) * tAttachPoint.bw.weight0;
  8001. vector += gaoo.m_bindposes[tAttachPoint.bw.boneIndex1].MultiplyPoint3x4(gaoo.m_vTmpVert[vidx]) * tAttachPoint.bw.weight1;
  8002. vector += gaoo.m_bindposes[tAttachPoint.bw.boneIndex2].MultiplyPoint3x4(gaoo.m_vTmpVert[vidx]) * tAttachPoint.bw.weight2;
  8003. vector += gaoo.m_bindposes[tAttachPoint.bw.boneIndex3].MultiplyPoint3x4(gaoo.m_vTmpVert[vidx]) * tAttachPoint.bw.weight3;
  8004. tm.BindVert[vidx] = vector;
  8005. }
  8006. else
  8007. {
  8008. //FixBlendValueより
  8009. tm.BindVert[vidx] = gaoo.m_bindposes[tAttachPoint.bw.boneIndex0].MultiplyPoint3x4(gaoo.m_vTmpVert[vidx]);
  8010. }
  8011. gaoo.reset();
  8012. return true;
  8013. }
  8014. #endregion
  8015. public class MsUtil
  8016. {
  8017. /// <summary>
  8018. /// スレイブの選択
  8019. /// </summary>
  8020. /// <param name="pageNum">ページ番号</param>
  8021. /// <param name="memNum">Slaveリストのキャラ番号</param>
  8022. /// <returns>成功ならTrue</returns>
  8023. public static bool SelectSlave(int pageNum, int memNum)
  8024. {
  8025. if (memNum < 0 || pageNum < 0)
  8026. return false;
  8027. MsLinks ms_ = _MSlinks[pageNum];
  8028. MsLinkConfig p_mscfg = cfgs[pageNum];
  8029. v3Offsets p_v3of = v3ofs[pageNum];
  8030. if (ms_.mdSlave_No >= 0)
  8031. {
  8032. //アタッチの解除
  8033. if (p_mscfg.doIKTargetMHand || p_mscfg.doCopyIKTarget)
  8034. {
  8035. ms_.mdSlaves[ms_.mdSlave_No].mem.IKTargetClear();
  8036. }
  8037. else if (p_mscfg.doIKTargetMHandSpCustom)
  8038. {
  8039. //ms_.bkupHandTgt.RestoreAtc(ref ms_.mdSlaves[ms_.mdSlave_No].mem.body0);
  8040. // 両手をアタッチ⇒カスタムアタッチ⇒両手をアタッチ解除→こことか、条件を考えるのがめんどうなので全解除
  8041. ms_.mdSlaves[ms_.mdSlave_No].mem.IKTargetClear();
  8042. ms_.bkupHandTgt = null;
  8043. }
  8044. }
  8045. //選択変更
  8046. ms_.mdSlave_No = memNum;
  8047. if (ms_.mdSlave_No >= ms_.mdSlaves.Count)
  8048. {
  8049. ms_.mdSlave_No = -1; //選択解除
  8050. ms_.maidKeepSlaveYotogi = null;
  8051. }
  8052. else
  8053. {
  8054. //キープメイド更新
  8055. if (ms_.doMasterSlave && ms_.mdSlave_No > 0 && !ms_.mdSlaves[ms_.mdSlave_No].mem.boMAN)
  8056. {
  8057. if (p_mscfg.doKeepSlaveYotogi && XtMasterSlave.IsKeepScene()/*(vIsKaisouScene || bIsYotogiScene)*/)
  8058. ms_.maidKeepSlaveYotogi = ms_.mdSlaves[ms_.mdSlave_No].mem;
  8059. }
  8060. else
  8061. {
  8062. ms_.maidKeepSlaveYotogi = null;
  8063. }
  8064. }
  8065. ms_.FixSlave();
  8066. return true;
  8067. }
  8068. /// <summary>
  8069. /// マスターの選択
  8070. /// </summary>
  8071. /// <param name="pageNum">ページ番号</param>
  8072. /// <param name="memNum">Masterリストのキャラ番号</param>
  8073. /// <returns>成功ならTrue</returns>
  8074. public static bool SelectMaster(int pageNum, int memNum)
  8075. {
  8076. if (memNum < 0 || pageNum < 0)
  8077. return false;
  8078. MsLinks ms_ = _MSlinks[pageNum];
  8079. //MsLinkConfig p_mscfg = cfgs[pageNum];
  8080. //v3Offsets p_v3of = v3ofs[pageNum];
  8081. ms_.mdMaster_No = memNum;
  8082. if (ms_.mdMaster_No >= ms_.mdMasters.Count)
  8083. ms_.mdMaster_No = -1; //選択解除
  8084. ms_.FixMaster();
  8085. return true;
  8086. }
  8087. /// <summary>
  8088. /// M/Sモード変更
  8089. /// </summary>
  8090. /// <param name="pageNum">ページ番号</param>
  8091. /// <param name="isMaidMaster">メイドがマスター</param>
  8092. public static void ChangeMsMode(int pageNum, bool isMaidMaster)
  8093. {
  8094. MsLinks ms_ = _MSlinks[pageNum];
  8095. MsLinkConfig p_mscfg = cfgs[pageNum];
  8096. //v3Offsets p_v3of = v3ofs[pageNum];
  8097. if (!isMaidMaster)
  8098. {
  8099. if (ms_.Scc1_MasterMaid)
  8100. {
  8101. // "Man⇒Maid"
  8102. ms_.Scc1_MasterMaid = false;
  8103. ms_.doMasterSlave = false;
  8104. int n = ms_.mdMaster_No;
  8105. ms_.mdMaster_No = ms_.mdSlave_No;
  8106. if (n >= 0 && ms_.testSlaved(_MaidList[n].mem, out int iran))
  8107. { //スレイブが重複しないかチェックして重複なら解除
  8108. n = -1;
  8109. }
  8110. ms_.mdSlave_No = n;
  8111. //コンボ初期化
  8112. CloseAllCombos();
  8113. }
  8114. }
  8115. else
  8116. {
  8117. if (!ms_.Scc1_MasterMaid)
  8118. {
  8119. ms_.Scc1_MasterMaid = true;
  8120. ms_.doMasterSlave = false;
  8121. int n = ms_.mdMaster_No;
  8122. ms_.mdMaster_No = ms_.mdSlave_No;
  8123. if (n >= 0 && ms_.testSlaved(_MensList[n].mem, out int iran))
  8124. { //スレイブが重複しないかチェックして重複なら解除
  8125. n = -1;
  8126. }
  8127. ms_.mdSlave_No = n;
  8128. //コンボ初期化
  8129. CloseAllCombos();
  8130. }
  8131. }
  8132. return;
  8133. }
  8134. /// <summary>
  8135. /// 指定ページのSlaveまたはMaster候補者リストを返す
  8136. /// </summary>
  8137. /// <param name="pageNum">ページ番号</param>
  8138. /// <param name="GetMasters">マスターを取得したい場合True(FalseでSlave)</param>
  8139. /// <returns>メイドまたは男リスト、エラーでNULL</returns>
  8140. public static Maid[] GetMembersList(int pageNum, bool GetMasters)
  8141. {
  8142. if (pageNum < 0)
  8143. return null;
  8144. MsLinks ms_ = _MSlinks[pageNum];
  8145. //MsLinkConfig p_mscfg = cfgs[pageNum];
  8146. //v3Offsets p_v3of = v3ofs[pageNum];
  8147. var m = ms_.mdSlaves;
  8148. if (GetMasters)
  8149. {
  8150. m = ms_.mdSlaves;
  8151. }
  8152. Maid[] ret = null;
  8153. if (m != null)
  8154. {
  8155. List<Maid> lm = new List<Maid>();
  8156. foreach (var p in m)
  8157. {
  8158. lm.Add(p.mem);
  8159. }
  8160. ret = lm.ToArray();
  8161. }
  8162. return ret;
  8163. }
  8164. /// <summary>
  8165. /// 指定ページで選択中のキャラクター番号
  8166. /// </summary>
  8167. /// <param name="pageNum">ページ番号</param>
  8168. /// <param name="GetMasters">マスターを取得したい場合True(FalseでSlave)</param>
  8169. /// <returns>エラーまたは未選択なら-1</returns>
  8170. public static int GetMemberNum(int pageNum, bool GetMaster)
  8171. {
  8172. if (pageNum < 0)
  8173. return -1;
  8174. MsLinks ms_ = _MSlinks[pageNum];
  8175. //MsLinkConfig p_mscfg = cfgs[pageNum];
  8176. //v3Offsets p_v3of = v3ofs[pageNum];
  8177. var m = ms_.mdSlave_No;
  8178. if (GetMaster)
  8179. {
  8180. m = ms_.mdMaster_No;
  8181. }
  8182. return m;
  8183. }
  8184. /// <summary>
  8185. /// Msリンクの開始か停止状態取得
  8186. /// </summary>
  8187. /// <param name="pageNum">ページ番号</param>
  8188. /// <returns>実行中ならTrue</returns>
  8189. public static bool IsStartMsLink(int pageNum)
  8190. {
  8191. MsLinks ms_ = _MSlinks[pageNum];
  8192. return ms_.doMasterSlave;
  8193. }
  8194. /// <summary>
  8195. /// Msリンクの開始か停止
  8196. /// </summary>
  8197. /// <param name="pageNum">ページ番号</param>
  8198. /// <param name="Stop">停止したい時はTrue</param>
  8199. /// <returns>成功ならTrue</returns>
  8200. public static bool StartMsLink(int pageNum, bool Stop)
  8201. {
  8202. if (pageNum < 0)
  8203. return false;
  8204. MsLinks ms_ = _MSlinks[pageNum];
  8205. Maid slave = (ms_.mdSlave_No >= 0 && ms_.mdSlaves.Count() > ms_.mdSlave_No) ? ms_.mdSlaves[ms_.mdSlave_No].mem : null;
  8206. if (!slave || !slave.body0)
  8207. {
  8208. return false;
  8209. }
  8210. return StartMsLink(pageNum, Stop, true, slave);
  8211. }
  8212. // 内部用
  8213. /// <summary>
  8214. /// Msリンクの開始か停止
  8215. /// </summary>
  8216. /// <param name="pageNum">ページ番号</param>
  8217. /// <param name="Stop">停止したい時はTrue</param>
  8218. /// <param name="LinkCheck">GUIではFalse</param>
  8219. /// <param name="slave">GUI用</param>
  8220. /// <returns>成功ならTrue</returns>
  8221. internal static bool StartMsLink(int pageNum, bool Stop, bool LinkCheck, Maid slave)
  8222. {
  8223. MsLinks ms_ = _MSlinks[pageNum];
  8224. MsLinkConfig p_mscfg = cfgs[pageNum];
  8225. //v3Offsets p_v3of = v3ofs[pageNum];
  8226. if (LinkCheck)
  8227. {
  8228. if (ms_.testLoopLink())
  8229. {
  8230. //リンクの無限ループを防止
  8231. return false;
  8232. }
  8233. else if (ms_.testOverlapedLink())
  8234. {
  8235. //リンクのダブりを防止
  8236. return false;
  8237. }
  8238. }
  8239. if (Stop == !ms_.doMasterSlave)
  8240. return true; //変化なし
  8241. //if (GUI.Button(rcItem, "Master-Slave *" + (_pageNum + 1) + " リンク" + (!ms_.doMasterSlave ? "実行" : "停止"), gsButton))
  8242. ms_.doMasterSlave = !ms_.doMasterSlave;
  8243. if (ms_.doMasterSlave)
  8244. {
  8245. if (p_mscfg.doKeepSlaveYotogi && XtMasterSlave.IsKeepScene() && !slave.boMAN)
  8246. ms_.maidKeepSlaveYotogi = slave;
  8247. }
  8248. else
  8249. {
  8250. ms_.maidKeepSlaveYotogi = null;
  8251. //アタッチの解除
  8252. if (p_mscfg.doIKTargetMHand || p_mscfg.doCopyIKTarget)
  8253. {
  8254. slave.IKTargetClear();
  8255. }
  8256. }
  8257. return true;
  8258. }
  8259. /// <summary>
  8260. /// 上級者向けリンク状態設定。アタッチ解除とかしないので後始末出来る人用
  8261. /// </summary>
  8262. /// <param name="pageNum">ページ番号</param>
  8263. /// <param name="StackPos">位置の重ね有無</param>
  8264. /// <param name="StackPos">局部で位置合わせ有無</param>
  8265. /// <param name="AtcMsHands">両手をマスターにアタッチ</param>
  8266. /// <param name="CopyIkHands">両手のIKコピー</param>
  8267. /// <param name="PosSync">位置のみリンク有無</param>
  8268. /// <param name="VoiceAndFacePlay">ボイス&フェイス変更</param>
  8269. /// <returns>成功ならTrue</returns>
  8270. public static bool ConfigMsLink(int pageNum, bool StackPos, bool AutoCnkPos, bool AtcMsHands, bool CopyIkHands, bool PosSync, bool VoiceAndFacePlay)
  8271. {
  8272. if (pageNum < 0)
  8273. return false;
  8274. MsLinks ms_ = _MSlinks[pageNum];
  8275. MsLinkConfig p_mscfg = cfgs[pageNum];
  8276. p_mscfg.doStackSlave = StackPos;
  8277. p_mscfg.doStackSlave_CliCnk = AutoCnkPos;
  8278. p_mscfg.doIKTargetMHand = AtcMsHands;
  8279. p_mscfg.doCopyIKTarget = CopyIkHands;
  8280. p_mscfg.doStackSlave_PosSyncMode = PosSync;
  8281. p_mscfg.doVoiceAndFacePlay = VoiceAndFacePlay;
  8282. return true;
  8283. }
  8284. }
  8285. #region FaceSync
  8286. public static void FaceBlend2Sync(XtTMorph tm, XtTMorph tm_tgt, bool isLateUpdate)
  8287. {
  8288. if (!isLateUpdate)
  8289. {
  8290. tm_tgt.BlendValues[(int)tm_tgt.hash["hohol"]] = tm.BlendValues[(int)tm.hash["hohol"]];
  8291. tm_tgt.BlendValues[(int)tm_tgt.hash["hohos"]] = tm.BlendValues[(int)tm.hash["hohos"]];
  8292. tm_tgt.BlendValues[(int)tm_tgt.hash["hohos"]] = tm.BlendValues[(int)tm.hash["hohos"]];
  8293. tm_tgt.BlendValues[(int)tm_tgt.hash["hoho2"]] = tm.BlendValues[(int)tm.hash["tear3"]];
  8294. tm_tgt.BlendValues[(int)tm_tgt.hash["hoho2"]] = tm.BlendValues[(int)tm.hash["tear2"]];
  8295. tm_tgt.BlendValues[(int)tm_tgt.hash["hoho2"]] = tm.BlendValues[(int)tm.hash["tear1"]];
  8296. tm_tgt.BlendValues[(int)tm_tgt.hash["yodare"]] = tm.BlendValues[(int)tm.hash["yodare"]];
  8297. }
  8298. else
  8299. {
  8300. tm_tgt.BlendValues[(int)tm_tgt.hash["hoho2"]] = tm.BlendValues[(int)tm.hash["hoho2"]];
  8301. tm_tgt.BlendValues[(int)tm_tgt.hash["namida"]] = tm.BlendValues[(int)tm.hash["namida"]];
  8302. tm_tgt.BlendValues[(int)tm_tgt.hash["shock"]] = tm.BlendValues[(int)tm.hash["shock"]];
  8303. }
  8304. tm_tgt.morph.FixBlendValues_Face();
  8305. }
  8306. class VymMouthAnime
  8307. {
  8308. //VibeYourMaidプラグインより頂きました
  8309. //メイドの口元変更
  8310. private float MouthHoldTime = 0f;
  8311. //private int MouthMode = 0;
  8312. private int OldMode = 0;
  8313. private float MaValue;
  8314. private float MiValue;
  8315. //private float McValue;
  8316. private float MdwValue;
  8317. private float TupValue = 0f;
  8318. private float ToutValue = 0f;
  8319. private float TopenValue = 0f;
  8320. private float TupValue2 = 0.3f;
  8321. private float ToutValue2 = 0.3f;
  8322. private float TopenValue2 = 0.4f;
  8323. public void MouthChange(Maid maid, int mode)
  8324. {
  8325. float timerRate = Time.deltaTime * 60;
  8326. float maV; //口あ
  8327. float miV; //口い
  8328. float mcV; //口う
  8329. float msV; //笑顔
  8330. float mdwV; //口角上げ
  8331. float mupV; //口角下げ
  8332. if (mode != OldMode)
  8333. {
  8334. MouthHoldTime = 0;
  8335. OldMode = mode;
  8336. }
  8337. if (MouthHoldTime <= 0)
  8338. {
  8339. MouthHoldTime = UnityEngine.Random.Range(180f, 360f);
  8340. if (mode == 0)
  8341. { //通常時
  8342. MaValue = UnityEngine.Random.Range(0f, 30f) / 100f;
  8343. MdwValue = UnityEngine.Random.Range(0f, 30f) / 100f;
  8344. }
  8345. if (mode == 1)
  8346. { //キス時
  8347. MaValue = UnityEngine.Random.Range(20f, 60f) / 100f;
  8348. MdwValue = UnityEngine.Random.Range(0f, 50f) / 100f;
  8349. }
  8350. if (mode == 2)
  8351. { //フェラ時
  8352. MaValue = UnityEngine.Random.Range(80f, 100f) / 100f;
  8353. }
  8354. if (mode == 3)
  8355. { //連続絶頂時1
  8356. MaValue = UnityEngine.Random.Range(70f, 90f) / 100f;
  8357. MdwValue = UnityEngine.Random.Range(30f, 90f) / 100f;
  8358. }
  8359. if (mode == 4)
  8360. { //連続絶頂時2
  8361. MiValue = UnityEngine.Random.Range(30f, 50f) / 100f;
  8362. MdwValue = UnityEngine.Random.Range(20f, 40f) / 100f;
  8363. }
  8364. if (mode == 5)
  8365. { //余韻時
  8366. MaValue = UnityEngine.Random.Range(10f, 40f) / 100f;
  8367. MdwValue = UnityEngine.Random.Range(0f, 30f) / 100f;
  8368. }
  8369. }
  8370. MouthHoldTime -= timerRate;
  8371. var morph = maid.body0.Face.XtMorph();
  8372. maV = morph.BlendValues[(int)maid.body0.Face.morph.hash[(object)"moutha"]] + MaValue;
  8373. miV = morph.BlendValues[(int)maid.body0.Face.morph.hash[(object)"mouthi"]] + MiValue;
  8374. mcV = morph.BlendValues[(int)maid.body0.Face.morph.hash[(object)"mouthc"]];
  8375. msV = morph.BlendValues[(int)maid.body0.Face.morph.hash[(object)"mouths"]];
  8376. mdwV = morph.BlendValues[(int)maid.body0.Face.morph.hash[(object)"mouthdw"]] + MdwValue;
  8377. mupV = morph.BlendValues[(int)maid.body0.Face.morph.hash[(object)"mouthup"]];
  8378. //舌の動き処理
  8379. //キス時とフェラ時
  8380. if (mode == 1 || mode == 2)
  8381. {
  8382. if (TupValue < TupValue2)
  8383. {
  8384. TupValue += Time.deltaTime * 0.5f;
  8385. if (TupValue >= TupValue2) { TupValue2 = UnityEngine.Random.Range(0f, 60f) / 100f; }
  8386. }
  8387. else
  8388. {
  8389. TupValue -= Time.deltaTime * 0.5f;
  8390. if (TupValue <= TupValue2) { TupValue2 = UnityEngine.Random.Range(0f, 60f) / 100f; }
  8391. }
  8392. if (ToutValue < ToutValue2)
  8393. {
  8394. ToutValue += Time.deltaTime * 0.5f;
  8395. if (ToutValue >= ToutValue2) { ToutValue2 = UnityEngine.Random.Range(0f, 50f) / 100f; }
  8396. }
  8397. else
  8398. {
  8399. ToutValue -= Time.deltaTime * 0.5f;
  8400. if (ToutValue <= ToutValue2) { ToutValue2 = UnityEngine.Random.Range(0f, 50f) / 100f; }
  8401. }
  8402. if (TopenValue < TopenValue2)
  8403. {
  8404. TopenValue += Time.deltaTime * 0.5f;
  8405. if (TopenValue >= TopenValue2) { TopenValue2 = UnityEngine.Random.Range(0f, 40f) / 100f; }
  8406. }
  8407. else
  8408. {
  8409. TopenValue -= Time.deltaTime * 0.5f;
  8410. if (TopenValue <= TopenValue2) { TopenValue2 = UnityEngine.Random.Range(0f, 40f) / 100f; }
  8411. }
  8412. }
  8413. //連続絶頂時
  8414. if (mode == 3)
  8415. {
  8416. if (TupValue < TupValue2)
  8417. {
  8418. TupValue += Time.deltaTime * 0.5f;
  8419. if (TupValue >= TupValue2) { TupValue2 = UnityEngine.Random.Range(0f, 40f) / 100f; }
  8420. }
  8421. else
  8422. {
  8423. TupValue -= Time.deltaTime * 0.5f;
  8424. if (TupValue <= TupValue2) { TupValue2 = UnityEngine.Random.Range(0f, 40f) / 100f; }
  8425. }
  8426. if (ToutValue < ToutValue2)
  8427. {
  8428. ToutValue += Time.deltaTime * 0.5f;
  8429. if (ToutValue >= ToutValue2) { ToutValue2 = UnityEngine.Random.Range(60f, 100f) / 100f; }
  8430. }
  8431. else
  8432. {
  8433. ToutValue -= Time.deltaTime * 0.5f;
  8434. if (ToutValue <= ToutValue2) { ToutValue2 = UnityEngine.Random.Range(60f, 100f) / 100f; }
  8435. }
  8436. if (TopenValue < TopenValue2)
  8437. {
  8438. TopenValue += Time.deltaTime * 0.5f;
  8439. if (TopenValue >= TopenValue2) { TopenValue2 = UnityEngine.Random.Range(0f, 60f) / 100f; }
  8440. }
  8441. else
  8442. {
  8443. TopenValue -= Time.deltaTime * 0.5f;
  8444. if (TopenValue <= TopenValue2) { TopenValue2 = UnityEngine.Random.Range(0f, 60f) / 100f; }
  8445. }
  8446. }
  8447. //口元破綻の抑制とシェイプキー操作
  8448. if (mode == 0)
  8449. { //通常時
  8450. try
  8451. {
  8452. VertexMorph_FromProcItem(maid.body0, "moutha", maV);
  8453. VertexMorph_FromProcItem(maid.body0, "mouthdw", mdwV);
  8454. }
  8455. catch { /*LogError(ex);*/ }
  8456. }
  8457. if (mode == 1)
  8458. { //キス時
  8459. if (miV > 0.1f) VertexMorph_FromProcItem(maid.body0, "mouthi", 0.1f);
  8460. if (maV > 0.6f) maV = 0.6f;
  8461. try
  8462. {
  8463. VertexMorph_FromProcItem(maid.body0, "moutha", maV);
  8464. VertexMorph_FromProcItem(maid.body0, "mouthdw", mdwV);
  8465. VertexMorph_FromProcItem(maid.body0, "tangup", TupValue);
  8466. VertexMorph_FromProcItem(maid.body0, "tangout", ToutValue);
  8467. VertexMorph_FromProcItem(maid.body0, "tangopen", TopenValue);
  8468. }
  8469. catch { /*LogError(ex);*/ }
  8470. }
  8471. if (mode == 2)
  8472. { //フェラ時
  8473. if (miV > 0.1f) VertexMorph_FromProcItem(maid.body0, "mouthi", 0.1f);
  8474. if (mcV > 0.2f) VertexMorph_FromProcItem(maid.body0, "mouthc", 0.2f);
  8475. if (msV > 0.1f) VertexMorph_FromProcItem(maid.body0, "mouths", 0.1f);
  8476. if (mupV > 0.1f) VertexMorph_FromProcItem(maid.body0, "mouthup", 0.1f);
  8477. if (maV > 1.0f) maV = 1.0f;
  8478. try
  8479. {
  8480. VertexMorph_FromProcItem(maid.body0, "moutha", maV);
  8481. VertexMorph_FromProcItem(maid.body0, "mouthdw", mdwV);
  8482. VertexMorph_FromProcItem(maid.body0, "tangup", TupValue);
  8483. VertexMorph_FromProcItem(maid.body0, "tangout", ToutValue);
  8484. VertexMorph_FromProcItem(maid.body0, "tangopen", TopenValue);
  8485. }
  8486. catch { /*LogError(ex);*/ }
  8487. }
  8488. if (mode == 3)
  8489. { //連続絶頂時1
  8490. if (miV > 0.1f) VertexMorph_FromProcItem(maid.body0, "mouthi", 0.1f);
  8491. if (mcV > 0.2f) VertexMorph_FromProcItem(maid.body0, "mouthc", 0.2f);
  8492. if (msV > 0.1f) VertexMorph_FromProcItem(maid.body0, "mouths", 0.1f);
  8493. if (mupV > 0.1f) VertexMorph_FromProcItem(maid.body0, "mouthup", 0.1f);
  8494. if (maV > 1.0f) maV = 1.0f;
  8495. try
  8496. {
  8497. VertexMorph_FromProcItem(maid.body0, "moutha", maV);
  8498. VertexMorph_FromProcItem(maid.body0, "mouthdw", mdwV);
  8499. VertexMorph_FromProcItem(maid.body0, "tangup", TupValue);
  8500. VertexMorph_FromProcItem(maid.body0, "tangout", ToutValue);
  8501. VertexMorph_FromProcItem(maid.body0, "tangopen", TopenValue);
  8502. }
  8503. catch { /*LogError(ex);*/ }
  8504. }
  8505. if (mode == 4)
  8506. { //連続絶頂時2
  8507. if (mupV > 0f) VertexMorph_FromProcItem(maid.body0, "mouthup", 0f);
  8508. if (msV > 0.1f) VertexMorph_FromProcItem(maid.body0, "mouths", 0.1f);
  8509. try
  8510. {
  8511. VertexMorph_FromProcItem(maid.body0, "mouthi", miV);
  8512. VertexMorph_FromProcItem(maid.body0, "mouthdw", mdwV);
  8513. VertexMorph_FromProcItem(maid.body0, "toothoff", 0f);
  8514. }
  8515. catch { /*LogError(ex);*/ }
  8516. }
  8517. if (mode == 5)
  8518. { //余韻時
  8519. try
  8520. {
  8521. VertexMorph_FromProcItem(maid.body0, "moutha", maV);
  8522. VertexMorph_FromProcItem(maid.body0, "mouthdw", mdwV);
  8523. }
  8524. catch { /*LogError(ex);*/ }
  8525. }
  8526. }
  8527. }
  8528. static List<TMorph> m_NeedFixTMorphs = new List<TMorph>();
  8529. //シェイプキー操作
  8530. //戻り値はsTagの存在有無にしているので必要に応じて変更してください
  8531. static public bool VertexMorph_FromProcItem(TBody body, string sTag, float f)
  8532. {
  8533. bool bRes = false;
  8534. if (!body || sTag == null || sTag == "")
  8535. return false;
  8536. for (int i = 0; i < body.goSlot.Count; i++)
  8537. {
  8538. TMorph morph = body.goSlot[i].morph;
  8539. if (morph != null)
  8540. {
  8541. if (morph.Contains(sTag))
  8542. {
  8543. /*if (i == 1)
  8544. {
  8545. bFace = true;
  8546. }*/
  8547. bRes = true;
  8548. int h = (int)morph.hash[sTag];
  8549. var morphV = body.goSlot[i].XtMorph();
  8550. morphV.BlendValues[h] = f;
  8551. //後でまとめて更新する
  8552. //body.goSlot[i].morph.FixBlendValues();
  8553. //更新リストに追加
  8554. if (!m_NeedFixTMorphs.Contains(morph))
  8555. m_NeedFixTMorphs.Add(morph);
  8556. }
  8557. }
  8558. }
  8559. return bRes;
  8560. }
  8561. //シェイプキー操作Fix(基本はUpdate等の最後に一度呼ぶだけで良いはず)
  8562. static public void VertexMorph_FixBlendValues()
  8563. {
  8564. foreach (TMorph tm in m_NeedFixTMorphs)
  8565. {
  8566. if (tm != null) // bugfix
  8567. {
  8568. tm.FixBlendValues();
  8569. }
  8570. }
  8571. m_NeedFixTMorphs.Clear();
  8572. }
  8573. #endregion
  8574. public class AnimeState
  8575. {
  8576. static HashSet<AnimeState> listInst_ = new HashSet<AnimeState>();
  8577. string ytg_Pre_sAnm = "";
  8578. State ytg_bOrg = State.none;
  8579. float last_anitime = 0f;
  8580. [FlagsAttribute]
  8581. public enum State
  8582. {
  8583. none = 0,
  8584. zeccho = 1,
  8585. yoin = 1 << 1,
  8586. kiss = 1 << 2,
  8587. uke = 1 << 3,
  8588. sex = 1 << 4,
  8589. taiki = 1 << 5,
  8590. kousoku = 1 << 6,
  8591. seme = 1 << 7,
  8592. }
  8593. public AnimeState()
  8594. {
  8595. listInst_.Add(this);
  8596. }
  8597. ~AnimeState()
  8598. {
  8599. if (listInst_.Contains(this))
  8600. listInst_.Remove(this);
  8601. }
  8602. public static void AllReset()
  8603. {
  8604. foreach (var m in listInst_)
  8605. {
  8606. m.chk_motion_reset();
  8607. }
  8608. }
  8609. public void chk_motion_reset()
  8610. {
  8611. {
  8612. ytg_Pre_sAnm = "";
  8613. ytg_bOrg = State.none;
  8614. last_anitime = 0f;
  8615. }
  8616. }
  8617. public State chk_motion_state(TBody body, bool reset, out bool boMotionChanged)
  8618. {
  8619. if (reset)
  8620. {
  8621. ytg_Pre_sAnm = "";
  8622. ytg_bOrg = State.none;
  8623. }
  8624. boMotionChanged = false;
  8625. //モーション判定ここから
  8626. //string anim = body.LastAnimeFN;
  8627. //vym、回想対応版
  8628. var anim_state = GetPlayingFN_withTime(body);
  8629. string anim = anim_state.Key;
  8630. if (anim == null || anim.Length <= 0)
  8631. {
  8632. ytg_bOrg = State.none;
  8633. return State.none;
  8634. }
  8635. //モーション名取得して絶頂時のものなら絶頂処理
  8636. if (anim != ytg_Pre_sAnm)//前回からモーション変化時のみ
  8637. {
  8638. boMotionChanged = true;
  8639. ytg_bOrg = State.none;
  8640. string anim_lr = anim.ToLower();
  8641. foreach (string s in ycfg.sMensKousokuMotion)
  8642. {
  8643. //拘束役
  8644. if (Regex.IsMatch(anim_lr, s))
  8645. {
  8646. ytg_bOrg = State.kousoku;
  8647. break;
  8648. }
  8649. }
  8650. if (ytg_bOrg == State.none)
  8651. {
  8652. foreach (string s in ycfg.sMensZeccyouMotion)
  8653. {
  8654. if (Regex.IsMatch(anim_lr, s))
  8655. {
  8656. ytg_bOrg = State.zeccho;
  8657. break;
  8658. }
  8659. }
  8660. }
  8661. if (ytg_bOrg == State.none)
  8662. {
  8663. foreach (string s in ycfg.sMensZeccyouAfterMotion)
  8664. {
  8665. if (Regex.IsMatch(anim_lr, s))
  8666. {
  8667. ytg_bOrg = State.yoin;
  8668. break;
  8669. }
  8670. }
  8671. }
  8672. if (ytg_bOrg == State.none)
  8673. {
  8674. foreach (string s in ycfg.sMensTaikiMotion)
  8675. {
  8676. if (Regex.IsMatch(anim_lr, s))
  8677. {
  8678. ytg_bOrg = State.taiki;
  8679. break;
  8680. }
  8681. }
  8682. }
  8683. if (ytg_bOrg == State.none || ytg_bOrg == State.zeccho || ytg_bOrg == State.yoin)
  8684. {
  8685. foreach (string s in ycfg.sMensKissMotion)
  8686. {
  8687. if (Regex.IsMatch(anim_lr, s))
  8688. {
  8689. ytg_bOrg = ytg_bOrg | State.kiss;
  8690. break;
  8691. }
  8692. }
  8693. }
  8694. if (ytg_bOrg == State.none)
  8695. {
  8696. foreach (string s in ycfg.sMensUkeMotion)
  8697. {
  8698. if (Regex.IsMatch(anim_lr, s))
  8699. {
  8700. ytg_bOrg = State.uke;
  8701. break;
  8702. }
  8703. }
  8704. }
  8705. if (ytg_bOrg == State.none)
  8706. {
  8707. foreach (string s in ycfg.sMensSemeMotion)
  8708. {
  8709. //責め役
  8710. if (Regex.IsMatch(anim_lr, s))
  8711. {
  8712. ytg_bOrg = State.seme;
  8713. break;
  8714. }
  8715. }
  8716. }
  8717. if (ytg_bOrg == State.none)
  8718. {
  8719. foreach (string s in ycfg.sMensSexMotion)
  8720. {
  8721. if (Regex.IsMatch(anim_lr, s))
  8722. {
  8723. ytg_bOrg = State.sex;
  8724. break;
  8725. }
  8726. }
  8727. }
  8728. //debugPrintConsole("Masterモーション変更あり " + ytg_bOrg + " / " + anim);
  8729. if (cfg.boMasterMotionLog)
  8730. Console.WriteLine("Masterモーション変更あり 登録カテゴリ:" + ytg_bOrg + " / モーション名:" + anim);
  8731. ytg_Pre_sAnm = anim;
  8732. }
  8733. else
  8734. {
  8735. if (anim_state.Value < last_anitime && (last_anitime % 1f) < 0.7f) //切りの悪いところでリセットが掛かった場合のみにする
  8736. {
  8737. boMotionChanged = true; //アニメリセット時(同一コマンド選択など)
  8738. debugPrintConsole("masterモーション変更あり " + anim + " " + anim_state.Value + " / " + last_anitime);
  8739. }
  8740. }
  8741. last_anitime = anim_state.Value;
  8742. return ytg_bOrg;
  8743. }
  8744. //実際にプレイ中のモーション名を取得する
  8745. string m_LastGetMotion = "";
  8746. static readonly KeyValuePair<string, float> errFNwithTime = new KeyValuePair<string, float>("", 0);
  8747. public KeyValuePair<string, float> GetPlayingFN_withTime(TBody body0)
  8748. {
  8749. Animation anim = body0.m_Bones.GetComponent<Animation>();
  8750. if (!anim.isPlaying)
  8751. return errFNwithTime; //モーション停止中
  8752. //LastAnimeFNの再生中チェック
  8753. if (anim.IsPlaying(body0.LastAnimeFN))
  8754. return new KeyValuePair<string, float>(body0.LastAnimeFN, anim[body0.LastAnimeFN].normalizedTime/*.normalizedTime*/); //再生中なら
  8755. //debugPrintConsole("LastAnimeFNは再生待ち " + maid.body0.LastAnimeFN);
  8756. if (!anim.IsPlaying(m_LastGetMotion))
  8757. {
  8758. string LastOnceFN = null, LastLoopFN = null;
  8759. m_LastGetMotion = "";
  8760. WrapMode CurMode = WrapMode.Default;
  8761. foreach (AnimationState state in anim)
  8762. {
  8763. if (state.enabled) //再生中の物のみチェック
  8764. {
  8765. CurMode = state.wrapMode; //最後の値が残る
  8766. if (CurMode == WrapMode.Once)
  8767. LastOnceFN = state.name;
  8768. if (CurMode == WrapMode.Loop)
  8769. LastLoopFN = state.name;
  8770. }
  8771. }
  8772. if (CurMode == WrapMode.Once)
  8773. {
  8774. //ループなしアニメの場合の処理
  8775. m_LastGetMotion = LastOnceFN;
  8776. }
  8777. else
  8778. {
  8779. //ループありアニメの場合の処理
  8780. m_LastGetMotion = LastLoopFN;
  8781. }
  8782. }
  8783. return new KeyValuePair<string, float>(m_LastGetMotion, anim[m_LastGetMotion].normalizedTime/*.normalizedTime*/);
  8784. }
  8785. }
  8786. }
  8787. public class OneScene : MonoBehaviour
  8788. {
  8789. private void OnDestroy()
  8790. {
  8791. Console.WriteLine("One Scene OnDestroy");
  8792. }
  8793. }
  8794. }
  8795. namespace ExtensionMethods
  8796. {
  8797. public static class ComExt
  8798. {
  8799. #if COM3D2
  8800. public static bool IsCom3d2 { get { return true; } }
  8801. public class XtTMorph
  8802. {
  8803. public TMorph morph;
  8804. FieldInfo fiBlendValues = typeof(TMorph).GetField("BlendValues", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
  8805. public XtTMorph(TMorph tm)
  8806. {
  8807. morph = tm;
  8808. BlendValues = fiBlendValues.GetValue(tm) as float[];
  8809. }
  8810. public System.Collections.Hashtable hash
  8811. {
  8812. get { return morph.hash; }
  8813. }
  8814. public float[] BlendValues;
  8815. public static implicit operator XtTMorph(TMorph tm)
  8816. {
  8817. return new XtTMorph(tm);
  8818. }
  8819. }
  8820. public static XtTMorph XtMorph(this TBodySkin tbs)
  8821. {
  8822. return new XtTMorph(tbs.morph);
  8823. }
  8824. public static void GetAttachPoint(this TMorph tm, string apname, out Vector3 vWorldPos, out Quaternion qWorldRot)
  8825. {
  8826. tm.GetAttachPoint(apname, out vWorldPos, out qWorldRot, out Vector3 dummy_Scale, false);
  8827. }
  8828. public class XtMaidParam
  8829. {
  8830. public XtMaidStatus status;
  8831. public XtMaidParam(Maid m)
  8832. {
  8833. status = new XtMaidStatus(m);
  8834. }
  8835. }
  8836. public class XtMaidStatus
  8837. {
  8838. public Maid maid;
  8839. MaidStatus.Status s_;
  8840. public XtMaidStatus(Maid m)
  8841. {
  8842. maid = m;
  8843. s_ = maid.status;
  8844. }
  8845. public string last_name
  8846. {
  8847. get { return s_.lastName; }
  8848. }
  8849. public string first_name
  8850. {
  8851. get { return s_.firstName; }
  8852. }
  8853. public int cur_excite
  8854. {
  8855. get { return s_.currentExcite; }
  8856. }
  8857. public string personal
  8858. {
  8859. get { return s_.personal.uniqueName; }
  8860. }
  8861. }
  8862. public static XtMaidParam XtParam(this Maid m)
  8863. {
  8864. return new XtMaidParam(m);
  8865. }
  8866. #else
  8867. public static bool IsCom3d2 { get { return false; } }
  8868. public class XtTMorph
  8869. {
  8870. public TMorph morph;
  8871. public XtTMorph(TMorph tm)
  8872. {
  8873. morph = tm;
  8874. }
  8875. public System.Collections.Hashtable hash
  8876. {
  8877. get { return morph.hash; }
  8878. }
  8879. public float[] BlendValues
  8880. {
  8881. get { return morph.BlendValues; }
  8882. }
  8883. public static implicit operator XtTMorph(TMorph tm)
  8884. {
  8885. return new XtTMorph(tm);
  8886. }
  8887. }
  8888. public static XtTMorph XtMorph(this TBodySkin tbs)
  8889. {
  8890. return new XtTMorph(tbs.morph);
  8891. }
  8892. public static MaidParam XtParam(this Maid m)
  8893. {
  8894. return m.Param;
  8895. }
  8896. #endif
  8897. }
  8898. public static class MyExtensions
  8899. {
  8900. static Dictionary<string, string> dicIkL = new Dictionary<string, string>
  8901. {
  8902. { "HandTgt", "tgtHandL" },
  8903. { "TgtMaid", "tgtMaidL" },
  8904. { "Tgt_AttachSlot", "tgtHandL_AttachSlot" },
  8905. { "Tgt_AttachName", "tgtHandL_AttachName" },
  8906. { "TgtOffset", "tgtHandL_offset" },
  8907. };
  8908. static Dictionary<string, string> dicIkR = new Dictionary<string, string>
  8909. {
  8910. { "HandTgt", "tgtHandR" },
  8911. { "TgtMaid", "tgtMaidR" },
  8912. { "Tgt_AttachSlot", "tgtHandR_AttachSlot" },
  8913. { "Tgt_AttachName", "tgtHandR_AttachName" },
  8914. { "TgtOffset", "tgtHandR_offset" },
  8915. };
  8916. static Dictionary<string, Type> dicType = new Dictionary<string, Type>
  8917. {
  8918. { "HandTgt", typeof(Transform) },
  8919. { "TgtMaid", typeof(Maid) },
  8920. { "Tgt_AttachSlot", typeof(int) },
  8921. { "Tgt_AttachName", typeof(string) },
  8922. { "TgtOffset", typeof(Vector3) },
  8923. };
  8924. class FiHand
  8925. {
  8926. public FieldInfo fiTgt, fiMaid, fiAslot, fiAname, fiOffset;
  8927. }
  8928. static FiHand _handL = new FiHand();
  8929. static FiHand _handR = new FiHand();
  8930. static FiHand _handNew = new FiHand();
  8931. static FieldInfo fiPointL;
  8932. static FieldInfo fiPointR;
  8933. static bool NeedInit = true;
  8934. static bool boLegacy = false;
  8935. public static void IKTargetClear(this Maid m)
  8936. {
  8937. if (IkXT.IsNewIK)
  8938. {
  8939. IkXT.IkClear(m, null);
  8940. return; // v3.2 fix
  8941. }
  8942. else
  8943. {
  8944. IKTargetClearOld(m);
  8945. }
  8946. }
  8947. static void IKTargetClearOld(this Maid m)
  8948. {
  8949. m.IKTargetToAttachPoint("左手", null, "body", string.Empty, Vector3.zero);
  8950. m.IKTargetToAttachPoint("右手", null, "body", string.Empty, Vector3.zero);
  8951. }
  8952. static Assembly LoadIkDll(string dllname)
  8953. {
  8954. // Sybarisのバージョンによってリダイレクトが変わるのでいくつか試す…
  8955. Console.WriteLine("XtMS: Loading... " + dllname);
  8956. //var asm = Assembly.Load("CM3D2.XtMasterSlave.IK159");
  8957. Assembly asm = null;
  8958. var dll = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + @"\" + dllname;
  8959. //Console.WriteLine(dll);
  8960. //if (!File.Exists(dll))すら欺かれる…?
  8961. try
  8962. {
  8963. asm = Assembly.LoadFile(dll);
  8964. }
  8965. catch
  8966. {
  8967. }
  8968. if (asm == null)
  8969. {
  8970. dll = Path.GetFullPath(@".") + @"\Sybaris\Plugins\UnityInjector\" + dllname;
  8971. Console.WriteLine(dll);
  8972. try
  8973. {
  8974. asm = Assembly.LoadFile(dll);
  8975. }
  8976. catch
  8977. {
  8978. }
  8979. }
  8980. if (asm == null)
  8981. {
  8982. dll = Directory.GetCurrentDirectory() + @"\Sybaris\Plugins\UnityInjector\" + dllname;
  8983. Console.WriteLine(dll);
  8984. try
  8985. {
  8986. asm = Assembly.LoadFile(dll);
  8987. }
  8988. catch
  8989. {
  8990. }
  8991. }
  8992. if (asm == null)
  8993. {
  8994. dll = Path.GetDirectoryName(typeof(IkXT).Module.Assembly.Location) + @"\" + dllname;
  8995. //Console.WriteLine(dll);
  8996. asm = Assembly.LoadFile(dll);
  8997. }
  8998. return asm;
  8999. }
  9000. // 1.55以降用
  9001. public class IkXT
  9002. {
  9003. public static IkInst _inst;
  9004. // cm3d2 1.59~
  9005. public static Type _typIKM159 = Assembly.Load("Assembly-CSharp").GetType("IKMgrData");
  9006. public static bool IsIkMgr159 { get { return _typIKM159 != null; } }
  9007. // com3d2 1.17~
  9008. public static Type _typIKO117 = Assembly.Load("Assembly-CSharp").GetType("IKCtrlData");
  9009. public static bool IsIkCtrlO117 { get { return _typIKO117 != null; } }
  9010. // com3d2 1.18~
  9011. public static Type _typFLIK = Assembly.Load("Assembly-CSharp").GetType("FullBodyIKCtrl");
  9012. //public static MethodInfo _methIKG118 = Assembly.Load("Assembly-CSharp").GetType("FullBodyIKCtrl")
  9013. // .GetMethod("GetIKData", BindingFlags.Instance | BindingFlags.Public ,null, new Type[] { typeof(string), typeof(bool) }, null);
  9014. public static bool IsIkCtrlO118 {
  9015. get {
  9016. if (_typFLIK != null)
  9017. {
  9018. var m = _typFLIK.GetMethod("GetIKData", BindingFlags.Instance | BindingFlags.Public, null, new Type[] { typeof(string), typeof(bool) }, null);
  9019. return m != null;
  9020. }
  9021. return false;
  9022. } }
  9023. // com3d2 1.32~
  9024. public static Type _typIKO132 = Assembly.Load("Assembly-CSharp").GetType("IKCtrlData")?.GetNestedType("IKSettingData");
  9025. public static bool IsIkCtrlO132 { get { return _typIKO132 != null; } }
  9026. public static bool IsNewIK { get { return IsIkCtrlO117 || IsIkMgr159; } }
  9027. static IkXT()
  9028. {
  9029. #if false//COM3D2 //com117以降で無理に
  9030. _inst = new XtMasterSlave_IK159.Ik159Inst();
  9031. #else
  9032. if (IsIkCtrlO117)
  9033. {
  9034. if (IsIkCtrlO132)
  9035. {
  9036. Console.WriteLine("XtMS: 新IKモードで動作開始(IKCtrl v1.32)");
  9037. #if COM3D2only
  9038. Assembly asm = LoadIkDll("COM3D2.XtMasterSlave.IKO132.xdll");
  9039. #else
  9040. Assembly asm = LoadIkDll("CM3D2.XtMasterSlave.IKO132.xdll");
  9041. #endif
  9042. var type = asm.GetType("XtMasterSlave_IK_XDLL.IkpInst");
  9043. _inst = Activator.CreateInstance(type) as IkInst;
  9044. }
  9045. else if (IsIkCtrlO118)
  9046. {
  9047. Console.WriteLine("XtMS: 新IKモードで動作開始(IKCtrl v1.18)");
  9048. #if COM3D2only
  9049. Assembly asm = LoadIkDll("COM3D2.XtMasterSlave.IKO118.xdll");
  9050. #else
  9051. Assembly asm = LoadIkDll("CM3D2.XtMasterSlave.IKO118.xdll");
  9052. #endif
  9053. var type = asm.GetType("XtMasterSlave_IK_XDLL.IkpInst");
  9054. _inst = Activator.CreateInstance(type) as IkInst;
  9055. }
  9056. else
  9057. {
  9058. Console.WriteLine("XtMS: 新IKモードで動作開始(IKCtrl v1.17)");
  9059. #if COM3D2only
  9060. Assembly asm = LoadIkDll("COM3D2.XtMasterSlave.IKO117.xdll");
  9061. #else
  9062. Assembly asm = LoadIkDll("CM3D2.XtMasterSlave.IKO117.xdll");
  9063. #endif
  9064. var type = asm.GetType("XtMasterSlave_IKO117.Iko117Inst");
  9065. _inst = Activator.CreateInstance(type) as IkInst;
  9066. }
  9067. }
  9068. else if (IsIkMgr159)
  9069. {
  9070. Console.WriteLine("XtMS: 新IKモードで動作開始(IKMgr v1.59)");
  9071. //var asm = Assembly.Load("CM3D2.XtMasterSlave.IK159");
  9072. #if COM3D2
  9073. Assembly asm = LoadIkDll("COM3D2.XtMasterSlave.IK159.xdll");
  9074. #else
  9075. Assembly asm = LoadIkDll("CM3D2.XtMasterSlave.IK159.xdll");
  9076. #endif
  9077. var type = asm.GetType("XtMasterSlave_IK159.Ik159Inst");
  9078. _inst = Activator.CreateInstance(type) as IkInst;
  9079. }
  9080. else
  9081. {
  9082. Console.WriteLine("XtMS: 旧IKモードで動作開始(IKMgr v1.59未満)");
  9083. _inst = new IkInst();
  9084. }
  9085. #endif
  9086. }
  9087. public static bool IsNewPointIK(Maid m, string hand = "右手")
  9088. {
  9089. if (IsNewIK)
  9090. return _inst.IsNewPointIK(m, hand);
  9091. return false;
  9092. }
  9093. public static object GetIkPoint(TBody body, string hand = "右手")
  9094. {
  9095. if (IsNewIK)
  9096. return _inst.GetIkPoint(body, hand);
  9097. return null;
  9098. }
  9099. public static void IkClear(Maid tgt, XtMasterSlave.MsLinkConfig mscfg)
  9100. {
  9101. List<string> listHand = new List<string> { "右手", "左手" };
  9102. IkClear(tgt, listHand, mscfg);
  9103. }
  9104. public static void IkClear(Maid tgt, List<string> listHand, XtMasterSlave.MsLinkConfig mscfg)
  9105. {
  9106. if (IsNewIK)
  9107. _inst.IkClear(tgt, listHand, mscfg);
  9108. }
  9109. public static void CopyHandIK(Maid master, Maid slave, XtMasterSlave.v3Offsets[] v3ofs, int num_)
  9110. {
  9111. if (IsNewIK)
  9112. _inst.CopyHandIK(master, slave, v3ofs, num_);
  9113. }
  9114. public static void SetHandIKRotate(string handName, Maid master, Maid slave, string boneTgtname, Vector3 v3HandLOffsetRot)
  9115. {
  9116. if (IsNewIK)
  9117. _inst.SetHandIKRotate(handName, master, slave, boneTgtname, v3HandLOffsetRot);
  9118. }
  9119. public static void SetHandIKTarget(XtMasterSlave.MsLinkConfig mscfg, string handName, Maid master, Maid slave, int slot_no, string attach_name, Transform target, Vector3 v3HandLOffset)
  9120. {
  9121. if (IsNewIK)
  9122. _inst.SetHandIKTarget(mscfg, handName, master, slave, slot_no, attach_name, target, v3HandLOffset);
  9123. }
  9124. public static object GetIKCmo(TBody body, string hand = "右手")
  9125. {
  9126. return _inst.GetIKCmo(body, hand);
  9127. }
  9128. }
  9129. public class IkInst
  9130. {
  9131. public virtual bool IsNewPointIK(Maid m, string hand = "右手")
  9132. {
  9133. return false;
  9134. }
  9135. public virtual object GetIkPoint(TBody body, string hand = "右手")
  9136. {
  9137. return null;
  9138. }
  9139. public virtual object GetIkCtrl(Maid maid)
  9140. {
  9141. return null;
  9142. }
  9143. public virtual object GetIkCtrlPoint(TBody body, string hand = "右手")
  9144. {
  9145. return null;
  9146. }
  9147. public virtual void IkClear(Maid tgt, XtMasterSlave.MsLinkConfig mscfg)
  9148. {
  9149. }
  9150. public virtual void IkClear(Maid tgt, List<string> listHand, XtMasterSlave.MsLinkConfig mscfg, int IkType = (-1))
  9151. {
  9152. }
  9153. public virtual void CopyHandIK(Maid master, Maid slave, XtMasterSlave.v3Offsets[] v3ofs, int num_)
  9154. {
  9155. }
  9156. public virtual void SetHandIKRotate(string handName, Maid master, Maid slave, string boneTgtname, Vector3 v3HandLOffsetRot)
  9157. {
  9158. }
  9159. public virtual object GetIKCmo(TBody body, string hand = "右手")
  9160. {
  9161. return null;
  9162. }
  9163. public virtual void SetHandIKTarget(XtMasterSlave.MsLinkConfig mscfg, string handName, Maid master, Maid slave, int slot_no, string attach_name, Transform target, Vector3 v3HandLOffset)
  9164. {
  9165. }
  9166. public virtual bool IKUpdate(TBody body)
  9167. {
  9168. return false; // 実行できたか
  9169. }
  9170. public virtual bool GetIKCmoPosRot(TBody body, out Vector3 pos, out Quaternion rot, string hand = "右手")
  9171. {
  9172. pos = Vector3.zero;
  9173. rot = Quaternion.identity;
  9174. return false;
  9175. }
  9176. public virtual bool IKCmoUpdate(TBody body, Transform trh, Vector3 offset, string hand = "右手")
  9177. {
  9178. return false;
  9179. }
  9180. public virtual bool UpdateFinalIK(Maid maid, XtMasterSlave.MsLinks ms, XtMasterSlave.MsLinkConfig mscfg)
  9181. {
  9182. return false; // 実行できたか
  9183. }
  9184. }
  9185. static void SetFI()
  9186. {
  9187. fiPointL = typeof(TBody).GetField("IkPointL", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9188. fiPointR = typeof(TBody).GetField("IkPointR", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9189. if (IkXT.IsIkCtrlO132)
  9190. {
  9191. Console.WriteLine("XtMS: COM3D2 Ver1.32以降相当のIKを検出");
  9192. Type typ132 = IkXT._typIKO132.DeclaringType.GetNestedType("IKTargetData");
  9193. _handNew.fiTgt = typ132.GetField("Target", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9194. _handNew.fiMaid = typ132.GetField("TgtChara", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9195. _handNew.fiAslot = typ132.GetField("Tgt_AttachSlot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9196. _handNew.fiAname = typ132.GetField("Tgt_AttachName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9197. _handNew.fiOffset = typ132.GetField("TgtOffset", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9198. }
  9199. else if (IkXT.IsIkCtrlO117)
  9200. {
  9201. Console.WriteLine("XtMS: COM3D2 Ver1.17以降相当のIKを検出");
  9202. Type typL = IkXT._typIKO117.GetNestedType("IKParam", BindingFlags.Public);
  9203. _handNew.fiTgt = typL.GetField("Target", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9204. _handNew.fiMaid = typL.GetField("TgtMaid", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9205. _handNew.fiAslot = typL.GetField("Tgt_AttachSlot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9206. _handNew.fiAname = typL.GetField("Tgt_AttachName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9207. _handNew.fiOffset = typL.GetField("TgtOffset", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9208. }
  9209. else if (IkXT.IsIkMgr159)
  9210. {
  9211. Console.WriteLine("XtMS: CM3D2 Ver1.59以降相当のIKを検出");
  9212. Type typL = IkXT._typIKM159.GetNestedType("IKParam", BindingFlags.Public);
  9213. _handNew.fiTgt = typL.GetField("Target", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9214. _handNew.fiMaid = typL.GetField("TgtMaid", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9215. _handNew.fiAslot = typL.GetField("Tgt_AttachSlot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9216. _handNew.fiAname = typL.GetField("Tgt_AttachName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9217. _handNew.fiOffset = typL.GetField("TgtOffset", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9218. }
  9219. else if (fiPointL == null && fiPointR == null)
  9220. {
  9221. Console.WriteLine("XtMS: CM3D2 Ver1.54以前互換モード");
  9222. boLegacy = true;
  9223. _handR.fiTgt = typeof(TBody).GetField("tgtHandR", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9224. _handR.fiMaid = typeof(TBody).GetField("tgtMaidR", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9225. _handR.fiAslot = typeof(TBody).GetField("tgtHandR_AttachSlot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9226. _handR.fiAname = typeof(TBody).GetField("tgtHandR_AttachName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9227. _handR.fiOffset = typeof(TBody).GetField("tgtHandR_offset", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9228. _handL.fiTgt = typeof(TBody).GetField("tgtHandL", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9229. _handL.fiMaid = typeof(TBody).GetField("tgtMaidL", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9230. _handL.fiAslot = typeof(TBody).GetField("tgtHandL_AttachSlot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9231. _handL.fiAname = typeof(TBody).GetField("tgtHandL_AttachName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9232. _handL.fiOffset = typeof(TBody).GetField("tgtHandL_offset", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9233. }
  9234. else
  9235. {
  9236. Console.WriteLine("XtMS: CM3D2 Ver1.55以降を検出");
  9237. Type typL = typeof(TBody).GetNestedType("IKParamData", BindingFlags.Public);
  9238. _handNew.fiTgt = typL.GetField("HandTgt", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9239. _handNew.fiMaid = typL.GetField("TgtMaid", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9240. _handNew.fiAslot = typL.GetField("Tgt_AttachSlot", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9241. _handNew.fiAname = typL.GetField("Tgt_AttachName", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9242. _handNew.fiOffset = typL.GetField("TgtOffset", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  9243. }
  9244. }
  9245. public class SetIK
  9246. {
  9247. TBody body;
  9248. object objL;
  9249. object objR;
  9250. FiHand fiR, fiL;
  9251. public Transform tgtHandR
  9252. {
  9253. get
  9254. {
  9255. return (Transform)fiR.fiTgt.GetValue(objR);
  9256. }
  9257. set
  9258. {
  9259. fiR.fiTgt.SetValue(objR, value);
  9260. }
  9261. }
  9262. public Transform tgtHandL
  9263. {
  9264. get
  9265. {
  9266. return (Transform)fiL.fiTgt.GetValue(objL);
  9267. }
  9268. set
  9269. {
  9270. fiL.fiTgt.SetValue(objL, value);
  9271. }
  9272. }
  9273. public Maid tgtMaidR
  9274. {
  9275. get
  9276. {
  9277. return fiR.fiMaid.GetValue(objR) as Maid;
  9278. }
  9279. set
  9280. {
  9281. fiR.fiMaid.SetValue(objR, value);
  9282. }
  9283. }
  9284. public Maid tgtMaidL
  9285. {
  9286. get
  9287. {
  9288. return fiL.fiMaid.GetValue(objL) as Maid;
  9289. }
  9290. set
  9291. {
  9292. fiL.fiMaid.SetValue(objL, value);
  9293. }
  9294. }
  9295. public Vector3 tgtHandR_offset
  9296. {
  9297. get
  9298. {
  9299. return (Vector3)fiR.fiOffset.GetValue(objR);
  9300. }
  9301. set
  9302. {
  9303. fiR.fiOffset.SetValue(objR, value);
  9304. }
  9305. }
  9306. public Vector3 tgtHandL_offset
  9307. {
  9308. get
  9309. {
  9310. return (Vector3)fiL.fiOffset.GetValue(objL);
  9311. }
  9312. set
  9313. {
  9314. fiL.fiOffset.SetValue(objL, value);
  9315. }
  9316. }
  9317. public int tgtHandR_AttachSlot
  9318. {
  9319. get
  9320. {
  9321. return (int)fiR.fiAslot.GetValue(objR);
  9322. }
  9323. set
  9324. {
  9325. fiR.fiAslot.SetValue(objR, value);
  9326. }
  9327. }
  9328. public int tgtHandL_AttachSlot
  9329. {
  9330. get
  9331. {
  9332. return (int)fiL.fiAslot.GetValue(objL);
  9333. }
  9334. set
  9335. {
  9336. fiL.fiAslot.SetValue(objL, value);
  9337. }
  9338. }
  9339. public string tgtHandR_AttachName
  9340. {
  9341. get
  9342. {
  9343. return fiR.fiAname.GetValue(objR) as string;
  9344. }
  9345. set
  9346. {
  9347. fiR.fiAname.SetValue(objR, value);
  9348. }
  9349. }
  9350. public string tgtHandL_AttachName
  9351. {
  9352. get
  9353. {
  9354. return fiL.fiAname.GetValue(objL) as string;
  9355. }
  9356. set
  9357. {
  9358. fiL.fiAname.SetValue(objL, value);
  9359. }
  9360. }
  9361. void Init()
  9362. {
  9363. if (NeedInit)
  9364. {
  9365. SetFI();
  9366. NeedInit = false;
  9367. }
  9368. if (IkXT.IsIkMgr159 || IkXT.IsIkCtrlO117)
  9369. {
  9370. /*
  9371. objR = body.StrIKDataPair["右手"].GetIKParam(IKMgrData.IKAttachType.Point);
  9372. if (objR == null)
  9373. objR = body.StrIKDataPair["右手"].GetIKParam(IKMgrData.IKAttachType.NewPoint);
  9374. objL = body.StrIKDataPair["左手"].GetIKParam(IKMgrData.IKAttachType.Point);
  9375. if (objL==null)
  9376. objL = body.StrIKDataPair["左手"].GetIKParam(IKMgrData.IKAttachType.NewPoint);
  9377. */
  9378. objR = IkXT.GetIkPoint(body, "右手");
  9379. objL = IkXT.GetIkPoint(body, "左手");
  9380. if (IkXT.IsIkCtrlO132)
  9381. {
  9382. var prop = IkXT._typIKO132.GetProperty("curTargetData");
  9383. objR = prop.GetValue(objR, null);
  9384. objL = prop.GetValue(objL, null);
  9385. }
  9386. fiR = _handNew;
  9387. fiL = _handNew;
  9388. }
  9389. else if (boLegacy)
  9390. {
  9391. objR = body;
  9392. objL = body;
  9393. fiR = _handR;
  9394. fiL = _handL;
  9395. }
  9396. else
  9397. {
  9398. objR = fiPointR.GetValue(body);
  9399. objL = fiPointL.GetValue(body);
  9400. fiR = _handNew;
  9401. fiL = _handNew;
  9402. }
  9403. }
  9404. public SetIK(TBody body)
  9405. {
  9406. this.body = body;
  9407. Init();
  9408. }
  9409. }
  9410. // フレーム内キャッシュ (フレーム内の参照回数が少なければ不要)
  9411. static Dictionary<TBody, SetIK> dicIKset = new Dictionary<TBody, SetIK>();
  9412. static int FrameCnt = 0;
  9413. /// <summary>
  9414. /// Maid.body0.tgtHandR/L→Maid.body0._ikp().tgtHandR/Lとするだけで~1.54/1.55両対応できる拡張メソッド
  9415. /// </summary>
  9416. /// <param name="body"> Maid.body0 </param>
  9417. /// <returns></returns>
  9418. public static SetIK _ikp(this TBody body)
  9419. {
  9420. if (UnityEngine.Time.frameCount != FrameCnt)
  9421. {
  9422. dicIKset.Clear(); // 毎フレームクリア
  9423. FrameCnt = Time.frameCount;
  9424. }
  9425. else if (dicIKset.TryGetValue(body, out SetIK val))
  9426. {
  9427. return val; // キャッシュを返す
  9428. }
  9429. var set = new SetIK(body);
  9430. dicIKset.Add(body, set);
  9431. return set;
  9432. }
  9433. class IKM
  9434. {
  9435. public TBody.IKCMO m_IkMgrR;
  9436. public TBody.IKCMO m_IkMgrL;
  9437. public IKM(TBody.IKCMO m_IkMgrR, TBody.IKCMO m_IkMgrL)
  9438. {
  9439. this.m_IkMgrR = m_IkMgrR;
  9440. this.m_IkMgrL = m_IkMgrL;
  9441. }
  9442. }
  9443. // 1.55以降用 ネストが深いのでキャッシュする
  9444. static Type typeIKP = typeof(TBody).GetNestedType("IKParamData");
  9445. static FieldInfo fim_IkMgr = typeIKP != null ? typeIKP.GetField("m_IkMgr", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly) : null;
  9446. static FieldInfo fiIkpointR = typeof(TBody).GetField("IkPointR", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
  9447. static FieldInfo fiIkpointL = typeof(TBody).GetField("IkPointL", BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly);
  9448. static FieldInfo fiVechand = typeof(TBody.IKCMO).GetField("vechand", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
  9449. static FieldInfo fiKnee_old = typeof(TBody.IKCMO).GetField("knee_old", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly);
  9450. public static void owIkParam(this TBody tb, bool boR, Vector3 vechand, Vector3 knee_old)
  9451. {
  9452. object ikm;
  9453. if (typeIKP != null)
  9454. {
  9455. var objL = boR ? fiIkpointR.GetValue(tb) : fiIkpointL.GetValue(tb);
  9456. //if (objL != null)
  9457. {
  9458. ikm = fim_IkMgr.GetValue(objL);
  9459. }
  9460. }
  9461. else
  9462. {
  9463. if (boR)
  9464. ikm = typeof(TBody).InvokeMember("ikRightArm", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly, null, tb, null);
  9465. else
  9466. ikm = typeof(TBody).InvokeMember("ikLeftArm", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly, null, tb, null);
  9467. }
  9468. fiVechand.SetValue(ikm, vechand);
  9469. fiKnee_old.SetValue(ikm, knee_old);
  9470. }
  9471. public static void setR_vechand(this TBody tb, Vector3 v3)
  9472. {
  9473. if (IkXT.IsIkMgr159 || IkXT.IsIkCtrlO117)
  9474. {
  9475. //fiVechand.SetValue(tb.IKHandR.IKCmo, v3);
  9476. fiVechand.SetValue(IkXT.GetIKCmo(tb, "右手"), v3);
  9477. return;
  9478. }
  9479. object ikm;
  9480. if (typeIKP != null)
  9481. {
  9482. var objL = fiIkpointR.GetValue(tb);
  9483. //if (objL != null)
  9484. {
  9485. ikm = fim_IkMgr.GetValue(objL);
  9486. }
  9487. }
  9488. else
  9489. ikm = typeof(TBody).InvokeMember("ikRightArm", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly, null, tb, null);
  9490. fiVechand.SetValue(ikm, v3);
  9491. }
  9492. public static void setL_vechand(this TBody tb, Vector3 v3)
  9493. {
  9494. if (IkXT.IsIkMgr159 || IkXT.IsIkCtrlO117)
  9495. {
  9496. //fiVechand.SetValue(tb.IKHandL.IKCmo, v3);
  9497. fiVechand.SetValue(IkXT.GetIKCmo(tb, "左手"), v3);
  9498. return;
  9499. }
  9500. object ikm;
  9501. if (typeIKP != null)
  9502. {
  9503. var objL = fiIkpointL.GetValue(tb);
  9504. //if (objL != null)
  9505. {
  9506. ikm = fim_IkMgr.GetValue(objL);
  9507. }
  9508. }
  9509. else
  9510. ikm = typeof(TBody).InvokeMember("ikLeftArm", BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly, null, tb, null);
  9511. fiVechand.SetValue(ikm, v3);
  9512. }
  9513. static MethodInfo miIkcmoProc1 = typeof(TBody.IKCMO).GetMethod("Proc", BindingFlags.Public | BindingFlags.Instance, null,
  9514. new Type[] { typeof(Transform), typeof(Transform), typeof(Transform), typeof(Vector3), typeof(Vector3) }, null);
  9515. static MethodInfo miIkcmoProc = typeof(TBody.IKCMO).GetMethod("Proc", BindingFlags.Public | BindingFlags.Instance);
  9516. public static void IKCmoProc(this TBody body, bool handRight, Transform bone, Vector3 tgt, Vector3 offset)
  9517. {
  9518. var cmo = IkXT.GetIKCmo(body, handRight ? "右手" : "左手");
  9519. var ikctrl = IkXT.GetIkPoint(body, handRight ? "右手" : "左手");
  9520. switch (miIkcmoProc.GetParameters().Length)
  9521. {
  9522. case 5:
  9523. miIkcmoProc.Invoke(cmo, new object[] { bone.parent.parent, bone.parent, bone, tgt, offset });
  9524. break;
  9525. case 6:
  9526. miIkcmoProc.Invoke(cmo, new object[] { bone.parent.parent, bone.parent, bone, tgt, offset, ikctrl});
  9527. break;
  9528. }
  9529. }
  9530. public static void InvokeNonPublicMethod(this object obj, string name, object[] values)
  9531. {
  9532. obj.GetType().GetMethod(name, BindingFlags.Instance | BindingFlags.NonPublic).Invoke(obj, values);
  9533. }
  9534. }
  9535. }
  9536. namespace BoneLink
  9537. {
  9538. public class BoneLink
  9539. {
  9540. //メンバ変数
  9541. static int maxInstId = 0;
  9542. int linkId; //0~21を想定
  9543. Maid slave_last_ = null;
  9544. Maid stopmaid_last_ = null;
  9545. Maid stopman_last_ = null;
  9546. //bool bk_eAnimeMan = true, bk_eAnimeMaid = true;
  9547. FlgStop _flgStopped = FlgStop.none;
  9548. //メイド、ストップカウント(ビットフラグ)、オリジナル値
  9549. static Dictionary<Maid, StopAnimeState> stopAnimeMngr = new Dictionary<Maid, StopAnimeState>();
  9550. enum FlgStop
  9551. {
  9552. none,
  9553. maid2man,
  9554. man2maid,
  9555. }
  9556. class StopAnimeState
  9557. {
  9558. public int linkIdBits = 0;
  9559. public bool valBkup = true;
  9560. }
  9561. public BoneLink(int id)
  9562. {
  9563. linkId = id;
  9564. if (maxInstId < id)
  9565. maxInstId = id;
  9566. if (maxInstId > 21) //cm3d2 最大アクティブメイド登録数
  9567. {
  9568. //5程度のはず…
  9569. Console.WriteLine("BoneLinkのカウントが想定値を超えています :" + maxInstId);
  9570. }
  9571. }
  9572. public void Reset()
  9573. {
  9574. stopAnime(null, null, FlgStop.none);
  9575. slave_last_ = null;
  9576. stopmaid_last_ = null;
  9577. stopman_last_ = null;
  9578. if (linkId == maxInstId) //最後のリンクでクリア
  9579. stopAnimeMngr.Clear();
  9580. }
  9581. //linkIDは0~32まで指定可能(そこまで使わないけど)
  9582. void stopAnime(Maid maid, Maid man, FlgStop flg)
  9583. {
  9584. if (stopmaid_last_ != maid)
  9585. {
  9586. stopAnime(stopmaid_last_, false, linkId);
  9587. stopmaid_last_ = maid;
  9588. _flgStopped = FlgStop.none;
  9589. }
  9590. if (stopman_last_ != maid)
  9591. {
  9592. stopAnime(stopman_last_, false, linkId);
  9593. stopman_last_ = man;
  9594. _flgStopped = FlgStop.none;
  9595. }
  9596. if (!maid || !man)
  9597. return;
  9598. if (flg == _flgStopped)
  9599. return;
  9600. //モーション停止
  9601. switch (flg)
  9602. {
  9603. case FlgStop.maid2man:
  9604. stopAnime(man, true, linkId);
  9605. stopAnime(maid, false, linkId);
  9606. break;
  9607. case FlgStop.man2maid:
  9608. stopAnime(man, false, linkId);
  9609. stopAnime(maid, true, linkId);
  9610. break;
  9611. case FlgStop.none:
  9612. stopAnime(maid, false, linkId);
  9613. stopAnime(man, false, linkId);
  9614. break;
  9615. }
  9616. _flgStopped = flg;
  9617. }
  9618. static void stopAnime(Maid maid, bool stop, int linkId)
  9619. {
  9620. if (maid == null)
  9621. return;
  9622. if (stop)
  9623. stopAnime(maid, linkId);
  9624. else
  9625. restoreAnime(maid, linkId);
  9626. }
  9627. static bool stopAnime(Maid maid, int linkId)
  9628. {
  9629. bool needBkup = false;
  9630. if (!stopAnimeMngr.ContainsKey(maid))
  9631. {
  9632. stopAnimeMngr.Add(maid, new StopAnimeState());
  9633. }
  9634. if (stopAnimeMngr[maid].linkIdBits == 0)
  9635. {
  9636. needBkup = true;
  9637. }
  9638. //ID対応のビットをセットする
  9639. stopAnimeMngr[maid].linkIdBits |= (1 << linkId);
  9640. bool motion_stop = true;
  9641. bool old = true;
  9642. if (maid.body0.m_Bones != null && !string.IsNullOrEmpty(maid.body0.LastAnimeFN))
  9643. {
  9644. Animation animation = maid.body0.m_Bones.GetComponent<Animation>();
  9645. if (animation != null)
  9646. {
  9647. var anime_state = animation[maid.body0.LastAnimeFN.ToLower()];
  9648. if (anime_state != null && anime_state.length != 0f)
  9649. {
  9650. old = !anime_state.enabled;
  9651. if (motion_stop != !anime_state.enabled)
  9652. {
  9653. anime_state.enabled = !motion_stop;
  9654. }
  9655. }
  9656. else
  9657. {
  9658. //アニメ再生なし
  9659. old = true;
  9660. }
  9661. }
  9662. }
  9663. if (needBkup)
  9664. {
  9665. stopAnimeMngr[maid].valBkup = old;
  9666. }
  9667. return old;
  9668. }
  9669. //戻り値:成功ならtrue
  9670. static bool restoreAnime(Maid maid, int linkId)
  9671. {
  9672. bool motion_stop = false;
  9673. bool old = true;
  9674. if (!stopAnimeMngr.ContainsKey(maid))
  9675. return false;
  9676. //ID対応のビットを取り除く
  9677. stopAnimeMngr[maid].linkIdBits &= (~(1 << linkId));
  9678. if (stopAnimeMngr[maid].linkIdBits != 0)
  9679. return true; //残っていたら帰る
  9680. //else
  9681. {
  9682. //バックアップの取得
  9683. motion_stop = stopAnimeMngr[maid].valBkup;
  9684. stopAnimeMngr.Remove(maid); //登録解除
  9685. //呼ばれるタイミングが後処理のため一応チェック
  9686. if (!maid || !maid.body0)
  9687. return false;
  9688. }
  9689. if (maid.body0.m_Bones != null && !string.IsNullOrEmpty(maid.body0.LastAnimeFN))
  9690. {
  9691. Animation animation = maid.body0.m_Bones.GetComponent<Animation>();
  9692. if (animation != null)
  9693. {
  9694. var anime_state = animation[maid.body0.LastAnimeFN.ToLower()];
  9695. if (anime_state != null && anime_state.length != 0f)
  9696. {
  9697. old = !anime_state.enabled;
  9698. if (motion_stop != !anime_state.enabled)
  9699. {
  9700. anime_state.enabled = !motion_stop;
  9701. }
  9702. }
  9703. }
  9704. }
  9705. return true;
  9706. }
  9707. #if false//単一リンク時
  9708. static FlgStop _flgStopped = FlgStop.none;
  9709. static bool bk_eAnimeMan = true, bk_eAnimeMaid = true;
  9710. static void stopAnime(Maid maid, Maid man, FlgStop flg)
  9711. {
  9712. if (flg == _flgStopped)
  9713. return;
  9714. bool olds_maid = bk_eAnimeMaid, olds_man = bk_eAnimeMan;
  9715. //モーション停止
  9716. switch (flg)
  9717. {
  9718. case FlgStop.maid2man:
  9719. olds_man = stopAnime(man, true);
  9720. olds_maid = stopAnime(maid, false);
  9721. break;
  9722. case FlgStop.man2maid:
  9723. olds_man = stopAnime(man, false);
  9724. olds_maid = stopAnime(maid, true);
  9725. break;
  9726. case FlgStop.none:
  9727. stopAnime(maid, olds_maid);
  9728. stopAnime(man, olds_man);
  9729. break;
  9730. }
  9731. if (_flgStopped == FlgStop.none)
  9732. {
  9733. bk_eAnimeMaid = olds_maid;
  9734. bk_eAnimeMan = olds_man;
  9735. }
  9736. _flgStopped = flg;
  9737. }
  9738. static bool stopAnime(Maid maid, bool motion_stop)
  9739. {
  9740. bool old = true;
  9741. if (maid.body0.m_Bones != null && !string.IsNullOrEmpty(maid.body0.LastAnimeFN))
  9742. {
  9743. Animation animation = maid.body0.m_Bones.GetComponent<Animation>();
  9744. if (animation != null)
  9745. {
  9746. var anime_state = animation[maid.body0.LastAnimeFN.ToLower()];
  9747. if (anime_state != null && anime_state.length != 0f)
  9748. {
  9749. old = !anime_state.enabled;
  9750. if (motion_stop != !anime_state.enabled)
  9751. {
  9752. anime_state.enabled = !motion_stop;
  9753. }
  9754. }
  9755. }
  9756. }
  9757. return old;
  9758. }
  9759. #endif
  9760. public static void ClearCache()
  9761. {
  9762. SearchObjCache.Clear();
  9763. }
  9764. static Dictionary<Transform, Dictionary<string, Transform>> SearchObjCache = new Dictionary<Transform, Dictionary<string, Transform>>();
  9765. public static Transform SearchObjName(Transform t, string name, bool boSMPass)
  9766. {
  9767. Dictionary<string, Transform> cache;
  9768. Transform tout;
  9769. if (SearchObjCache.TryGetValue(t, out cache))
  9770. {
  9771. if (cache.TryGetValue(name, out tout))
  9772. {
  9773. return tout;
  9774. }
  9775. }
  9776. else
  9777. {
  9778. SearchObjCache.Add(t, new Dictionary<string, Transform>());
  9779. }
  9780. tout = CMT.SearchObjName(t, name, true);
  9781. SearchObjCache[t][name] = tout;
  9782. return tout;
  9783. }
  9784. //static Maid slave_last_ = null;
  9785. //public static void Try(Maid master, Maid slave, bool enabled, bool org_pelvis)
  9786. public void Try(Maid master, Maid slave, bool enabled, bool org_pelvis, bool org_clit, Vector3 v3StackOffset, XtMasterSlave.v3Offsets v3ofs, XtMasterSlave.MsLinkConfig mcfg)
  9787. {
  9788. if (!master || !slave)
  9789. return;
  9790. Transform gotr_mas = master.gameObject.transform;
  9791. Transform gotr_slv = slave.gameObject.transform;
  9792. if (slave_last_ != slave)
  9793. {
  9794. //スレイブが変更されたらフラグリセット
  9795. //ここではチェックしない _flgStopped = FlgStop.none;
  9796. }
  9797. Maid man = master;
  9798. Maid maid = slave;
  9799. if (!master.boMAN)
  9800. {
  9801. man = slave;
  9802. maid = master;
  9803. }
  9804. var dicMaidPose = new Dictionary<string, Quaternion>();
  9805. var dicManPose = new Dictionary<string, Quaternion>();
  9806. Transform maid_bone_tr = maid.body0.m_Bones.transform;
  9807. Transform man_bone_tr = man.body0.m_Bones.transform;
  9808. if (!enabled)
  9809. {
  9810. stopAnime(maid, man, FlgStop.none);
  9811. }
  9812. else if (!master.boMAN)
  9813. {
  9814. //if (_flgStopped != FlgStop.maid2man)
  9815. {
  9816. stopAnime(maid, man, FlgStop.maid2man);
  9817. }
  9818. foreach (var bone in Defines.data.MaidBones)
  9819. {
  9820. try
  9821. {
  9822. Quaternion q = SearchObjName(maid_bone_tr, bone, true).localRotation;
  9823. dicMaidPose[bone] = q;
  9824. }
  9825. catch (Exception e)
  9826. {
  9827. Console.WriteLine("PoseGetMaid: " + e);
  9828. }
  9829. }
  9830. dicManPose = maid2man(dicMaidPose);
  9831. foreach (var bone in Defines.data.ManBones)
  9832. {
  9833. try
  9834. {
  9835. Quaternion q;
  9836. float[] q0;
  9837. if (dicManPose.TryGetValue(bone, out q))
  9838. {
  9839. SearchObjName(man_bone_tr, bone, true).localRotation = q;//(q.x, q.y, q.z, q.w);
  9840. }
  9841. else if (ipData.dicManInitPose.TryGetValue(bone, out q0))
  9842. {
  9843. SearchObjName(man_bone_tr, bone, true).localRotation = new Quaternion(q0[0], q0[1], q0[2], q0[3]);//(q.x, q.y, q.z, q.w);
  9844. }
  9845. }
  9846. catch (Exception e)
  9847. {
  9848. Console.WriteLine("PoseInitMild: " + e);
  9849. }
  9850. }
  9851. //ボーン基準位置合わせ
  9852. try
  9853. {
  9854. Transform trManBip = SearchObjName(man_bone_tr, "ManBip", true);
  9855. Transform trBip01 = SearchObjName(maid_bone_tr, "Bip01", true);
  9856. trManBip.localPosition = trBip01.localPosition;
  9857. if (org_clit)
  9858. {
  9859. trManBip.position += (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_mas.position)
  9860. - (SearchObjName(man_bone_tr, "chinkoCenter", true).position - gotr_slv.position);
  9861. //trManBip.position += SearchObjName(man_bone_tr, "chinkoCenter", true).TransformDirection(v3StackOffset);
  9862. //trManBip.position += trBip01.TransformDirection(Quaternion.Inverse(Quaternion.Euler(0, -90, -90)) * v3StackOffset);
  9863. trManBip.position += trManBip.TransformDirection(v3StackOffset);
  9864. /*
  9865. if ( !maid.body0.goSlot[(int)TBody.SlotID.body].morph.GetAttachPoint("クリトリス", out Vector3 vout, out Quaternion qout) )
  9866. {
  9867. SearchObjName(man_bone_tr, "ManBip", true).position += (vout - gotr_mas.position)
  9868. - (SearchObjName(man_bone_tr, "chinko1", true).position - gotr_slv.position);
  9869. }*/
  9870. }
  9871. else if (org_pelvis)
  9872. {
  9873. trManBip.position += (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_mas.position)
  9874. - (SearchObjName(man_bone_tr, "ManBip Pelvis", true).position - gotr_slv.position);
  9875. //trManBip.position += SearchObjName(man_bone_tr, "ManBip Pelvis", true).TransformDirection(v3StackOffset);
  9876. //trManBip.localPosition += Quaternion.Inverse(Quaternion.Euler(0, -90, -90)) * v3StackOffset;
  9877. trManBip.position += trManBip.TransformDirection(v3StackOffset);
  9878. }
  9879. }
  9880. catch (Exception e)
  9881. {
  9882. Console.WriteLine("PoseInitMild2: " + e);
  9883. }
  9884. }
  9885. else
  9886. {
  9887. //if (_flgStopped != FlgStop.man2maid)
  9888. {
  9889. stopAnime(maid, man, FlgStop.man2maid);
  9890. }
  9891. foreach (var bone in Defines.data.ManBones)
  9892. {
  9893. try
  9894. {
  9895. Quaternion q = SearchObjName(man_bone_tr, bone, true).localRotation;
  9896. dicManPose[bone] = q;
  9897. }
  9898. catch (Exception e)
  9899. {
  9900. Console.WriteLine("PoseGetMan: " + e);
  9901. }
  9902. }
  9903. dicMaidPose = man2maid(dicManPose);
  9904. foreach (var bone in Defines.data.MaidBones)
  9905. {
  9906. try
  9907. {
  9908. if (bone == "Mune_R" || bone == "Mune_L") //胸ボーンbugfix v0011
  9909. continue;
  9910. /* test v5.0
  9911. if (mcfg.doIKTargetMHand && !mcfg.doIK159NewPointToDef && (bone.Contains("UpperArm") || bone.Contains("Forearm") || bone.Contains("Hand")))
  9912. continue;*/
  9913. #if DEBUG
  9914. /*// v5.0
  9915. if (Input.GetKey(KeyCode.Space) && mcfg.doIK159NewPointToDef && bone.Contains("Hand"))
  9916. continue;
  9917. if (Input.GetKey(KeyCode.LeftControl) && mcfg.doIK159NewPointToDef && (bone.Contains("UpperArm") || bone.Contains("Forearm") || bone.Contains("Hand")))
  9918. continue;*/
  9919. #endif
  9920. Quaternion q;
  9921. float[] q0;
  9922. if (dicMaidPose.TryGetValue(bone, out q))
  9923. {
  9924. SearchObjName(maid_bone_tr, bone, true).localRotation = q;//(q.x, q.y, q.z, q.w);
  9925. }
  9926. else if (ipData.dicMaidInitPose.TryGetValue(bone, out q0))
  9927. {
  9928. SearchObjName(maid_bone_tr, bone, true).localRotation = new Quaternion(q0[0], q0[1], q0[2], q0[3]);//(q.x, q.y, q.z, q.w);
  9929. }
  9930. }
  9931. catch (Exception e)
  9932. {
  9933. Console.WriteLine("PoseInitMild: " + e);
  9934. }
  9935. }
  9936. //ボーン基準位置合わせ
  9937. try
  9938. {
  9939. Transform trManBip = SearchObjName(man_bone_tr, "ManBip", true);
  9940. Transform trBip01 = SearchObjName(maid_bone_tr, "Bip01", true);
  9941. trBip01.localPosition = trManBip.localPosition;
  9942. //忘れてたので追加
  9943. Transform trHuta = SearchObjName(maid_bone_tr, "_IK_hutanari", true);
  9944. if (trHuta && dicMaidPose.TryGetValue("_IK_hutanari", out Quaternion q)) //chinko1rot
  9945. {
  9946. #if DEBUG
  9947. if (Input.GetKey(KeyCode.H))
  9948. {
  9949. Console.WriteLine("{0}, prt={1}, c={2}, {3}", trHuta.name, trHuta.parent.name, trHuta.childCount, trHuta.hideFlags);
  9950. Console.WriteLine("x{0}, y{1}, z{2}, {3}", trHuta.localPosition.x, trHuta.localPosition.y, trHuta.localPosition.z, trHuta.localRotation);
  9951. Console.WriteLine("x{0}, y{1}, z{2}, w{3}", trHuta.localRotation.x, trHuta.localRotation.y, trHuta.localRotation.z, trHuta.localRotation.w);
  9952. foreach (Transform t in trHuta)
  9953. {
  9954. Console.WriteLine("├{0}, prt={1}, c={2}, {3}", t.name, t.parent.name, t.childCount, t.hideFlags);
  9955. }
  9956. }
  9957. #endif
  9958. trHuta.localRotation = SearchObjName(man_bone_tr, "chinkoCenter", true).localRotation * q * Quaternion.Euler(-90, 0, 0);
  9959. }
  9960. /*位置変更
  9961. // v0025 手の角度調整
  9962. if (v3ofs.v3HandROffsetRot != Vector3.zero)
  9963. {
  9964. Transform trh = SearchObjName(maid_bone_tr, "Bip01 R Hand", true);
  9965. trh.localRotation *= Quaternion.Euler(v3ofs.v3HandROffsetRot);
  9966. }
  9967. if (v3ofs.v3HandLOffsetRot != Vector3.zero)
  9968. {
  9969. Transform trh = SearchObjName(maid_bone_tr, "Bip01 L Hand", true);
  9970. trh.localRotation *= Quaternion.Euler(v3ofs.v3HandLOffsetRot);
  9971. }*/
  9972. #if true // ボーンを追加(別のプラグインにする -> 5.0一応有効にしてみる
  9973. else
  9974. {
  9975. if (!trHuta)
  9976. {
  9977. // _IK_hutanariが無ければ追加
  9978. GameObject go = UnityEngine.Object.Instantiate(Resources.Load("seed")) as GameObject;
  9979. go.layer = 10;
  9980. go.name = "_IK_hutanari";
  9981. go.transform.SetParent(SearchObjName(maid_bone_tr, "Bip01 Pelvis", true));
  9982. go.transform.localPosition= new Vector3(0.02106727f, 0.04978831f, -1.620466E-07f);
  9983. go.transform.localRotation = new Quaternion(0.5323541f, -0.4653954f, -0.4654013f, 0.5323607f);
  9984. GameObject go2 = UnityEngine.Object.Instantiate(Resources.Load("seed")) as GameObject;
  9985. go2.transform.SetParent(SearchObjName(maid.body0.m_Bones2.transform, "Bip01 Pelvis", true));
  9986. go2.transform.localPosition = new Vector3(0.02106727f, 0.04978831f, -1.620466E-07f);
  9987. go2.transform.localRotation = new Quaternion(0.5323541f, -0.4653954f, -0.4654013f, 0.5323607f);
  9988. #if DEBUG
  9989. Console.WriteLine("不足ボーンを追加:{0}, prt={1}, c={2}, {3}", go.name, go.transform.parent.name, go.transform.childCount, go.transform.hideFlags);
  9990. #endif
  9991. // ボーンを追加したのでキャッシュを破棄
  9992. ClearCache();
  9993. }
  9994. }
  9995. #endif
  9996. if (org_clit)
  9997. {
  9998. trBip01.position += (SearchObjName(man_bone_tr, "chinkoCenter", true).position - gotr_mas.position)
  9999. - (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_slv.position);
  10000. //trBip01.position += SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).TransformDirection(v3StackOffset);
  10001. trBip01.position += trBip01.TransformDirection(v3StackOffset);
  10002. }
  10003. else if (org_pelvis)
  10004. {
  10005. #if DEBUG
  10006. //Console.WriteLine("{0}, {1}, {2}, {3}", SearchObjName(man_bone_tr, "ManBip Pelvis", true).position, gotr_mas.position,
  10007. // SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position, gotr_slv.position);
  10008. #endif
  10009. trBip01.position += (SearchObjName(man_bone_tr, "ManBip Pelvis", true).position - gotr_mas.position)
  10010. - (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_slv.position);
  10011. //trBip01.position += SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).TransformDirection(v3StackOffset);
  10012. trBip01.position += trBip01.TransformDirection(v3StackOffset);
  10013. }
  10014. }
  10015. catch (Exception e)
  10016. {
  10017. Console.WriteLine("PoseInitMild2: " + e);
  10018. }
  10019. }
  10020. }
  10021. // 位置のみリンク用 ボーンアタッチ座標計算
  10022. public static Vector3 TryPosSp(Maid master, Maid slave, bool enabled, bool org_pelvis, bool org_clit, bool PosSyncModeV2, string tgtBonename,
  10023. Vector3 v3StackOffset, Vector3 v3StackOffsetRot)
  10024. {
  10025. if (!master || !slave || !enabled)
  10026. return Vector3.zero;
  10027. if (!org_pelvis && !org_clit && string.IsNullOrEmpty(tgtBonename))
  10028. return slave.transform.rotation * v3StackOffset;
  10029. if (string.IsNullOrEmpty(tgtBonename) && (org_clit || org_pelvis))
  10030. { // ギズモ回転角度に補正
  10031. v3StackOffset = Quaternion.Euler(0, -90, -90) * Quaternion.Euler(v3StackOffsetRot) * v3StackOffset;
  10032. }
  10033. else
  10034. {
  10035. v3StackOffset = Quaternion.Euler(v3StackOffsetRot) * v3StackOffset;
  10036. }
  10037. Transform gotr_mas = master.gameObject.transform;
  10038. Transform gotr_slv = slave.gameObject.transform;
  10039. Maid man = master;
  10040. Maid maid = slave;
  10041. if (!master.boMAN)
  10042. {
  10043. man = slave;
  10044. maid = master;
  10045. }
  10046. string tgtbone = tgtBonename;
  10047. bool boTgtBone = !string.IsNullOrEmpty(tgtBonename);
  10048. var dicMaidPose = new Dictionary<string, Quaternion>();
  10049. var dicManPose = new Dictionary<string, Quaternion>();
  10050. Transform maid_bone_tr = maid.body0.m_Bones.transform;
  10051. Transform man_bone_tr = man.body0.m_Bones.transform;
  10052. //Vector3 dpos = master.transform.position - slave.transform.position;
  10053. Vector3 dpos = master.gameObject.transform.position - slave.gameObject.transform.position;
  10054. Vector3 res = Vector3.zero;
  10055. if (!master.boMAN)
  10056. {
  10057. //ボーン基準位置合わせ
  10058. try
  10059. {
  10060. if (!boTgtBone)
  10061. {
  10062. tgtbone = "Bip01 Pelvis";
  10063. }
  10064. //slave.transform.localPosition += SearchObjName(man_bone_tr, "ManBip", true).position - SearchObjName(maid_bone_tr, "Bip01", true).position - dpos;
  10065. //Bip01とpelvisは同座標っぽい… res = SearchObjName(maid_bone_tr, "Bip01", true).position - SearchObjName(man_bone_tr, "ManBip", true).position - dpos;
  10066. //SearchObjName(man_bone_tr, "ManBip", true).localPosition = SearchObjName(maid_bone_tr, "Bip01", true).localPosition;
  10067. if (PosSyncModeV2)
  10068. {
  10069. res = (SearchObjName(maid_bone_tr, tgtbone, true).position - gotr_mas.position);
  10070. }
  10071. else if (org_clit)
  10072. {
  10073. res = (SearchObjName(maid_bone_tr, tgtbone, true).position - gotr_mas.position)
  10074. - (SearchObjName(man_bone_tr, "chinkoCenter", true).position - gotr_slv.position);
  10075. }
  10076. else if (org_pelvis)
  10077. {
  10078. res = (SearchObjName(maid_bone_tr, tgtbone, true).position - gotr_mas.position)
  10079. - (SearchObjName(man_bone_tr, "ManBip Pelvis", true).position - gotr_slv.position);
  10080. }
  10081. else if (boTgtBone)
  10082. {
  10083. res = (SearchObjName(maid_bone_tr, tgtbone, true).position - gotr_mas.position);
  10084. }
  10085. if (v3StackOffset != Vector3.zero)
  10086. {
  10087. if (!boTgtBone)
  10088. res += SearchObjName(maid_bone_tr, "Bip01", true).TransformDirection(v3StackOffset);
  10089. else
  10090. res += SearchObjName(maid_bone_tr, tgtbone, true).TransformDirection(v3StackOffset);
  10091. }
  10092. }
  10093. catch (Exception e)
  10094. {
  10095. Console.WriteLine("TryPosSp: " + e);
  10096. }
  10097. }
  10098. else
  10099. {
  10100. //ボーン基準位置合わせ
  10101. try
  10102. {
  10103. if (!boTgtBone)
  10104. {
  10105. if (org_clit)
  10106. tgtbone = "chinkoCenter";
  10107. else //if (org_pelvis)
  10108. tgtbone = "ManBip Pelvis";
  10109. }
  10110. //SearchObjName(maid_bone_tr, "Bip01", true).localPosition = SearchObjName(man_bone_tr, "ManBip", true).localPosition;
  10111. //Bip01とpelvisは同座標っぽい…res = SearchObjName(man_bone_tr, "ManBip", true).position - SearchObjName(maid_bone_tr, "Bip01", true).position - dpos;
  10112. if (PosSyncModeV2)
  10113. {
  10114. res = (SearchObjName(man_bone_tr, tgtbone, true).position - gotr_mas.position);
  10115. }
  10116. else if (org_clit || org_pelvis)
  10117. {
  10118. res = (SearchObjName(man_bone_tr, tgtbone, true).position - gotr_mas.position)
  10119. - (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_slv.position);
  10120. }
  10121. else if (boTgtBone)
  10122. {
  10123. res = (SearchObjName(man_bone_tr, tgtbone, true).position - gotr_mas.position);
  10124. }
  10125. if (v3StackOffset != Vector3.zero)
  10126. {
  10127. if (!boTgtBone)
  10128. res += SearchObjName(man_bone_tr, "ManBip", true).TransformDirection(v3StackOffset);
  10129. else
  10130. res += SearchObjName(man_bone_tr, tgtbone, true).TransformDirection(v3StackOffset);
  10131. }
  10132. }
  10133. catch (Exception e)
  10134. {
  10135. Console.WriteLine("PoseInitMild2: " + e);
  10136. }
  10137. }
  10138. return res;
  10139. }
  10140. #if pre0025
  10141. public static Vector3 TryPos(Maid master, Maid slave, bool enabled, bool org_pelvis, bool org_clit, bool PosSyncModeV2, Vector3 v3StackOffset)
  10142. {
  10143. if (!master || !slave || !enabled)
  10144. return Vector3.zero;
  10145. Transform gotr_mas = master.gameObject.transform;
  10146. Transform gotr_slv = slave.gameObject.transform;
  10147. Maid man = master;
  10148. Maid maid = slave;
  10149. if (!master.boMAN)
  10150. {
  10151. man = slave;
  10152. maid = master;
  10153. }
  10154. var dicMaidPose = new Dictionary<string, Quaternion>();
  10155. var dicManPose = new Dictionary<string, Quaternion>();
  10156. Transform maid_bone_tr = maid.body0.m_Bones.transform;
  10157. Transform man_bone_tr = man.body0.m_Bones.transform;
  10158. //Vector3 dpos = master.transform.position - slave.transform.position;
  10159. Vector3 dpos = master.gameObject.transform.position - slave.gameObject.transform.position;
  10160. Vector3 res = Vector3.zero;
  10161. if (!master.boMAN)
  10162. {
  10163. //ボーン基準位置合わせ
  10164. try
  10165. {
  10166. //slave.transform.localPosition += SearchObjName(man_bone_tr, "ManBip", true).position - SearchObjName(maid_bone_tr, "Bip01", true).position - dpos;
  10167. //Bip01とpelvisは同座標っぽい… res = SearchObjName(maid_bone_tr, "Bip01", true).position - SearchObjName(man_bone_tr, "ManBip", true).position - dpos;
  10168. //SearchObjName(man_bone_tr, "ManBip", true).localPosition = SearchObjName(maid_bone_tr, "Bip01", true).localPosition;
  10169. if (org_clit)
  10170. {
  10171. //slave.transform.localPosition += (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_mas.position)
  10172. if (PosSyncModeV2)
  10173. {
  10174. res = (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_mas.position);
  10175. }
  10176. else
  10177. {
  10178. res = (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_mas.position)
  10179. - (SearchObjName(man_bone_tr, "chinkoCenter", true).position - gotr_slv.position);
  10180. }
  10181. //res += SearchObjName(man_bone_tr, "chinkoCenter", true).TransformDirection(v3StackOffset);
  10182. if (v3StackOffset != Vector3.zero)
  10183. res += SearchObjName(maid_bone_tr, "Bip01", true).TransformDirection(v3StackOffset);
  10184. //res += SearchObjName(man_bone_tr, "ManBip", true).TransformDirection(v3StackOffset);
  10185. }
  10186. else if (org_pelvis)
  10187. {
  10188. //slave.transform.localPosition += (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_mas.position)
  10189. if (PosSyncModeV2)
  10190. {
  10191. res = (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_mas.position);
  10192. }
  10193. else
  10194. {
  10195. res = (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_mas.position)
  10196. - (SearchObjName(man_bone_tr, "ManBip Pelvis", true).position - gotr_slv.position);
  10197. }
  10198. //res += SearchObjName(man_bone_tr, "ManBip Pelvis", true).TransformDirection(v3StackOffset);
  10199. if (v3StackOffset != Vector3.zero)
  10200. res += SearchObjName(maid_bone_tr, "Bip01", true).TransformDirection(v3StackOffset);
  10201. //res += SearchObjName(man_bone_tr, "ManBip", true).TransformDirection(v3StackOffset);
  10202. }
  10203. }
  10204. catch (Exception e)
  10205. {
  10206. Console.WriteLine("PoseInitMild2: " + e);
  10207. }
  10208. }
  10209. else
  10210. {
  10211. //ボーン基準位置合わせ
  10212. try
  10213. {
  10214. //SearchObjName(maid_bone_tr, "Bip01", true).localPosition = SearchObjName(man_bone_tr, "ManBip", true).localPosition;
  10215. //Bip01とpelvisは同座標っぽい…res = SearchObjName(man_bone_tr, "ManBip", true).position - SearchObjName(maid_bone_tr, "Bip01", true).position - dpos;
  10216. if (org_clit)
  10217. {
  10218. //slave.transform.localPosition += (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_mas.position)
  10219. if (PosSyncModeV2)
  10220. {
  10221. res = (SearchObjName(man_bone_tr, "chinkoCenter", true).position - gotr_mas.position);
  10222. }
  10223. else
  10224. {
  10225. res = (SearchObjName(man_bone_tr, "chinkoCenter", true).position - gotr_mas.position)
  10226. - (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_slv.position);
  10227. }
  10228. //res += SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).TransformDirection(v3StackOffset);
  10229. //res += SearchObjName(maid_bone_tr, "Bip01", true).TransformDirection(v3StackOffset);
  10230. if (v3StackOffset != Vector3.zero)
  10231. res += SearchObjName(man_bone_tr, "ManBip", true).TransformDirection(v3StackOffset);
  10232. }
  10233. else if (org_pelvis)
  10234. {
  10235. #if DEBUG
  10236. //Console.WriteLine("{0}, {1}, {2}, {3}", SearchObjName(man_bone_tr, "ManBip Pelvis", true).position, gotr_mas.position,
  10237. // SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position, gotr_slv.position);
  10238. #endif
  10239. //slave.transform.position += (SearchObjName(man_bone_tr, "ManBip Pelvis", true).position - gotr_mas.position)
  10240. if (PosSyncModeV2)
  10241. {
  10242. res = (SearchObjName(man_bone_tr, "ManBip Pelvis", true).position - gotr_mas.position);
  10243. }
  10244. else
  10245. {
  10246. res = (SearchObjName(man_bone_tr, "ManBip Pelvis", true).position - gotr_mas.position)
  10247. - (SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).position - gotr_slv.position);
  10248. }
  10249. //res += SearchObjName(maid_bone_tr, "Bip01 Pelvis", true).TransformDirection(v3StackOffset);
  10250. //res += SearchObjName(maid_bone_tr, "Bip01", true).TransformDirection(v3StackOffset);
  10251. if (v3StackOffset != Vector3.zero)
  10252. res += SearchObjName(man_bone_tr, "ManBip", true).TransformDirection(v3StackOffset);
  10253. }
  10254. }
  10255. catch (Exception e)
  10256. {
  10257. Console.WriteLine("PoseInitMild2: " + e);
  10258. }
  10259. }
  10260. return res;
  10261. }
  10262. #endif
  10263. static Dictionary<string, Quaternion> maid2man(Dictionary<string, Quaternion> dicBones)
  10264. {
  10265. var dest = new Dictionary<string, Quaternion>();
  10266. foreach (var bn in dicBones)
  10267. {
  10268. string name = bn.Key;
  10269. if (!name.Contains("Bip01")) name = ""; //v0020 不要なボーンを除く
  10270. //# ボーン/ウェイト名を Maid → Man
  10271. //name = Regex.Replace(name, @"Mune_.*", @"ManBip Spine2");
  10272. //name = Regex.Replace(name, @"Uppertwist.*_([rRlL]).*$", @"ManBip $1 UpperArm");
  10273. //name = Regex.Replace(name, @"Kata_([rRlL]).*$", @"ManBip $1 UpperArm");
  10274. //name = Regex.Replace(name, @"Foretwist.*_([rRlL]).*$", @"ManBip $1 Forearm");
  10275. //name = Regex.Replace(name, @"Hip_([rRlL]).*$", @"ManBip $1 Thigh");
  10276. //name = Regex.Replace(name, @"momotwist.*_([rRlL]).*$", @"ManBip $1 Thigh");
  10277. //name = Regex.Replace(name, @"momoniku.*_([rRlL]).*$", @"ManBip $1 Thigh");
  10278. name = Regex.Replace(name, @"Bip01 ([rRlL]) Toe1$", @"ManBip $1 Toe0");
  10279. //name = Regex.Replace(name, @"(Bip01.*) Toe11$", @"$1 Toe0");
  10280. //name = Regex.Replace(name, @"(Bip01.*) Toe01$", @"$1 Toe0");
  10281. name = Regex.Replace(name, @"Bip01 ([rRlL]) Toe2$", @"ManBip $1 Toe1");
  10282. //name = Regex.Replace(name, @"(Bip01.*) Toe21$", @"$1 Toe1");
  10283. if (name.Contains(" Toe") && name.Contains("Bip01 ")) name = ""; //v0020 不要なボーンを除く
  10284. name = Regex.Replace(name, @"Spine0a", @"Spine1");
  10285. name = Regex.Replace(name, @"Spine1a", @"Spine2");
  10286. //name = Regex.Replace(name, @"Bip01", @"ManBip");
  10287. name = name.Replace(@"Bip01", @"ManBip");
  10288. if (name != "")
  10289. dest[name] = bn.Value;
  10290. }
  10291. return dest;
  10292. }
  10293. static Dictionary<string, Quaternion> man2maid(Dictionary<string, Quaternion> dicBones)
  10294. {
  10295. var dest = new Dictionary<string, Quaternion>();
  10296. foreach (var bn in dicBones)
  10297. {
  10298. string name = bn.Key;
  10299. //# ボーン/ウェイト名を Man → Maid
  10300. //name = Regex.Replace(name, @"chinko.*$", @"Bip01 Pelvis");
  10301. //name = Regex.Replace(name, @"tamabukuro$", @"Bip01 Pelvis");
  10302. name = Regex.Replace(name, @"chinko1$", @"_IK_hutanari");
  10303. name = Regex.Replace(name, @"Spine1$", @"Spine0a");
  10304. name = Regex.Replace(name, @"Spine2$", @"Spine1a");
  10305. //name = Regex.Replace(name, @"(ManBip)(.*)$", @"Bip01$2");
  10306. name = Regex.Replace(name, @"ManBip ([rRlL]) Toe1$", @"Bip01 $1 Toe2");
  10307. name = Regex.Replace(name, @"ManBip ([rRlL]) Toe0$", @"Bip01 $1 Toe1");
  10308. if (name.Contains(" Toe") && name.Contains("ManBip")) name = ""; //v0020 不要なボーンを除く
  10309. name = name.Replace(@"ManBip", @"Bip01");
  10310. if (name != "")
  10311. dest[name] = bn.Value;
  10312. //足指のボーンを複製
  10313. float[] q0 = new float[4];
  10314. if ((name == "Bip01 R Toe1") && ipData.dicMaidInitPose.TryGetValue("Bip01 R Toe0", out q0))
  10315. {
  10316. dest["Bip01 R Toe0"] = Quaternion.Lerp(new Quaternion(q0[0], q0[1], q0[2], q0[3]), bn.Value, 0.5f);
  10317. }
  10318. if ((name == "Bip01 L Toe1") && ipData.dicMaidInitPose.TryGetValue("Bip01 L Toe0", out q0))
  10319. {
  10320. dest["Bip01 L Toe0"] = Quaternion.Lerp(new Quaternion(q0[0], q0[1], q0[2], q0[3]), bn.Value, 0.5f);
  10321. }
  10322. }
  10323. return dest;
  10324. }
  10325. //初期ポーズデータ
  10326. static InitPose ipData = new InitPose(true);
  10327. class InitPose
  10328. {
  10329. public InitPose()
  10330. {
  10331. }
  10332. public InitPose(bool load)
  10333. {
  10334. if (load)
  10335. {
  10336. Load();
  10337. }
  10338. }
  10339. public void Load()
  10340. {
  10341. var ipData = JsonFx.Json.JsonReader.Deserialize<InitPose>(@"{""dicMaidInitPose"":{""Bip01"":[-0.500000358,0.499999642,0.499999642,0.500000358],""Bip01 Head"":[5.10125346E-08,-1.01156218E-07,0.08458735,0.9964161],""Bip01 Neck"":[-4.095299E-14,4.27135149E-07,-0.154000267,0.988070846],""Bip01 Spine"":[-0.5224006,0.476547748,0.4765491,0.522399068],""Bip01 Spine0a"":[-7.289694E-08,-2.48852643E-07,0.08234593,0.996603847],""Bip01 Spine1"":[2.84859958E-09,-2.56992337E-07,0.05952706,0.9982267],""Bip01 Spine1a"":[2.54004089E-08,5.56248E-09,-0.0262033567,0.9996567],""Mune_R"":[-0.130401641,-0.116427459,-0.6552144,0.734938145],""Bip01 R Clavicle"":[0.707011163,-0.0116283,0.7070017,-0.0121913319],""Bip01 R UpperArm"":[-0.127119452,0.347238928,0.280861944,0.8856536],""Bip01 R Forearm"":[3.04732928E-09,2.669005E-08,0.456733763,0.889603436],""Bip01 R Hand"":[0.9619744,0.035165213,0.0032886113,0.270846665],""Mune_L"":[0.735012531,-0.655130446,-0.116414241,-0.130416155],""Bip01 L Clavicle"":[0.707011163,-0.0116263488,-0.707001746,0.0121893613],""Bip01 L UpperArm"":[0.1271193,-0.347239166,0.280861765,0.8856536],""Bip01 L Forearm"":[3.40293149E-09,-6.628062E-09,0.456733733,0.889603436],""Bip01 L Hand"":[0.9619744,0.03516523,-0.00328857778,-0.270846665],""Bip01 R Thigh"":[-0.5271557,0.825693846,-0.131378531,-0.151908576],""Bip01 R Calf"":[1.5333729E-08,7.856927E-09,0.456016839,0.8899712],""Bip01 R Foot"":[0.0429165475,-0.0405659154,0.0193312634,0.998067558],""Bip01 L Thigh"":[-0.5271557,0.825694263,0.131378159,0.151906654],""Bip01 L Calf"":[-1.57551006E-09,-9.178994E-09,0.456016868,0.889971137],""Bip01 L Foot"":[-0.042916514,0.0405658446,0.0193312317,0.9980676],""Bip01 R Finger0"":[-0.334180564,0.285874128,-0.035913486,0.8973904],""Bip01 R Finger01"":[-1.55828523E-08,1.41867531E-08,0.0468453579,0.9989022],""Bip01 R Finger02"":[-2.98023188E-08,7.450581E-09,7.450581E-09,1],""Bip01 R Finger1"":[0.00194044434,0.0588727221,0.0261753127,0.9979204],""Bip01 R Finger11"":[3.7252903E-09,7.450581E-09,-2.32830644E-09,1],""Bip01 R Finger12"":[3.7252903E-09,7.450581E-09,-2.32830644E-09,1],""Bip01 R Finger2"":[0.000407734333,0.002978354,0.00321666966,0.999990344],""Bip01 R Finger21"":[3.72315334E-09,1.26156932E-10,0.0338649936,0.9994264],""Bip01 R Finger22"":[3.7252903E-09,-1.49011594E-08,5.587935E-09,1],""Bip01 R Finger3"":[-0.000201299859,-0.07369577,0.00395552255,0.9972729],""Bip01 R Finger31"":[4.000103E-09,-1.48297543E-08,0.0184850525,0.9998292],""Bip01 R Finger32"":[-7.71108E-09,2.97359826E-08,0.008750517,0.999961734],""Bip01 R Finger4"":[-0.00130899251,-0.1456734,0.01685153,0.9891884],""Bip01 R Finger41"":[-1.86264493E-09,1.49011594E-08,2.7755569E-17,1],""Bip01 R Finger42"":[-2.44913223E-09,4.46460575E-08,0.03396485,0.999423],""Bip01 L Finger0"":[0.334180564,-0.285874128,-0.0359135047,0.8973904],""Bip01 L Finger01"":[1.62809037E-08,-2.90715541E-08,0.04684536,0.9989022],""Bip01 L Finger02"":[-2.220446E-16,2.98023224E-08,7.450581E-09,1],""Bip01 L Finger1"":[-0.001940444,-0.0588727035,0.0261753183,0.9979204],""Bip01 L Finger11"":[0,0,-4.19095159E-09,1],""Bip01 L Finger12"":[0,0,-4.19095159E-09,1],""Bip01 L Finger2"":[-0.0004077344,-0.002978339,0.00321665849,0.999990344],""Bip01 L Finger21"":[-3.21852567E-09,-1.501877E-08,0.0338649936,0.9994264],""Bip01 L Finger22"":[0,0,7.45057971E-09,1],""Bip01 L Finger3"":[0.0002012996,0.07369578,0.00395552441,0.9972729],""Bip01 L Finger31"":[5.862429E-09,-1.47953205E-08,0.0184850488,0.9998292],""Bip01 L Finger32"":[1.3039303E-10,-1.49005892E-08,0.008750529,0.999961734],""Bip01 L Finger4"":[0.00130899344,0.1456734,0.016851522,0.9891884],""Bip01 L Finger41"":[0,0,-1.11758709E-08,1],""Bip01 L Finger42"":[-1.355455E-09,-1.49558268E-08,0.03396483,0.999423],""Bip01 R Toe2"":[-0.0308998842,-0.0107883792,-0.5952882,0.8028455],""Bip01 R Toe21"":[-4.386279E-09,1.94202219E-08,0.0339062028,0.999425054],""Bip01 R Toe1"":[0.0493279733,0.0129661234,-0.617873847,0.784621358],""Bip01 R Toe11"":[-1.86264537E-09,1.11758718E-08,2.0816685E-17,1],""Bip01 R Toe0"":[0.00419396255,-0.00206413679,-0.6421687,0.76654917],""Bip01 R Toe01"":[7.960058E-09,-5.8863705E-09,0.0819981843,0.9966325],""Bip01 L Toe2"":[0.0308998823,0.010788383,-0.595288157,0.8028455],""Bip01 L Toe21"":[7.5094535E-09,-1.60895353E-09,0.03390623,0.999425054],""Bip01 L Toe1"":[-0.0493279621,-0.0129661178,-0.6178737,0.784621358],""Bip01 L Toe11"":[2.7939675E-09,2.25845724E-08,-6.310056E-17,1],""Bip01 L Toe0"":[-0.00419394253,0.00206416636,-0.642168641,0.7665492],""Bip01 L Toe01"":[-4.476413E-09,8.97639651E-09,0.08199818,0.9966325],""Bip01 Pelvis"":[-0.5323567,0.4653983,0.465398431,0.53235805],""Bip01 Footsteps"":[0,0,-0.707106352,0.7071073]},""dicManInitPose"":{""ManBip"":[-0.500000358,0.499999642,0.499999642,0.500000358],""ManBip Head"":[4.17850264E-14,2.48618228E-08,-0.008963051,0.9999598],""ManBip Neck"":[5.575591E-14,4.20879815E-07,-0.151744932,0.9884197],""ManBip Spine"":[0.5000007,-0.4999993,-0.5000007,-0.4999993],""ManBip Spine1"":[-6.12429131E-15,-1.07341428E-07,0.038701117,0.9992508],""ManBip Spine2"":[-3.8841E-14,-1.31670959E-07,0.0474729538,0.9988725],""ManBip R Clavicle"":[0.6467047,0.0002564384,0.7627404,-0.000304589048],""ManBip R UpperArm"":[-0.103138067,0.3984069,-0.0506248623,0.9099844],""ManBip R Forearm"":[-1.96698768E-10,-2.98344E-08,0.0402369276,0.9991902],""ManBip R Hand"":[0.706165135,0.0305421874,0.0123255923,0.707280755],""ManBip L Clavicle"":[-0.6467047,-0.000258554064,0.7627404,-0.000302795466],""ManBip L UpperArm"":[0.103138067,-0.398406923,-0.05062485,0.9099844],""ManBip L Forearm"":[-3.23052762E-09,7.443611E-08,0.04023694,0.9991902],""ManBip L Hand"":[-0.706165135,-0.0305421837,0.01232559,0.707280755],""ManBip R Thigh"":[0.00263441727,0.9982243,-0.00517705875,-0.0592836924],""ManBip R Calf"":[2.48443544E-10,7.454624E-09,0.01352519,0.999908566],""ManBip R Foot"":[0.0313028,-0.0597688779,-0.0139128156,0.997624338],""ManBip L Thigh"":[0.002634342,0.9982244,0.00517567061,0.0592822172],""ManBip L Calf"":[1.16404685E-10,1.57453933E-12,0.0135251889,0.999908566],""ManBip L Foot"":[-0.03130279,0.0597687848,-0.0139128147,0.997624338],""ManBip R Finger0"":[-0.4217479,0.283663929,-0.0152533976,0.861063838],""ManBip R Finger01"":[2.0470706E-08,-8.678663E-10,-0.0423574746,0.999102533],""ManBip R Finger02"":[2.04890949E-08,-3.05311252E-16,-1.49011594E-08,1],""ManBip R Finger1"":[0.0008758125,0.0596490949,0.008028525,0.998186767],""ManBip R Finger11"":[-3.72529E-09,-1.49011612E-08,-1.49011612E-08,1],""ManBip R Finger12"":[-3.72529E-09,-1.49011612E-08,-1.49011612E-08,1],""ManBip R Finger2"":[0.000398111,0.0156074585,6.18502054E-06,0.999878168],""ManBip R Finger21"":[3.7252903E-09,-7.450581E-09,-1.49011612E-08,1],""ManBip R Finger22"":[3.7252903E-09,-7.450581E-09,-1.49011612E-08,1],""ManBip R Finger3"":[0.000398110424,-0.0156222573,-6.223847E-06,0.9998779],""ManBip R Finger31"":[0,1.86264515E-09,0,1],""ManBip R Finger32"":[0,1.86264515E-09,0,1],""ManBip R Finger4"":[0.0003967817,-0.08307511,-3.30893345E-05,0.9965432],""ManBip R Finger41"":[-1.86264515E-09,0,0,1],""ManBip R Finger42"":[-1.86264515E-09,0,0,1],""ManBip L Finger0"":[0.421747833,-0.2836639,-0.0152533874,0.861063838],""ManBip L Finger01"":[-1.33424019E-08,-6.891615E-09,-0.0423574746,0.999102533],""ManBip L Finger02"":[-1.11758709E-08,3.7252903E-09,4.16333634E-17,1],""ManBip L Finger1"":[-0.000875810045,-0.0596490875,0.00802857,0.998186767],""ManBip L Finger11"":[3.7252903E-09,0,0,1],""ManBip L Finger12"":[3.7252903E-09,0,0,1],""ManBip L Finger2"":[-0.0003981141,-0.0156074539,6.22968264E-06,0.999878168],""ManBip L Finger21"":[-1.86264537E-09,3.7252903E-09,6.938895E-18,1],""ManBip L Finger22"":[-1.86264537E-09,3.7252903E-09,6.938895E-18,1],""ManBip L Finger3"":[-0.0003981144,0.0156222573,-6.208881E-06,0.9998779],""ManBip L Finger31"":[9.313226E-10,2.79396772E-09,-1.49011612E-08,1],""ManBip L Finger32"":[9.313226E-10,2.79396772E-09,-1.49011612E-08,1],""ManBip L Finger4"":[-0.0003967855,0.0830751061,-3.30890143E-05,0.9965432],""ManBip L Finger41"":[0,0,0,1],""ManBip L Finger42"":[0,0,0,1],""ManBip R Toe1"":[1.808849E-08,-1.28201343E-08,-0.7071068,0.7071068],""ManBip R Toe0"":[1.808849E-08,-1.28201343E-08,-0.7071068,0.7071068],""ManBip L Toe1"":[-1.54543134E-08,1.54543134E-08,-0.7071068,0.7071068],""ManBip L Toe0"":[-1.54543134E-08,1.54543134E-08,-0.7071068,0.7071068],""ManBip Pelvis"":[-0.499999642,0.500000358,0.499999642,0.500000358],""chinkoCenter"":[0.7071068,-0.7071068,5.577444E-07,1.50745143E-06],""chinko1"":[-2.71605011E-14,-8.23369151E-14,0.336606741,0.9416453],""chinko2"":[-1.00942432E-09,-4.852763E-08,-0.0207966343,0.999783754],""tamabukuro"":[-3.374307E-17,-4.86970168E-15,0.6788698,0.7342587],""ManBip Footsteps"":[0,0,-0.707106352,0.7071073]},""isDataInit"":true}") as InitPose;
  10342. this.dicMaidInitPose = ipData.dicMaidInitPose;
  10343. this.dicManInitPose = ipData.dicManInitPose;
  10344. }
  10345. public InitPose(Dictionary<string, float[]> dicMaidInitPose, Dictionary<string, float[]> dicManInitPose)
  10346. {
  10347. this.dicMaidInitPose = dicMaidInitPose;
  10348. this.dicManInitPose = dicManInitPose;
  10349. }
  10350. public Dictionary<string, float[]> dicMaidInitPose = new Dictionary<string, float[]>();
  10351. public Dictionary<string, float[]> dicManInitPose = new Dictionary<string, float[]>();
  10352. public bool isDataInit = false;
  10353. }
  10354. }
  10355. }
  10356. namespace XtHandMgr
  10357. {
  10358. // 公式のArmFinger : FingerBlend.BaseFingerより改造
  10359. public class BlendMgr
  10360. {
  10361. bool isR = true;
  10362. public Maid maid;
  10363. public float fBlend;
  10364. public float fOpen;
  10365. public float fGrip;
  10366. IKManager.BoneType[][] fingers = new IKManager.BoneType[][] { };
  10367. Dictionary<IKManager.BoneType, KeyValuePair<IKManager.BoneSetType, GameObject>> fingersBoneDic;
  10368. public bool animOn = false;
  10369. //float animVal = 0;
  10370. public float animRange = 0;
  10371. public float animSpeed = 0;
  10372. public int retry = 100;
  10373. bool needInit = true;
  10374. public void Apply(bool bo)
  10375. {
  10376. if (maid && bo)
  10377. {
  10378. try
  10379. {
  10380. if (!maid.body0.m_Bones)
  10381. return;
  10382. if (needInit)
  10383. init(maid, isR);
  10384. Apply(this.fingers);
  10385. retry = 100;
  10386. }
  10387. catch (NullReferenceException ex)
  10388. {
  10389. if (retry > 0)
  10390. {
  10391. needInit = true;
  10392. UnityEngine.Debug.LogWarningFormat("XtMS: 指のブレンドマネージャを再起動(リトライ=残{0})", retry);
  10393. retry--;
  10394. }
  10395. else
  10396. {
  10397. UnityEngine.Debug.LogError(ex);
  10398. }
  10399. }
  10400. }
  10401. }
  10402. public void Apply(IKManager.BoneType[][] fingers)
  10403. {
  10404. var valO = Mathf.Clamp01(fOpen);
  10405. var valG = Mathf.Clamp01(fGrip);
  10406. if (animOn)
  10407. {
  10408. //valG = Mathf.SmoothStep(Mathf.Clamp01(valG), Mathf.Clamp01(valG + animRange), Mathf.PingPong(Time.time * animSpeed, 1f));
  10409. // v5.0 非対称
  10410. var time = Time.time * animSpeed % 3f;
  10411. if (time > 1f)
  10412. {
  10413. time = (time - 1f) / 2f + 1f;
  10414. }
  10415. valG = Mathf.SmoothStep(Mathf.Clamp01(valG), Mathf.Clamp01(valG + animRange), Mathf.PingPong(time, 1f));
  10416. }
  10417. if (FingerBlend.open_dic == null || FingerBlend.close_dic == null || FingerBlend.fist_dic == null)
  10418. {
  10419. // FingerBlend初期化まだ
  10420. var gofb = GameObject.Find("xtMsInit_FingerBlend");
  10421. if (!gofb)
  10422. {
  10423. Console.WriteLine("XtMs: FingerBlendの初期化");
  10424. var go = new GameObject("xtMsInit_FingerBlend");
  10425. go.AddComponent<FingerBlend>();
  10426. }
  10427. else
  10428. {
  10429. GameObject.DestroyImmediate(gofb);
  10430. Console.WriteLine("XtMs: FingerBlendの再初期化");
  10431. var go = new GameObject("xtMsInit_FingerBlend");
  10432. go.AddComponent<FingerBlend>();
  10433. }
  10434. }
  10435. for (int i = 0; i < fingers.Length; i++)
  10436. {
  10437. foreach (IKManager.BoneType boneType in this.fingers[i])
  10438. {
  10439. var trBone = getBone(boneType).transform;
  10440. trBone.localRotation
  10441. = Quaternion.Lerp(
  10442. trBone.localRotation,
  10443. Quaternion.Lerp(
  10444. Quaternion.Lerp(
  10445. FingerBlend.close_dic[boneType],
  10446. FingerBlend.open_dic[boneType],
  10447. valO),
  10448. FingerBlend.fist_dic[boneType],
  10449. valG),
  10450. Mathf.Clamp01(fBlend));
  10451. }
  10452. }
  10453. }
  10454. private void init(Maid maid, bool isR)
  10455. {
  10456. this.isR = isR;
  10457. this.maid = maid;
  10458. this.fingers = new IKManager.BoneType[5][];
  10459. for (int i = 0; i < 5; i++)
  10460. {
  10461. this.fingers[i] = new IKManager.BoneType[3];
  10462. for (int j = 0; j < 3; j++)
  10463. {
  10464. if (isR)
  10465. this.fingers[i][j] = i * this.fingers[i].Length + IKManager.BoneType.Finger0_Root_R + j;
  10466. else
  10467. this.fingers[i][j] = i * this.fingers[i].Length + IKManager.BoneType.Finger0_Root_L + j;
  10468. }
  10469. }
  10470. setDic(maid);
  10471. needInit = false;
  10472. }
  10473. public BlendMgr(Maid maid, bool isR)
  10474. {
  10475. init(maid, isR);
  10476. }
  10477. GameObject getBone(IKManager.BoneType type)
  10478. {
  10479. return fingersBoneDic[type].Value;
  10480. }
  10481. void setDic(Maid maid)
  10482. {
  10483. //IKManagerより 旧カスメでも使えるように切り出し
  10484. fingersBoneDic = new Dictionary<IKManager.BoneType, KeyValuePair<IKManager.BoneSetType, GameObject>>
  10485. {
  10486. {
  10487. IKManager.BoneType.Finger0_Root_R,
  10488. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger0").gameObject)
  10489. },
  10490. {
  10491. IKManager.BoneType.Finger0_0_R,
  10492. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger01").gameObject)
  10493. },
  10494. {
  10495. IKManager.BoneType.Finger0_1_R,
  10496. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger02").gameObject)
  10497. },
  10498. {
  10499. IKManager.BoneType.Finger1_Root_R,
  10500. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger1").gameObject)
  10501. },
  10502. {
  10503. IKManager.BoneType.Finger1_0_R,
  10504. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger11").gameObject)
  10505. },
  10506. {
  10507. IKManager.BoneType.Finger1_1_R,
  10508. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger12").gameObject)
  10509. },
  10510. {
  10511. IKManager.BoneType.Finger2_Root_R,
  10512. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger2").gameObject)
  10513. },
  10514. {
  10515. IKManager.BoneType.Finger2_0_R,
  10516. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger21").gameObject)
  10517. },
  10518. {
  10519. IKManager.BoneType.Finger2_1_R,
  10520. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger22").gameObject)
  10521. },
  10522. {
  10523. IKManager.BoneType.Finger3_Root_R,
  10524. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger3").gameObject)
  10525. },
  10526. {
  10527. IKManager.BoneType.Finger3_0_R,
  10528. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger31").gameObject)
  10529. },
  10530. {
  10531. IKManager.BoneType.Finger3_1_R,
  10532. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger32").gameObject)
  10533. },
  10534. {
  10535. IKManager.BoneType.Finger4_Root_R,
  10536. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger4").gameObject)
  10537. },
  10538. {
  10539. IKManager.BoneType.Finger4_0_R,
  10540. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger41").gameObject)
  10541. },
  10542. {
  10543. IKManager.BoneType.Finger4_1_R,
  10544. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightArmFinger, maid.body0.GetBone("Bip01 R Finger42").gameObject)
  10545. },
  10546. {
  10547. IKManager.BoneType.Finger0_Root_L,
  10548. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger0").gameObject)
  10549. },
  10550. {
  10551. IKManager.BoneType.Finger0_0_L,
  10552. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger01").gameObject)
  10553. },
  10554. {
  10555. IKManager.BoneType.Finger0_1_L,
  10556. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger02").gameObject)
  10557. },
  10558. {
  10559. IKManager.BoneType.Finger1_Root_L,
  10560. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger1").gameObject)
  10561. },
  10562. {
  10563. IKManager.BoneType.Finger1_0_L,
  10564. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger11").gameObject)
  10565. },
  10566. {
  10567. IKManager.BoneType.Finger1_1_L,
  10568. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger12").gameObject)
  10569. },
  10570. {
  10571. IKManager.BoneType.Finger2_Root_L,
  10572. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger2").gameObject)
  10573. },
  10574. {
  10575. IKManager.BoneType.Finger2_0_L,
  10576. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger21").gameObject)
  10577. },
  10578. {
  10579. IKManager.BoneType.Finger2_1_L,
  10580. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger22").gameObject)
  10581. },
  10582. {
  10583. IKManager.BoneType.Finger3_Root_L,
  10584. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger3").gameObject)
  10585. },
  10586. {
  10587. IKManager.BoneType.Finger3_0_L,
  10588. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger31").gameObject)
  10589. },
  10590. {
  10591. IKManager.BoneType.Finger3_1_L,
  10592. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger32").gameObject)
  10593. },
  10594. {
  10595. IKManager.BoneType.Finger4_Root_L,
  10596. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger4").gameObject)
  10597. },
  10598. {
  10599. IKManager.BoneType.Finger4_0_L,
  10600. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger41").gameObject)
  10601. },
  10602. {
  10603. IKManager.BoneType.Finger4_1_L,
  10604. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftArmFinger, maid.body0.GetBone("Bip01 L Finger42").gameObject)
  10605. },
  10606. {
  10607. IKManager.BoneType.Toe0_Root_R,
  10608. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightLegFinger, maid.body0.GetBone("Bip01 R Toe2").gameObject)
  10609. },
  10610. {
  10611. IKManager.BoneType.Toe0_0_R,
  10612. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightLegFinger, maid.body0.GetBone("Bip01 R Toe21").gameObject)
  10613. },
  10614. {
  10615. IKManager.BoneType.Toe1_Root_R,
  10616. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightLegFinger, maid.body0.GetBone("Bip01 R Toe1").gameObject)
  10617. },
  10618. {
  10619. IKManager.BoneType.Toe1_0_R,
  10620. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightLegFinger, maid.body0.GetBone("Bip01 R Toe11").gameObject)
  10621. },
  10622. {
  10623. IKManager.BoneType.Toe2_Root_R,
  10624. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightLegFinger, maid.body0.GetBone("Bip01 R Toe0").gameObject)
  10625. },
  10626. {
  10627. IKManager.BoneType.Toe2_0_R,
  10628. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightLegFinger, maid.body0.GetBone("Bip01 R Toe01").gameObject)
  10629. },
  10630. {
  10631. IKManager.BoneType.Toe0_Root_L,
  10632. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.RightLegFinger, maid.body0.GetBone("Bip01 L Toe2").gameObject)
  10633. },
  10634. {
  10635. IKManager.BoneType.Toe0_0_L,
  10636. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftLegFinger, maid.body0.GetBone("Bip01 L Toe21").gameObject)
  10637. },
  10638. {
  10639. IKManager.BoneType.Toe1_Root_L,
  10640. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftLegFinger, maid.body0.GetBone("Bip01 L Toe1").gameObject)
  10641. },
  10642. {
  10643. IKManager.BoneType.Toe1_0_L,
  10644. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftLegFinger, maid.body0.GetBone("Bip01 L Toe11").gameObject)
  10645. },
  10646. {
  10647. IKManager.BoneType.Toe2_Root_L,
  10648. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftLegFinger, maid.body0.GetBone("Bip01 L Toe0").gameObject)
  10649. },
  10650. {
  10651. IKManager.BoneType.Toe2_0_L,
  10652. new KeyValuePair<IKManager.BoneSetType, GameObject>(IKManager.BoneSetType.LeftLegFinger, maid.body0.GetBone("Bip01 L Toe01").gameObject)
  10653. }
  10654. };
  10655. }
  10656. }
  10657. }
  10658. namespace Defines
  10659. {
  10660. class data
  10661. {
  10662. public readonly static string[] MaidBones =
  10663. {
  10664. "Bip01",
  10665. "Bip01 Head",
  10666. "Bip01 Neck",
  10667. "Bip01 Spine",
  10668. "Bip01 Spine0a",
  10669. "Bip01 Spine1",
  10670. "Bip01 Spine1a",
  10671. "Mune_R",
  10672. "Bip01 R Clavicle",
  10673. "Bip01 R UpperArm",
  10674. "Bip01 R Forearm",
  10675. "Bip01 R Hand",
  10676. "Mune_L",
  10677. "Bip01 L Clavicle",
  10678. "Bip01 L UpperArm",
  10679. "Bip01 L Forearm",
  10680. "Bip01 L Hand",
  10681. "Bip01 R Thigh",
  10682. "Bip01 R Calf",
  10683. "Bip01 R Foot",
  10684. "Bip01 L Thigh",
  10685. "Bip01 L Calf",
  10686. "Bip01 L Foot",
  10687. "Bip01 R Finger0",
  10688. "Bip01 R Finger01",
  10689. "Bip01 R Finger02",
  10690. "Bip01 R Finger1",
  10691. "Bip01 R Finger11",
  10692. "Bip01 R Finger12",
  10693. "Bip01 R Finger2",
  10694. "Bip01 R Finger21",
  10695. "Bip01 R Finger22",
  10696. "Bip01 R Finger3",
  10697. "Bip01 R Finger31",
  10698. "Bip01 R Finger32",
  10699. "Bip01 R Finger4",
  10700. "Bip01 R Finger41",
  10701. "Bip01 R Finger42",
  10702. "Bip01 L Finger0",
  10703. "Bip01 L Finger01",
  10704. "Bip01 L Finger02",
  10705. "Bip01 L Finger1",
  10706. "Bip01 L Finger11",
  10707. "Bip01 L Finger12",
  10708. "Bip01 L Finger2",
  10709. "Bip01 L Finger21",
  10710. "Bip01 L Finger22",
  10711. "Bip01 L Finger3",
  10712. "Bip01 L Finger31",
  10713. "Bip01 L Finger32",
  10714. "Bip01 L Finger4",
  10715. "Bip01 L Finger41",
  10716. "Bip01 L Finger42",
  10717. "Bip01 R Toe2",
  10718. "Bip01 R Toe21",
  10719. "Bip01 R Toe1",
  10720. "Bip01 R Toe11",
  10721. "Bip01 R Toe0",
  10722. "Bip01 R Toe01",
  10723. "Bip01 L Toe2",
  10724. "Bip01 L Toe21",
  10725. "Bip01 L Toe1",
  10726. "Bip01 L Toe11",
  10727. "Bip01 L Toe0",
  10728. "Bip01 L Toe01",
  10729. "Bip01 Pelvis",
  10730. "Bip01 Footsteps",
  10731. };
  10732. public readonly static string[] ManBones =
  10733. {
  10734. "ManBip",
  10735. "ManBip Head",
  10736. "ManBip Neck",
  10737. "ManBip Spine",
  10738. "ManBip Spine1",
  10739. "ManBip Spine2",
  10740. "ManBip R Clavicle",
  10741. "ManBip R UpperArm",
  10742. "ManBip R Forearm",
  10743. "ManBip R Hand",
  10744. "ManBip L Clavicle",
  10745. "ManBip L UpperArm",
  10746. "ManBip L Forearm",
  10747. "ManBip L Hand",
  10748. "ManBip R Thigh",
  10749. "ManBip R Calf",
  10750. "ManBip R Foot",
  10751. "ManBip L Thigh",
  10752. "ManBip L Calf",
  10753. "ManBip L Foot",
  10754. "ManBip R Finger0",
  10755. "ManBip R Finger01",
  10756. "ManBip R Finger02",
  10757. "ManBip R Finger1",
  10758. "ManBip R Finger11",
  10759. "ManBip R Finger12",
  10760. "ManBip R Finger2",
  10761. "ManBip R Finger21",
  10762. "ManBip R Finger22",
  10763. "ManBip R Finger3",
  10764. "ManBip R Finger31",
  10765. "ManBip R Finger32",
  10766. "ManBip R Finger4",
  10767. "ManBip R Finger41",
  10768. "ManBip R Finger42",
  10769. "ManBip L Finger0",
  10770. "ManBip L Finger01",
  10771. "ManBip L Finger02",
  10772. "ManBip L Finger1",
  10773. "ManBip L Finger11",
  10774. "ManBip L Finger12",
  10775. "ManBip L Finger2",
  10776. "ManBip L Finger21",
  10777. "ManBip L Finger22",
  10778. "ManBip L Finger3",
  10779. "ManBip L Finger31",
  10780. "ManBip L Finger32",
  10781. "ManBip L Finger4",
  10782. "ManBip L Finger41",
  10783. "ManBip L Finger42",
  10784. "ManBip R Toe1",
  10785. "ManBip R Toe0",
  10786. "ManBip L Toe1",
  10787. "ManBip L Toe0",
  10788. "ManBip Pelvis",
  10789. "chinkoCenter",
  10790. "chinko1",
  10791. "chinko2",
  10792. "tamabukuro",
  10793. "ManBip Footsteps",
  10794. };
  10795. public readonly static string comboBonePrefix = "* ";
  10796. }
  10797. }
  10798. #if true
  10799. namespace VYMModule
  10800. {
  10801. #region VoiceTableToCsv
  10802. // csvテーブル移行用 v0027
  10803. class cnv2csv
  10804. {
  10805. static readonly string[] levelTypes = new string[] { /*"10",*/ "20", "30", "40" };
  10806. #if COM3D2
  10807. static readonly string[] maidTypes = new string[] { "Pure", "Pride", "Cool", "Yandere", "Anesan", "Genki", "Sadist", "Muku", "Majime", "Rindere", };
  10808. #else
  10809. static readonly string[] maidTypes = new string[] { "Pure", "Pride", "Cool", "Yandere", "Anesan", "Genki", "Sadist", };
  10810. #endif
  10811. static readonly string[] voiceTypes = new string[] { "sLoopVoice{0}{1}Vibe", "sLoopVoice{0}{1}Fera", "sOrgasmVoice{0}{1}Vibe", "sOrgasmVoice{0}{1}Fera", };
  10812. static readonly string[] customTypes = new string[] { "1", "2", "3", "4" };
  10813. static readonly string[] voiceCustoms = new string[] { "sLoopVoice{0}Custom{1}", "sOrgasmVoice{0}Custom{1}", };
  10814. public static void SaveVoiceCsvFile()
  10815. {
  10816. string fileName = NewVoiceTable.fileName;
  10817. if (System.IO.File.Exists(fileName)/* && !vs_Overwrite*/)
  10818. { //上書きのチェック
  10819. #if !DEBUG
  10820. return;
  10821. #endif
  10822. }
  10823. try
  10824. {
  10825. using (StreamWriter sw = new StreamWriter(fileName, false, new System.Text.UTF8Encoding(true)))
  10826. {
  10827. sw.WriteLine("VoiceType,State(20=Low|30=High|40=Rest),Personal,Level(0~3=ExciteLv|4=Stun|-1=N/A),Files...");
  10828. toCsv(sw);
  10829. sw.Flush();
  10830. sw.Close();
  10831. }
  10832. }
  10833. catch (Exception e)
  10834. {
  10835. Console.WriteLine("XtMS: CSV生成エラー " + e);
  10836. }
  10837. }
  10838. public static void toCsv(StreamWriter sw)
  10839. {
  10840. var vcfg = VYMModule.VymModule.voiceLegacy;
  10841. maidTypes.ToList().ForEach(y =>
  10842. {
  10843. levelTypes.ToList().ForEach(x =>
  10844. {
  10845. voiceTypes.ToList().ForEach(z =>
  10846. {
  10847. var str = string.Format(z, x, y);
  10848. try
  10849. {
  10850. var obj = vcfg.GetType().GetField(str).GetValue(vcfg);
  10851. if (obj is string[][])
  10852. {
  10853. var spp = obj as string[][];
  10854. for (int i = 0; i < spp.Length; i++)
  10855. {
  10856. outputLine(spp[i], i);
  10857. }
  10858. }
  10859. else
  10860. {
  10861. string[] sl = obj as string[];
  10862. if (z.Contains("sLoopVoice") && x == "40")
  10863. {
  10864. for (int i = 0; i < sl.Length; i++)
  10865. {
  10866. string[] newsl = new string[1] { sl[i] };
  10867. outputLine(newsl, i);
  10868. }
  10869. }
  10870. else
  10871. outputLine(sl, -1);
  10872. }
  10873. void outputLine(string[] vList, int state)
  10874. {
  10875. List<string> line = new List<string> { string.Format(z, "", "").Substring(1).Replace("Vibe", ""), x, y, state.ToString() };
  10876. line.AddRange(vList);
  10877. sw.WriteLine(string.Join(",", line.ToArray()));
  10878. }
  10879. }
  10880. catch
  10881. {
  10882. if (!(z.Contains("sOrgasmVoice") && x != "30") && !(z.Contains("Fera") && x == "40"))
  10883. Console.WriteLine(str + "は見つかりません");
  10884. }
  10885. });
  10886. });
  10887. });
  10888. customTypes.ToList().ForEach(y =>
  10889. {
  10890. levelTypes.ToList().ForEach(x =>
  10891. {
  10892. voiceTypes.ToList().ForEach(z =>
  10893. {
  10894. var str = string.Format(voiceCustoms[0], x, y);
  10895. try
  10896. {
  10897. if (z.Contains("Fera") && x == "40")
  10898. return; // continue
  10899. if (!z.Contains("sLoopVoice"))
  10900. {
  10901. str = string.Format(voiceCustoms[1], x, y);
  10902. }
  10903. var obj = vcfg.GetType().GetField(str).GetValue(vcfg);
  10904. if (obj is string[][])
  10905. {
  10906. var spp = obj as string[][];
  10907. for (int i = 0; i < spp.Length; i++)
  10908. {
  10909. outputLine(spp[i], i);
  10910. }
  10911. }
  10912. else
  10913. {
  10914. string[] sl = obj as string[];
  10915. if (z.Contains("sLoopVoice") && x == "40")
  10916. {
  10917. for (int i = 0; i < sl.Length; i++)
  10918. {
  10919. string[] newsl = new string[1] { sl[i] };
  10920. outputLine(newsl, i);
  10921. }
  10922. }
  10923. else
  10924. outputLine(sl, -1);
  10925. }
  10926. void outputLine(string[] vList, int state)
  10927. {
  10928. List<string> line = new List<string> { string.Format(z, "", "").Substring(1).Replace("Vibe", ""), x, "Custom" + y, state.ToString() };
  10929. line.AddRange(vList);
  10930. sw.WriteLine(string.Join(",", line.ToArray()));
  10931. }
  10932. }
  10933. catch
  10934. {
  10935. if (!(z.Contains("sOrgasmVoice") && x != "30") && !(z.Contains("Fera") && x == "40"))
  10936. Console.WriteLine(str + "は見つかりません");
  10937. }
  10938. });
  10939. });
  10940. });
  10941. }
  10942. }
  10943. #endregion
  10944. #region NewVoiceTable
  10945. class NewVoiceTable
  10946. {
  10947. public static readonly string fileName
  10948. = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
  10949. @"Config\xtYotogiVoiceTable.csv");
  10950. public class VoiceSet
  10951. {
  10952. public enum VoiceType
  10953. {
  10954. LoopVoice,
  10955. LoopVoiceFera,
  10956. OrgasmVoice,
  10957. OrgasmVoiceFera,
  10958. }
  10959. public VoiceType MyType; // 音声タイプ
  10960. public int State; // VYMでのバイブ強弱(20=Low|30=High|40=Rest)
  10961. public string Personal; // 性格
  10962. public int Level; // 興奮Lv(0~3=ExciteLv|4=Stun|-1=N/A)
  10963. public string[] Files; // 音声リスト
  10964. public VoiceSet(VoiceType type, int state, string personal, int level, string[] files)
  10965. {
  10966. this.MyType = type;
  10967. this.State = state;
  10968. this.Personal = personal;
  10969. this.Level = level;
  10970. this.Files = files;
  10971. }
  10972. public VoiceSet(string type, string state, string personal, string level, string[] files)
  10973. : this((VoiceType)Enum.Parse(typeof(VoiceType), type, true), int.Parse(state), personal, int.Parse(level), files)
  10974. {
  10975. }
  10976. public VoiceSet(string type, string state, string personal, string level)
  10977. : this((VoiceType)Enum.Parse(typeof(VoiceType), type, true), int.Parse(state), personal, int.Parse(level), new string[0])
  10978. {
  10979. }
  10980. }
  10981. public static List<VoiceSet> voiceTable = new List<VoiceSet>();
  10982. public static void LoadCsv()
  10983. {
  10984. // 他プロセスが開いていても読み込む
  10985. using (FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
  10986. {
  10987. using (StreamReader sr = new StreamReader(fs, new System.Text.UTF8Encoding(true)))
  10988. {
  10989. voiceTable = new List<VoiceSet>();
  10990. int i = 0;
  10991. while (sr.Peek() > -1)
  10992. {
  10993. i++;
  10994. List<string> lineData = new List<string>();
  10995. string m = sr.ReadLine();
  10996. if (i <= 1)
  10997. continue; // ヘッダーを飛ばす
  10998. string[] values = m.Split(new char[] { ',', '\t' });
  10999. try
  11000. {
  11001. // パラメータ
  11002. var set = new VoiceSet(values[0], values[1], values[2], values[3]);
  11003. // ファイルリスト
  11004. if (values.Length > 4)
  11005. {
  11006. int emplen = 0;
  11007. for (int j = values.Length - 1; j > 4; j--)
  11008. {
  11009. if (string.IsNullOrEmpty(values[j]))
  11010. emplen++;
  11011. else
  11012. break;
  11013. }
  11014. set.Files = new string[values.Length - 4 - emplen];
  11015. Array.Copy(values, 4, set.Files, 0, set.Files.Length);
  11016. }
  11017. voiceTable.Add(set);
  11018. }
  11019. catch (Exception e)
  11020. {
  11021. Console.WriteLine("CSV読込エラー 行:{0} " + m, i);
  11022. Console.WriteLine(" : " + e.Message);
  11023. }
  11024. }
  11025. sr.Close();
  11026. }
  11027. }
  11028. }
  11029. public static VoiceSet GetVoiceSet(NewVoiceTable.VoiceSet.VoiceType VoiceType, int State, string Personal, int Level)
  11030. {
  11031. var get = voiceTable.FirstOrDefault(x =>
  11032. x.MyType == VoiceType &&
  11033. x.State == State &&
  11034. x.Personal == Personal &&
  11035. x.Level == Level);
  11036. if (get == null)
  11037. {
  11038. Console.WriteLine("ボイスセットが見つかりません {0}, {1}, {2}, {3}", VoiceType, State, Personal, Level);
  11039. }
  11040. #if DEBUG
  11041. else
  11042. {
  11043. Console.WriteLine("ボイスセット {0}, {1}, {2}, {3}, " + string.Join(",", get.Files), VoiceType, State, Personal, Level);
  11044. }
  11045. #endif
  11046. return get;
  11047. }
  11048. }
  11049. #endregion
  11050. public class VymModule
  11051. {
  11052. // 興奮度管理
  11053. private static int vExciteLevel = 1; // 0~300の興奮度を、1~4の興奮レベルに変換した値
  11054. private static double iCurrentExcite = 0; // 現在興奮値
  11055. private static int OrgasmVoice = 0; // 絶頂時音声フラグ
  11056. private static int vStateMajor = 10; // 強弱によるステート
  11057. //private int vOrgasmCount = 0; // 絶頂回数
  11058. public class vMaidParam
  11059. {
  11060. public int vOrgasmCmb = 0; // 連続絶頂回数
  11061. public int iExcite_Old = 0;
  11062. public int vStateMajor_Old = 10;
  11063. public bool faceanimeChanged = true; //最初に表情を切り替えるようにtrue
  11064. }
  11065. public static Dictionary<Maid, vMaidParam> maidParam = new Dictionary<Maid, vMaidParam>();
  11066. //改変 表情管理(バイブ)
  11067. public static int vStateAltTime1VBase = 120; // フェイスアニメの変化時間1(秒)(20→21の遷移、40→41の遷移)
  11068. public static int vStateAltTime2VBase = 180; // フェイスアニメの変化時間2(秒)(30におけるランダム再遷移)
  11069. public static int vStateAltTime1VRandomExtend = 120; // 変化時間1へのランダム加算(秒)
  11070. public static int vStateAltTime2VRandomExtend = 180; // 変化時間2へのランダム加算(秒)
  11071. public static float fAnimeFadeTimeV = 1.0f; // バイブモードのフェイスアニメ等のフェード時間(秒)
  11072. private static bool vMaidStun = false;
  11073. //ランダムボイス被り防止
  11074. //private static int[] iRandomVoiceBackup = new int[] { -1, -1, -1, -1, -1 };
  11075. //複数メイド対応型
  11076. private static Dictionary<int, Dictionary<Maid, int>> iRandomVoiceBackup = new Dictionary<int, Dictionary<Maid, int>>
  11077. {
  11078. { 0, new Dictionary<Maid , int>() },
  11079. { 1, new Dictionary<Maid , int>() },
  11080. { 2, new Dictionary<Maid , int>() },
  11081. { 3, new Dictionary<Maid , int>() },
  11082. { 4, new Dictionary<Maid , int>() },
  11083. };
  11084. //表情バックアップ
  11085. private static Dictionary<Maid, string> sFaceBackup = new Dictionary<Maid, string>();
  11086. private static Dictionary<Maid, string> sFace3Backup = new Dictionary<Maid, string>();
  11087. public enum VoiceMode
  11088. {
  11089. オートモード,
  11090. 通常固定,
  11091. 舐め固定,
  11092. カスタム1,
  11093. カスタム2,
  11094. カスタム3,
  11095. カスタム4,
  11096. }
  11097. #region ini設定用
  11098. // 設定クラス(Iniファイルで読み書きしたい変数はここに格納する)
  11099. public class VibeYourMaidConfig
  11100. { //@API実装//→API用にpublicに変更
  11101. public int vExciteLevelThresholdV1 = 100; // 興奮レベル1→2閾値
  11102. public int vExciteLevelThresholdV2 = 200; //180 // 興奮レベル2→3閾値
  11103. public int vExciteLevelThresholdV3 = 250; // 興奮レベル3→4閾値
  11104. public int iYodareAppearLevelV = 3; // 所定の興奮レベル以上でよだれをつける(1~4のどれかを入れる、0で無効)
  11105. public int vStateMajor30Threshold = 200; // Voice20→30しきい値
  11106. public bool NamidaEnabled = false;
  11107. public bool HohoEnabled = true;
  11108. public bool YodareEnabled = false;
  11109. public float fAnimeFadeTimeV = 1.0f; // バイブモードのフェイスアニメ等のフェード時間(秒)
  11110. public VoiceMode eVoiceMode = VoiceMode.オートモード;
  11111. public string sFaceAnimeYotogiDefault = "エロ好感1";
  11112. // 表情テーブル (バイブ)
  11113. public string[][] sFaceAnime20Vibe = new string[][] {
  11114. new string[] { "困った" , "ダンス困り顔" , "恥ずかしい" , "苦笑い" , "引きつり笑顔" , "まぶたギュ" },
  11115. new string[] { "困った" , "ダンス困り顔" , "恥ずかしい" , "苦笑い" , "引きつり笑顔" , "まぶたギュ" },
  11116. new string[] { "怒り" , "興奮射精後1" , "発情" , "エロ痛み2" , "引きつり笑顔" , "エロ我慢3" },
  11117. new string[] { "怒り" , "興奮射精後1" , "発情" , "エロ痛み2" , "引きつり笑顔" , "エロ我慢3" }
  11118. };
  11119. public string[][] sFaceAnime30Vibe = new string[][] {
  11120. new string[] { "エロ痛み1" , "エロ痛み2" , "エロ我慢1" , "エロ我慢2" , "泣き" , "怒り" },
  11121. new string[] { "エロ痛み1" , "エロ痛み2" , "エロ我慢1" , "エロ我慢2" , "泣き" , "怒り" },
  11122. new string[] { "エロ痛み我慢" , "エロ痛み我慢2" , "エロ痛み我慢3" , "エロメソ泣き" , "エロ羞恥3" , "エロ我慢3" },
  11123. new string[] { "エロ痛み我慢" , "エロ痛み我慢2" , "エロ痛み我慢3" , "エロメソ泣き" , "エロ羞恥3" , "エロ我慢3" }
  11124. };
  11125. public string[] sFaceAnime40Vibe = new string[] { "少し怒り", "思案伏せ目", "まぶたギュ", "エロメソ泣き" };
  11126. public string[] sFaceAnimeStun = new string[] { "絶頂射精後1", "興奮射精後1", "エロメソ泣き", "エロ痛み2", "エロ我慢3", "引きつり笑顔", "エロ通常3", "泣き" };
  11127. }
  11128. #region Legacy
  11129. // v0027でiniよりボイステーブルを分離
  11130. public static VoiceTableLegacy voiceLegacy = new VoiceTableLegacy();
  11131. // 旧ボイステーブル、移行&CSV生成用
  11132. public class VoiceTableLegacy
  11133. {
  11134. // 性格別声テーブル 弱バイブ版---------------------------------------------------------------
  11135. //通常
  11136. public string[][] sLoopVoice20PrideVibe = new string[][] {
  11137. new string[] { "s0_01236.ogg" , "s0_01237.ogg" , "s0_01238.ogg" , "s0_01239.ogg" },
  11138. new string[] { "s0_01236.ogg" , "s0_01237.ogg" , "s0_01238.ogg" , "s0_01239.ogg" },
  11139. new string[] { "s0_01236.ogg" , "s0_01237.ogg" , "s0_01238.ogg" , "s0_01239.ogg" },
  11140. new string[] { "s0_01236.ogg" , "s0_01237.ogg" , "s0_01238.ogg" , "s0_01239.ogg" },
  11141. new string[] { "s0_01236.ogg" , "s0_01237.ogg" , "s0_01238.ogg" , "s0_01239.ogg" }
  11142. };
  11143. public string[][] sLoopVoice20CoolVibe = new string[][] {
  11144. new string[] { "s1_02396.ogg" , "s1_02390.ogg" , "s1_02391.ogg" , "s1_02392.ogg" },
  11145. new string[] { "s1_02396.ogg" , "s1_02390.ogg" , "s1_02391.ogg" , "s1_02392.ogg" },
  11146. new string[] { "s1_02396.ogg" , "s1_02390.ogg" , "s1_02391.ogg" , "s1_02392.ogg" },
  11147. new string[] { "s1_02396.ogg" , "s1_02390.ogg" , "s1_02391.ogg" , "s1_02392.ogg" },
  11148. new string[] { "s1_02396.ogg" , "s1_02390.ogg" , "s1_02391.ogg" , "s1_02392.ogg" }
  11149. };
  11150. public string[][] sLoopVoice20PureVibe = new string[][] {
  11151. new string[] { "s2_01235.ogg" , "s2_01236.ogg" , "s2_01237.ogg" , "s2_01238.ogg" },
  11152. new string[] { "s2_01235.ogg" , "s2_01236.ogg" , "s2_01237.ogg" , "s2_01238.ogg" },
  11153. new string[] { "s2_01235.ogg" , "s2_01236.ogg" , "s2_01237.ogg" , "s2_01238.ogg" },
  11154. new string[] { "s2_01235.ogg" , "s2_01236.ogg" , "s2_01237.ogg" , "s2_01238.ogg" },
  11155. new string[] { "s2_01235.ogg" , "s2_01236.ogg" , "s2_01237.ogg" , "s2_01238.ogg" }
  11156. };
  11157. public string[][] sLoopVoice20YandereVibe = new string[][] {
  11158. new string[] { "s3_02767.ogg" , "s3_02768.ogg" , "s3_02769.ogg" , "s3_02770.ogg" },
  11159. new string[] { "s3_02767.ogg" , "s3_02768.ogg" , "s3_02769.ogg" , "s3_02770.ogg" },
  11160. new string[] { "s3_02767.ogg" , "s3_02768.ogg" , "s3_02769.ogg" , "s3_02770.ogg" },
  11161. new string[] { "s3_02767.ogg" , "s3_02768.ogg" , "s3_02769.ogg" , "s3_02770.ogg" },
  11162. new string[] { "s3_02767.ogg" , "s3_02768.ogg" , "s3_02769.ogg" , "s3_02770.ogg" }
  11163. };
  11164. public string[][] sLoopVoice20AnesanVibe = new string[][] {
  11165. new string[] { "s4_08211.ogg" , "s4_08212.ogg" , "s4_08213.ogg" , "s4_08214.ogg" },
  11166. new string[] { "s4_08211.ogg" , "s4_08212.ogg" , "s4_08213.ogg" , "s4_08214.ogg" },
  11167. new string[] { "s4_08211.ogg" , "s4_08212.ogg" , "s4_08213.ogg" , "s4_08214.ogg" },
  11168. new string[] { "s4_08211.ogg" , "s4_08212.ogg" , "s4_08213.ogg" , "s4_08214.ogg" },
  11169. new string[] { "s4_08211.ogg" , "s4_08212.ogg" , "s4_08213.ogg" , "s4_08214.ogg" }
  11170. };
  11171. public string[][] sLoopVoice20GenkiVibe = new string[][] {
  11172. new string[] { "s5_04127.ogg" , "s5_04129.ogg" , "s5_04130.ogg" , "s5_04131.ogg" },
  11173. new string[] { "s5_04127.ogg" , "s5_04048.ogg" , "s5_04130.ogg" , "s5_04048.ogg" },
  11174. new string[] { "s5_04133.ogg" , "s5_04134.ogg" , "s5_04047.ogg" , "s5_04048.ogg" },
  11175. new string[] { "s5_04133.ogg" , "s5_04134.ogg" , "s5_04047.ogg" , "s5_04131.ogg" },
  11176. new string[] { "s5_04133.ogg" , "s5_04134.ogg" , "s5_04047.ogg" , "s5_04131.ogg" }
  11177. };
  11178. public string[][] sLoopVoice20SadistVibe = new string[][] {
  11179. new string[] { "S6_02244.ogg" , "S6_02180.ogg" , "S6_02181.ogg" , "S6_02245.ogg" },
  11180. new string[] { "S6_02179.ogg" , "S6_02243.ogg" , "S6_02246.ogg" , "S6_02182.ogg" },
  11181. new string[] { "S6_02179.ogg" , "S6_02183.ogg" , "S6_02246.ogg" , "S6_02247.ogg" },
  11182. new string[] { "S6_02183.ogg" , "S6_02184.ogg" , "S6_02246.ogg" , "S6_02247.ogg" },
  11183. new string[] { "S6_02179.ogg" , "S6_02180.ogg" , "S6_02181.ogg" , "S6_02182.ogg" }
  11184. };
  11185. #if COM3D2
  11186. // オダメ追加分
  11187. public string[][] sLoopVoice20MukuVibe = new string[][] {
  11188. new string[] { "s2_01235.ogg" , "s2_01236.ogg" , "s2_01237.ogg" , "s2_01238.ogg" },
  11189. new string[] { "s2_01235.ogg" , "s2_01236.ogg" , "s2_01237.ogg" , "s2_01238.ogg" },
  11190. new string[] { "s2_01235.ogg" , "s2_01236.ogg" , "s2_01237.ogg" , "s2_01238.ogg" },
  11191. new string[] { "s2_01235.ogg" , "s2_01236.ogg" , "s2_01237.ogg" , "s2_01238.ogg" },
  11192. new string[] { "s2_01235.ogg" , "s2_01236.ogg" , "s2_01237.ogg" , "s2_01238.ogg" }
  11193. };
  11194. public string[][] sLoopVoice20MajimeVibe = new string[][] {
  11195. new string[] { "s1_02396.ogg" , "s1_02390.ogg" , "s1_02391.ogg" , "s1_02392.ogg" },
  11196. new string[] { "s1_02396.ogg" , "s1_02390.ogg" , "s1_02391.ogg" , "s1_02392.ogg" },
  11197. new string[] { "s1_02396.ogg" , "s1_02390.ogg" , "s1_02391.ogg" , "s1_02392.ogg" },
  11198. new string[] { "s1_02396.ogg" , "s1_02390.ogg" , "s1_02391.ogg" , "s1_02392.ogg" },
  11199. new string[] { "s1_02396.ogg" , "s1_02390.ogg" , "s1_02391.ogg" , "s1_02392.ogg" }
  11200. };
  11201. public string[][] sLoopVoice20RindereVibe = new string[][] {
  11202. new string[] { "s0_01236.ogg" , "s0_01237.ogg" , "s0_01238.ogg" , "s0_01239.ogg" },
  11203. new string[] { "s0_01236.ogg" , "s0_01237.ogg" , "s0_01238.ogg" , "s0_01239.ogg" },
  11204. new string[] { "s0_01236.ogg" , "s0_01237.ogg" , "s0_01238.ogg" , "s0_01239.ogg" },
  11205. new string[] { "s0_01236.ogg" , "s0_01237.ogg" , "s0_01238.ogg" , "s0_01239.ogg" },
  11206. new string[] { "s0_01236.ogg" , "s0_01237.ogg" , "s0_01238.ogg" , "s0_01239.ogg" }
  11207. };
  11208. #endif
  11209. //-----------------------------------------------------------------------------------
  11210. //フェラ
  11211. public string[][] sLoopVoice20PrideFera = new string[][] {
  11212. new string[] { "S0_01383.ogg" , "S0_01367.ogg" , "S0_01384.ogg" , "S0_01369.ogg" },
  11213. new string[] { "S0_01383.ogg" , "S0_01367.ogg" , "S0_01384.ogg" , "S0_01369.ogg" },
  11214. new string[] { "S0_01383.ogg" , "S0_01367.ogg" , "S0_01384.ogg" , "S0_01369.ogg" },
  11215. new string[] { "S0_01383.ogg" , "S0_01367.ogg" , "S0_01384.ogg" , "S0_01369.ogg" },
  11216. new string[] { "S0_01383.ogg" , "S0_01367.ogg" , "S0_01384.ogg" , "S0_01369.ogg" }
  11217. };
  11218. public string[][] sLoopVoice20CoolFera = new string[][] {
  11219. new string[] { "S1_02455.ogg" , "S1_02440.ogg" , "S1_02457.ogg" , "S1_02442.ogg" },
  11220. new string[] { "S1_02455.ogg" , "S1_02440.ogg" , "S1_02457.ogg" , "S1_02442.ogg" },
  11221. new string[] { "S1_02455.ogg" , "S1_02440.ogg" , "S1_02457.ogg" , "S1_02442.ogg" },
  11222. new string[] { "S1_02455.ogg" , "S1_02440.ogg" , "S1_02457.ogg" , "S1_02442.ogg" },
  11223. new string[] { "S1_02455.ogg" , "S1_02440.ogg" , "S1_02457.ogg" , "S1_02442.ogg" }
  11224. };
  11225. public string[][] sLoopVoice20PureFera = new string[][] {
  11226. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11227. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11228. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11229. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11230. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" }
  11231. };
  11232. public string[][] sLoopVoice20YandereFera = new string[][] {
  11233. new string[] { "S3_02833.ogg" , "S3_02818.ogg" , "S3_02835.ogg" , "S3_02820.ogg" },
  11234. new string[] { "S3_02833.ogg" , "S3_02818.ogg" , "S3_02835.ogg" , "S3_02820.ogg" },
  11235. new string[] { "S3_02833.ogg" , "S3_02818.ogg" , "S3_02835.ogg" , "S3_02820.ogg" },
  11236. new string[] { "S3_02833.ogg" , "S3_02818.ogg" , "S3_02835.ogg" , "S3_02820.ogg" },
  11237. new string[] { "S3_02833.ogg" , "S3_02818.ogg" , "S3_02835.ogg" , "S3_02820.ogg" }
  11238. };
  11239. public string[][] sLoopVoice20AnesanFera = new string[][] {
  11240. new string[] { "S4_08241.ogg" , "S4_08258.ogg" , "S4_08243.ogg" , "S4_08259.ogg" },
  11241. new string[] { "S4_08241.ogg" , "S4_08258.ogg" , "S4_08243.ogg" , "S4_08259.ogg" },
  11242. new string[] { "S4_08241.ogg" , "S4_08258.ogg" , "S4_08243.ogg" , "S4_08259.ogg" },
  11243. new string[] { "S4_08241.ogg" , "S4_08258.ogg" , "S4_08243.ogg" , "S4_08259.ogg" },
  11244. new string[] { "S4_08241.ogg" , "S4_08258.ogg" , "S4_08243.ogg" , "S4_08259.ogg" }
  11245. };
  11246. public string[][] sLoopVoice20GenkiFera = new string[][] {
  11247. new string[] { "S5_04163.ogg" , "S5_04162.ogg" , "S5_04179.ogg" , "S5_04181.ogg" },
  11248. new string[] { "S5_04163.ogg" , "S5_04162.ogg" , "S5_04179.ogg" , "S5_04181.ogg" },
  11249. new string[] { "S5_04163.ogg" , "S5_04162.ogg" , "S5_04179.ogg" , "s5_04174.ogg" },
  11250. new string[] { "S5_04163.ogg" , "S5_04162.ogg" , "S5_04179.ogg" , "s5_04174.ogg" },
  11251. new string[] { "S5_04163.ogg" , "S5_04162.ogg" , "S5_04179.ogg" , "s5_04174.ogg" }
  11252. };
  11253. public string[][] sLoopVoice20SadistFera = new string[][] {
  11254. new string[] { "S6_02219.ogg" , "S6_02220.ogg" , "S6_02221.ogg" , "S6_02222.ogg" },
  11255. new string[] { "S6_02219.ogg" , "S6_02220.ogg" , "S6_02221.ogg" , "S6_02222.ogg" },
  11256. new string[] { "S6_02219.ogg" , "S6_02220.ogg" , "S6_02221.ogg" , "S6_02222.ogg" },
  11257. new string[] { "S6_02219.ogg" , "S6_02220.ogg" , "S6_02221.ogg" , "S6_02222.ogg" },
  11258. new string[] { "S6_02219.ogg" , "S6_02220.ogg" , "S6_02221.ogg" , "S6_02222.ogg" }
  11259. };
  11260. #if COM3D2
  11261. // オダメ追加分
  11262. public string[][] sLoopVoice20MukuFera = new string[][] {
  11263. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11264. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11265. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11266. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11267. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" }
  11268. };
  11269. public string[][] sLoopVoice20MajimeFera = new string[][] {
  11270. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11271. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11272. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11273. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11274. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" }
  11275. };
  11276. public string[][] sLoopVoice20RindereFera = new string[][] {
  11277. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11278. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11279. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11280. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" },
  11281. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" }
  11282. };
  11283. #endif
  11284. //-----------------------------------------------------------------------------------
  11285. //カスタムボイス1
  11286. public string[][] sLoopVoice20Custom1 = new string[][] {
  11287. new string[] { "N0_00435.ogg" , "N0_00449.ogg" },
  11288. new string[] { "N0_00435.ogg" , "N0_00449.ogg" },
  11289. new string[] { "N0_00435.ogg" , "N0_00449.ogg" },
  11290. new string[] { "N0_00435.ogg" , "N0_00449.ogg" },
  11291. new string[] { "N0_00435.ogg" , "N0_00449.ogg" }
  11292. };
  11293. //カスタムボイス2
  11294. public string[][] sLoopVoice20Custom2 = new string[][] {
  11295. new string[] { "N7_00262.ogg" , "N7_00267.ogg" , "N7_00269.ogg" , "N7_00272.ogg" },
  11296. new string[] { "N7_00262.ogg" , "N7_00267.ogg" , "N7_00269.ogg" , "N7_00272.ogg" },
  11297. new string[] { "N7_00262.ogg" , "N7_00267.ogg" , "N7_00269.ogg" , "N7_00272.ogg" },
  11298. new string[] { "N7_00262.ogg" , "N7_00267.ogg" , "N7_00269.ogg" , "N7_00272.ogg" },
  11299. new string[] { "N7_00262.ogg" , "N7_00267.ogg" , "N7_00269.ogg" , "N7_00272.ogg" }
  11300. };
  11301. //カスタムボイス3
  11302. public string[][] sLoopVoice20Custom3 = new string[][] {
  11303. new string[] { "N1_00170.ogg" , "N1_00191.ogg" , "N1_00192.ogg" , "N1_00194.ogg" },
  11304. new string[] { "N1_00170.ogg" , "N1_00191.ogg" , "N1_00192.ogg" , "N1_00194.ogg" },
  11305. new string[] { "N1_00170.ogg" , "N1_00191.ogg" , "N1_00192.ogg" , "N1_00194.ogg" },
  11306. new string[] { "N1_00170.ogg" , "N1_00191.ogg" , "N1_00192.ogg" , "N1_00194.ogg" },
  11307. new string[] { "N1_00170.ogg" , "N1_00191.ogg" , "N1_00192.ogg" , "N1_00194.ogg" }
  11308. };
  11309. //カスタムボイス4
  11310. public string[][] sLoopVoice20Custom4 = new string[][] {
  11311. new string[] { "N3_00157.ogg" , "N3_00370.ogg" },
  11312. new string[] { "N3_00157.ogg" , "N3_00370.ogg" },
  11313. new string[] { "N3_00157.ogg" , "N3_00370.ogg" },
  11314. new string[] { "N3_00157.ogg" , "N3_00370.ogg" },
  11315. new string[] { "N3_00157.ogg" , "N3_00370.ogg" }
  11316. };
  11317. // 性格別声テーブル 強バイブ版---------------------------------------------------------------
  11318. //通常
  11319. public string[][] sLoopVoice30PrideVibe = new string[][] {
  11320. new string[] { "s0_01326.ogg" , "s0_01327.ogg" , "s0_01330.ogg" , "s0_01331.ogg" },
  11321. new string[] { "s0_01326.ogg" , "s0_01327.ogg" , "s0_01330.ogg" , "s0_01331.ogg" },
  11322. new string[] { "s0_01326.ogg" , "s0_01327.ogg" , "s0_01330.ogg" , "s0_01331.ogg" },
  11323. new string[] { "s0_01326.ogg" , "s0_01327.ogg" , "s0_01330.ogg" , "s0_01331.ogg" },
  11324. new string[] { "s0_01236.ogg" , "s0_01237.ogg" , "s0_01238.ogg" , "s0_01239.ogg" }
  11325. };
  11326. public string[][] sLoopVoice30CoolVibe = new string[][] {
  11327. new string[] { "s1_02401.ogg" , "s1_02400.ogg" , "s1_02402.ogg" , "s1_02404.ogg" },
  11328. new string[] { "s1_02401.ogg" , "s1_02400.ogg" , "s1_02402.ogg" , "s1_02404.ogg" },
  11329. new string[] { "s1_02401.ogg" , "s1_02400.ogg" , "s1_02402.ogg" , "s1_02404.ogg" },
  11330. new string[] { "s1_02401.ogg" , "s1_02400.ogg" , "s1_02402.ogg" , "s1_02404.ogg" },
  11331. new string[] { "s1_02396.ogg" , "s1_02390.ogg" , "s1_02391.ogg" , "s1_02392.ogg" }
  11332. };
  11333. public string[][] sLoopVoice30PureVibe = new string[][] {
  11334. new string[] { "s2_01185.ogg" , "s2_01186.ogg" , "s2_01187.ogg" , "s2_01188.ogg" },
  11335. new string[] { "s2_01185.ogg" , "s2_01186.ogg" , "s2_01187.ogg" , "s2_01188.ogg" },
  11336. new string[] { "s2_01185.ogg" , "s2_01186.ogg" , "s2_01187.ogg" , "s2_01188.ogg" },
  11337. new string[] { "s2_01185.ogg" , "s2_01186.ogg" , "s2_01187.ogg" , "s2_01188.ogg" },
  11338. new string[] { "s2_01235.ogg" , "s2_01236.ogg" , "s2_01237.ogg" , "s2_01238.ogg" }
  11339. };
  11340. public string[][] sLoopVoice30YandereVibe = new string[][] {
  11341. new string[] { "s3_02797.ogg" , "s3_02798.ogg" , "s3_02691.ogg" , "s3_02796.ogg" },
  11342. new string[] { "s3_02797.ogg" , "s3_02798.ogg" , "s3_02691.ogg" , "s3_02796.ogg" },
  11343. new string[] { "s3_02797.ogg" , "s3_02798.ogg" , "s3_02691.ogg" , "s3_02796.ogg" },
  11344. new string[] { "s3_02797.ogg" , "s3_02798.ogg" , "s3_02691.ogg" , "s3_02796.ogg" },
  11345. new string[] { "s3_02767.ogg" , "s3_02768.ogg" , "s3_02769.ogg" , "s3_02770.ogg" }
  11346. };
  11347. public string[][] sLoopVoice30AnesanVibe = new string[][] {
  11348. new string[] { "s4_08140.ogg" , "s4_08141.ogg" , "s4_08142.ogg" , "s4_08145.ogg" },
  11349. new string[] { "s4_08140.ogg" , "s4_08141.ogg" , "s4_08142.ogg" , "s4_08145.ogg" },
  11350. new string[] { "s4_08140.ogg" , "s4_08141.ogg" , "s4_08149.ogg" , "s4_08150.ogg" },
  11351. new string[] { "s4_08140.ogg" , "s4_08134.ogg" , "s4_08149.ogg" , "s4_08150.ogg" },
  11352. new string[] { "s4_08211.ogg" , "s4_08212.ogg" , "s4_08213.ogg" , "s4_08214.ogg" }
  11353. };
  11354. public string[][] sLoopVoice30GenkiVibe = new string[][] {
  11355. new string[] { "s5_04133.ogg" , "s5_04058.ogg" , "s5_04055.ogg" , "s5_04050.ogg" },
  11356. new string[] { "s5_04133.ogg" , "s5_04058.ogg" , "s5_04055.ogg" , "s5_04050.ogg" },
  11357. new string[] { "s5_04051.ogg" , "s5_04055.ogg" , "s5_04054.ogg" , "s5_04052.ogg" },
  11358. new string[] { "s5_04055.ogg" , "s5_04061.ogg" , "s5_04054.ogg" , "s5_04052.ogg" },
  11359. new string[] { "s5_04133.ogg" , "s5_04134.ogg" , "s5_04047.ogg" , "s5_04131.ogg" }
  11360. };
  11361. public string[][] sLoopVoice30SadistVibe = new string[][] {
  11362. new string[] { "S6_02183.ogg" , "S6_02184.ogg" , "S6_02246.ogg" , "S6_02247.ogg" },
  11363. new string[] { "S6_02183.ogg" , "S6_02184.ogg" , "S6_02246.ogg" , "S6_02247.ogg" },
  11364. new string[] { "S6_02248.ogg" , "S6_02184.ogg" , "S6_02185.ogg" , "S6_02249.ogg" },
  11365. new string[] { "S6_02249.ogg" , "S6_02250.ogg" , "S6_02185.ogg" , "S6_02186.ogg" },
  11366. new string[] { "S6_02243.ogg" , "S6_02244.ogg" , "S6_02245.ogg" , "S6_02246.ogg" }
  11367. };
  11368. #if COM3D2
  11369. // オダメ追加分
  11370. public string[][] sLoopVoice30MukuVibe = new string[][] {
  11371. new string[] { "s2_01185.ogg" , "s2_01186.ogg" , "s2_01187.ogg" , "s2_01188.ogg" },
  11372. new string[] { "s2_01185.ogg" , "s2_01186.ogg" , "s2_01187.ogg" , "s2_01188.ogg" },
  11373. new string[] { "s2_01185.ogg" , "s2_01186.ogg" , "s2_01187.ogg" , "s2_01188.ogg" },
  11374. new string[] { "s2_01185.ogg" , "s2_01186.ogg" , "s2_01187.ogg" , "s2_01188.ogg" },
  11375. new string[] { "s2_01235.ogg" , "s2_01236.ogg" , "s2_01237.ogg" , "s2_01238.ogg" }
  11376. };
  11377. public string[][] sLoopVoice30MajimeVibe = new string[][] {
  11378. new string[] { "s1_02401.ogg" , "s1_02400.ogg" , "s1_02402.ogg" , "s1_02404.ogg" },
  11379. new string[] { "s1_02401.ogg" , "s1_02400.ogg" , "s1_02402.ogg" , "s1_02404.ogg" },
  11380. new string[] { "s1_02401.ogg" , "s1_02400.ogg" , "s1_02402.ogg" , "s1_02404.ogg" },
  11381. new string[] { "s1_02401.ogg" , "s1_02400.ogg" , "s1_02402.ogg" , "s1_02404.ogg" },
  11382. new string[] { "s1_02396.ogg" , "s1_02390.ogg" , "s1_02391.ogg" , "s1_02392.ogg" }
  11383. };
  11384. public string[][] sLoopVoice30RindereVibe = new string[][] {
  11385. new string[] { "s0_01326.ogg" , "s0_01327.ogg" , "s0_01330.ogg" , "s0_01331.ogg" },
  11386. new string[] { "s0_01326.ogg" , "s0_01327.ogg" , "s0_01330.ogg" , "s0_01331.ogg" },
  11387. new string[] { "s0_01326.ogg" , "s0_01327.ogg" , "s0_01330.ogg" , "s0_01331.ogg" },
  11388. new string[] { "s0_01326.ogg" , "s0_01327.ogg" , "s0_01330.ogg" , "s0_01331.ogg" },
  11389. new string[] { "s0_01236.ogg" , "s0_01237.ogg" , "s0_01238.ogg" , "s0_01239.ogg" }
  11390. };
  11391. #endif
  11392. //-----------------------------------------------------------------------------------
  11393. //フェラ
  11394. public string[][] sLoopVoice30PrideFera = new string[][] {
  11395. new string[] { "S0_01385.ogg" , "S0_01371.ogg" , "S0_01386.ogg" , "S0_01387.ogg" },
  11396. new string[] { "S0_01385.ogg" , "S0_01371.ogg" , "S0_01386.ogg" , "S0_01387.ogg" },
  11397. new string[] { "S0_01385.ogg" , "S0_01371.ogg" , "S0_01386.ogg" , "S0_01387.ogg" },
  11398. new string[] { "S0_01385.ogg" , "S0_01371.ogg" , "S0_01386.ogg" , "S0_01387.ogg" },
  11399. new string[] { "S0_01383.ogg" , "S0_01367.ogg" , "S0_01384.ogg" , "S0_01369.ogg" }
  11400. };
  11401. public string[][] sLoopVoice30CoolFera = new string[][] {
  11402. new string[] { "S1_02458.ogg" , "S1_02459.ogg" , "S1_02444.ogg" , "S1_02460.ogg" },
  11403. new string[] { "S1_02458.ogg" , "S1_02459.ogg" , "S1_02444.ogg" , "S1_02460.ogg" },
  11404. new string[] { "S1_02458.ogg" , "S1_02459.ogg" , "S1_02444.ogg" , "S1_02460.ogg" },
  11405. new string[] { "S1_02458.ogg" , "S1_02459.ogg" , "S1_02444.ogg" , "S1_02460.ogg" },
  11406. new string[] { "S1_02455.ogg" , "S1_02440.ogg" , "S1_02457.ogg" , "S1_02442.ogg" }
  11407. };
  11408. public string[][] sLoopVoice30PureFera = new string[][] {
  11409. new string[] { "S2_01299.ogg" , "S2_01300.ogg" , "S2_01285.ogg" , "S2_01301.ogg" },
  11410. new string[] { "S2_01299.ogg" , "S2_01300.ogg" , "S2_01285.ogg" , "S2_01301.ogg" },
  11411. new string[] { "S2_01299.ogg" , "S2_01300.ogg" , "S2_01285.ogg" , "S2_01301.ogg" },
  11412. new string[] { "S2_01299.ogg" , "S2_01300.ogg" , "S2_01285.ogg" , "S2_01301.ogg" },
  11413. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" }
  11414. };
  11415. public string[][] sLoopVoice30YandereFera = new string[][] {
  11416. new string[] { "S3_02836.ogg" , "S3_02837.ogg" , "S3_02822.ogg" , "S3_02838.ogg" },
  11417. new string[] { "S3_02836.ogg" , "S3_02837.ogg" , "S3_02822.ogg" , "S3_02838.ogg" },
  11418. new string[] { "S3_02836.ogg" , "S3_02837.ogg" , "S3_02822.ogg" , "S3_02838.ogg" },
  11419. new string[] { "S3_02836.ogg" , "S3_02837.ogg" , "S3_02822.ogg" , "S3_02838.ogg" },
  11420. new string[] { "S3_02833.ogg" , "S3_02818.ogg" , "S3_02835.ogg" , "S3_02820.ogg" }
  11421. };
  11422. public string[][] sLoopVoice30AnesanFera = new string[][] {
  11423. new string[] { "S4_08244.ogg" , "S4_08245.ogg" , "S4_08262.ogg" , "S4_08246.ogg" },
  11424. new string[] { "S4_08244.ogg" , "S4_08245.ogg" , "S4_08262.ogg" , "S4_08246.ogg" },
  11425. new string[] { "S4_08244.ogg" , "S4_08245.ogg" , "S4_08262.ogg" , "S4_08246.ogg" },
  11426. new string[] { "S4_08244.ogg" , "S4_08245.ogg" , "S4_08262.ogg" , "S4_08246.ogg" },
  11427. new string[] { "S4_08241.ogg" , "S4_08258.ogg" , "S4_08243.ogg" , "S4_08259.ogg" }
  11428. };
  11429. public string[][] sLoopVoice30GenkiFera = new string[][] {
  11430. new string[] { "S5_04093.ogg" , "S5_04094.ogg" , "S5_04102.ogg" , "S5_04100.ogg" },
  11431. new string[] { "S5_04093.ogg" , "S5_04094.ogg" , "S5_04102.ogg" , "S5_04100.ogg" },
  11432. new string[] { "S5_04093.ogg" , "S5_04094.ogg" , "S5_04102.ogg" , "S5_04100.ogg" },
  11433. new string[] { "S5_04093.ogg" , "S5_04094.ogg" , "S5_04102.ogg" , "S5_04100.ogg" },
  11434. new string[] { "S5_04163.ogg" , "S5_04162.ogg" , "S5_04179.ogg" , "s5_04174.ogg" }
  11435. };
  11436. public string[][] sLoopVoice30SadistFera = new string[][] {
  11437. new string[] { "S6_02223.ogg" , "S6_02224.ogg" , "S6_02225.ogg" , "S6_02226.ogg" },
  11438. new string[] { "S6_02223.ogg" , "S6_02224.ogg" , "S6_02225.ogg" , "S6_02226.ogg" },
  11439. new string[] { "S6_02223.ogg" , "S6_02224.ogg" , "S6_02225.ogg" , "S6_02226.ogg" },
  11440. new string[] { "S6_02223.ogg" , "S6_02224.ogg" , "S6_02225.ogg" , "S6_02226.ogg" },
  11441. new string[] { "S6_02219.ogg" , "S6_02220.ogg" , "S6_02221.ogg" , "S6_02222.ogg" }
  11442. };
  11443. #if COM3D2
  11444. // オダメ追加分
  11445. public string[][] sLoopVoice30RindereFera = new string[][] {
  11446. new string[] { "S0_01385.ogg" , "S0_01371.ogg" , "S0_01386.ogg" , "S0_01387.ogg" },
  11447. new string[] { "S0_01385.ogg" , "S0_01371.ogg" , "S0_01386.ogg" , "S0_01387.ogg" },
  11448. new string[] { "S0_01385.ogg" , "S0_01371.ogg" , "S0_01386.ogg" , "S0_01387.ogg" },
  11449. new string[] { "S0_01385.ogg" , "S0_01371.ogg" , "S0_01386.ogg" , "S0_01387.ogg" },
  11450. new string[] { "S0_01383.ogg" , "S0_01367.ogg" , "S0_01384.ogg" , "S0_01369.ogg" }
  11451. };
  11452. public string[][] sLoopVoice30MajimeFera = new string[][] {
  11453. new string[] { "S1_02458.ogg" , "S1_02459.ogg" , "S1_02444.ogg" , "S1_02460.ogg" },
  11454. new string[] { "S1_02458.ogg" , "S1_02459.ogg" , "S1_02444.ogg" , "S1_02460.ogg" },
  11455. new string[] { "S1_02458.ogg" , "S1_02459.ogg" , "S1_02444.ogg" , "S1_02460.ogg" },
  11456. new string[] { "S1_02458.ogg" , "S1_02459.ogg" , "S1_02444.ogg" , "S1_02460.ogg" },
  11457. new string[] { "S1_02455.ogg" , "S1_02440.ogg" , "S1_02457.ogg" , "S1_02442.ogg" }
  11458. };
  11459. public string[][] sLoopVoice30MukuFera = new string[][] {
  11460. new string[] { "S2_01299.ogg" , "S2_01300.ogg" , "S2_01285.ogg" , "S2_01301.ogg" },
  11461. new string[] { "S2_01299.ogg" , "S2_01300.ogg" , "S2_01285.ogg" , "S2_01301.ogg" },
  11462. new string[] { "S2_01299.ogg" , "S2_01300.ogg" , "S2_01285.ogg" , "S2_01301.ogg" },
  11463. new string[] { "S2_01299.ogg" , "S2_01300.ogg" , "S2_01285.ogg" , "S2_01301.ogg" },
  11464. new string[] { "S2_01296.ogg" , "S2_01281.ogg" , "S2_01298.ogg" , "S2_01282.ogg" }
  11465. };
  11466. #endif
  11467. //-----------------------------------------------------------------------------------
  11468. //カスタムボイス
  11469. public string[][] sLoopVoice30Custom1 = new string[][] {
  11470. new string[] { "N0_00421.ogg" , "N0_00422.ogg" , "N0_00423.ogg" },
  11471. new string[] { "N0_00421.ogg" , "N0_00422.ogg" , "N0_00423.ogg" },
  11472. new string[] { "N0_00421.ogg" , "N0_00422.ogg" , "N0_00423.ogg" },
  11473. new string[] { "N0_00421.ogg" , "N0_00422.ogg" , "N0_00423.ogg" },
  11474. new string[] { "N0_00435.ogg" , "N0_00449.ogg" }
  11475. };
  11476. public string[][] sLoopVoice30Custom2 = new string[][] {
  11477. new string[] { "N7_00252.ogg" , "N7_00255.ogg" , "N7_00267.ogg" , "N7_00261.ogg" },
  11478. new string[] { "N7_00252.ogg" , "N7_00255.ogg" , "N7_00267.ogg" , "N7_00261.ogg" },
  11479. new string[] { "N7_00252.ogg" , "N7_00255.ogg" , "N7_00267.ogg" , "N7_00261.ogg" },
  11480. new string[] { "N7_00252.ogg" , "N7_00255.ogg" , "N7_00267.ogg" , "N7_00261.ogg" },
  11481. new string[] { "N7_00262.ogg" , "N7_00267.ogg" , "N7_00269.ogg" , "N7_00272.ogg" }
  11482. };
  11483. public string[][] sLoopVoice30Custom3 = new string[][] {
  11484. new string[] { "N1_00183.ogg" , "N1_00195.ogg" , "N1_00323.ogg" , "N1_00330.ogg" },
  11485. new string[] { "N1_00183.ogg" , "N1_00195.ogg" , "N1_00323.ogg" , "N1_00330.ogg" },
  11486. new string[] { "N1_00183.ogg" , "N1_00195.ogg" , "N1_00323.ogg" , "N1_00330.ogg" },
  11487. new string[] { "N1_00183.ogg" , "N1_00195.ogg" , "N1_00323.ogg" , "N1_00330.ogg" },
  11488. new string[] { "N1_00170.ogg" , "N1_00191.ogg" , "N1_00192.ogg" , "N1_00194.ogg" }
  11489. };
  11490. public string[][] sLoopVoice30Custom4 = new string[][] {
  11491. new string[] { "N3_00310.ogg" , "N3_00318.ogg" , "N3_00377.ogg" },
  11492. new string[] { "N3_00310.ogg" , "N3_00318.ogg" , "N3_00377.ogg" },
  11493. new string[] { "N3_00310.ogg" , "N3_00318.ogg" , "N3_00377.ogg" },
  11494. new string[] { "N3_00310.ogg" , "N3_00318.ogg" , "N3_00377.ogg" },
  11495. new string[] { "N3_00157.ogg" , "N3_00370.ogg" }
  11496. };
  11497. // 性格別声テーブル 絶頂時---------------------------------------------------------------
  11498. //通常
  11499. public string[][] sOrgasmVoice30PrideVibe = new string[][] {
  11500. new string[] { "s0_01898.ogg" , "s0_01899.ogg" , "s0_01902.ogg" , "s0_01900.ogg" },
  11501. new string[] { "s0_01913.ogg" , "s0_01918.ogg" , "s0_01919.ogg" , "s0_01917.ogg" },
  11502. new string[] { "s0_09072.ogg" , "s0_09070.ogg" , "s0_09099.ogg" , "s0_09059.ogg" },
  11503. new string[] { "s0_09067.ogg" , "s0_09068.ogg" , "s0_09069.ogg" , "s0_09071.ogg" , "s0_09085.ogg" , "s0_09086.ogg" , "s0_09087.ogg" , "s0_09091.ogg" },
  11504. new string[] { "s0_01898.ogg" , "s0_01899.ogg" , "s0_01902.ogg" , "s0_01900.ogg" }
  11505. };
  11506. public string[][] sOrgasmVoice30CoolVibe = new string[][] {
  11507. new string[] { "s1_03223.ogg" , "s1_03246.ogg" , "s1_03247.ogg" , "s1_03210.ogg" },
  11508. new string[] { "s1_03214.ogg" , "s1_03215.ogg" , "s1_03216.ogg" , "s1_03209.ogg" },
  11509. new string[] { "s1_03207.ogg" , "s1_03205.ogg" , "s1_08993.ogg" , "s1_08971.ogg" },
  11510. new string[] { "s1_09344.ogg" , "s1_09370.ogg" , "s1_09371.ogg" , "s1_09372.ogg" , "s1_09374.ogg" , "s1_09398.ogg" , "s1_09392.ogg" , "s1_09365.ogg" },
  11511. new string[] { "s1_03223.ogg" , "s1_03246.ogg" , "s1_03247.ogg" , "s1_03210.ogg" }
  11512. };
  11513. public string[][] sOrgasmVoice30PureVibe = new string[][] {
  11514. new string[] { "s2_01478.ogg" , "s2_01477.ogg" , "s2_01476.ogg" , "s2_01475.ogg" },
  11515. new string[] { "s2_01432.ogg" , "s2_01433.ogg" , "s2_01434.ogg" , "s2_01436.ogg" },
  11516. new string[] { "s2_09039.ogg" , "s2_09067.ogg" , "s2_09052.ogg" , "s2_08502.ogg" },
  11517. new string[] { "s2_09047.ogg" , "s2_09048.ogg" , "s2_09049.ogg" , "s2_09050.ogg" , "s2_09051.ogg" , "s2_09066.ogg" , "s2_09069.ogg" , "s2_09073.ogg" },
  11518. new string[] { "s2_01478.ogg" , "s2_01477.ogg" , "s2_01476.ogg" , "s2_01475.ogg" }
  11519. };
  11520. public string[][] sOrgasmVoice30YandereVibe = new string[][] {
  11521. new string[] { "s3_02908.ogg" , "s3_02950.ogg" , "s3_02923.ogg" , "s3_02932.ogg" },
  11522. new string[] { "s3_02909.ogg" , "s3_02910.ogg" , "s3_02915.ogg" , "s3_02914.ogg" },
  11523. new string[] { "s3_02905.ogg" , "s3_02906.ogg" , "s3_02907.ogg" , "s3_05540.ogg" },
  11524. new string[] { "s3_05657.ogg" , "s3_05658.ogg" , "s3_05659.ogg" , "s3_05660.ogg" , "s3_05661.ogg" , "s3_05678.ogg" , "s3_05651.ogg" , "s3_05656.ogg" },
  11525. new string[] { "s3_02908.ogg" , "s3_02950.ogg" , "s3_02923.ogg" , "s3_02932.ogg" }
  11526. };
  11527. public string[][] sOrgasmVoice30AnesanVibe = new string[][] {
  11528. new string[] { "s4_08348.ogg" , "s4_08354.ogg" , "s4_08365.ogg" , "s4_08374.ogg" },
  11529. new string[] { "s4_08345.ogg" , "s4_08346.ogg" , "s4_08349.ogg" , "s4_08350.ogg" },
  11530. new string[] { "s4_08347.ogg" , "s4_08355.ogg" , "s4_08356.ogg" , "s4_11658.ogg" },
  11531. new string[] { "s4_11684.ogg" , "s4_11677.ogg" , "s4_11680.ogg" , "s4_11683.ogg" , "s4_11661.ogg" , "s4_11659.ogg" , "s4_11654.ogg" , "s4_11660.ogg" },
  11532. new string[] { "s4_08348.ogg" , "s4_08354.ogg" , "s4_08365.ogg" , "s4_08374.ogg" }
  11533. };
  11534. public string[][] sOrgasmVoice30GenkiVibe = new string[][] {
  11535. new string[] { "s5_04264.ogg" , "s5_04258.ogg" , "s5_04256.ogg" , "s5_04255.ogg" },
  11536. new string[] { "s5_04265.ogg" , "s5_04270.ogg" , "s5_04267.ogg" , "s5_04268.ogg" },
  11537. new string[] { "s5_04266.ogg" , "s5_18375.ogg" , "s5_18380.ogg" , "s5_18393.ogg" },
  11538. new string[] { "s5_18379.ogg" , "s5_18380.ogg" , "s5_18382.ogg" , "s5_18384.ogg" , "s5_18385.ogg" , "s5_18400.ogg" , "s5_18402.ogg" , "s5_18119.ogg" },
  11539. new string[] { "s5_04264.ogg" , "s5_04258.ogg" , "s5_04256.ogg" , "s5_04255.ogg" }
  11540. };
  11541. public string[][] sOrgasmVoice30SadistVibe = new string[][] {
  11542. new string[] { "s6_01744.ogg" , "s6_02700.ogg" , "s6_02450.ogg" , "s6_02357.ogg" },
  11543. new string[] { "S6_28847.ogg" , "S6_28853.ogg" , "S6_28814.ogg" , "S6_02397.ogg" },
  11544. new string[] { "S6_28817.ogg" , "S6_02398.ogg" , "S6_02399.ogg" , "s6_02402.ogg" },
  11545. new string[] { "S6_09048.ogg" , "S6_01984.ogg" , "S6_01988.ogg" , "S6_01991.ogg" , "S6_02000.ogg" , "S6_01996.ogg" , "S6_01997.ogg" , "S6_01998.ogg" , "S6_01999.ogg" , "S6_02001.ogg" , "s6_05796.ogg" , "s6_05797.ogg" , "s6_05798.ogg" , "s6_05799.ogg" , "s6_05800.ogg" , "s6_05801.ogg" },
  11546. new string[] { "s6_01744.ogg" , "s6_02700.ogg" , "s6_02450.ogg" , "s6_02357.ogg" }
  11547. };
  11548. #if COM3D2
  11549. // オダメ追加分
  11550. public string[][] sOrgasmVoice30RindereVibe = new string[][] {
  11551. new string[] { "s0_01898.ogg" , "s0_01899.ogg" , "s0_01902.ogg" , "s0_01900.ogg" },
  11552. new string[] { "s0_01913.ogg" , "s0_01918.ogg" , "s0_01919.ogg" , "s0_01917.ogg" },
  11553. new string[] { "s0_09072.ogg" , "s0_09070.ogg" , "s0_09099.ogg" , "s0_09059.ogg" },
  11554. new string[] { "s0_09067.ogg" , "s0_09068.ogg" , "s0_09069.ogg" , "s0_09071.ogg" , "s0_09085.ogg" , "s0_09086.ogg" , "s0_09087.ogg" , "s0_09091.ogg" },
  11555. new string[] { "s0_01898.ogg" , "s0_01899.ogg" , "s0_01902.ogg" , "s0_01900.ogg" }
  11556. };
  11557. public string[][] sOrgasmVoice30MajimeVibe = new string[][] {
  11558. new string[] { "s1_03223.ogg" , "s1_03246.ogg" , "s1_03247.ogg" , "s1_03210.ogg" },
  11559. new string[] { "s1_03214.ogg" , "s1_03215.ogg" , "s1_03216.ogg" , "s1_03209.ogg" },
  11560. new string[] { "s1_03207.ogg" , "s1_03205.ogg" , "s1_08993.ogg" , "s1_08971.ogg" },
  11561. new string[] { "s1_09344.ogg" , "s1_09370.ogg" , "s1_09371.ogg" , "s1_09372.ogg" , "s1_09374.ogg" , "s1_09398.ogg" , "s1_09392.ogg" , "s1_09365.ogg" },
  11562. new string[] { "s1_03223.ogg" , "s1_03246.ogg" , "s1_03247.ogg" , "s1_03210.ogg" }
  11563. };
  11564. public string[][] sOrgasmVoice30MukuVibe = new string[][] {
  11565. new string[] { "s2_01478.ogg" , "s2_01477.ogg" , "s2_01476.ogg" , "s2_01475.ogg" },
  11566. new string[] { "s2_01432.ogg" , "s2_01433.ogg" , "s2_01434.ogg" , "s2_01436.ogg" },
  11567. new string[] { "s2_09039.ogg" , "s2_09067.ogg" , "s2_09052.ogg" , "s2_08502.ogg" },
  11568. new string[] { "s2_09047.ogg" , "s2_09048.ogg" , "s2_09049.ogg" , "s2_09050.ogg" , "s2_09051.ogg" , "s2_09066.ogg" , "s2_09069.ogg" , "s2_09073.ogg" },
  11569. new string[] { "s2_01478.ogg" , "s2_01477.ogg" , "s2_01476.ogg" , "s2_01475.ogg" }
  11570. };
  11571. #endif
  11572. //-----------------------------------------------------------------------------------
  11573. //フェラ
  11574. public string[][] sOrgasmVoice30PrideFera = new string[][] {
  11575. new string[] { "S0_01922.ogg" , "S0_01920.ogg" , "S0_01921.ogg" },
  11576. new string[] { "S0_01922.ogg" , "S0_01920.ogg" , "S0_01921.ogg" },
  11577. new string[] { "S0_01922.ogg" , "S0_01920.ogg" , "S0_01921.ogg" },
  11578. new string[] { "S0_11361.ogg" , "S0_01931.ogg" , "S0_11350.ogg" , "S0_11349.ogg" },
  11579. new string[] { "S0_01922.ogg" , "S0_01920.ogg" , "S0_01921.ogg" }
  11580. };
  11581. public string[][] sOrgasmVoice30CoolFera = new string[][] {
  11582. new string[] { "S1_03219.ogg" , "S1_03218.ogg" , "S1_03228.ogg" },
  11583. new string[] { "S1_03219.ogg" , "S1_03218.ogg" , "S1_03228.ogg" },
  11584. new string[] { "S1_03219.ogg" , "S1_03218.ogg" , "S1_03228.ogg" },
  11585. new string[] { "S1_11440.ogg" , "S1_11429.ogg" , "S1_11952.ogg" , "S1_19221.ogg" },
  11586. new string[] { "S1_03219.ogg" , "S1_03218.ogg" , "S1_03228.ogg" }
  11587. };
  11588. public string[][] sOrgasmVoice30PureFera = new string[][] {
  11589. new string[] { "S2_01446.ogg" , "S2_01445.ogg" , "S2_01495.ogg" },
  11590. new string[] { "S2_01446.ogg" , "S2_01445.ogg" , "S2_01495.ogg" },
  11591. new string[] { "S2_01446.ogg" , "S2_01445.ogg" , "S2_01495.ogg" },
  11592. new string[] { "S2_11371.ogg" , "S2_11370.ogg" , "S2_11358.ogg" , "S2_11347.ogg" },
  11593. new string[] { "S2_01446.ogg" , "S2_01445.ogg" , "S2_01495.ogg" }
  11594. };
  11595. public string[][] sOrgasmVoice30YandereFera = new string[][] {
  11596. new string[] { "S3_02919.ogg" , "S3_02918.ogg" , "S3_02928.ogg" },
  11597. new string[] { "S3_02919.ogg" , "S3_02918.ogg" , "S3_02928.ogg" },
  11598. new string[] { "S3_02919.ogg" , "S3_02918.ogg" , "S3_02928.ogg" },
  11599. new string[] { "S3_03084.ogg" , "S3_03184.ogg" , "S3_03162.ogg" , "S3_18748.ogg" },
  11600. new string[] { "S3_02919.ogg" , "S3_02918.ogg" , "S3_02928.ogg" }
  11601. };
  11602. public string[][] sOrgasmVoice30AnesanFera = new string[][] {
  11603. new string[] { "S4_08359.ogg" , "S4_08358.ogg" , "S4_08368.ogg" },
  11604. new string[] { "S4_08359.ogg" , "S4_08358.ogg" , "S4_08368.ogg" },
  11605. new string[] { "S4_08359.ogg" , "S4_08358.ogg" , "S4_08368.ogg" },
  11606. new string[] { "S4_05728.ogg" , "S4_05726.ogg" , "S4_05680.ogg" , "S4_05668.ogg" },
  11607. new string[] { "S4_08359.ogg" , "S4_08358.ogg" , "S4_08368.ogg" }
  11608. };
  11609. public string[][] sOrgasmVoice30GenkiFera = new string[][] {
  11610. new string[] { "s5_04271.ogg" , "s5_04272.ogg" , "s5_04273.ogg" },
  11611. new string[] { "s5_04271.ogg" , "s5_04272.ogg" , "s5_04273.ogg" },
  11612. new string[] { "s5_04271.ogg" , "s5_04272.ogg" , "s5_04273.ogg" },
  11613. new string[] { "S5_07752.ogg" , "S5_07753.ogg" , "s5_04273.ogg" , "s5_04271.ogg" },
  11614. new string[] { "s5_04271.ogg" , "s5_04272.ogg" , "s5_04273.ogg" }
  11615. };
  11616. public string[][] sOrgasmVoice30SadistFera = new string[][] {
  11617. new string[] { "S6_28832.ogg" , "s6_02403.ogg" , "S6_28835.ogg" },
  11618. new string[] { "S6_28835.ogg" , "s6_02403.ogg" , "s6_02404.ogg" },
  11619. new string[] { "S6_28838.ogg" , "s6_02404.ogg" , "s6_02405.ogg" },
  11620. new string[] { "S6_02420.ogg" , "S6_08109.ogg" , "S6_08112.ogg" , "S6_08114.ogg" , "s6_02404.ogg" , "s6_02405.ogg" },
  11621. new string[] { "S6_28832.ogg" , "s6_02403.ogg" , "S6_28835.ogg" }
  11622. };
  11623. #if COM3D2
  11624. // オダメ追加分
  11625. public string[][] sOrgasmVoice30RindereFera = new string[][] {
  11626. new string[] { "S0_01922.ogg" , "S0_01920.ogg" , "S0_01921.ogg" },
  11627. new string[] { "S0_01922.ogg" , "S0_01920.ogg" , "S0_01921.ogg" },
  11628. new string[] { "S0_01922.ogg" , "S0_01920.ogg" , "S0_01921.ogg" },
  11629. new string[] { "S0_11361.ogg" , "S0_01931.ogg" , "S0_11350.ogg" , "S0_11349.ogg" },
  11630. new string[] { "S0_01922.ogg" , "S0_01920.ogg" , "S0_01921.ogg" }
  11631. };
  11632. public string[][] sOrgasmVoice30MajimeFera = new string[][] {
  11633. new string[] { "S1_03219.ogg" , "S1_03218.ogg" , "S1_03228.ogg" },
  11634. new string[] { "S1_03219.ogg" , "S1_03218.ogg" , "S1_03228.ogg" },
  11635. new string[] { "S1_03219.ogg" , "S1_03218.ogg" , "S1_03228.ogg" },
  11636. new string[] { "S1_11440.ogg" , "S1_11429.ogg" , "S1_11952.ogg" , "S1_19221.ogg" },
  11637. new string[] { "S1_03219.ogg" , "S1_03218.ogg" , "S1_03228.ogg" }
  11638. };
  11639. public string[][] sOrgasmVoice30MukuFera = new string[][] {
  11640. new string[] { "S2_01446.ogg" , "S2_01445.ogg" , "S2_01495.ogg" },
  11641. new string[] { "S2_01446.ogg" , "S2_01445.ogg" , "S2_01495.ogg" },
  11642. new string[] { "S2_01446.ogg" , "S2_01445.ogg" , "S2_01495.ogg" },
  11643. new string[] { "S2_11371.ogg" , "S2_11370.ogg" , "S2_11358.ogg" , "S2_11347.ogg" },
  11644. new string[] { "S2_01446.ogg" , "S2_01445.ogg" , "S2_01495.ogg" }
  11645. };
  11646. #endif
  11647. //-----------------------------------------------------------------------------------
  11648. //カスタムボイス
  11649. public string[][] sOrgasmVoice30Custom1 = new string[][] {
  11650. new string[] { "N0_00424.ogg" , "N0_00459.ogg" , "N0_00503.ogg" , "N0_00508.ogg" , "N0_00534.ogg" },
  11651. new string[] { "N0_00424.ogg" , "N0_00459.ogg" , "N0_00503.ogg" , "N0_00508.ogg" , "N0_00534.ogg" },
  11652. new string[] { "N0_00424.ogg" , "N0_00457.ogg" , "N0_00503.ogg" , "N0_00508.ogg" , "N0_00534.ogg" },
  11653. new string[] { "N0_00456.ogg" , "N0_00457.ogg" , "N0_00458.ogg" , "N0_00534.ogg" , "N0_00288.ogg" , "N0_00292.ogg" , "N0_00293.ogg" },
  11654. new string[] { "N0_00424.ogg" , "N0_00459.ogg" , "N0_00503.ogg" , "N0_00508.ogg" , "N0_00534.ogg" }
  11655. };
  11656. public string[][] sOrgasmVoice30Custom2 = new string[][] {
  11657. new string[] { "N7_00251.ogg" , "N7_00267.ogg" , "N7_00275.ogg" , "N7_00276.ogg" , "N7_00280.ogg" },
  11658. new string[] { "N7_00251.ogg" , "N7_00267.ogg" , "N7_00275.ogg" , "N7_00276.ogg" , "N7_00280.ogg" },
  11659. new string[] { "N7_00251.ogg" , "N7_00267.ogg" , "N7_00275.ogg" , "N7_00276.ogg" , "N7_00280.ogg" },
  11660. new string[] { "N7_00284.ogg" , "N7_00291.ogg" , "N7_00293.ogg" , "N7_00294.ogg" , "N7_00295.ogg" , "N7_00275.ogg" , "n7_00295.ogg" },
  11661. new string[] { "N7_00251.ogg" , "N7_00267.ogg" , "N7_00275.ogg" , "N7_00276.ogg" , "N7_00280.ogg" }
  11662. };
  11663. public string[][] sOrgasmVoice30Custom3 = new string[][] {
  11664. new string[] { "N1_00179.ogg" , "N1_00180.ogg" , "N1_00200.ogg" , "N1_00204.ogg" , "N1_00209.ogg" },
  11665. new string[] { "N1_00179.ogg" , "N1_00180.ogg" , "N1_00200.ogg" , "N1_00204.ogg" , "N1_00209.ogg" },
  11666. new string[] { "N1_00179.ogg" , "N1_00180.ogg" , "N1_00200.ogg" , "N1_00204.ogg" , "N1_00209.ogg" },
  11667. new string[] { "N1_00179.ogg" , "N1_00180.ogg" , "N1_00198.ogg" , "N1_00199.ogg" , "N1_00205.ogg" , "N1_00217.ogg" , "N1_00333.ogg" },
  11668. new string[] { "N1_00179.ogg" , "N1_00180.ogg" , "N1_00200.ogg" , "N1_00204.ogg" , "N1_00209.ogg" }
  11669. };
  11670. public string[][] sOrgasmVoice30Custom4 = new string[][] {
  11671. new string[] { "N3_00193.ogg" , "N3_00194.ogg" , "N3_00195.ogg" , "N3_00330.ogg" , "N3_00378.ogg" },
  11672. new string[] { "N3_00193.ogg" , "N3_00194.ogg" , "N3_00195.ogg" , "N3_00330.ogg" , "N3_00378.ogg" },
  11673. new string[] { "N3_00193.ogg" , "N3_00194.ogg" , "N3_00195.ogg" , "N3_00330.ogg" , "N3_00378.ogg" },
  11674. new string[] { "N3_00376.ogg" , "N3_00194.ogg" , "N3_00195.ogg" , "N3_00197.ogg" , "N3_00203.ogg" , "N3_00328.ogg" , "N3_00330.ogg" , "N3_00379.ogg" },
  11675. new string[] { "N3_00193.ogg" , "N3_00194.ogg" , "N3_00195.ogg" , "N3_00330.ogg" , "N3_00378.ogg" }
  11676. };
  11677. // 性格別声テーブル 停止時
  11678. public string[] sLoopVoice40PrideVibe = new string[] { "S0_01967.ogg", "S0_01967.ogg", "S0_01968.ogg", "S0_01969.ogg", "S0_01969.ogg" };
  11679. public string[] sLoopVoice40CoolVibe = new string[] { "S1_03264.ogg", "S1_03264.ogg", "S1_03265.ogg", "S1_03266.ogg", "S1_03266.ogg" };
  11680. public string[] sLoopVoice40PureVibe = new string[] { "s2_01491.ogg", "s2_01491.ogg", "s2_01492.ogg", "s2_01493.ogg", "s2_01493.ogg" };
  11681. public string[] sLoopVoice40YandereVibe = new string[] { "S3_02964.ogg", "S3_02964.ogg", "S3_02965.ogg", "S3_02966.ogg", "S3_02966.ogg" };
  11682. public string[] sLoopVoice40AnesanVibe = new string[] { "s4_08424.ogg", "s4_08426.ogg", "s4_08427.ogg", "s4_08428.ogg", "s4_08428.ogg" };
  11683. public string[] sLoopVoice40GenkiVibe = new string[] { "s5_04127.ogg", "s5_04129.ogg", "s5_04131.ogg", "s5_04134.ogg", "s5_04134.ogg" };
  11684. public string[] sLoopVoice40SadistVibe = new string[] { "s6_02477.ogg", "s6_02478.ogg", "s6_02479.ogg", "s6_02481.ogg", "s6_02480.ogg" };
  11685. #if COM3D2
  11686. // オダメ追加分
  11687. //案1 public string[] sLoopVoice40MukuVibe = new string[] { "H0_00337.ogg", "H0_00352.ogg", "H0_00338.ogg", "H0_00354.ogg", "H0_00339.ogg" };
  11688. public string[] sLoopVoice40MukuVibe = new string[] { "H0_15027.ogg", "H0_00352_vd.ogg", "H0_00338.ogg", "H0_00354.ogg", "H0_00339.ogg" };
  11689. //案1 public string[] sLoopVoice40MajimeVibe = new string[] { "H1_00509.ogg", "H1_00524.ogg", "H1_00510.ogg", "H1_00511.ogg", "H1_00526.ogg" };
  11690. public string[] sLoopVoice40MajimeVibe = new string[] { "H1_00525_vd.ogg"/*"H1_08954.ogg"*/, "H1_00524_vd.ogg", "H1_00510.ogg", "H1_00526.ogg", "H1_00526.ogg" };
  11691. //案1 public string[] sLoopVoice40RindereVibe = new string[] { "H2_00311.ogg", "H2_00326.ogg", "H2_00327.ogg", "H2_00313.ogg", "H2_00328.ogg" };
  11692. public string[] sLoopVoice40RindereVibe = new string[] { "H2_00326_vd.ogg", "H2_00326_vd.ogg", "H2_00327.ogg", "H2_00328.ogg", "H2_00313.ogg" };
  11693. #endif
  11694. public string[] sLoopVoice40Custom1 = new string[] { "N0_00460.ogg", "N0_00460.ogg", "N0_00460.ogg", "N0_00460.ogg", "N0_00460.ogg" };
  11695. public string[] sLoopVoice40Custom2 = new string[] { "N7_00277.ogg", "N7_00277.ogg", "N7_00277.ogg", "N7_00277.ogg", "N7_00277.ogg" };
  11696. public string[] sLoopVoice40Custom3 = new string[] { "N1_00382.ogg", "N1_00382.ogg", "N1_00382.ogg", "N1_00382.ogg", "N1_00382.ogg" };
  11697. public string[] sLoopVoice40Custom4 = new string[] { "N3_00205.ogg", "N3_00205.ogg", "N3_00205.ogg", "N3_00205.ogg", "N3_00205.ogg" };
  11698. }
  11699. #endregion
  11700. #endregion
  11701. public static VibeYourMaidConfig cfg = new VibeYourMaidConfig();
  11702. public static void Reset()
  11703. {
  11704. sFaceBackup.Clear();
  11705. sFace3Backup.Clear();
  11706. maidParam.Clear();
  11707. }
  11708. //メイドの音声再生処理
  11709. public static void MaidVoicePlay(Maid vm, /*int Num, */int iExcite, XtMasterSlave.AnimeState.State motionState,
  11710. bool boMotionChanged, bool faceAnimeEnabled, bool VoiceEnabled, bool modeVYM, bool modeManual, XtMasterSlave.MsLinkConfig msCfg, ref bool VoicePlaying)
  11711. {
  11712. string sPersonal = vm.XtParam().status.personal.ToString();
  11713. string[] VoiceList = new string[1];
  11714. int vi = 0;
  11715. if (!maidParam.ContainsKey(vm))
  11716. maidParam.Add(vm, new vMaidParam());
  11717. var vOrgasmCmb = maidParam[vm].vOrgasmCmb;
  11718. var iExcite_Old = maidParam[vm].iExcite_Old;
  11719. //Console.WriteLine(sPersonal);
  11720. iCurrentExcite = iExcite * 60;
  11721. OrgasmVoice = 0;
  11722. vMaidStun = false;
  11723. // 興奮度の判定
  11724. if (iCurrentExcite < cfg.vExciteLevelThresholdV1 * 60)
  11725. {
  11726. vExciteLevel = 1;
  11727. }
  11728. else if (cfg.vExciteLevelThresholdV1 * 60 <= iCurrentExcite && iCurrentExcite < cfg.vExciteLevelThresholdV2 * 60)
  11729. {
  11730. vExciteLevel = 2;
  11731. }
  11732. else if (cfg.vExciteLevelThresholdV2 * 60 <= iCurrentExcite && iCurrentExcite < cfg.vExciteLevelThresholdV3 * 60)
  11733. {
  11734. vExciteLevel = 3;
  11735. }
  11736. else if (cfg.vExciteLevelThresholdV3 * 60 <= iCurrentExcite)
  11737. {
  11738. vExciteLevel = 4;
  11739. }
  11740. vStateMajor = 20;
  11741. if (iExcite >= cfg.vStateMajor30Threshold)
  11742. {
  11743. vStateMajor = 30;
  11744. }
  11745. //モーションによるテーブル操作
  11746. int ModeSelect = 0;
  11747. if ((motionState & XtMasterSlave.AnimeState.State.kiss) != 0)
  11748. {
  11749. ModeSelect = 1;
  11750. }
  11751. if ((motionState & XtMasterSlave.AnimeState.State.zeccho) != 0)
  11752. {
  11753. OrgasmVoice = 1;
  11754. }
  11755. #if false//設定ファイルに応じて変更するようにした
  11756. /*
  11757. * else if (motionState == XtMasterSlave.AnimeState.State.sex)
  11758. {
  11759. vExciteLevel -= 1;
  11760. if (vExciteLevel < 1)
  11761. vExciteLevel = 1;
  11762. ModeSelect = 0;
  11763. }
  11764. else if (motionState == XtMasterSlave.AnimeState.State.yoin)
  11765. {
  11766. ModeSelect = 0;
  11767. //vMaidStun = true;
  11768. vStateMajor = 40;
  11769. }
  11770. else if (motionState == XtMasterSlave.AnimeState.State.zeccho)
  11771. {
  11772. ModeSelect = 0;
  11773. OrgasmVoice = 1;
  11774. vStateMajor = 30;
  11775. }
  11776. else if (motionState == XtMasterSlave.AnimeState.State.taiki)
  11777. {
  11778. vExciteLevel = 1;
  11779. vStateMajor = 10;
  11780. }
  11781. else //他
  11782. {
  11783. //責め側なので喘ぎを抑制
  11784. vExciteLevel -= 1;
  11785. if (vExciteLevel < 1)
  11786. vExciteLevel = 1;
  11787. vStateMajor = 40;
  11788. }*/
  11789. #endif
  11790. //モーションカテゴリ別のボイステーブル操作
  11791. int v;
  11792. var mCate = motionState;
  11793. //絶頂系フラグとkissフラグの重複解消
  11794. if ((mCate & XtMasterSlave.AnimeState.State.zeccho) != 0)
  11795. mCate = XtMasterSlave.AnimeState.State.zeccho;
  11796. if ((mCate & XtMasterSlave.AnimeState.State.yoin) != 0)
  11797. mCate = XtMasterSlave.AnimeState.State.yoin;
  11798. int lvCorrect = 0;
  11799. if (XtMasterSlave.ycfg.MotionEffect_ExciteLevelSift.TryGetValue(mCate.ToString(), out v))
  11800. {
  11801. vExciteLevel += v;
  11802. lvCorrect = v;
  11803. }
  11804. int stateLock = 0; // v5.0
  11805. if (XtMasterSlave.ycfg.MotionEffect_StateMajorSwitch.TryGetValue(mCate.ToString(), out v))
  11806. {
  11807. if (v != 0)
  11808. {
  11809. vStateMajor = v;
  11810. //if (mCate != XtMasterSlave.AnimeState.State.uke && mCate != XtMasterSlave.AnimeState.State.sex)
  11811. // stateLock = v;
  11812. stateLock = v;
  11813. }
  11814. }
  11815. //vOrgasmCmb = 0;
  11816. if (modeVYM && !modeManual)
  11817. {
  11818. //バイブ状態
  11819. int i_VLevel = VYM.API.obj2int(VYM.API.GetVYM_Value(VYM.API.VYM_IO_ID.i_VLevel));
  11820. //メイド状態
  11821. int i_vb_state_m = VYM.API.obj2int(VYM.API.GetVYM_Value(VYM.API.VYM_IO_ID.i_vStateMajor));
  11822. //if (i_vb_state_m > 0)
  11823. // vStateMajor = i_vb_state_m;
  11824. vOrgasmCmb = VYM.API.obj2int(VYM.API.GetVYM_Value(VYM.API.VYM_IO_ID.i_vOrgasmCmb));
  11825. if (vOrgasmCmb < 0)
  11826. vOrgasmCmb = 0;
  11827. if (msCfg.doVoiceAndFacePlayOnVYM_Zeccho)
  11828. {
  11829. if (mCate == XtMasterSlave.AnimeState.State.sex
  11830. || mCate == XtMasterSlave.AnimeState.State.uke
  11831. || mCate == XtMasterSlave.AnimeState.State.kiss)
  11832. {
  11833. OrgasmVoice = (VYM.API.obj2int(VYM.API.GetVYM_Value(VYM.API.VYM_IO_ID.i_OrgasmVoice)) >= 1) ? 1 : 0;
  11834. }
  11835. if (OrgasmVoice != 0)
  11836. {
  11837. debugPrintConsole("xtms+ VYM絶頂あり");
  11838. if (vm.AudioMan.audiosource.loop || (!vm.AudioMan.audiosource.loop && !vm.AudioMan.audiosource.isPlaying))
  11839. boMotionChanged = true; //割り込み用
  11840. }
  11841. }
  11842. /*
  11843. if (mCate == XtMasterSlave.AnimeState.State.sex
  11844. || mCate == XtMasterSlave.AnimeState.State.uke
  11845. || mCate == XtMasterSlave.AnimeState.State.kiss)
  11846. {
  11847. OrgasmVoice = (VYM.API.obj2int(VYM.API.GetVYM_Value(VYM.API.VYM_IO_ID.i_OrgasmVoice)) == 1) ? 1 : 0;
  11848. }*/
  11849. if (stateLock <= 0)
  11850. {
  11851. if (i_vb_state_m > 0)
  11852. {
  11853. vStateMajor = i_vb_state_m;
  11854. if (mCate != XtMasterSlave.AnimeState.State.uke)
  11855. {
  11856. // 受け以外ではmasterはスタンしない
  11857. vMaidStun = VYM.API.obj2bool(VYM.API.GetVYM_Value(VYM.API.VYM_IO_ID.b_vMaidStun));
  11858. /*if (vStateMajor == 40)
  11859. {
  11860. // バイブステートの変更
  11861. if (i_VLevel == 2)
  11862. { // 「バイブ強」
  11863. vStateMajor = 30;
  11864. }
  11865. else if (i_VLevel == 1)
  11866. { // 「バイブ弱」
  11867. vStateMajor = 20;
  11868. }
  11869. else
  11870. { // 「バイブ停止」
  11871. vStateMajor = 10;
  11872. }
  11873. }*/
  11874. }
  11875. }
  11876. }
  11877. if (i_VLevel == 0 && i_vb_state_m <= 10)
  11878. {
  11879. //VYM停止中に他のプラグインなどのモーション変更に反応しないように
  11880. OrgasmVoice = 0;
  11881. ModeSelect = 0;
  11882. vExciteLevel = 1;
  11883. mCate = XtMasterSlave.AnimeState.State.taiki;
  11884. vStateMajor = 10;
  11885. }
  11886. if (vStateMajor > 10)
  11887. {
  11888. //フェイスバックアップ
  11889. sFaceBackup[vm] = vm.ActiveFace;
  11890. sFace3Backup[vm] = vm.FaceName3;
  11891. }
  11892. else if (vStateMajor == 10)
  11893. {
  11894. if (!VoicePlaying)
  11895. {
  11896. //フェイス復元
  11897. if (sFaceBackup.ContainsKey(vm))
  11898. {
  11899. vm.FaceAnime(sFaceBackup[vm], 1, 0);
  11900. sFaceBackup.Remove(vm);
  11901. }
  11902. if (sFace3Backup.ContainsKey(vm))
  11903. {
  11904. vm.FaceBlend(sFace3Backup[vm]);
  11905. sFace3Backup.Remove(vm);
  11906. }
  11907. return;
  11908. }
  11909. }
  11910. }//vym_mode
  11911. else
  11912. {
  11913. if (OrgasmVoice == 1 && boMotionChanged)
  11914. {
  11915. vOrgasmCmb++;
  11916. if (vOrgasmCmb > 1000)
  11917. vOrgasmCmb = 1000;
  11918. }
  11919. }
  11920. //バイブ状態マニュアルモード
  11921. if (modeManual)
  11922. {
  11923. vStateMajor = msCfg.manuVf_mState;
  11924. if (OrgasmVoice != 0)
  11925. vStateMajor = 30;
  11926. }
  11927. //コンボ数マニュアルモード
  11928. if (msCfg.manuVf_mOrgcmb >= 0)
  11929. {
  11930. vOrgasmCmb = msCfg.manuVf_mOrgcmb;
  11931. }
  11932. if (vExciteLevel < 1)
  11933. {
  11934. vExciteLevel = 1;
  11935. }
  11936. else if (vExciteLevel >= 100)
  11937. {
  11938. //裏機能
  11939. vMaidStun = true;
  11940. vExciteLevel = 4;
  11941. }
  11942. else if (vExciteLevel > 4)
  11943. {
  11944. vExciteLevel = 4;
  11945. }
  11946. #if DEBUG
  11947. if (Time.frameCount % 180 == 0) //60フレームに1回表示
  11948. debugPrintConsole(string.Format("モーションカテゴリ:{0}, ELv:{1}, SM:{2}, Stun:{3}", motionState, vExciteLevel, vStateMajor, vMaidStun));
  11949. #endif
  11950. // v0027用
  11951. string sPersonalEx = sPersonal;
  11952. int modeOrg = ModeSelect;
  11953. NewVoiceTable.VoiceSet voiceSet = null;
  11954. //ユーザー設定によるボイステーブル固定
  11955. switch (cfg.eVoiceMode)
  11956. {
  11957. case VoiceMode.オートモード:
  11958. // オートモードならスキップ
  11959. break;
  11960. case VoiceMode.通常固定:
  11961. ModeSelect = 0;
  11962. break;
  11963. case VoiceMode.舐め固定:
  11964. ModeSelect = 1;
  11965. break;
  11966. case VoiceMode.カスタム1:
  11967. ModeSelect = 2;
  11968. break;
  11969. case VoiceMode.カスタム2:
  11970. ModeSelect = 3;
  11971. break;
  11972. case VoiceMode.カスタム3:
  11973. ModeSelect = 4;
  11974. break;
  11975. case VoiceMode.カスタム4:
  11976. ModeSelect = 5;
  11977. break;
  11978. }
  11979. // v0027拡張
  11980. if (ModeSelect >= 2)
  11981. {
  11982. sPersonalEx = "Custom" + (ModeSelect - 1).ToString();
  11983. ModeSelect = modeOrg;
  11984. }
  11985. // v0027ボイス選定位置移動元
  11986. bool boStateChanged = false;
  11987. //VYM本体より
  11988. bool bAllowVoiceOverrideV = false;
  11989. // ループ音声を再生中、もしくは一回再生音声が再生済みなら介入してよい
  11990. if (vm.AudioMan.audiosource.loop || (!vm.AudioMan.audiosource.loop && !vm.AudioMan.audiosource.isPlaying))
  11991. {
  11992. //m_sLastLoopFN = vm.AudioMan.FileName;
  11993. //m_sLastMotionFN = vm.body0.LastAnimeFN;
  11994. //debugPrintConsole("書き戻し用のループ音声を保持: " + m_sLastLoopFN + " モーション:" + m_sLastMotionFN);
  11995. //m_iLoopWaitCnt = 0;
  11996. bAllowVoiceOverrideV = true;
  11997. }
  11998. if (!vm.AudioMan.audiosource.loop && !vm.AudioMan.audiosource.isPlaying || (VoiceEnabled && !VoicePlaying)) //→ループ音声停止中も割り込みを入れてみる(VoiceEnabled判定追加v0025)
  11999. { // 一回再生音声が停止中
  12000. /*m_iLoopWaitCnt++;
  12001. if (m_iLoopWaitCnt > 20) //20フレーム待ってもループ音声がなければ介入
  12002. {
  12003. debugPrintConsole("ループウェイトカウントオーバー m_iLoopWaitCnt = " + m_iLoopWaitCnt);
  12004. m_iLoopWaitCnt = 0;
  12005. bAllowVoiceOverrideV = true;
  12006. }*/
  12007. if (VoiceEnabled) // v0027 bugfix
  12008. boStateChanged = true;//一回音声再生後はモーション変更同様に音声を切換え
  12009. }
  12010. //VYMからの興奮値計算を変更したので不要に if (!modeVYM) //VYMでは興奮度変化が大きいのとモーション変更頻度が多いので除外
  12011. {
  12012. //興奮度がある程度変わった場合もボイス更新する
  12013. if (modeVYM)
  12014. {
  12015. if (modeManual)
  12016. {
  12017. if (maidParam[vm].vStateMajor_Old != vStateMajor || maidParam[vm].vOrgasmCmb != vOrgasmCmb)
  12018. boStateChanged = true;
  12019. }
  12020. else
  12021. {
  12022. if (maidParam[vm].vStateMajor_Old != vStateMajor)
  12023. boStateChanged = true;
  12024. }
  12025. }
  12026. else if (modeManual)
  12027. {
  12028. if (Math.Abs(iExcite_Old - iExcite) > 10 || maidParam[vm].vStateMajor_Old != vStateMajor || maidParam[vm].vOrgasmCmb != vOrgasmCmb)
  12029. boStateChanged = true;
  12030. }
  12031. else
  12032. {
  12033. if (Math.Abs(iExcite_Old - iExcite) > 10 || maidParam[vm].vStateMajor_Old != vStateMajor)
  12034. boStateChanged = true;
  12035. }
  12036. //前回値の保持(毎回)
  12037. maidParam[vm].vOrgasmCmb = vOrgasmCmb;
  12038. }
  12039. //絶頂音声以外は基本モーション変更のタイミングでのみ切り替える
  12040. bAllowVoiceOverrideV = (bAllowVoiceOverrideV && (boMotionChanged || boStateChanged))
  12041. || (OrgasmVoice > 0 && boMotionChanged); //絶頂音声は割り込み可に
  12042. if (!bAllowVoiceOverrideV)
  12043. {
  12044. //VoicePlaying = false;
  12045. return;
  12046. }
  12047. //bool boExciteChanged = iExcite_Old != iExcite;
  12048. //前回値の保持(ボイス再生毎)
  12049. iExcite_Old = iExcite;
  12050. maidParam[vm].iExcite_Old = iExcite_Old;
  12051. maidParam[vm].vStateMajor_Old = vStateMajor;
  12052. //Console.WriteLine("iExcite {0}, vExciteLevel {1}, ModeSelect {2}, vStateMajor {3}", iExcite, vExciteLevel, ModeSelect, vStateMajor);
  12053. //debugPrintConsole(string.Format("bAllowVoiceOverrideV {0}, boMotionChanged {1}, OrgasmVoice {2}", bAllowVoiceOverrideV, boMotionChanged, OrgasmVoice));
  12054. //音声変更可能なタイミングでフェイスも変更
  12055. if (bAllowVoiceOverrideV && faceAnimeEnabled) //フェイスアニメ有効チェック
  12056. {
  12057. FaceAnime(vm, 0, vStateMajor, vOrgasmCmb);
  12058. //bool force = modeManual || (vStateMajor <= 10 && iExcite == 0 && boExciteChanged); //停止状態で興奮0ならブレンドリセット
  12059. FaceBlend(vm, vOrgasmCmb, true); //常に上書き
  12060. }
  12061. if (!VoiceEnabled)
  12062. {
  12063. if (VoicePlaying)
  12064. {
  12065. VoicePlaying = false;
  12066. vm.AudioMan.Stop(0f);
  12067. }
  12068. return;
  12069. }
  12070. //ボイス再生フラグ
  12071. VoicePlaying = true;
  12072. // v0027ボイス選定位置移動
  12073. if (VoiceEnabled)
  12074. {
  12075. //バイブ弱の音声
  12076. if (vStateMajor == 20)
  12077. {
  12078. if (vMaidStun)
  12079. {
  12080. vi = 4;
  12081. }
  12082. else
  12083. {
  12084. vi = vExciteLevel - 1;
  12085. }
  12086. if (ModeSelect == 0)
  12087. { //通常音声
  12088. voiceSet = NewVoiceTable.GetVoiceSet(
  12089. VoiceType: NewVoiceTable.VoiceSet.VoiceType.LoopVoice,
  12090. State: 20,
  12091. Personal: sPersonalEx,
  12092. Level: vi);
  12093. }
  12094. else if (ModeSelect == 1)
  12095. { //フェラ音声
  12096. voiceSet = NewVoiceTable.GetVoiceSet(
  12097. VoiceType: NewVoiceTable.VoiceSet.VoiceType.LoopVoiceFera,
  12098. State: 20,
  12099. Personal: sPersonalEx,
  12100. Level: vi);
  12101. }
  12102. }
  12103. //バイブ強の音声
  12104. if (vStateMajor == 30)
  12105. {
  12106. if (OrgasmVoice == 0)
  12107. {
  12108. if (vMaidStun)
  12109. {
  12110. vi = 4;
  12111. }
  12112. else
  12113. {
  12114. vi = vExciteLevel - 1;
  12115. }
  12116. if (ModeSelect == 0)
  12117. { //通常音声
  12118. voiceSet = NewVoiceTable.GetVoiceSet(
  12119. VoiceType: NewVoiceTable.VoiceSet.VoiceType.LoopVoice,
  12120. State: 30,
  12121. Personal: sPersonalEx,
  12122. Level: vi);
  12123. }
  12124. else if (ModeSelect == 1)
  12125. { //フェラ音声
  12126. voiceSet = NewVoiceTable.GetVoiceSet(
  12127. VoiceType: NewVoiceTable.VoiceSet.VoiceType.LoopVoiceFera,
  12128. State: 30,
  12129. Personal: sPersonalEx,
  12130. Level: vi);
  12131. }
  12132. }
  12133. else
  12134. { //絶頂時音声
  12135. if (vMaidStun)
  12136. {
  12137. //放心中の絶頂時音声
  12138. vi = 4;
  12139. }
  12140. else if (vOrgasmCmb < 4)
  12141. {
  12142. vi = vExciteLevel - 2;
  12143. if (vi < 0) vi = 0;
  12144. }
  12145. else
  12146. {
  12147. vi = 3;
  12148. }
  12149. if (ModeSelect == 0)
  12150. { //通常音声
  12151. voiceSet = NewVoiceTable.GetVoiceSet(
  12152. VoiceType: NewVoiceTable.VoiceSet.VoiceType.OrgasmVoice,
  12153. State: 30,
  12154. Personal: sPersonalEx,
  12155. Level: vi);
  12156. }
  12157. else if (ModeSelect == 1)
  12158. { //フェラ音声
  12159. voiceSet = NewVoiceTable.GetVoiceSet(
  12160. VoiceType: NewVoiceTable.VoiceSet.VoiceType.OrgasmVoiceFera,
  12161. State: 30,
  12162. Personal: sPersonalEx,
  12163. Level: vi);
  12164. }
  12165. }
  12166. }
  12167. // v0027 ボイスセット→ボイスリスト
  12168. if (voiceSet != null && voiceSet.Files.Length > 0)
  12169. {
  12170. VoiceList = voiceSet.Files;
  12171. }
  12172. }
  12173. int iRandomVoice = UnityEngine.Random.Range(0, VoiceList.Length);
  12174. if (OrgasmVoice != 0)
  12175. {
  12176. //while (iRandomVoice == iRandomVoiceBackup[vi] && VoiceList.Length > 1)
  12177. while (iRandomVoiceBackup[vi].ContainsKey(vm) && iRandomVoice == iRandomVoiceBackup[vi][vm] && VoiceList.Length > 1)
  12178. {
  12179. iRandomVoice = UnityEngine.Random.Range(0, VoiceList.Length);
  12180. }
  12181. //iRandomVoiceBackup[vi] = iRandomVoice;
  12182. iRandomVoiceBackup[vi][vm] = iRandomVoice;
  12183. }
  12184. //debugPrintConsole("MaidVoicePlay " + VoiceList[iRandomVoice]);
  12185. //バイブ動作時の音声を実際に再生する
  12186. if (vStateMajor == 20)
  12187. {
  12188. vm.AudioMan.LoadPlay(VoiceList[iRandomVoice], 0f, false, true);
  12189. }
  12190. if (vStateMajor == 30)
  12191. {
  12192. if (OrgasmVoice == 0)
  12193. {
  12194. vm.AudioMan.LoadPlay(VoiceList[iRandomVoice], 0f, false, true);
  12195. }
  12196. else
  12197. {
  12198. vm.AudioMan.LoadPlay(VoiceList[iRandomVoice], 0f, false, false);
  12199. OrgasmVoice = 2; //絶頂音声再生中のフラグ
  12200. //int index1 = Array.IndexOf(Edit_MaidsNum, Num);
  12201. //if (index1 != -1) vsFlag[index1] = 0;
  12202. }
  12203. }
  12204. if (vStateMajor == 10)
  12205. {
  12206. VoicePlaying = false;
  12207. vm.AudioMan.Stop(0.7f);
  12208. }
  12209. //バイブ停止時の音声
  12210. if (vStateMajor == 40)
  12211. {
  12212. int VoiceValue;
  12213. if (vMaidStun)
  12214. {
  12215. vi = 1;
  12216. }
  12217. else
  12218. {
  12219. vi = 0;
  12220. }
  12221. if (vOrgasmCmb > 0)
  12222. {
  12223. VoiceValue = 3 + vi;
  12224. }
  12225. else
  12226. {
  12227. VoiceValue = vExciteLevel - 1 + vi;
  12228. }
  12229. // v0027
  12230. voiceSet = NewVoiceTable.GetVoiceSet(
  12231. VoiceType: NewVoiceTable.VoiceSet.VoiceType.LoopVoice,
  12232. State: 40,
  12233. Personal: sPersonalEx,
  12234. Level: VoiceValue);
  12235. if (voiceSet != null)
  12236. {
  12237. int cnt = voiceSet.Files.Length;
  12238. if (cnt > 1)
  12239. cnt = UnityEngine.Random.Range(0, cnt - 1);
  12240. else
  12241. cnt = 0;
  12242. vm.AudioMan.LoadPlay(voiceSet.Files[cnt], 0f, false, true);
  12243. }
  12244. //int index1 = Array.IndexOf(Edit_MaidsNum, Num);
  12245. //if (index1 != -1) vsFlag[index1] = 0;
  12246. }
  12247. }
  12248. public static void FaceAnime(Maid maid, int vStateHoldTime, int vState, int vOrgasmCmb)
  12249. {
  12250. // バイブフェイスアニメの適用
  12251. bool bAllowChangeFaceAnime = false;
  12252. // 遷移直後かカウンタリセット時のタイミングで適用
  12253. if ((vStateHoldTime <= 0)
  12254. //|| (vStateMajor == 20 && vStateHoldTime >= vStateAltTime1)
  12255. //|| (vStateMajor == 40 && vStateHoldTime >= vStateAltTime1)
  12256. )
  12257. {
  12258. bAllowChangeFaceAnime = true;
  12259. }
  12260. int iRandomFace = 0;
  12261. if (bAllowChangeFaceAnime)
  12262. {
  12263. string sFaceAnimeName = "";
  12264. if (vMaidStun)
  12265. {
  12266. iRandomFace = UnityEngine.Random.Range(0, cfg.sFaceAnimeStun.Length);
  12267. sFaceAnimeName = cfg.sFaceAnimeStun[iRandomFace];
  12268. }
  12269. else if (vState == 20)
  12270. {
  12271. iRandomFace = UnityEngine.Random.Range(0, cfg.sFaceAnime20Vibe[vExciteLevel - 1].Length);
  12272. sFaceAnimeName = cfg.sFaceAnime20Vibe[vExciteLevel - 1][iRandomFace];
  12273. }
  12274. else if (vState == 40)
  12275. {
  12276. if (vOrgasmCmb > 0)
  12277. {
  12278. sFaceAnimeName = cfg.sFaceAnime40Vibe[3];
  12279. }
  12280. else
  12281. {
  12282. sFaceAnimeName = cfg.sFaceAnime40Vibe[vExciteLevel - 1];
  12283. }
  12284. }
  12285. else if (vState == 30)
  12286. {
  12287. iRandomFace = UnityEngine.Random.Range(0, cfg.sFaceAnime30Vibe[vExciteLevel - 1].Length);
  12288. sFaceAnimeName = cfg.sFaceAnime30Vibe[vExciteLevel - 1][iRandomFace];
  12289. }
  12290. else if (vState == 10 && maidParam[maid].faceanimeChanged)
  12291. {
  12292. if (maid.ActiveFace != cfg.sFaceAnimeYotogiDefault)
  12293. sFaceAnimeName = cfg.sFaceAnimeYotogiDefault;
  12294. maidParam[maid].faceanimeChanged = false;
  12295. }
  12296. // ""か"変更しない"でなければ、フェイスアニメを適用する
  12297. if (sFaceAnimeName != "" && sFaceAnimeName != "変更しない")
  12298. {
  12299. maid.FaceAnime(sFaceAnimeName, cfg.fAnimeFadeTimeV, 0);
  12300. if (vState != 10)
  12301. maidParam[maid].faceanimeChanged = true;
  12302. }
  12303. }
  12304. }
  12305. public static void FaceBlend(Maid maid, int vOrgasmCmb, bool force)
  12306. {
  12307. // フェイスブレンドの適用
  12308. // ステートに応じたフェイスブレンドに上書きする。
  12309. // ただし、より強いものが適用されるなら、そちらを尊重して上書きしない
  12310. string sFaceBlendCurrent = "";//maid.FaceName3;
  12311. if (!force)
  12312. sFaceBlendCurrent = maid.FaceName3;
  12313. sFaceBlendCurrent = sFaceBlendCurrent.Replace("オリジナル", ""); //取得したフェイスブレンド情報から「オリジナル」の記述を削除
  12314. if (sFaceBlendCurrent == "") sFaceBlendCurrent = "頬0涙0"; // 背景選択時、スキル選択時は、"" が返ってきてエラーが出るため
  12315. string sCurrentCheek = "";
  12316. string sCurrentTears = "";
  12317. int iCurrentCheek = 0;
  12318. int iCurrentTears = 0;
  12319. bool bCurrentYodare = false;
  12320. string sChangeCheek = "";
  12321. string sChangeTears = "";
  12322. int iChangeCheek = 0;
  12323. int iChangeTears = 0;
  12324. string sChangeYodare = "";
  12325. string sChangeBlend = "";
  12326. int iOverrideCheek = 0;
  12327. int iOverrideTears = 0;
  12328. bool bOverrideYodare = false;
  12329. // 興奮度によってフェイスブレンドを変更する
  12330. if (vExciteLevel == 1)
  12331. {
  12332. iOverrideCheek = 1; //"頬1"
  12333. iOverrideTears = 1; //"涙1"
  12334. }
  12335. else if (vExciteLevel == 2)
  12336. {
  12337. iOverrideCheek = 2; //"頬2"
  12338. iOverrideTears = 1; //"涙1"
  12339. }
  12340. else if (vExciteLevel == 3)
  12341. {
  12342. iOverrideCheek = 3; //"頬3"
  12343. iOverrideTears = 2; //"涙2"
  12344. }
  12345. else if (vExciteLevel == 4)
  12346. {
  12347. iOverrideCheek = 3; //"頬3"
  12348. iOverrideTears = 3; //"涙3"
  12349. }
  12350. // よだれ(興奮レベルが一定以上の時にだけよだれをつける)
  12351. if (cfg.iYodareAppearLevelV != 0 && vExciteLevel >= cfg.iYodareAppearLevelV)
  12352. {
  12353. bOverrideYodare = true;
  12354. }
  12355. else if (vOrgasmCmb > 0 || vMaidStun)
  12356. {
  12357. bOverrideYodare = true;
  12358. }
  12359. else
  12360. {
  12361. bOverrideYodare = false;
  12362. }
  12363. // 元々のフェイスブレンドと比較する
  12364. sCurrentCheek = sFaceBlendCurrent.Substring(0, 2);
  12365. sCurrentTears = sFaceBlendCurrent.Substring(2, 2);
  12366. if (sFaceBlendCurrent.Length == 7) bCurrentYodare = true;
  12367. if (force)
  12368. {
  12369. iChangeCheek = iOverrideCheek;
  12370. iChangeTears = iOverrideTears;
  12371. if (bOverrideYodare) sChangeYodare = "よだれ";
  12372. }
  12373. else
  12374. {
  12375. if (sCurrentCheek == "頬0") iCurrentCheek = 0;
  12376. if (sCurrentCheek == "頬1") iCurrentCheek = 1;
  12377. if (sCurrentCheek == "頬2") iCurrentCheek = 2;
  12378. if (sCurrentCheek == "頬3") iCurrentCheek = 3;
  12379. iChangeCheek = iCurrentCheek;
  12380. if (iOverrideCheek > iChangeCheek) iChangeCheek = iOverrideCheek;
  12381. if (sCurrentTears == "涙0") iCurrentTears = 0;
  12382. if (sCurrentTears == "涙1") iCurrentTears = 1;
  12383. if (sCurrentTears == "涙2") iCurrentTears = 2;
  12384. if (sCurrentTears == "涙3") iCurrentTears = 3;
  12385. iChangeTears = iCurrentTears;
  12386. if (iOverrideTears > iChangeTears) iChangeTears = iOverrideTears;
  12387. if (bCurrentYodare || bOverrideYodare) sChangeYodare = "よだれ";
  12388. }
  12389. //頬
  12390. if (iChangeCheek == 0) sChangeCheek = "頬0";
  12391. if (iChangeCheek == 1) sChangeCheek = "頬1";
  12392. if (iChangeCheek == 2) sChangeCheek = "頬2";
  12393. if (iChangeCheek == 3) sChangeCheek = "頬3";
  12394. //涙
  12395. if (iChangeTears == 0) sChangeTears = "涙0";
  12396. if (iChangeTears == 1) sChangeTears = "涙1";
  12397. if (iChangeTears == 2) sChangeTears = "涙2";
  12398. if (iChangeTears == 3) sChangeTears = "涙3";
  12399. //設定により各ブレンドを除外
  12400. if (!cfg.HohoEnabled) sChangeCheek = sCurrentCheek;
  12401. if (!cfg.NamidaEnabled) sChangeTears = sCurrentTears;
  12402. if (!cfg.YodareEnabled)
  12403. {
  12404. if (bCurrentYodare) sChangeYodare = "よだれ";
  12405. if (!bCurrentYodare) sChangeYodare = "";
  12406. }
  12407. sChangeBlend = sChangeCheek + sChangeTears + sChangeYodare;
  12408. //メインメイドにフェイスブレンド適用
  12409. maid.FaceBlend(sChangeBlend);
  12410. }
  12411. #region 旧音声ルーチン
  12412. #if false
  12413. //メイドの音声再生処理
  12414. private void MaidVoicePlay(Maid vm, int Num)
  12415. {
  12416. //フェラしているかのチェック
  12417. checkBlowjobing(vm, Num);
  12418. string sPersonal = vm.Param.status.personal.ToString();
  12419. string[] VoiceList = new string[1];
  12420. int vi = 0;
  12421. //Console.WriteLine(sPersonal);
  12422. //バイブ弱の音声
  12423. if (vStateMajor == 20)
  12424. {
  12425. if (vMaidStun)
  12426. {
  12427. vi = 4;
  12428. }
  12429. else
  12430. {
  12431. vi = vExciteLevel - 1;
  12432. }
  12433. if (ModeSelect == 0)
  12434. { //通常音声
  12435. if (sPersonal == "Pure")
  12436. {
  12437. VoiceList = cfg.sLoopVoice20PureVibe[vi];
  12438. }
  12439. else if (sPersonal == "Cool")
  12440. {
  12441. VoiceList = cfg.sLoopVoice20CoolVibe[vi];
  12442. }
  12443. else if (sPersonal == "Pride")
  12444. {
  12445. VoiceList = cfg.sLoopVoice20PrideVibe[vi];
  12446. }
  12447. else if (sPersonal == "Yandere")
  12448. {
  12449. VoiceList = cfg.sLoopVoice20YandereVibe[vi];
  12450. }
  12451. else if (sPersonal == "Anesan")
  12452. {
  12453. VoiceList = cfg.sLoopVoice20AnesanVibe[vi];
  12454. }
  12455. else if (sPersonal == "Genki")
  12456. {
  12457. VoiceList = cfg.sLoopVoice20GenkiVibe[vi];
  12458. }
  12459. else if (sPersonal == "Sadist")
  12460. {
  12461. VoiceList = cfg.sLoopVoice20SadistVibe[vi];
  12462. }
  12463. }
  12464. else if (ModeSelect == 1)
  12465. { //フェラ音声
  12466. if (sPersonal == "Pure")
  12467. {
  12468. VoiceList = cfg.sLoopVoice20PureFera[vi];
  12469. }
  12470. else if (sPersonal == "Cool")
  12471. {
  12472. VoiceList = cfg.sLoopVoice20CoolFera[vi];
  12473. }
  12474. else if (sPersonal == "Pride")
  12475. {
  12476. VoiceList = cfg.sLoopVoice20PrideFera[vi];
  12477. }
  12478. else if (sPersonal == "Yandere")
  12479. {
  12480. VoiceList = cfg.sLoopVoice20YandereFera[vi];
  12481. }
  12482. else if (sPersonal == "Anesan")
  12483. {
  12484. VoiceList = cfg.sLoopVoice20AnesanFera[vi];
  12485. }
  12486. else if (sPersonal == "Genki")
  12487. {
  12488. VoiceList = cfg.sLoopVoice20GenkiFera[vi];
  12489. }
  12490. else if (sPersonal == "Sadist")
  12491. {
  12492. VoiceList = cfg.sLoopVoice20SadistFera[vi];
  12493. }
  12494. }
  12495. else if (ModeSelect == 2)
  12496. { //カスタム音声1
  12497. VoiceList = cfg.sLoopVoice20Custom1[vi];
  12498. }
  12499. else if (ModeSelect == 3)
  12500. { //カスタム音声2
  12501. VoiceList = cfg.sLoopVoice20Custom2[vi];
  12502. }
  12503. else if (ModeSelect == 4)
  12504. { //カスタム音声3
  12505. VoiceList = cfg.sLoopVoice20Custom3[vi];
  12506. }
  12507. else if (ModeSelect == 5)
  12508. { //カスタム音声4
  12509. VoiceList = cfg.sLoopVoice20Custom4[vi];
  12510. }
  12511. }
  12512. //バイブ強の音声
  12513. if (vStateMajor == 30)
  12514. {
  12515. if (OrgasmVoice == 0)
  12516. {
  12517. if (vMaidStun)
  12518. {
  12519. vi = 4;
  12520. }
  12521. else
  12522. {
  12523. vi = vExciteLevel - 1;
  12524. }
  12525. if (ModeSelect == 0)
  12526. { //通常音声
  12527. if (sPersonal == "Pure")
  12528. {
  12529. VoiceList = cfg.sLoopVoice30PureVibe[vi];
  12530. }
  12531. else if (sPersonal == "Cool")
  12532. {
  12533. VoiceList = cfg.sLoopVoice30CoolVibe[vi];
  12534. }
  12535. else if (sPersonal == "Pride")
  12536. {
  12537. VoiceList = cfg.sLoopVoice30PrideVibe[vi];
  12538. }
  12539. else if (sPersonal == "Yandere")
  12540. {
  12541. VoiceList = cfg.sLoopVoice30YandereVibe[vi];
  12542. }
  12543. else if (sPersonal == "Anesan")
  12544. {
  12545. VoiceList = cfg.sLoopVoice30AnesanVibe[vi];
  12546. }
  12547. else if (sPersonal == "Genki")
  12548. {
  12549. VoiceList = cfg.sLoopVoice30GenkiVibe[vi];
  12550. }
  12551. else if (sPersonal == "Sadist")
  12552. {
  12553. VoiceList = cfg.sLoopVoice30SadistVibe[vi];
  12554. }
  12555. }
  12556. else if (ModeSelect == 1)
  12557. { //フェラ音声
  12558. if (sPersonal == "Pure")
  12559. {
  12560. VoiceList = cfg.sLoopVoice30PureFera[vi];
  12561. }
  12562. else if (sPersonal == "Cool")
  12563. {
  12564. VoiceList = cfg.sLoopVoice30CoolFera[vi];
  12565. }
  12566. else if (sPersonal == "Pride")
  12567. {
  12568. VoiceList = cfg.sLoopVoice30PrideFera[vi];
  12569. }
  12570. else if (sPersonal == "Yandere")
  12571. {
  12572. VoiceList = cfg.sLoopVoice30YandereFera[vi];
  12573. }
  12574. else if (sPersonal == "Anesan")
  12575. {
  12576. VoiceList = cfg.sLoopVoice30AnesanFera[vi];
  12577. }
  12578. else if (sPersonal == "Genki")
  12579. {
  12580. VoiceList = cfg.sLoopVoice30GenkiFera[vi];
  12581. }
  12582. else if (sPersonal == "Sadist")
  12583. {
  12584. VoiceList = cfg.sLoopVoice30SadistFera[vi];
  12585. }
  12586. }
  12587. else if (ModeSelect == 2)
  12588. { //カスタム音声1
  12589. VoiceList = cfg.sLoopVoice30Custom1[vi];
  12590. }
  12591. else if (ModeSelect == 3)
  12592. { //カスタム音声2
  12593. VoiceList = cfg.sLoopVoice30Custom2[vi];
  12594. }
  12595. else if (ModeSelect == 4)
  12596. { //カスタム音声3
  12597. VoiceList = cfg.sLoopVoice30Custom3[vi];
  12598. }
  12599. else if (ModeSelect == 5)
  12600. { //カスタム音声4
  12601. VoiceList = cfg.sLoopVoice30Custom4[vi];
  12602. }
  12603. }
  12604. else
  12605. { //放心中の絶頂時音声
  12606. if (vMaidStun)
  12607. {
  12608. vi = 4;
  12609. }
  12610. else if (vOrgasmCmb < 4)
  12611. {
  12612. vi = vExciteLevel - 2;
  12613. }
  12614. else
  12615. {
  12616. vi = 3;
  12617. }
  12618. if (ModeSelect == 0)
  12619. { //通常音声
  12620. if (sPersonal == "Pure")
  12621. {
  12622. VoiceList = cfg.sOrgasmVoice30PureVibe[vi];
  12623. }
  12624. else if (sPersonal == "Cool")
  12625. {
  12626. VoiceList = cfg.sOrgasmVoice30CoolVibe[vi];
  12627. }
  12628. else if (sPersonal == "Pride")
  12629. {
  12630. VoiceList = cfg.sOrgasmVoice30PrideVibe[vi];
  12631. }
  12632. else if (sPersonal == "Yandere")
  12633. {
  12634. VoiceList = cfg.sOrgasmVoice30YandereVibe[vi];
  12635. }
  12636. else if (sPersonal == "Anesan")
  12637. {
  12638. VoiceList = cfg.sOrgasmVoice30AnesanVibe[vi];
  12639. }
  12640. else if (sPersonal == "Genki")
  12641. {
  12642. VoiceList = cfg.sOrgasmVoice30GenkiVibe[vi];
  12643. }
  12644. else if (sPersonal == "Sadist")
  12645. {
  12646. VoiceList = cfg.sOrgasmVoice30SadistVibe[vi];
  12647. }
  12648. }
  12649. else if (ModeSelect == 1)
  12650. { //フェラ音声
  12651. if (sPersonal == "Pure")
  12652. {
  12653. VoiceList = cfg.sOrgasmVoice30PureFera[vi];
  12654. }
  12655. else if (sPersonal == "Cool")
  12656. {
  12657. VoiceList = cfg.sOrgasmVoice30CoolFera[vi];
  12658. }
  12659. else if (sPersonal == "Pride")
  12660. {
  12661. VoiceList = cfg.sOrgasmVoice30PrideFera[vi];
  12662. }
  12663. else if (sPersonal == "Yandere")
  12664. {
  12665. VoiceList = cfg.sOrgasmVoice30YandereFera[vi];
  12666. }
  12667. else if (sPersonal == "Anesan")
  12668. {
  12669. VoiceList = cfg.sOrgasmVoice30AnesanFera[vi];
  12670. }
  12671. else if (sPersonal == "Genki")
  12672. {
  12673. VoiceList = cfg.sOrgasmVoice30GenkiFera[vi];
  12674. }
  12675. else if (sPersonal == "Sadist")
  12676. {
  12677. VoiceList = cfg.sOrgasmVoice30SadistFera[vi];
  12678. }
  12679. }
  12680. else if (ModeSelect == 2)
  12681. { //カスタム音声1
  12682. VoiceList = cfg.sOrgasmVoice30Custom1[vi];
  12683. }
  12684. else if (ModeSelect == 3)
  12685. { //カスタム音声2
  12686. VoiceList = cfg.sOrgasmVoice30Custom2[vi];
  12687. }
  12688. else if (ModeSelect == 4)
  12689. { //カスタム音声3
  12690. VoiceList = cfg.sOrgasmVoice30Custom3[vi];
  12691. }
  12692. else if (ModeSelect == 5)
  12693. { //カスタム音声4
  12694. VoiceList = cfg.sOrgasmVoice30Custom4[vi];
  12695. }
  12696. }
  12697. }
  12698. int iRandomVoice = UnityEngine.Random.Range(0, VoiceList.Length);
  12699. if (OrgasmVoice != 0)
  12700. {
  12701. do
  12702. {
  12703. while (iRandomVoice == iRandomVoiceBackup[vi] && VoiceList.Length > 1)
  12704. {
  12705. iRandomVoice = UnityEngine.Random.Range(0, VoiceList.Length);
  12706. }
  12707. } while (VoiceList[iRandomVoice] == API.mMaidLastZcVoiceFN); //@API連動で追加//夜伽中の音声と重複を避けるため
  12708. iRandomVoiceBackup[vi] = iRandomVoice;
  12709. }
  12710. //バイブ動作時の音声を実際に再生する
  12711. if (vStateMajor == 20)
  12712. {
  12713. int index1 = Array.IndexOf(Edit_MaidsNum, Num);
  12714. if (index1 == -1)
  12715. {
  12716. vm.AudioMan.LoadPlay(VoiceList[iRandomVoice], 0f, false, true);
  12717. }
  12718. else if (vsFlag[index1] == 0)
  12719. {
  12720. vm.AudioMan.LoadPlay(VoiceList[iRandomVoice], 0f, false, true);
  12721. }
  12722. }
  12723. if (vStateMajor == 30)
  12724. {
  12725. if (OrgasmVoice == 0)
  12726. {
  12727. int index1 = Array.IndexOf(Edit_MaidsNum, Num);
  12728. if (index1 == -1)
  12729. {
  12730. vm.AudioMan.LoadPlay(VoiceList[iRandomVoice], 0f, false, true);
  12731. }
  12732. else if (vsFlag[index1] == 0)
  12733. {
  12734. vm.AudioMan.LoadPlay(VoiceList[iRandomVoice], 0f, false, true);
  12735. }
  12736. }
  12737. else
  12738. {
  12739. vm.AudioMan.LoadPlay(VoiceList[iRandomVoice], 0f, false, false);
  12740. OrgasmVoice = 2; //絶頂音声再生中のフラグ
  12741. int index1 = Array.IndexOf(Edit_MaidsNum, Num);
  12742. if (index1 != -1) vsFlag[index1] = 0;
  12743. }
  12744. }
  12745. //バイブ停止時の音声
  12746. if (vStateMajor == 40)
  12747. {
  12748. int VoiceValue;
  12749. if (vMaidStun)
  12750. {
  12751. vi = 1;
  12752. }
  12753. else
  12754. {
  12755. vi = 0;
  12756. }
  12757. if (vOrgasmCmb > 0)
  12758. {
  12759. VoiceValue = 3 + vi;
  12760. }
  12761. else
  12762. {
  12763. VoiceValue = vExciteLevel - 1 + vi;
  12764. }
  12765. if (ModeSelect == 2)
  12766. {
  12767. vm.AudioMan.LoadPlay(cfg.sLoopVoice40Custom1[VoiceValue], 0f, false, true);
  12768. }
  12769. else if (ModeSelect == 3)
  12770. {
  12771. vm.AudioMan.LoadPlay(cfg.sLoopVoice40Custom2[VoiceValue], 0f, false, true);
  12772. }
  12773. else if (ModeSelect == 4)
  12774. {
  12775. vm.AudioMan.LoadPlay(cfg.sLoopVoice40Custom3[VoiceValue], 0f, false, true);
  12776. }
  12777. else if (ModeSelect == 5)
  12778. {
  12779. vm.AudioMan.LoadPlay(cfg.sLoopVoice40Custom4[VoiceValue], 0f, false, true);
  12780. }
  12781. else if (sPersonal == "Pure")
  12782. {
  12783. vm.AudioMan.LoadPlay(cfg.sLoopVoice40PureVibe[VoiceValue], 0f, false, true);
  12784. }
  12785. else if (sPersonal == "Cool")
  12786. {
  12787. vm.AudioMan.LoadPlay(cfg.sLoopVoice40CoolVibe[VoiceValue], 0f, false, true);
  12788. }
  12789. else if (sPersonal == "Pride")
  12790. {
  12791. vm.AudioMan.LoadPlay(cfg.sLoopVoice40PrideVibe[VoiceValue], 0f, false, true);
  12792. }
  12793. else if (sPersonal == "Yandere")
  12794. {
  12795. vm.AudioMan.LoadPlay(cfg.sLoopVoice40YandereVibe[VoiceValue], 0f, false, true);
  12796. }
  12797. else if (sPersonal == "Anesan")
  12798. {
  12799. vm.AudioMan.LoadPlay(cfg.sLoopVoice40AnesanVibe[VoiceValue], 0f, false, true);
  12800. }
  12801. else if (sPersonal == "Genki")
  12802. {
  12803. vm.AudioMan.LoadPlay(cfg.sLoopVoice40GenkiVibe[VoiceValue], 0f, false, true);
  12804. }
  12805. else if (sPersonal == "Sadist")
  12806. {
  12807. vm.AudioMan.LoadPlay(cfg.sLoopVoice40SadistVibe[VoiceValue], 0f, false, true);
  12808. }
  12809. int index1 = Array.IndexOf(Edit_MaidsNum, Num);
  12810. if (index1 != -1) vsFlag[index1] = 0;
  12811. }
  12812. }
  12813. // フェラ状態チェック
  12814. private int[] bIsBlowjobing = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
  12815. private string sLastAnimeFileName = "";
  12816. private string sLastAnimeFileNameOld = "";
  12817. private string[] ZAnimeFileName = new string[20];
  12818. //フェラしてるかチェック
  12819. private void checkBlowjobing(Maid m, int Num)
  12820. {
  12821. if (maid)
  12822. {
  12823. //メイドさんのモーションファイル名に含まれる文字列で判別させる
  12824. if (OrgasmVoice == 0)
  12825. {
  12826. sLastAnimeFileName = m.body0.LastAnimeFN;
  12827. }
  12828. else if (Num == maidDataList[iCurrentMaid] && cfgw.ZeccyouAnimeEnabled)
  12829. {
  12830. sLastAnimeFileName = ZAnimeFileName[Num];
  12831. }
  12832. else if (Num != maidDataList[iCurrentMaid] && cfgw.ZeccyouAnimeEnabled && cfgw.MaidLinkMotionEnabled)
  12833. {
  12834. sLastAnimeFileName = ZAnimeFileName[Num];
  12835. }
  12836. if (sLastAnimeFileName != null)
  12837. {
  12838. bIsBlowjobing[Num] = 0;
  12839. if (sLastAnimeFileName.Contains("fera")) bIsBlowjobing[Num] = 2; //フェラ
  12840. if (sLastAnimeFileName.Contains("sixnine")) bIsBlowjobing[Num] = 2; //シックスナイン
  12841. if (sLastAnimeFileName.Contains("_ir_")) bIsBlowjobing[Num] = 2; //イラマ
  12842. if (sLastAnimeFileName.Contains("_kuti")) bIsBlowjobing[Num] = 2; //乱交3P
  12843. if (sLastAnimeFileName.Contains("housi")) bIsBlowjobing[Num] = 2; //乱交奉仕
  12844. if (sLastAnimeFileName.Contains("kiss")) bIsBlowjobing[Num] = 1; //キス
  12845. if (sLastAnimeFileName.Contains("ran4p")) bIsBlowjobing[Num] = 2; //乱交4P
  12846. if (sLastAnimeFileName.Contains("taiki")) bIsBlowjobing[Num] = 0; //待機中は含めない
  12847. if (sLastAnimeFileName.Contains("shaseigo")) bIsBlowjobing[Num] = 0; //射精後は含めない
  12848. if (sLastAnimeFileName.Contains("surituke")) bIsBlowjobing[Num] = 1; //乱交3P擦り付け時は咥えないのでは含めない
  12849. if (sLastAnimeFileName.Contains("siriname")) bIsBlowjobing[Num] = 1; //尻舐めはキス扱い
  12850. if (sLastAnimeFileName.Contains("asiname")) bIsBlowjobing[Num] = 1; //足舐めはキス扱い
  12851. if (sLastAnimeFileName.Contains("tikubiname")) bIsBlowjobing[Num] = 1; //乳首舐めはキス扱い
  12852. if (sLastAnimeFileName.Contains("ir_in_taiki")) bIsBlowjobing[Num] = 2; //咥え始めはフェラに含める
  12853. if (sLastAnimeFileName.Contains("dt_in_taiki")) bIsBlowjobing[Num] = 2; //咥え始めはフェラに含める
  12854. if (sLastAnimeFileName.Contains("kuti_in_taiki")) bIsBlowjobing[Num] = 2; //咥え始めはフェラに含める
  12855. if (sLastAnimeFileName.Contains("kutia_in_taiki")) bIsBlowjobing[Num] = 2; //咥え始めはフェラに含める
  12856. sLastAnimeFileNameOld = sLastAnimeFileName;
  12857. //メインメイドの場合はマウスモードを切り替える
  12858. //if(Num == maidDataList[iCurrentMaid]){
  12859. if (bIsBlowjobing[Num] == 0 && vOrgasmCmb <= 3)
  12860. { //0の時は連続絶頂中じゃなければ切り替える
  12861. if (vBoostBase > 40)
  12862. { //感度が40以上の時はランダムで歯を食いしばる
  12863. MouthMode[Num] = UnityEngine.Random.Range(2, 5);
  12864. if (MouthMode[Num] < 4) MouthMode[Num] = 0;
  12865. }
  12866. else
  12867. {
  12868. MouthMode[Num] = bIsBlowjobing[Num];
  12869. }
  12870. }
  12871. if (bIsBlowjobing[Num] == 1 && cfgw.MouthKissEnabled) MouthMode[Num] = bIsBlowjobing[Num]; //1の時はキスが有効なら切り替える
  12872. if (bIsBlowjobing[Num] == 2 && cfgw.MouthFeraEnabled) MouthMode[Num] = bIsBlowjobing[Num]; //2の時はフェラが有効なら切り替える
  12873. if (vMaidStun) MouthMode[Num] = 3; //放心中は無条件でアヘらせる
  12874. //}
  12875. //フェラの時は顔をカメラに向けないようにする
  12876. if (bIsBlowjobing[Num] == 2)
  12877. {
  12878. m.EyeToCamera((Maid.EyeMoveType)0, 0.8f);
  12879. }
  12880. }
  12881. }
  12882. }
  12883. #endif
  12884. #endregion
  12885. // デバッグ用コンソール出力メソッド
  12886. [Conditional("DEBUG")]
  12887. private static void debugPrintConsole(string s)
  12888. {
  12889. Console.WriteLine(s);
  12890. }
  12891. }
  12892. }
  12893. #endif
  12894. namespace AudioUtil
  12895. {
  12896. static class SE
  12897. {
  12898. /// <summary>
  12899. /// GameMain.Instance.SoundMgr.PlaySe()でセットしたSEの再生情報をコンソールに書き出すサンプル
  12900. ///
  12901. /// 公式のPlaySeメソッドから呼ばれている、音声ファイルが既に登録済みかのチェックルーチンを参考にしました
  12902. /// </summary>
  12903. public static AudioSourceMgr[] m_aryAudioMan = null;
  12904. public static bool CheckSE(string check_fn)
  12905. {
  12906. try
  12907. {
  12908. if (m_aryAudioMan == null)
  12909. {
  12910. //オーディオマネージャーの取得、2回目以降はキャッシュを使う
  12911. object objAudioSeBufSe = GameMain.Instance.SoundMgr.GetType().InvokeMember("m_AudioSeBufSe",
  12912. BindingFlags.GetField | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.NonPublic, null, GameMain.Instance.SoundMgr, null);
  12913. if (objAudioSeBufSe != null)
  12914. {
  12915. object o = objAudioSeBufSe.GetType().InvokeMember("m_aryAudioMan",
  12916. BindingFlags.GetField | BindingFlags.Instance | BindingFlags.NonPublic, null, objAudioSeBufSe, null);
  12917. m_aryAudioMan = o as AudioSourceMgr[];
  12918. }
  12919. }
  12920. if (m_aryAudioMan != null)
  12921. {
  12922. //SEの全チャンネルの書き出し、重複チェックが公式にあるので同じSEが複数チャンネルにあることはないはず
  12923. int i = 0;
  12924. foreach (AudioSourceMgr asm in m_aryAudioMan)
  12925. {
  12926. i++;
  12927. //debugPrintConsole("SE[" + i + "]:" + asm.FileName + " isPlay?:" + asm.isPlay() + " isLoop?:" + asm.isLoop());
  12928. if (check_fn == asm.FileName && asm.isPlay())
  12929. return true;
  12930. }
  12931. }
  12932. }
  12933. catch (Exception e)
  12934. {
  12935. debugPrintConsole("e:" + e);
  12936. }
  12937. return false;
  12938. }
  12939. // デバッグ用コンソール出力メソッド
  12940. [Conditional("DEBUG")]
  12941. static private void debugPrintConsole(string s)
  12942. {
  12943. Console.WriteLine(s);
  12944. }
  12945. }
  12946. }
  12947. delegate System.Object delegate_API_Entry(int mode, object param1, object param2);
  12948. namespace VYM
  12949. {
  12950. //@API実装->// API実装用クラス
  12951. public static class API
  12952. {
  12953. //static string sPlugin = @"UnityInjector\CM3D2.VibeYourMaid.Plugin.dll";
  12954. //private static CM3D2.VibeYourMaid.Plugin.VibeYourMaid objVYM = null;
  12955. public static object objVYM = null;
  12956. static int iRetry = 2;
  12957. static MethodInfo mi_api_entry = null;
  12958. static delegate_API_Entry dlg_API_Entry = null;
  12959. //static Type type_VYM_IO_ID = null;
  12960. //
  12961. // 一般関数
  12962. //
  12963. public static double obj2dbl(object obj)
  12964. {
  12965. try
  12966. {
  12967. if (obj is double) return (double)obj;
  12968. }
  12969. catch { }
  12970. return -1;
  12971. }
  12972. public static float obj2float(object obj)
  12973. {
  12974. try
  12975. {
  12976. if (obj is float) return (float)obj;
  12977. }
  12978. catch { }
  12979. return -1;
  12980. }
  12981. public static int obj2int(object obj)
  12982. {
  12983. try
  12984. {
  12985. if (obj is int) return (int)obj;
  12986. }
  12987. catch { }
  12988. return -1;
  12989. }
  12990. public static bool obj2bool(object obj)
  12991. {
  12992. try
  12993. {
  12994. if (obj is bool) return (bool)obj;
  12995. }
  12996. catch { }
  12997. return false;
  12998. }
  12999. private static bool checkVYM()
  13000. {
  13001. if (iRetry <= 0) return false;
  13002. if (mi_api_entry != null)
  13003. { return true; }
  13004. try
  13005. {
  13006. if (objVYM == null)
  13007. {
  13008. GameObject go = UnityEngine.GameObject.Find("UnityInjector");
  13009. #if COM3D2
  13010. objVYM = go.GetComponent("COM3D2.VibeYourMaid.Plugin.VibeYourMaid");
  13011. #else
  13012. objVYM = go.GetComponent("CM3D2.VibeYourMaid.Plugin.VibeYourMaid");
  13013. #endif
  13014. if (objVYM != null)
  13015. {
  13016. //debugPrintConsole("+API.GetMethod API_Entry");
  13017. mi_api_entry = objVYM.GetType().GetMethod("API_Entry", BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);
  13018. //if (Assembly.LoadFile(sPlugin).GetTypes().Any(t => t == typeof(VYM_IO_ID)))
  13019. if (mi_api_entry != null)
  13020. {
  13021. dlg_API_Entry = (delegate_API_Entry)Delegate.CreateDelegate(typeof(delegate_API_Entry), objVYM, mi_api_entry, false);
  13022. if (dlg_API_Entry != null)
  13023. {
  13024. //Console.WriteLine("くらげ+VYM: API_Entryが見つかりました!連動開始");
  13025. return true;
  13026. }
  13027. else
  13028. {
  13029. dlg_API_Entry = null;
  13030. }
  13031. }
  13032. else
  13033. {
  13034. Console.WriteLine("XtMS→VYM: API_Entryが見つかりません。対応したCM3D2.VibeYourMaid.Pluginではないかも…");
  13035. objVYM = null;
  13036. }
  13037. }
  13038. }
  13039. }
  13040. catch (Exception e)
  13041. {
  13042. Console.WriteLine("XtMS→VYM:" + e);
  13043. //return false;
  13044. }
  13045. iRetry--;
  13046. if (iRetry == 0)
  13047. {
  13048. //Console.WriteLine("VYM+APITEST:CM3D2.VibeYourMaid.Pluginが見つかりません。スタンドアローンモードです");
  13049. }
  13050. return false;
  13051. }
  13052. //////////////////////////////////////////////////////////////////////////////
  13053. /// <summary>
  13054. /// getVYM_ValueやsetVYM_Value関数でターゲットとするパラメータの指定用
  13055. /// </summary>
  13056. public enum VYM_IO_ID
  13057. { //WindowsMessage的ID値割り当て。一意の数値さえ変えなければ行間に追加可
  13058. b_PluginEnabledV = 100 + 10, //有効状態
  13059. i_GetCurrentMaidNo = 100 + 20, //現在操作中のMaidNo//返り値:-1 未定義/null エラー
  13060. i_CurrentMaid = 100 + 30, //内部配列のメイドNo //'17.04.07追加
  13061. i_VLevel = 200 + 10, // バイブ状態 1=弱 2=強 0=停止
  13062. i_vState = 200 + 20, // 現状vStateMajorとほぼ同じ
  13063. i_vStateMajor = 200 + 30, // 強弱によるメイドステート//10 …停止(余韻もなし)//20 …弱//30 …強
  13064. i_vExciteLevel = 300 + 10, // 0~300の興奮度を、1~4の興奮レベルに変換した値
  13065. d_iCurrentExcite = 300 + 20, // 現在興奮値
  13066. d_vResistGet = 400 + 10, // 現在抵抗値
  13067. d_vResistBase = 400 + 20, // 抵抗値のベース値
  13068. d_vResistBonus = 400 + 30, // 抵抗の特別加算値
  13069. d_vBoostGet = 500 + 10, // 現在感度
  13070. d_vBoostBase = 500 + 20, // 感度のベース値
  13071. d_vBoostBonus = 500 + 30, // 感度の特別加算値(今は使われていないみたい)
  13072. d_vMaidStamina = 600 + 10, // スタミナ値
  13073. b_vMaidStun = 600 + 20, // スタン状態(trueでたたき起こす=ON)
  13074. d_vOrgasmValue = 700 + 10, // 現在絶頂値 100になると絶頂
  13075. i_vOrgasmCount = 700 + 20, // 絶頂回数
  13076. i_vOrgasmCmb = 700 + 30, // 連続絶頂回数
  13077. i_OrgasmVoice = 700 + 40, // 絶頂音声再生フラグ(1再生開始、2再生中)
  13078. f_vOrgasmHoldTime = 700 + 50, //絶頂後ボーナスタイム(残り時間。MAX600)
  13079. b_BreastFlag = 1000 + 10, //噴乳(胸)開始フラグ
  13080. b_EnemaFlag = 1000 + 20, //噴乳(尻)開始フラグ
  13081. b_ChinpoFlag = 1000 + 30, //射精開始フラグ
  13082. b_SioFlag = 1000 + 40, //潮開始フラグ
  13083. d_AheValue = 1100 + 10, // アヘ値=アヘ有効での瞳の上昇値
  13084. d_AheValue2 = 1100 + 20,
  13085. d_vJirashi = 1300 + 10, // 焦らし度
  13086. b_ExciteLock = 1500 + 10, // 興奮度ロック
  13087. b_OrgasmLock = 1500 + 20, // 絶頂度ロック
  13088. b_RankoEnabled = 1600 + 10, // 乱交モード
  13089. obj_GetSaveSlot = 90000 + 1, //セーブスロット項目、一日でリセット(値渡し)
  13090. i_GuiFlag = 98000 + 1, // GUIの表示フラグ(0:非表示、1:表示、2:最小化)
  13091. b_GuiFlag2 = 98000 + 2, // 設定画面の表示フラグ
  13092. b_GuiFlag3 = 98000 + 3, // 命令画面の表示フラグ
  13093. b_StartFlag = 98100 + 1, //#1.0.1.2で追加#シーン開始後の有効状態フラグ(通常操作があるまでFalse)
  13094. obj_VibeYourMaidConfig = 99800 + 1, //設定ファイル項目(荒業/非推奨/参照渡し)
  13095. obj_VibeYourMaidCfgWriting = 99900 + 2, //GUI設定項目(荒業/非推奨/参照渡し)
  13096. };
  13097. public class SaveSlot
  13098. {
  13099. public bool SaveFlag = false;
  13100. public List<double> vBoostBaseSave = new List<double>();
  13101. public List<int> vOrgasmCountSave = new List<int>();
  13102. public List<string> MaidNameSave = new List<string>();
  13103. public List<int> VLevelSave = new List<int>();
  13104. public List<string> FaceBackupSave = new List<string>();
  13105. public List<string> MotionBackupSave = new List<string>();
  13106. }
  13107. //////////////////////////////////////////////////////////////////////////////
  13108. //
  13109. //プラグインの有効状態を取得 0:無効、1:有効、-1:取得失敗
  13110. //
  13111. /// <summary>
  13112. /// (ViveYourMaid.API関数)プラグインの有効状態を取得
  13113. /// </summary>
  13114. /// <returns>0:無効、1:有効、-1:取得失敗</returns>
  13115. public static int GetPluginEnabled()
  13116. {
  13117. try
  13118. {
  13119. object o = GetVYM_Value(API.VYM_IO_ID.b_PluginEnabledV/*, true*/);
  13120. if (o is bool)
  13121. return (bool)o ? 1 : 0;
  13122. }
  13123. catch (Exception e) { UnityEngine.Debug.Log("GetPluginEnabled Error:" + e); }
  13124. return -1;
  13125. }
  13126. //////////////////////////////////////////////////////////////////////////////
  13127. //
  13128. // API.VYM_IO_IDで指定した数値の読み出し
  13129. // 成功ならオブジェクト型で返るので、VYM_IO_IDアイテムの最初の文字を参考にキャストして使用
  13130. // 失敗:null
  13131. //
  13132. /// <summary>
  13133. /// (ViveYourMaid.API関数)プラグインからのパラメータ読み出し用
  13134. /// 成功ならオブジェクト型で返るので、VYM_IO_IDアイテムの最初の文字を参考にキャストして使用
  13135. /// [頭文字:i=int、d=double、f=float、b=bool、obj=特殊・固有のオブジェクト]
  13136. /// <param name="id">パラメータID(ターゲット指定)</param>
  13137. /// <returns>成功:指定の値(キャストして使用)、失敗:nullまたは数値型なら-1以下</returns>
  13138. /// </summary>
  13139. public static object GetVYM_Value(API.VYM_IO_ID id/*, bool PluginEnabled*/)
  13140. {
  13141. try
  13142. {
  13143. if (checkVYM()/* && PluginEnabled*/)
  13144. return dlg_API_Entry(1, ((int)id), null);
  13145. //return mi_api_entry.Invoke(objVYM, new System.Object[] {1, ((int)id), null });
  13146. //else
  13147. // return getVYM_Value_Emu(id);
  13148. }
  13149. catch (Exception e) { UnityEngine.Debug.Log("GetVYM_Value Error:" + e); }
  13150. return null;
  13151. }
  13152. //////////////////////////////////////////////////////////////////////////////
  13153. //
  13154. // API.VYM_IO_IDで指定した数値の書き込み(処理的に問題なさそうな物だけ実装)
  13155. //
  13156. // objVarはVYM_IO_IDアイテムの最初の文字を参考に指定(型が違うと失敗します)
  13157. // 成功なら0、メイドの状態などで設定できなかった場合は1
  13158. // 失敗:-1以下(-1は本体クラス側…書き込み拒否含む、-2はAPIクラス側でエラー)
  13159. //
  13160. /// <summary>
  13161. /// (ViveYourMaid.API関数)プラグインへのパラメータ書き込み用
  13162. /// ※objVarはVYM_IO_IDアイテムの最初の文字を参考に指定(型が違うと失敗します)
  13163. /// [頭文字:i=int、d=double、f=float、b=bool、obj=特殊・固有のオブジェクト]
  13164. /// </summary>
  13165. /// <param name="id">パラメータID(ターゲット指定)</param>
  13166. /// <param name="objVar">書き込みたい値</param>
  13167. /// <returns>成功:0、メイドやシーン状態などで設定不可:1、エラーや書込不可:-1以下</returns>
  13168. public static int SetVYM_Value(API.VYM_IO_ID id, object objVar, bool PluginEnabled)
  13169. {
  13170. try
  13171. {
  13172. if (checkVYM() && PluginEnabled)
  13173. {
  13174. object ret = dlg_API_Entry(2, ((int)id), objVar);
  13175. if (ret is int)
  13176. return (int)ret;
  13177. }
  13178. }
  13179. catch (Exception e) { UnityEngine.Debug.Log("SetVYM_Value Error:" + e); }
  13180. return -2;
  13181. }
  13182. }
  13183. //<-@VYM.APIクラス追加ここまで
  13184. }