bundle.js 323 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870
  1. (function () {
  2. 'use strict';
  3. class ImageRunTime extends Laya.Image {
  4. constructor() {
  5. super();
  6. this.scaleTime = 80;
  7. this.clickId = false;
  8. this.on(Laya.Event.MOUSE_DOWN, this, this.scaleSmall);
  9. this.on(Laya.Event.MOUSE_OVER, this, this.overs);
  10. this.on(Laya.Event.MOUSE_UP, this, this.scaleBig);
  11. this.on(Laya.Event.MOUSE_OUT, this, this.mouseout);
  12. }
  13. scaleBig(e) {
  14. if (!this.clickId)
  15. return;
  16. this.clickId = false;
  17. this.alpha = 1;
  18. if (this.CZ) {
  19. this.CZ();
  20. }
  21. }
  22. overs() {
  23. this.alpha = 0.7;
  24. }
  25. mouseout() {
  26. this.alpha = 1;
  27. }
  28. scaleSmall(e) {
  29. this.clickId = true;
  30. }
  31. onDestroy() {
  32. this.ClearRunTime();
  33. }
  34. ClearRunTime() {
  35. this.off(Laya.Event.MOUSE_DOWN, this, this.scaleSmall);
  36. this.off(Laya.Event.MOUSE_UP, this, this.scaleBig);
  37. this.off(Laya.Event.MOUSE_OUT, this, this.mouseout);
  38. this.off(Laya.Event.MOUSE_OVER, this, this.overs);
  39. this.CZ = null;
  40. }
  41. }
  42. class GameTool {
  43. static getM_Vector(v1, v2) {
  44. let temp = new Laya.Vector3();
  45. Laya.Vector3.add(v1, v2, temp);
  46. return new Laya.Vector3(temp.x * 0.5, temp.y * 0.5, temp.z * 0.5);
  47. }
  48. static SpliteString(s, sp) {
  49. var _sp = sp ? sp : ";";
  50. let s_s = s.split(_sp);
  51. let result = [];
  52. for (let i = 0; i < s_s.length; i++) {
  53. result.push(s_s[i]);
  54. }
  55. return result;
  56. }
  57. static random_1to1() {
  58. var iszheng = Math.random() > 0.5 ? -1 : 1;
  59. return Math.random() * iszheng;
  60. }
  61. static get64Encode(str) {
  62. var c1, c2, c3;
  63. var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  64. var i = 0, len = str.length, string = '';
  65. while (i < len) {
  66. c1 = str.charCodeAt(i++) & 0xff;
  67. if (i == len) {
  68. string += base64EncodeChars.charAt(c1 >> 2);
  69. string += base64EncodeChars.charAt((c1 & 0x3) << 4);
  70. string += "==";
  71. break;
  72. }
  73. c2 = str.charCodeAt(i++);
  74. if (i == len) {
  75. string += base64EncodeChars.charAt(c1 >> 2);
  76. string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
  77. string += base64EncodeChars.charAt((c2 & 0xF) << 2);
  78. string += "=";
  79. break;
  80. }
  81. c3 = str.charCodeAt(i++);
  82. string += base64EncodeChars.charAt(c1 >> 2);
  83. string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
  84. string += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
  85. string += base64EncodeChars.charAt(c3 & 0x3F);
  86. }
  87. return string;
  88. }
  89. static randomInt(min, max) {
  90. if (max < min)
  91. return parseInt(min);
  92. return parseInt(Math.random() * (max - min + 1) + min);
  93. }
  94. }
  95. class Dictionary {
  96. constructor() {
  97. this._container = {};
  98. this._length = 0;
  99. }
  100. get container() {
  101. return this._container;
  102. }
  103. get size() {
  104. return this._length;
  105. }
  106. set(key, value) {
  107. if (!this._container.hasOwnProperty(key)) {
  108. this._length++;
  109. }
  110. this._container[key] = value;
  111. }
  112. delete(key) {
  113. if (this._container.hasOwnProperty(key)) {
  114. delete this._container[key];
  115. this._length--;
  116. }
  117. }
  118. has(key) {
  119. return this._container.hasOwnProperty(key) ? true : false;
  120. }
  121. get(key) {
  122. if (this._container.hasOwnProperty(key)) {
  123. return this._container[key];
  124. }
  125. else {
  126. return undefined;
  127. }
  128. }
  129. clear() {
  130. this._container = {};
  131. this._length = 0;
  132. }
  133. }
  134. class DispatcherManager {
  135. static get Disispatcher() {
  136. return DispatcherManager.disispatcher || (DispatcherManager.disispatcher = new Laya.EventDispatcher());
  137. }
  138. static on(type, call, data) {
  139. this.Disispatcher.on(type, call, data);
  140. }
  141. static off(type, call, data) {
  142. this.Disispatcher.off(type, call, data);
  143. }
  144. static event(type, data = null) {
  145. this.Disispatcher.event(type, data);
  146. }
  147. }
  148. class EventType {
  149. loadUI() {
  150. Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
  151. var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "正常模式"));
  152. changeActionButton.size(160, 40);
  153. changeActionButton.labelBold = true;
  154. changeActionButton.labelSize = 30;
  155. changeActionButton.sizeGrid = "4,4,4,4";
  156. changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
  157. changeActionButton.pos(Laya.stage.width / 2 - changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
  158. changeActionButton.on(Laya.Event.CLICK, this, function () {
  159. if (++this.curStateIndex % 2 == 1) {
  160. this.sprite3D.active = false;
  161. this.lineSprite3D.active = true;
  162. changeActionButton.label = "网格模式";
  163. }
  164. else {
  165. this.sprite3D.active = true;
  166. this.lineSprite3D.active = false;
  167. changeActionButton.label = "正常模式";
  168. }
  169. });
  170. }));
  171. }
  172. }
  173. EventType.Event = {
  174. CamFollowArg: "CamFollowArg",
  175. SetAimPos: "SetAimPos",
  176. RefreshBulletCount: "RefreshBulletCount",
  177. RefreshRemainEnemyCount: "RefreshRemainEnemyCount",
  178. GameShowTips: "GameShowTips",
  179. StartShot: 'StartShot',
  180. StopShot: 'StopShot',
  181. ShowMainUi: "ShowMainUi",
  182. SetMonery: "SetMonery",
  183. SetStage: "SetStage",
  184. SetStagePro: "SetStagePro"
  185. };
  186. class GameVersion {
  187. }
  188. GameVersion.VER = "1.0.11";
  189. GameVersion.CFG = "CFG";
  190. GameVersion.wxValue = "";
  191. GameVersion.isX = false;
  192. GameVersion.mSharePeopleScene = null;
  193. var Particle2D = Laya.Particle2D;
  194. var SoundType;
  195. (function (SoundType) {
  196. SoundType[SoundType["hit"] = 0] = "hit";
  197. SoundType[SoundType["click"] = 1] = "click";
  198. SoundType[SoundType["win"] = 2] = "win";
  199. SoundType[SoundType["defeat"] = 3] = "defeat";
  200. })(SoundType || (SoundType = {}));
  201. class SettingController {
  202. constructor() {
  203. this.vibrate = true;
  204. this.sound = true;
  205. this.SoundType = {
  206. click: "subpackage1/sound/click.mp3",
  207. win: "subpackage1/sound/vector.mp3",
  208. defeat: "subpackage1/sound/defeat.mp3",
  209. car_crush_1: "subpackage1/sound/car_crush_1.mp3",
  210. car_crush_2: "subpackage1/sound/car_crush_2.mp3",
  211. car_crush_3: "subpackage1/sound/car_crush_3.mp3",
  212. explotion1: "subpackage1/sound/explotion1.mp3",
  213. explotion2: "subpackage1/sound/explotion2.mp3",
  214. gun_fire_1: "subpackage1/sound/gun_fire_1.mp3",
  215. gun_fire_2: "subpackage1/sound/gun_fire_2.mp3",
  216. gun_fire_3: "subpackage1/sound/gun_fire_3.mp3",
  217. reload_gun_1: "subpackage1/sound/reload_gun_1.mp3",
  218. reload_gun_2: "subpackage1/sound/reload_gun_2.mp3",
  219. hitcar: "subpackage1/sound/hitcar.mp3",
  220. hitrole: "subpackage1/sound/hitrole.mp3",
  221. hit: "subpackage1/sound/hit.mp3"
  222. };
  223. this.bgm = "subpackage1/sound/bgm.mp3";
  224. }
  225. static get Instance() {
  226. return this.instasnce || (this.instasnce = new SettingController());
  227. }
  228. onAssetsLoaded(settings) {
  229. this.sp = new Particle2D(settings);
  230. this.sp.emitter.start();
  231. this.sp.play();
  232. Laya.stage.addChild(this.sp);
  233. this.sp.x = Laya.stage.width / 2;
  234. this.sp.y = Laya.stage.height / 2;
  235. }
  236. SettingSound(value) {
  237. }
  238. _playMusic(on) {
  239. }
  240. SetSoundV(value) {
  241. }
  242. PlaySound(type) {
  243. }
  244. StopSound(type) {
  245. }
  246. Init() {
  247. var v = Laya.LocalStorage.getItem("vibrate");
  248. this.vibrate = Number(v) ? v == "1" ? true : false : true;
  249. }
  250. }
  251. class ShareModule {
  252. static GoShare(callBack) {
  253. ShareModule.ShareTime = new Date().getTime();
  254. console.log("分享点击时间=" + ShareModule.ShareTime);
  255. ShareModule.IsSharing = true;
  256. ShareModule.callback = callBack;
  257. }
  258. static OnShowHandle() {
  259. if (Laya.Browser.window.wx) {
  260. Laya.Browser.window.wx.onShow(function (option) {
  261. SettingController.Instance.SetSoundV(1);
  262. console.log("onshow share start");
  263. console.log("进入微信");
  264. if (ShareModule.IsSharing) {
  265. ShareModule.IsSharing = false;
  266. let time = new Date().getTime();
  267. console.log("分享回到游戏时间" + time);
  268. let wait = (time - ShareModule.ShareTime) / 1000;
  269. console.log("分享停留时间为:" + wait);
  270. if (wait >= 2) {
  271. if (Math.random() <= 1) {
  272. if (!ShareModule.callback)
  273. return;
  274. ShareModule.callback(true, 1);
  275. }
  276. else {
  277. if (!ShareModule.callback)
  278. return;
  279. if (Math.random() <= 0.5) {
  280. ViewManager.Instance.ShowTips("分享失败!");
  281. }
  282. else {
  283. ViewManager.Instance.ShowTips("请分享到不同的群!");
  284. }
  285. ShareModule.callback(false, 1);
  286. }
  287. }
  288. else {
  289. if (!ShareModule.callback)
  290. return;
  291. if (Math.random() <= 0.5) {
  292. ViewManager.Instance.ShowTips("分享失败!");
  293. }
  294. else {
  295. ViewManager.Instance.ShowTips("请分享到不同的群!");
  296. }
  297. ShareModule.callback(false, 1);
  298. }
  299. }
  300. });
  301. }
  302. }
  303. }
  304. ShareModule.IsSharing = false;
  305. class OnHideHandler {
  306. static Reg() {
  307. }
  308. }
  309. var Templet = Laya.Templet;
  310. var Event = Laya.Event;
  311. class NetInfoManager {
  312. constructor() {
  313. this.mStartX = 200;
  314. this.mStartY = 500;
  315. this.mActionIndex = 0;
  316. this.mCurrIndex = 0;
  317. this.mCurrSkinIndex = 0;
  318. }
  319. static get Instance() {
  320. return this.instance || (this.instance = new NetInfoManager());
  321. }
  322. GetThing(id) {
  323. if (this._thing) {
  324. return this._thing[id - 1];
  325. }
  326. return null;
  327. }
  328. GetTheme(id) {
  329. if (this._theme) {
  330. return this._theme[id - 1];
  331. }
  332. return null;
  333. }
  334. GetRoad(id) {
  335. if (this._road) {
  336. return this._road[id - 1];
  337. }
  338. return null;
  339. }
  340. GetRate(id) {
  341. if (this._rate) {
  342. return this._rate[id - 1];
  343. }
  344. return null;
  345. }
  346. GetStreet(id) {
  347. if (this._block) {
  348. return this._block[id - 1];
  349. }
  350. return null;
  351. }
  352. GetGlobal(key) {
  353. if (this._globe) {
  354. for (let index = 0; index < this._globe.length; index++) {
  355. const element = this._globe[index];
  356. if (element.key == key) {
  357. return element.value;
  358. }
  359. }
  360. }
  361. }
  362. GetLevel(id) {
  363. if (this._level) {
  364. return this._level[id - 1];
  365. }
  366. return null;
  367. }
  368. GetAtk(id) {
  369. if (this._atk) {
  370. return this._atk[id - 1];
  371. }
  372. return null;
  373. }
  374. startFun() {
  375. this.mAniPath = "res/spine/spineRes5/vine.sk";
  376. this.mFactory = new Templet();
  377. this.mFactory.on(Event.COMPLETE, this, this.parseComplete);
  378. this.mFactory.on(Event.ERROR, this, this.onError);
  379. this.mFactory.loadAni(this.mAniPath);
  380. }
  381. onError() {
  382. console.log("error");
  383. }
  384. parseComplete() {
  385. this.mArmature = this.mFactory.buildArmature(1);
  386. this.mArmature.x = this.mStartX;
  387. this.mArmature.y = this.mStartY;
  388. this.mArmature.scale(0.5, 0.5);
  389. Laya.stage.addChild(this.mArmature);
  390. this.mArmature.on(Event.STOPPED, this, this.completeHandler);
  391. this.play();
  392. }
  393. completeHandler() {
  394. this.play();
  395. }
  396. play() {
  397. this.mCurrIndex++;
  398. if (this.mCurrIndex >= this.mArmature.getAnimNum()) {
  399. this.mCurrIndex = 0;
  400. }
  401. this.mArmature.play(this.mCurrIndex, false);
  402. }
  403. }
  404. class AssetPath {
  405. loadUI() {
  406. Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
  407. var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "切换注视目标"));
  408. changeActionButton.size(200, 40);
  409. changeActionButton.labelBold = true;
  410. changeActionButton.labelSize = 30;
  411. changeActionButton.sizeGrid = "4,4,4,4";
  412. changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
  413. changeActionButton.pos(Laya.stage.width / 2 - changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
  414. changeActionButton.on(Laya.Event.CLICK, this, function () {
  415. this.index++;
  416. if (this.index % 3 === 1) {
  417. this.camera.transform.lookAt(this.box.transform.position, this.upVector);
  418. }
  419. else if (this.index % 3 === 2) {
  420. this.camera.transform.lookAt(this.cylinder.transform.position, this.upVector);
  421. }
  422. else {
  423. this.camera.transform.lookAt(this.capsule.transform.position, this.upVector);
  424. }
  425. });
  426. }));
  427. }
  428. }
  429. AssetPath.MainScene = "subpackage/LayaScene_MainScene/Conventional/main.ls";
  430. AssetPath.Player = ["subpackage/LayaScene_Character/Conventional/Character1.lh",
  431. "subpackage/LayaScene_Character/Conventional/Character2.lh",
  432. "subpackage/LayaScene_Character/Conventional/Character3.lh",
  433. "subpackage/LayaScene_Character/Conventional/Character4.lh",
  434. "subpackage/LayaScene_Character/Conventional/Character5.lh",
  435. "subpackage/LayaScene_Character/Conventional/Character6.lh",
  436. "subpackage/LayaScene_Character/Conventional/Character7.lh",
  437. "subpackage/LayaScene_Character/Conventional/Character8.lh",
  438. ];
  439. AssetPath.Enemy = "subpackage/LayaScene_Character/Conventional/enemy.lh";
  440. AssetPath.PlayerShot = "subpackage/LayaScene_Property/Conventional/PlayerShoot.lh";
  441. AssetPath.Mound = "subpackage/LayaScene_Property/Conventional/Mound.lh";
  442. AssetPath.Barrier = [
  443. "subpackage/LayaScene_barrier/Conventional/barrier_1.lh",
  444. "subpackage/LayaScene_barrier/Conventional/barrier_2.lh",
  445. "subpackage/LayaScene_barrier/Conventional/barrier_3.lh",
  446. "subpackage/LayaScene_barrier/Conventional/barrier_4.lh",
  447. "subpackage/LayaScene_barrier/Conventional/move_barrier.lh",
  448. "subpackage/LayaScene_barrier/Conventional/stone_1.lh",
  449. "subpackage/LayaScene_barrier/Conventional/stone_2.lh",
  450. "subpackage/LayaScene_barrier/Conventional/stone_3.lh",
  451. "subpackage/LayaScene_barrier/Conventional/stone_4.lh",
  452. "subpackage/LayaScene_barrier/Conventional/Block1.lh",
  453. ];
  454. AssetPath.Particle = [
  455. "subpackage/LayaScene_Particle/Conventional/Explode.lh",
  456. "subpackage/LayaScene_Particle/Conventional/Hit.lh",
  457. "subpackage/LayaScene_Particle/Conventional/Blood.lh",
  458. ];
  459. AssetPath.Config = {
  460. level: "level",
  461. road: "road",
  462. block: "block",
  463. thing: "thing",
  464. atk: "atk",
  465. rate: "rate",
  466. global: "global",
  467. theme: "theme"
  468. };
  469. class AppSetting {
  470. constructor() {
  471. this._outHitResult = new Laya.HitResult();
  472. this.outs = new Array();
  473. this.posX = 0.0;
  474. this.posY = 0.0;
  475. this.point = new Laya.Vector2();
  476. }
  477. addBoxXYZ(x, y, z) {
  478. var mat1 = new Laya.BlinnPhongMaterial();
  479. Laya.Texture2D.load("res/threeDimen/Physics/rocks.jpg", Laya.Handler.create(null, function (tex) {
  480. mat1.albedoTexture = tex;
  481. }));
  482. var sX = Math.random() * 0.75 + 0.25;
  483. var sY = Math.random() * 0.75 + 0.25;
  484. var sZ = Math.random() * 0.75 + 0.25;
  485. var box = new Laya.MeshSprite3D(Laya.PrimitiveMesh.createBox(sX, sY, sZ));
  486. this.scene.addChild(box);
  487. box.meshRenderer.material = mat1;
  488. this.tmpVector.setValue(x, y, z);
  489. box.transform.position = this.tmpVector;
  490. this.tmpVector.setValue(Math.random() * 360, Math.random() * 360, Math.random() * 360);
  491. box.transform.rotationEuler = this.tmpVector;
  492. var rigidBody = box.addComponent(Laya.Rigidbody3D);
  493. var boxShape = new Laya.BoxColliderShape(sX, sY, sZ);
  494. rigidBody.colliderShape = boxShape;
  495. rigidBody.mass = 10;
  496. }
  497. }
  498. AppSetting.moveTime = 1;
  499. var TiledMap = Laya.TiledMap;
  500. var Rectangle = Laya.Rectangle;
  501. var Browser = Laya.Browser;
  502. var Handler = Laya.Handler;
  503. class PlayerManager {
  504. constructor() {
  505. this.stage = 1;
  506. this.equipId = 1;
  507. this.mLastMouseX = 0;
  508. this.mLastMouseY = 0;
  509. this.mX = 0;
  510. this.mY = 0;
  511. }
  512. static get Instance() {
  513. return PlayerManager.instance || (PlayerManager.instance = new PlayerManager());
  514. }
  515. static GlobalMessage() {
  516. PlayerManager.tower_reward = Number(NetInfoManager.Instance.GetGlobal("tower_reward"));
  517. PlayerManager.block_reward = Number(NetInfoManager.Instance.GetGlobal("block_reward"));
  518. PlayerManager.enemy_reward = Number(NetInfoManager.Instance.GetGlobal("enemy_reward"));
  519. }
  520. InitPlayer() {
  521. var usermodel = UserModel.Instance.CurModel;
  522. PlayerManager.instance.stage = (Number(usermodel.GetUserAttr(UserAttr.stage)) + 1);
  523. PlayerManager.instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
  524. this.SetInfo();
  525. }
  526. SpeedUp(level, chanel, count, callback) {
  527. let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "rate" }, { "level": level }, { "channel": chanel }, { "amount": count }];
  528. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {
  529. if (callback)
  530. callback(true);
  531. }, (data) => {
  532. if (callback)
  533. callback(false);
  534. });
  535. }
  536. SetInfo() {
  537. let power = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["power"];
  538. if (power)
  539. this.powerLevel = Number(power);
  540. else
  541. this.powerLevel = 1;
  542. let al = NetInfoManager.Instance._atk.length;
  543. let t = this.powerLevel > al ? al : this.powerLevel;
  544. PlayerManager.bulletAttack = NetInfoManager.Instance.GetAtk(t)["atk"];
  545. let rate = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["rate"];
  546. if (rate)
  547. this.rateLevel = Number(rate);
  548. else
  549. this.rateLevel = 1;
  550. let al1 = NetInfoManager.Instance._rate.length;
  551. let t1 = this.rateLevel > al1 ? al1 : this.rateLevel;
  552. PlayerManager.bulletTime = NetInfoManager.Instance.GetRate(t1)["rate"];
  553. }
  554. createMap() {
  555. this.tiledMap = new TiledMap();
  556. this.mX = this.mY = 0;
  557. this.tiledMap.createMap("res/tiledMap/desert.json", new Rectangle(0, 0, Browser.width, Browser.height), new Handler(this, this.completeHandler));
  558. }
  559. completeHandler() {
  560. console.log("地图创建完成");
  561. console.log("ClientW:" + Browser.clientWidth + " ClientH:" + Browser.clientHeight);
  562. Laya.stage.on(Laya.Event.RESIZE, this, this.resize);
  563. this.resize();
  564. }
  565. mouseDown() {
  566. this.mLastMouseX = Laya.stage.mouseX;
  567. this.mLastMouseY = Laya.stage.mouseY;
  568. Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.mouseMove);
  569. }
  570. mouseMove() {
  571. this.tiledMap.moveViewPort(this.mX - (Laya.stage.mouseX - this.mLastMouseX), this.mY - (Laya.stage.mouseY - this.mLastMouseY));
  572. }
  573. mouseUp() {
  574. this.mX = this.mX - (Laya.stage.mouseX - this.mLastMouseX);
  575. this.mY = this.mY - (Laya.stage.mouseY - this.mLastMouseY);
  576. Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.mouseMove);
  577. }
  578. resize() {
  579. this.tiledMap.changeViewPort(this.mX, this.mY, Browser.width, Browser.height);
  580. }
  581. PowerUp(level, chanel, count, callback) {
  582. let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "power" }, { "level": level }, { "channel": chanel }, { "amount": count }];
  583. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {
  584. if (callback)
  585. callback(true);
  586. }, (data) => {
  587. if (callback)
  588. callback(false);
  589. });
  590. }
  591. }
  592. PlayerManager.bulletAttack = 1;
  593. PlayerManager.bulletTime = 0.3;
  594. class GlobalParam {
  595. }
  596. GlobalParam.playerRayLengthF = 1.3;
  597. GlobalParam.playerRayLengthLR = 0.3;
  598. GlobalParam.bulletRayLength = 1;
  599. GlobalParam.bulletMaxDis = 40;
  600. GlobalParam.barrierRoadLength = 50;
  601. GlobalParam.barrierRoadAverageNum = 50;
  602. GlobalParam.playerspeed = 0.1;
  603. GlobalParam.matespeed = 0.2;
  604. GlobalParam.hitmaxcount = 2;
  605. GlobalParam.boommaxcount = 2;
  606. GlobalParam.blockLRmoveMaxDis = 5;
  607. GlobalParam.arriveStandWidth = 5;
  608. GlobalParam.enemySpeed = 0.1;
  609. GlobalParam.shootspeed = 0.8;
  610. GlobalParam.sliderFactor = 0.02;
  611. GlobalParam.playerMoveMaxX = 4.5;
  612. var Sprite = Laya.Sprite;
  613. var Event$1 = Laya.Event;
  614. var SoundManager = Laya.SoundManager;
  615. var Handler$1 = Laya.Handler;
  616. class UserInfoManager {
  617. static GameInfo() {
  618. PlayerManager.Instance.InitPlayer();
  619. }
  620. static SetCfg(cfg) {
  621. NetInfoManager.Instance._level = cfg[AssetPath.Config.level];
  622. NetInfoManager.Instance._road = cfg[AssetPath.Config.road];
  623. NetInfoManager.Instance._block = cfg[AssetPath.Config.block];
  624. NetInfoManager.Instance._thing = cfg[AssetPath.Config.thing];
  625. NetInfoManager.Instance._atk = cfg[AssetPath.Config.atk];
  626. NetInfoManager.Instance._rate = cfg[AssetPath.Config.rate];
  627. NetInfoManager.Instance._theme = cfg[AssetPath.Config.theme];
  628. NetInfoManager.Instance._globe = cfg[AssetPath.Config.global];
  629. PlayerManager.GlobalMessage();
  630. }
  631. setup() {
  632. var gap = 10;
  633. var soundButton = this.createButton("播放音效");
  634. soundButton.x = (Laya.stage.width - soundButton.width * 2 + gap) / 2;
  635. soundButton.y = (Laya.stage.height - soundButton.height) / 2;
  636. Laya.stage.addChild(soundButton);
  637. var musicButton = this.createButton("播放音乐");
  638. musicButton.x = soundButton.x + gap + soundButton.width;
  639. musicButton.y = soundButton.y;
  640. Laya.stage.addChild(musicButton);
  641. soundButton.on(Event$1.CLICK, this, this.onPlaySound);
  642. musicButton.on(Event$1.CLICK, this, this.onPlayMusic);
  643. }
  644. createButton(label) {
  645. var w = 110;
  646. var h = 40;
  647. var button = new Sprite();
  648. button.size(w, h);
  649. button.graphics.drawRect(0, 0, w, h, "#FF7F50");
  650. button.graphics.fillText(label, w / 2, 8, "25px SimHei", "#FFFFFF", "center");
  651. Laya.stage.addChild(button);
  652. return button;
  653. }
  654. onPlayMusic(e) {
  655. console.log("播放音乐");
  656. SoundManager.playMusic("res/sounds/bgm.mp3", 1, new Handler$1(this, this.onComplete));
  657. }
  658. onPlaySound(e) {
  659. console.log("播放音效");
  660. SoundManager.playSound("res/sounds/btn.mp3", 1, new Handler$1(this, this.onComplete));
  661. }
  662. onComplete() {
  663. console.log("播放完成");
  664. }
  665. static Appseting(data) {
  666. AppSetting.shareimage = data["shareimage"];
  667. AppSetting.sharetitle = data["sharetitle"];
  668. AppSetting.bannerCanMove = Number(data["bannerCanMove"]);
  669. AppSetting.moveTime = Number(data["moveTime"]);
  670. AppSetting.OpenSceneValue = Number(data["OpenSceneValue"]);
  671. AppSetting.freeUpdateVideotime = Number(data["freeUpdateVideotime"]);
  672. AppSetting.freecoinValue = Number(data["freecoinValue"]);
  673. AppSetting.freeGetcoinTime = Number(data["freeGetcoinTime"]);
  674. AppSetting.cheat = data["cheat"];
  675. AppSetting.cheattime = data["cheattime"];
  676. AppSetting.checkscene = data["checkscene"];
  677. GlobalParam.playerspeed = Number(data["playerspeed"]);
  678. GlobalParam.matespeed = Number(data["friendspeed"]);
  679. GlobalParam.shootspeed = Number(data["bulletspeed"]);
  680. GlobalParam.sliderFactor = Number(data["sliderFactor"]);
  681. GlobalParam.playerMoveMaxX = Number(data["playerMoveMaxX"]);
  682. GlobalParam.playerRayLengthF = Number(data["playerRayLengthF"]);
  683. GlobalParam.playerRayLengthLR = Number(data["playerRayLengthLR"]);
  684. GlobalParam.bulletRayLength = Number(data["bulletRayLength"]);
  685. GlobalParam.bulletMaxDis = Number(data["bulletMaxDis"]);
  686. GlobalParam.barrierRoadLength = Number(data["barrierRoadLength"]);
  687. GlobalParam.barrierRoadAverageNum = Number(data["barrierRoadAverageNum"]);
  688. GlobalParam.hitmaxcount = Number(data["hitmaxcount"]);
  689. GlobalParam.boommaxcount = Number(data["boommaxcount"]);
  690. GlobalParam.blockLRmoveMaxDis = Number(data["blockLRmoveMaxDis"]);
  691. GlobalParam.arriveStandWidth = Number(data["arriveStandWidth"]);
  692. GlobalParam.enemySpeed = Number(data["enemySpeed"]);
  693. }
  694. static get Cheat() {
  695. return AppSetting.cheat == "1";
  696. }
  697. static get CheatTime() {
  698. return Number(AppSetting.cheattime);
  699. }
  700. static get CheckScene() {
  701. return AppSetting.checkscene == "1";
  702. }
  703. }
  704. var Event$2 = Laya.Event;
  705. var HttpRequest = Laya.HttpRequest;
  706. const PROTOCOL_URL = "https://gungangfengyunapi.xwxgame.com/";
  707. class PROTOCOLS {
  708. }
  709. PROTOCOLS.protocols = {
  710. Login: "user/login",
  711. Userauth: "user/auth",
  712. BuyLand: "shop/land",
  713. UserSync: "user/sync",
  714. ShopBuild: "shop/build",
  715. ShopUpgrade: "shop/upgrade",
  716. ShopSale: "shop/sale",
  717. RoleUpgrade: "role/upgrade",
  718. Fissionvd: "fission/vd",
  719. DailyTaskrefresh: "dailytask/refresh",
  720. DailyTaskrewards: "dailytask/rewards",
  721. Rankingvmoney: "ranking/vmoney",
  722. Lotterylottery: "lottery/lottery",
  723. AchievementgetRewards: "achievement/getRewards",
  724. Fissiondeduct: "fission/deduct",
  725. Sign: "sign/sign",
  726. InvitegetRewards: "invite/getRewards",
  727. InvitetargetRewards: "invite/targetRewards",
  728. GameResult: "game/play",
  729. Easter: "game/revival",
  730. GetCfg: "config/table",
  731. DoubleAward: "fission/vd",
  732. KunDiscard: "kun/discard",
  733. KunEquip: "kun/equip",
  734. KunMove: "kun/move",
  735. KunBuy: "kun/buy",
  736. Opentreasure: "treasure/open",
  737. Entertreasure: "treasure/enter",
  738. Buy: "theme/buy",
  739. Equip: "theme/equip",
  740. themefission: "theme/fission",
  741. Start: "game/start",
  742. UpgradeAttr: "attr/upgrade"
  743. };
  744. class NetManager {
  745. PostTokenRequest(protocol, completecb, errorcb, isload = true) {
  746. let args = "";
  747. let url = PROTOCOL_URL + protocol;
  748. args = args = `token=${UserModel.Instance.CurModel.m_token}`;
  749. let httpRequest = new HttpRequest();
  750. httpRequest.once(Event$2.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
  751. httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
  752. httpRequest.send(url, args, "post", "text");
  753. if (isload) {
  754. WXSdk.ShowLoading("");
  755. }
  756. }
  757. onHttpRequestComplete(succeedcb, failurecb, httpRequest, isload) {
  758. let data;
  759. if (isload) {
  760. WXSdk.HideLoading();
  761. }
  762. data = JSON.parse(httpRequest.data);
  763. console.log("请求成功:" + JSON.stringify(data));
  764. if (data["code"] == 0) {
  765. UserModel.Instance.RefreshModel(data);
  766. if (succeedcb != null) {
  767. succeedcb(data);
  768. }
  769. }
  770. else {
  771. if (failurecb != null) {
  772. var mess = GameTool.SpliteString(data["message"], ",")[0];
  773. failurecb(mess);
  774. }
  775. }
  776. }
  777. onHttpRequestError(errorcb, httpRequest, isload) {
  778. if (errorcb != null) {
  779. var data = JSON.parse(httpRequest.data);
  780. errorcb(data);
  781. }
  782. console.log("Error! Http request error, code: " + data);
  783. if (isload) {
  784. WXSdk.HideLoading();
  785. }
  786. }
  787. static get Instance() {
  788. return NetManager.instance || (NetManager.instance = new NetManager());
  789. }
  790. login(progresscb, completecb, errorcb) {
  791. console.log("发送登录请求");
  792. var userInfor = UserModel.Instance;
  793. var ver = GameVersion.VER;
  794. let args = `code=${userInfor.m_code}&nickname=${userInfor.m_nickname}&avatar=${userInfor.m_avatar}&gender=${userInfor.m_gender}&country=${userInfor.m_country}&province=${userInfor.m_province}&city=${userInfor.m_city}&device=${userInfor.m_device}&share_id=${userInfor.m_share_id}&scene=${userInfor.channel}&v=${ver}`;
  795. console.log("登录 参数: " + args);
  796. let httpRequest = new HttpRequest();
  797. httpRequest.once(Event$2.PROGRESS, this, this.onHttpRequestProgress, [progresscb, httpRequest]);
  798. httpRequest.once(Event$2.COMPLETE, this, this.onLoginRequestComplete, [completecb, httpRequest]);
  799. httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
  800. httpRequest.send(PROTOCOL_URL + PROTOCOLS.protocols.Login, args, "post", "text");
  801. }
  802. onHttpRequestProgress() {
  803. }
  804. onLoginRequestComplete(completecb, httpRequest) {
  805. let data = JSON.parse(httpRequest.data);
  806. console.log(data);
  807. console.log("登录完成");
  808. if (data["code"] != "0") {
  809. var errInfo = JSON.stringify(httpRequest.data);
  810. console.log("登录异常错误!错误信息:", errInfo);
  811. completecb(data);
  812. return;
  813. }
  814. UserModel.Instance.SetUserModel(new NetUserModel(data["token"], data["configs"], data["app_setting"], data["user"], data["user_base"], data["user_invite"], data["user_lottery"], data["user_treasure"], data["t"], data["user_achievement"], data["user_sign"], data["user_arena"], data["is_new"], data["user_shop"], data["user_daily_task"], data["user_video"]));
  815. UserInfoManager.Appseting(data["app_setting"]);
  816. var ver = data["table_version"];
  817. UserModel.Instance.CurModel.JundgCfg(ver, (c) => {
  818. if (c) {
  819. UserInfoManager.GameInfo();
  820. completecb(data);
  821. }
  822. });
  823. WXSdk.ShareMessage();
  824. }
  825. PostCfgRequest(completecb, errorcb) {
  826. let args = "";
  827. let url = PROTOCOL_URL + PROTOCOLS.protocols.GetCfg;
  828. args = `token=${UserModel.Instance.CurModel.m_token}`;
  829. let httpRequest = new HttpRequest();
  830. httpRequest.once(Event$2.COMPLETE, this, () => {
  831. var data = JSON.parse(httpRequest.data);
  832. if (data["code"] == 0) {
  833. if (completecb != null) {
  834. if (data["configs"]) {
  835. completecb(data["configs"]);
  836. }
  837. }
  838. }
  839. else {
  840. if (errorcb != null) {
  841. errorcb(data);
  842. }
  843. }
  844. });
  845. httpRequest.once(Event$2.ERROR, this, () => {
  846. var data = JSON.parse(httpRequest.data);
  847. if (errorcb != null) {
  848. errorcb(data);
  849. }
  850. });
  851. httpRequest.send(url, args, "post", "text");
  852. }
  853. HttpPostRequest(protocol, param, completecb, errorcb, hasToken = true, isload = true) {
  854. let args = "";
  855. let url = PROTOCOL_URL + protocol;
  856. if (hasToken == true) {
  857. args = `token=${UserModel.Instance.CurModel.m_token}&`;
  858. }
  859. if (protocol == PROTOCOLS.protocols.UserSync || protocol == PROTOCOLS.protocols.Fissionvd || protocol == PROTOCOLS.protocols.Lotterylottery
  860. || protocol == PROTOCOLS.protocols.Fissiondeduct || protocol == PROTOCOLS.protocols.KunBuy || protocol == PROTOCOLS.protocols.KunDiscard
  861. || protocol == PROTOCOLS.protocols.KunEquip || protocol == PROTOCOLS.protocols.KunMove || protocol == PROTOCOLS.protocols.Start || protocol == PROTOCOLS.protocols.GameResult
  862. || protocol == PROTOCOLS.protocols.themefission || protocol == PROTOCOLS.protocols.Opentreasure || protocol == PROTOCOLS.protocols.UpgradeAttr) {
  863. let str = "abcdefghijkimnopqrstuvwxyz0123456789";
  864. let code = "{";
  865. let mask = "";
  866. for (let i = 0; i < 4; i++) {
  867. mask += str[Math.floor(Math.random() * 100) % str.length];
  868. }
  869. for (let i = 0; i < param.length; i++) {
  870. for (let key in param[i]) {
  871. code += "\"" + key + "\":";
  872. if (typeof param[i][key] === 'string') {
  873. code += "\"" + param[i][key] + "\"";
  874. }
  875. else {
  876. code += param[i][key];
  877. }
  878. }
  879. if (i < param.length - 1) {
  880. code += ",";
  881. }
  882. else {
  883. code += "}";
  884. }
  885. }
  886. args += "_r=" + mask + GameTool.get64Encode(code);
  887. }
  888. else {
  889. if (param != null) {
  890. for (let i = 0; i < param.length; i++) {
  891. for (let key in param[i]) {
  892. let val = param[i][key];
  893. args += `${key}=${val}`;
  894. if (i < param.length - 1) {
  895. args += "&";
  896. }
  897. }
  898. }
  899. }
  900. }
  901. let httpRequest = new HttpRequest();
  902. httpRequest.once(Event$2.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
  903. httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest, isload]);
  904. httpRequest.send(url, args, "post", "text");
  905. if (isload) {
  906. WXSdk.ShowLoading("");
  907. }
  908. }
  909. static errorRequest(arg, callback) {
  910. let httpRequest = new Laya.HttpRequest();
  911. if (callback) {
  912. httpRequest.once(Laya.Event.PROGRESS, this, () => { callback.progress && callback.progress(httpRequest); });
  913. httpRequest.once(Laya.Event.ERROR, this, () => { callback.error && callback.error(httpRequest); });
  914. httpRequest.once(Laya.Event.COMPLETE, this, () => { callback.complete && callback.complete(httpRequest); });
  915. }
  916. httpRequest.send("https://r.94xj.net/e", arg, "post", "json", ["Content-Type", "application/json"]);
  917. }
  918. static ErrorReport() {
  919. let arg = {
  920. "code": 1003,
  921. "msg": "invalid code",
  922. "user_id": 0,
  923. "game": "parkourrace",
  924. "type": "backend",
  925. "platform": "weixin"
  926. };
  927. this.errorRequest(arg, {
  928. complete: (request) => {
  929. },
  930. error: (request) => {
  931. }
  932. });
  933. }
  934. }
  935. var UserConfigName;
  936. (function (UserConfigName) {
  937. UserConfigName[UserConfigName["train"] = 0] = "train";
  938. UserConfigName[UserConfigName["sign"] = 1] = "sign";
  939. UserConfigName[UserConfigName["rewards"] = 2] = "rewards";
  940. })(UserConfigName || (UserConfigName = {}));
  941. var UserAttr;
  942. (function (UserAttr) {
  943. UserAttr[UserAttr["user_id"] = 0] = "user_id";
  944. UserAttr[UserAttr["diamond"] = 1] = "diamond";
  945. UserAttr[UserAttr["energy"] = 2] = "energy";
  946. UserAttr[UserAttr["list_kun"] = 3] = "list_kun";
  947. UserAttr[UserAttr["stage"] = 4] = "stage";
  948. UserAttr[UserAttr["vmoney"] = 5] = "vmoney";
  949. UserAttr[UserAttr["equip_kun"] = 6] = "equip_kun";
  950. UserAttr[UserAttr["unlock_kun"] = 7] = "unlock_kun";
  951. UserAttr[UserAttr["buyed_kun"] = 8] = "buyed_kun";
  952. UserAttr[UserAttr["money"] = 9] = "money";
  953. UserAttr[UserAttr["progress_themes"] = 10] = "progress_themes";
  954. UserAttr[UserAttr["equip_themes"] = 11] = "equip_themes";
  955. UserAttr[UserAttr["get_themes"] = 12] = "get_themes";
  956. UserAttr[UserAttr["attrs"] = 13] = "attrs";
  957. })(UserAttr || (UserAttr = {}));
  958. class NetUserModel {
  959. constructor(_token, _config, _appSetting, _user, _userbase, _useInvite, _user_lottery, _user_treasure, t, _user_achievement, _user_sign, _user_arena, is_new, user_shop, user_daily_task, user_video) {
  960. this.loginSeverTime = 0;
  961. this.m_avatar = "";
  962. this.localTime = Laya.timer.currTimer;
  963. this.loginSeverTime = t;
  964. this.m_token = _token;
  965. this.m_user = _user;
  966. this.m_base = _userbase;
  967. this.m_invite = _useInvite;
  968. this.m_lottery = _user_lottery;
  969. this.m_treasure = _user_treasure;
  970. this.m_achievement = _user_achievement;
  971. this.m_sign = _user_sign;
  972. this.m_arena = _user_arena;
  973. this.m_shop = user_shop;
  974. this.user_video = user_video;
  975. this.user_daily_task = user_daily_task;
  976. this.m_userid = this.m_user["user_id"];
  977. this.m_openid = this.m_base["openid"];
  978. this.m_nickname = this.m_base["nickname"];
  979. this.is_new = Number(is_new);
  980. }
  981. GetUserAttr(_attr) {
  982. var attr = UserAttr[_attr];
  983. return this.m_user[attr];
  984. }
  985. get ServerTime() {
  986. let time = Laya.timer.currTimer;
  987. let stime = this.loginSeverTime + Math.ceil((time - this.localTime) / 1000);
  988. return stime;
  989. }
  990. HasTheme(_id) {
  991. var data = this.GetUserAttr(UserAttr.get_themes);
  992. for (var i = 0; i < data.length; i++) {
  993. var hd = data[i];
  994. if (_id == hd) {
  995. return true;
  996. }
  997. }
  998. return false;
  999. }
  1000. GetThemeProgress(_id) {
  1001. var config = this.GetUserAttr(UserAttr.progress_themes);
  1002. var progress = config[_id] ? config[_id] : 0;
  1003. return progress;
  1004. }
  1005. JundgCfg(ver, callball) {
  1006. var cfg = Laya.LocalStorage.getJSON(GameVersion.CFG);
  1007. if (cfg) {
  1008. if (cfg.VER == ver) {
  1009. console.log("已经拥有,不用更新");
  1010. UserInfoManager.SetCfg(cfg);
  1011. callball(true);
  1012. }
  1013. else {
  1014. console.log("cfg存在但是过期了");
  1015. Laya.LocalStorage.removeItem(GameVersion.CFG);
  1016. NetManager.Instance.PostCfgRequest((data) => {
  1017. data.VER = ver;
  1018. Laya.LocalStorage.setJSON(GameVersion.CFG, data);
  1019. UserInfoManager.SetCfg(data);
  1020. callball(true);
  1021. }, (data) => {
  1022. console.log("配置获取失败" + data);
  1023. callball(false);
  1024. return;
  1025. });
  1026. }
  1027. }
  1028. else {
  1029. console.log("本地没有cfg");
  1030. NetManager.Instance.PostCfgRequest((data) => {
  1031. console.log("cfg" + data);
  1032. data.VER = ver;
  1033. Laya.LocalStorage.setJSON(GameVersion.CFG, data);
  1034. UserInfoManager.SetCfg(data);
  1035. callball(true);
  1036. }, (data) => {
  1037. console.log("配置获取失败" + data);
  1038. });
  1039. }
  1040. }
  1041. }
  1042. class UserModel {
  1043. get CurModel() {
  1044. return this.curModel;
  1045. }
  1046. constructor(code, nickname, avatar, gender, country, province, city, device, share_id, channel) {
  1047. UserModel.instance = this;
  1048. this.m_code = code;
  1049. this.m_nickname = nickname ? nickname : "";
  1050. this.m_avatar = avatar ? avatar : "";
  1051. this.m_gender = gender ? gender : 0;
  1052. this.m_city = city ? city : "";
  1053. this.m_device = device ? device : "";
  1054. this.m_share_id = share_id ? share_id : "";
  1055. this.channel = channel ? channel : "";
  1056. this.m_country = country ? country : "";
  1057. this.m_province = province ? province : "";
  1058. }
  1059. static get Instance() {
  1060. if (UserModel.instance) {
  1061. return UserModel.instance;
  1062. }
  1063. else {
  1064. UserModel.instance = new UserModel("11", "", "", 0, "", "", "", "", "", "");
  1065. return UserModel.instance;
  1066. }
  1067. }
  1068. SetUserModel(_model) {
  1069. this.curModel = _model;
  1070. }
  1071. RefreshModel(data) {
  1072. if (data["user"])
  1073. this.curModel.m_user = data["user"];
  1074. if (data["user_invite"])
  1075. this.curModel.m_invite = data["user_invite"];
  1076. if (data["user_lottery"])
  1077. this.curModel.m_lottery = data["user_lottery"];
  1078. if (data["user_achievement"]) {
  1079. this.curModel.m_achievement = data["user_achievement"];
  1080. }
  1081. if (data["user_sign"])
  1082. this.curModel.m_sign = data["user_sign"];
  1083. if (data["user_shop"])
  1084. this.curModel.m_shop = data["user_shop"];
  1085. if (data["user_daily_task"])
  1086. this.curModel.user_daily_task = data["user_daily_task"];
  1087. if (data["user_video"])
  1088. this.curModel.user_video = data["user_video"];
  1089. }
  1090. }
  1091. var ALDType;
  1092. (function (ALDType) {
  1093. ALDType[ALDType["\u767B\u5F55\u52A0\u8F7D"] = 0] = "\u767B\u5F55\u52A0\u8F7D";
  1094. ALDType[ALDType["\u754C\u9762\u5F00\u542F"] = 1] = "\u754C\u9762\u5F00\u542F";
  1095. })(ALDType || (ALDType = {}));
  1096. class WXSdk {
  1097. static get ShareId() {
  1098. return this.shareId;
  1099. }
  1100. static get Chanel() {
  1101. return this._chanel;
  1102. }
  1103. static init(cb) {
  1104. this.EventStatistics();
  1105. Laya.Browser.window.wx.showShareMenu({
  1106. withShareTicket: true
  1107. });
  1108. Laya.Browser.window.wx.onShow(this.InitWx);
  1109. }
  1110. static InitWx(option) {
  1111. var shareid = option.query.share_id;
  1112. this.shareId = shareid ? shareid : "";
  1113. GameVersion.wxValue = option.scene;
  1114. var scene = Laya.LocalStorage.getItem("scene");
  1115. if (scene) {
  1116. GameVersion.wxValue = scene;
  1117. console.log("读取配置场景值:" + scene);
  1118. }
  1119. else {
  1120. console.log("第一次拉取场景值:" + GameVersion.wxValue);
  1121. Laya.LocalStorage.setItem("scene", GameVersion.wxValue);
  1122. }
  1123. var channel = option.query.channel;
  1124. this._chanel = channel ? channel : "";
  1125. Laya.Browser.window.wx.offShow(WXSdk.InitWx);
  1126. }
  1127. static ShareMessage() {
  1128. if (!GameVersion.isWx)
  1129. return;
  1130. var t = UserModel.Instance.CurModel.ServerTime;
  1131. var _title;
  1132. var _url;
  1133. _title = AppSetting.sharetitle;
  1134. _url = AppSetting.shareimage;
  1135. if (_title == null) {
  1136. _title = "枪王之王...";
  1137. _url = "res/share.png";
  1138. }
  1139. else {
  1140. let a = GameTool.SpliteString(_title);
  1141. let b = GameTool.SpliteString(_url);
  1142. _title = a[GameTool.randomInt(0, a.length - 1)];
  1143. _url = b[GameTool.randomInt(0, b.length - 1)];
  1144. }
  1145. console.log("_title:", _title);
  1146. console.log("_url:", _url);
  1147. Laya.Browser.window.wx.onShareAppMessage(() => ({
  1148. title: _title,
  1149. imageUrl: _url,
  1150. query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_other_" + t + "_" + Math.floor(9999 * Math.random()).toString()
  1151. }));
  1152. }
  1153. static Login(cb) {
  1154. if (WXSdk.Lodining) {
  1155. return;
  1156. }
  1157. WXSdk.Lodining = true;
  1158. Laya.Browser.window.wx.login({
  1159. success: function (res) {
  1160. console.log("wx.login: success! res.code=" + res.code);
  1161. if (res.code) {
  1162. WXSdk.Lodining = false;
  1163. console.log("将要传递的参数:" + res);
  1164. cb(res);
  1165. }
  1166. else {
  1167. console.log('获取用户登录态失败!' + res.errMsg);
  1168. cb("error");
  1169. }
  1170. },
  1171. fail: function (res) { console.log("wx.login: failed, res=" + res); WXSdk.Lodining = false; cb("error"); }
  1172. });
  1173. }
  1174. static ShowLoading(title = "加载中...", isShowWx = true) {
  1175. console.log(title);
  1176. if (Laya.Browser.window && Laya.Browser.window.wx) {
  1177. if (isShowWx) {
  1178. Laya.Browser.window.wx.showLoading({ title: title, mask: true });
  1179. }
  1180. ViewManager.Instance.OpenMask();
  1181. }
  1182. else {
  1183. ViewManager.Instance.OpenMask();
  1184. }
  1185. }
  1186. static HideLoading(isShowWx = true) {
  1187. if (Laya.Browser.window && Laya.Browser.window.wx) {
  1188. if (isShowWx) {
  1189. Laya.Browser.window.wx.hideLoading();
  1190. }
  1191. ViewManager.Instance.CloseMask();
  1192. }
  1193. else {
  1194. ViewManager.Instance.CloseMask();
  1195. }
  1196. }
  1197. static SystemInfo() {
  1198. if (Laya.Browser.window.wx) {
  1199. if (!WXSdk.sysdata)
  1200. WXSdk.sysdata = Laya.Browser.window.wx.getSystemInfoSync();
  1201. return WXSdk.sysdata;
  1202. }
  1203. }
  1204. static ShowToast(text, icon = true) {
  1205. if (Laya.Browser.window.wx) {
  1206. var t_icon = icon ? "success" : "none";
  1207. text = text ? text : "暂未开放...";
  1208. Laya.Browser.window.wx.showToast({ title: text, icon: t_icon });
  1209. }
  1210. else {
  1211. console.log(text);
  1212. }
  1213. }
  1214. static ShortVibrate() {
  1215. if (Laya.Browser.window.wx && SettingController.Instance.vibrate) {
  1216. if (WXSdk.vibrating)
  1217. return;
  1218. WXSdk.vibrating = true;
  1219. Laya.Browser.window.wx.vibrateShort({
  1220. complete: function (res) {
  1221. WXSdk.vibrating = false;
  1222. }
  1223. });
  1224. }
  1225. }
  1226. static LongVibrate() {
  1227. if (Laya.Browser.window.wx && SettingController.Instance.vibrate) {
  1228. if (WXSdk.vibrating)
  1229. return;
  1230. WXSdk.vibrating = true;
  1231. Laya.Browser.window.wx.vibrateLong({
  1232. complete: function (res) {
  1233. WXSdk.vibrating = false;
  1234. }
  1235. });
  1236. }
  1237. }
  1238. static Success(stageId) {
  1239. if (!GameVersion.isWx)
  1240. return;
  1241. Laya.Browser.window.wx.aldStage.onEnd({
  1242. stageId: stageId,
  1243. stageName: "第" + stageId + "关",
  1244. event: "complete",
  1245. params: {
  1246. desc: "关卡完成"
  1247. }
  1248. });
  1249. }
  1250. static AldEvent(eventName, a) {
  1251. if (Laya.Browser.window && Laya.Browser.window.wx) {
  1252. Laya.Browser.window.wx.aldSendEvent(eventName, { key: "" });
  1253. }
  1254. }
  1255. static EventStatistics() {
  1256. let uuid = Laya.LocalStorage.getItem("uuidTimes");
  1257. if (uuid) {
  1258. let lastSignTime = new Date(Number(uuid));
  1259. let todayZero = new Date(Laya.timer.currTimer);
  1260. todayZero.setHours(0, 0, 0, 0);
  1261. if (lastSignTime.valueOf() < todayZero.valueOf()) {
  1262. this.IsNew = 0;
  1263. }
  1264. else {
  1265. this.IsNew = 1;
  1266. }
  1267. }
  1268. else {
  1269. this.IsNew = 1;
  1270. Laya.LocalStorage.setItem("uuidTimes", Laya.timer.currTimer.toString());
  1271. }
  1272. }
  1273. static Fail(stageId) {
  1274. if (!GameVersion.isWx)
  1275. return;
  1276. Laya.Browser.window.wx.aldStage.onEnd({
  1277. stageId: stageId,
  1278. stageName: "第" + stageId + "关",
  1279. event: "fail",
  1280. params: {
  1281. desc: "关卡失败",
  1282. }
  1283. });
  1284. }
  1285. static Start(stageId) {
  1286. if (!GameVersion.isWx)
  1287. return;
  1288. Laya.Browser.window.wx.aldStage.onStart({
  1289. stageId: stageId,
  1290. stageName: "第" + stageId + "关",
  1291. });
  1292. }
  1293. static Game_Share(callback = null, channel = "") {
  1294. if (!GameVersion.isWx) {
  1295. return;
  1296. }
  1297. var _title;
  1298. var _url;
  1299. _title = AppSetting.sharetitle;
  1300. _url = AppSetting.shareimage;
  1301. if (_title == null) {
  1302. _title = "枪王之王...";
  1303. _url = "res/share.png";
  1304. }
  1305. else {
  1306. let a = GameTool.SpliteString(_title);
  1307. let b = GameTool.SpliteString(_url);
  1308. _title = a[GameTool.randomInt(0, a.length - 1)];
  1309. _url = b[GameTool.randomInt(0, b.length - 1)];
  1310. }
  1311. console.log("_title:", _title);
  1312. console.log("_url:", _url);
  1313. var t = UserModel.Instance.CurModel.ServerTime;
  1314. Laya.Browser.window.wx.shareAppMessage({
  1315. title: _title,
  1316. imageUrl: _url,
  1317. query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_" + "other" + "_" + t + "_" + Math.floor(9999 * Math.random()).toString(),
  1318. });
  1319. ShareModule.GoShare(callback);
  1320. }
  1321. static LoadSubPackage(name, callback) {
  1322. if (GameVersion.isWx) {
  1323. const loadTask = Laya.Browser.window.wx.loadSubpackage({
  1324. name: name,
  1325. success(res) {
  1326. console.log("分包下载成功:", res);
  1327. if (callback)
  1328. callback(true);
  1329. },
  1330. fail(res) {
  1331. console.log("分包下载失败:" + JSON.stringify(res));
  1332. if (callback)
  1333. callback(false);
  1334. }
  1335. });
  1336. }
  1337. else {
  1338. if (callback)
  1339. callback(true);
  1340. }
  1341. }
  1342. static IsNeedUpdate() {
  1343. if (!GameVersion.isWx)
  1344. return false;
  1345. const updateManager = Laya.Browser.window.wx.getUpdateManager();
  1346. updateManager.onCheckForUpdate(function (res) {
  1347. console.log("最新版本:" + res.hasUpdate);
  1348. });
  1349. updateManager.onUpdateReady(function () {
  1350. Laya.Browser.window.wx.showModal({
  1351. showCancel: false,
  1352. title: '更新提示',
  1353. content: '新版本已经准备好,是否重启应用?',
  1354. success(res) {
  1355. updateManager.applyUpdate();
  1356. },
  1357. fail(res) {
  1358. updateManager.applyUpdate();
  1359. }
  1360. });
  1361. });
  1362. }
  1363. static IsAuth() {
  1364. if (Laya.Browser.window && Laya.Browser.window.wx) {
  1365. Laya.Browser.window.wx.getSetting({
  1366. success: (res) => {
  1367. console.log("授权结果..");
  1368. console.log(res);
  1369. if (res.authSetting['scope.userInfo'] == true) {
  1370. WXSdk.isAuth = true;
  1371. Laya.Browser.window.wx.getUserInfo({
  1372. lang: 'zh_CN',
  1373. success: (res) => {
  1374. UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName;
  1375. UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl;
  1376. console.log("已经受过权");
  1377. },
  1378. fail: () => {
  1379. console.log('调用getUserInfo fail');
  1380. }
  1381. });
  1382. }
  1383. }
  1384. });
  1385. }
  1386. }
  1387. static RequestAuth(callback) {
  1388. if (WXSdk.isAuth) {
  1389. if (callback != null) {
  1390. callback(true);
  1391. }
  1392. return;
  1393. }
  1394. if (GameVersion.isWx) {
  1395. console.log("-----授权");
  1396. let openAuthView = () => {
  1397. let w = Laya.stage.width;
  1398. let h = Laya.stage.height;
  1399. console.log("准备授权");
  1400. let button = Laya.Browser.window.wx.createUserInfoButton({
  1401. type: 'text',
  1402. text: '',
  1403. style: {
  1404. left: 0,
  1405. top: 0,
  1406. width: w,
  1407. height: h,
  1408. lineHeight: 40,
  1409. backgroundColor: '#00000000',
  1410. textAlign: 'center',
  1411. fontSize: 16,
  1412. borderRadius: 4
  1413. }
  1414. });
  1415. let opTapHandler = (res) => {
  1416. console.log("res:" + JSON.stringify(res));
  1417. if (res.userInfo) {
  1418. button.hide();
  1419. button.offTap(opTapHandler);
  1420. button.destroy();
  1421. console.log("userinfo", res);
  1422. UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName;
  1423. UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl;
  1424. let param = [{ "nickname": res.userInfo.nickName }, { "avatar": res.userInfo.avatarUrl }, { "gender": res.userInfo.gender }, { "city": res.userInfo.city },
  1425. { "country": res.userInfo.country }, { "province": res.userInfo.province }];
  1426. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Userauth, param, () => {
  1427. WXSdk.isAuth = true;
  1428. if (callback != null) {
  1429. callback(true);
  1430. }
  1431. }, null);
  1432. }
  1433. else {
  1434. button.hide();
  1435. button.offTap(opTapHandler);
  1436. button.destroy();
  1437. if (callback != null) {
  1438. callback(false);
  1439. }
  1440. }
  1441. };
  1442. button.show();
  1443. button.onTap(opTapHandler);
  1444. };
  1445. openAuthView();
  1446. }
  1447. else {
  1448. WXSdk.isAuth = true;
  1449. if (callback != null) {
  1450. callback(true);
  1451. }
  1452. }
  1453. }
  1454. static showbjWxGameQuan(flag) {
  1455. if (!GameVersion.isWx) {
  1456. return;
  1457. }
  1458. if (flag) {
  1459. if (this.button == null) {
  1460. let info = Laya.Browser.window.wx.getSystemInfoSync();
  1461. if (!info)
  1462. return;
  1463. var top = 0.5 * info.windowHeight;
  1464. var height = 109 * info.windowHeight / Laya.stage.height;
  1465. var width = height * 80 / 109;
  1466. Laya.stage.width;
  1467. this.button = Laya.Browser.window.wx.createGameClubButton({
  1468. type: "image",
  1469. image: 'res/talk.png',
  1470. style: {
  1471. left: info.windowWidth * 0.5 + 150 * info.windowWidth / Laya.stage.width,
  1472. top: top - 240 * info.windowHeight / Laya.stage.height,
  1473. width: width,
  1474. height: height
  1475. }
  1476. });
  1477. }
  1478. this.button.show();
  1479. }
  1480. else {
  1481. if (this.button) {
  1482. this.button.hide();
  1483. }
  1484. }
  1485. }
  1486. }
  1487. WXSdk.Lodining = false;
  1488. WXSdk.shareId = "";
  1489. WXSdk._chanel = "";
  1490. WXSdk.isAuth = false;
  1491. WXSdk.vibrating = false;
  1492. WXSdk.IsNew = 0;
  1493. var Sprite3D = Laya.Sprite3D;
  1494. var PoolType;
  1495. (function (PoolType) {
  1496. PoolType[PoolType["WarnTips"] = 1] = "WarnTips";
  1497. PoolType[PoolType["HpText"] = 2] = "HpText";
  1498. })(PoolType || (PoolType = {}));
  1499. class GamePool {
  1500. constructor() {
  1501. this.poolDic = new Dictionary();
  1502. this.prefabDic = new Dictionary();
  1503. this.singleobjDic = new Dictionary();
  1504. }
  1505. static get Instance() {
  1506. return GamePool.instance || (GamePool.instance = new GamePool());
  1507. }
  1508. InitSelf(name, prefab) {
  1509. if (prefab != null) {
  1510. if (!this.prefabDic.has(name))
  1511. this.prefabDic.set(name, prefab);
  1512. }
  1513. }
  1514. onComplete(s) {
  1515. Laya.Sprite3D.load("res/threeDimen/staticModel/lizard/lizard.lh", Laya.Handler.create(this, function (sprite) {
  1516. var monster1 = this.scene.addChild(sprite);
  1517. monster1.transform.position = new Laya.Vector3(-0.6, 0, 0);
  1518. monster1.transform.localScale = new Laya.Vector3(0.075, 0.075, 0.075);
  1519. var monster2 = Laya.Sprite3D.instantiate(monster1, this.scene, false, new Laya.Vector3(0.6, 0, 0));
  1520. monster2.transform.localScale = new Laya.Vector3(0.075, 0.075, 0.075);
  1521. for (var i = 0; i < monster2.getChildByName("lizard").numChildren; i++) {
  1522. var meshSprite3D = monster2.getChildByName("lizard").getChildAt(i);
  1523. var material = meshSprite3D.meshRenderer.material;
  1524. Laya.Texture2D.load(this.normalMapUrl[i], Laya.Handler.create(this, function (mat, texture) {
  1525. mat.normalTexture = texture;
  1526. }, [material]));
  1527. }
  1528. Laya.timer.frameLoop(1, this, function () {
  1529. monster1.transform.rotate(this.rotation);
  1530. monster2.transform.rotate(this.rotation);
  1531. });
  1532. }));
  1533. }
  1534. GetUi(type) {
  1535. if (this.singleobjDic.has(type)) {
  1536. if (this.singleobjDic.get(type).length > 0) {
  1537. var result = this.singleobjDic.get(type).shift();
  1538. result.visible = true;
  1539. return result;
  1540. }
  1541. else {
  1542. return this.GetByType(type);
  1543. }
  1544. }
  1545. else {
  1546. return this.GetByType(type);
  1547. }
  1548. }
  1549. RecoverUi(type, go) {
  1550. go.visible = false;
  1551. go.removeSelf();
  1552. if (!this.singleobjDic.has(type)) {
  1553. this.singleobjDic.set(type, new Array());
  1554. }
  1555. this.singleobjDic.get(type).push(go);
  1556. }
  1557. RecoverModel(go) {
  1558. if (!go)
  1559. return;
  1560. go.active = false;
  1561. go.removeSelf();
  1562. var key = go.name;
  1563. if (!this.poolDic.has(key)) {
  1564. this.poolDic.set(key, new Array());
  1565. }
  1566. this.poolDic.get(key).push(go);
  1567. }
  1568. GetModel(name) {
  1569. if (name == "PlayerShoot")
  1570. GamePool.bulletCount++;
  1571. if (this.poolDic.has(name)) {
  1572. if (this.poolDic.get(name).length > 0) {
  1573. var result = this.poolDic.get(name).shift();
  1574. result.active = true;
  1575. return result;
  1576. }
  1577. else {
  1578. if (this.prefabDic.has(name)) {
  1579. var curObj = Sprite3D.instantiate(this.prefabDic.get(name));
  1580. curObj.name = name;
  1581. console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id);
  1582. return curObj;
  1583. }
  1584. else {
  1585. return null;
  1586. }
  1587. }
  1588. }
  1589. else {
  1590. if (this.prefabDic.has(name)) {
  1591. var curObj = Sprite3D.instantiate(this.prefabDic.get(name));
  1592. curObj.name = name;
  1593. console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id);
  1594. return curObj;
  1595. }
  1596. else {
  1597. return null;
  1598. }
  1599. }
  1600. }
  1601. onStateEnter() {
  1602. console.log("动画开始播放了");
  1603. }
  1604. onStateUpdate() {
  1605. console.log("动画状态更新了");
  1606. }
  1607. onStateExit() {
  1608. console.log("动画退出了");
  1609. }
  1610. GetByType(type) {
  1611. if (type == PoolType.WarnTips) {
  1612. var _t = new Laya.Text();
  1613. _t.width = 720;
  1614. _t.height = 60;
  1615. _t.align = "center";
  1616. _t.valign = "middle";
  1617. _t.fontSize = 35;
  1618. _t.bold = true;
  1619. _t.pivotX = 360;
  1620. _t.pivotY = 30;
  1621. _t.color = "#ffffff";
  1622. _t.stroke = 5;
  1623. _t.strokeColor = "#000000";
  1624. return _t;
  1625. }
  1626. else if (type == PoolType.HpText) {
  1627. var _t = new Laya.Text();
  1628. _t.font = "Microsoft YaHei";
  1629. _t.width = 260;
  1630. _t.height = 50;
  1631. _t.align = "center";
  1632. _t.valign = "middle";
  1633. _t.fontSize = 30;
  1634. _t.bold = true;
  1635. _t.pivotX = 130;
  1636. _t.pivotY = 25;
  1637. _t.color = "#ffffff";
  1638. return _t;
  1639. }
  1640. }
  1641. }
  1642. GamePool.modeltype = {
  1643. Mound: "Mound",
  1644. PlayerShoot: "PlayerShoot",
  1645. Player: "Character",
  1646. Enemy: "enemy"
  1647. };
  1648. GamePool.bulletCount = 0;
  1649. class FollowNumber {
  1650. constructor(t, from = 0, to = 0, tiny = 0) {
  1651. this.m_t = 0;
  1652. this.target = 0;
  1653. this.follow = 0;
  1654. this.m_tiny = 0;
  1655. this.m_t = t;
  1656. this.target = to;
  1657. this.follow = from;
  1658. this.m_tiny = tiny;
  1659. }
  1660. ChangeT(value) {
  1661. this.m_t = value;
  1662. }
  1663. get t() { return this.m_t; }
  1664. update() {
  1665. this.follow = MathTool.MixNumber(this.follow, this.target, this.m_t);
  1666. if (this.m_tiny != 0 && this.target != this.follow) {
  1667. if (Math.abs(this.target - this.follow) <= this.m_tiny) {
  1668. this.follow = this.target;
  1669. }
  1670. }
  1671. }
  1672. }
  1673. class MathTool {
  1674. static get VecZero() {
  1675. return new Laya.Vector3();
  1676. }
  1677. static RandomNumber(from, to) {
  1678. if (from >= to) {
  1679. return 0;
  1680. }
  1681. var size = to - from;
  1682. var curNumber = Math.random() * size + from;
  1683. return curNumber;
  1684. }
  1685. static SpToCam(v3) {
  1686. v3.x = -v3.x;
  1687. v3.y = v3.y - 180;
  1688. v3.z = -v3.z;
  1689. return v3;
  1690. }
  1691. static MixVector3(from, to, t, res = null) {
  1692. if (res == null) {
  1693. res = this.m_mixVector;
  1694. }
  1695. res.x = MathTool.MixNumber(from.x, to.x, t);
  1696. res.y = MathTool.MixNumber(from.y, to.y, t);
  1697. res.z = MathTool.MixNumber(from.z, to.z, t);
  1698. return res;
  1699. }
  1700. static MixNumber(from, to, t) {
  1701. t = MathTool.Clamp(t, 0, 1);
  1702. from = (to - from) * t + from;
  1703. return from;
  1704. }
  1705. static Clamp(value, from, to) {
  1706. if (value < from) {
  1707. value = from;
  1708. }
  1709. if (value > to) {
  1710. value = to;
  1711. }
  1712. return value;
  1713. }
  1714. }
  1715. MathTool.m_mixVector = new Laya.Vector3();
  1716. var ColliderGroup;
  1717. (function (ColliderGroup) {
  1718. ColliderGroup[ColliderGroup["mound"] = 8] = "mound";
  1719. ColliderGroup[ColliderGroup["wall"] = 9] = "wall";
  1720. ColliderGroup[ColliderGroup["opponent"] = 10] = "opponent";
  1721. ColliderGroup[ColliderGroup["obstacle1"] = 11] = "obstacle1";
  1722. ColliderGroup[ColliderGroup["obstacle2"] = 12] = "obstacle2";
  1723. ColliderGroup[ColliderGroup["obstacle3"] = 13] = "obstacle3";
  1724. })(ColliderGroup || (ColliderGroup = {}));
  1725. class MusicType {
  1726. onPreLoadFinish() {
  1727. var layaMonkeyParent = this.scene.addChild(Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh"));
  1728. var layaMonkeySon = Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey2/LayaMonkey.lh");
  1729. layaMonkeySon.transform.translate(new Laya.Vector3(2.5, 0, 0));
  1730. var scale = new Laya.Vector3(0.5, 0.5, 0.5);
  1731. layaMonkeySon.transform.localScale = scale;
  1732. layaMonkeyParent.addChild(layaMonkeySon);
  1733. this.addButton(100, 120, 160, 30, "移动父级猴子", 20, function (e) {
  1734. layaMonkeyParent.transform.translate(new Laya.Vector3(-0.1, 0, 0));
  1735. });
  1736. this.addButton(100, 160, 160, 30, "放大父级猴子", 20, function (e) {
  1737. var scale = new Laya.Vector3(0.2, 0.2, 0.2);
  1738. layaMonkeyParent.transform.localScale = scale;
  1739. });
  1740. this.addButton(100, 200, 160, 30, "旋转父级猴子", 20, function (e) {
  1741. layaMonkeyParent.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false);
  1742. });
  1743. this.addButton(100, 250, 160, 30, "移动子级猴子", 20, function (e) {
  1744. layaMonkeySon.transform.translate(new Laya.Vector3(-0.1, 0, 0));
  1745. });
  1746. this.addButton(100, 290, 160, 30, "放大子级猴子", 20, function (e) {
  1747. var scale = new Laya.Vector3(1, 1, 1);
  1748. layaMonkeySon.transform.localScale = scale;
  1749. });
  1750. this.addButton(100, 330, 160, 30, "旋转子级猴子", 20, function (e) {
  1751. layaMonkeySon.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false);
  1752. });
  1753. }
  1754. addButton(x, y, width, height, text, size, clickFun) {
  1755. Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(null, function () {
  1756. var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", text));
  1757. changeActionButton.size(width, height);
  1758. changeActionButton.labelBold = true;
  1759. changeActionButton.labelSize = size;
  1760. changeActionButton.sizeGrid = "4,4,4,4";
  1761. changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
  1762. changeActionButton.pos(x, y);
  1763. changeActionButton.on(Laya.Event.CLICK, this, clickFun);
  1764. }));
  1765. }
  1766. }
  1767. MusicType.Idle = "Idle";
  1768. MusicType.CrouchFiring = "CrouchFiring";
  1769. MusicType.Dance = "Dance";
  1770. MusicType.RunAndGun = "RunAndGun";
  1771. MusicType.RunningHysteric = "RunningHysteric";
  1772. var Text = Laya.Text;
  1773. class CameraManager {
  1774. static get Instance() {
  1775. return this.instance || (this.instance = new CameraManager());
  1776. }
  1777. CameraFollow(z) {
  1778. if (this.Camera)
  1779. this.Camera.MoveGame(z);
  1780. }
  1781. Init(cam, startPos) {
  1782. this.startPosTra = startPos.transform;
  1783. if (cam) {
  1784. this._maincamera = cam;
  1785. this.Camera = this._maincamera.addComponent(Camera);
  1786. this.Camera.Init();
  1787. }
  1788. }
  1789. createSampleText() {
  1790. var text = new Text();
  1791. text.overflow = Text.HIDDEN;
  1792. text.color = "#FFFFFF";
  1793. text.font = "Impact";
  1794. text.fontSize = 20;
  1795. text.borderColor = "#FFFF00";
  1796. text.x = 80;
  1797. Laya.stage.addChild(text);
  1798. text.text = "A POWERFUL HTML5 ENGINE ON FLASH TECHNICAL\n" + "A POWERFUL HTML5 ENGINE ON FLASH TECHNICAL\n" + "A POWERFUL HTML5 ENGINE ON FLASH TECHNICAL";
  1799. return text;
  1800. }
  1801. SetCameraAction(type, arg) {
  1802. if (this.Camera)
  1803. this.Camera.CameraAction(type, arg);
  1804. }
  1805. }
  1806. var BitmapFont = Laya.BitmapFont;
  1807. var Text$1 = Laya.Text;
  1808. var Handler$2 = Laya.Handler;
  1809. class ConstructManager {
  1810. constructor() {
  1811. this.tarDis = 30;
  1812. this.constructArr = [];
  1813. this.fontName = "diyFont";
  1814. }
  1815. static get Instance() {
  1816. return this.instance || (this.instance = new ConstructManager());
  1817. }
  1818. Init(builds) {
  1819. this.constructArr.push(builds.getChildAt(2));
  1820. this.constructArr.push(builds.getChildAt(1));
  1821. this.constructArr.push(builds.getChildAt(0));
  1822. }
  1823. CheckMainRolePos(_zp) {
  1824. let d = this.tarDis - _zp;
  1825. if (d > 0)
  1826. return;
  1827. this.SwitchRoad();
  1828. }
  1829. loadFont() {
  1830. var bitmapFont = new BitmapFont();
  1831. bitmapFont.loadFont("res/bitmapFont/test.fnt", new Handler$2(this, this.onFontLoaded, [bitmapFont]));
  1832. }
  1833. onFontLoaded(bitmapFont) {
  1834. bitmapFont.setSpaceWidth(10);
  1835. Text$1.registerBitmapFont(this.fontName, bitmapFont);
  1836. this.createText(this.fontName);
  1837. }
  1838. createText(font) {
  1839. var txt = new Text$1();
  1840. txt.width = 250;
  1841. txt.wordWrap = true;
  1842. txt.text = "Do one thing at a time, and do well.";
  1843. txt.font = font;
  1844. txt.leading = 5;
  1845. txt.pos(Laya.stage.width - txt.width >> 1, Laya.stage.height - txt.height >> 1);
  1846. Laya.stage.addChild(txt);
  1847. }
  1848. SwitchRoad() {
  1849. let rs = this.constructArr.pop();
  1850. rs.transform.localPositionZ = this.tarDis + 60;
  1851. this.constructArr.unshift(rs);
  1852. this.tarDis = this.tarDis + 30;
  1853. }
  1854. SetConstruct() {
  1855. for (let index = this.constructArr.length - 1; index >= 0; index--) {
  1856. const element = this.constructArr[index];
  1857. element.transform.localPositionZ = (2 - index) * 30;
  1858. }
  1859. this.tarDis = 30;
  1860. }
  1861. }
  1862. var Sprite$1 = Laya.Sprite;
  1863. var Handler$3 = Laya.Handler;
  1864. class LevelController {
  1865. static get Instance() {
  1866. return LevelController.instance || (LevelController.instance = new LevelController());
  1867. }
  1868. showApe() {
  1869. var ape = new Sprite$1();
  1870. Laya.stage.addChild(ape);
  1871. ape.loadImage("res/apes/monkey3.png");
  1872. Laya.loader.load("res/apes/monkey2.png", Handler$3.create(this, function () {
  1873. var t = Laya.loader.getRes("res/apes/monkey2.png");
  1874. var ape = new Sprite$1();
  1875. ape.graphics.drawTexture(t, 0, 0);
  1876. Laya.stage.addChild(ape);
  1877. ape.pos(200, 0);
  1878. }));
  1879. }
  1880. SetLevel(level) {
  1881. let len = NetInfoManager.Instance._level.length;
  1882. let index = PlayerManager.Instance.stage;
  1883. if (PlayerManager.Instance.stage > len)
  1884. index = GameTool.randomInt(1, len);
  1885. this.curLevelData = NetInfoManager.Instance.GetLevel(index);
  1886. if (!this._level)
  1887. this._level = new Level();
  1888. this._level.SetLevel(this.curLevelData);
  1889. }
  1890. }
  1891. class Level {
  1892. constructor() {
  1893. this.road_list = [];
  1894. this.fail_gold = 0;
  1895. }
  1896. createApes() {
  1897. var layoutRadius = 150;
  1898. var radianUnit = Math.PI / 2;
  1899. this.apesCtn = new Sprite$1();
  1900. Laya.stage.addChild(this.apesCtn);
  1901. for (var i = 0; i < 4; i++) {
  1902. var ape = new Sprite$1();
  1903. ape.loadImage("res/apes/monkey" + i + ".png");
  1904. ape.pivot(55, 72);
  1905. ape.pos(Math.cos(radianUnit * i) * layoutRadius, Math.sin(radianUnit * i) * layoutRadius);
  1906. this.apesCtn.addChild(ape);
  1907. }
  1908. this.apesCtn.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  1909. }
  1910. SetLevel(data) {
  1911. this.road_list = GameTool.SpliteString(data["road_list"]);
  1912. this.gold = Number(data["gold"]);
  1913. this.fail_gold = Number(data["fail_gold"]);
  1914. this.enemy = data["enemy"];
  1915. this.enemy_hp = data["enemy_hp"];
  1916. this.isgold = Number(data["isgold"]) == 1;
  1917. this.enemy_cloth = data["enemy_cloth"] ? Number(data["enemy_cloth"]) : 1;
  1918. }
  1919. }
  1920. class MoundManager {
  1921. static get Instance() {
  1922. return this.instance || (this.instance = new MoundManager());
  1923. }
  1924. constructor() {
  1925. this.MoundrDic = new Dictionary();
  1926. }
  1927. Init(da) {
  1928. this.moundContainer = da;
  1929. }
  1930. MakeMound(data) {
  1931. let tower = GamePool.Instance.GetModel(GamePool.modeltype.Mound);
  1932. if (!tower)
  1933. return;
  1934. this.moundContainer.addChild(tower);
  1935. let ts = tower.getComponent(Mound);
  1936. if (!ts)
  1937. ts = tower.addComponent(Mound);
  1938. ts.SetMound(data);
  1939. this.MoundrDic.set(tower.id, ts);
  1940. }
  1941. Reset() {
  1942. let arr = [];
  1943. for (const key in this.MoundrDic.container) {
  1944. arr.push(key);
  1945. }
  1946. if (arr.length > 0) {
  1947. for (let index = 0; index < arr.length; index++) {
  1948. const element = arr[index];
  1949. let s = this.MoundrDic.get(element);
  1950. if (s)
  1951. s.Recovery();
  1952. }
  1953. }
  1954. }
  1955. RecoverMound(sp) {
  1956. this.MoundrDic.delete(sp.id);
  1957. }
  1958. HpUi() {
  1959. return GamePool.Instance.GetUi(PoolType.HpText);
  1960. }
  1961. }
  1962. class MatrixTransform {
  1963. static WorldToScreen2(camera, point) {
  1964. var pointA = this.InverseTransformPoint(camera.transform, point);
  1965. var distance = pointA.z;
  1966. var out = new Laya.Vector3();
  1967. camera.viewport.project(point, camera.projectionViewMatrix, out);
  1968. var value = new Laya.Vector3(out.x / Laya.stage.clientScaleX, out.y / Laya.stage.clientScaleY, distance);
  1969. return value;
  1970. }
  1971. static ScreenToWorld(camera, point) {
  1972. var halfFOV = (camera.fieldOfView * 0.5) * Math.PI / 180;
  1973. let height = point.z * Math.tan(halfFOV);
  1974. let width = height * camera.aspectRatio;
  1975. let lowerLeft = this.GetLowerLeft(camera.transform, point.z, width, height);
  1976. let v = this.GetScreenScale(width, height);
  1977. var value = new Laya.Vector3();
  1978. var lowerLeftA = this.InverseTransformPoint(camera.transform, lowerLeft);
  1979. value = new Laya.Vector3(-point.x / v.x, point.y / v.y, 0);
  1980. Laya.Vector3.add(lowerLeftA, value, value);
  1981. value = this.TransformPoint(camera.transform, value);
  1982. return value;
  1983. }
  1984. static GetScreenScale(width, height) {
  1985. var v = new Laya.Vector3();
  1986. v.x = Laya.stage.width / width / 2;
  1987. v.y = Laya.stage.height / height / 2;
  1988. return v;
  1989. }
  1990. static GetLowerLeft(transform, distance, width, height) {
  1991. var lowerLeft = new Laya.Vector3();
  1992. var right = new Laya.Vector3();
  1993. transform.getRight(right);
  1994. Laya.Vector3.normalize(right, right);
  1995. var xx = new Laya.Vector3(right.x * width, right.y * width, right.z * width);
  1996. Laya.Vector3.add(transform.position, xx, lowerLeft);
  1997. var up = new Laya.Vector3();
  1998. transform.getUp(up);
  1999. Laya.Vector3.normalize(up, up);
  2000. var yy = new Laya.Vector3(up.x * height, up.y * height, up.z * height);
  2001. Laya.Vector3.subtract(lowerLeft, yy, lowerLeft);
  2002. var forward = new Laya.Vector3();
  2003. transform.getForward(forward);
  2004. Laya.Vector3.normalize(forward, forward);
  2005. var zz = new Laya.Vector3(forward.x * distance, forward.y * distance, forward.z * distance);
  2006. Laya.Vector3.subtract(lowerLeft, zz, lowerLeft);
  2007. return lowerLeft;
  2008. }
  2009. static InverseTransformPoint(origin, point) {
  2010. var xx = new Laya.Vector3();
  2011. origin.getRight(xx);
  2012. var yy = new Laya.Vector3();
  2013. origin.getUp(yy);
  2014. var zz = new Laya.Vector3();
  2015. origin.getForward(zz);
  2016. var zz1 = new Laya.Vector3(-zz.x, -zz.y, -zz.z);
  2017. var x = this.ProjectDistance(point, origin.position, xx);
  2018. var y = this.ProjectDistance(point, origin.position, yy);
  2019. var z = this.ProjectDistance(point, origin.position, zz1);
  2020. var value = new Laya.Vector3(x, y, z);
  2021. return value;
  2022. }
  2023. static TransformPoint(origin, point) {
  2024. var value = new Laya.Vector3();
  2025. Laya.Vector3.transformQuat(point, origin.rotation, value);
  2026. Laya.Vector3.add(value, origin.position, value);
  2027. return value;
  2028. }
  2029. static ProjectDistance(A, C, B) {
  2030. var CA = new Laya.Vector3();
  2031. Laya.Vector3.subtract(A, C, CA);
  2032. var angle = this.Angle2(CA, B) * Math.PI / 180;
  2033. var distance = Laya.Vector3.distance(A, C);
  2034. distance *= Math.cos(angle);
  2035. return distance;
  2036. }
  2037. static Angle2(ma, mb) {
  2038. var v1 = (ma.x * mb.x) + (ma.y * mb.y) + (ma.z * mb.z);
  2039. var ma_val = Math.sqrt(ma.x * ma.x + ma.y * ma.y + ma.z * ma.z);
  2040. var mb_val = Math.sqrt(mb.x * mb.x + mb.y * mb.y + mb.z * mb.z);
  2041. var cosM = v1 / (ma_val * mb_val);
  2042. if (cosM < -1)
  2043. cosM = -1;
  2044. if (cosM > 1)
  2045. cosM = 1;
  2046. var angleAMB = Math.acos(cosM) * 180 / Math.PI;
  2047. return angleAMB;
  2048. }
  2049. }
  2050. var Sprite$2 = Laya.Sprite;
  2051. class ParticleManager {
  2052. constructor() {
  2053. this.attackmaxcount = 0;
  2054. this.explodemaxcount = 0;
  2055. }
  2056. static get Instance() {
  2057. return ParticleManager.instance || (ParticleManager.instance = new ParticleManager());
  2058. }
  2059. AttackEffect(pos) {
  2060. if (this.attackmaxcount >= GlobalParam.hitmaxcount)
  2061. return;
  2062. let h = GamePool.Instance.GetModel("Hit");
  2063. h.transform.position = pos;
  2064. Scene3DManager.Instance.effectCon.addChild(h);
  2065. this.attackmaxcount++;
  2066. Laya.timer.once(800, this, this.RecoverEffect, [h], false);
  2067. }
  2068. RecoverEffect(sp) {
  2069. GamePool.Instance.RecoverModel(sp);
  2070. this.attackmaxcount--;
  2071. }
  2072. mapLoaded() {
  2073. this.layer = this.tiledMap.getLayerByIndex(0);
  2074. var radiusX = 32;
  2075. var radiusY = Math.tan(180 / Math.PI * 30) * radiusX;
  2076. var color = "#FF7F50";
  2077. this.sprite = new Sprite$2();
  2078. this.sprite.graphics.drawLine(0, 0, -radiusX, radiusY, color);
  2079. this.sprite.graphics.drawLine(0, 0, radiusX, radiusY, color);
  2080. this.sprite.graphics.drawLine(-radiusX, radiusY, 0, radiusY * 2, color);
  2081. this.sprite.graphics.drawLine(radiusX, radiusY, 0, radiusY * 2, color);
  2082. Laya.stage.addChild(this.sprite);
  2083. }
  2084. ExplodeEffect(pos) {
  2085. if (this.explodemaxcount >= GlobalParam.boommaxcount)
  2086. return;
  2087. let h = GamePool.Instance.GetModel("Explode");
  2088. h.transform.position = pos;
  2089. Scene3DManager.Instance.effectCon.addChild(h);
  2090. this.explodemaxcount++;
  2091. Laya.timer.once(800, this, this.RecoverExpolde, [h], false);
  2092. }
  2093. RecoverExpolde(sp) {
  2094. GamePool.Instance.RecoverModel(sp);
  2095. this.explodemaxcount--;
  2096. }
  2097. BloodEffect(pos) {
  2098. let h = GamePool.Instance.GetModel("Blood");
  2099. h.transform.position = pos;
  2100. Scene3DManager.Instance.effectCon.addChild(h);
  2101. Laya.timer.once(800, this, this.RecoverBlood, [h], false);
  2102. }
  2103. RecoverBlood(sp) {
  2104. GamePool.Instance.RecoverModel(sp);
  2105. }
  2106. }
  2107. var Event$3 = Laya.Event;
  2108. var MouseManager = Laya.MouseManager;
  2109. var MovieClip = Laya.MovieClip;
  2110. var Animation = Laya.Animation;
  2111. class MouseEvent {
  2112. constructor() {
  2113. this.SWFPath = "res/swf/dragon.swf";
  2114. this.MCWidth = 318;
  2115. this.MCHeight = 406;
  2116. this._switch = false;
  2117. this._isCanClick = true;
  2118. this.clickD = false;
  2119. this._mousePos = MathTool.VecZero;
  2120. this.tempMouse = MathTool.VecZero;
  2121. this.clickCount = 0;
  2122. this.mStartX = 400;
  2123. this.mStartY = 500;
  2124. this.mActionIndex = 0;
  2125. this.mCurrIndex = 0;
  2126. this.mCurrSkinIndex = 0;
  2127. }
  2128. static get Instance() {
  2129. return this.instance || (this.instance = new MouseEvent());
  2130. }
  2131. InitMouseEvent() {
  2132. Laya.stage.on(Event$3.MOUSE_DOWN, this, this.OnClickDown);
  2133. Laya.stage.on(Event$3.MOUSE_OUT, this, this.OnClickUp);
  2134. }
  2135. createMovieClip() {
  2136. var mc = new MovieClip();
  2137. mc.load(this.SWFPath);
  2138. mc.x = (Laya.stage.width - this.MCWidth) / 2;
  2139. mc.y = (Laya.stage.height - this.MCHeight) / 2;
  2140. Laya.stage.addChild(mc);
  2141. }
  2142. OnClickDown(e) {
  2143. if (!this._isCanClick || !this._switch)
  2144. return;
  2145. if (e.target instanceof Laya.UIComponent)
  2146. return;
  2147. this.clickD = true;
  2148. Laya.stage.on(Event$3.MOUSE_UP, this, this.OnClickUp);
  2149. Laya.stage.on(Event$3.MOUSE_MOVE, this, this.OnSlider);
  2150. this._mousePos.x = MouseManager.instance.mouseX;
  2151. this._mousePos.y = MouseManager.instance.mouseY;
  2152. this.MouseD();
  2153. }
  2154. StartGameClick() {
  2155. this._switch = true;
  2156. if (!this._isCanClick)
  2157. return;
  2158. this.clickD = true;
  2159. Laya.stage.on(Event$3.MOUSE_UP, this, this.OnClickUp);
  2160. Laya.stage.on(Event$3.MOUSE_MOVE, this, this.OnSlider);
  2161. this._mousePos.x = MouseManager.instance.mouseX;
  2162. this.MouseD();
  2163. }
  2164. MouseD() {
  2165. MainRoleManager.Instance.SetModelPos(this._mousePos.x);
  2166. MainRoleManager.Instance.CreateShoot();
  2167. }
  2168. OnClickUp(e) {
  2169. if (!this._isCanClick || !this._switch)
  2170. return;
  2171. if (!this.clickD)
  2172. return;
  2173. this.MouseU();
  2174. }
  2175. createAnimation() {
  2176. var ani = new Animation();
  2177. ani.interval = 30;
  2178. ani.index = 1;
  2179. ani.play();
  2180. var bounds = ani.getGraphicBounds();
  2181. ani.pivot(bounds.width / 2, bounds.height / 2);
  2182. ani.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  2183. Laya.stage.addChild(ani);
  2184. }
  2185. OffMouseEvent() {
  2186. Laya.stage.off(Event$3.MOUSE_DOWN, this, this.OnClickDown);
  2187. Laya.stage.off(Event$3.MOUSE_UP, this, this.OnClickUp);
  2188. Laya.stage.off(Event$3.MOUSE_OUT, this, this.OnClickUp);
  2189. }
  2190. MouseU() {
  2191. this.clickD = false;
  2192. Laya.stage.off(Event$3.MOUSE_MOVE, this, this.OnSlider);
  2193. Laya.stage.off(Event$3.MOUSE_UP, this, this.OnClickUp);
  2194. }
  2195. OnSlider(e) {
  2196. this.tempMouse.x = MouseManager.instance.mouseX;
  2197. let offestX = this.tempMouse.x - this._mousePos.x;
  2198. if (offestX >= 0)
  2199. offestX = offestX < 20 ? offestX : 20;
  2200. if (offestX < 0)
  2201. offestX = offestX > -20 ? offestX : -20;
  2202. MainRoleManager.Instance.PlayerSlip(-offestX);
  2203. this._mousePos.x = this.tempMouse.x;
  2204. this._mousePos.y = this.tempMouse.y;
  2205. }
  2206. OpenInput() {
  2207. this.clickCount++;
  2208. if (this.clickCount > 1)
  2209. return;
  2210. this._isCanClick = true;
  2211. }
  2212. CloseInput() {
  2213. this.clickCount--;
  2214. if (this.clickCount > 0)
  2215. return;
  2216. this._isCanClick = false;
  2217. this.clickD = false;
  2218. }
  2219. set _Switch(value) {
  2220. this._switch = value;
  2221. }
  2222. play() {
  2223. this.mCurrIndex++;
  2224. if (this.mCurrIndex >= this.mArmature.getAnimNum()) {
  2225. this.mCurrIndex = 0;
  2226. }
  2227. this.mArmature.play(this.mCurrIndex, false);
  2228. }
  2229. onEvent(e) {
  2230. var tEventData = e;
  2231. Laya.stage.addChild(this.mLabelSprite);
  2232. this.mLabelSprite.x = this.mStartX;
  2233. this.mLabelSprite.y = this.mStartY;
  2234. this.mLabelSprite.graphics.clear();
  2235. this.mLabelSprite.graphics.fillText(tEventData.name, 0, 0, "20px Arial", "#ff0000", "center");
  2236. }
  2237. }
  2238. var Sprite$3 = Laya.Sprite;
  2239. var ColorFilter = Laya.ColorFilter;
  2240. class Street extends Laya.Script3D {
  2241. constructor() {
  2242. super(...arguments);
  2243. this.rotate = MathTool.VecZero;
  2244. this.speed = MathTool.VecZero;
  2245. this.ApePath = "res/apes/monkey2.png";
  2246. }
  2247. onAwake() {
  2248. this.selfobj = this.owner;
  2249. this.tran = this.selfobj.transform;
  2250. }
  2251. SetMoveType() {
  2252. if (this.thing.type == 5) {
  2253. this._transform = this.selfobj.getChildAt(0).transform;
  2254. }
  2255. else {
  2256. this._transform = this.tran;
  2257. if (this.thing.type == 4) {
  2258. StreetManager.Instance.StreetAddCube(this.selfobj);
  2259. }
  2260. }
  2261. if (this.thing.moveType == 1) {
  2262. Laya.timer.frameLoop(3, this, this.CheckRecover);
  2263. return;
  2264. }
  2265. else if (this.thing.moveType == 2) {
  2266. this.rotate.x = 0;
  2267. this.rotate.y = -this.thing.moveSpeed;
  2268. this.rotate.z = 0;
  2269. Laya.timer.frameLoop(2, this, this.MoveType2);
  2270. }
  2271. else if (this.thing.moveType == 3) {
  2272. this.rotate.x = 0;
  2273. this.rotate.y = this.thing.moveSpeed;
  2274. this.rotate.z = 0;
  2275. Laya.timer.frameLoop(2, this, this.MoveType2);
  2276. }
  2277. else if (this.thing.moveType == 4) {
  2278. this.rotate.x = 0;
  2279. this.rotate.y = 0;
  2280. this.rotate.z = this.thing.moveSpeed;
  2281. Laya.timer.frameLoop(1, this, this.MoveType3);
  2282. }
  2283. else if (this.thing.moveType == 5) {
  2284. this.rotate.x = 0;
  2285. this.rotate.y = 0;
  2286. this.rotate.z = -this.thing.moveSpeed;
  2287. Laya.timer.frameLoop(1, this, this.MoveType3);
  2288. }
  2289. else if (this.thing.moveType == 6) {
  2290. this.speed.x = -this.thing.moveSpeed;
  2291. this.speed.y = 0;
  2292. this.speed.z = 0;
  2293. Laya.timer.frameLoop(1, this, this.MoveType4);
  2294. }
  2295. else if (this.thing.moveType == 7) {
  2296. this.speed.x = this.thing.moveSpeed;
  2297. this.speed.y = 0;
  2298. this.speed.z = 0;
  2299. Laya.timer.frameLoop(1, this, this.MoveType4);
  2300. }
  2301. else if (this.thing.moveType == 8) ;
  2302. else if (this.thing.moveType == 9) ;
  2303. }
  2304. setup() {
  2305. this.normalizeApe();
  2306. this.makeRedApe();
  2307. this.grayingApe();
  2308. }
  2309. normalizeApe() {
  2310. var originalApe = this.createApe();
  2311. this.apeTexture = Laya.loader.getRes(this.ApePath);
  2312. originalApe.x = (Laya.stage.width - this.apeTexture.width * 3) / 2;
  2313. originalApe.y = (Laya.stage.height - this.apeTexture.height) / 2;
  2314. }
  2315. makeRedApe() {
  2316. var redMat = [
  2317. 1, 0, 0, 0, 0,
  2318. 0, 0, 0, 0, 0,
  2319. 0, 0, 0, 0, 0,
  2320. 0, 0, 0, 1, 0,
  2321. ];
  2322. var redFilter = new ColorFilter(redMat);
  2323. var redApe = this.createApe();
  2324. redApe.filters = [redFilter];
  2325. var firstChild = Laya.stage.getChildAt(0);
  2326. redApe.x = firstChild.x + this.apeTexture.width;
  2327. redApe.y = firstChild.y;
  2328. }
  2329. grayingApe() {
  2330. var grayscaleMat = [0.3086, 0.6094, 0.0820, 0, 0, 0.3086, 0.6094, 0.0820, 0, 0, 0.3086, 0.6094, 0.0820, 0, 0, 0, 0, 0, 1, 0];
  2331. var grayscaleFilter = new ColorFilter(grayscaleMat);
  2332. var grayApe = this.createApe();
  2333. grayApe.filters = [grayscaleFilter];
  2334. var secondChild = Laya.stage.getChildAt(1);
  2335. grayApe.x = secondChild.x + this.apeTexture.width;
  2336. grayApe.y = secondChild.y;
  2337. }
  2338. createApe() {
  2339. var ape = new Sprite$3();
  2340. ape.loadImage("res/apes/monkey2.png");
  2341. Laya.stage.addChild(ape);
  2342. return ape;
  2343. }
  2344. MoveType4() {
  2345. this._transform.translate(this.speed);
  2346. if (Math.abs(this._transform.localPositionX) >= GlobalParam.blockLRmoveMaxDis)
  2347. this.speed.x = -this.speed.x;
  2348. this.CheckRecover();
  2349. }
  2350. MoveType2() {
  2351. this._transform.rotate(this.rotate);
  2352. this.CheckRecover();
  2353. }
  2354. MoveType3() {
  2355. this._transform.rotate(this.rotate);
  2356. if (Math.abs(this._transform.localRotationEulerZ) >= 50)
  2357. this.rotate.z = -this.rotate.z;
  2358. this.CheckRecover();
  2359. }
  2360. Recover() {
  2361. if (this.thing.type) {
  2362. StreetManager.Instance.StreetResetCube(this.selfobj.id);
  2363. }
  2364. Laya.timer.clearAll(this);
  2365. StreetManager.Instance.RecoverStreet(this.selfobj);
  2366. GamePool.Instance.RecoverModel(this.selfobj);
  2367. }
  2368. CheckRecover() {
  2369. if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 10) {
  2370. console.log("回收block", this.selfobj.name);
  2371. this.Recover();
  2372. return;
  2373. }
  2374. }
  2375. SetStreet(thing) {
  2376. this.tran.localPositionZ = Number(thing.z);
  2377. this.tran.localPositionX = Number(thing.x);
  2378. this.tran.rotationEuler = MathTool.VecZero;
  2379. this.thing = thing;
  2380. if (!MainRoleManager.Instance.player)
  2381. return;
  2382. this.tarTran = MainRoleManager.Instance.player.transform;
  2383. this.SetMoveType();
  2384. }
  2385. }
  2386. var REG = Laya.ClassUtils.regClass;
  2387. var ui;
  2388. (function (ui) {
  2389. class AttributeUpViewUI extends Laya.Scene {
  2390. constructor() { super(); }
  2391. createChildren() {
  2392. super.createChildren();
  2393. this.createView(AttributeUpViewUI.uiView);
  2394. }
  2395. }
  2396. AttributeUpViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "14,14,13,15", "right": 0, "left": 0, "bottom": 0, "alpha": 1 }, "compId": 3 }, { "type": "Box", "props": { "y": 112, "x": 42, "width": 636, "height": 538 }, "compId": 4, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/webp.webp.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 31, "child": [{ "type": "Image", "props": { "y": 40, "x": -9, "width": 655, "skin": "Main/shengji-biaoti.png", "height": 102 }, "compId": 32 }] }, { "type": "Button", "props": { "y": 556, "x": 350, "var": "rateBtn", "stateNum": 1, "skin": "Main/landi.png" }, "compId": 34, "child": [{ "type": "Image", "props": { "y": 19, "x": 44, "skin": "Main/gongjisudu-1.png" }, "compId": 35 }, { "type": "Image", "props": { "y": 124, "x": 4, "width": 236, "var": "_rate", "stateNum": 1, "height": 71 }, "compId": 36, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 37 }, { "type": "Image", "props": { "y": 13, "x": 57, "skin": "Main/jinbi-zhu.png" }, "compId": 38, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 39 }] }] }, { "type": "Text", "props": { "y": 71, "x": 72, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 40 }, { "type": "Image", "props": { "y": 124, "x": 5, "width": 235, "visible": false, "var": "_rateVideo", "stateNum": 1, "height": 71 }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 42 }, { "type": "Image", "props": { "y": 16.5, "x": 117.5, "skin": "Main/shipin-biao.png" }, "compId": 43 }] }, { "type": "Image", "props": { "y": 154, "x": 137, "var": "click2", "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 49 }] }, { "type": "Button", "props": { "y": 558, "x": 54, "var": "atkBtn", "stateNum": 1, "skin": "Main/hong-di.png" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 19, "x": 66, "skin": "Main/gongjili-2.png" }, "compId": 10 }, { "type": "Image", "props": { "y": 124, "x": 3, "width": 236, "var": "_atk", "stateNum": 1, "height": 71 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 33 }, { "type": "Image", "props": { "y": 15, "x": 61, "skin": "Main/jinbi-zhu.png" }, "compId": 14, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }] }, { "type": "Text", "props": { "y": 71, "x": 57, "width": 136, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 124, "x": 2, "width": 238, "visible": false, "var": "_atkVideo", "stateNum": 1, "height": 71 }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 46 }, { "type": "Image", "props": { "y": 16.5, "x": 119, "skin": "Main/shipin-biao.png" }, "compId": 47 }] }, { "type": "Image", "props": { "y": 154.5, "x": 137, "var": "click1", "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 48 }] }, { "type": "Image", "props": { "x": 201, "var": "backBtn", "skin": "Main/jixuyouxi-bt.png", "runtime": "View/Com/ButtonRunTime.ts", "centerY": 620 }, "compId": 8 }] }, { "type": "Box", "props": { "y": 243, "x": 74.5, "width": 571, "var": "PushBox", "height": 407 }, "compId": 72, "child": [{ "type": "Box", "props": { "y": 112, "x": 100, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 68, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 70 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 71 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 69 }] }, { "type": "Box", "props": { "y": 112, "x": 283, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 73, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 74 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 75 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 76 }] }, { "type": "Box", "props": { "y": 112, "x": 470, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 77, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 78 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 79 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 80 }] }, { "type": "Box", "props": { "y": 306, "x": 100, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 81, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 84 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 85 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 86 }] }, { "type": "Box", "props": { "y": 306, "x": 283, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 82, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 87 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 88 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 89 }] }, { "type": "Box", "props": { "y": 306, "x": 470, "width": 140, "height": 175, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 83, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 140, "name": "icon", "height": 140 }, "compId": 90 }, { "type": "Text", "props": { "y": 140, "x": 0, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 35, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 91 }, { "type": "Button", "props": { "y": 0, "x": 0, "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 92 }] }] }], "animations": [{ "nodes": [{ "target": 48, "keyframes": { "y": [{ "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 0 }, { "value": 207, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 5 }, { "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 10 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 49, "keyframes": { "y": [{ "value": 154, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 0 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 5 }, { "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 10 }] } }], "name": "ani2", "id": 2, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 68, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 20 }] } }, { "target": 73, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 20 }] } }, { "target": 77, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 20 }] } }, { "target": 81, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 20 }] } }, { "target": 82, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 20 }] } }, { "target": 83, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 20 }] } }], "name": "shakeani", "id": 3, "frameRate": 24, "action": 0 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/webp.webp.png", "Main/shengji-biaoti.png", "Main/landi.png", "Main/gongjisudu-1.png", "Main/shengji-tubiao-1.png", "Main/jinbi-zhu.png", "Main/shipin-biao.png", "Main/shou.png", "Main/hong-di.png", "Main/gongjili-2.png", "Main/jixuyouxi-bt.png"], "loadList3D": [] };
  2397. ui.AttributeUpViewUI = AttributeUpViewUI;
  2398. REG("ui.AttributeUpViewUI", AttributeUpViewUI);
  2399. class CompleteViewUI extends Laya.Scene {
  2400. constructor() { super(); }
  2401. createChildren() {
  2402. super.createChildren();
  2403. this.createView(CompleteViewUI.uiView);
  2404. }
  2405. }
  2406. CompleteViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "10,10,12,11", "right": 0, "left": 0, "bottom": 0, "alpha": 1 }, "compId": 22 }, { "type": "Box", "props": { "x": 178, "width": 364, "var": "winbtnBox", "height": 223, "bottom": 199 }, "compId": 47, "child": [{ "type": "Image", "props": { "x": 120, "var": "nextBtn", "skin": "Main/no.png", "runtime": "View/Com/ButtonRunTime.ts", "bottom": 40 }, "compId": 46 }, { "type": "Image", "props": { "y": 32, "x": 36, "var": "doublegetBtn", "skin": "Main/sanbeilingqu.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 28 }] }, { "type": "Image", "props": { "x": 41, "var": "shibaiTop", "skin": "Main/shibai-di bg.png", "centerY": -182 }, "compId": 68, "child": [{ "type": "Image", "props": { "y": 136, "x": 76, "skin": "Main/shibai-jiesuan-b.png" }, "compId": 121 }] }, { "type": "Image", "props": { "x": 41.5, "var": "winTop", "skin": "Main/shengli-beidi.png", "centerY": -182 }, "compId": 44, "child": [{ "type": "Image", "props": { "y": 132, "x": 76, "skin": "Main/tonggun-biao.png" }, "compId": 122 }] }, { "type": "Image", "props": { "x": 243, "width": 60, "skin": "Main/jinbi-zhu.png", "height": 60, "centerY": 120 }, "compId": 69, "child": [{ "type": "Text", "props": { "y": -8, "x": 77, "width": 165, "var": "valueText", "valign": "middle", "text": "50(+100)", "height": 75, "fontSize": 40, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 70 }] }, { "type": "Box", "props": { "x": 136, "width": 447, "height": 419, "centerY": -138 }, "compId": 71, "child": [{ "type": "Image", "props": { "y": 58, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 76, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 80, "child": [{ "type": "Image", "props": { "y": 15, "x": 17, "skin": "Main/baolei.png" }, "compId": 118 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 83 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "towerValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#48efcc", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 82 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "towerCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#48efcc", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 81 }] }, { "type": "Image", "props": { "y": 179, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 84, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 85, "child": [{ "type": "Image", "props": { "y": 15, "x": 13.5, "skin": "Main/rentou.png" }, "compId": 119 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 88 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "roleCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#99ff53", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 86 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "roleValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#99ff53", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 87 }] }, { "type": "Image", "props": { "y": 301, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 89, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 90, "child": [{ "type": "Image", "props": { "y": 13, "x": 16, "skin": "Main/baohe.png" }, "compId": 120 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 93 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "blockCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffe92e", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 91 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "blockValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffe92e", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 92 }] }] }, { "type": "Button", "props": { "y": 423, "width": 109, "var": "LeftTopPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 14, "height": 128 }, "compId": 96, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 98 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 99 }] }, { "type": "Button", "props": { "y": 640, "width": 109, "var": "LeftBottomPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 14, "height": 128 }, "compId": 102, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 103 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Button", "props": { "y": 423, "width": 109, "var": "RightTopPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 595, "height": 128 }, "compId": 105, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 107 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 108 }] }, { "type": "Button", "props": { "y": 640, "width": 109, "var": "RightBottomPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 595, "height": 128 }, "compId": 106, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 109 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 110 }] }], "animations": [{ "nodes": [{ "target": 18, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 0 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 20 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 40 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 0 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 20 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 40 }] } }], "name": "aim", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 96, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 20 }] } }, { "target": 102, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 20 }] } }, { "target": 105, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 20 }] } }, { "target": 106, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 20 }] } }], "name": "pushshake", "id": 2, "frameRate": 24, "action": 0 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/no.png", "Main/sanbeilingqu.png", "Main/shibai-di bg.png", "Main/shibai-jiesuan-b.png", "Main/shengli-beidi.png", "Main/tonggun-biao.png", "Main/jinbi-zhu.png", "Main/zhengchang-di.png", "Main/biaozhi-di8.png", "Main/baolei.png", "Main/rentou.png", "Main/baohe.png", "Main/hutui-1-4.png"], "loadList3D": [] };
  2407. ui.CompleteViewUI = CompleteViewUI;
  2408. REG("ui.CompleteViewUI", CompleteViewUI);
  2409. class ExitViewUI extends Laya.Scene {
  2410. constructor() { super(); }
  2411. createChildren() {
  2412. super.createChildren();
  2413. this.createView(ExitViewUI.uiView);
  2414. }
  2415. }
  2416. ExitViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/hutui-1-4.png", "sizeGrid": "16,16,14,14", "right": 0, "name": "BG", "left": 0, "bottom": 0 }, "compId": 5 }, { "type": "Image", "props": { "x": 0, "width": 720, "top": 0, "skin": "Main/hutui-1-3.png", "height": 131 }, "compId": 4, "child": [{ "type": "Text", "props": { "y": 84, "x": 360, "width": 135, "valign": "middle", "text": "小程序", "pivotY": 31, "pivotX": 68, "height": 61, "fontSize": 35, "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 6 }, { "type": "Text", "props": { "y": 154, "x": 56, "width": 92, "valign": "middle", "text": "最近使用", "pivotY": 18, "pivotX": 46, "height": 36, "fontSize": 23, "color": "#5d5353", "align": "center", "runtime": "laya.display.Text" }, "compId": 8 }] }, { "type": "Button", "props": { "y": 66, "x": 37, "width": 66, "var": "CloseBtn", "pivotY": 41, "pivotX": 33, "height": 81 }, "compId": 7 }, { "type": "List", "props": { "x": 360, "width": 656, "var": "PushList", "top": 180, "spaceY": 15, "bottom": 0, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 9, "child": [{ "type": "Box", "props": { "y": 0, "width": 630, "right": 26, "renderType": "render", "height": 130 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 130, "name": "icon", "height": 130 }, "compId": 11 }, { "type": "Text", "props": { "y": 0, "x": 138, "width": 485, "valign": "middle", "text": "冲冲冲冲", "name": "name", "height": 130, "fontSize": 30, "align": "left", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 65, "x": 598.5, "width": 49, "skin": "Main/hutui-1-1.png", "pivotY": 23, "pivotX": 25, "name": "star", "height": 46 }, "compId": 13 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 14 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 16 }] }] }], "loadList": ["Main/hutui-1-4.png", "Main/hutui-1-3.png", "Main/hutui-1-1.png"], "loadList3D": [] };
  2417. ui.ExitViewUI = ExitViewUI;
  2418. REG("ui.ExitViewUI", ExitViewUI);
  2419. class ExportViewUI extends Laya.Scene {
  2420. constructor() { super(); }
  2421. createChildren() {
  2422. super.createChildren();
  2423. this.createView(ExportViewUI.uiView);
  2424. }
  2425. }
  2426. ExportViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "var": "BG", "top": 0, "skin": "Main/111111.png", "sizeGrid": "10,12,14,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 5 }, { "type": "Image", "props": { "top": 130, "skin": "Main/haoyourwBg.png", "right": 10, "left": 10, "height": 200 }, "compId": 3, "child": [{ "type": "List", "props": { "y": 52, "x": 11.5, "width": 697, "var": "TopList", "spaceX": 20, "height": 130 }, "compId": 8, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 130, "renderType": "render", "height": 130 }, "compId": 9, "child": [{ "type": "Image", "props": { "width": 131, "name": "icon", "height": 131 }, "compId": 10 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 11 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 23 }] }] }] }, { "type": "Image", "props": { "top": 360, "skin": "Main/baokuanrwbg.png", "right": 10, "left": 10, "height": 36 }, "compId": 4 }, { "type": "Image", "props": { "x": 209.5, "top": 50, "skin": "Main/hotGameTitle.png" }, "compId": 6 }, { "type": "Button", "props": { "x": 8, "width": 172, "var": "CloseBtn", "top": 50, "stateNum": 1, "skin": "Main/backBtn.png", "height": 51 }, "compId": 7 }, { "type": "List", "props": { "x": 10, "var": "BottomList", "top": 400, "spaceY": 15, "spaceX": 40, "right": 0, "repeatX": 3, "left": 0, "bottom": 150 }, "compId": 12, "child": [{ "type": "Box", "props": { "y": 0, "x": 32, "width": 190, "renderType": "render", "height": 230 }, "compId": 13, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/bg-box.png", "sizeGrid": "33,36,40,30", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 18 }, { "type": "Image", "props": { "y": 40, "x": 0, "width": 190, "name": "icon", "height": 150 }, "compId": 14 }, { "type": "Text", "props": { "y": 190, "x": 1, "width": 189, "valign": "middle", "text": "text", "name": "tip", "height": 41, "fontSize": 23, "align": "center", "runtime": "laya.display.Text" }, "compId": 15 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 190, "name": "bottom", "height": 40 }, "compId": 16 }, { "type": "Text", "props": { "y": 0, "x": 0, "width": 189, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 17 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 19 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 24 }] }] }, { "type": "Button", "props": { "x": 228, "width": 241, "var": "ContinueBtn", "stateNum": 1, "skin": "Main/zhengchang-di2.png", "sizeGrid": "17,31,12,28", "height": 65, "bottom": 50 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 11, "x": 33.5, "skin": "Main/jixuyouxi.png" }, "compId": 21 }] }], "loadList": ["Main/111111.png", "Main/haoyourwBg.png", "Main/baokuanrwbg.png", "Main/hotGameTitle.png", "Main/backBtn.png", "Main/bg-box.png", "Main/zhengchang-di2.png", "Main/jixuyouxi.png"], "loadList3D": [] };
  2427. ui.ExportViewUI = ExportViewUI;
  2428. REG("ui.ExportViewUI", ExportViewUI);
  2429. class GuideViewUI extends Laya.Scene {
  2430. constructor() { super(); }
  2431. createChildren() {
  2432. super.createChildren();
  2433. this.createView(GuideViewUI.uiView);
  2434. }
  2435. }
  2436. GuideViewUI.uiView = { "type": "Scene", "props": { "width": 720, "mouseThrough": true, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "y": 30, "x": 958, "width": 104, "var": "guide1Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 3, "x": -3, "skin": "Main/guangquan(1).png" }, "compId": 8 }, { "type": "Image", "props": { "y": -123, "x": 2, "skin": "Main/jiantou(1).png" }, "compId": 9 }] }, { "type": "Box", "props": { "y": 154, "x": 969, "width": 207, "var": "guide2Box", "scaleY": 0.8, "scaleX": 0.8, "height": 56, "anchorY": 0.5, "anchorX": 0 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 28, "x": 207, "width": 0, "skin": "Main/zuoyou-jiantou(1).png", "rotation": 180, "pivotY": 48, "height": 96 }, "compId": 12 }, { "type": "Image", "props": { "y": 15, "x": 181, "skin": "Main/shou.png" }, "compId": 11 }] }, { "type": "Box", "props": { "y": 298, "x": 1790, "width": 207, "var": "guide3Box", "scaleY": 0.8, "scaleX": 0.8, "height": 48, "anchorY": 0.5, "anchorX": 1 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 22, "x": 0, "width": 0, "skin": "Main/zuoyou-jiantou(1).png", "pivotY": 48, "height": 96 }, "compId": 14 }, { "type": "Image", "props": { "y": 6, "x": -17, "width": 61, "skin": "Main/shou.png" }, "compId": 15 }] }, { "type": "Box", "props": { "y": 278, "x": -163, "width": 104, "var": "guide4Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 19, "child": [{ "type": "Image", "props": { "y": -106, "x": 4, "skin": "Main/jiantou(1).png" }, "compId": 21 }] }, { "type": "Image", "props": { "x": 183, "var": "guide1Image", "skin": "Main/biaoyu.png", "bottom": 220 }, "compId": 16 }, { "type": "Image", "props": { "x": 164, "var": "guide2Image", "skin": "Main/biaoyu4.png", "bottom": 218 }, "compId": 17 }, { "type": "Image", "props": { "x": 136, "var": "guide3Image", "skin": "Main/biaoyu2.png", "bottom": 220 }, "compId": 18 }], "animations": [{ "nodes": [{ "target": 9, "keyframes": { "y": [{ "value": -116, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 0 }, { "value": -197, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 5 }, { "value": -115, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 10 }] } }], "name": "guide1", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 11, "keyframes": { "x": [{ "value": 181, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 0 }, { "value": 21, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 10 }] } }, { "target": 12, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 0 }, { "value": 188, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 10 }] } }], "name": "guide2", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 15, "keyframes": { "x": [{ "value": -17, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 0 }, { "value": 122, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 10 }] } }, { "target": 14, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 0 }, { "value": 149, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 10 }] } }], "name": "guide3", "id": 3, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 21, "keyframes": { "y": [{ "value": -212, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 0 }, { "value": -106, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 10 }] } }], "name": "guide4", "id": 4, "frameRate": 24, "action": 0 }], "loadList": ["Main/guangquan(1).png", "Main/jiantou(1).png", "Main/zuoyou-jiantou(1).png", "Main/shou.png", "Main/biaoyu.png", "Main/biaoyu4.png", "Main/biaoyu2.png"], "loadList3D": [] };
  2437. ui.GuideViewUI = GuideViewUI;
  2438. REG("ui.GuideViewUI", GuideViewUI);
  2439. class InGameViewUI extends Laya.Scene {
  2440. constructor() { super(); }
  2441. createChildren() {
  2442. super.createChildren();
  2443. this.createView(InGameViewUI.uiView);
  2444. }
  2445. }
  2446. InGameViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] };
  2447. ui.InGameViewUI = InGameViewUI;
  2448. REG("ui.InGameViewUI", InGameViewUI);
  2449. class IntensifyViewUI extends Laya.Scene {
  2450. constructor() { super(); }
  2451. createChildren() {
  2452. super.createChildren();
  2453. this.createView(IntensifyViewUI.uiView);
  2454. }
  2455. }
  2456. IntensifyViewUI.uiView = { "type": "Scene", "props": { "width": 720, "sizeGrid": "0,0,0,0", "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "15,13,12,13", "right": 0, "left": 0, "bottom": 0 }, "compId": 64 }, { "type": "Image", "props": { "top": 0, "skin": "Main/bg-sheng.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.8 }, "compId": 3 }, { "type": "Image", "props": { "y": 139, "x": 14, "var": "backBtn", "skin": "Main/p__fanhui.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 8 }, { "type": "Image", "props": { "y": 139, "x": 63.5, "skin": "Main/beijing-di.png" }, "compId": 36 }, { "type": "Box", "props": { "y": 402, "x": 42, "width": 636, "height": 645 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 17, "x": 44.5, "var": "atkBox", "skin": "Main/wenzi-di5.png" }, "compId": 37, "child": [{ "type": "Image", "props": { "y": 43, "x": 183, "skin": "Main/gongji-2-3.png" }, "compId": 38 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 60 }, { "type": "Image", "props": { "y": 58.5, "x": 34, "skin": "Main/gongji-icon.png" }, "compId": 39 }, { "type": "Image", "props": { "y": 125, "x": 179, "skin": "Main/gongji-1-3.png" }, "compId": 40 }, { "type": "Button", "props": { "y": 95.5, "x": 358, "var": "atkupBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 7, "x": 15, "width": 45, "skin": "Main/jinbi-zhu.png", "height": 45 }, "compId": 43, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 44 }] }] }, { "type": "Text", "props": { "y": 38, "x": 390, "width": 106, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 50, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 42 }] }, { "type": "Image", "props": { "y": 226, "x": 44.5, "var": "rateBox", "skin": "Main/wenzi-di5.png" }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 43, "x": 170, "skin": "Main/gongji-2-2.png" }, "compId": 46 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 62 }, { "type": "Image", "props": { "y": 63.5, "x": 35, "skin": "Main/iconqiang.png" }, "compId": 47 }, { "type": "Image", "props": { "y": 125, "x": 164, "skin": "Main/gongji-1-2.png" }, "compId": 48 }, { "type": "Button", "props": { "y": 94.5, "x": 360, "var": "rateupBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 49, "child": [{ "type": "Image", "props": { "y": 7, "x": 12, "width": 45, "skin": "Main/jinbi-zhu.png", "height": 45 }, "compId": 51, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 52 }] }] }, { "type": "Text", "props": { "y": 33, "x": 392, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 50, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 50 }] }, { "type": "Image", "props": { "y": 445, "x": 44.5, "var": "coinBox", "skin": "Main/wenzi-di5.png" }, "compId": 53, "child": [{ "type": "Image", "props": { "y": 43, "x": 161, "skin": "Main/gongji-2.png" }, "compId": 54 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 63 }, { "type": "Image", "props": { "y": 63.5, "x": 30, "skin": "Main/jinbi.png" }, "compId": 55 }, { "type": "Image", "props": { "y": 124, "x": 161, "skin": "Main/gongji-1.png" }, "compId": 56 }, { "type": "Button", "props": { "y": 94, "x": 351, "var": "getcoinBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 57, "child": [{ "type": "Image", "props": { "y": 7, "x": 12, "width": 45, "skin": "Main/shipin-biao.png", "height": 45 }, "compId": 58, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "coinValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 59 }] }] }] }] }], "loadList": ["Main/zhujiemian-1-20.png", "Main/bg-sheng.png", "Main/p__fanhui.png", "Main/beijing-di.png", "Main/wenzi-di5.png", "Main/gongji-2-3.png", "Main/zhuangbei-tubiao-di.png", "Main/gongji-icon.png", "Main/gongji-1-3.png", "Main/zheng-qianbi-di.png", "Main/jinbi-zhu.png", "Main/gongji-2-2.png", "Main/iconqiang.png", "Main/gongji-1-2.png", "Main/gongji-2.png", "Main/jinbi.png", "Main/gongji-1.png", "Main/shipin-biao.png"], "loadList3D": [] };
  2457. ui.IntensifyViewUI = IntensifyViewUI;
  2458. REG("ui.IntensifyViewUI", IntensifyViewUI);
  2459. class LoadViewUI extends Laya.Scene {
  2460. constructor() { super(); }
  2461. createChildren() {
  2462. super.createChildren();
  2463. this.createView(LoadViewUI.uiView);
  2464. }
  2465. }
  2466. LoadViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "bg", "top": 0, "skin": "load/bg.png", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 6 }, { "type": "Image", "props": { "x": 360, "var": "prepan", "centerY": -68 }, "compId": 14 }, { "type": "Image", "props": { "x": 86, "skin": "load/title.png", "centerY": -360 }, "compId": 17 }, { "type": "Image", "props": { "y": 932, "x": 137, "var": "pro", "skin": "load/jindu-di.png", "centerY": 309 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 4, "x": 4, "width": 438, "var": "pro1", "skin": "load/shang.png" }, "compId": 21 }, { "type": "Text", "props": { "y": 0, "x": 2, "width": 442, "var": "proTex", "valign": "middle", "text": "100%", "height": 38, "fontSize": 28, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 22 }, { "type": "Text", "props": { "y": 60, "x": 51, "width": 359, "valign": "middle", "text": "一款好玩的游戏正在加载...", "height": 37, "fontSize": 30, "font": "SimSun", "color": "#ff0000", "align": "left", "runtime": "laya.display.Text" }, "compId": 23 }] }], "animations": [{ "nodes": [{ "target": 9, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "alpha", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "alpha", "index": 20 }] } }, { "target": 10, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "alpha", "index": 10 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 10, "key": "alpha", "index": 20 }] } }, { "target": 11, "keyframes": { "alpha": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "alpha", "index": 0 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "alpha", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "alpha", "index": 20 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["load/bg.png", "load/title.png", "load/jindu-di.png", "load/shang.png"], "loadList3D": [] };
  2467. ui.LoadViewUI = LoadViewUI;
  2468. REG("ui.LoadViewUI", LoadViewUI);
  2469. class MainViewUI extends Laya.Scene {
  2470. constructor() { super(); }
  2471. createChildren() {
  2472. super.createChildren();
  2473. this.createView(MainViewUI.uiView);
  2474. }
  2475. }
  2476. MainViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "x": 0, "top": 82, "right": 0, "left": 0, "height": 70 }, "compId": 265, "child": [{ "type": "Image", "props": { "y": 21, "x": 282, "width": 157, "var": "pro", "skin": "Main/jindu-duan.png" }, "compId": 302, "child": [{ "type": "Image", "props": { "y": 4, "x": 1, "width": 150, "var": "pro1", "skin": "Main/jindu-guan-do.png", "height": 20 }, "compId": 305 }, { "type": "Image", "props": { "y": -11, "x": -49, "skin": "Main/guanshu.png" }, "compId": 303, "child": [{ "type": "Text", "props": { "y": -1, "x": -3, "width": 54, "var": "stageValue", "valign": "middle", "text": "10", "height": 51, "fontSize": 32, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 264 }] }, { "type": "Image", "props": { "y": -11, "x": 155, "skin": "Main/shadi.png" }, "compId": 304 }] }, { "type": "Image", "props": { "width": 187, "top": 130, "skin": "Main/jinbi-di.png", "right": 522 }, "compId": 261, "child": [{ "type": "Image", "props": { "y": 4.5, "x": 0, "skin": "Main/jinbi-zhu.png" }, "compId": 262 }, { "type": "Text", "props": { "y": 3.5, "x": 37, "width": 142, "var": "countValue", "valign": "middle", "text": "100000", "italic": true, "height": 47, "fontSize": 36, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 263 }] }] }, { "type": "Box", "props": { "var": "mainBox", "top": 0, "right": 0, "name": "mainBox", "left": 0, "bottom": 0 }, "compId": 284, "child": [{ "type": "Image", "props": { "x": 30, "var": "settingBtn", "top": 104, "skin": "Main/shezhi.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 260 }, { "type": "Box", "props": { "x": 29, "width": 63, "visible": false, "var": "settingBox", "top": 179, "height": 134 }, "compId": 291, "child": [{ "type": "Button", "props": { "x": 2, "width": 59, "var": "shake_btn", "stateNum": 1, "height": 59 }, "compId": 285, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/ButtonVibrationOff.png", "name": "kai" }, "compId": 287 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "Main/ButtonVibrationOn.png", "name": "guan" }, "compId": 288 }] }, { "type": "Button", "props": { "y": 74, "width": 62, "var": "sound_btn", "stateNum": 1, "height": 60 }, "compId": 286, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/Icon_SoundOn.png", "name": "kai" }, "compId": 289 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "Main/Icon_SoundOff.png", "name": "guan" }, "compId": 290 }] }] }, { "type": "Box", "props": { "var": "startBox", "right": 0, "left": 0, "height": 5, "bottom": 208 }, "compId": 259, "child": [{ "type": "Image", "props": { "var": "updateBtn", "skin": "Main/shengji.png", "runtime": "View/Com/ButtonRunTime.ts", "left": 0, "bottom": 0 }, "compId": 257 }, { "type": "Image", "props": { "var": "skinBtn", "skin": "Main/shangdain.png", "runtime": "View/Com/ButtonRunTime.ts", "right": 0, "bottom": 0 }, "compId": 258 }] }, { "type": "Text", "props": { "y": 0, "x": 0, "width": 194, "var": "user_id", "valign": "middle", "text": "user_id:12", "height": 25, "fontSize": 25, "color": "#000000", "runtime": "laya.display.Text" }, "compId": 270 }] }, { "type": "Image", "props": { "x": 168.5, "var": "sliderBox", "skin": "Main/zhiyin-di.png", "gray": false, "bottom": 325 }, "compId": 253, "child": [{ "type": "Image", "props": { "y": -71, "x": 27, "skin": "Main/pause1.png" }, "compId": 334 }, { "type": "Image", "props": { "y": 18, "x": 191.5, "skin": "Main/shouzhi.png", "anchorX": 0.5 }, "compId": 293 }, { "type": "Image", "props": { "y": 13.5, "x": 18, "skin": "Main/fangxiangzuo.png" }, "compId": 331 }, { "type": "Image", "props": { "y": 13.5, "x": 283, "skin": "Main/fangxiangyou.png" }, "compId": 332 }] }, { "type": "Sprite", "props": { "var": "duohuituiSp" }, "compId": 312 }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "bannerHuiTuiSp" }, "compId": 313 }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 720, "visible": true, "right": 0, "name": "BottomBox", "left": 0, "height": 177, "bottom": 0 }, "compId": 314, "child": [{ "type": "Image", "props": { "width": 720, "top": 0, "skin": "Main/chunhei2.png", "sizeGrid": "12,11,13,10", "right": 0, "name": "BG", "left": 0, "height": 183, "bottom": 0 }, "compId": 317 }, { "type": "List", "props": { "width": 720, "var": "BottomList", "spaceX": 30, "right": 0, "repeatY": 1, "left": 0, "height": 176, "bottom": 0 }, "compId": 318, "child": [{ "type": "Box", "props": { "y": 8, "x": 18, "width": 130, "renderType": "render", "height": 160 }, "compId": 319, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 129, "skin": "Main/bg-box.png", "sizeGrid": "27,27,37,20", "name": "BG", "height": 159 }, "compId": 320 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 130, "name": "icon", "height": 130 }, "compId": 321 }, { "type": "Text", "props": { "y": 130, "x": 0, "width": 126, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 29, "fontSize": 20, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 322 }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 130, "name": "btn", "height": 160 }, "compId": 323 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 335 }] }] }] }, { "type": "Button", "props": { "y": 561, "width": 140, "var": "LeftPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 88, "pivotX": 70, "left": 20, "height": 175 }, "compId": 315, "child": [{ "type": "Image", "props": { "width": 140, "name": "icon", "height": 140 }, "compId": 325 }, { "type": "Text", "props": { "y": 159, "x": 70, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 326 }] }, { "type": "Button", "props": { "y": 561, "width": 140, "var": "RightPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "right": 21, "pivotY": 88, "pivotX": 70, "height": 175 }, "compId": 316, "child": [{ "type": "Image", "props": { "width": 140, "name": "icon", "height": 140 }, "compId": 327 }, { "type": "Text", "props": { "y": 159, "x": 70, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 328 }] }, { "type": "Button", "props": { "y": 209, "x": 532, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit.png" }, "compId": 330 }, { "type": "Button", "props": { "y": 726, "x": 0, "var": "MoreGameBtn", "stateNum": 1, "skin": "Main/gengduoyouxi.png" }, "compId": 333 }], "animations": [{ "nodes": [{ "target": 293, "keyframes": { "x": [{ "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 15 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 30 }, { "value": 326, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 45 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 60 }] } }], "name": "gameStart", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 315, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 20 }] } }], "name": "lefticon", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 316, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 20 }] } }], "name": "righticon", "id": 3, "frameRate": 24, "action": 0 }], "loadList": ["Main/jindu-duan.png", "Main/jindu-guan-do.png", "Main/guanshu.png", "Main/shadi.png", "Main/jinbi-di.png", "Main/jinbi-zhu.png", "Main/shezhi.png", "Main/ButtonVibrationOff.png", "Main/ButtonVibrationOn.png", "Main/Icon_SoundOn.png", "Main/Icon_SoundOff.png", "Main/shengji.png", "Main/shangdain.png", "Main/zhiyin-di.png", "Main/pause1.png", "Main/shouzhi.png", "Main/fangxiangzuo.png", "Main/fangxiangyou.png", "Main/chunhei2.png", "Main/bg-box.png", "Main/hutui-1-4.png", "Main/exit.png", "Main/gengduoyouxi.png"], "loadList3D": [] };
  2477. ui.MainViewUI = MainViewUI;
  2478. REG("ui.MainViewUI", MainViewUI);
  2479. class ShadeViewUI extends Laya.View {
  2480. constructor() { super(); }
  2481. createChildren() {
  2482. super.createChildren();
  2483. this.createView(ShadeViewUI.uiView);
  2484. }
  2485. }
  2486. ShadeViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] };
  2487. ui.ShadeViewUI = ShadeViewUI;
  2488. REG("ui.ShadeViewUI", ShadeViewUI);
  2489. class SkinShopViewUI extends Laya.View {
  2490. constructor() { super(); }
  2491. createChildren() {
  2492. super.createChildren();
  2493. this.createView(SkinShopViewUI.uiView);
  2494. }
  2495. }
  2496. SkinShopViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "13,14,14,13", "right": 0, "left": 0, "bottom": 0 }, "compId": 115 }, { "type": "Image", "props": { "top": 0, "skin": "Main/bg-sheng1.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "x": 17, "var": "CloseBtn", "skin": "Main/guanbi-bt.png", "runtime": "View/Com/ButtonRunTime.ts", "centerY": -529 }, "compId": 87 }, { "type": "Image", "props": { "skin": "Main/pifu-biaoti.png", "centerY": -399 }, "compId": 92 }, { "type": "Box", "props": { "x": 50, "width": 626, "height": 102, "centerY": -70 }, "compId": 100, "child": [{ "type": "Button", "props": { "y": 0, "x": 0, "width": 83, "var": "leftBtn", "stateNum": 1, "height": 88 }, "compId": 93, "child": [{ "type": "Image", "props": { "y": 3, "x": 3, "skin": "Main/wu-you.png", "name": "leftFalse" }, "compId": 95 }, { "type": "Image", "props": { "y": 3, "x": 3, "skin": "Main/you-zuo.png", "name": "leftTrue" }, "compId": 96 }] }, { "type": "Button", "props": { "y": 51, "x": 572, "width": 94, "var": "rightBtn", "stateNum": 1, "pivotY": 51, "pivotX": 51, "height": 97 }, "compId": 97, "child": [{ "type": "Image", "props": { "y": 51, "x": 51, "width": 80, "skin": "Main/wu-zuo.png", "rotation": 180, "pivotY": 42, "pivotX": 40, "name": "rightFalse", "height": 84 }, "compId": 98 }, { "type": "Image", "props": { "y": 51, "x": 51, "width": 80, "skin": "Main/you-you.png", "pivotY": 42, "pivotX": 40, "name": "rightTrue", "height": 84 }, "compId": 99 }] }] }, { "type": "Image", "props": { "x": 163.5, "skin": "Main/dizuo.png", "centerY": 199 }, "compId": 101 }, { "type": "Image", "props": { "x": 173.5, "width": 379, "var": "viewPort", "height": 426, "centerY": 14 }, "compId": 102 }, { "type": "Box", "props": { "x": 196, "width": 331, "var": "btnBox", "height": 127, "centerY": 396 }, "compId": 113, "child": [{ "type": "Image", "props": { "y": 9, "x": 0, "var": "using", "skin": "Main/bt.png" }, "compId": 103, "child": [{ "type": "Text", "props": { "y": 22, "x": 54.5, "width": 202, "valign": "middle", "text": "使用中", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "use", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 105, "child": [{ "type": "Text", "props": { "y": 22, "x": 54.5, "width": 202, "valign": "middle", "text": "使用", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 106 }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "coin", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 107, "child": [{ "type": "Image", "props": { "y": 26.5, "x": 40, "width": 53, "skin": "Main/jinbi-zhu.png", "height": 56 }, "compId": 109, "child": [{ "type": "Text", "props": { "y": -4.5, "x": 37, "width": 202, "valign": "middle", "text": "500", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 108 }] }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "video", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 110, "child": [{ "type": "Image", "props": { "y": 24, "x": 46, "width": 65, "skin": "Main/shipin-biao.png", "height": 61 }, "compId": 111, "child": [{ "type": "Text", "props": { "y": -2, "x": 63, "width": 202, "valign": "middle", "text": "1/3", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 112 }] }] }] }], "loadList": ["Main/zhujiemian-1-20.png", "Main/bg-sheng1.png", "Main/guanbi-bt.png", "Main/pifu-biaoti.png", "Main/wu-you.png", "Main/you-zuo.png", "Main/wu-zuo.png", "Main/you-you.png", "Main/dizuo.png", "Main/bt.png", "Main/jinbi-zhu.png", "Main/shipin-biao.png"], "loadList3D": [] };
  2497. ui.SkinShopViewUI = SkinShopViewUI;
  2498. REG("ui.SkinShopViewUI", SkinShopViewUI);
  2499. class TopTipUiUI extends Laya.Scene {
  2500. constructor() { super(); }
  2501. createChildren() {
  2502. super.createChildren();
  2503. this.createView(TopTipUiUI.uiView);
  2504. }
  2505. }
  2506. TopTipUiUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "bg", "top": 0, "skin": "Main/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 647, "x": 159, "width": 402, "var": "sliderBox", "skin": "Main/huadong-tiao.png", "height": 33, "gray": false, "centerY": 23 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 124, "x": 37, "skin": "Main/pause1.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 0, "x": 201, "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 6 }] }], "animations": [{ "nodes": [{ "target": 6, "keyframes": { "x": [{ "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 0 }, { "value": 13, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 15 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 30 }, { "value": 402, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 45 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 60 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/huadong-tiao.png", "Main/pause1.png", "Main/shou.png"], "loadList3D": [] };
  2507. ui.TopTipUiUI = TopTipUiUI;
  2508. REG("ui.TopTipUiUI", TopTipUiUI);
  2509. class TrialViewUI extends Laya.Scene {
  2510. constructor() { super(); }
  2511. createChildren() {
  2512. super.createChildren();
  2513. this.createView(TrialViewUI.uiView);
  2514. }
  2515. }
  2516. TrialViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "11,11,13,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 82, "x": 129.5, "skin": "Main/biaoti.png" }, "compId": 4 }, { "type": "Image", "props": { "x": 104, "visible": false, "skin": "Main/shiyong-bg.png", "centerY": -100 }, "compId": 5 }, { "type": "Image", "props": { "x": 165, "skin": "Main/dizuo.png", "centerY": 91 }, "compId": 6 }, { "type": "Image", "props": { "x": 170, "width": 380, "var": "viewPort", "height": 398, "centerY": -91 }, "compId": 8 }, { "type": "Box", "props": { "x": 197.5, "width": 325, "var": "btnBox", "height": 191, "bottom": 175 }, "compId": 11, "child": [{ "type": "Image", "props": { "y": 127, "x": 91, "var": "backBtn", "skin": "Main/no-bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 9 }, { "type": "Image", "props": { "y": 0, "x": 16, "var": "videoBtn", "skin": "Main/sanbeilingqu--s.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 10 }] }], "loadList": ["Main/zhujiemian-1-20.png", "Main/biaoti.png", "Main/shiyong-bg.png", "Main/dizuo.png", "Main/no-bt.png", "Main/sanbeilingqu--s.png"], "loadList3D": [] };
  2517. ui.TrialViewUI = TrialViewUI;
  2518. REG("ui.TrialViewUI", TrialViewUI);
  2519. })(ui || (ui = {}));
  2520. class GuideView extends ui.GuideViewUI {
  2521. constructor() {
  2522. super();
  2523. this.isguide2or3 = false;
  2524. this.guide1pos = MathTool.VecZero;
  2525. this.guide1Com = false;
  2526. GuideView.instance = this;
  2527. this.Resize();
  2528. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  2529. }
  2530. static get Instance() {
  2531. return GuideView.instance;
  2532. }
  2533. OnShow(data) {
  2534. this.RegButton();
  2535. this.RefreshData();
  2536. this.RefreshUI();
  2537. }
  2538. RefreshUI() {
  2539. }
  2540. RefreshData() {
  2541. }
  2542. RegButton() {
  2543. }
  2544. TwoGuide() {
  2545. this.guide3Box.visible = true;
  2546. this.guide4Box.visible = true;
  2547. this.guide2Image.visible = true;
  2548. this.guide3.play(0, true);
  2549. this.guide4.play(0, true);
  2550. Laya.timer.frameLoop(1, this, this._twoguide);
  2551. this.guide1pos.x = -4.5;
  2552. this.guide1pos.y = 0;
  2553. }
  2554. _twoguide() {
  2555. let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guidetwoPos.clone());
  2556. this.guide4Box.pos(p.x, p.y);
  2557. this.guide1pos.z = this.playerTran.localPositionZ + 5;
  2558. let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos);
  2559. this.guide3Box.pos(p1.x, p1.y);
  2560. if (this.playerTran.localPositionZ >= GuideController.Instance.guidetwoPos.z - 10) {
  2561. this.guide3Box.visible = false;
  2562. this.guide4Box.visible = false;
  2563. this.guide2Image.visible = false;
  2564. this.guide3Image.visible = true;
  2565. this.guide3.stop();
  2566. this.guide4.stop();
  2567. Laya.timer.clear(this, this._twoguide);
  2568. Laya.timer.once(5000, this, () => {
  2569. GuideController.Instance.GuideOff();
  2570. });
  2571. }
  2572. }
  2573. SetGuide(type) {
  2574. if (!this.playerTran)
  2575. this.playerTran = MainRoleManager.Instance.playerTra;
  2576. if (!this._camera)
  2577. this._camera = CameraManager.Instance._maincamera;
  2578. if (type == 1) {
  2579. this.guide1Image.visible = true;
  2580. this.guide2Image.visible = false;
  2581. this.guide3Image.visible = false;
  2582. this.guide1Box.visible = true;
  2583. this.guide1.play(0, true);
  2584. this.guide4Box.visible = false;
  2585. if (this.playerTran.localPositionX <= GuideController.Instance.guideonepos.x) {
  2586. this.guide2Box.visible = true;
  2587. this.guide3Box.visible = false;
  2588. this.isguide2or3 = true;
  2589. this.guide2.play(0, true);
  2590. }
  2591. else {
  2592. this.guide2Box.visible = false;
  2593. this.guide3Box.visible = true;
  2594. this.isguide2or3 = false;
  2595. this.guide3.play(0, true);
  2596. }
  2597. this.guide1pos = GuideController.Instance.guideonepos.clone();
  2598. Laya.timer.frameLoop(1, this, this.OneGuide);
  2599. this.guide1Com = false;
  2600. }
  2601. }
  2602. OnClose() {
  2603. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  2604. GuideView.instance = null;
  2605. Laya.timer.clearAll(this);
  2606. }
  2607. Resize() {
  2608. this.height = Laya.stage.height;
  2609. }
  2610. OneGuide() {
  2611. if (!this.guide1Com) {
  2612. let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guideonepos.clone());
  2613. this.guide1Box.pos(p.x, p.y);
  2614. this.guide1pos.z = this.playerTran.localPositionZ + 10;
  2615. let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos);
  2616. if (this.isguide2or3) {
  2617. this.guide2Box.pos(p1.x, p1.y);
  2618. }
  2619. else {
  2620. this.guide3Box.pos(p1.x, p1.y);
  2621. }
  2622. if (this.playerTran.localPositionZ >= GuideController.Instance.guideonepos.z - 5) {
  2623. this.guide2.stop();
  2624. this.guide3.stop();
  2625. this.guide2Box.visible = false;
  2626. this.guide3Box.visible = false;
  2627. this.guide1Box.visible = false;
  2628. this.guide1Com = true;
  2629. this.guide1Image.visible = false;
  2630. }
  2631. }
  2632. else {
  2633. if (this.playerTran.localPositionZ >= GuideController.Instance.guideonepos.z) {
  2634. console.log(111);
  2635. Laya.timer.clear(this, this.OneGuide);
  2636. this.TwoGuide();
  2637. }
  2638. }
  2639. }
  2640. }
  2641. var Input = Laya.Input;
  2642. class GuideController {
  2643. constructor() {
  2644. this.guideonepos = new Laya.Vector3(2.5, 0, 59.4);
  2645. this.guidetwoPos = new Laya.Vector3(-5, 2, 104.4);
  2646. this.index = 0;
  2647. this._guide = false;
  2648. }
  2649. static get Instance() {
  2650. return this.instance || (this.instance = new GuideController());
  2651. }
  2652. GuideOn() {
  2653. if (this._guide) {
  2654. Laya.timer.once(500, this, this.Guide);
  2655. }
  2656. }
  2657. Guide() {
  2658. ViewManager.Instance.ShowGuideView();
  2659. if (GuideView.Instance) {
  2660. GuideView.Instance.SetGuide(1);
  2661. }
  2662. }
  2663. GuideOff() {
  2664. this._guide = false;
  2665. ViewManager.Instance.CloseGuideView();
  2666. }
  2667. GameOver() {
  2668. if (this._guide) {
  2669. ViewManager.Instance.CloseGuideView();
  2670. }
  2671. }
  2672. createInput() {
  2673. var inputText = new Input();
  2674. inputText.size(350, 100);
  2675. inputText.x = Laya.stage.width - inputText.width >> 1;
  2676. inputText.y = Laya.stage.height - inputText.height >> 1;
  2677. inputText.text = "这段文本不可编辑,但可复制";
  2678. inputText.editable = false;
  2679. inputText.bold = true;
  2680. inputText.bgColor = "#666666";
  2681. inputText.color = "#ffffff";
  2682. inputText.fontSize = 20;
  2683. Laya.stage.addChild(inputText);
  2684. }
  2685. InitGuide(p) {
  2686. if (this.index == 0) {
  2687. this.guideonepos.z = p;
  2688. this.index++;
  2689. }
  2690. else if (this.index == 1) {
  2691. this.guidetwoPos.z = p;
  2692. this.index++;
  2693. }
  2694. }
  2695. RequireGuide() {
  2696. let t = Laya.LocalStorage.getItem("guide");
  2697. if (PlayerManager.Instance.stage == 1) {
  2698. Laya.LocalStorage.setItem("guide", "1");
  2699. this._guide = true;
  2700. return true;
  2701. }
  2702. this._guide = false;
  2703. return false;
  2704. }
  2705. }
  2706. var Sprite$4 = Laya.Sprite;
  2707. class RoadArr {
  2708. constructor(blocks, blockPos) {
  2709. this.blocks = blocks;
  2710. this.blockPos = blockPos;
  2711. }
  2712. }
  2713. class BlockArr {
  2714. constructor(things, thingPos, blockHp) {
  2715. this.things = things;
  2716. this.thingPos = thingPos;
  2717. this.blockHp = blockHp;
  2718. }
  2719. }
  2720. class ThingArr {
  2721. constructor(type, prrfabName, moveType, moveSpeed) {
  2722. this.type = type;
  2723. this.prrfabName = prrfabName;
  2724. this.moveType = moveType;
  2725. this.moveSpeed = moveSpeed;
  2726. }
  2727. }
  2728. class StreetManager {
  2729. constructor() {
  2730. this.isover = false;
  2731. this.curindex = 1;
  2732. this.texture1 = "res/apes/monkey2.png";
  2733. this.texture2 = "res/apes/monkey3.png";
  2734. this.flag = false;
  2735. this.blockDic = new Dictionary();
  2736. this.cubeBlockDic = new Dictionary();
  2737. }
  2738. static get Instance() {
  2739. return StreetManager.instance || (StreetManager.instance = new StreetManager());
  2740. }
  2741. Init(BlockContainer) {
  2742. this.BlockContainer = BlockContainer;
  2743. }
  2744. SetBlock() {
  2745. this.isover = false;
  2746. this.curindex = 1;
  2747. this.CreateStreet();
  2748. }
  2749. onAssetsLoaded() {
  2750. this.ape = new Sprite$4();
  2751. Laya.stage.addChild(this.ape);
  2752. this.ape.pivot(55, 72);
  2753. this.ape.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  2754. this.switchTexture();
  2755. this.ape.on("click", this, this.switchTexture);
  2756. }
  2757. switchTexture() {
  2758. var textureUrl = (this.flag = !this.flag) ? this.texture1 : this.texture2;
  2759. this.ape.graphics.clear();
  2760. var texture = Laya.loader.getRes(textureUrl);
  2761. this.ape.graphics.drawTexture(texture, 0, 0);
  2762. this.ape.size(texture.width, texture.height);
  2763. }
  2764. CheckPlayerRoadPos(_zp) {
  2765. if (this.isover)
  2766. return;
  2767. let d = this.tarDis - _zp;
  2768. if (d > 0)
  2769. return;
  2770. this.StreetSwitch();
  2771. }
  2772. StreetSwitch() {
  2773. this.curindex++;
  2774. this.CreateStreet();
  2775. }
  2776. CreateSprite(road) {
  2777. if (GuideController.Instance._guide) {
  2778. GuideController.Instance.InitGuide(road.blockPos[0]);
  2779. }
  2780. let blocks = road.blocks;
  2781. let blockPos = road.blockPos;
  2782. let j = 0;
  2783. for (let index = 0; index < blocks.length; index++) {
  2784. const element = blocks[index];
  2785. const p = blockPos[index];
  2786. let things = element.things;
  2787. let thingPos = element.thingPos;
  2788. let blockHp = element.blockHp;
  2789. let isr = blockHp.length > 1;
  2790. for (let index = 0; index < things.length; index++) {
  2791. const element1 = things[index];
  2792. element1.z = p;
  2793. element1.x = thingPos[index];
  2794. element1.towerR = isr;
  2795. element1.hp = blockHp[index];
  2796. j++;
  2797. Laya.timer.frameOnce(j, this, this.Create, [element1], false);
  2798. }
  2799. }
  2800. }
  2801. Create(thing) {
  2802. if (thing.type == 1 || thing.type == 2) {
  2803. MoundManager.Instance.MakeMound(thing);
  2804. }
  2805. else {
  2806. let p = GamePool.Instance.GetModel(thing.prrfabName);
  2807. if (!p)
  2808. return;
  2809. this.BlockContainer.addChild(p);
  2810. let ts = p.getComponent(Street);
  2811. if (!ts)
  2812. ts = p.addComponent(Street);
  2813. ts.SetStreet(thing);
  2814. this.blockDic.set(p.id, ts);
  2815. }
  2816. }
  2817. RecoverStreet(sp) {
  2818. this.blockDic.delete(sp.id);
  2819. }
  2820. StreetAtkedCube(sp) {
  2821. sp.active = false;
  2822. ParticleManager.Instance.ExplodeEffect(sp.transform.position);
  2823. }
  2824. Reset() {
  2825. this.isover = false;
  2826. let arr = [];
  2827. for (const key in this.blockDic.container) {
  2828. arr.push(key);
  2829. }
  2830. let j = 1;
  2831. if (arr.length > 0) {
  2832. for (let index = 0; index < arr.length; index++) {
  2833. const element = arr[index];
  2834. let s = this.blockDic.get(element);
  2835. if (s)
  2836. s.Recover();
  2837. if (this.cubeBlockDic.has(element)) {
  2838. Laya.timer.frameOnce(j, this, this.StreetResetCube, [element], false);
  2839. j++;
  2840. }
  2841. }
  2842. }
  2843. }
  2844. StreetAddCube(sp) {
  2845. if (this.cubeBlockDic.has(sp.id))
  2846. return;
  2847. this.cubeBlockDic.set(sp.id, sp);
  2848. }
  2849. StreetResetCube(id) {
  2850. let sp = this.cubeBlockDic.get(id);
  2851. this.cubeBlockDic.delete(id);
  2852. if (!sp)
  2853. return;
  2854. console.log("回收CubeBlock,", sp.name);
  2855. for (let index = 0; index < sp.numChildren; index++) {
  2856. const element = sp.getChildAt(index);
  2857. element.active = true;
  2858. }
  2859. }
  2860. createApes() {
  2861. var gap = 300;
  2862. this.sp1 = new Sprite$4();
  2863. this.sp1.pos((Laya.stage.width - gap) / 2, Laya.stage.height / 2);
  2864. this.sp1.pivot(55, 72);
  2865. Laya.stage.addChild(this.sp1);
  2866. this.sp2 = new Sprite$4();
  2867. this.sp2.pos((Laya.stage.width + gap) / 2, Laya.stage.height / 2);
  2868. Laya.stage.addChild(this.sp2);
  2869. Laya.timer.frameLoop(1, this, this.animate);
  2870. }
  2871. animate(e) {
  2872. this.sp1.rotation += 2;
  2873. this.sp2.rotation += 2;
  2874. }
  2875. CreateStreet() {
  2876. let road_list = LevelController.Instance._level.road_list;
  2877. if (this.curindex > road_list.length - 1) {
  2878. this.isover = true;
  2879. console.log("没有障碍物了");
  2880. return;
  2881. }
  2882. this.tarDis =
  2883. this.curindex * GlobalParam.barrierRoadLength;
  2884. let roadindex = road_list[this.curindex];
  2885. if (roadindex == 0)
  2886. return;
  2887. let roads = NetInfoManager.Instance.GetRoad(roadindex);
  2888. if (!roads)
  2889. return;
  2890. let blocks = GameTool.SpliteString(roads["blocks"]);
  2891. let blockPoss = GameTool.SpliteString(roads["position"]);
  2892. let bps = [];
  2893. let d = GlobalParam.barrierRoadLength / GlobalParam.barrierRoadAverageNum;
  2894. blockPoss.forEach(element => {
  2895. bps.push(this.tarDis + element * d);
  2896. });
  2897. let bbs = [];
  2898. blocks.forEach(element => {
  2899. let thing = NetInfoManager.Instance.GetStreet(element);
  2900. let tss = GameTool.SpliteString(thing["block_things"]);
  2901. let tps = GameTool.SpliteString(thing["thing_position"]);
  2902. let ths = GameTool.SpliteString(thing["block_hp"]);
  2903. let ttt = [];
  2904. tss.forEach(element1 => {
  2905. let t = NetInfoManager.Instance.GetThing(element1);
  2906. let tt = new ThingArr(t["type"], t["prefabs"], t["dynamic_type"], t["dynamic_speed"]);
  2907. ttt.push(tt);
  2908. });
  2909. let things = new BlockArr(ttt, tps, ths);
  2910. bbs.push(things);
  2911. });
  2912. let blockB = new RoadArr(bbs, bps);
  2913. this.CreateSprite(blockB);
  2914. }
  2915. }
  2916. var Vector3 = Laya.Vector3;
  2917. var Quaternion = Laya.Quaternion;
  2918. var Animation$1 = Laya.Animation;
  2919. var Tween = Laya.Tween;
  2920. class Opponent extends Laya.Script3D {
  2921. constructor() {
  2922. super(...arguments);
  2923. this._up = new Vector3(0, 1, 0);
  2924. this.isArrive1 = false;
  2925. this.phoenixWidth = 550;
  2926. this.phoenixHeight = 400;
  2927. this.bgColorTweener = new Tween();
  2928. this.gradientInterval = 2000;
  2929. this.bgColorChannels = { r: 99, g: 0, b: 0xFF };
  2930. }
  2931. onAwake() {
  2932. this.selfobj = this.owner;
  2933. this.tran = this.selfobj.transform;
  2934. this.forW = MathTool.VecZero;
  2935. this.speed = GlobalParam.enemySpeed;
  2936. this.quaternion1 = new Quaternion();
  2937. }
  2938. Run() {
  2939. if (this.isArrive1) {
  2940. if (this.tarSp == null)
  2941. return;
  2942. if (!this.tarSp.active) {
  2943. this.tarSp = RoleManager.Instance.GetTar();
  2944. if (this.tarSp == null)
  2945. return;
  2946. this.tarPos = this.tarSp.transform.position.clone();
  2947. }
  2948. Vector3.subtract(this.tarPos, this.tran.position, this.forW);
  2949. Vector3.normalize(this.forW, this.forW);
  2950. this.forW = new Vector3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
  2951. this.tran.translate(this.forW, false);
  2952. if (Vector3.distance(this.tran.position, this.tarPos) < 0.1) {
  2953. return;
  2954. }
  2955. Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1);
  2956. this.quaternion1.invert(this.quaternion1);
  2957. this.tran.rotation = this.quaternion1.clone();
  2958. }
  2959. else {
  2960. Vector3.subtract(this.tarPos, this.tran.position, this.forW);
  2961. Vector3.normalize(this.forW, this.forW);
  2962. this.forW = new Vector3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
  2963. this.tran.translate(this.forW, false);
  2964. if (Vector3.distance(this.tran.position, this.tarPos) < 0.1) {
  2965. this.tarSp = RoleManager.Instance.GetTar();
  2966. this.isArrive1 = true;
  2967. if (this.tarSp == null)
  2968. return;
  2969. this.tarPos = this.tarSp.transform.position.clone();
  2970. return;
  2971. }
  2972. Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1);
  2973. this.quaternion1.invert(this.quaternion1);
  2974. this.tran.rotation = this.quaternion1.clone();
  2975. }
  2976. }
  2977. createPhoenixes() {
  2978. var scaleFactor = Math.min(Laya.stage.width / (this.phoenixWidth * 2), Laya.stage.height / this.phoenixHeight);
  2979. var blendedPhoenix = this.createAnimation();
  2980. blendedPhoenix.blendMode = "lighter";
  2981. blendedPhoenix.scale(scaleFactor, scaleFactor);
  2982. blendedPhoenix.y = (Laya.stage.height - this.phoenixHeight * scaleFactor) / 2;
  2983. var normalPhoenix = this.createAnimation();
  2984. normalPhoenix.scale(scaleFactor, scaleFactor);
  2985. normalPhoenix.x = this.phoenixWidth * scaleFactor;
  2986. normalPhoenix.y = (Laya.stage.height - this.phoenixHeight * scaleFactor) / 2;
  2987. }
  2988. createAnimation() {
  2989. var frames = [];
  2990. var animation = new Animation$1();
  2991. animation.loadImages(frames);
  2992. Laya.stage.addChild(animation);
  2993. var clips = animation.frames.concat();
  2994. clips = clips.reverse();
  2995. animation.frames = animation.frames.concat(clips);
  2996. animation.play();
  2997. return animation;
  2998. }
  2999. Recovery() {
  3000. Laya.timer.clearAll(this);
  3001. RoleManager.Instance.RecoverEnemy(this.selfobj);
  3002. GamePool.Instance.RecoverModel(this.selfobj);
  3003. }
  3004. InitModel(tar, hp, cloth) {
  3005. this.tarSp = tar;
  3006. this.isArrive1 = false;
  3007. if (this.tarSp == null)
  3008. return;
  3009. this.tarPos = this.tarSp.transform.position.clone();
  3010. if (this.tarPos.x > 0) {
  3011. this.tarPos = PlaneManager.Instance.toured1.clone();
  3012. }
  3013. else {
  3014. this.tarPos = PlaneManager.Instance.toured2.clone();
  3015. }
  3016. this.hp = hp;
  3017. Laya.timer.frameLoop(1, this, this.Run);
  3018. }
  3019. Injured(hitpos) {
  3020. this.hp -= PlayerManager.bulletAttack;
  3021. if (this.hp <= 0) {
  3022. this.Dead();
  3023. return;
  3024. }
  3025. ParticleManager.Instance.AttackEffect(hitpos);
  3026. }
  3027. Dead() {
  3028. ParticleManager.Instance.BloodEffect(this.tran.position);
  3029. this.Recovery();
  3030. RoleManager.Instance.CheckGameOver();
  3031. GameManager.Instance.roleCount++;
  3032. }
  3033. }
  3034. var Sprite$5 = Laya.Sprite;
  3035. class RoleManager {
  3036. constructor() {
  3037. this.frameCount = 10;
  3038. this.enemyDic = new Dictionary();
  3039. }
  3040. static get Instance() {
  3041. return this.instance || (this.instance = new RoleManager());
  3042. }
  3043. Create(hp, texture) {
  3044. let e = GamePool.Instance.GetModel(GamePool.modeltype.Enemy);
  3045. if (!e)
  3046. return;
  3047. MainRoleManager.Instance.playerContainer.addChild(e);
  3048. e.transform.position = this.startPos.clone();
  3049. let ps = e.getComponent(Opponent);
  3050. if (!ps)
  3051. ps = e.addComponent(Opponent);
  3052. let sp = this.GetTar();
  3053. ps.InitModel(sp, hp, texture);
  3054. this.enemyDic.set(e.id, ps);
  3055. }
  3056. CheckGameOver() {
  3057. if (this.enemyDic.size == 0) {
  3058. MouseEvent.Instance.OnClickUp();
  3059. MainRoleManager.Instance.CreateOver();
  3060. GameManager.Instance.Congratulate();
  3061. }
  3062. }
  3063. GetOpponent() {
  3064. for (const key in this.enemyDic.container) {
  3065. const element = this.enemyDic.get(key);
  3066. return element.selfobj;
  3067. }
  3068. return null;
  3069. }
  3070. Reset() {
  3071. let arr = [];
  3072. for (const key in this.enemyDic.container) {
  3073. arr.push(key);
  3074. }
  3075. if (arr.length > 0) {
  3076. for (let index = 0; index < arr.length; index++) {
  3077. const element = arr[index];
  3078. let s = this.enemyDic.get(element);
  3079. if (s)
  3080. s.Recovery();
  3081. }
  3082. }
  3083. }
  3084. CreateOpponent(startPos) {
  3085. this.startPos = startPos;
  3086. let count = LevelController.Instance._level.enemy;
  3087. let hp = LevelController.Instance._level.enemy_hp;
  3088. let texture = LevelController.Instance._level.enemy_cloth;
  3089. for (let index = 0; index < count; index++) {
  3090. let a = index;
  3091. Laya.timer.frameOnce(a * this.frameCount, this, this.Create, [hp, texture], false);
  3092. }
  3093. }
  3094. createCoralRect() {
  3095. var coralRect = new Sprite$5();
  3096. coralRect.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height / 2, "#FF7F50");
  3097. coralRect.name = "珊瑚色容器";
  3098. coralRect.size(Laya.stage.width, Laya.stage.height / 2);
  3099. Laya.stage.addChild(coralRect);
  3100. }
  3101. createDeepSkyblueRect() {
  3102. var deepSkyblueRect = new Sprite$5();
  3103. deepSkyblueRect.graphics.drawRect(0, 0, 100, 100, "#00BFFF");
  3104. deepSkyblueRect.name = "天蓝色矩形";
  3105. deepSkyblueRect.size(100, 100);
  3106. deepSkyblueRect.pos(10, 10);
  3107. Laya.stage.addChild(deepSkyblueRect);
  3108. }
  3109. GetTar() {
  3110. let p = MainRoleManager.Instance.NearIsdead();
  3111. if (!p) {
  3112. if (Math.random() > 0.5) {
  3113. return MainRoleManager.Instance.playerScript.body;
  3114. }
  3115. else {
  3116. let s = MateManager.Instance.GetSprite();
  3117. if (!s)
  3118. return MainRoleManager.Instance.playerScript.body;
  3119. else
  3120. return s;
  3121. }
  3122. }
  3123. else {
  3124. let s = MateManager.Instance.GetSprite();
  3125. if (!s)
  3126. return null;
  3127. else
  3128. return s;
  3129. }
  3130. }
  3131. RecoverEnemy(sp) {
  3132. this.enemyDic.delete(sp.id);
  3133. }
  3134. }
  3135. class GuangGao {
  3136. constructor() {
  3137. GuangGao.ins = this;
  3138. }
  3139. static get Instance() {
  3140. if (GuangGao.ins == null) {
  3141. return new GuangGao();
  3142. }
  3143. return GuangGao.ins;
  3144. }
  3145. static InitVideo() {
  3146. }
  3147. static ShowVideo(callback) {
  3148. }
  3149. static SetVideoCallBack(callback) {
  3150. this.fsaasfafssfa.offClose();
  3151. this.fsaasfafssfa.onClose(res => {
  3152. console.log("激励视频关闭:" + res.isEnded);
  3153. if (res && res.isEnded || res === undefined) {
  3154. callback && callback(true);
  3155. }
  3156. else {
  3157. callback && callback(false);
  3158. }
  3159. this.fsaasfafssfa.offClose();
  3160. });
  3161. }
  3162. static OpenBanner(gap = 0, callVack = null, iswait = false) {
  3163. }
  3164. static GetRealHight(gap) {
  3165. if (this.curbanner) {
  3166. let info = Laya.Browser.window.wx.getSystemInfoSync();
  3167. this.curbanner.style.width = info.windowWidth;
  3168. this.curbanner.style.top = info.windowHeight - this.curbanner.style.realHeight - gap;
  3169. return Laya.stage.height / info.windowHeight * this.curbanner.style.realHeight;
  3170. }
  3171. }
  3172. static Clear() {
  3173. }
  3174. static hidebanner() {
  3175. if (!Laya.Browser.onWeiXin)
  3176. return;
  3177. if (this.curbanner)
  3178. this.curbanner.hide();
  3179. }
  3180. static showbanner() {
  3181. if (!Laya.Browser.onWeiXin)
  3182. return;
  3183. if (this.curbanner)
  3184. this.curbanner.show();
  3185. }
  3186. static get cancheat() {
  3187. if (!UserInfoManager.Cheat) {
  3188. console.log("cheat:false-> CurAccountData.cheat != 1");
  3189. return false;
  3190. }
  3191. var checkscence = UserInfoManager.CheckScene;
  3192. if (checkscence == false) {
  3193. console.log("cheat:true-> " + GameVersion.wxValue);
  3194. return true;
  3195. }
  3196. if (GameVersion.wxValue == "1037" || GameVersion.wxValue == "1058" || GameVersion.wxValue == "1067" || GameVersion.wxValue == "1095") {
  3197. console.log("cheat:true-> " + GameVersion.wxValue);
  3198. return true;
  3199. }
  3200. console.log("cheat:false-> " + GameVersion.wxValue);
  3201. return false;
  3202. }
  3203. static SetPosBanner(btn, complete) {
  3204. }
  3205. static CheatBanner(btn, complete = null, gap = 0) {
  3206. }
  3207. showBanner(success = null, fail = null) {
  3208. if (!Laya.Browser.onWeiXin)
  3209. return;
  3210. let ad = GuangGao.bannerAdUnitId;
  3211. let bannerAd = Laya.Browser.window.wx.createBannerAd({
  3212. adUnitId: ad,
  3213. style: {
  3214. left: 0,
  3215. top: 0,
  3216. width: 460
  3217. }
  3218. });
  3219. bannerAd.onLoad(() => {
  3220. console.log("[LOG] Banner广告加载成功");
  3221. this.hideBanner();
  3222. this._bannerAd = bannerAd;
  3223. let info = Laya.Browser.window.wx.getSystemInfoSync();
  3224. this._bannerAd.style.width = info.windowWidth;
  3225. this._bannerAd.style.top = info.windowHeight - this._bannerAd.style.realHeight - 20;
  3226. this._bannerAd.show();
  3227. success && success(this._bannerAd);
  3228. });
  3229. bannerAd.onError(err => {
  3230. console.log("[LOG] Banner广告加载失败");
  3231. console.log(err);
  3232. fail && fail();
  3233. });
  3234. }
  3235. hideBanner() {
  3236. if (!Laya.Browser.onWeiXin)
  3237. return;
  3238. if (this._bannerAd) {
  3239. this._bannerAd.hide();
  3240. this._bannerAd.destroy();
  3241. this._bannerAd = null;
  3242. }
  3243. }
  3244. }
  3245. GuangGao.videlAdUnitId = "adunit-c417d6819ffdc5a2";
  3246. GuangGao.bannerAdUnitId = "adunit-741a4dcc646d56b8";
  3247. GuangGao.afsfsaafsfsa = false;
  3248. GuangGao.asfasfsaffsa = false;
  3249. GuangGao.canshowbanner = true;
  3250. GuangGao.bannerhigt = 0;
  3251. class GameManager {
  3252. constructor() {
  3253. this.towerCount = 0;
  3254. this.roleCount = 0;
  3255. this.blockCount = 0;
  3256. }
  3257. static get Instance() {
  3258. return GameManager.instance || (GameManager.instance = new GameManager());
  3259. }
  3260. Start() {
  3261. this.towerCount = 0;
  3262. this.roleCount = 0;
  3263. this.blockCount = 0;
  3264. }
  3265. Win() {
  3266. WXSdk.LongVibrate();
  3267. GuangGao.Clear();
  3268. ViewManager.Instance.AddView(ViewType.CompleteView, true);
  3269. MoundManager.Instance.Reset();
  3270. StreetManager.Instance.Reset();
  3271. MateManager.Instance.Reset();
  3272. MainRoleManager.Instance.Reset();
  3273. RoleManager.Instance.Reset();
  3274. }
  3275. Congratulate(isglod = false) {
  3276. GuangGao.CheatBanner(null);
  3277. MainRoleManager.Instance.GoToTiaoWu();
  3278. if (isglod)
  3279. MateManager.Instance.TiaoWu1();
  3280. else
  3281. MateManager.Instance.TiaoWu();
  3282. CameraManager.Instance.SetCameraAction(CameraState.jump, 0.03);
  3283. Laya.timer.once(4000, this, this.Win);
  3284. }
  3285. Over() {
  3286. GuideController.Instance.GameOver();
  3287. MouseEvent.Instance.OnClickUp();
  3288. MainRoleManager.Instance.CreateOver();
  3289. MouseEvent.Instance._Switch = false;
  3290. WXSdk.LongVibrate();
  3291. GuangGao.Clear();
  3292. ViewManager.Instance.AddView(ViewType.CompleteView, false);
  3293. MoundManager.Instance.Reset();
  3294. StreetManager.Instance.Reset();
  3295. MateManager.Instance.Reset();
  3296. MainRoleManager.Instance.Reset();
  3297. MainRoleManager.Instance.HidePlayer();
  3298. RoleManager.Instance.Reset();
  3299. }
  3300. loadUI() {
  3301. Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
  3302. this.changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "切换Mesh"));
  3303. this.changeActionButton.size(160, 40);
  3304. this.changeActionButton.labelBold = true;
  3305. this.changeActionButton.labelSize = 30;
  3306. this.changeActionButton.sizeGrid = "4,4,4,4";
  3307. this.changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
  3308. this.changeActionButton.pos(Laya.stage.width / 2 - this.changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
  3309. this.changeActionButton.on(Laya.Event.CLICK, this, function () {
  3310. this.index++;
  3311. if (this.index % 5 === 1) {
  3312. this.sphere.meshFilter.sharedMesh = this.box;
  3313. }
  3314. else if (this.index % 5 === 2) {
  3315. this.sphere.meshFilter.sharedMesh = this.capsule;
  3316. }
  3317. else if (this.index % 5 === 3) {
  3318. this.sphere.meshFilter.sharedMesh = this.cylinder;
  3319. }
  3320. else if (this.index % 5 === 3) {
  3321. this.sphere.meshFilter.sharedMesh = this.cone;
  3322. }
  3323. else {
  3324. this.sphere.meshFilter.sharedMesh = this.sphereMesh;
  3325. }
  3326. });
  3327. }));
  3328. }
  3329. Near() {
  3330. MoundManager.Instance.Reset();
  3331. StreetManager.Instance.Reset();
  3332. }
  3333. ReStart() {
  3334. MateManager.Instance.Reset();
  3335. Scene3DManager.Instance.InItScene();
  3336. DispatcherManager.event(EventType.Event.ShowMainUi);
  3337. DispatcherManager.event(EventType.Event.SetStagePro, 0);
  3338. }
  3339. LevelUp() {
  3340. PlayerManager.Instance.stage++;
  3341. Scene3DManager.Instance.InItScene();
  3342. ViewManager.Instance.CloseView(ViewType.CompleteView);
  3343. DispatcherManager.event(EventType.Event.ShowMainUi);
  3344. DispatcherManager.event(EventType.Event.SetStage);
  3345. DispatcherManager.event(EventType.Event.SetStagePro, 0);
  3346. }
  3347. }
  3348. GameManager.GameNum = 0;
  3349. class Mound extends Laya.Script3D {
  3350. constructor() {
  3351. super(...arguments);
  3352. this.guideSteps = [
  3353. { x: 151, y: 575, radius: 150, tip: "res/guide/help6.png", tipx: 200, tipy: 250 },
  3354. { x: 883, y: 620, radius: 100, tip: "res/guide/help4.png", tipx: 730, tipy: 380 },
  3355. { x: 1128, y: 583, radius: 110, tip: "res/guide/help3.png", tipx: 900, tipy: 300 }
  3356. ];
  3357. this.guideStep = 0;
  3358. }
  3359. onAwake() {
  3360. this.selfobj = this.owner;
  3361. this.tran = this.selfobj.transform;
  3362. this.FriendSpawnPoint = this.selfobj.getChildByName("FriendSpawnPoint").transform;
  3363. this.HealthText = this.selfobj.getChildByName("HealthText").transform;
  3364. let we = this.selfobj.getChildByName("WallsEnd");
  3365. this.WallsEnd = we.transform;
  3366. this._reflect = we.getChildAt(0).meshRenderer.material;
  3367. }
  3368. HpUi() {
  3369. let p = MatrixTransform.WorldToScreen2(this._camera, this.HealthText.position.clone());
  3370. if (p.x <= 0 || p.x >= Laya.stage.width || p.y <= 0 || p.y >= Laya.stage.height)
  3371. this.hpText.visible = false;
  3372. else {
  3373. if (!this.hpText.visible)
  3374. this.hpText.visible = true;
  3375. this.hpText.x = p.x;
  3376. this.hpText.y = p.y;
  3377. }
  3378. }
  3379. CheckHp() {
  3380. if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 5) {
  3381. this.Recovery();
  3382. return;
  3383. }
  3384. this.HpUi();
  3385. }
  3386. nextStep() {
  3387. if (this.guideStep == this.guideSteps.length) {
  3388. Laya.stage.removeChild(this.guideContainer);
  3389. Laya.stage.removeChild(this.tipContainer);
  3390. }
  3391. else {
  3392. var step = this.guideSteps[this.guideStep++];
  3393. this.hitArea.unHit.clear();
  3394. this.hitArea.unHit.drawCircle(step.x, step.y, step.radius, "#000000");
  3395. this.interactionArea.graphics.clear();
  3396. this.interactionArea.graphics.drawCircle(step.x, step.y, step.radius, "#000000");
  3397. this.tipContainer.graphics.clear();
  3398. this.tipContainer.loadImage(step.tip);
  3399. this.tipContainer.pos(step.tipx, step.tipy);
  3400. }
  3401. }
  3402. MakeMate() {
  3403. this._mate = MateManager.Instance.MadeMate(this.FriendSpawnPoint);
  3404. }
  3405. Rescue() {
  3406. if (this._mate) {
  3407. this._mate.FallDown();
  3408. this._mate = null;
  3409. }
  3410. }
  3411. ReflectSet() {
  3412. this._reflect.albedoIntensity = 4;
  3413. Laya.timer.once(100, this, () => {
  3414. this._reflect.albedoIntensity = 1;
  3415. });
  3416. }
  3417. Recovery() {
  3418. Laya.timer.clearAll(this);
  3419. if (this.hpText) {
  3420. GamePool.Instance.RecoverUi(PoolType.HpText, this.hpText);
  3421. this.hpText = null;
  3422. }
  3423. this._reflect.albedoIntensity = 1;
  3424. MoundManager.Instance.RecoverMound(this.selfobj);
  3425. GamePool.Instance.RecoverModel(this.selfobj);
  3426. if (this._mate) {
  3427. this._mate.Recover();
  3428. this._mate = null;
  3429. }
  3430. }
  3431. Injured(hitpos) {
  3432. this._hp -= PlayerManager.bulletAttack;
  3433. if (this._hp <= 0) {
  3434. this.Rescue();
  3435. ParticleManager.Instance.ExplodeEffect(this.tran.position);
  3436. this.Recovery();
  3437. GameManager.Instance.towerCount++;
  3438. return;
  3439. }
  3440. ParticleManager.Instance.AttackEffect(hitpos);
  3441. let t = Math.ceil(this._hp);
  3442. this.hpText.text = t.toString();
  3443. this.ReflectSet();
  3444. }
  3445. SetMound(data) {
  3446. this._mate = null;
  3447. this.tarTran = MainRoleManager.Instance.player.transform;
  3448. this.tran.localPositionX = data.x;
  3449. this.tran.localPositionY = 0;
  3450. this.tran.localPositionZ = data.z;
  3451. if (data.towerR)
  3452. this.WallsEnd.localRotationEulerY = 30;
  3453. else
  3454. this.WallsEnd.localRotationEulerY = 0;
  3455. if (data.type == 1) {
  3456. this.MakeMate();
  3457. }
  3458. this._hp = data.hp;
  3459. if (!this.hpText) {
  3460. this.hpText = MoundManager.Instance.HpUi();
  3461. this.hpText.text = this._hp.toString();
  3462. if (!this._camera)
  3463. this._camera = CameraManager.Instance._maincamera;
  3464. ViewManager.Instance.popNode.addChild(this.hpText);
  3465. }
  3466. this.HpUi();
  3467. Laya.timer.frameLoop(1, this, this.CheckHp);
  3468. }
  3469. }
  3470. var Vector3$1 = Laya.Vector3;
  3471. var Sprite$6 = Laya.Sprite;
  3472. class MainRoleShot extends Laya.Script3D {
  3473. constructor() {
  3474. super(...arguments);
  3475. this.speed = MathTool.VecZero;
  3476. this._forward = new Vector3$1(0, 0, 1);
  3477. this.over = false;
  3478. }
  3479. onAwake() {
  3480. this.selfobj = this.owner;
  3481. this.tran = this.selfobj.transform;
  3482. this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
  3483. this.speed.z = GlobalParam.shootspeed;
  3484. }
  3485. Run() {
  3486. this.tran.translate(this.speed);
  3487. let d = Vector3$1.distance(this.tarTran.position, this.tran.position);
  3488. if (d >= GlobalParam.bulletMaxDis) {
  3489. this.RecoverBullet();
  3490. return;
  3491. }
  3492. this.RayReset();
  3493. }
  3494. RecoverBullet() {
  3495. Laya.timer.clearAll(this);
  3496. GamePool.Instance.RecoverModel(this.selfobj);
  3497. GamePool.bulletCount--;
  3498. }
  3499. drawSomething() {
  3500. this.sp = new Sprite$6();
  3501. Laya.stage.addChild(this.sp);
  3502. this.sp.graphics.drawLine(10, 58, 146, 58, "#ff0000", 3);
  3503. this.sp.graphics.drawLines(176, 58, [0, 0, 39, -50, 78, 0, 117, 50, 156, 0], "#ff0000", 5);
  3504. this.sp.graphics.drawCurves(352, 58, [0, 0, 19, -100, 39, 0, 58, 100, 78, 0, 97, -100, 117, 0, 136, 100, 156, 0], "#ff0000", 5);
  3505. this.sp.graphics.drawRect(10, 166, 166, 90, "#ffff00");
  3506. this.sp.graphics.drawPoly(264, 166, [0, 0, 60, 0, 78.48, 57, 30, 93.48, -18.48, 57], "#ffff00");
  3507. this.sp.graphics.drawPoly(400, 166, [0, 100, 50, 0, 100, 100], "#ffff00");
  3508. this.sp.graphics.drawCircle(98, 332, 50, "#00ffff");
  3509. this.sp.graphics.drawPie(240, 290, 100, 10, 60, "#00ffff");
  3510. this.sp.graphics.drawPath(400, 310, [["moveTo", 5, 0], ["lineTo", 105, 0], ["arcTo", 110, 0, 110, 5, 5], ["lineTo", 110, 55], ["arcTo", 110, 60, 105, 60, 5], ["lineTo", 5, 60], ["arcTo", 0, 60, 0, 55, 5], ["lineTo", 0, 5], ["arcTo", 0, 0, 5, 0, 5], ["closePath"]], { fillStyle: "#00ffff" });
  3511. }
  3512. RayReset() {
  3513. let origP = this.rayPoint.position.clone();
  3514. if (!this._scene) {
  3515. this._scene = Scene3DManager.Instance.MainScene;
  3516. }
  3517. if (!this.ray) {
  3518. if (!this.forward)
  3519. this.forward = MathTool.VecZero;
  3520. this.ray = new Laya.Ray(MathTool.VecZero, this._forward);
  3521. this.outHit = new Laya.HitResult();
  3522. }
  3523. this.ray.origin = origP;
  3524. if (this.over) {
  3525. this.tran.getForward(this.forward);
  3526. this.forward.x = -this.forward.x;
  3527. this.forward.y = -this.forward.y;
  3528. this.forward.z = -this.forward.z;
  3529. this.ray.direction = this.forward;
  3530. }
  3531. else {
  3532. this.ray.direction = this._forward;
  3533. }
  3534. let isHItF = this._scene.physicsSimulation.rayCast(this.ray, this.outHit, GlobalParam.bulletRayLength);
  3535. if (isHItF) {
  3536. let obj = this.outHit.collider.owner;
  3537. if (obj.layer == ColliderGroup.mound) {
  3538. let tower = obj.getComponent(Mound);
  3539. if (tower) {
  3540. tower.Injured(this.outHit.point);
  3541. }
  3542. }
  3543. else if (obj.layer == ColliderGroup.opponent) {
  3544. let tower = obj.getComponent(Opponent);
  3545. if (tower) {
  3546. tower.Injured(this.outHit.point);
  3547. }
  3548. }
  3549. else if (obj.layer == ColliderGroup.obstacle1 || obj.layer == ColliderGroup.obstacle2 || obj.layer == ColliderGroup.obstacle3) {
  3550. StreetManager.Instance.StreetAtkedCube(obj);
  3551. GameManager.Instance.blockCount++;
  3552. }
  3553. else {
  3554. ParticleManager.Instance.AttackEffect(this.outHit.point);
  3555. }
  3556. this.RecoverBullet();
  3557. return;
  3558. }
  3559. }
  3560. Start(tarTran, isover = false) {
  3561. this.tarTran = tarTran;
  3562. this.over = isover;
  3563. Laya.timer.frameLoop(1, this, this.Run);
  3564. }
  3565. }
  3566. var Vector3$2 = Laya.Vector3;
  3567. var Quaternion$1 = Laya.Quaternion;
  3568. var Sprite$7 = Laya.Sprite;
  3569. var Text$2 = Laya.Text;
  3570. class Mate extends Laya.Script3D {
  3571. constructor() {
  3572. super(...arguments);
  3573. this._up = new Vector3$2(0, 1, 0);
  3574. this.isreturn = false;
  3575. this.isover = false;
  3576. this.isClickCom = true;
  3577. this.isStop = true;
  3578. this.texture1 = "res/apes/monkey2.png";
  3579. this.texture2 = "res/apes/monkey3.png";
  3580. this.flag = false;
  3581. this.isFristShoot = true;
  3582. this.ts = new Vector3$2(0, 0, 0.01);
  3583. }
  3584. onAwake() {
  3585. this.selfobj = this.owner;
  3586. this.tran = this.selfobj.transform;
  3587. this.animator = this.selfobj.getChildAt(0).getComponent(Laya.Animator);
  3588. this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
  3589. this.bulletPos = this.selfobj.getChildByName("bulletPos").transform;
  3590. this.forW = MathTool.VecZero;
  3591. this.speed = GlobalParam.matespeed;
  3592. this.quaternion1 = new Quaternion$1();
  3593. }
  3594. setup() {
  3595. var textBox = new Sprite$7();
  3596. var text;
  3597. for (var i = 0; i < 1000; i++) {
  3598. text = new Text$2();
  3599. text.fontSize = 20;
  3600. text.text = (Math.random() * 100).toFixed(0);
  3601. text.rotation = Math.random() * 360;
  3602. text.color = "#CCCCCC";
  3603. text.x = Math.random() * Laya.stage.width;
  3604. text.y = Math.random() * Laya.stage.height;
  3605. textBox.addChild(text);
  3606. }
  3607. textBox.cacheAs = "bitmap";
  3608. Laya.stage.addChild(textBox);
  3609. }
  3610. TrialAdd(dataPar) {
  3611. this.AnimatorPlayByType(MusicType.Idle, 1);
  3612. this.dataPar = dataPar;
  3613. this.dataPar["ishave"] = true;
  3614. this.isClickCom = true;
  3615. this.isStop = true;
  3616. this.isreturn = true;
  3617. this.isover = false;
  3618. MateManager.Instance.AddModelToDic(this.selfobj.id, this);
  3619. this.ShootFunc();
  3620. if (MainRoleManager.Instance.IsShoot())
  3621. this.CreateShoot();
  3622. Laya.timer.frameLoop(1, this, this.Move);
  3623. }
  3624. SetTar() {
  3625. this.isreturn = false;
  3626. this.isClickCom = true;
  3627. this.isStop = true;
  3628. this.isover = false;
  3629. this.AnimatorPlayByType(MusicType.Idle, 1);
  3630. DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate);
  3631. }
  3632. FallDown() {
  3633. let tween = Laya.Tween.to(this.tran, { localPositionY: 0 }, 400, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
  3634. let dataPar = MainRoleManager.Instance.GetMatePos();
  3635. if (!dataPar) {
  3636. console.warn("friendPar没有位置了");
  3637. return;
  3638. }
  3639. this.dataPar = dataPar;
  3640. this.dataPar["ishave"] = true;
  3641. this.tar = this.dataPar["sp"];
  3642. this.tarTra = this.tar.transform;
  3643. tween.clear();
  3644. this.Start();
  3645. }, null, false));
  3646. }
  3647. Start() {
  3648. this.AnimatorPlayByType(MusicType.RunAndGun, 2);
  3649. this.isreturn = false;
  3650. this.isClickCom = true;
  3651. this.isStop = true;
  3652. this.isover = false;
  3653. Laya.timer.frameLoop(1, this, this.Move);
  3654. }
  3655. ArriveTarPos() {
  3656. this.isClickCom = true;
  3657. this.isStop = true;
  3658. this.isreturn = true;
  3659. this.tar.addChild(this.selfobj);
  3660. this.tran.localPosition = MathTool.VecZero;
  3661. this.AnimatorPlayByType(MusicType.RunAndGun, 2);
  3662. MateManager.Instance.AddModelToDic(this.selfobj.id, this);
  3663. let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
  3664. tween.clear();
  3665. this.tran.localRotationEuler = MathTool.VecZero;
  3666. this.ShootFunc();
  3667. this.CreateShoot();
  3668. }, null, false));
  3669. }
  3670. RayReset() {
  3671. let origP = this.rayPoint.position;
  3672. if (!this._scene) {
  3673. this._scene = Scene3DManager.Instance.MainScene;
  3674. }
  3675. if (!this.rayF) {
  3676. this.rayF = new Laya.Ray(MathTool.VecZero, new Vector3$2(0, 0, 1));
  3677. this.outHitF = new Laya.HitResult();
  3678. }
  3679. this.rayF.origin = origP;
  3680. let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalParam.playerRayLengthF);
  3681. if (isHItF) {
  3682. let obj = this.outHitF.collider.owner;
  3683. this.Dead(this.outHitF.point);
  3684. return;
  3685. }
  3686. if (!this.rayL) {
  3687. this.rayL = new Laya.Ray(MathTool.VecZero, new Vector3$2(1, 0, 0));
  3688. this.outHitL = new Laya.HitResult();
  3689. }
  3690. this.rayL.origin = origP;
  3691. let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalParam.playerRayLengthLR);
  3692. if (isHItL) {
  3693. let obj = this.outHitL.collider.owner;
  3694. this.Dead(this.outHitL.point);
  3695. return;
  3696. }
  3697. if (!this.rayR) {
  3698. this.rayR = new Laya.Ray(MathTool.VecZero, new Vector3$2(-1, 0, 0));
  3699. this.outHitR = new Laya.HitResult();
  3700. }
  3701. this.rayR.origin = origP;
  3702. let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalParam.playerRayLengthLR);
  3703. if (isHItR) {
  3704. let obj = this.outHitR.collider.owner;
  3705. this.Dead(this.outHitR.point);
  3706. return;
  3707. }
  3708. }
  3709. createApes() {
  3710. this.ape1 = new Sprite$7();
  3711. this.ape2 = new Sprite$7();
  3712. this.ape1.loadImage("res/apes/monkey2.png");
  3713. this.ape2.loadImage("res/apes/monkey2.png");
  3714. this.ape1.pivot(55, 72);
  3715. this.ape2.pivot(55, 72);
  3716. this.ape1.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  3717. this.ape2.pos(200, 0);
  3718. Laya.stage.addChild(this.ape1);
  3719. this.ape1.addChild(this.ape2);
  3720. Laya.timer.frameLoop(1, this, this.animate);
  3721. }
  3722. animate(e) {
  3723. this.ape1.rotation += 2;
  3724. this.ape2.rotation -= 4;
  3725. }
  3726. Move() {
  3727. if (this.isreturn) {
  3728. this.RayReset();
  3729. return;
  3730. }
  3731. let tarPos = this.tarTra.position.clone();
  3732. Vector3$2.subtract(tarPos, this.tran.position, this.forW);
  3733. Vector3$2.normalize(this.forW, this.forW);
  3734. this.forW = new Vector3$2(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
  3735. this.tran.translate(this.forW, false);
  3736. if (Vector3$2.distance(this.tran.position, tarPos) < 0.1) {
  3737. this.ArriveTarPos();
  3738. return;
  3739. }
  3740. Quaternion$1.lookAt(tarPos, this.tran.position, this._up, this.quaternion1);
  3741. this.quaternion1.invert(this.quaternion1);
  3742. Quaternion$1.slerp(this.tran.rotation, this.quaternion1, 0.1, this.quaternion1);
  3743. this.tran.rotation = this.quaternion1.clone();
  3744. }
  3745. AnimatorPlayByType(clip, speed, callback) {
  3746. this.animator.play(clip);
  3747. if (!speed)
  3748. speed = 1;
  3749. this.animator.speed = speed;
  3750. }
  3751. ShootFunc() {
  3752. DispatcherManager.on(EventType.Event.StopShot, this, this.StopCreate);
  3753. }
  3754. LoopCreate() {
  3755. if (this.isStop) {
  3756. Laya.timer.clear(this, this.LoopCreate);
  3757. this.isClickCom = true;
  3758. return;
  3759. }
  3760. this._CreateShoot();
  3761. }
  3762. CreateShoot() {
  3763. this.isStop = false;
  3764. if (!this.isClickCom)
  3765. return;
  3766. this.isClickCom = false;
  3767. this._CreateShoot();
  3768. Laya.timer.loop(PlayerManager.bulletTime * 2 * 1000, this, this.LoopCreate);
  3769. }
  3770. _CreateShoot() {
  3771. let bu = GamePool.Instance.GetModel(GamePool.modeltype.PlayerShoot);
  3772. if (bu) {
  3773. Scene3DManager.Instance.bulletCon.addChild(bu);
  3774. bu.transform.position = this.bulletPos.position.clone();
  3775. bu.transform.localRotationEuler = this.bulletPos.rotationEuler.clone();
  3776. let pb = bu.getComponent(MainRoleShot);
  3777. if (!pb)
  3778. pb = bu.addComponent(MainRoleShot);
  3779. pb.Start(this.bulletPos, this.isover);
  3780. }
  3781. }
  3782. StopCreate() {
  3783. this.isStop = true;
  3784. }
  3785. Dead(pos) {
  3786. if (this.dataPar)
  3787. this.dataPar["ishave"] = false;
  3788. ParticleManager.Instance.BloodEffect(pos);
  3789. MateManager.Instance.RemoveModelToDic(this.selfobj);
  3790. this.Recover();
  3791. MainRoleManager.Instance.CheckGameOver();
  3792. }
  3793. SetPar() {
  3794. let t = this.tran.position.clone();
  3795. MainRoleManager.Instance.playerContainer.addChild(this.selfobj);
  3796. this.tran.position = t.clone();
  3797. }
  3798. TiaoWu(sp) {
  3799. this.AnimatorPlayByType(MusicType.RunAndGun, 2);
  3800. this.danceP = sp.position.clone();
  3801. this.r = sp.rotationEuler.clone();
  3802. Laya.timer.frameLoop(1, this, this._TiaoWu);
  3803. }
  3804. _TiaoWu() {
  3805. Vector3$2.subtract(this.danceP, this.tran.position, this.forW);
  3806. Vector3$2.normalize(this.forW, this.forW);
  3807. this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  3808. this.tran.translate(this.forW);
  3809. if (Vector3$2.distance(this.tran.position, this.danceP) < 0.15) {
  3810. Laya.timer.clear(this, this._TiaoWu);
  3811. this.tran.position = this.danceP.clone();
  3812. this.tran.rotationEuler = this.r.clone();
  3813. this.AnimatorPlayByType(MusicType.Dance, 1);
  3814. return;
  3815. }
  3816. Quaternion$1.lookAt(this.danceP, this.tran.position, this._up, this.quaternion1);
  3817. this.quaternion1.invert(this.quaternion1);
  3818. this.tran.rotation = this.quaternion1.clone();
  3819. }
  3820. onAssetsLoaded() {
  3821. this.ape = new Sprite$7();
  3822. Laya.stage.addChild(this.ape);
  3823. this.ape.pivot(55, 72);
  3824. this.ape.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  3825. }
  3826. Attack() {
  3827. Laya.timer.clear(this, this._Defense);
  3828. this.isover = true;
  3829. this.isFristShoot = true;
  3830. this.enemyTar = null;
  3831. Laya.timer.frameLoop(1, this, this._attack);
  3832. }
  3833. _attack() {
  3834. if (this.enemyTar == null) {
  3835. this.enemyTar = RoleManager.Instance.GetOpponent();
  3836. if (this.enemyTar != null) {
  3837. this.ATKp = this.enemyTar.transform.position.clone();
  3838. Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
  3839. this.quaternion1.invert(this.quaternion1);
  3840. this.tran.rotation = this.quaternion1.clone();
  3841. }
  3842. }
  3843. else {
  3844. if (!this.enemyTar.active) {
  3845. this.enemyTar = RoleManager.Instance.GetOpponent();
  3846. if (this.enemyTar != null) {
  3847. this.ATKp = this.enemyTar.transform.position.clone();
  3848. Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
  3849. this.quaternion1.invert(this.quaternion1);
  3850. this.tran.rotation = this.quaternion1.clone();
  3851. }
  3852. }
  3853. if (this.enemyTar == null) {
  3854. this.StopCreate();
  3855. this.isFristShoot = true;
  3856. return;
  3857. }
  3858. if (this.isFristShoot) {
  3859. this.isFristShoot = false;
  3860. this.CreateShoot();
  3861. }
  3862. this.ATKp = this.enemyTar.transform.position.clone();
  3863. Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
  3864. this.quaternion1.invert(this.quaternion1);
  3865. this.tran.rotation = this.quaternion1.clone();
  3866. }
  3867. }
  3868. _Defense() {
  3869. Vector3$2.subtract(this.tp, this.tran.position, this.forW);
  3870. Vector3$2.normalize(this.forW, this.forW);
  3871. this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  3872. this.tran.translate(this.forW, false);
  3873. if (Vector3$2.distance(this.tran.position, this.tp) < 0.1) {
  3874. Laya.timer.clear(this, this._Defense);
  3875. let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
  3876. tween.clear();
  3877. }, null, false));
  3878. return;
  3879. }
  3880. Quaternion$1.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
  3881. this.quaternion1.invert(this.quaternion1);
  3882. this.tran.rotation = this.quaternion1.clone();
  3883. }
  3884. Defense(pos) {
  3885. this.SetPar();
  3886. this.tp = pos;
  3887. Quaternion$1.lookAt(pos, this.tran.position, this._up, this.quaternion1);
  3888. this.quaternion1.invert(this.quaternion1);
  3889. this.tran.rotation = this.quaternion1.clone();
  3890. this.AnimatorPlayByType(MusicType.CrouchFiring, 1);
  3891. Laya.timer.frameLoop(1, this, this._Defense);
  3892. }
  3893. Recover() {
  3894. if (this.dataPar) {
  3895. this.dataPar["ishave"] = false;
  3896. this.dataPar = null;
  3897. }
  3898. MateManager.Instance.RecoverMateModel(this.selfobj);
  3899. MateManager.Instance.RemoveModelToDic(this.selfobj);
  3900. Laya.timer.clearAll(this);
  3901. Laya.Tween.clearAll(this);
  3902. DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate);
  3903. GamePool.Instance.RecoverModel(this.selfobj);
  3904. }
  3905. }
  3906. var Rectangle$1 = Laya.Rectangle;
  3907. class MateManager {
  3908. constructor() {
  3909. this.ApePath = "res/apes/monkey2.png";
  3910. this.v3 = MathTool.VecZero;
  3911. this.friendDic = new Dictionary();
  3912. this.getDic = new Dictionary();
  3913. }
  3914. static get Instance() {
  3915. return this.instance || (this.instance = new MateManager());
  3916. }
  3917. Trial() {
  3918. for (let index = 0; index < 3; index++) {
  3919. Laya.timer.frameOnce(index, this, this._createtrialmodel, null, false);
  3920. }
  3921. }
  3922. TrialModelPlayAni() {
  3923. for (const key in this.friendDic.container) {
  3924. const element = this.friendDic.get(key);
  3925. element.CreateShoot();
  3926. element.AnimatorPlayByType(MusicType.RunAndGun, 2);
  3927. }
  3928. }
  3929. RecoverMateModel(sp) {
  3930. this.friendDic.delete(sp.id);
  3931. }
  3932. AddModelToDic(id, fr) {
  3933. this.getDic.set(id, fr);
  3934. }
  3935. RemoveModelToDic(sp) {
  3936. this.getDic.delete(sp.id);
  3937. }
  3938. MadeMate(tra) {
  3939. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
  3940. if (p) {
  3941. p.transform.position = tra.position.clone();
  3942. p.transform.rotationEuler = tra.rotationEuler.clone();
  3943. MainRoleManager.Instance.playerContainer.addChild(p);
  3944. let ps = p.getComponent(Mate);
  3945. if (!ps)
  3946. ps = p.addComponent(Mate);
  3947. ps.SetTar();
  3948. this.friendDic.set(p.id, ps);
  3949. return ps;
  3950. }
  3951. return null;
  3952. }
  3953. showDragRegion() {
  3954. var dragWidthLimit = 350;
  3955. var dragHeightLimit = 200;
  3956. this.dragRegion = new Rectangle$1(Laya.stage.width - dragWidthLimit >> 1, Laya.stage.height - dragHeightLimit >> 1, dragWidthLimit, dragHeightLimit);
  3957. Laya.stage.graphics.drawRect(this.dragRegion.x, this.dragRegion.y, this.dragRegion.width, this.dragRegion.height, null, "#FFFFFF", 2);
  3958. }
  3959. onStartDrag(e) {
  3960. this.ape.startDrag(this.dragRegion, true, 100);
  3961. }
  3962. NearDestination() {
  3963. return this.getDic.size;
  3964. }
  3965. Near(count, zs) {
  3966. if (count == 1) {
  3967. for (const key in this.getDic.container) {
  3968. const element = this.getDic.get(key);
  3969. this.v3.x = 0;
  3970. element.Defense(this.v3.clone());
  3971. }
  3972. return;
  3973. }
  3974. let len = 2 * GlobalParam.arriveStandWidth;
  3975. let avr = len / (count - 1);
  3976. let index = 0;
  3977. this.v3.z = zs;
  3978. for (const key in this.getDic.container) {
  3979. const element = this.getDic.get(key);
  3980. this.v3.x = GlobalParam.arriveStandWidth - index * avr;
  3981. element.Defense(this.v3.clone());
  3982. index++;
  3983. }
  3984. }
  3985. Attack() {
  3986. for (const key in this.getDic.container) {
  3987. const element = this.getDic.get(key);
  3988. element.Attack();
  3989. }
  3990. }
  3991. GetSprite() {
  3992. let count = this.getDic.size;
  3993. let a = GameTool.randomInt(1, count);
  3994. let tindex = 1;
  3995. for (const key in this.getDic.container) {
  3996. if (tindex == a) {
  3997. const element = this.getDic.get(key);
  3998. return element.selfobj;
  3999. }
  4000. tindex++;
  4001. }
  4002. return null;
  4003. }
  4004. TiaoWu() {
  4005. for (const key in this.getDic.container) {
  4006. let t = PlaneManager.Instance.GetWuDaoPosition();
  4007. if (!t)
  4008. return;
  4009. const element = this.getDic.get(key);
  4010. element.TiaoWu(t);
  4011. }
  4012. }
  4013. Reset() {
  4014. let arr = [];
  4015. for (const key in this.friendDic.container) {
  4016. arr.push(key);
  4017. }
  4018. if (arr.length > 0) {
  4019. for (let index = 0; index < arr.length; index++) {
  4020. const element = arr[index];
  4021. let s = this.friendDic.get(element);
  4022. if (s)
  4023. s.Recover();
  4024. }
  4025. }
  4026. console.log("this.friendDic.size", this.friendDic.size);
  4027. this.getDic.clear();
  4028. }
  4029. TiaoWu1() {
  4030. for (const key in this.getDic.container) {
  4031. let t = PlaneManager.Instance.GetWuDaoPosition();
  4032. const element = this.getDic.get(key);
  4033. element.SetPar();
  4034. if (t) {
  4035. element.TiaoWu(t);
  4036. }
  4037. }
  4038. }
  4039. _createtrialmodel() {
  4040. let dataPar = MainRoleManager.Instance.GetMatePos();
  4041. if (!dataPar) {
  4042. console.warn("friendPar没有位置了");
  4043. return;
  4044. }
  4045. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
  4046. if (p) {
  4047. let tar = dataPar["sp"];
  4048. tar.addChild(p);
  4049. p.transform.localPosition = MathTool.VecZero;
  4050. p.transform.localRotationEuler = MathTool.VecZero;
  4051. let ps = p.getComponent(Mate);
  4052. if (!ps)
  4053. ps = p.addComponent(Mate);
  4054. ps.TrialAdd(dataPar);
  4055. this.friendDic.set(p.id, ps);
  4056. }
  4057. }
  4058. }
  4059. var Sprite$8 = Laya.Sprite;
  4060. var Text$3 = Laya.Text;
  4061. class PlaneManager {
  4062. constructor() {
  4063. this.airisshow = false;
  4064. this.danceindex = 0;
  4065. }
  4066. static get Instance() {
  4067. return this.instance || (this.instance = new PlaneManager());
  4068. }
  4069. Init(finalP) {
  4070. if (!finalP) {
  4071. console.error("飞机不存在");
  4072. return;
  4073. }
  4074. this.finalTra = finalP.transform;
  4075. this.jumpCamTra = finalP.getChildByName("jumpCamPos").transform;
  4076. this.FinalBlock = finalP.getChildAt(0);
  4077. this.EnemySpawnPoint = this.FinalBlock.getChildByName("EnemySpawnPoint").transform;
  4078. this.PlayerDancePoint = this.FinalBlock.getChildByName("PlayerDancePoint");
  4079. this.helicopter = this.FinalBlock.getChildByName("helicopter");
  4080. this.toured = this.FinalBlock.getChildByName("toured").transform;
  4081. this.FinalBlock.active = false;
  4082. }
  4083. SetAir() {
  4084. this.danceindex = 0;
  4085. this.airisshow = false;
  4086. this.FinalBlock.active = false;
  4087. let count = LevelController.Instance._level.road_list.length;
  4088. this.winPos = (count) * GlobalParam.barrierRoadLength;
  4089. this.finalTra.localPositionZ = this.winPos;
  4090. this.stageProLen = this.winPos - MainRoleManager.Instance.playerStartTra.localPositionZ;
  4091. let isgold = LevelController.Instance._level.isgold;
  4092. this.helicopter.active = isgold;
  4093. this.toured1 = this.FinalBlock.getChildByName("toured1").transform.position.clone();
  4094. this.toured2 = this.FinalBlock.getChildByName("toured2").transform.position.clone();
  4095. }
  4096. createDarkOrchidRect() {
  4097. var darkOrchidRect = new Sprite$8();
  4098. darkOrchidRect.name = "暗紫色矩形容器";
  4099. darkOrchidRect.graphics.drawRect(-100, -100, 200, 200, "#9932CC");
  4100. darkOrchidRect.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  4101. Laya.stage.addChild(darkOrchidRect);
  4102. darkOrchidRect.mouseThrough = true;
  4103. }
  4104. createLogger() {
  4105. this.logger = new Text$3();
  4106. this.logger.size(Laya.stage.width, Laya.stage.height);
  4107. this.logger.align = 'right';
  4108. this.logger.fontSize = 20;
  4109. this.logger.color = "#FFFFFF";
  4110. Laya.stage.addChild(this.logger);
  4111. }
  4112. CheckPlayerRoadPos(_zp) {
  4113. let d = this.winPos - _zp;
  4114. if (d <= 60 && !this.airisshow) {
  4115. this.ShowAir();
  4116. return;
  4117. }
  4118. DispatcherManager.event(EventType.Event.SetStagePro, (this.stageProLen - d) / this.stageProLen);
  4119. if (d <= 0) {
  4120. this.NearDestination();
  4121. }
  4122. }
  4123. ShowAir() {
  4124. this.airisshow = true;
  4125. this.FinalBlock.active = true;
  4126. }
  4127. NearDestination() {
  4128. MainRoleManager.Instance.Destination();
  4129. if (LevelController.Instance._level.isgold) {
  4130. GameManager.Instance.Congratulate(true);
  4131. }
  4132. else {
  4133. let count = 0;
  4134. let isdesd = MainRoleManager.Instance.NearIsdead();
  4135. if (!isdesd) {
  4136. count++;
  4137. }
  4138. let num = MateManager.Instance.NearDestination();
  4139. count += num;
  4140. if (count == 0)
  4141. return;
  4142. MateManager.Instance.Near(count, this.toured.position.z);
  4143. if (!isdesd)
  4144. MainRoleManager.Instance.Near(count, this.toured.position.z);
  4145. Laya.timer.once(1300, this, this.CreateOpponent);
  4146. }
  4147. }
  4148. CreateOpponent() {
  4149. MainRoleManager.Instance.Attack();
  4150. MateManager.Instance.Attack();
  4151. RoleManager.Instance.CreateOpponent(this.EnemySpawnPoint.position.clone());
  4152. }
  4153. GetWuDaoPosition() {
  4154. if (this.danceindex > this.PlayerDancePoint.numChildren - 1)
  4155. return null;
  4156. let t = this.PlayerDancePoint.getChildAt(this.danceindex).transform;
  4157. this.danceindex++;
  4158. return t;
  4159. }
  4160. }
  4161. var Vector3$3 = Laya.Vector3;
  4162. var Quaternion$2 = Laya.Quaternion;
  4163. var Sprite$9 = Laya.Sprite;
  4164. class MainRole extends Laya.Script3D {
  4165. constructor() {
  4166. super(...arguments);
  4167. this.isarrive = false;
  4168. this.isdead = false;
  4169. this.isFristShoot = true;
  4170. this._up = new Vector3$3(0, 1, 0);
  4171. this.ts = new Vector3$3(0, 0, 0.01);
  4172. }
  4173. onAwake() {
  4174. this.selfobj = this.owner;
  4175. this._transform = this.selfobj.transform;
  4176. this.body = this.selfobj.getChildAt(0);
  4177. this.animator = this.body.getComponent(Laya.Animator);
  4178. this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
  4179. this.shootPos = this.selfobj.getChildByName("bulletPos").transform;
  4180. this._speed = MathTool.VecZero;
  4181. this._speed.z = GlobalParam.playerspeed;
  4182. this.forW = MathTool.VecZero;
  4183. this.quaternion1 = new Quaternion$2();
  4184. }
  4185. Move() {
  4186. if (this.isarrive) {
  4187. if (this.isdead)
  4188. return;
  4189. this.RayReset();
  4190. return;
  4191. }
  4192. this._transform.translate(this._speed);
  4193. let pz = this._transform.localPositionZ;
  4194. ConstructManager.Instance.CheckMainRolePos(pz);
  4195. PlaneManager.Instance.CheckPlayerRoadPos(pz);
  4196. StreetManager.Instance.CheckPlayerRoadPos(pz);
  4197. CameraManager.Instance.CameraFollow(pz);
  4198. if (this.isdead)
  4199. return;
  4200. this.RayReset();
  4201. }
  4202. Near() {
  4203. this.isarrive = true;
  4204. }
  4205. Start() {
  4206. this.isdead = false;
  4207. this.isarrive = false;
  4208. Laya.timer.frameLoop(1, this, this.Move);
  4209. }
  4210. drawPentagram() {
  4211. var canvas = new Sprite$9();
  4212. Laya.stage.addChild(canvas);
  4213. var path = [];
  4214. path.push(0, -130);
  4215. path.push(33, -33);
  4216. path.push(137, -30);
  4217. path.push(55, 32);
  4218. path.push(85, 130);
  4219. path.push(0, 73);
  4220. path.push(-85, 130);
  4221. path.push(-55, 32);
  4222. path.push(-137, -30);
  4223. path.push(-33, -33);
  4224. canvas.graphics.drawPoly(Laya.stage.width / 2, Laya.stage.height / 2, path, "#FF7F50");
  4225. }
  4226. PlayAni(clip, speed, callback) {
  4227. this.animator.play(clip);
  4228. if (!speed)
  4229. speed = 1;
  4230. this.animator.speed = speed;
  4231. }
  4232. Slider(x) {
  4233. this._transform.localPositionX += x;
  4234. let px = this._transform.localPositionX;
  4235. let abs = Math.abs(px);
  4236. if (abs > GlobalParam.playerMoveMaxX) {
  4237. if (px > 0)
  4238. this._transform.localPositionX = GlobalParam.playerMoveMaxX;
  4239. else
  4240. this._transform.localPositionX = -GlobalParam.playerMoveMaxX;
  4241. }
  4242. }
  4243. CreateBullet() {
  4244. if (this.isdead)
  4245. return null;
  4246. return this.shootPos;
  4247. }
  4248. Dead(pos) {
  4249. this.isdead = true;
  4250. this.body.active = false;
  4251. ParticleManager.Instance.BloodEffect(pos);
  4252. MainRoleManager.Instance.CheckGameOver(true);
  4253. }
  4254. Reset() {
  4255. this.body.active = true;
  4256. this.PlayAni(MusicType.Idle, 1);
  4257. Laya.timer.clearAll(this);
  4258. }
  4259. RayReset() {
  4260. let origP = this.rayPoint.position;
  4261. if (!this._scene) {
  4262. this._scene = Scene3DManager.Instance.MainScene;
  4263. }
  4264. if (!this.rayF) {
  4265. this.rayF = new Laya.Ray(MathTool.VecZero, new Vector3$3(0, 0, 1));
  4266. this.outHitF = new Laya.HitResult();
  4267. }
  4268. this.rayF.origin = origP;
  4269. let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalParam.playerRayLengthF);
  4270. if (isHItF) {
  4271. let obj = this.outHitF.collider.owner;
  4272. this.Dead(this.outHitF.point);
  4273. return;
  4274. }
  4275. if (!this.rayL) {
  4276. this.rayL = new Laya.Ray(MathTool.VecZero, new Vector3$3(1, 0, 0));
  4277. this.outHitL = new Laya.HitResult();
  4278. }
  4279. this.rayL.origin = origP;
  4280. let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalParam.playerRayLengthLR);
  4281. if (isHItL) {
  4282. let obj = this.outHitL.collider.owner;
  4283. this.Dead(this.outHitL.point);
  4284. return;
  4285. }
  4286. if (!this.rayR) {
  4287. this.rayR = new Laya.Ray(MathTool.VecZero, new Vector3$3(-1, 0, 0));
  4288. this.outHitR = new Laya.HitResult();
  4289. }
  4290. this.rayR.origin = origP;
  4291. let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalParam.playerRayLengthLR);
  4292. if (isHItR) {
  4293. let obj = this.outHitR.collider.owner;
  4294. this.Dead(this.outHitR.point);
  4295. return;
  4296. }
  4297. }
  4298. setup() {
  4299. var bg = new Sprite$9();
  4300. bg.loadImage("res/bg2.png");
  4301. Laya.stage.addChild(bg);
  4302. this.bg2 = new Sprite$9();
  4303. this.bg2.loadImage("res/bg2.png");
  4304. Laya.stage.addChild(this.bg2);
  4305. this.bg2.scale(3, 3);
  4306. this.maskSp = new Sprite$9();
  4307. this.maskSp.loadImage("res/mask.png");
  4308. this.maskSp.pivot(50, 50);
  4309. this.bg2.mask = this.maskSp;
  4310. }
  4311. _attack() {
  4312. if (this.isdead)
  4313. return;
  4314. if (this.enemyTar == null) {
  4315. this.enemyTar = RoleManager.Instance.GetOpponent();
  4316. if (this.enemyTar != null) {
  4317. this.tp = this.enemyTar.transform.position.clone();
  4318. Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
  4319. this.quaternion1.invert(this.quaternion1);
  4320. this._transform.rotation = this.quaternion1.clone();
  4321. }
  4322. }
  4323. else {
  4324. if (!this.enemyTar.active) {
  4325. this.enemyTar = RoleManager.Instance.GetOpponent();
  4326. if (this.enemyTar != null) {
  4327. this.tp = this.enemyTar.transform.position.clone();
  4328. Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
  4329. this.quaternion1.invert(this.quaternion1);
  4330. this._transform.rotation = this.quaternion1.clone();
  4331. }
  4332. }
  4333. if (this.enemyTar == null) {
  4334. MainRoleManager.Instance.CreateOver(true);
  4335. this.isFristShoot = true;
  4336. return;
  4337. }
  4338. if (this.isFristShoot) {
  4339. this.isFristShoot = false;
  4340. MainRoleManager.Instance.CreateShoot(true);
  4341. }
  4342. this.tp = this.enemyTar.transform.position.clone();
  4343. Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
  4344. this.quaternion1.invert(this.quaternion1);
  4345. this._transform.rotation = this.quaternion1.clone();
  4346. }
  4347. }
  4348. TiaoWu(sp) {
  4349. this.PlayAni(MusicType.RunAndGun, 2);
  4350. this.dancepos = sp.position.clone();
  4351. this.r = sp.rotationEuler.clone();
  4352. Laya.timer.frameLoop(1, this, this.PlayWuDao);
  4353. }
  4354. PlayWuDao() {
  4355. Vector3$3.subtract(this.dancepos, this._transform.position, this.forW);
  4356. Vector3$3.normalize(this.forW, this.forW);
  4357. this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  4358. this._transform.translate(this.forW);
  4359. if (Vector3$3.distance(this._transform.position, this.dancepos) < 0.15) {
  4360. Laya.timer.clear(this, this.PlayWuDao);
  4361. this._transform.position = this.dancepos.clone();
  4362. this._transform.rotationEuler = this.r.clone();
  4363. this.PlayAni(MusicType.Dance, 1);
  4364. return;
  4365. }
  4366. Quaternion$2.lookAt(this.dancepos, this._transform.position, this._up, this.quaternion1);
  4367. this.quaternion1.invert(this.quaternion1);
  4368. this._transform.rotation = this.quaternion1.clone();
  4369. }
  4370. Defense(pos) {
  4371. if (this.isdead)
  4372. return;
  4373. this.tp = pos;
  4374. Quaternion$2.lookAt(pos, this._transform.position, this._up, this.quaternion1);
  4375. this.quaternion1.invert(this.quaternion1);
  4376. this._transform.rotation = this.quaternion1.clone();
  4377. this.PlayAni(MusicType.CrouchFiring, 1);
  4378. Laya.timer.frameLoop(1, this, this._Defense);
  4379. }
  4380. _Defense() {
  4381. Vector3$3.subtract(this.tp, this._transform.position, this.forW);
  4382. Vector3$3.normalize(this.forW, this.forW);
  4383. this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  4384. this._transform.translate(this.forW);
  4385. if (Vector3$3.distance(this._transform.position, this.tp) < 0.1) {
  4386. Laya.timer.clear(this, this._Defense);
  4387. return;
  4388. }
  4389. Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
  4390. this.quaternion1.invert(this.quaternion1);
  4391. this._transform.rotation = this.quaternion1.clone();
  4392. }
  4393. Attack() {
  4394. Laya.timer.clear(this, this._Defense);
  4395. this.isFristShoot = true;
  4396. this.enemyTar = null;
  4397. Laya.timer.frameLoop(1, this, this._attack);
  4398. }
  4399. }
  4400. var Vector3$4 = Laya.Vector3;
  4401. var Text$4 = Laya.Text;
  4402. var HScrollBar = Laya.HScrollBar;
  4403. var VScrollBar = Laya.VScrollBar;
  4404. class MainRoleManager {
  4405. constructor() {
  4406. this.isover = false;
  4407. this.isClickCom = true;
  4408. this.isend = true;
  4409. }
  4410. static get Instance() {
  4411. return this.instance || (this.instance = new MainRoleManager());
  4412. }
  4413. Init(startPos, playerCon) {
  4414. this.playerStartTra = startPos.transform;
  4415. this.playerContainer = playerCon;
  4416. }
  4417. ChangeModel() {
  4418. if (this.player)
  4419. GamePool.Instance.RecoverModel(this.player);
  4420. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
  4421. if (p) {
  4422. this.player = p;
  4423. this.SetMatePos(p);
  4424. this.playerTra = this.player.transform;
  4425. this.playerTra.position = this.playerStartTra.position.clone();
  4426. this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
  4427. this.playerContainer.addChild(this.player);
  4428. let ps = this.player.getComponent(MainRole);
  4429. if (ps)
  4430. this.playerScript = ps;
  4431. else
  4432. this.playerScript = this.player.addComponent(MainRole);
  4433. }
  4434. }
  4435. SetMatePos(player) {
  4436. this.MateArrPosition = [];
  4437. let par = player.getChildByName("FriendSpawPos");
  4438. if (!par)
  4439. console.error("friend父物体不存在");
  4440. for (let index = 0; index < par.numChildren; index++) {
  4441. let data = {};
  4442. data["ishave"] = false;
  4443. data["sp"] = par.getChildAt(index);
  4444. this.MateArrPosition.push(data);
  4445. }
  4446. }
  4447. GetMatePos() {
  4448. for (let index = 0; index < this.MateArrPosition.length; index++) {
  4449. const element = this.MateArrPosition[index];
  4450. if (!element["ishave"])
  4451. return element;
  4452. }
  4453. return null;
  4454. }
  4455. createTexts() {
  4456. var t1 = this.createText();
  4457. t1.overflow = Text$4.VISIBLE;
  4458. t1.pos(10, 10);
  4459. var t2 = this.createText();
  4460. t2.overflow = Text$4.SCROLL;
  4461. t2.pos(10, 110);
  4462. var t3 = this.createText();
  4463. t3.overflow = Text$4.HIDDEN;
  4464. t3.pos(10, 210);
  4465. }
  4466. createText() {
  4467. var txt = new Text$4();
  4468. txt.text =
  4469. "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!\n" +
  4470. "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!\n" +
  4471. "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!";
  4472. txt.borderColor = "#FFFF00";
  4473. txt.size(300, 50);
  4474. txt.fontSize = 20;
  4475. txt.color = "#ffffff";
  4476. Laya.stage.addChild(txt);
  4477. return txt;
  4478. }
  4479. PlayerSlip(offsetX) {
  4480. let x = offsetX.toFixed(2);
  4481. let x1 = Number(x) * GlobalParam.sliderFactor;
  4482. if (this.playerScript)
  4483. this.playerScript.Slider(x1);
  4484. }
  4485. CreateOver(isgameover = false) {
  4486. this.isend = true;
  4487. if (!isgameover)
  4488. DispatcherManager.event(EventType.Event.StopShot);
  4489. }
  4490. IsShoot() {
  4491. return !this.isend;
  4492. }
  4493. Destination() {
  4494. MouseEvent.Instance.OnClickUp();
  4495. MainRoleManager.Instance.CreateOver();
  4496. MouseEvent.Instance._Switch = false;
  4497. GameManager.Instance.Near();
  4498. if (!this.playerScript)
  4499. return;
  4500. this.playerScript.Near();
  4501. }
  4502. NearIsdead() {
  4503. if (!this.playerScript)
  4504. return true;
  4505. return this.playerScript.isdead;
  4506. }
  4507. Near(count, z) {
  4508. if (!this.playerScript)
  4509. return;
  4510. if (count == 1) {
  4511. this.playerScript.Defense(new Vector3$4(0, 0, z));
  4512. }
  4513. else {
  4514. this.playerScript.Defense(new Vector3$4(-GlobalParam.arriveStandWidth, 0, z));
  4515. }
  4516. }
  4517. Attack() {
  4518. if (!this.playerScript)
  4519. return;
  4520. this.isover = true;
  4521. this.playerScript.Attack();
  4522. }
  4523. CreateShoot(isgameover = false) {
  4524. if (!this.playerScript)
  4525. return;
  4526. this.isend = false;
  4527. if (!this.isClickCom)
  4528. return;
  4529. console.log("开始创建子弹");
  4530. this.isClickCom = false;
  4531. this._CreateShoot();
  4532. Laya.timer.loop(PlayerManager.bulletTime * 1000, this, this._Loop);
  4533. }
  4534. _Loop() {
  4535. if (this.isend) {
  4536. Laya.timer.clear(this, this._Loop);
  4537. this.isClickCom = true;
  4538. return;
  4539. }
  4540. this._CreateShoot();
  4541. }
  4542. _CreateShoot() {
  4543. WXSdk.ShortVibrate();
  4544. SettingController.Instance.PlaySound(SoundType.hit);
  4545. let bulletPos = this.playerScript.CreateBullet();
  4546. if (bulletPos == null)
  4547. return;
  4548. let bu = GamePool.Instance.GetModel(GamePool.modeltype.PlayerShoot);
  4549. if (bu) {
  4550. Scene3DManager.Instance.bulletCon.addChild(bu);
  4551. bu.transform.position = bulletPos.position.clone();
  4552. bu.transform.localRotationEuler = bulletPos.rotationEuler.clone();
  4553. let pb = bu.getComponent(MainRoleShot);
  4554. if (!pb)
  4555. pb = bu.addComponent(MainRoleShot);
  4556. pb.Start(bulletPos, this.isover);
  4557. }
  4558. }
  4559. CheckGameOver(isplayer) {
  4560. if (isplayer) {
  4561. let count = MateManager.Instance.NearDestination();
  4562. if (count == 0) {
  4563. this.playerScript.Near();
  4564. GameManager.Instance.Over();
  4565. }
  4566. }
  4567. else {
  4568. let count = MateManager.Instance.NearDestination();
  4569. if (count == 0) {
  4570. let isplayerdead = this.playerScript.isdead;
  4571. if (isplayerdead) {
  4572. this.playerScript.Near();
  4573. GameManager.Instance.Over();
  4574. }
  4575. }
  4576. }
  4577. }
  4578. GoToTiaoWu() {
  4579. if (!this.playerScript)
  4580. return;
  4581. let t = PlaneManager.Instance.GetWuDaoPosition();
  4582. if (!t)
  4583. return;
  4584. this.playerScript.TiaoWu(t);
  4585. }
  4586. Reset() {
  4587. for (let index = 0; index < this.MateArrPosition.length; index++) {
  4588. const element = this.MateArrPosition[index];
  4589. element["ishave"] = false;
  4590. }
  4591. this.isover = false;
  4592. if (!this.playerScript)
  4593. return;
  4594. this.playerScript.Reset();
  4595. }
  4596. HidePlayer() {
  4597. if (this.player)
  4598. this.player.active = false;
  4599. }
  4600. onSkinLoadComplete() {
  4601. this.placeHScroller();
  4602. this.placeVScroller();
  4603. }
  4604. placeHScroller() {
  4605. var hs = new HScrollBar();
  4606. hs.skin = "res/ui/hscroll.png";
  4607. hs.width = 300;
  4608. hs.pos(50, 170);
  4609. hs.min = 0;
  4610. hs.max = 100;
  4611. }
  4612. placeVScroller() {
  4613. var vs = new VScrollBar();
  4614. vs.skin = "res/ui/vscroll.png";
  4615. vs.height = 300;
  4616. vs.pos(400, 50);
  4617. vs.min = 0;
  4618. vs.max = 100;
  4619. Laya.stage.addChild(vs);
  4620. }
  4621. MadePlayer() {
  4622. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
  4623. if (p) {
  4624. this.player = p;
  4625. this.SetMatePos(p);
  4626. this.playerTra = this.player.transform;
  4627. this.playerTra.position = this.playerStartTra.position.clone();
  4628. this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
  4629. this.playerContainer.addChild(this.player);
  4630. let ps = this.player.getComponent(MainRole);
  4631. if (ps)
  4632. this.playerScript = ps;
  4633. else
  4634. this.playerScript = this.player.addComponent(MainRole);
  4635. }
  4636. else {
  4637. console.error("player不存在");
  4638. }
  4639. }
  4640. SetPlayerPosition() {
  4641. this.player.active = true;
  4642. this.playerTra.position = this.playerStartTra.position.clone();
  4643. this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
  4644. this.playerScript.PlayAni(MusicType.Idle, 1);
  4645. }
  4646. SetModelPos(x) {
  4647. if (!this.player) {
  4648. this.MadePlayer();
  4649. this.SetPlayerPosition();
  4650. }
  4651. if (!this._maincamera) {
  4652. this._maincamera = CameraManager.Instance._maincamera;
  4653. this._distance = -Vector3$4.distance(this.playerTra.position, this._maincamera.transform.position);
  4654. this._posy = MatrixTransform.WorldToScreen2(this._maincamera, this.playerTra.position).y;
  4655. }
  4656. let uiP = new Vector3$4(x, this._posy, this._distance);
  4657. let p = MatrixTransform.ScreenToWorld(this._maincamera, uiP);
  4658. this.playerTra.localPositionX = p.x;
  4659. }
  4660. Start() {
  4661. if (this.playerScript) {
  4662. this.playerScript.Start();
  4663. this.playerScript.PlayAni(MusicType.RunAndGun, 2);
  4664. }
  4665. }
  4666. }
  4667. var Vector3$5 = Laya.Vector3;
  4668. var CameraState;
  4669. (function (CameraState) {
  4670. CameraState[CameraState["game"] = 1] = "game";
  4671. CameraState[CameraState["jump"] = 2] = "jump";
  4672. })(CameraState || (CameraState = {}));
  4673. class Camera extends Laya.Script3D {
  4674. constructor() {
  4675. super();
  4676. this.arg = 0.1;
  4677. this.startShake = false;
  4678. this.seconds = 0;
  4679. this.started = false;
  4680. this.quake = 0.3;
  4681. this._position = new Laya.Vector3();
  4682. this._outPos = new Laya.Vector3();
  4683. this.scaleDelta = 0;
  4684. this.scale = new Laya.Vector3(0.1, 0.1, 0.1);
  4685. this.canmovegame = false;
  4686. }
  4687. onAwake() {
  4688. this.selfObj = this.owner;
  4689. this._tran = this.selfObj.transform;
  4690. this.nowP = MathTool.VecZero;
  4691. this.nowR = MathTool.VecZero;
  4692. this.dis = MathTool.VecZero;
  4693. this.temp = MathTool.VecZero;
  4694. }
  4695. Init() {
  4696. let t = CameraManager.Instance.startPosTra;
  4697. this._tran.position = t.position.clone();
  4698. this._tran.localRotationEuler = MathTool.SpToCam(t.localRotationEuler.clone());
  4699. this.dis.x = MainRoleManager.Instance.playerStartTra.position.x - this._tran.position.x;
  4700. this.dis.y = MainRoleManager.Instance.playerStartTra.position.y - this._tran.position.y;
  4701. this.dis.z = MainRoleManager.Instance.playerStartTra.position.z - this._tran.position.z;
  4702. }
  4703. StopMove() {
  4704. Laya.timer.clear(this, this.JumpCameraMove);
  4705. }
  4706. JumpCameraMove() {
  4707. let p, r;
  4708. if (this.arg == 1) {
  4709. p = this._transform.position;
  4710. r = MathTool.SpToCam(this._transform.localRotationEuler.clone());
  4711. }
  4712. else {
  4713. p = MathTool.MixVector3(this._tran.position.clone(), this._transform.position, this.arg, this.nowP);
  4714. r = MathTool.MixVector3(this._tran.localRotationEuler, MathTool.SpToCam(this._transform.localRotationEuler.clone()), this.arg, this.nowR);
  4715. }
  4716. this._tran.position = p;
  4717. this._tran.localRotationEuler = r;
  4718. }
  4719. CameraAction(type, arg) {
  4720. this.arg = arg;
  4721. switch (type) {
  4722. case CameraState.game:
  4723. this._transform = MainRoleManager.Instance.playerTra;
  4724. if (!this._transform)
  4725. return;
  4726. let t = CameraManager.Instance.startPosTra;
  4727. this._tran.position = t.position.clone();
  4728. this._tran.localRotationEuler = MathTool.SpToCam(t.localRotationEuler.clone());
  4729. this.canmovegame = true;
  4730. break;
  4731. case CameraState.jump:
  4732. this._transform = PlaneManager.Instance.jumpCamTra;
  4733. if (!this._transform)
  4734. return;
  4735. this.canmovegame = false;
  4736. Laya.timer.frameLoop(1, this, this.JumpCameraMove);
  4737. Laya.timer.once(3000, this, this.StopMove);
  4738. break;
  4739. }
  4740. }
  4741. onComplete() {
  4742. var grid = this._scene.addChild(Laya.Loader.getRes("res/threeDimen/staticModel/grid/plane.lh"));
  4743. grid.getChildAt(0).meshRenderer.receiveShadow = true;
  4744. grid.getChildAt(0).layer = 5;
  4745. var staticLayaMonkey = new Laya.MeshSprite3D(Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/Assets/LayaMonkey/LayaMonkey-LayaMonkey.lm"));
  4746. this._scene.addChild(staticLayaMonkey);
  4747. staticLayaMonkey.meshRenderer.material = Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/Assets/LayaMonkey/Materials/T_Diffuse.lmat");
  4748. staticLayaMonkey.layer = 1;
  4749. staticLayaMonkey.transform.position = new Laya.Vector3(0, 0, 0.5);
  4750. staticLayaMonkey.transform.localScale = new Laya.Vector3(0.3, 0.3, 0.3);
  4751. staticLayaMonkey.transform.rotation = new Laya.Quaternion(0.7071068, 0, 0, -0.7071067);
  4752. staticLayaMonkey.meshRenderer.castShadow = true;
  4753. var layaMonkey_clone1 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5));
  4754. var layaMonkey_clone2 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5));
  4755. var layaMonkey_clone3 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5));
  4756. layaMonkey_clone1.layer = 2;
  4757. layaMonkey_clone2.layer = 3;
  4758. layaMonkey_clone3.layer = 0;
  4759. layaMonkey_clone1.transform.translate(new Laya.Vector3(1.5, 0, 0.0));
  4760. layaMonkey_clone2.transform.translate(new Laya.Vector3(-1.5, 0, 0.0));
  4761. layaMonkey_clone3.transform.translate(new Laya.Vector3(2.5, 0, 0.0));
  4762. layaMonkey_clone2.transform.rotate(new Laya.Vector3(0, 60, 0), false, false);
  4763. var scale = new Laya.Vector3(0.1, 0.1, 0.1);
  4764. layaMonkey_clone3.transform.localScale = scale;
  4765. }
  4766. onDestroy() {
  4767. Laya.timer.clearAll(this);
  4768. }
  4769. ShakeFor(a, b) {
  4770. this.camPOS = this.selfObj.transform.position.clone();
  4771. this.seconds = a;
  4772. this.started = true;
  4773. this.startShake = true;
  4774. this.quake = b;
  4775. }
  4776. Shake() {
  4777. var x = GameTool.random_1to1() * this.quake;
  4778. var y = GameTool.random_1to1() * this.quake;
  4779. var z = GameTool.random_1to1() * this.quake;
  4780. var temp = new Vector3$5(this.camPOS.x + Math.random() * this.quake, this.camPOS.y + Math.random() * this.quake, this.camPOS.z + Math.random() * this.quake);
  4781. this.selfObj.transform.position = temp;
  4782. }
  4783. onLateUpdate() {
  4784. if (this.startShake) {
  4785. this.Shake();
  4786. }
  4787. if (this.started) {
  4788. this.started = false;
  4789. Laya.timer.once(this.seconds * 1000, this, () => {
  4790. this.startShake = false;
  4791. this.selfObj.transform.position = this.camPOS;
  4792. });
  4793. }
  4794. }
  4795. animate() {
  4796. this._position.x = Math.sin(this.scaleDelta += 0.01);
  4797. this.layaMonkey3D.transform.position = this._position;
  4798. this.layaMonkey3D.transform.scale = this.scale;
  4799. this.camera.viewport.project(this.layaMonkey3D.transform.position, this.camera.projectionViewMatrix, this._outPos);
  4800. this.layaMonkey2D.pos(this._outPos.x / Laya.stage.clientScaleX, this._outPos.y / Laya.stage.clientScaleY);
  4801. }
  4802. MoveGame(z) {
  4803. if (!this.canmovegame)
  4804. return;
  4805. this.temp.z = z - this.dis.z;
  4806. this._tran.localPositionZ = this.temp.z;
  4807. }
  4808. }
  4809. var Sprite$a = Laya.Sprite;
  4810. var BlurFilter = Laya.BlurFilter;
  4811. class Scene3DManager {
  4812. constructor() {
  4813. this.apePath = "res/apes/monkey2.png";
  4814. }
  4815. static get Instance() {
  4816. return Scene3DManager.instance || (Scene3DManager.instance = new Scene3DManager());
  4817. }
  4818. InitGame() {
  4819. Laya.timer.frameOnce(10, this, () => {
  4820. MainRoleManager.Instance.MadePlayer();
  4821. this.InItScene();
  4822. });
  4823. }
  4824. ;
  4825. Init(_s) {
  4826. if (_s) {
  4827. this.MainScene = _s;
  4828. Laya.stage.addChild(_s);
  4829. }
  4830. else {
  4831. console.error("场景不存在");
  4832. return;
  4833. }
  4834. let sceneNode;
  4835. sceneNode = this.MainScene.getChildByName("scene");
  4836. if (!sceneNode) {
  4837. console.error("场景资源配置错误!");
  4838. return;
  4839. }
  4840. this.MainCamera = this.MainScene.getChildByName("Main Camera");
  4841. this.MainCamera.enableHDR = false;
  4842. this.bulletCon = sceneNode.getChildByName("bulletContainer");
  4843. this.effectCon = sceneNode.getChildByName("effectPos");
  4844. this.SetSceneMaterial();
  4845. let build = sceneNode.getChildByName("buildings");
  4846. ConstructManager.Instance.Init(build);
  4847. let playerStartPos = sceneNode.getChildByName("playerstartPoint");
  4848. let playerCon = sceneNode.getChildByName("playerContainer");
  4849. MainRoleManager.Instance.Init(playerStartPos, playerCon);
  4850. let moveBlockContainer = sceneNode.getChildByName("BlockContainer");
  4851. StreetManager.Instance.Init(moveBlockContainer);
  4852. let towerContainer = sceneNode.getChildByName("towerContainer");
  4853. MoundManager.Instance.Init(towerContainer);
  4854. let startCampos1 = sceneNode.getChildByName("startCamPos");
  4855. let startCamposX = sceneNode.getChildByName("startXCamPos");
  4856. let ps;
  4857. if (GameVersion.isX)
  4858. ps = startCamposX;
  4859. else
  4860. ps = startCampos1;
  4861. CameraManager.Instance.Init(this.MainCamera, ps);
  4862. let finalPos = sceneNode.getChildByName("finalPos");
  4863. PlaneManager.Instance.Init(finalPos);
  4864. this.InitGame();
  4865. }
  4866. createApe() {
  4867. var ape = new Sprite$a();
  4868. ape.loadImage(this.apePath);
  4869. ape.x = (Laya.stage.width - ape.width) / 2;
  4870. ape.y = (Laya.stage.height - ape.height) / 2;
  4871. Laya.stage.addChild(ape);
  4872. this.applayFilter(ape);
  4873. }
  4874. applayFilter(ape) {
  4875. var blurFilter = new BlurFilter();
  4876. blurFilter.strength = 5;
  4877. ape.filters = [blurFilter];
  4878. }
  4879. SetSceneMaterial() {
  4880. this.MainCamera.clearFlag = Laya.BaseCamera.CLEARFLAG_SKY;
  4881. let skyRenderer = this.MainScene.skyRenderer;
  4882. skyRenderer.mesh = Laya.SkyDome.instance;
  4883. let mat = new Laya.SkyProceduralMaterial();
  4884. skyRenderer.material = mat;
  4885. mat.sunDisk = Laya.SkyProceduralMaterial.SUN_NODE;
  4886. mat.skyTint = new Laya.Vector4(1, 0.74, 0.74, 1);
  4887. }
  4888. InItScene() {
  4889. LevelController.Instance.SetLevel();
  4890. PlaneManager.Instance.SetAir();
  4891. ConstructManager.Instance.SetConstruct();
  4892. CameraManager.Instance.SetCameraAction(CameraState.game, 1);
  4893. MainRoleManager.Instance.SetPlayerPosition();
  4894. }
  4895. }
  4896. var Sprite$b = Laya.Sprite;
  4897. var GlowFilter = Laya.GlowFilter;
  4898. class ResourcesManager {
  4899. constructor() {
  4900. this.cloth = [];
  4901. this.apePath = "res/apes/monkey2.png";
  4902. }
  4903. static get Instance() {
  4904. return this.instance || (this.instance = new ResourcesManager());
  4905. }
  4906. static LoadResource(path, complet) {
  4907. Laya.loader.retryNum = 2;
  4908. Laya.loader.maxLoader = 3;
  4909. Laya.loader.retryDelay = 100;
  4910. Laya.loader.create(path, new Laya.Handler(this, complet));
  4911. Laya.loader.on(Laya.Event.ERROR, this, (data) => {
  4912. console.log(data + " 资源加载失败");
  4913. });
  4914. }
  4915. InitAsset() {
  4916. AssetPath.Player.forEach(element => {
  4917. let _player = Laya.loader.getRes(element);
  4918. Laya.loader.clearRes(element);
  4919. this.LoadPoolRes(_player.name, _player);
  4920. });
  4921. AssetPath.Particle.forEach(element => {
  4922. let _effect = Laya.loader.getRes(element);
  4923. Laya.loader.clearRes(element);
  4924. this.LoadPoolRes(_effect.name, _effect);
  4925. });
  4926. let _enemy = Laya.loader.getRes(AssetPath.Enemy);
  4927. Laya.loader.clearRes(AssetPath.Enemy);
  4928. this.LoadPoolRes(_enemy.name, _enemy);
  4929. let _playerbullet = Laya.loader.getRes(AssetPath.PlayerShot);
  4930. Laya.loader.clearRes(AssetPath.PlayerShot);
  4931. this.LoadPoolRes(_playerbullet.name, _playerbullet);
  4932. let _tower = Laya.loader.getRes(AssetPath.Mound);
  4933. Laya.loader.clearRes(AssetPath.Mound);
  4934. this.LoadPoolRes(_tower.name, _tower);
  4935. let _scene = Laya.loader.getRes(AssetPath.MainScene);
  4936. Laya.loader.clearRes(AssetPath.MainScene);
  4937. AssetPath.Barrier.forEach(element => {
  4938. let _barrier = Laya.loader.getRes(element);
  4939. Laya.loader.clearRes(element);
  4940. this.LoadPoolRes(_barrier.name, _barrier);
  4941. });
  4942. Scene3DManager.Instance.Init(_scene);
  4943. }
  4944. LoadPoolRes(name, prefab) {
  4945. GamePool.Instance.InitSelf(name, prefab);
  4946. }
  4947. setup() {
  4948. this.createApe();
  4949. this.applayFilter();
  4950. }
  4951. createApe() {
  4952. this.ape = new Sprite$b();
  4953. this.ape.loadImage(this.apePath);
  4954. var texture = Laya.loader.getRes(this.apePath);
  4955. this.ape.x = (Laya.stage.width - texture.width) / 2;
  4956. this.ape.y = (Laya.stage.height - texture.height) / 2;
  4957. Laya.stage.addChild(this.ape);
  4958. }
  4959. applayFilter() {
  4960. var glowFilter = new GlowFilter("#ffff00", 10, 0, 0);
  4961. this.ape.filters = [glowFilter];
  4962. }
  4963. Load(callback) {
  4964. var arr = [
  4965. AssetPath.MainScene,
  4966. AssetPath.Enemy,
  4967. AssetPath.PlayerShot,
  4968. AssetPath.Mound,
  4969. ];
  4970. let arr1 = arr.concat(AssetPath.Player);
  4971. let arr2 = arr1.concat(AssetPath.Barrier);
  4972. let arr3 = arr2.concat(AssetPath.Particle);
  4973. ResourcesManager.LoadResource(arr3, () => {
  4974. this.InitAsset();
  4975. if (callback)
  4976. callback();
  4977. });
  4978. }
  4979. }
  4980. var Tween$1 = Laya.Tween;
  4981. class LoadView extends ui.LoadViewUI {
  4982. constructor() {
  4983. super();
  4984. this.proCom = false;
  4985. this.a = new Laya.Vector3();
  4986. this.loadResCom = false;
  4987. this.loginCom = false;
  4988. this.errorTime = 0;
  4989. this.timers = 0;
  4990. this.subLoadCom = false;
  4991. LoadView.instance = this;
  4992. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  4993. }
  4994. static get Instance() {
  4995. return LoadView.instance;
  4996. }
  4997. Resize() {
  4998. this.height = Laya.stage.height;
  4999. }
  5000. OnShow(data) {
  5001. this.proTex.text = "0%";
  5002. this.pro1.width = 0;
  5003. this.RefreshUI();
  5004. this.LoginGame();
  5005. this.LoadSubpackage();
  5006. Laya.timer.frameOnce(5, this, () => {
  5007. this.Resize();
  5008. });
  5009. WXSdk.AldEvent("进入加载加载界面!");
  5010. }
  5011. RefreshData() {
  5012. this.proLen = this.pro.width;
  5013. }
  5014. RegButton() {
  5015. }
  5016. RefreshUI() {
  5017. Tween$1.to(this.a, {
  5018. x: 1, update: new Laya.Handler(this, () => {
  5019. var num = this.a.x;
  5020. this.pro1.width = this.proLen * num;
  5021. num = num * 100;
  5022. this.proTex.text = Math.ceil(num) + "%";
  5023. })
  5024. }, 1500, Laya.Ease.quadInOut, new Laya.Handler(this, () => {
  5025. this.proTex.text = "100%";
  5026. this.pro1.width = this.proLen;
  5027. this.proCom = true;
  5028. this.AllCom();
  5029. }));
  5030. }
  5031. LoadRes() {
  5032. if (this.subLoadCom && this.loginCom) {
  5033. ResourcesManager.Instance.Load(() => {
  5034. WXSdk.AldEvent("资源加载成功");
  5035. this.loadResCom = true;
  5036. this.AllCom();
  5037. });
  5038. }
  5039. }
  5040. LoginGame() {
  5041. if (GameVersion.isWx) {
  5042. WXSdk.Login((data) => {
  5043. this.onWxLoginHandler(data);
  5044. });
  5045. }
  5046. else {
  5047. this.LocalLogin();
  5048. }
  5049. }
  5050. onWxLoginHandler(params) {
  5051. console.log("微信回调成功!");
  5052. console.log(params);
  5053. if (params == "error" || params.code == null) {
  5054. if (this.errorTime == 0) {
  5055. WXSdk.AldEvent("微信登录失败");
  5056. }
  5057. this.errorTime++;
  5058. if (this.errorTime >= 3)
  5059. return;
  5060. WXSdk.Login((data) => {
  5061. this.onWxLoginHandler(data);
  5062. });
  5063. }
  5064. else {
  5065. if (this.errorTime == 0) {
  5066. WXSdk.AldEvent("微信登录成功!");
  5067. }
  5068. let systemInfo = WXSdk.SystemInfo();
  5069. let platformModel = "ipx";
  5070. if (systemInfo != null) {
  5071. var model = systemInfo.model;
  5072. platformModel = `${systemInfo.brand}_${model}_${systemInfo.system}_wx${systemInfo.version}_SDKVer${systemInfo.SDKVersion}`;
  5073. console.log("platformModel:" + platformModel);
  5074. }
  5075. new UserModel(params.code, params.nickName, params.avatarUrl, params.gender, params.country, params.province, params.city, platformModel, WXSdk.ShareId, WXSdk.Chanel);
  5076. this.LocalLogin();
  5077. }
  5078. }
  5079. LocalLogin() {
  5080. NetManager.Instance.login(null, (data) => {
  5081. this.OnLoginComplete(data);
  5082. }, (data) => {
  5083. this.OnLoginError(data);
  5084. });
  5085. }
  5086. OnLoginComplete(data) {
  5087. if (data["code"] != "0") {
  5088. console.log("登录异常错误!");
  5089. WXSdk.AldEvent("本地登录成功!");
  5090. this.timers++;
  5091. if (this.timers >= 4)
  5092. return;
  5093. if (GameVersion.isWx) {
  5094. WXSdk.Login((data) => {
  5095. this.onWxLoginHandler(data);
  5096. });
  5097. }
  5098. else {
  5099. this.LocalLogin();
  5100. }
  5101. }
  5102. else {
  5103. this.loginCom = true;
  5104. this.LoadRes();
  5105. FYHD_Sdk.InitSdk();
  5106. this.AllCom();
  5107. }
  5108. }
  5109. OnLoginError(data) {
  5110. console.log("登录错误");
  5111. WXSdk.AldEvent("本地登陆失败");
  5112. }
  5113. LoadSubpackage() {
  5114. WXSdk.LoadSubPackage("subpackage", (com) => {
  5115. if (com) {
  5116. console.log("subpackage com++++++++++++++++");
  5117. LoadView.instance.subLoadCom = true;
  5118. LoadView.instance.LoadRes();
  5119. }
  5120. });
  5121. }
  5122. AllCom() {
  5123. if (this.proCom && this.loadResCom && this.loginCom) {
  5124. GuangGao.InitVideo();
  5125. Laya.timer.once(1000, this, () => {
  5126. WXSdk.AldEvent("进入主界面");
  5127. ViewManager.Instance.OpenView(ViewType.MainView);
  5128. MouseEvent.Instance.InitMouseEvent();
  5129. ShareModule.OnShowHandle();
  5130. SettingController.Instance.Init();
  5131. OnHideHandler.Reg();
  5132. SettingController.Instance._playMusic();
  5133. });
  5134. }
  5135. }
  5136. OnClose() {
  5137. LoadView.instance = null;
  5138. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5139. }
  5140. }
  5141. class MainView extends ui.MainViewUI {
  5142. constructor() {
  5143. super();
  5144. this.isTryed = false;
  5145. MainView.instance = this;
  5146. this.Resize();
  5147. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5148. }
  5149. static get Instance() {
  5150. return MainView.instance;
  5151. }
  5152. OnShow(data) {
  5153. this.RefreshData();
  5154. this.RegButton();
  5155. this.RefreshUI();
  5156. this.SetData();
  5157. this.SetTopAd();
  5158. if (GuideController.Instance.RequireGuide()) {
  5159. this.mainBox.visible = false;
  5160. }
  5161. }
  5162. RefreshUI() {
  5163. this.user_id.text = "user_id:" + UserModel.Instance.CurModel.m_userid;
  5164. this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5165. this.SetStage();
  5166. this.SetStagePro(0);
  5167. this.SetSettingBox(false);
  5168. }
  5169. RefreshData() {
  5170. this.GetImage();
  5171. this.coinFollow = new FollowNumber(0.1, 0, 0, 0.1);
  5172. this.proWidth = this.pro.width;
  5173. this.isTryed = false;
  5174. }
  5175. AdaptiveUI() {
  5176. }
  5177. moreFunc(ist) {
  5178. if (ist) ;
  5179. else {
  5180. console.log("mainui");
  5181. }
  5182. }
  5183. RegButton() {
  5184. this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5185. this.settingBtn.CZ = () => {
  5186. this.SetSettingBox();
  5187. };
  5188. this.skinBtn.CZ = () => {
  5189. ViewManager.Instance.AddView(ViewType.SKinShopView);
  5190. };
  5191. this.updateBtn.CZ = () => {
  5192. ViewManager.Instance.AddView(ViewType.IntensifyView);
  5193. };
  5194. DispatcherManager.on(EventType.Event.ShowMainUi, this, this.ShowMainBox);
  5195. DispatcherManager.on(EventType.Event.SetMonery, this, this.SetPlayerGrade);
  5196. DispatcherManager.on(EventType.Event.SetStage, this, this.SetStage);
  5197. DispatcherManager.on(EventType.Event.SetStagePro, this, this.SetStagePro);
  5198. this.sound_btn.clickHandler = new Laya.Handler(this, () => {
  5199. this.ClickSound();
  5200. });
  5201. this.shake_btn.clickHandler = new Laya.Handler(this, () => {
  5202. this.ClickShake();
  5203. });
  5204. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  5205. this.MoreGameBtn.clickHandler = new Laya.Handler(this, this.ClickExport);
  5206. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  5207. }
  5208. ClickExit() {
  5209. ViewManager.Instance.AddView(ViewType.ExitView);
  5210. }
  5211. ClickExport() {
  5212. ViewManager.Instance.AddView(ViewType.ExportView);
  5213. }
  5214. SetStage() {
  5215. this.stageValue.text = PlayerManager.Instance.stage.toString();
  5216. }
  5217. SetStagePro(value) {
  5218. value = value >= 1 ? 1 : value;
  5219. this.pro1.width = this.proWidth * value;
  5220. }
  5221. SetPlayerGrade(num) {
  5222. this.tempTarGrade = num;
  5223. this.coinFollow.target = num;
  5224. Laya.timer.frameLoop(1, this, this.T2);
  5225. }
  5226. T2() {
  5227. this.coinFollow.update();
  5228. let v = Math.ceil(this.coinFollow.follow);
  5229. this.countValue.text = v.toString();
  5230. if (v >= this.tempTarGrade) {
  5231. this.countValue.text = this.tempTarGrade.toString();
  5232. Laya.timer.clear(this, this.T2);
  5233. }
  5234. }
  5235. StartGame(e) {
  5236. if (this.isTryed) {
  5237. this.TryStartGame();
  5238. return;
  5239. }
  5240. if (e.target instanceof Laya.UIComponent) {
  5241. if (e.target.name != "mainBox")
  5242. return;
  5243. }
  5244. console.log("click");
  5245. let param = [{ "t": UserModel.Instance.CurModel.ServerTime }];
  5246. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Start, param, (data) => {
  5247. if (data["play_id"]) {
  5248. PlayerManager.Instance.Play_Id = data["play_id"];
  5249. }
  5250. WXSdk.Start(PlayerManager.Instance.stage.toString());
  5251. if (PlayerManager.Instance.stage >= 3) {
  5252. ViewManager.Instance.AddView(ViewType.TrialView);
  5253. }
  5254. else {
  5255. this.MainStartGame();
  5256. }
  5257. }, (data) => {
  5258. });
  5259. }
  5260. MainStartGame() {
  5261. GameManager.GameNum++;
  5262. this.mainBox.visible = false;
  5263. this.sliderBox.visible = false;
  5264. this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5265. this.gameStart.stop();
  5266. GameManager.Instance.Start();
  5267. MouseEvent.Instance.StartGameClick();
  5268. MainRoleManager.Instance.Start();
  5269. MateManager.Instance.TrialModelPlayAni();
  5270. StreetManager.Instance.SetBlock();
  5271. GuideController.Instance.GuideOn();
  5272. }
  5273. TryStartGame() {
  5274. GameManager.GameNum++;
  5275. this.sliderBox.visible = false;
  5276. this.gameStart.stop();
  5277. this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5278. GameManager.Instance.Start();
  5279. MouseEvent.Instance.StartGameClick();
  5280. MainRoleManager.Instance.Start();
  5281. MateManager.Instance.TrialModelPlayAni();
  5282. StreetManager.Instance.SetBlock();
  5283. }
  5284. TryClick() {
  5285. this.isTryed = true;
  5286. this.mainBox.visible = false;
  5287. }
  5288. ShowMainBox() {
  5289. this.mainBox.visible = true;
  5290. this.sliderBox.visible = true;
  5291. this.gameStart.play(0, true);
  5292. this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5293. this.isTryed = false;
  5294. this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5295. }
  5296. SetSettingBox(ist = true) {
  5297. if (!ist) {
  5298. this.settingBox.visible = false;
  5299. return;
  5300. }
  5301. this.settingBox.visible = !this.settingBox.visible;
  5302. }
  5303. GetImage() {
  5304. this.sound_open = this.sound_btn.getChildByName("kai");
  5305. this.sound_guan = this.sound_btn.getChildByName("guan");
  5306. this.shake_open = this.shake_btn.getChildByName("kai");
  5307. this.shake_guan = this.shake_btn.getChildByName("guan");
  5308. this.ShowSound(SettingController.Instance.sound);
  5309. this.ShowShake(SettingController.Instance.vibrate);
  5310. }
  5311. ClickSound() {
  5312. SettingController.Instance.sound = !SettingController.Instance.sound;
  5313. this.ShowSound(SettingController.Instance.sound);
  5314. }
  5315. ShowSound(isshow) {
  5316. if (!isshow) {
  5317. this.sound_open.visible = false;
  5318. this.sound_guan.visible = true;
  5319. SettingController.Instance.SettingSound(0);
  5320. Laya.LocalStorage.setItem("sound", "0");
  5321. console.log("关闭声音");
  5322. }
  5323. else {
  5324. this.sound_open.visible = true;
  5325. this.sound_guan.visible = false;
  5326. SettingController.Instance.SettingSound(1);
  5327. Laya.LocalStorage.setItem("sound", "1");
  5328. console.log("开启声音");
  5329. }
  5330. }
  5331. ClickShake() {
  5332. SettingController.Instance.vibrate = !SettingController.Instance.vibrate;
  5333. this.ShowShake(SettingController.Instance.vibrate);
  5334. }
  5335. ShowShake(isshow) {
  5336. if (!isshow) {
  5337. this.shake_open.visible = false;
  5338. this.shake_guan.visible = true;
  5339. Laya.LocalStorage.setItem("vibrate", "0");
  5340. console.log("关闭震动");
  5341. }
  5342. else {
  5343. this.shake_open.visible = true;
  5344. this.shake_guan.visible = false;
  5345. Laya.LocalStorage.setItem("vibrate", "1");
  5346. console.log("开启震动");
  5347. }
  5348. }
  5349. OnClose() {
  5350. this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5351. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5352. DispatcherManager.off(EventType.Event.ShowMainUi, this, this.ShowMainBox);
  5353. DispatcherManager.off(EventType.Event.SetMonery, this, this.SetPlayerGrade);
  5354. DispatcherManager.off(EventType.Event.SetStage, this, this.SetStage);
  5355. DispatcherManager.off(EventType.Event.SetStagePro, this, this.SetStagePro);
  5356. MainView.instance = null;
  5357. Laya.timer.clearAll(this);
  5358. }
  5359. Resize() {
  5360. this.height = Laya.stage.height;
  5361. }
  5362. SetData() {
  5363. FYHD_Sdk.SetHuTuiList(this.BottomList, 2, "");
  5364. this.GunGun();
  5365. }
  5366. GunGun() {
  5367. var maxBtm;
  5368. try {
  5369. this.BottomList.scrollBar.value = 0;
  5370. maxBtm = this.BottomList.scrollBar.max;
  5371. }
  5372. catch (error) {
  5373. console.error(error);
  5374. return;
  5375. }
  5376. var tempBtm = 1;
  5377. Laya.timer.frameLoop(1, this, () => {
  5378. this.BottomList.scrollBar.value += tempBtm;
  5379. if (this.BottomList.scrollBar.value >= maxBtm || this.BottomList.scrollBar.value <= 0) {
  5380. tempBtm = -tempBtm;
  5381. }
  5382. });
  5383. }
  5384. SetTopAd() {
  5385. if (Laya.Browser.onPC)
  5386. return;
  5387. this.topAdData = FYHD_Sdk.pushData || [];
  5388. this.LeftPushIcon.visible = this.RightPushIcon.visible = this.topAdData.length >= 2;
  5389. if (this.topAdData.length < 2)
  5390. return;
  5391. this.topLeftAdIndex = { index: 0 };
  5392. this.topRightAdIndex = { index: 1 };
  5393. this._setTopAd(this.LeftPushIcon, this.topLeftAdIndex);
  5394. this._setTopAd(this.RightPushIcon, this.topRightAdIndex);
  5395. }
  5396. _setTopAd(topAd, adIndex) {
  5397. let _icon = topAd.getChildByName("icon");
  5398. let _name = topAd.getChildByName("name");
  5399. topAd.clickHandler = new Laya.Handler(this, () => {
  5400. FYHD_Sdk.ShowHuTuiJump(this.topAdData[adIndex.index]);
  5401. });
  5402. this._setIcon(_icon, _name, adIndex);
  5403. Laya.timer.loop(3000, this, () => {
  5404. this._setIcon(_icon, _name, adIndex);
  5405. this.lefticon.play(null, false);
  5406. this.righticon.play(null, false);
  5407. });
  5408. }
  5409. _setIcon(_icon, _name, adIndex) {
  5410. adIndex.index = (adIndex.index + 2) % this.topAdData.length;
  5411. _icon.skin = this.topAdData[adIndex.index].icon;
  5412. _name.text = this.topAdData[adIndex.index].togame_name;
  5413. }
  5414. }
  5415. class CompleteView extends ui.CompleteViewUI {
  5416. constructor() {
  5417. super();
  5418. this.isWin = false;
  5419. CompleteView.instance = this;
  5420. this.Resize();
  5421. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5422. }
  5423. static get Instance() {
  5424. return CompleteView.instance;
  5425. }
  5426. OnShow(data) {
  5427. this.isWin = data;
  5428. this.RefreshData();
  5429. this.RegButton();
  5430. this.RefreshUI();
  5431. this.SetTopAd();
  5432. GuangGao.CheatBanner(this.winbtnBox);
  5433. }
  5434. Resize() {
  5435. this.height = Laya.stage.height;
  5436. }
  5437. RefreshData() {
  5438. this.coinValue = this.isWin == true ? LevelController.Instance._level.gold : LevelController.Instance._level.fail_gold;
  5439. this.tes1 = this.coinValue;
  5440. this.coinValue += (PlayerManager.tower_reward * GameManager.Instance.towerCount + PlayerManager.enemy_reward * GameManager.Instance.roleCount + PlayerManager.block_reward * GameManager.Instance.blockCount);
  5441. let iswin = this.isWin == true ? 1 : 0;
  5442. let count = this.coinValue;
  5443. let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "play_id": PlayerManager.Instance.Play_Id }, { "win": iswin }, { "money": count }];
  5444. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.GameResult, param, (data) => {
  5445. }, (data) => {
  5446. ViewManager.Instance.ShowTips("结算失败");
  5447. });
  5448. if (this.isWin) {
  5449. SettingController.Instance.PlaySound(SoundType.win);
  5450. WXSdk.Success(PlayerManager.Instance.stage.toString());
  5451. }
  5452. else {
  5453. SettingController.Instance.PlaySound(SoundType.defeat);
  5454. WXSdk.Fail(PlayerManager.Instance.stage.toString());
  5455. }
  5456. }
  5457. RegButton() {
  5458. this.doublegetBtn.CZ = () => {
  5459. this.DoubleGet();
  5460. };
  5461. this.nextBtn.CZ = () => {
  5462. if (this.isWin) {
  5463. this.Next();
  5464. }
  5465. else {
  5466. this.Resset();
  5467. }
  5468. };
  5469. }
  5470. Next() {
  5471. GameManager.Instance.LevelUp();
  5472. }
  5473. Resset() {
  5474. ViewManager.Instance.CloseView(ViewType.CompleteView);
  5475. GameManager.Instance.ReStart();
  5476. }
  5477. OnClose() {
  5478. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5479. CompleteView.instance = null;
  5480. Laya.timer.clearAll(this);
  5481. if (GameManager.GameNum == 1) {
  5482. ViewManager.Instance.AddView(ViewType.AttributeUpView);
  5483. ViewManager.Instance.AddView(ViewType.ExportView);
  5484. }
  5485. else {
  5486. ViewManager.Instance.AddView(ViewType.IntensifyView);
  5487. ViewManager.Instance.AddView(ViewType.ExportView);
  5488. }
  5489. GuangGao.Clear();
  5490. }
  5491. RefreshUI() {
  5492. this.winTop.visible = this.isWin;
  5493. this.shibaiTop.visible = !this.isWin;
  5494. this.valueText.text = "+" + this.coinValue;
  5495. this.towerCount.text = "X" + GameManager.Instance.towerCount.toString();
  5496. this.towerValue.text = (PlayerManager.tower_reward * GameManager.Instance.towerCount).toString();
  5497. this.roleCount.text = "X" + GameManager.Instance.roleCount.toString();
  5498. this.roleValue.text = (PlayerManager.enemy_reward * GameManager.Instance.roleCount).toString();
  5499. this.blockCount.text = "X" + GameManager.Instance.blockCount.toString();
  5500. this.blockValue.text = (PlayerManager.block_reward * GameManager.Instance.blockCount).toString();
  5501. }
  5502. DoubleGet() {
  5503. GuangGao.ShowVideo((isok) => {
  5504. if (isok) {
  5505. WXSdk.AldEvent("结束界面看视屏获得钱");
  5506. var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.coinValue * 2).toString() }];
  5507. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
  5508. ViewManager.Instance.ShowTips("金币:X" + (this.coinValue * 3));
  5509. this.Next();
  5510. }, (data) => {
  5511. });
  5512. }
  5513. });
  5514. }
  5515. SetTopAd() {
  5516. if (Laya.Browser.onPC)
  5517. return;
  5518. this.topAdData = FYHD_Sdk.pushData || [];
  5519. if (this.topAdData.length < 4)
  5520. return;
  5521. this.topLeftAdIndex = { index: 0 };
  5522. this.topRightAdIndex = { index: 1 };
  5523. this.bottomleftAdIndex = { index: 2 };
  5524. this.bottomRightAdIndex = { index: 3 };
  5525. this._setTopAd(this.LeftTopPushIcon, this.topLeftAdIndex);
  5526. this._setTopAd(this.LeftBottomPushIcon, this.bottomleftAdIndex);
  5527. this._setTopAd(this.RightTopPushIcon, this.topRightAdIndex);
  5528. this._setTopAd(this.RightBottomPushIcon, this.bottomRightAdIndex);
  5529. }
  5530. _setTopAd(topAd, adIndex) {
  5531. let _icon = topAd.getChildByName("icon");
  5532. let _name = topAd.getChildByName("name");
  5533. topAd.clickHandler = new Laya.Handler(this, () => {
  5534. FYHD_Sdk.ShowHuTuiJump(this.topAdData[adIndex.index]);
  5535. });
  5536. this._setIcon(_icon, _name, adIndex);
  5537. Laya.timer.loop(3000, this, () => {
  5538. this._setIcon(_icon, _name, adIndex);
  5539. this.pushshake.play(null, false);
  5540. });
  5541. }
  5542. _setIcon(_icon, _name, adIndex) {
  5543. adIndex.index = (adIndex.index + 4) % this.topAdData.length;
  5544. _icon.skin = this.topAdData[adIndex.index].icon;
  5545. _name.text = this.topAdData[adIndex.index].togame_name;
  5546. }
  5547. }
  5548. class InGameView extends ui.InGameViewUI {
  5549. static get Instance() {
  5550. return InGameView.instance;
  5551. }
  5552. constructor() {
  5553. super();
  5554. InGameView.instance = this;
  5555. this.Resize();
  5556. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5557. }
  5558. OnShow(data) {
  5559. this.RefreshData();
  5560. this.RegButton();
  5561. this.RefreshUI();
  5562. }
  5563. Resize() {
  5564. this.height = Laya.stage.height;
  5565. }
  5566. RefreshData() {
  5567. }
  5568. RegButton() {
  5569. }
  5570. RefreshUI() {
  5571. }
  5572. OnClose() {
  5573. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5574. InGameView.instance = null;
  5575. Laya.timer.clearAll(this);
  5576. }
  5577. }
  5578. class IntensifyView extends ui.IntensifyViewUI {
  5579. constructor() {
  5580. super();
  5581. this.iscoinShowfreecoinbtn = false;
  5582. this.Resize();
  5583. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5584. }
  5585. OnShow(data) {
  5586. this.RefreshData();
  5587. this.RegButton();
  5588. this.RefreshUI();
  5589. GuangGao.CheatBanner(null);
  5590. }
  5591. RefreshUI() {
  5592. this.InitUi();
  5593. this.RefreshCoinShow();
  5594. let t = this.cost1 < this.cost2 ? this.cost1 : this.cost2;
  5595. this.freecoinValue = Math.floor(t * 1.2);
  5596. this.coinValue.text = this.freecoinValue.toString();
  5597. }
  5598. RefreshData() {
  5599. this.tempPowerLevel = PlayerManager.Instance.powerLevel;
  5600. this.tempRateLevel = PlayerManager.Instance.rateLevel;
  5601. this.RefreshData2();
  5602. }
  5603. RefreshData2() {
  5604. let detail = UserModel.Instance.CurModel.user_video.detail;
  5605. if (!detail)
  5606. this.iscoinShowfreecoinbtn = true;
  5607. else {
  5608. let freet = detail.freecoin;
  5609. if (!freet) {
  5610. this.iscoinShowfreecoinbtn = true;
  5611. return;
  5612. }
  5613. if (freet < AppSetting.freeGetcoinTime) {
  5614. this.iscoinShowfreecoinbtn = true;
  5615. return;
  5616. }
  5617. this.iscoinShowfreecoinbtn = false;
  5618. }
  5619. }
  5620. RegButton() {
  5621. this.backBtn.CZ = () => {
  5622. ViewManager.Instance.CloseView(ViewType.IntensifyView);
  5623. };
  5624. this.atkupBtn.clickHandler = new Laya.Handler(this, this.AtkUp);
  5625. this.rateupBtn.clickHandler = new Laya.Handler(this, this.RateUp);
  5626. this.getcoinBtn.clickHandler = new Laya.Handler(this, this.GetCoin);
  5627. }
  5628. AtkUp() {
  5629. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
  5630. ViewManager.Instance.ShowTips("金币不足!", 1);
  5631. return;
  5632. }
  5633. PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => {
  5634. if (iscom) {
  5635. WXSdk.AldEvent("升级界面花钱升级攻击力");
  5636. this.tempPowerLevel++;
  5637. this.InitUi();
  5638. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5639. }
  5640. });
  5641. }
  5642. RateUp() {
  5643. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
  5644. ViewManager.Instance.ShowTips("金币不足!", 1);
  5645. return;
  5646. }
  5647. PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "money", this.cost2, (iscom) => {
  5648. if (iscom) {
  5649. WXSdk.AldEvent("升级界面花钱升级速度");
  5650. this.tempRateLevel++;
  5651. this.InitUi();
  5652. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5653. }
  5654. });
  5655. }
  5656. GetCoin() {
  5657. GuangGao.ShowVideo((isok) => {
  5658. if (isok) {
  5659. var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.freecoinValue).toString() }, { "channel": "video:freecoin" }];
  5660. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
  5661. WXSdk.AldEvent("升级界面看视屏获得钱");
  5662. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5663. this.RefreshData();
  5664. this.RefreshCoinShow();
  5665. }, (data) => {
  5666. });
  5667. }
  5668. });
  5669. }
  5670. RefreshCoinShow() {
  5671. if (this.iscoinShowfreecoinbtn) {
  5672. this.getcoinBtn.gray = false;
  5673. this.getcoinBtn.mouseEnabled = true;
  5674. }
  5675. else {
  5676. this.getcoinBtn.gray = true;
  5677. this.getcoinBtn.mouseEnabled = false;
  5678. }
  5679. }
  5680. InitUi() {
  5681. this.atkLv.text = "LV" + this.tempPowerLevel;
  5682. let al = NetInfoManager.Instance._atk.length;
  5683. let t = this.tempPowerLevel > al ? al : this.tempPowerLevel;
  5684. this.cost1 = NetInfoManager.Instance.GetAtk(t)["cost"];
  5685. this.atkValue.text = this.cost1.toString();
  5686. this.rateLv.text = "LV" + this.tempRateLevel;
  5687. let al1 = NetInfoManager.Instance._rate.length;
  5688. let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel;
  5689. this.cost2 = NetInfoManager.Instance.GetRate(t1)["cost"];
  5690. this.rateValue.text = this.cost2.toString();
  5691. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
  5692. this.atkupBtn.gray = true;
  5693. this.atkupBtn.mouseEnabled = false;
  5694. }
  5695. else {
  5696. this.atkupBtn.gray = false;
  5697. this.atkupBtn.mouseEnabled = true;
  5698. }
  5699. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
  5700. this.rateupBtn.gray = true;
  5701. this.rateupBtn.mouseEnabled = false;
  5702. }
  5703. else {
  5704. this.rateupBtn.gray = false;
  5705. this.rateupBtn.mouseEnabled = true;
  5706. }
  5707. }
  5708. OnClose() {
  5709. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5710. if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
  5711. PlayerManager.Instance.SetInfo();
  5712. }
  5713. GuangGao.Clear();
  5714. }
  5715. Resize() {
  5716. this.height = Laya.stage.height;
  5717. }
  5718. }
  5719. class AttributeUpView extends ui.AttributeUpViewUI {
  5720. constructor() {
  5721. super();
  5722. this.iscanShowVideoBtn = true;
  5723. this.isatkvideo = false;
  5724. this.isfirstatkvideo = true;
  5725. this.isfirstratevideo = true;
  5726. this.isratevideo = false;
  5727. this.atkShow = false;
  5728. this.PushDataArray = [];
  5729. this.doudongcishu = 2;
  5730. this.Resize();
  5731. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5732. }
  5733. OnShow(data) {
  5734. this.RefreshData();
  5735. this.RegButton();
  5736. this.RefreshUI();
  5737. this.InitPushData();
  5738. GuangGao.CheatBanner(null);
  5739. }
  5740. RefreshUI() {
  5741. this.SetUi();
  5742. }
  5743. SetUi() {
  5744. this.atkLv.text = "LV" + this.tempPowerLevel;
  5745. let al = NetInfoManager.Instance._atk.length;
  5746. let t = this.tempPowerLevel > al ? al : this.tempPowerLevel;
  5747. this.cost1 = NetInfoManager.Instance.GetAtk(t)["cost"];
  5748. this.atkValue.text = this.cost1.toString();
  5749. this.rateLv.text = "LV" + this.tempRateLevel;
  5750. let al1 = NetInfoManager.Instance._rate.length;
  5751. let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel;
  5752. this.cost2 = NetInfoManager.Instance.GetRate(t1)["cost"];
  5753. this.rateValue.text = this.cost2.toString();
  5754. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
  5755. if (this.iscanShowVideoBtn && this.isfirstatkvideo) {
  5756. this.isatkvideo = true;
  5757. this._atk.visible = false;
  5758. this._atkVideo.visible = true;
  5759. this.atkBtn.mouseEnabled = true;
  5760. this.atkBtn.gray = false;
  5761. this.click1.visible = true;
  5762. this.atkShow = true;
  5763. }
  5764. else {
  5765. this.atkBtn.mouseEnabled = false;
  5766. this.atkBtn.gray = true;
  5767. this.isatkvideo = false;
  5768. this.click1.visible = false;
  5769. this.atkShow = false;
  5770. }
  5771. }
  5772. else {
  5773. this._atk.visible = true;
  5774. this._atkVideo.visible = false;
  5775. this.atkBtn.gray = false;
  5776. this.atkBtn.mouseEnabled = true;
  5777. this.isatkvideo = false;
  5778. this.click1.visible = true;
  5779. this.atkShow = true;
  5780. }
  5781. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
  5782. if (this.iscanShowVideoBtn && this.isfirstratevideo) {
  5783. this.isratevideo = true;
  5784. this._rate.visible = false;
  5785. this._rateVideo.visible = true;
  5786. this.rateBtn.mouseEnabled = true;
  5787. this.rateBtn.gray = false;
  5788. if (this.atkShow)
  5789. this.click2.visible = false;
  5790. else
  5791. this.click2.visible = true;
  5792. }
  5793. else {
  5794. this.rateBtn.mouseEnabled = false;
  5795. this.rateBtn.gray = true;
  5796. this.isratevideo = false;
  5797. this.click2.visible = false;
  5798. }
  5799. }
  5800. else {
  5801. this._rate.visible = true;
  5802. this._rateVideo.visible = false;
  5803. this.rateBtn.gray = false;
  5804. this.rateBtn.mouseEnabled = true;
  5805. this.isratevideo = false;
  5806. if (this.atkShow)
  5807. this.click2.visible = false;
  5808. else
  5809. this.click2.visible = true;
  5810. }
  5811. }
  5812. RefreshData() {
  5813. this.tempPowerLevel = PlayerManager.Instance.powerLevel;
  5814. this.tempRateLevel = PlayerManager.Instance.rateLevel;
  5815. let detail = UserModel.Instance.CurModel.user_video.detail;
  5816. if (!detail)
  5817. this.iscanShowVideoBtn = true;
  5818. else {
  5819. let freet = detail.free;
  5820. if (!freet) {
  5821. this.iscanShowVideoBtn = true;
  5822. return;
  5823. }
  5824. if (freet < AppSetting.freeUpdateVideotime) {
  5825. this.iscanShowVideoBtn = true;
  5826. return;
  5827. }
  5828. {
  5829. this.iscanShowVideoBtn = false;
  5830. }
  5831. }
  5832. }
  5833. RegButton() {
  5834. this.backBtn.CZ = () => {
  5835. this.BackClickHandler();
  5836. };
  5837. this.atkBtn.clickHandler = new Laya.Handler(this, this.AtkBtnHandler);
  5838. this.rateBtn.clickHandler = new Laya.Handler(this, this.RateBtnHandler);
  5839. }
  5840. AtkBtnHandler() {
  5841. if (this.isatkvideo) {
  5842. GuangGao.ShowVideo((iscom) => {
  5843. if (iscom) {
  5844. PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "video:free", this.cost1, (iscom) => {
  5845. if (iscom) {
  5846. WXSdk.AldEvent("失败界面看视屏升级攻击力");
  5847. this.tempPowerLevel++;
  5848. this.isfirstatkvideo = false;
  5849. this.SetUi();
  5850. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5851. }
  5852. });
  5853. }
  5854. });
  5855. }
  5856. else {
  5857. PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => {
  5858. if (iscom) {
  5859. WXSdk.AldEvent("失败界面花钱升级攻击力");
  5860. this.tempPowerLevel++;
  5861. this.SetUi();
  5862. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5863. }
  5864. });
  5865. }
  5866. }
  5867. RateBtnHandler() {
  5868. if (this.isratevideo) {
  5869. GuangGao.ShowVideo((iscom) => {
  5870. if (iscom) {
  5871. PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "video:free", this.cost2, (iscom) => {
  5872. if (iscom) {
  5873. WXSdk.AldEvent("失败界面看视屏升级速度");
  5874. this.tempRateLevel++;
  5875. this.isfirstratevideo = false;
  5876. this.SetUi();
  5877. }
  5878. });
  5879. }
  5880. });
  5881. }
  5882. else {
  5883. PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "money", this.cost2, (iscom) => {
  5884. if (iscom) {
  5885. WXSdk.AldEvent("失败界面花钱升级速度");
  5886. this.tempRateLevel++;
  5887. this.SetUi();
  5888. }
  5889. });
  5890. }
  5891. }
  5892. BackClickHandler() {
  5893. ViewManager.Instance.CloseView(ViewType.AttributeUpView);
  5894. GameManager.Instance.ReStart();
  5895. }
  5896. OnClose() {
  5897. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5898. if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
  5899. PlayerManager.Instance.SetInfo();
  5900. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5901. }
  5902. GuangGao.Clear();
  5903. }
  5904. Resize() {
  5905. this.height = Laya.stage.height;
  5906. }
  5907. InitPushData() {
  5908. for (let i = 0; i < FYHD_Sdk.pushData.length; i++) {
  5909. if (i < 6) {
  5910. this.PushDataArray.push(FYHD_Sdk.pushData[i]);
  5911. }
  5912. }
  5913. for (let j = 0; j < this.PushBox.numChildren; j++) {
  5914. let box = this.PushBox.getChildAt(j);
  5915. let icon = box.getChildByName("icon");
  5916. let btn = box.getChildByName("btn");
  5917. let name = box.getChildByName("name");
  5918. icon.skin = this.PushDataArray[j].icon;
  5919. name.text = this.PushDataArray[j].togame_name;
  5920. btn.clickHandler = new Laya.Handler(this, this.clickAd, [this.PushDataArray[j]]);
  5921. }
  5922. Laya.timer.loop(3000, this, this.Doudong);
  5923. }
  5924. clickAd(_data) {
  5925. FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
  5926. FYHD_Sdk.ShowHuTuiJump(_data);
  5927. }
  5928. PlayAni() {
  5929. this.shakeani.play(null, false);
  5930. }
  5931. Doudong() {
  5932. this.PlayAni();
  5933. this.doudongcishu++;
  5934. let _arr = [];
  5935. if (this.doudongcishu % 2 == 0) {
  5936. for (let i = 0; i < FYHD_Sdk.pushData.length; i++) {
  5937. if (i < 6) {
  5938. _arr.push(FYHD_Sdk.pushData[i]);
  5939. }
  5940. }
  5941. for (let j = 0; j < this.PushBox.numChildren; j++) {
  5942. let box = this.PushBox.getChildAt(j);
  5943. let icon = box.getChildByName("icon");
  5944. let btn = box.getChildByName("btn");
  5945. icon.skin = _arr[j].icon;
  5946. btn.clickHandler = new Laya.Handler(this, this.clickAd, [_arr[j]]);
  5947. }
  5948. }
  5949. else {
  5950. let num = 0;
  5951. for (let i = FYHD_Sdk.pushData.length - 1; i > -1; i--) {
  5952. if (num < 6) {
  5953. _arr.push(FYHD_Sdk.pushData[i]);
  5954. }
  5955. num++;
  5956. }
  5957. for (let j = 0; j < this.PushBox.numChildren; j++) {
  5958. let box = this.PushBox.getChildAt(j);
  5959. let icon = box.getChildByName("icon");
  5960. let btn = box.getChildByName("btn");
  5961. icon.skin = _arr[j].icon;
  5962. btn.clickHandler = new Laya.Handler(this, this.clickAd, [_arr[j]]);
  5963. }
  5964. }
  5965. }
  5966. }
  5967. var Vector3$6 = Laya.Vector3;
  5968. class DisplayerCarController {
  5969. static get Instance() {
  5970. return DisplayerCarController.instance || (DisplayerCarController.instance = new DisplayerCarController());
  5971. }
  5972. CreatePlayer(id) {
  5973. if (!id)
  5974. id = PlayerManager.Instance.equipId;
  5975. if (!this.player) {
  5976. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + id);
  5977. if (p)
  5978. this.player = p;
  5979. this.mainscene.addChild(this.player);
  5980. this.player.transform.localPosition = MathTool.VecZero;
  5981. this.player.transform.localRotationEuler = MathTool.VecZero;
  5982. }
  5983. else {
  5984. GamePool.Instance.RecoverModel(this.player);
  5985. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + id);
  5986. if (p)
  5987. this.player = p;
  5988. this.mainscene.addChild(this.player);
  5989. this.player.transform.localPosition = MathTool.VecZero;
  5990. this.player.transform.localRotationEuler = MathTool.VecZero;
  5991. }
  5992. let anima = this.player.getChildAt(0).getComponent(Laya.Animator);
  5993. anima.play(MusicType.Dance);
  5994. anima.speed = 1;
  5995. }
  5996. Reset() {
  5997. if (this.mainscene) {
  5998. this.mainscene.removeSelf();
  5999. }
  6000. if (this.player) {
  6001. GamePool.Instance.RecoverModel(this.player);
  6002. this.player = null;
  6003. }
  6004. }
  6005. InitDis(par) {
  6006. if (!this.mainscene) {
  6007. this.mainscene = new Laya.Scene3D();
  6008. this.maincamera = new Laya.Camera();
  6009. this.maincamera.enableHDR = false;
  6010. this.mainscene.addChild(this.maincamera);
  6011. this.light = new Laya.DirectionLight();
  6012. this.light.transform.rotation = new Laya.Quaternion(-0.24776, 0, 0, 0.9688215);
  6013. this.light.intensity = 0.45;
  6014. this.light.color = new Vector3$6(1, 1, 1);
  6015. this.mainscene.addChild(this.light);
  6016. let or = 1;
  6017. this.maincamera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or);
  6018. this.maincamera.orthographic = false;
  6019. this.maincamera.enableHDR = false;
  6020. this.maincamera.clearFlag = 2;
  6021. this.maincamera.fieldOfView = 60;
  6022. this.maincamera.transform.position = new Vector3$6(0, 1.52, 3.12);
  6023. this.maincamera.transform.rotation = new Laya.Quaternion(0, 0, 0, 1);
  6024. }
  6025. let or = 1;
  6026. this.maincamera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or);
  6027. par.addChild(this.mainscene);
  6028. this.CreatePlayer();
  6029. }
  6030. }
  6031. class SKinShopView extends ui.SkinShopViewUI {
  6032. static get Instance() {
  6033. return SKinShopView.instance;
  6034. }
  6035. constructor() {
  6036. super();
  6037. SKinShopView.instance = this;
  6038. this.Resize();
  6039. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  6040. }
  6041. Resize() {
  6042. this.height = Laya.stage.height;
  6043. }
  6044. OnShow(data) {
  6045. this.RefreshData();
  6046. this.RegButton();
  6047. this.RefreshUI();
  6048. WXSdk.AldEvent("打开皮肤界面");
  6049. }
  6050. RefreshData() {
  6051. this.oignPlayerid = PlayerManager.Instance.equipId;
  6052. this.operateIndex = this.oignPlayerid;
  6053. }
  6054. RefreshUI(data) {
  6055. this.SetBtnUi(this.operateIndex);
  6056. this.RefreshBtnUi(this.operateIndex);
  6057. DisplayerCarController.Instance.InitDis(this.viewPort);
  6058. }
  6059. RefreshBtnUi(index) {
  6060. if (PlayerManager.Instance.equipId == index) {
  6061. this.using.visible = true;
  6062. this.use.visible = false;
  6063. this.coin.visible = false;
  6064. this.video.visible = false;
  6065. return;
  6066. }
  6067. if (UserModel.Instance.CurModel.HasTheme(index)) {
  6068. this.using.visible = false;
  6069. this.use.visible = true;
  6070. this.coin.visible = false;
  6071. this.video.visible = false;
  6072. return;
  6073. }
  6074. let data = NetInfoManager.Instance.GetTheme(index);
  6075. if (data.require_type == 2) {
  6076. this.using.visible = false;
  6077. this.use.visible = false;
  6078. this.coin.visible = true;
  6079. this.video.visible = false;
  6080. this.coinValue = Number(data.require_num);
  6081. this.coin.getChildAt(0).getChildAt(0).text = this.coinValue.toString();
  6082. return;
  6083. }
  6084. if (data.require_type == 3) {
  6085. this.using.visible = false;
  6086. this.use.visible = false;
  6087. this.coin.visible = false;
  6088. this.video.visible = true;
  6089. this.video.getChildAt(0).getChildAt(0).text = UserModel.Instance.CurModel.GetThemeProgress(data.id) + "/" + data.require_num;
  6090. return;
  6091. }
  6092. }
  6093. SetBtnUi(index) {
  6094. if (index == 1) {
  6095. this.leftBtn.getChildByName("leftFalse").visible = true;
  6096. this.leftBtn.getChildByName("leftTrue").visible = false;
  6097. this.rightBtn.getChildByName("rightFalse").visible = false;
  6098. this.rightBtn.getChildByName("rightTrue").visible = true;
  6099. return;
  6100. }
  6101. if (index == 8) {
  6102. this.leftBtn.getChildByName("leftFalse").visible = false;
  6103. this.leftBtn.getChildByName("leftTrue").visible = true;
  6104. this.rightBtn.getChildByName("rightFalse").visible = true;
  6105. this.rightBtn.getChildByName("rightTrue").visible = false;
  6106. return;
  6107. }
  6108. this.leftBtn.getChildByName("leftFalse").visible = false;
  6109. this.leftBtn.getChildByName("leftTrue").visible = true;
  6110. this.rightBtn.getChildByName("rightFalse").visible = false;
  6111. this.rightBtn.getChildByName("rightTrue").visible = true;
  6112. }
  6113. ClickClose() {
  6114. DisplayerCarController.Instance.Reset();
  6115. if (this.oignPlayerid != PlayerManager.Instance.equipId) {
  6116. MainRoleManager.Instance.ChangeModel();
  6117. }
  6118. ViewManager.Instance.CloseView(ViewType.SKinShopView);
  6119. }
  6120. ClickVideo() {
  6121. GuangGao.ShowVideo((done) => {
  6122. if (done) {
  6123. WXSdk.AldEvent("商店中看视屏获得皮肤");
  6124. this.VideoGet();
  6125. }
  6126. });
  6127. }
  6128. ;
  6129. VideoGet() {
  6130. var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "id": this.operateIndex }, { "channel": "video" }];
  6131. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.themefission, param, (data) => {
  6132. var usermodel = UserModel.Instance.CurModel;
  6133. PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
  6134. this.RefreshBtnUi(this.operateIndex);
  6135. }, (data) => {
  6136. });
  6137. }
  6138. Buy() {
  6139. var param = [{ "id": this.operateIndex }];
  6140. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Buy, param, (data) => {
  6141. var usermodel = UserModel.Instance.CurModel;
  6142. PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
  6143. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  6144. this.RefreshBtnUi(this.operateIndex);
  6145. }, (data) => {
  6146. });
  6147. }
  6148. Equip() {
  6149. var param = [{ "id": this.operateIndex }];
  6150. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Equip, param, (data) => {
  6151. var usermodel = UserModel.Instance.CurModel;
  6152. PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
  6153. this.RefreshBtnUi(this.operateIndex);
  6154. }, (data) => {
  6155. });
  6156. }
  6157. RegButton() {
  6158. this.CloseBtn.CZ = () => {
  6159. this.ClickClose();
  6160. };
  6161. this.leftBtn.clickHandler = Laya.Handler.create(this, () => {
  6162. if (this.operateIndex == 1)
  6163. return;
  6164. this.operateIndex--;
  6165. this.SetBtnUi(this.operateIndex);
  6166. this.RefreshBtnUi(this.operateIndex);
  6167. DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
  6168. }, null, false);
  6169. this.rightBtn.clickHandler = Laya.Handler.create(this, () => {
  6170. if (this.operateIndex == 8)
  6171. return;
  6172. this.operateIndex++;
  6173. this.SetBtnUi(this.operateIndex);
  6174. this.RefreshBtnUi(this.operateIndex);
  6175. DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
  6176. }, null, false);
  6177. this.use.CZ = () => {
  6178. this.Equip();
  6179. };
  6180. this.coin.CZ = () => {
  6181. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.coinValue)
  6182. ViewManager.Instance.ShowTips("金币不足!", 2);
  6183. else
  6184. this.Buy();
  6185. };
  6186. this.video.CZ = () => {
  6187. this.ClickVideo();
  6188. };
  6189. }
  6190. OnClose() {
  6191. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6192. SKinShopView.instance = null;
  6193. WXSdk.AldEvent("关闭皮肤界面");
  6194. }
  6195. }
  6196. class TrialView extends ui.TrialViewUI {
  6197. constructor() {
  6198. super();
  6199. this.Resize();
  6200. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  6201. }
  6202. OnShow(data) {
  6203. this.RegButton();
  6204. this.RefreshData();
  6205. this.RegButton();
  6206. this.RefreshUI();
  6207. GuangGao.CheatBanner(this.btnBox);
  6208. }
  6209. RefreshUI() {
  6210. DisplayerCarController.Instance.InitDis(this.viewPort);
  6211. }
  6212. RefreshData() {
  6213. }
  6214. RegButton() {
  6215. this.videoBtn.CZ = () => {
  6216. this.VideoHandler();
  6217. };
  6218. this.backBtn.CZ = () => {
  6219. DisplayerCarController.Instance.Reset();
  6220. this.BackUi();
  6221. };
  6222. }
  6223. VideoHandler() {
  6224. GuangGao.ShowVideo((isok) => {
  6225. if (isok) {
  6226. WXSdk.AldEvent("看视屏试用");
  6227. this.VideoCom();
  6228. }
  6229. });
  6230. }
  6231. VideoCom() {
  6232. DisplayerCarController.Instance.Reset();
  6233. this.BackUi();
  6234. MateManager.Instance.Trial();
  6235. }
  6236. BackUi() {
  6237. ViewManager.Instance.CloseView(ViewType.TrialView);
  6238. if (MainView.Instance)
  6239. MainView.Instance.TryClick();
  6240. }
  6241. OnClose() {
  6242. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6243. GuangGao.Clear();
  6244. }
  6245. Resize() {
  6246. this.height = Laya.stage.height;
  6247. }
  6248. }
  6249. class ShadeView extends ui.ShadeViewUI {
  6250. constructor() {
  6251. super();
  6252. this.Resize();
  6253. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  6254. }
  6255. OnShow(data) {
  6256. this.RegButton();
  6257. }
  6258. RefreshUI() {
  6259. }
  6260. RefreshData() {
  6261. }
  6262. RegButton() {
  6263. this.on(Laya.Event.CLICK, this, this.Test);
  6264. }
  6265. Test() {
  6266. }
  6267. OnClose() {
  6268. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6269. this.off(Laya.Event.CLICK, this, this.Test);
  6270. }
  6271. Resize() {
  6272. this.height = Laya.stage.height;
  6273. }
  6274. }
  6275. class ExportView extends ui.ExportViewUI {
  6276. constructor() {
  6277. super(...arguments);
  6278. this.jump = false;
  6279. }
  6280. OnShow(data) {
  6281. this.CloseBtn.clickHandler = Laya.Handler.create(this, this.ClickClose, null, false);
  6282. this.ContinueBtn.clickHandler = Laya.Handler.create(this, this.ClickContinue, null, false);
  6283. this.SetData();
  6284. this.ContinueBtn.visible = FYHD_Sdk.iswhite;
  6285. if (FYHD_Sdk.iswhite) {
  6286. Laya.timer.once(1000, this, () => {
  6287. });
  6288. }
  6289. this.height = Laya.stage.height;
  6290. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  6291. this.height = Laya.stage.height;
  6292. });
  6293. }
  6294. OnClose() {
  6295. Laya.timer.clearAll(this);
  6296. }
  6297. ClickClose(_data) {
  6298. ViewManager.Instance.CloseView(ViewType.ExportView);
  6299. }
  6300. ClickContinue() {
  6301. let ran = GameTool.randomInt(0, FYHD_Sdk.pushData.length);
  6302. let item = FYHD_Sdk.pushData[ran];
  6303. FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
  6304. FYHD_Sdk.ShowHuTuiJump(item);
  6305. }
  6306. SetData() {
  6307. FYHD_Sdk.SetHuTuiList(this.TopList, 2, "");
  6308. FYHD_Sdk.SetHuTuiList(this.BottomList, 1, "");
  6309. this.GunGun();
  6310. }
  6311. GunGun() {
  6312. var maxTop;
  6313. var maxBtm;
  6314. try {
  6315. this.TopList.scrollBar.value = 0;
  6316. this.BottomList.scrollBar.value = 0;
  6317. maxTop = this.TopList.scrollBar.max;
  6318. maxBtm = this.BottomList.scrollBar.max;
  6319. }
  6320. catch (error) {
  6321. console.error(error);
  6322. return;
  6323. }
  6324. var tempTop = 1;
  6325. var tempBtm = 1;
  6326. Laya.timer.frameLoop(1, this, () => {
  6327. this.TopList.scrollBar.value += tempTop;
  6328. if (this.TopList.scrollBar.value >= maxTop || this.TopList.scrollBar.value <= 0) {
  6329. tempTop = -tempTop;
  6330. }
  6331. this.BottomList.scrollBar.value += tempBtm;
  6332. if (this.BottomList.scrollBar.value >= maxBtm || this.BottomList.scrollBar.value <= 0) {
  6333. tempBtm = -tempBtm;
  6334. }
  6335. });
  6336. }
  6337. }
  6338. class ExitView extends ui.ExitViewUI {
  6339. constructor() {
  6340. super();
  6341. this.jump = false;
  6342. ExitView.ins = this;
  6343. }
  6344. static get Instance() {
  6345. if (ExitView.ins) {
  6346. return ExitView.ins;
  6347. }
  6348. else {
  6349. return new ExitView();
  6350. }
  6351. }
  6352. OnShow() {
  6353. this.SetData();
  6354. this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
  6355. this.height = Laya.stage.height;
  6356. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  6357. this.height = Laya.stage.height;
  6358. });
  6359. }
  6360. OnClose() {
  6361. }
  6362. ClickClose() {
  6363. ViewManager.Instance.CloseView(ViewType.ExitView);
  6364. }
  6365. SetData() {
  6366. FYHD_Sdk.SetHuTuiList(this.PushList, 1, "");
  6367. }
  6368. }
  6369. var ViewType;
  6370. (function (ViewType) {
  6371. ViewType[ViewType["InGameView"] = 0] = "InGameView";
  6372. ViewType[ViewType["ShadeView"] = 1] = "ShadeView";
  6373. ViewType[ViewType["CompleteView"] = 2] = "CompleteView";
  6374. ViewType[ViewType["LoadView"] = 3] = "LoadView";
  6375. ViewType[ViewType["MainView"] = 4] = "MainView";
  6376. ViewType[ViewType["SettingUi"] = 5] = "SettingUi";
  6377. ViewType[ViewType["SKinShopView"] = 6] = "SKinShopView";
  6378. ViewType[ViewType["TrialView"] = 7] = "TrialView";
  6379. ViewType[ViewType["IntensifyView"] = 8] = "IntensifyView";
  6380. ViewType[ViewType["AttributeUpView"] = 9] = "AttributeUpView";
  6381. ViewType[ViewType["ExportView"] = 10] = "ExportView";
  6382. ViewType[ViewType["ExitView"] = 11] = "ExitView";
  6383. })(ViewType || (ViewType = {}));
  6384. class ViewManager {
  6385. constructor() {
  6386. this.viewDic = [];
  6387. this.addViewDic = new Dictionary();
  6388. this.showpushview = 0;
  6389. this._maskCnt = 0;
  6390. this.init();
  6391. }
  6392. static get Instance() {
  6393. return this.instance || (this.instance = new ViewManager());
  6394. }
  6395. init() {
  6396. this._maskCnt = 0;
  6397. this.viewDic[ViewType.InGameView] = InGameView;
  6398. this.viewDic[ViewType.LoadView] = LoadView;
  6399. this.viewDic[ViewType.MainView] = MainView;
  6400. this.viewDic[ViewType.IntensifyView] = IntensifyView;
  6401. this.viewDic[ViewType.CompleteView] = CompleteView;
  6402. this.viewDic[ViewType.SKinShopView] = SKinShopView;
  6403. this.viewDic[ViewType.TrialView] = TrialView;
  6404. this.viewDic[ViewType.ShadeView] = ShadeView;
  6405. this.viewDic[ViewType.ExportView] = ExportView;
  6406. this.viewDic[ViewType.ExitView] = ExitView;
  6407. this.viewDic[ViewType.AttributeUpView] = AttributeUpView;
  6408. this.uiNode = new Laya.Sprite();
  6409. this.popNode = new Laya.Sprite();
  6410. Laya.stage.addChild(this.uiNode);
  6411. Laya.stage.addChild(this.popNode);
  6412. this.uiNode.zOrder = 3;
  6413. this.popNode.zOrder = 4;
  6414. }
  6415. OpenView(view, data) {
  6416. if (this.curView != null) {
  6417. this.curView.OnClose();
  6418. this.uiNode.removeChild(this.curView);
  6419. this.curView.destroy(true);
  6420. this.curView = null;
  6421. }
  6422. this.curView = new this.viewDic[view];
  6423. this.uiNode.addChild(this.curView);
  6424. this.curView.OnShow(data);
  6425. }
  6426. get getCurView() {
  6427. return this.curView;
  6428. }
  6429. AddView(view, data) {
  6430. if (this.addViewDic.has(view))
  6431. return;
  6432. let t_view = new this.viewDic[view];
  6433. this.addViewDic.set(view, t_view);
  6434. this.uiNode.addChild(t_view);
  6435. t_view.OnShow(data);
  6436. MouseEvent.Instance.CloseInput();
  6437. }
  6438. RemoveView() {
  6439. if (this.curView != null) {
  6440. this.curView.OnClose();
  6441. this.uiNode.removeChild(this.curView);
  6442. this.curView.destroy(true);
  6443. this.curView = null;
  6444. }
  6445. }
  6446. HaveView(view) {
  6447. return this.addViewDic.has(view);
  6448. }
  6449. CloseView(view) {
  6450. if (!this.addViewDic.has(view))
  6451. return;
  6452. let t_view = this.addViewDic.get(view);
  6453. t_view.OnClose();
  6454. this.uiNode.removeChild(t_view);
  6455. t_view.destroy(true);
  6456. this.addViewDic.delete(view);
  6457. MouseEvent.Instance.OpenInput();
  6458. }
  6459. OpenMask() {
  6460. this._maskCnt++;
  6461. if (this._maskCnt > 1)
  6462. return;
  6463. if (this.curMask != null) {
  6464. this.curMask.OnClose();
  6465. this.popNode.removeChild(this.curView);
  6466. this.curMask.destroy();
  6467. this.curMask = null;
  6468. return;
  6469. }
  6470. this.curMask = new this.viewDic[ViewType.ShadeView];
  6471. if (!this.curMask)
  6472. return;
  6473. console.log("打开遮罩");
  6474. this.popNode.addChild(this.curMask);
  6475. this.curMask.OnShow();
  6476. }
  6477. CloseMask() {
  6478. this._maskCnt--;
  6479. if (this._maskCnt > 0)
  6480. return;
  6481. if (this.curMask != null) {
  6482. this.curMask.OnClose();
  6483. this.popNode.removeChild(this.curMask);
  6484. this.curMask.destroy(true);
  6485. console.log("关闭遮罩");
  6486. this.curMask = null;
  6487. }
  6488. }
  6489. ShowTips(value, type = 1) {
  6490. var warn = GamePool.Instance.GetUi(PoolType.WarnTips);
  6491. if (!warn)
  6492. return;
  6493. if (type == 1) {
  6494. warn.y = 0;
  6495. warn.text = value;
  6496. warn.x = Laya.stage.width >> 1;
  6497. this.popNode.addChild(warn);
  6498. let _end = (Laya.stage.height >> 1) - 300;
  6499. var tw = Laya.Tween.to(warn, { y: _end }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
  6500. tw.clear();
  6501. GamePool.Instance.RecoverUi(PoolType.WarnTips, warn);
  6502. }));
  6503. }
  6504. else if (type == 2) {
  6505. warn.y = Laya.stage.height - 400;
  6506. warn.text = value;
  6507. warn.x = Laya.stage.width >> 1;
  6508. this.popNode.addChild(warn);
  6509. var tw = Laya.Tween.to(warn, { alpha: 0 }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
  6510. tw.clear();
  6511. GamePool.Instance.RecoverUi(PoolType.WarnTips, warn);
  6512. warn.alpha = 1;
  6513. }));
  6514. }
  6515. }
  6516. ShowGuideView() {
  6517. if (!this.GuideView) {
  6518. this.GuideView = new GuideView();
  6519. this.popNode.addChild(this.GuideView);
  6520. }
  6521. this.GuideView.OnShow();
  6522. }
  6523. CloseGuideView() {
  6524. if (this.GuideView) {
  6525. this.GuideView.OnClose();
  6526. this.GuideView.removeSelf();
  6527. this.GuideView.destroy();
  6528. }
  6529. }
  6530. }
  6531. class FYHD_Sdk {
  6532. static InitSdk() {
  6533. Laya.Browser.window.sdk.getFyhd().startSdk();
  6534. FYHD_Sdk.UserInfoAuth();
  6535. let white = Laya.LocalStorage.getItem("is_white");
  6536. if (white) {
  6537. FYHD_Sdk.iswhite = true;
  6538. }
  6539. else {
  6540. FYHD_Sdk.getWhiteConfig();
  6541. }
  6542. let newuser = Laya.LocalStorage.getItem("is_newuser");
  6543. if (!newuser) {
  6544. FYHD_Sdk.isnewuser = true;
  6545. Laya.LocalStorage.setItem("is_newuser", "1");
  6546. }
  6547. else {
  6548. FYHD_Sdk.isnewuser = false;
  6549. }
  6550. FYHD_Sdk.PushData();
  6551. }
  6552. static UserInfoAuth() {
  6553. if (!Laya.Browser.onWeiXin)
  6554. return;
  6555. Laya.Browser.window.sdk.getFyhd().getFyhdUserInfo(null, false, (data) => {
  6556. console.log("无授权回调:" + JSON.stringify(data));
  6557. if (data.result.user) {
  6558. FYHD_Sdk.openid = data.result.user.openid;
  6559. FYHD_Sdk.AuthInfo();
  6560. }
  6561. });
  6562. }
  6563. static AuthInfo() {
  6564. var args = {
  6565. openid: FYHD_Sdk.openid,
  6566. };
  6567. Laya.Browser.window.sdk.getFyhd().loginData(args, (data) => {
  6568. console.log("授权上报回调:" + JSON.stringify(data));
  6569. FYHD_Sdk.ValueUser();
  6570. });
  6571. }
  6572. static ValueUser() {
  6573. var args = {
  6574. openid: FYHD_Sdk.openid,
  6575. };
  6576. Laya.Browser.window.sdk.getFyhd().valueuser(args, (data) => {
  6577. console.log("有效用户上报:" + JSON.stringify(data));
  6578. });
  6579. }
  6580. static getWhiteConfig() {
  6581. Laya.Browser.window.sdk.getFyhd().whiteConfig(function (e) {
  6582. FYHD_Sdk.iswhite = e.data.is_white;
  6583. if (FYHD_Sdk.iswhite) {
  6584. Laya.LocalStorage.setItem("is_white", "1");
  6585. }
  6586. console.log("白名单---", e);
  6587. });
  6588. }
  6589. static SetHuTuiList(list, scrol = 1, type = "") {
  6590. let arr = this.pushData;
  6591. if (!arr || arr.length == 0)
  6592. return;
  6593. list.selectEnable = false;
  6594. scrol == 1 ? list.vScrollBarSkin = "" : list.hScrollBarSkin = "";
  6595. list.renderHandler = Laya.Handler.create(this, this.updateItem, [type], false);
  6596. list.array = arr;
  6597. list.refresh();
  6598. }
  6599. static updateItem(type, cell, index) {
  6600. var aditem = cell.getComponent(ListItem);
  6601. aditem.Refresh(type);
  6602. }
  6603. static ClickAd(ad_type) {
  6604. console.log("上报类型---", ad_type);
  6605. if (!Laya.Browser.onWeiXin)
  6606. return;
  6607. var param = {
  6608. ad_type: ad_type,
  6609. openid: FYHD_Sdk.openid
  6610. };
  6611. console.log("点击参数:" + param);
  6612. Laya.Browser.window.sdk.getFyhd().advertisement(param, (data) => {
  6613. console.log("点击结果:" + JSON.stringify(data));
  6614. });
  6615. }
  6616. static PushData() {
  6617. if (!Laya.Browser.onWeiXin)
  6618. return;
  6619. var param = {};
  6620. Laya.Browser.window.sdk.getFyhd().shareRecommend(param, (data) => {
  6621. console.log("热门游戏数据--", data);
  6622. if (data.data) {
  6623. FYHD_Sdk.pushData = data.data;
  6624. FYHD_Sdk.pushData.sort(FYHD_Sdk.ListSort);
  6625. FYHD_Sdk.isHaveDate = true;
  6626. }
  6627. console.log("获取互推信息:" + JSON.stringify(FYHD_Sdk.pushData));
  6628. });
  6629. }
  6630. static ShowHuTuiJump(data) {
  6631. if (!Laya.Browser.onWeiXin)
  6632. return;
  6633. if (data.jump_type == 2) {
  6634. Laya.Browser.window.wx.previewImage({ current: data.qrcode, urls: [data.qrcode] });
  6635. }
  6636. else if (data.jump_type == 1) {
  6637. Laya.Browser.window.wx.navigateToMiniProgram({
  6638. appId: data.to_appid,
  6639. path: data.jump_path,
  6640. success(res) {
  6641. console.log("上报成功:" + JSON.stringify(res));
  6642. FYHD_Sdk.PushClick(data.to_appid);
  6643. },
  6644. fail(res) {
  6645. ViewManager.Instance.AddView(ViewType.ExportView);
  6646. }
  6647. });
  6648. }
  6649. else if (data.jump_type == 0) {
  6650. Laya.Browser.window.wx.navigateToMiniProgram({
  6651. appId: data.platform_appid,
  6652. path: data.jump_path,
  6653. success(res) {
  6654. console.log("上报成功:" + JSON.stringify(res));
  6655. FYHD_Sdk.PushClick(data.to_appid);
  6656. },
  6657. fail(res) {
  6658. }
  6659. });
  6660. }
  6661. }
  6662. static PushClick(to_appid) {
  6663. if (!Laya.Browser.onWeiXin)
  6664. return;
  6665. var param = {
  6666. openid: FYHD_Sdk.openid,
  6667. to_appid: to_appid,
  6668. };
  6669. Laya.Browser.window.sdk.getFyhd().sharePlay(param, (data) => {
  6670. console.log("点击上报结果:" + JSON.stringify(data));
  6671. });
  6672. }
  6673. static ListSort(a, b) {
  6674. if (Number(a["panel"]) < Number(b["panel"])) {
  6675. return -1;
  6676. }
  6677. if (Number(a["panel"]) == Number(b["panel"])) {
  6678. return 0;
  6679. }
  6680. if (Number(a["panel"]) > Number(b["panel"])) {
  6681. return 1;
  6682. }
  6683. }
  6684. }
  6685. FYHD_Sdk.Ad_ClickType = {
  6686. Video: "video_click",
  6687. Watch: "watch",
  6688. Share: "share",
  6689. Banner: "banner",
  6690. Push: "push",
  6691. PushClick: "icon_click"
  6692. };
  6693. FYHD_Sdk.pushData = [];
  6694. FYHD_Sdk.isHaveDate = false;
  6695. FYHD_Sdk.ShowAd = "ShowAd";
  6696. class ListItem extends Laya.Script {
  6697. constructor() { super(); }
  6698. onAwake() {
  6699. this.self = this.owner;
  6700. this.icon = this.self.getChildByName("icon");
  6701. this.btn = this.self.getChildByName("btn");
  6702. this.name = this.self.getChildByName("name");
  6703. this._tip = this.self.getChildByName("tip");
  6704. this.bottom = this.self.getChildByName("bottom");
  6705. this.remen = this.self.getChildByName("remen");
  6706. this.star = this.self.getChildByName("star");
  6707. this.diandian = this.icon.getChildAt(0);
  6708. this.btn.clickHandler = new Laya.Handler(this, this.clickAd);
  6709. console.log("self-------------------", this.self);
  6710. }
  6711. Refresh(type) {
  6712. this.data = this.self.dataSource;
  6713. this.type = type;
  6714. if (this.name) {
  6715. this.name.text = this.data.togame_name;
  6716. }
  6717. if (this._tip) {
  6718. this._tip.visible = true;
  6719. let rnd = GameTool.randomInt(1, 200000);
  6720. let text = rnd.toString() + "人在玩";
  6721. this._tip.text = text;
  6722. }
  6723. if (this.diandian) {
  6724. this.diandian.visible = false;
  6725. }
  6726. if (this.bottom) {
  6727. let num = GameTool.randomInt(1, 6);
  6728. this.bottom.skin = "subpackage/bottom/icontitle" + num + ".png";
  6729. }
  6730. if (this.remen) {
  6731. this.remen.visible = Math.random() < 0.2 ? true : false;
  6732. }
  6733. if (this.star) {
  6734. this.star.visible = Math.random() < 0.2 ? true : false;
  6735. }
  6736. this.icon.skin = this.data.icon;
  6737. }
  6738. clickAd() {
  6739. FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
  6740. FYHD_Sdk.ShowHuTuiJump(this.data);
  6741. }
  6742. onDestroy() {
  6743. this.btn.clickHandler = null;
  6744. }
  6745. }
  6746. class GameConfig {
  6747. constructor() { }
  6748. static init() {
  6749. var reg = Laya.ClassUtils.regClass;
  6750. reg("View/Com/ButtonRunTime.ts", ImageRunTime);
  6751. reg("View/Com/ListItem.ts", ListItem);
  6752. }
  6753. }
  6754. GameConfig.width = 720;
  6755. GameConfig.height = 1280;
  6756. GameConfig.scaleMode = "fixedwidth";
  6757. GameConfig.screenMode = "vertical";
  6758. GameConfig.alignV = "middle";
  6759. GameConfig.alignH = "center";
  6760. GameConfig.startScene = "MainView.scene";
  6761. GameConfig.sceneRoot = "";
  6762. GameConfig.debug = false;
  6763. GameConfig.stat = false;
  6764. GameConfig.physicsDebug = false;
  6765. GameConfig.exportSceneToJson = true;
  6766. GameConfig.init();
  6767. class Main {
  6768. constructor() {
  6769. window['Config3D'] && (window['Config3D']["_config"]["_defaultPhysicsMemory"] = 128);
  6770. window['Config3D'] && (window['Config3D']["_config"]["isAntialias"] = true);
  6771. if (window["Laya3D"])
  6772. Laya3D.init(GameConfig.width, GameConfig.height);
  6773. else
  6774. Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]);
  6775. Laya["Physics"] && Laya["Physics"].enable();
  6776. Laya["DebugPanel"] && Laya["DebugPanel"].enable();
  6777. Laya.stage.scaleMode = GameConfig.scaleMode;
  6778. Laya.stage.screenMode = GameConfig.screenMode;
  6779. Laya.stage.alignV = GameConfig.alignV;
  6780. Laya.stage.alignH = GameConfig.alignH;
  6781. Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson;
  6782. if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true")
  6783. Laya.enableDebugPanel();
  6784. if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"])
  6785. Laya["PhysicsDebugDraw"].enable();
  6786. if (GameConfig.stat)
  6787. Laya.Stat.show();
  6788. Laya.alertGlobalError = true;
  6789. GameVersion.isWx = Laya.Browser.onWeiXin;
  6790. if (GameVersion.isWx) {
  6791. WXSdk.init();
  6792. }
  6793. Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
  6794. WXSdk.IsNeedUpdate();
  6795. }
  6796. onVersionLoaded() {
  6797. Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
  6798. Laya.MouseManager.multiTouchEnabled = false;
  6799. }
  6800. onConfigLoaded() {
  6801. ViewManager.Instance.OpenView(ViewType.LoadView);
  6802. GameVersion.isX = Laya.Browser.clientHeight / Laya.Browser.clientWidth > 2;
  6803. }
  6804. }
  6805. new Main();
  6806. }());
  6807. //# sourceMappingURL=bundle.js.map