bundle.js 321 KB

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