bundle.js 362 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638
  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. static randRangefloat(min, max) {
  95. var value = Math.random() * (max - min + 1) + min;
  96. if (value > max) {
  97. value = max;
  98. }
  99. return value;
  100. }
  101. }
  102. class Dictionary {
  103. constructor() {
  104. this._container = {};
  105. this._length = 0;
  106. }
  107. get container() {
  108. return this._container;
  109. }
  110. get size() {
  111. return this._length;
  112. }
  113. set(key, value) {
  114. if (!this._container.hasOwnProperty(key)) {
  115. this._length++;
  116. }
  117. this._container[key] = value;
  118. }
  119. delete(key) {
  120. if (this._container.hasOwnProperty(key)) {
  121. delete this._container[key];
  122. this._length--;
  123. }
  124. }
  125. has(key) {
  126. return this._container.hasOwnProperty(key) ? true : false;
  127. }
  128. get(key) {
  129. if (this._container.hasOwnProperty(key)) {
  130. return this._container[key];
  131. }
  132. else {
  133. return undefined;
  134. }
  135. }
  136. clear() {
  137. this._container = {};
  138. this._length = 0;
  139. }
  140. }
  141. class DispatcherManager {
  142. static get Disispatcher() {
  143. return DispatcherManager.disispatcher || (DispatcherManager.disispatcher = new Laya.EventDispatcher());
  144. }
  145. static on(type, call, data) {
  146. this.Disispatcher.on(type, call, data);
  147. }
  148. static off(type, call, data) {
  149. this.Disispatcher.off(type, call, data);
  150. }
  151. static event(type, data = null) {
  152. this.Disispatcher.event(type, data);
  153. }
  154. }
  155. class EventType {
  156. loadUI() {
  157. Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
  158. var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "正常模式"));
  159. changeActionButton.size(160, 40);
  160. changeActionButton.labelBold = true;
  161. changeActionButton.labelSize = 30;
  162. changeActionButton.sizeGrid = "4,4,4,4";
  163. changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
  164. changeActionButton.pos(Laya.stage.width / 2 - changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
  165. changeActionButton.on(Laya.Event.CLICK, this, function () {
  166. if (++this.curStateIndex % 2 == 1) {
  167. this.sprite3D.active = false;
  168. this.lineSprite3D.active = true;
  169. changeActionButton.label = "网格模式";
  170. }
  171. else {
  172. this.sprite3D.active = true;
  173. this.lineSprite3D.active = false;
  174. changeActionButton.label = "正常模式";
  175. }
  176. });
  177. }));
  178. }
  179. }
  180. EventType.Event = {
  181. CamFollowArg: "CamFollowArg",
  182. SetAimPos: "SetAimPos",
  183. RefreshBulletCount: "RefreshBulletCount",
  184. RefreshRemainEnemyCount: "RefreshRemainEnemyCount",
  185. GameShowTips: "GameShowTips",
  186. StartShot: 'StartShot',
  187. StopShot: 'StopShot',
  188. ShowMainUi: "ShowMainUi",
  189. SetMonery: "SetMonery",
  190. SetStage: "SetStage",
  191. SetStagePro: "SetStagePro"
  192. };
  193. class GameVersion {
  194. }
  195. GameVersion.VER = "1.0.11";
  196. GameVersion.CFG = "CFG";
  197. GameVersion.wxValue = "";
  198. GameVersion.isX = false;
  199. GameVersion.mSharePeopleScene = null;
  200. var Particle2D = Laya.Particle2D;
  201. var SoundType;
  202. (function (SoundType) {
  203. SoundType[SoundType["hit"] = 0] = "hit";
  204. SoundType[SoundType["click"] = 1] = "click";
  205. SoundType[SoundType["win"] = 2] = "win";
  206. SoundType[SoundType["defeat"] = 3] = "defeat";
  207. })(SoundType || (SoundType = {}));
  208. class SettingController {
  209. constructor() {
  210. this.vibrate = true;
  211. this.sound = true;
  212. this.SoundType = {
  213. click: "subpackage1/sound/click.mp3",
  214. win: "subpackage1/sound/vector.mp3",
  215. defeat: "subpackage1/sound/defeat.mp3",
  216. car_crush_1: "subpackage1/sound/car_crush_1.mp3",
  217. car_crush_2: "subpackage1/sound/car_crush_2.mp3",
  218. car_crush_3: "subpackage1/sound/car_crush_3.mp3",
  219. explotion1: "subpackage1/sound/explotion1.mp3",
  220. explotion2: "subpackage1/sound/explotion2.mp3",
  221. gun_fire_1: "subpackage1/sound/gun_fire_1.mp3",
  222. gun_fire_2: "subpackage1/sound/gun_fire_2.mp3",
  223. gun_fire_3: "subpackage1/sound/gun_fire_3.mp3",
  224. reload_gun_1: "subpackage1/sound/reload_gun_1.mp3",
  225. reload_gun_2: "subpackage1/sound/reload_gun_2.mp3",
  226. hitcar: "subpackage1/sound/hitcar.mp3",
  227. hitrole: "subpackage1/sound/hitrole.mp3",
  228. hit: "subpackage1/sound/hit.mp3"
  229. };
  230. this.bgm = "subpackage1/sound/bgm.mp3";
  231. }
  232. static get Instance() {
  233. return this.instasnce || (this.instasnce = new SettingController());
  234. }
  235. onAssetsLoaded(settings) {
  236. this.sp = new Particle2D(settings);
  237. this.sp.emitter.start();
  238. this.sp.play();
  239. Laya.stage.addChild(this.sp);
  240. this.sp.x = Laya.stage.width / 2;
  241. this.sp.y = Laya.stage.height / 2;
  242. }
  243. SettingSound(value) {
  244. }
  245. _playMusic(on) {
  246. }
  247. SetSoundV(value) {
  248. }
  249. PlaySound(type) {
  250. }
  251. StopSound(type) {
  252. }
  253. Init() {
  254. var v = Laya.LocalStorage.getItem("vibrate");
  255. this.vibrate = Number(v) ? v == "1" ? true : false : true;
  256. }
  257. }
  258. class ShareModule {
  259. static GoShare(callBack) {
  260. ShareModule.ShareTime = new Date().getTime();
  261. console.log("分享点击时间=" + ShareModule.ShareTime);
  262. ShareModule.IsSharing = true;
  263. ShareModule.callback = callBack;
  264. }
  265. static OnShowHandle() {
  266. if (Laya.Browser.window.wx) {
  267. Laya.Browser.window.wx.onShow(function (option) {
  268. SettingController.Instance.SetSoundV(1);
  269. console.log("onshow share start");
  270. console.log("进入微信");
  271. if (ShareModule.IsSharing) {
  272. ShareModule.IsSharing = false;
  273. let time = new Date().getTime();
  274. console.log("分享回到游戏时间" + time);
  275. let wait = (time - ShareModule.ShareTime) / 1000;
  276. console.log("分享停留时间为:" + wait);
  277. if (wait >= 2) {
  278. if (Math.random() <= 1) {
  279. if (!ShareModule.callback)
  280. return;
  281. ShareModule.callback(true, 1);
  282. }
  283. else {
  284. if (!ShareModule.callback)
  285. return;
  286. if (Math.random() <= 0.5) {
  287. ViewManager.Instance.ShowTips("分享失败!");
  288. }
  289. else {
  290. ViewManager.Instance.ShowTips("请分享到不同的群!");
  291. }
  292. ShareModule.callback(false, 1);
  293. }
  294. }
  295. else {
  296. if (!ShareModule.callback)
  297. return;
  298. if (Math.random() <= 0.5) {
  299. ViewManager.Instance.ShowTips("分享失败!");
  300. }
  301. else {
  302. ViewManager.Instance.ShowTips("请分享到不同的群!");
  303. }
  304. ShareModule.callback(false, 1);
  305. }
  306. }
  307. });
  308. }
  309. }
  310. }
  311. ShareModule.IsSharing = false;
  312. class OnHideHandler {
  313. static Reg() {
  314. }
  315. }
  316. var Templet = Laya.Templet;
  317. var Event = Laya.Event;
  318. class NetInfoManager {
  319. constructor() {
  320. this.mStartX = 200;
  321. this.mStartY = 500;
  322. this.mActionIndex = 0;
  323. this.mCurrIndex = 0;
  324. this.mCurrSkinIndex = 0;
  325. }
  326. static get Instance() {
  327. return this.instance || (this.instance = new NetInfoManager());
  328. }
  329. GetThing(id) {
  330. if (this._thing) {
  331. return this._thing[id - 1];
  332. }
  333. return null;
  334. }
  335. GetTheme(id) {
  336. if (this._theme) {
  337. return this._theme[id - 1];
  338. }
  339. return null;
  340. }
  341. GetRoad(id) {
  342. if (this._road) {
  343. return this._road[id - 1];
  344. }
  345. return null;
  346. }
  347. GetRate(id) {
  348. if (this._rate) {
  349. return this._rate[id - 1];
  350. }
  351. return null;
  352. }
  353. GetStreet(id) {
  354. if (this._block) {
  355. return this._block[id - 1];
  356. }
  357. return null;
  358. }
  359. GetGlobal(key) {
  360. if (this._globe) {
  361. for (let index = 0; index < this._globe.length; index++) {
  362. const element = this._globe[index];
  363. if (element.key == key) {
  364. return element.value;
  365. }
  366. }
  367. }
  368. }
  369. GetLevel(id) {
  370. if (this._level) {
  371. return this._level[id - 1];
  372. }
  373. return null;
  374. }
  375. GetAtk(id) {
  376. if (this._atk) {
  377. return this._atk[id - 1];
  378. }
  379. return null;
  380. }
  381. startFun() {
  382. this.mAniPath = "res/spine/spineRes5/vine.sk";
  383. this.mFactory = new Templet();
  384. this.mFactory.on(Event.COMPLETE, this, this.parseComplete);
  385. this.mFactory.on(Event.ERROR, this, this.onError);
  386. this.mFactory.loadAni(this.mAniPath);
  387. }
  388. onError() {
  389. console.log("error");
  390. }
  391. parseComplete() {
  392. this.mArmature = this.mFactory.buildArmature(1);
  393. this.mArmature.x = this.mStartX;
  394. this.mArmature.y = this.mStartY;
  395. this.mArmature.scale(0.5, 0.5);
  396. Laya.stage.addChild(this.mArmature);
  397. this.mArmature.on(Event.STOPPED, this, this.completeHandler);
  398. this.play();
  399. }
  400. completeHandler() {
  401. this.play();
  402. }
  403. play() {
  404. this.mCurrIndex++;
  405. if (this.mCurrIndex >= this.mArmature.getAnimNum()) {
  406. this.mCurrIndex = 0;
  407. }
  408. this.mArmature.play(this.mCurrIndex, false);
  409. }
  410. }
  411. class AssetPath {
  412. loadUI() {
  413. Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
  414. var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "切换注视目标"));
  415. changeActionButton.size(200, 40);
  416. changeActionButton.labelBold = true;
  417. changeActionButton.labelSize = 30;
  418. changeActionButton.sizeGrid = "4,4,4,4";
  419. changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
  420. changeActionButton.pos(Laya.stage.width / 2 - changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
  421. changeActionButton.on(Laya.Event.CLICK, this, function () {
  422. this.index++;
  423. if (this.index % 3 === 1) {
  424. this.camera.transform.lookAt(this.box.transform.position, this.upVector);
  425. }
  426. else if (this.index % 3 === 2) {
  427. this.camera.transform.lookAt(this.cylinder.transform.position, this.upVector);
  428. }
  429. else {
  430. this.camera.transform.lookAt(this.capsule.transform.position, this.upVector);
  431. }
  432. });
  433. }));
  434. }
  435. }
  436. AssetPath.MainScene = "subpackage/LayaScene_MainScene/Conventional/main.ls";
  437. AssetPath.Player = ["subpackage/LayaScene_Character/Conventional/Character1.lh",
  438. "subpackage/LayaScene_Character/Conventional/Character2.lh",
  439. "subpackage/LayaScene_Character/Conventional/Character3.lh",
  440. "subpackage/LayaScene_Character/Conventional/Character4.lh",
  441. "subpackage/LayaScene_Character/Conventional/Character5.lh",
  442. "subpackage/LayaScene_Character/Conventional/Character6.lh",
  443. "subpackage/LayaScene_Character/Conventional/Character7.lh",
  444. "subpackage/LayaScene_Character/Conventional/Character8.lh",
  445. ];
  446. AssetPath.Enemy = "subpackage/LayaScene_Character/Conventional/enemy.lh";
  447. AssetPath.PlayerShot = "subpackage/LayaScene_Property/Conventional/PlayerShoot.lh";
  448. AssetPath.Mound = "subpackage/LayaScene_Property/Conventional/Mound.lh";
  449. AssetPath.Barrier = [
  450. "subpackage/LayaScene_barrier/Conventional/barrier_1.lh",
  451. "subpackage/LayaScene_barrier/Conventional/barrier_2.lh",
  452. "subpackage/LayaScene_barrier/Conventional/barrier_3.lh",
  453. "subpackage/LayaScene_barrier/Conventional/barrier_4.lh",
  454. "subpackage/LayaScene_barrier/Conventional/move_barrier.lh",
  455. "subpackage/LayaScene_barrier/Conventional/stone_1.lh",
  456. "subpackage/LayaScene_barrier/Conventional/stone_2.lh",
  457. "subpackage/LayaScene_barrier/Conventional/stone_3.lh",
  458. "subpackage/LayaScene_barrier/Conventional/stone_4.lh",
  459. "subpackage/LayaScene_barrier/Conventional/Block1.lh",
  460. ];
  461. AssetPath.Particle = [
  462. "subpackage/LayaScene_Particle/Conventional/Explode.lh",
  463. "subpackage/LayaScene_Particle/Conventional/Hit.lh",
  464. "subpackage/LayaScene_Particle/Conventional/Blood.lh",
  465. ];
  466. AssetPath.Config = {
  467. level: "level",
  468. road: "road",
  469. block: "block",
  470. thing: "thing",
  471. atk: "atk",
  472. rate: "rate",
  473. global: "global",
  474. theme: "theme"
  475. };
  476. class AppSetting {
  477. constructor() {
  478. this._outHitResult = new Laya.HitResult();
  479. this.outs = new Array();
  480. this.posX = 0.0;
  481. this.posY = 0.0;
  482. this.point = new Laya.Vector2();
  483. }
  484. addBoxXYZ(x, y, z) {
  485. var mat1 = new Laya.BlinnPhongMaterial();
  486. Laya.Texture2D.load("res/threeDimen/Physics/rocks.jpg", Laya.Handler.create(null, function (tex) {
  487. mat1.albedoTexture = tex;
  488. }));
  489. var sX = Math.random() * 0.75 + 0.25;
  490. var sY = Math.random() * 0.75 + 0.25;
  491. var sZ = Math.random() * 0.75 + 0.25;
  492. var box = new Laya.MeshSprite3D(Laya.PrimitiveMesh.createBox(sX, sY, sZ));
  493. this.scene.addChild(box);
  494. box.meshRenderer.material = mat1;
  495. this.tmpVector.setValue(x, y, z);
  496. box.transform.position = this.tmpVector;
  497. this.tmpVector.setValue(Math.random() * 360, Math.random() * 360, Math.random() * 360);
  498. box.transform.rotationEuler = this.tmpVector;
  499. var rigidBody = box.addComponent(Laya.Rigidbody3D);
  500. var boxShape = new Laya.BoxColliderShape(sX, sY, sZ);
  501. rigidBody.colliderShape = boxShape;
  502. rigidBody.mass = 10;
  503. }
  504. }
  505. AppSetting.moveTime = 1;
  506. var TiledMap = Laya.TiledMap;
  507. var Rectangle = Laya.Rectangle;
  508. var Browser = Laya.Browser;
  509. var Handler = Laya.Handler;
  510. class PlayerManager {
  511. constructor() {
  512. this.stage = 1;
  513. this.equipId = 1;
  514. this.mLastMouseX = 0;
  515. this.mLastMouseY = 0;
  516. this.mX = 0;
  517. this.mY = 0;
  518. }
  519. static get Instance() {
  520. return PlayerManager.instance || (PlayerManager.instance = new PlayerManager());
  521. }
  522. static GlobalMessage() {
  523. PlayerManager.tower_reward = Number(NetInfoManager.Instance.GetGlobal("tower_reward"));
  524. PlayerManager.block_reward = Number(NetInfoManager.Instance.GetGlobal("block_reward"));
  525. PlayerManager.enemy_reward = Number(NetInfoManager.Instance.GetGlobal("enemy_reward"));
  526. }
  527. InitPlayer() {
  528. var usermodel = UserModel.Instance.CurModel;
  529. PlayerManager.instance.stage = (Number(usermodel.GetUserAttr(UserAttr.stage)) + 1);
  530. PlayerManager.instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
  531. this.SetInfo();
  532. }
  533. SpeedUp(level, chanel, count, callback) {
  534. let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "rate" }, { "level": level }, { "channel": chanel }, { "amount": count }];
  535. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {
  536. if (callback)
  537. callback(true);
  538. }, (data) => {
  539. if (callback)
  540. callback(false);
  541. });
  542. }
  543. SetInfo() {
  544. let power = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["power"];
  545. if (power)
  546. this.powerLevel = Number(power);
  547. else
  548. this.powerLevel = 1;
  549. let al = NetInfoManager.Instance._atk.length;
  550. let t = this.powerLevel > al ? al : this.powerLevel;
  551. PlayerManager.bulletAttack = NetInfoManager.Instance.GetAtk(t)["atk"];
  552. let rate = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["rate"];
  553. if (rate)
  554. this.rateLevel = Number(rate);
  555. else
  556. this.rateLevel = 1;
  557. let al1 = NetInfoManager.Instance._rate.length;
  558. let t1 = this.rateLevel > al1 ? al1 : this.rateLevel;
  559. PlayerManager.bulletTime = NetInfoManager.Instance.GetRate(t1)["rate"];
  560. }
  561. createMap() {
  562. this.tiledMap = new TiledMap();
  563. this.mX = this.mY = 0;
  564. this.tiledMap.createMap("res/tiledMap/desert.json", new Rectangle(0, 0, Browser.width, Browser.height), new Handler(this, this.completeHandler));
  565. }
  566. completeHandler() {
  567. console.log("地图创建完成");
  568. console.log("ClientW:" + Browser.clientWidth + " ClientH:" + Browser.clientHeight);
  569. Laya.stage.on(Laya.Event.RESIZE, this, this.resize);
  570. this.resize();
  571. }
  572. mouseDown() {
  573. this.mLastMouseX = Laya.stage.mouseX;
  574. this.mLastMouseY = Laya.stage.mouseY;
  575. Laya.stage.on(Laya.Event.MOUSE_MOVE, this, this.mouseMove);
  576. }
  577. mouseMove() {
  578. this.tiledMap.moveViewPort(this.mX - (Laya.stage.mouseX - this.mLastMouseX), this.mY - (Laya.stage.mouseY - this.mLastMouseY));
  579. }
  580. mouseUp() {
  581. this.mX = this.mX - (Laya.stage.mouseX - this.mLastMouseX);
  582. this.mY = this.mY - (Laya.stage.mouseY - this.mLastMouseY);
  583. Laya.stage.off(Laya.Event.MOUSE_MOVE, this, this.mouseMove);
  584. }
  585. resize() {
  586. this.tiledMap.changeViewPort(this.mX, this.mY, Browser.width, Browser.height);
  587. }
  588. PowerUp(level, chanel, count, callback) {
  589. let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "power" }, { "level": level }, { "channel": chanel }, { "amount": count }];
  590. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {
  591. if (callback)
  592. callback(true);
  593. }, (data) => {
  594. if (callback)
  595. callback(false);
  596. });
  597. }
  598. }
  599. PlayerManager.bulletAttack = 1;
  600. PlayerManager.bulletTime = 0.3;
  601. class GlobalParam {
  602. }
  603. GlobalParam.playerRayLengthF = 1.3;
  604. GlobalParam.playerRayLengthLR = 0.3;
  605. GlobalParam.bulletRayLength = 1;
  606. GlobalParam.bulletMaxDis = 40;
  607. GlobalParam.barrierRoadLength = 50;
  608. GlobalParam.barrierRoadAverageNum = 50;
  609. GlobalParam.playerspeed = 0.1;
  610. GlobalParam.matespeed = 0.2;
  611. GlobalParam.hitmaxcount = 2;
  612. GlobalParam.boommaxcount = 2;
  613. GlobalParam.blockLRmoveMaxDis = 5;
  614. GlobalParam.arriveStandWidth = 5;
  615. GlobalParam.enemySpeed = 0.1;
  616. GlobalParam.shootspeed = 0.8;
  617. GlobalParam.sliderFactor = 0.02;
  618. GlobalParam.playerMoveMaxX = 4.5;
  619. var Sprite = Laya.Sprite;
  620. var Event$1 = Laya.Event;
  621. var SoundManager = Laya.SoundManager;
  622. var Handler$1 = Laya.Handler;
  623. class UserInfoManager {
  624. static GameInfo() {
  625. PlayerManager.Instance.InitPlayer();
  626. }
  627. static SetCfg(cfg) {
  628. NetInfoManager.Instance._level = cfg[AssetPath.Config.level];
  629. NetInfoManager.Instance._road = cfg[AssetPath.Config.road];
  630. NetInfoManager.Instance._block = cfg[AssetPath.Config.block];
  631. NetInfoManager.Instance._thing = cfg[AssetPath.Config.thing];
  632. NetInfoManager.Instance._atk = cfg[AssetPath.Config.atk];
  633. NetInfoManager.Instance._rate = cfg[AssetPath.Config.rate];
  634. NetInfoManager.Instance._theme = cfg[AssetPath.Config.theme];
  635. NetInfoManager.Instance._globe = cfg[AssetPath.Config.global];
  636. PlayerManager.GlobalMessage();
  637. }
  638. setup() {
  639. var gap = 10;
  640. var soundButton = this.createButton("播放音效");
  641. soundButton.x = (Laya.stage.width - soundButton.width * 2 + gap) / 2;
  642. soundButton.y = (Laya.stage.height - soundButton.height) / 2;
  643. Laya.stage.addChild(soundButton);
  644. var musicButton = this.createButton("播放音乐");
  645. musicButton.x = soundButton.x + gap + soundButton.width;
  646. musicButton.y = soundButton.y;
  647. Laya.stage.addChild(musicButton);
  648. soundButton.on(Event$1.CLICK, this, this.onPlaySound);
  649. musicButton.on(Event$1.CLICK, this, this.onPlayMusic);
  650. }
  651. createButton(label) {
  652. var w = 110;
  653. var h = 40;
  654. var button = new Sprite();
  655. button.size(w, h);
  656. button.graphics.drawRect(0, 0, w, h, "#FF7F50");
  657. button.graphics.fillText(label, w / 2, 8, "25px SimHei", "#FFFFFF", "center");
  658. Laya.stage.addChild(button);
  659. return button;
  660. }
  661. onPlayMusic(e) {
  662. console.log("播放音乐");
  663. SoundManager.playMusic("res/sounds/bgm.mp3", 1, new Handler$1(this, this.onComplete));
  664. }
  665. onPlaySound(e) {
  666. console.log("播放音效");
  667. SoundManager.playSound("res/sounds/btn.mp3", 1, new Handler$1(this, this.onComplete));
  668. }
  669. onComplete() {
  670. console.log("播放完成");
  671. }
  672. static Appseting(data) {
  673. AppSetting.shareimage = data["shareimage"];
  674. AppSetting.sharetitle = data["sharetitle"];
  675. AppSetting.bannerCanMove = Number(data["bannerCanMove"]);
  676. AppSetting.moveTime = Number(data["moveTime"]);
  677. AppSetting.OpenSceneValue = Number(data["OpenSceneValue"]);
  678. AppSetting.freeUpdateVideotime = Number(data["freeUpdateVideotime"]);
  679. AppSetting.freecoinValue = Number(data["freecoinValue"]);
  680. AppSetting.freeGetcoinTime = Number(data["freeGetcoinTime"]);
  681. AppSetting.cheat = data["cheat"];
  682. AppSetting.cheattime = data["cheattime"];
  683. AppSetting.checkscene = data["checkscene"];
  684. GlobalParam.playerspeed = Number(data["playerspeed"]);
  685. GlobalParam.matespeed = Number(data["friendspeed"]);
  686. GlobalParam.shootspeed = Number(data["bulletspeed"]);
  687. GlobalParam.sliderFactor = Number(data["sliderFactor"]);
  688. GlobalParam.playerMoveMaxX = Number(data["playerMoveMaxX"]);
  689. GlobalParam.playerRayLengthF = Number(data["playerRayLengthF"]);
  690. GlobalParam.playerRayLengthLR = Number(data["playerRayLengthLR"]);
  691. GlobalParam.bulletRayLength = Number(data["bulletRayLength"]);
  692. GlobalParam.bulletMaxDis = Number(data["bulletMaxDis"]);
  693. GlobalParam.barrierRoadLength = Number(data["barrierRoadLength"]);
  694. GlobalParam.barrierRoadAverageNum = Number(data["barrierRoadAverageNum"]);
  695. GlobalParam.hitmaxcount = Number(data["hitmaxcount"]);
  696. GlobalParam.boommaxcount = Number(data["boommaxcount"]);
  697. GlobalParam.blockLRmoveMaxDis = Number(data["blockLRmoveMaxDis"]);
  698. GlobalParam.arriveStandWidth = Number(data["arriveStandWidth"]);
  699. GlobalParam.enemySpeed = Number(data["enemySpeed"]);
  700. }
  701. static get Cheat() {
  702. return AppSetting.cheat == "1";
  703. }
  704. static get CheatTime() {
  705. return Number(AppSetting.cheattime);
  706. }
  707. static get CheckScene() {
  708. return AppSetting.checkscene == "1";
  709. }
  710. }
  711. var Event$2 = Laya.Event;
  712. var HttpRequest = Laya.HttpRequest;
  713. const PROTOCOL_URL = "https://gungangfengyunapi.xwxgame.com/";
  714. class PROTOCOLS {
  715. }
  716. PROTOCOLS.protocols = {
  717. Login: "user/login",
  718. Userauth: "user/auth",
  719. BuyLand: "shop/land",
  720. UserSync: "user/sync",
  721. ShopBuild: "shop/build",
  722. ShopUpgrade: "shop/upgrade",
  723. ShopSale: "shop/sale",
  724. RoleUpgrade: "role/upgrade",
  725. Fissionvd: "fission/vd",
  726. DailyTaskrefresh: "dailytask/refresh",
  727. DailyTaskrewards: "dailytask/rewards",
  728. Rankingvmoney: "ranking/vmoney",
  729. Lotterylottery: "lottery/lottery",
  730. AchievementgetRewards: "achievement/getRewards",
  731. Fissiondeduct: "fission/deduct",
  732. Sign: "sign/sign",
  733. InvitegetRewards: "invite/getRewards",
  734. InvitetargetRewards: "invite/targetRewards",
  735. GameResult: "game/play",
  736. Easter: "game/revival",
  737. GetCfg: "config/table",
  738. DoubleAward: "fission/vd",
  739. KunDiscard: "kun/discard",
  740. KunEquip: "kun/equip",
  741. KunMove: "kun/move",
  742. KunBuy: "kun/buy",
  743. Opentreasure: "treasure/open",
  744. Entertreasure: "treasure/enter",
  745. Buy: "theme/buy",
  746. Equip: "theme/equip",
  747. themefission: "theme/fission",
  748. Start: "game/start",
  749. UpgradeAttr: "attr/upgrade"
  750. };
  751. class NetManager {
  752. PostTokenRequest(protocol, completecb, errorcb, isload = true) {
  753. let args = "";
  754. let url = PROTOCOL_URL + protocol;
  755. args = args = `token=${UserModel.Instance.CurModel.m_token}`;
  756. let httpRequest = new HttpRequest();
  757. httpRequest.once(Event$2.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
  758. httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
  759. httpRequest.send(url, args, "post", "text");
  760. if (isload) {
  761. WXSdk.ShowLoading("");
  762. }
  763. }
  764. onHttpRequestComplete(succeedcb, failurecb, httpRequest, isload) {
  765. let data;
  766. if (isload) {
  767. WXSdk.HideLoading();
  768. }
  769. data = JSON.parse(httpRequest.data);
  770. console.log("请求成功:" + JSON.stringify(data));
  771. if (data["code"] == 0) {
  772. UserModel.Instance.RefreshModel(data);
  773. if (succeedcb != null) {
  774. succeedcb(data);
  775. }
  776. }
  777. else {
  778. if (failurecb != null) {
  779. var mess = GameTool.SpliteString(data["message"], ",")[0];
  780. failurecb(mess);
  781. }
  782. }
  783. }
  784. onHttpRequestError(errorcb, httpRequest, isload) {
  785. if (errorcb != null) {
  786. var data = JSON.parse(httpRequest.data);
  787. errorcb(data);
  788. }
  789. console.log("Error! Http request error, code: " + data);
  790. if (isload) {
  791. WXSdk.HideLoading();
  792. }
  793. }
  794. static get Instance() {
  795. return NetManager.instance || (NetManager.instance = new NetManager());
  796. }
  797. login(progresscb, completecb, errorcb) {
  798. console.log("发送登录请求");
  799. var userInfor = UserModel.Instance;
  800. var ver = GameVersion.VER;
  801. 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}`;
  802. console.log("登录 参数: " + args);
  803. let httpRequest = new HttpRequest();
  804. httpRequest.once(Event$2.PROGRESS, this, this.onHttpRequestProgress, [progresscb, httpRequest]);
  805. httpRequest.once(Event$2.COMPLETE, this, this.onLoginRequestComplete, [completecb, httpRequest]);
  806. httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
  807. httpRequest.send(PROTOCOL_URL + PROTOCOLS.protocols.Login, args, "post", "text");
  808. }
  809. onHttpRequestProgress() {
  810. }
  811. onLoginRequestComplete(completecb, httpRequest) {
  812. let data = JSON.parse(httpRequest.data);
  813. console.log(data);
  814. console.log("登录完成");
  815. if (data["code"] != "0") {
  816. var errInfo = JSON.stringify(httpRequest.data);
  817. console.log("登录异常错误!错误信息:", errInfo);
  818. completecb(data);
  819. return;
  820. }
  821. 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"]));
  822. UserInfoManager.Appseting(data["app_setting"]);
  823. var ver = data["table_version"];
  824. UserModel.Instance.CurModel.JundgCfg(ver, (c) => {
  825. if (c) {
  826. UserInfoManager.GameInfo();
  827. completecb(data);
  828. }
  829. });
  830. WXSdk.ShareMessage();
  831. }
  832. PostCfgRequest(completecb, errorcb) {
  833. let args = "";
  834. let url = PROTOCOL_URL + PROTOCOLS.protocols.GetCfg;
  835. args = `token=${UserModel.Instance.CurModel.m_token}`;
  836. let httpRequest = new HttpRequest();
  837. httpRequest.once(Event$2.COMPLETE, this, () => {
  838. var data = JSON.parse(httpRequest.data);
  839. if (data["code"] == 0) {
  840. if (completecb != null) {
  841. if (data["configs"]) {
  842. completecb(data["configs"]);
  843. }
  844. }
  845. }
  846. else {
  847. if (errorcb != null) {
  848. errorcb(data);
  849. }
  850. }
  851. });
  852. httpRequest.once(Event$2.ERROR, this, () => {
  853. var data = JSON.parse(httpRequest.data);
  854. if (errorcb != null) {
  855. errorcb(data);
  856. }
  857. });
  858. httpRequest.send(url, args, "post", "text");
  859. }
  860. HttpPostRequest(protocol, param, completecb, errorcb, hasToken = true, isload = true) {
  861. let args = "";
  862. let url = PROTOCOL_URL + protocol;
  863. if (hasToken == true) {
  864. args = `token=${UserModel.Instance.CurModel.m_token}&`;
  865. }
  866. if (protocol == PROTOCOLS.protocols.UserSync || protocol == PROTOCOLS.protocols.Fissionvd || protocol == PROTOCOLS.protocols.Lotterylottery
  867. || protocol == PROTOCOLS.protocols.Fissiondeduct || protocol == PROTOCOLS.protocols.KunBuy || protocol == PROTOCOLS.protocols.KunDiscard
  868. || protocol == PROTOCOLS.protocols.KunEquip || protocol == PROTOCOLS.protocols.KunMove || protocol == PROTOCOLS.protocols.Start || protocol == PROTOCOLS.protocols.GameResult
  869. || protocol == PROTOCOLS.protocols.themefission || protocol == PROTOCOLS.protocols.Opentreasure || protocol == PROTOCOLS.protocols.UpgradeAttr) {
  870. let str = "abcdefghijkimnopqrstuvwxyz0123456789";
  871. let code = "{";
  872. let mask = "";
  873. for (let i = 0; i < 4; i++) {
  874. mask += str[Math.floor(Math.random() * 100) % str.length];
  875. }
  876. for (let i = 0; i < param.length; i++) {
  877. for (let key in param[i]) {
  878. code += "\"" + key + "\":";
  879. if (typeof param[i][key] === 'string') {
  880. code += "\"" + param[i][key] + "\"";
  881. }
  882. else {
  883. code += param[i][key];
  884. }
  885. }
  886. if (i < param.length - 1) {
  887. code += ",";
  888. }
  889. else {
  890. code += "}";
  891. }
  892. }
  893. args += "_r=" + mask + GameTool.get64Encode(code);
  894. }
  895. else {
  896. if (param != null) {
  897. for (let i = 0; i < param.length; i++) {
  898. for (let key in param[i]) {
  899. let val = param[i][key];
  900. args += `${key}=${val}`;
  901. if (i < param.length - 1) {
  902. args += "&";
  903. }
  904. }
  905. }
  906. }
  907. }
  908. let httpRequest = new HttpRequest();
  909. httpRequest.once(Event$2.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
  910. httpRequest.once(Event$2.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest, isload]);
  911. httpRequest.send(url, args, "post", "text");
  912. if (isload) {
  913. WXSdk.ShowLoading("");
  914. }
  915. }
  916. static errorRequest(arg, callback) {
  917. let httpRequest = new Laya.HttpRequest();
  918. if (callback) {
  919. httpRequest.once(Laya.Event.PROGRESS, this, () => { callback.progress && callback.progress(httpRequest); });
  920. httpRequest.once(Laya.Event.ERROR, this, () => { callback.error && callback.error(httpRequest); });
  921. httpRequest.once(Laya.Event.COMPLETE, this, () => { callback.complete && callback.complete(httpRequest); });
  922. }
  923. httpRequest.send("https://r.94xj.net/e", arg, "post", "json", ["Content-Type", "application/json"]);
  924. }
  925. static ErrorReport() {
  926. let arg = {
  927. "code": 1003,
  928. "msg": "invalid code",
  929. "user_id": 0,
  930. "game": "parkourrace",
  931. "type": "backend",
  932. "platform": "weixin"
  933. };
  934. this.errorRequest(arg, {
  935. complete: (request) => {
  936. },
  937. error: (request) => {
  938. }
  939. });
  940. }
  941. }
  942. var UserConfigName;
  943. (function (UserConfigName) {
  944. UserConfigName[UserConfigName["train"] = 0] = "train";
  945. UserConfigName[UserConfigName["sign"] = 1] = "sign";
  946. UserConfigName[UserConfigName["rewards"] = 2] = "rewards";
  947. })(UserConfigName || (UserConfigName = {}));
  948. var UserAttr;
  949. (function (UserAttr) {
  950. UserAttr[UserAttr["user_id"] = 0] = "user_id";
  951. UserAttr[UserAttr["diamond"] = 1] = "diamond";
  952. UserAttr[UserAttr["energy"] = 2] = "energy";
  953. UserAttr[UserAttr["list_kun"] = 3] = "list_kun";
  954. UserAttr[UserAttr["stage"] = 4] = "stage";
  955. UserAttr[UserAttr["vmoney"] = 5] = "vmoney";
  956. UserAttr[UserAttr["equip_kun"] = 6] = "equip_kun";
  957. UserAttr[UserAttr["unlock_kun"] = 7] = "unlock_kun";
  958. UserAttr[UserAttr["buyed_kun"] = 8] = "buyed_kun";
  959. UserAttr[UserAttr["money"] = 9] = "money";
  960. UserAttr[UserAttr["progress_themes"] = 10] = "progress_themes";
  961. UserAttr[UserAttr["equip_themes"] = 11] = "equip_themes";
  962. UserAttr[UserAttr["get_themes"] = 12] = "get_themes";
  963. UserAttr[UserAttr["attrs"] = 13] = "attrs";
  964. })(UserAttr || (UserAttr = {}));
  965. class NetUserModel {
  966. 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) {
  967. this.loginSeverTime = 0;
  968. this.m_avatar = "";
  969. this.localTime = Laya.timer.currTimer;
  970. this.loginSeverTime = t;
  971. this.m_token = _token;
  972. this.m_user = _user;
  973. this.m_base = _userbase;
  974. this.m_invite = _useInvite;
  975. this.m_lottery = _user_lottery;
  976. this.m_treasure = _user_treasure;
  977. this.m_achievement = _user_achievement;
  978. this.m_sign = _user_sign;
  979. this.m_arena = _user_arena;
  980. this.m_shop = user_shop;
  981. this.user_video = user_video;
  982. this.user_daily_task = user_daily_task;
  983. this.m_userid = this.m_user["user_id"];
  984. this.m_openid = this.m_base["openid"];
  985. this.m_nickname = this.m_base["nickname"];
  986. this.is_new = Number(is_new);
  987. }
  988. GetUserAttr(_attr) {
  989. var attr = UserAttr[_attr];
  990. return this.m_user[attr];
  991. }
  992. get ServerTime() {
  993. let time = Laya.timer.currTimer;
  994. let stime = this.loginSeverTime + Math.ceil((time - this.localTime) / 1000);
  995. return stime;
  996. }
  997. HasTheme(_id) {
  998. var data = this.GetUserAttr(UserAttr.get_themes);
  999. for (var i = 0; i < data.length; i++) {
  1000. var hd = data[i];
  1001. if (_id == hd) {
  1002. return true;
  1003. }
  1004. }
  1005. return false;
  1006. }
  1007. GetThemeProgress(_id) {
  1008. var config = this.GetUserAttr(UserAttr.progress_themes);
  1009. var progress = config[_id] ? config[_id] : 0;
  1010. return progress;
  1011. }
  1012. JundgCfg(ver, callball) {
  1013. var cfg = Laya.LocalStorage.getJSON(GameVersion.CFG);
  1014. if (cfg) {
  1015. if (cfg.VER == ver) {
  1016. console.log("已经拥有,不用更新");
  1017. UserInfoManager.SetCfg(cfg);
  1018. callball(true);
  1019. }
  1020. else {
  1021. console.log("cfg存在但是过期了");
  1022. Laya.LocalStorage.removeItem(GameVersion.CFG);
  1023. NetManager.Instance.PostCfgRequest((data) => {
  1024. data.VER = ver;
  1025. Laya.LocalStorage.setJSON(GameVersion.CFG, data);
  1026. UserInfoManager.SetCfg(data);
  1027. callball(true);
  1028. }, (data) => {
  1029. console.log("配置获取失败" + data);
  1030. callball(false);
  1031. return;
  1032. });
  1033. }
  1034. }
  1035. else {
  1036. console.log("本地没有cfg");
  1037. NetManager.Instance.PostCfgRequest((data) => {
  1038. console.log("cfg" + data);
  1039. data.VER = ver;
  1040. Laya.LocalStorage.setJSON(GameVersion.CFG, data);
  1041. UserInfoManager.SetCfg(data);
  1042. callball(true);
  1043. }, (data) => {
  1044. console.log("配置获取失败" + data);
  1045. });
  1046. }
  1047. }
  1048. }
  1049. class UserModel {
  1050. get CurModel() {
  1051. return this.curModel;
  1052. }
  1053. constructor(code, nickname, avatar, gender, country, province, city, device, share_id, channel) {
  1054. UserModel.instance = this;
  1055. this.m_code = code;
  1056. this.m_nickname = nickname ? nickname : "";
  1057. this.m_avatar = avatar ? avatar : "";
  1058. this.m_gender = gender ? gender : 0;
  1059. this.m_city = city ? city : "";
  1060. this.m_device = device ? device : "";
  1061. this.m_share_id = share_id ? share_id : "";
  1062. this.channel = channel ? channel : "";
  1063. this.m_country = country ? country : "";
  1064. this.m_province = province ? province : "";
  1065. }
  1066. static get Instance() {
  1067. if (UserModel.instance) {
  1068. return UserModel.instance;
  1069. }
  1070. else {
  1071. UserModel.instance = new UserModel("11", "", "", 0, "", "", "", "", "", "");
  1072. return UserModel.instance;
  1073. }
  1074. }
  1075. SetUserModel(_model) {
  1076. this.curModel = _model;
  1077. }
  1078. RefreshModel(data) {
  1079. if (data["user"])
  1080. this.curModel.m_user = data["user"];
  1081. if (data["user_invite"])
  1082. this.curModel.m_invite = data["user_invite"];
  1083. if (data["user_lottery"])
  1084. this.curModel.m_lottery = data["user_lottery"];
  1085. if (data["user_achievement"]) {
  1086. this.curModel.m_achievement = data["user_achievement"];
  1087. }
  1088. if (data["user_sign"])
  1089. this.curModel.m_sign = data["user_sign"];
  1090. if (data["user_shop"])
  1091. this.curModel.m_shop = data["user_shop"];
  1092. if (data["user_daily_task"])
  1093. this.curModel.user_daily_task = data["user_daily_task"];
  1094. if (data["user_video"])
  1095. this.curModel.user_video = data["user_video"];
  1096. }
  1097. }
  1098. var ALDType;
  1099. (function (ALDType) {
  1100. ALDType[ALDType["\u767B\u5F55\u52A0\u8F7D"] = 0] = "\u767B\u5F55\u52A0\u8F7D";
  1101. ALDType[ALDType["\u754C\u9762\u5F00\u542F"] = 1] = "\u754C\u9762\u5F00\u542F";
  1102. })(ALDType || (ALDType = {}));
  1103. class WXSdk {
  1104. static get ShareId() {
  1105. return this.shareId;
  1106. }
  1107. static get Chanel() {
  1108. return this._chanel;
  1109. }
  1110. static init(cb) {
  1111. this.EventStatistics();
  1112. Laya.Browser.window.wx.showShareMenu({
  1113. withShareTicket: true
  1114. });
  1115. Laya.Browser.window.wx.onShow(this.InitWx);
  1116. }
  1117. static InitWx(option) {
  1118. var shareid = option.query.share_id;
  1119. this.shareId = shareid ? shareid : "";
  1120. GameVersion.wxValue = option.scene;
  1121. var scene = Laya.LocalStorage.getItem("scene");
  1122. if (scene) {
  1123. GameVersion.wxValue = scene;
  1124. console.log("读取配置场景值:" + scene);
  1125. }
  1126. else {
  1127. console.log("第一次拉取场景值:" + GameVersion.wxValue);
  1128. Laya.LocalStorage.setItem("scene", GameVersion.wxValue);
  1129. }
  1130. var channel = option.query.channel;
  1131. this._chanel = channel ? channel : "";
  1132. Laya.Browser.window.wx.offShow(WXSdk.InitWx);
  1133. }
  1134. static ShareMessage() {
  1135. if (!GameVersion.isWx)
  1136. return;
  1137. var t = UserModel.Instance.CurModel.ServerTime;
  1138. var _title;
  1139. var _url;
  1140. _title = AppSetting.sharetitle;
  1141. _url = AppSetting.shareimage;
  1142. if (_title == null) {
  1143. _title = "枪王之王...";
  1144. _url = "res/share.png";
  1145. }
  1146. else {
  1147. let a = GameTool.SpliteString(_title);
  1148. let b = GameTool.SpliteString(_url);
  1149. _title = a[GameTool.randomInt(0, a.length - 1)];
  1150. _url = b[GameTool.randomInt(0, b.length - 1)];
  1151. }
  1152. console.log("_title:", _title);
  1153. console.log("_url:", _url);
  1154. Laya.Browser.window.wx.onShareAppMessage(() => ({
  1155. title: _title,
  1156. imageUrl: _url,
  1157. query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_other_" + t + "_" + Math.floor(9999 * Math.random()).toString()
  1158. }));
  1159. }
  1160. static Login(cb) {
  1161. if (WXSdk.Lodining) {
  1162. return;
  1163. }
  1164. WXSdk.Lodining = true;
  1165. Laya.Browser.window.wx.login({
  1166. success: function (res) {
  1167. console.log("wx.login: success! res.code=" + res.code);
  1168. if (res.code) {
  1169. WXSdk.Lodining = false;
  1170. console.log("将要传递的参数:" + res);
  1171. cb(res);
  1172. }
  1173. else {
  1174. console.log('获取用户登录态失败!' + res.errMsg);
  1175. cb("error");
  1176. }
  1177. },
  1178. fail: function (res) { console.log("wx.login: failed, res=" + res); WXSdk.Lodining = false; cb("error"); }
  1179. });
  1180. }
  1181. static ShowLoading(title = "加载中...", isShowWx = true) {
  1182. console.log(title);
  1183. if (Laya.Browser.window && Laya.Browser.window.wx) {
  1184. if (isShowWx) {
  1185. Laya.Browser.window.wx.showLoading({ title: title, mask: true });
  1186. }
  1187. ViewManager.Instance.OpenMask();
  1188. }
  1189. else {
  1190. ViewManager.Instance.OpenMask();
  1191. }
  1192. }
  1193. static HideLoading(isShowWx = true) {
  1194. if (Laya.Browser.window && Laya.Browser.window.wx) {
  1195. if (isShowWx) {
  1196. Laya.Browser.window.wx.hideLoading();
  1197. }
  1198. ViewManager.Instance.CloseMask();
  1199. }
  1200. else {
  1201. ViewManager.Instance.CloseMask();
  1202. }
  1203. }
  1204. static SystemInfo() {
  1205. if (Laya.Browser.window.wx) {
  1206. if (!WXSdk.sysdata)
  1207. WXSdk.sysdata = Laya.Browser.window.wx.getSystemInfoSync();
  1208. return WXSdk.sysdata;
  1209. }
  1210. }
  1211. static ShowToast(text, icon = true) {
  1212. if (Laya.Browser.window.wx) {
  1213. var t_icon = icon ? "success" : "none";
  1214. text = text ? text : "暂未开放...";
  1215. Laya.Browser.window.wx.showToast({ title: text, icon: t_icon });
  1216. }
  1217. else {
  1218. console.log(text);
  1219. }
  1220. }
  1221. static ShortVibrate() {
  1222. if (Laya.Browser.window.wx && SettingController.Instance.vibrate) {
  1223. if (WXSdk.vibrating)
  1224. return;
  1225. WXSdk.vibrating = true;
  1226. Laya.Browser.window.wx.vibrateShort({
  1227. complete: function (res) {
  1228. WXSdk.vibrating = false;
  1229. }
  1230. });
  1231. }
  1232. }
  1233. static LongVibrate() {
  1234. if (Laya.Browser.window.wx && SettingController.Instance.vibrate) {
  1235. if (WXSdk.vibrating)
  1236. return;
  1237. WXSdk.vibrating = true;
  1238. Laya.Browser.window.wx.vibrateLong({
  1239. complete: function (res) {
  1240. WXSdk.vibrating = false;
  1241. }
  1242. });
  1243. }
  1244. }
  1245. static Success(stageId) {
  1246. if (!GameVersion.isWx)
  1247. return;
  1248. Laya.Browser.window.wx.aldStage.onEnd({
  1249. stageId: stageId,
  1250. stageName: "第" + stageId + "关",
  1251. event: "complete",
  1252. params: {
  1253. desc: "关卡完成"
  1254. }
  1255. });
  1256. }
  1257. static AldEvent(eventName, a) {
  1258. if (Laya.Browser.window && Laya.Browser.window.wx) {
  1259. Laya.Browser.window.wx.aldSendEvent(eventName, { key: "" });
  1260. }
  1261. }
  1262. static EventStatistics() {
  1263. let uuid = Laya.LocalStorage.getItem("uuidTimes");
  1264. if (uuid) {
  1265. let lastSignTime = new Date(Number(uuid));
  1266. let todayZero = new Date(Laya.timer.currTimer);
  1267. todayZero.setHours(0, 0, 0, 0);
  1268. if (lastSignTime.valueOf() < todayZero.valueOf()) {
  1269. this.IsNew = 0;
  1270. }
  1271. else {
  1272. this.IsNew = 1;
  1273. }
  1274. }
  1275. else {
  1276. this.IsNew = 1;
  1277. Laya.LocalStorage.setItem("uuidTimes", Laya.timer.currTimer.toString());
  1278. }
  1279. }
  1280. static Fail(stageId) {
  1281. if (!GameVersion.isWx)
  1282. return;
  1283. Laya.Browser.window.wx.aldStage.onEnd({
  1284. stageId: stageId,
  1285. stageName: "第" + stageId + "关",
  1286. event: "fail",
  1287. params: {
  1288. desc: "关卡失败",
  1289. }
  1290. });
  1291. }
  1292. static Start(stageId) {
  1293. if (!GameVersion.isWx)
  1294. return;
  1295. Laya.Browser.window.wx.aldStage.onStart({
  1296. stageId: stageId,
  1297. stageName: "第" + stageId + "关",
  1298. });
  1299. }
  1300. static Game_Share(callback = null, channel = "") {
  1301. if (!GameVersion.isWx) {
  1302. return;
  1303. }
  1304. var _title;
  1305. var _url;
  1306. _title = AppSetting.sharetitle;
  1307. _url = AppSetting.shareimage;
  1308. if (_title == null) {
  1309. _title = "枪王之王...";
  1310. _url = "res/share.png";
  1311. }
  1312. else {
  1313. let a = GameTool.SpliteString(_title);
  1314. let b = GameTool.SpliteString(_url);
  1315. _title = a[GameTool.randomInt(0, a.length - 1)];
  1316. _url = b[GameTool.randomInt(0, b.length - 1)];
  1317. }
  1318. console.log("_title:", _title);
  1319. console.log("_url:", _url);
  1320. var t = UserModel.Instance.CurModel.ServerTime;
  1321. Laya.Browser.window.wx.shareAppMessage({
  1322. title: _title,
  1323. imageUrl: _url,
  1324. query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_" + "other" + "_" + t + "_" + Math.floor(9999 * Math.random()).toString(),
  1325. });
  1326. ShareModule.GoShare(callback);
  1327. }
  1328. static LoadSubPackage(name, callback) {
  1329. if (GameVersion.isWx) {
  1330. const loadTask = Laya.Browser.window.wx.loadSubpackage({
  1331. name: name,
  1332. success(res) {
  1333. console.log("分包下载成功:", res);
  1334. if (callback)
  1335. callback(true);
  1336. },
  1337. fail(res) {
  1338. console.log("分包下载失败:" + JSON.stringify(res));
  1339. if (callback)
  1340. callback(false);
  1341. }
  1342. });
  1343. }
  1344. else {
  1345. if (callback)
  1346. callback(true);
  1347. }
  1348. }
  1349. static IsNeedUpdate() {
  1350. if (!GameVersion.isWx)
  1351. return false;
  1352. const updateManager = Laya.Browser.window.wx.getUpdateManager();
  1353. updateManager.onCheckForUpdate(function (res) {
  1354. console.log("最新版本:" + res.hasUpdate);
  1355. });
  1356. updateManager.onUpdateReady(function () {
  1357. Laya.Browser.window.wx.showModal({
  1358. showCancel: false,
  1359. title: '更新提示',
  1360. content: '新版本已经准备好,是否重启应用?',
  1361. success(res) {
  1362. updateManager.applyUpdate();
  1363. },
  1364. fail(res) {
  1365. updateManager.applyUpdate();
  1366. }
  1367. });
  1368. });
  1369. }
  1370. static IsAuth() {
  1371. if (Laya.Browser.window && Laya.Browser.window.wx) {
  1372. Laya.Browser.window.wx.getSetting({
  1373. success: (res) => {
  1374. console.log("授权结果..");
  1375. console.log(res);
  1376. if (res.authSetting['scope.userInfo'] == true) {
  1377. WXSdk.isAuth = true;
  1378. Laya.Browser.window.wx.getUserInfo({
  1379. lang: 'zh_CN',
  1380. success: (res) => {
  1381. UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName;
  1382. UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl;
  1383. console.log("已经受过权");
  1384. },
  1385. fail: () => {
  1386. console.log('调用getUserInfo fail');
  1387. }
  1388. });
  1389. }
  1390. }
  1391. });
  1392. }
  1393. }
  1394. static RequestAuth(callback) {
  1395. if (WXSdk.isAuth) {
  1396. if (callback != null) {
  1397. callback(true);
  1398. }
  1399. return;
  1400. }
  1401. if (GameVersion.isWx) {
  1402. console.log("-----授权");
  1403. let openAuthView = () => {
  1404. let w = Laya.stage.width;
  1405. let h = Laya.stage.height;
  1406. console.log("准备授权");
  1407. let button = Laya.Browser.window.wx.createUserInfoButton({
  1408. type: 'text',
  1409. text: '',
  1410. style: {
  1411. left: 0,
  1412. top: 0,
  1413. width: w,
  1414. height: h,
  1415. lineHeight: 40,
  1416. backgroundColor: '#00000000',
  1417. textAlign: 'center',
  1418. fontSize: 16,
  1419. borderRadius: 4
  1420. }
  1421. });
  1422. let opTapHandler = (res) => {
  1423. console.log("res:" + JSON.stringify(res));
  1424. if (res.userInfo) {
  1425. button.hide();
  1426. button.offTap(opTapHandler);
  1427. button.destroy();
  1428. console.log("userinfo", res);
  1429. UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName;
  1430. UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl;
  1431. let param = [{ "nickname": res.userInfo.nickName }, { "avatar": res.userInfo.avatarUrl }, { "gender": res.userInfo.gender }, { "city": res.userInfo.city },
  1432. { "country": res.userInfo.country }, { "province": res.userInfo.province }];
  1433. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Userauth, param, () => {
  1434. WXSdk.isAuth = true;
  1435. if (callback != null) {
  1436. callback(true);
  1437. }
  1438. }, null);
  1439. }
  1440. else {
  1441. button.hide();
  1442. button.offTap(opTapHandler);
  1443. button.destroy();
  1444. if (callback != null) {
  1445. callback(false);
  1446. }
  1447. }
  1448. };
  1449. button.show();
  1450. button.onTap(opTapHandler);
  1451. };
  1452. openAuthView();
  1453. }
  1454. else {
  1455. WXSdk.isAuth = true;
  1456. if (callback != null) {
  1457. callback(true);
  1458. }
  1459. }
  1460. }
  1461. static OnShow(cb) {
  1462. if (!Laya.Browser.onWeiXin)
  1463. return;
  1464. Laya.Browser.window.wx.onShow(cb);
  1465. }
  1466. static OffShow(cb) {
  1467. if (!Laya.Browser.onWeiXin)
  1468. return;
  1469. Laya.Browser.window.wx.offShow(cb);
  1470. }
  1471. static showbjWxGameQuan(flag) {
  1472. if (!GameVersion.isWx) {
  1473. return;
  1474. }
  1475. if (flag) {
  1476. if (this.button == null) {
  1477. let info = Laya.Browser.window.wx.getSystemInfoSync();
  1478. if (!info)
  1479. return;
  1480. var top = 0.5 * info.windowHeight;
  1481. var height = 109 * info.windowHeight / Laya.stage.height;
  1482. var width = height * 80 / 109;
  1483. Laya.stage.width;
  1484. this.button = Laya.Browser.window.wx.createGameClubButton({
  1485. type: "image",
  1486. image: 'res/talk.png',
  1487. style: {
  1488. left: info.windowWidth * 0.5 + 150 * info.windowWidth / Laya.stage.width,
  1489. top: top - 240 * info.windowHeight / Laya.stage.height,
  1490. width: width,
  1491. height: height
  1492. }
  1493. });
  1494. }
  1495. this.button.show();
  1496. }
  1497. else {
  1498. if (this.button) {
  1499. this.button.hide();
  1500. }
  1501. }
  1502. }
  1503. }
  1504. WXSdk.Lodining = false;
  1505. WXSdk.shareId = "";
  1506. WXSdk._chanel = "";
  1507. WXSdk.isAuth = false;
  1508. WXSdk.vibrating = false;
  1509. WXSdk.IsNew = 0;
  1510. var Sprite3D = Laya.Sprite3D;
  1511. var PoolType;
  1512. (function (PoolType) {
  1513. PoolType[PoolType["WarnTips"] = 1] = "WarnTips";
  1514. PoolType[PoolType["HpText"] = 2] = "HpText";
  1515. })(PoolType || (PoolType = {}));
  1516. class GamePool {
  1517. constructor() {
  1518. this.poolDic = new Dictionary();
  1519. this.prefabDic = new Dictionary();
  1520. this.singleobjDic = new Dictionary();
  1521. }
  1522. static get Instance() {
  1523. return GamePool.instance || (GamePool.instance = new GamePool());
  1524. }
  1525. InitSelf(name, prefab) {
  1526. if (prefab != null) {
  1527. if (!this.prefabDic.has(name))
  1528. this.prefabDic.set(name, prefab);
  1529. }
  1530. }
  1531. onComplete(s) {
  1532. Laya.Sprite3D.load("res/threeDimen/staticModel/lizard/lizard.lh", Laya.Handler.create(this, function (sprite) {
  1533. var monster1 = this.scene.addChild(sprite);
  1534. monster1.transform.position = new Laya.Vector3(-0.6, 0, 0);
  1535. monster1.transform.localScale = new Laya.Vector3(0.075, 0.075, 0.075);
  1536. var monster2 = Laya.Sprite3D.instantiate(monster1, this.scene, false, new Laya.Vector3(0.6, 0, 0));
  1537. monster2.transform.localScale = new Laya.Vector3(0.075, 0.075, 0.075);
  1538. for (var i = 0; i < monster2.getChildByName("lizard").numChildren; i++) {
  1539. var meshSprite3D = monster2.getChildByName("lizard").getChildAt(i);
  1540. var material = meshSprite3D.meshRenderer.material;
  1541. Laya.Texture2D.load(this.normalMapUrl[i], Laya.Handler.create(this, function (mat, texture) {
  1542. mat.normalTexture = texture;
  1543. }, [material]));
  1544. }
  1545. Laya.timer.frameLoop(1, this, function () {
  1546. monster1.transform.rotate(this.rotation);
  1547. monster2.transform.rotate(this.rotation);
  1548. });
  1549. }));
  1550. }
  1551. GetUi(type) {
  1552. if (this.singleobjDic.has(type)) {
  1553. if (this.singleobjDic.get(type).length > 0) {
  1554. var result = this.singleobjDic.get(type).shift();
  1555. result.visible = true;
  1556. return result;
  1557. }
  1558. else {
  1559. return this.GetByType(type);
  1560. }
  1561. }
  1562. else {
  1563. return this.GetByType(type);
  1564. }
  1565. }
  1566. RecoverUi(type, go) {
  1567. go.visible = false;
  1568. go.removeSelf();
  1569. if (!this.singleobjDic.has(type)) {
  1570. this.singleobjDic.set(type, new Array());
  1571. }
  1572. this.singleobjDic.get(type).push(go);
  1573. }
  1574. RecoverModel(go) {
  1575. if (!go)
  1576. return;
  1577. go.active = false;
  1578. go.removeSelf();
  1579. var key = go.name;
  1580. if (!this.poolDic.has(key)) {
  1581. this.poolDic.set(key, new Array());
  1582. }
  1583. this.poolDic.get(key).push(go);
  1584. }
  1585. GetModel(name) {
  1586. if (name == "PlayerShoot")
  1587. GamePool.bulletCount++;
  1588. if (this.poolDic.has(name)) {
  1589. if (this.poolDic.get(name).length > 0) {
  1590. var result = this.poolDic.get(name).shift();
  1591. result.active = true;
  1592. return result;
  1593. }
  1594. else {
  1595. if (this.prefabDic.has(name)) {
  1596. var curObj = Sprite3D.instantiate(this.prefabDic.get(name));
  1597. curObj.name = name;
  1598. console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id);
  1599. return curObj;
  1600. }
  1601. else {
  1602. return null;
  1603. }
  1604. }
  1605. }
  1606. else {
  1607. if (this.prefabDic.has(name)) {
  1608. var curObj = Sprite3D.instantiate(this.prefabDic.get(name));
  1609. curObj.name = name;
  1610. console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id);
  1611. return curObj;
  1612. }
  1613. else {
  1614. return null;
  1615. }
  1616. }
  1617. }
  1618. onStateEnter() {
  1619. console.log("动画开始播放了");
  1620. }
  1621. onStateUpdate() {
  1622. console.log("动画状态更新了");
  1623. }
  1624. onStateExit() {
  1625. console.log("动画退出了");
  1626. }
  1627. GetByType(type) {
  1628. if (type == PoolType.WarnTips) {
  1629. var _t = new Laya.Text();
  1630. _t.width = 720;
  1631. _t.height = 60;
  1632. _t.align = "center";
  1633. _t.valign = "middle";
  1634. _t.fontSize = 35;
  1635. _t.bold = true;
  1636. _t.pivotX = 360;
  1637. _t.pivotY = 30;
  1638. _t.color = "#ffffff";
  1639. _t.stroke = 5;
  1640. _t.strokeColor = "#000000";
  1641. return _t;
  1642. }
  1643. else if (type == PoolType.HpText) {
  1644. var _t = new Laya.Text();
  1645. _t.font = "Microsoft YaHei";
  1646. _t.width = 260;
  1647. _t.height = 50;
  1648. _t.align = "center";
  1649. _t.valign = "middle";
  1650. _t.fontSize = 30;
  1651. _t.bold = true;
  1652. _t.pivotX = 130;
  1653. _t.pivotY = 25;
  1654. _t.color = "#ffffff";
  1655. return _t;
  1656. }
  1657. }
  1658. }
  1659. GamePool.modeltype = {
  1660. Mound: "Mound",
  1661. PlayerShoot: "PlayerShoot",
  1662. Player: "Character",
  1663. Enemy: "enemy"
  1664. };
  1665. GamePool.bulletCount = 0;
  1666. class FollowNumber {
  1667. constructor(t, from = 0, to = 0, tiny = 0) {
  1668. this.m_t = 0;
  1669. this.target = 0;
  1670. this.follow = 0;
  1671. this.m_tiny = 0;
  1672. this.m_t = t;
  1673. this.target = to;
  1674. this.follow = from;
  1675. this.m_tiny = tiny;
  1676. }
  1677. ChangeT(value) {
  1678. this.m_t = value;
  1679. }
  1680. get t() { return this.m_t; }
  1681. update() {
  1682. this.follow = MathTool.MixNumber(this.follow, this.target, this.m_t);
  1683. if (this.m_tiny != 0 && this.target != this.follow) {
  1684. if (Math.abs(this.target - this.follow) <= this.m_tiny) {
  1685. this.follow = this.target;
  1686. }
  1687. }
  1688. }
  1689. }
  1690. class MathTool {
  1691. static get VecZero() {
  1692. return new Laya.Vector3();
  1693. }
  1694. static RandomNumber(from, to) {
  1695. if (from >= to) {
  1696. return 0;
  1697. }
  1698. var size = to - from;
  1699. var curNumber = Math.random() * size + from;
  1700. return curNumber;
  1701. }
  1702. static SpToCam(v3) {
  1703. v3.x = -v3.x;
  1704. v3.y = v3.y - 180;
  1705. v3.z = -v3.z;
  1706. return v3;
  1707. }
  1708. static MixVector3(from, to, t, res = null) {
  1709. if (res == null) {
  1710. res = this.m_mixVector;
  1711. }
  1712. res.x = MathTool.MixNumber(from.x, to.x, t);
  1713. res.y = MathTool.MixNumber(from.y, to.y, t);
  1714. res.z = MathTool.MixNumber(from.z, to.z, t);
  1715. return res;
  1716. }
  1717. static MixNumber(from, to, t) {
  1718. t = MathTool.Clamp(t, 0, 1);
  1719. from = (to - from) * t + from;
  1720. return from;
  1721. }
  1722. static Clamp(value, from, to) {
  1723. if (value < from) {
  1724. value = from;
  1725. }
  1726. if (value > to) {
  1727. value = to;
  1728. }
  1729. return value;
  1730. }
  1731. }
  1732. MathTool.m_mixVector = new Laya.Vector3();
  1733. var ColliderGroup;
  1734. (function (ColliderGroup) {
  1735. ColliderGroup[ColliderGroup["mound"] = 8] = "mound";
  1736. ColliderGroup[ColliderGroup["wall"] = 9] = "wall";
  1737. ColliderGroup[ColliderGroup["opponent"] = 10] = "opponent";
  1738. ColliderGroup[ColliderGroup["obstacle1"] = 11] = "obstacle1";
  1739. ColliderGroup[ColliderGroup["obstacle2"] = 12] = "obstacle2";
  1740. ColliderGroup[ColliderGroup["obstacle3"] = 13] = "obstacle3";
  1741. })(ColliderGroup || (ColliderGroup = {}));
  1742. class MusicType {
  1743. onPreLoadFinish() {
  1744. var layaMonkeyParent = this.scene.addChild(Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/LayaMonkey.lh"));
  1745. var layaMonkeySon = Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey2/LayaMonkey.lh");
  1746. layaMonkeySon.transform.translate(new Laya.Vector3(2.5, 0, 0));
  1747. var scale = new Laya.Vector3(0.5, 0.5, 0.5);
  1748. layaMonkeySon.transform.localScale = scale;
  1749. layaMonkeyParent.addChild(layaMonkeySon);
  1750. this.addButton(100, 120, 160, 30, "移动父级猴子", 20, function (e) {
  1751. layaMonkeyParent.transform.translate(new Laya.Vector3(-0.1, 0, 0));
  1752. });
  1753. this.addButton(100, 160, 160, 30, "放大父级猴子", 20, function (e) {
  1754. var scale = new Laya.Vector3(0.2, 0.2, 0.2);
  1755. layaMonkeyParent.transform.localScale = scale;
  1756. });
  1757. this.addButton(100, 200, 160, 30, "旋转父级猴子", 20, function (e) {
  1758. layaMonkeyParent.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false);
  1759. });
  1760. this.addButton(100, 250, 160, 30, "移动子级猴子", 20, function (e) {
  1761. layaMonkeySon.transform.translate(new Laya.Vector3(-0.1, 0, 0));
  1762. });
  1763. this.addButton(100, 290, 160, 30, "放大子级猴子", 20, function (e) {
  1764. var scale = new Laya.Vector3(1, 1, 1);
  1765. layaMonkeySon.transform.localScale = scale;
  1766. });
  1767. this.addButton(100, 330, 160, 30, "旋转子级猴子", 20, function (e) {
  1768. layaMonkeySon.transform.rotate(new Laya.Vector3(-15, 0, 0), true, false);
  1769. });
  1770. }
  1771. addButton(x, y, width, height, text, size, clickFun) {
  1772. Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(null, function () {
  1773. var changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", text));
  1774. changeActionButton.size(width, height);
  1775. changeActionButton.labelBold = true;
  1776. changeActionButton.labelSize = size;
  1777. changeActionButton.sizeGrid = "4,4,4,4";
  1778. changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
  1779. changeActionButton.pos(x, y);
  1780. changeActionButton.on(Laya.Event.CLICK, this, clickFun);
  1781. }));
  1782. }
  1783. }
  1784. MusicType.Idle = "Idle";
  1785. MusicType.CrouchFiring = "CrouchFiring";
  1786. MusicType.Dance = "Dance";
  1787. MusicType.RunAndGun = "RunAndGun";
  1788. MusicType.RunningHysteric = "RunningHysteric";
  1789. var Text = Laya.Text;
  1790. class CameraManager {
  1791. static get Instance() {
  1792. return this.instance || (this.instance = new CameraManager());
  1793. }
  1794. CameraFollow(z) {
  1795. if (this.Camera)
  1796. this.Camera.MoveGame(z);
  1797. }
  1798. Init(cam, startPos) {
  1799. this.startPosTra = startPos.transform;
  1800. if (cam) {
  1801. this._maincamera = cam;
  1802. this.Camera = this._maincamera.addComponent(Camera);
  1803. this.Camera.Init();
  1804. }
  1805. }
  1806. createSampleText() {
  1807. var text = new Text();
  1808. text.overflow = Text.HIDDEN;
  1809. text.color = "#FFFFFF";
  1810. text.font = "Impact";
  1811. text.fontSize = 20;
  1812. text.borderColor = "#FFFF00";
  1813. text.x = 80;
  1814. Laya.stage.addChild(text);
  1815. 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";
  1816. return text;
  1817. }
  1818. SetCameraAction(type, arg) {
  1819. if (this.Camera)
  1820. this.Camera.CameraAction(type, arg);
  1821. }
  1822. }
  1823. var BitmapFont = Laya.BitmapFont;
  1824. var Text$1 = Laya.Text;
  1825. var Handler$2 = Laya.Handler;
  1826. class ConstructManager {
  1827. constructor() {
  1828. this.tarDis = 30;
  1829. this.constructArr = [];
  1830. this.fontName = "diyFont";
  1831. }
  1832. static get Instance() {
  1833. return this.instance || (this.instance = new ConstructManager());
  1834. }
  1835. Init(builds) {
  1836. this.constructArr.push(builds.getChildAt(2));
  1837. this.constructArr.push(builds.getChildAt(1));
  1838. this.constructArr.push(builds.getChildAt(0));
  1839. }
  1840. CheckMainRolePos(_zp) {
  1841. let d = this.tarDis - _zp;
  1842. if (d > 0)
  1843. return;
  1844. this.SwitchRoad();
  1845. }
  1846. loadFont() {
  1847. var bitmapFont = new BitmapFont();
  1848. bitmapFont.loadFont("res/bitmapFont/test.fnt", new Handler$2(this, this.onFontLoaded, [bitmapFont]));
  1849. }
  1850. onFontLoaded(bitmapFont) {
  1851. bitmapFont.setSpaceWidth(10);
  1852. Text$1.registerBitmapFont(this.fontName, bitmapFont);
  1853. this.createText(this.fontName);
  1854. }
  1855. createText(font) {
  1856. var txt = new Text$1();
  1857. txt.width = 250;
  1858. txt.wordWrap = true;
  1859. txt.text = "Do one thing at a time, and do well.";
  1860. txt.font = font;
  1861. txt.leading = 5;
  1862. txt.pos(Laya.stage.width - txt.width >> 1, Laya.stage.height - txt.height >> 1);
  1863. Laya.stage.addChild(txt);
  1864. }
  1865. SwitchRoad() {
  1866. let rs = this.constructArr.pop();
  1867. rs.transform.localPositionZ = this.tarDis + 60;
  1868. this.constructArr.unshift(rs);
  1869. this.tarDis = this.tarDis + 30;
  1870. }
  1871. SetConstruct() {
  1872. for (let index = this.constructArr.length - 1; index >= 0; index--) {
  1873. const element = this.constructArr[index];
  1874. element.transform.localPositionZ = (2 - index) * 30;
  1875. }
  1876. this.tarDis = 30;
  1877. }
  1878. }
  1879. var Sprite$1 = Laya.Sprite;
  1880. var Handler$3 = Laya.Handler;
  1881. class LevelController {
  1882. static get Instance() {
  1883. return LevelController.instance || (LevelController.instance = new LevelController());
  1884. }
  1885. showApe() {
  1886. var ape = new Sprite$1();
  1887. Laya.stage.addChild(ape);
  1888. ape.loadImage("res/apes/monkey3.png");
  1889. Laya.loader.load("res/apes/monkey2.png", Handler$3.create(this, function () {
  1890. var t = Laya.loader.getRes("res/apes/monkey2.png");
  1891. var ape = new Sprite$1();
  1892. ape.graphics.drawTexture(t, 0, 0);
  1893. Laya.stage.addChild(ape);
  1894. ape.pos(200, 0);
  1895. }));
  1896. }
  1897. SetLevel(level) {
  1898. let len = NetInfoManager.Instance._level.length;
  1899. let index = PlayerManager.Instance.stage;
  1900. if (PlayerManager.Instance.stage > len)
  1901. index = GameTool.randomInt(1, len);
  1902. this.curLevelData = NetInfoManager.Instance.GetLevel(index);
  1903. if (!this._level)
  1904. this._level = new Level();
  1905. this._level.SetLevel(this.curLevelData);
  1906. }
  1907. }
  1908. class Level {
  1909. constructor() {
  1910. this.road_list = [];
  1911. this.fail_gold = 0;
  1912. }
  1913. createApes() {
  1914. var layoutRadius = 150;
  1915. var radianUnit = Math.PI / 2;
  1916. this.apesCtn = new Sprite$1();
  1917. Laya.stage.addChild(this.apesCtn);
  1918. for (var i = 0; i < 4; i++) {
  1919. var ape = new Sprite$1();
  1920. ape.loadImage("res/apes/monkey" + i + ".png");
  1921. ape.pivot(55, 72);
  1922. ape.pos(Math.cos(radianUnit * i) * layoutRadius, Math.sin(radianUnit * i) * layoutRadius);
  1923. this.apesCtn.addChild(ape);
  1924. }
  1925. this.apesCtn.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  1926. }
  1927. SetLevel(data) {
  1928. this.road_list = GameTool.SpliteString(data["road_list"]);
  1929. this.gold = Number(data["gold"]);
  1930. this.fail_gold = Number(data["fail_gold"]);
  1931. this.enemy = data["enemy"];
  1932. this.enemy_hp = data["enemy_hp"];
  1933. this.isgold = Number(data["isgold"]) == 1;
  1934. this.enemy_cloth = data["enemy_cloth"] ? Number(data["enemy_cloth"]) : 1;
  1935. }
  1936. }
  1937. class MoundManager {
  1938. static get Instance() {
  1939. return this.instance || (this.instance = new MoundManager());
  1940. }
  1941. constructor() {
  1942. this.MoundrDic = new Dictionary();
  1943. }
  1944. Init(da) {
  1945. this.moundContainer = da;
  1946. }
  1947. MakeMound(data) {
  1948. let tower = GamePool.Instance.GetModel(GamePool.modeltype.Mound);
  1949. if (!tower)
  1950. return;
  1951. this.moundContainer.addChild(tower);
  1952. let ts = tower.getComponent(Mound);
  1953. if (!ts)
  1954. ts = tower.addComponent(Mound);
  1955. ts.SetMound(data);
  1956. this.MoundrDic.set(tower.id, ts);
  1957. }
  1958. Reset() {
  1959. let arr = [];
  1960. for (const key in this.MoundrDic.container) {
  1961. arr.push(key);
  1962. }
  1963. if (arr.length > 0) {
  1964. for (let index = 0; index < arr.length; index++) {
  1965. const element = arr[index];
  1966. let s = this.MoundrDic.get(element);
  1967. if (s)
  1968. s.Recovery();
  1969. }
  1970. }
  1971. }
  1972. RecoverMound(sp) {
  1973. this.MoundrDic.delete(sp.id);
  1974. }
  1975. HpUi() {
  1976. return GamePool.Instance.GetUi(PoolType.HpText);
  1977. }
  1978. }
  1979. class MatrixTransform {
  1980. static WorldToScreen2(camera, point) {
  1981. var pointA = this.InverseTransformPoint(camera.transform, point);
  1982. var distance = pointA.z;
  1983. var out = new Laya.Vector3();
  1984. camera.viewport.project(point, camera.projectionViewMatrix, out);
  1985. var value = new Laya.Vector3(out.x / Laya.stage.clientScaleX, out.y / Laya.stage.clientScaleY, distance);
  1986. return value;
  1987. }
  1988. static ScreenToWorld(camera, point) {
  1989. var halfFOV = (camera.fieldOfView * 0.5) * Math.PI / 180;
  1990. let height = point.z * Math.tan(halfFOV);
  1991. let width = height * camera.aspectRatio;
  1992. let lowerLeft = this.GetLowerLeft(camera.transform, point.z, width, height);
  1993. let v = this.GetScreenScale(width, height);
  1994. var value = new Laya.Vector3();
  1995. var lowerLeftA = this.InverseTransformPoint(camera.transform, lowerLeft);
  1996. value = new Laya.Vector3(-point.x / v.x, point.y / v.y, 0);
  1997. Laya.Vector3.add(lowerLeftA, value, value);
  1998. value = this.TransformPoint(camera.transform, value);
  1999. return value;
  2000. }
  2001. static GetScreenScale(width, height) {
  2002. var v = new Laya.Vector3();
  2003. v.x = Laya.stage.width / width / 2;
  2004. v.y = Laya.stage.height / height / 2;
  2005. return v;
  2006. }
  2007. static GetLowerLeft(transform, distance, width, height) {
  2008. var lowerLeft = new Laya.Vector3();
  2009. var right = new Laya.Vector3();
  2010. transform.getRight(right);
  2011. Laya.Vector3.normalize(right, right);
  2012. var xx = new Laya.Vector3(right.x * width, right.y * width, right.z * width);
  2013. Laya.Vector3.add(transform.position, xx, lowerLeft);
  2014. var up = new Laya.Vector3();
  2015. transform.getUp(up);
  2016. Laya.Vector3.normalize(up, up);
  2017. var yy = new Laya.Vector3(up.x * height, up.y * height, up.z * height);
  2018. Laya.Vector3.subtract(lowerLeft, yy, lowerLeft);
  2019. var forward = new Laya.Vector3();
  2020. transform.getForward(forward);
  2021. Laya.Vector3.normalize(forward, forward);
  2022. var zz = new Laya.Vector3(forward.x * distance, forward.y * distance, forward.z * distance);
  2023. Laya.Vector3.subtract(lowerLeft, zz, lowerLeft);
  2024. return lowerLeft;
  2025. }
  2026. static InverseTransformPoint(origin, point) {
  2027. var xx = new Laya.Vector3();
  2028. origin.getRight(xx);
  2029. var yy = new Laya.Vector3();
  2030. origin.getUp(yy);
  2031. var zz = new Laya.Vector3();
  2032. origin.getForward(zz);
  2033. var zz1 = new Laya.Vector3(-zz.x, -zz.y, -zz.z);
  2034. var x = this.ProjectDistance(point, origin.position, xx);
  2035. var y = this.ProjectDistance(point, origin.position, yy);
  2036. var z = this.ProjectDistance(point, origin.position, zz1);
  2037. var value = new Laya.Vector3(x, y, z);
  2038. return value;
  2039. }
  2040. static TransformPoint(origin, point) {
  2041. var value = new Laya.Vector3();
  2042. Laya.Vector3.transformQuat(point, origin.rotation, value);
  2043. Laya.Vector3.add(value, origin.position, value);
  2044. return value;
  2045. }
  2046. static ProjectDistance(A, C, B) {
  2047. var CA = new Laya.Vector3();
  2048. Laya.Vector3.subtract(A, C, CA);
  2049. var angle = this.Angle2(CA, B) * Math.PI / 180;
  2050. var distance = Laya.Vector3.distance(A, C);
  2051. distance *= Math.cos(angle);
  2052. return distance;
  2053. }
  2054. static Angle2(ma, mb) {
  2055. var v1 = (ma.x * mb.x) + (ma.y * mb.y) + (ma.z * mb.z);
  2056. var ma_val = Math.sqrt(ma.x * ma.x + ma.y * ma.y + ma.z * ma.z);
  2057. var mb_val = Math.sqrt(mb.x * mb.x + mb.y * mb.y + mb.z * mb.z);
  2058. var cosM = v1 / (ma_val * mb_val);
  2059. if (cosM < -1)
  2060. cosM = -1;
  2061. if (cosM > 1)
  2062. cosM = 1;
  2063. var angleAMB = Math.acos(cosM) * 180 / Math.PI;
  2064. return angleAMB;
  2065. }
  2066. }
  2067. var Sprite$2 = Laya.Sprite;
  2068. class ParticleManager {
  2069. constructor() {
  2070. this.attackmaxcount = 0;
  2071. this.explodemaxcount = 0;
  2072. }
  2073. static get Instance() {
  2074. return ParticleManager.instance || (ParticleManager.instance = new ParticleManager());
  2075. }
  2076. AttackEffect(pos) {
  2077. if (this.attackmaxcount >= GlobalParam.hitmaxcount)
  2078. return;
  2079. let h = GamePool.Instance.GetModel("Hit");
  2080. h.transform.position = pos;
  2081. Scene3DManager.Instance.effectCon.addChild(h);
  2082. this.attackmaxcount++;
  2083. Laya.timer.once(800, this, this.RecoverEffect, [h], false);
  2084. }
  2085. RecoverEffect(sp) {
  2086. GamePool.Instance.RecoverModel(sp);
  2087. this.attackmaxcount--;
  2088. }
  2089. mapLoaded() {
  2090. this.layer = this.tiledMap.getLayerByIndex(0);
  2091. var radiusX = 32;
  2092. var radiusY = Math.tan(180 / Math.PI * 30) * radiusX;
  2093. var color = "#FF7F50";
  2094. this.sprite = new Sprite$2();
  2095. this.sprite.graphics.drawLine(0, 0, -radiusX, radiusY, color);
  2096. this.sprite.graphics.drawLine(0, 0, radiusX, radiusY, color);
  2097. this.sprite.graphics.drawLine(-radiusX, radiusY, 0, radiusY * 2, color);
  2098. this.sprite.graphics.drawLine(radiusX, radiusY, 0, radiusY * 2, color);
  2099. Laya.stage.addChild(this.sprite);
  2100. }
  2101. ExplodeEffect(pos) {
  2102. if (this.explodemaxcount >= GlobalParam.boommaxcount)
  2103. return;
  2104. let h = GamePool.Instance.GetModel("Explode");
  2105. h.transform.position = pos;
  2106. Scene3DManager.Instance.effectCon.addChild(h);
  2107. this.explodemaxcount++;
  2108. Laya.timer.once(800, this, this.RecoverExpolde, [h], false);
  2109. }
  2110. RecoverExpolde(sp) {
  2111. GamePool.Instance.RecoverModel(sp);
  2112. this.explodemaxcount--;
  2113. }
  2114. BloodEffect(pos) {
  2115. let h = GamePool.Instance.GetModel("Blood");
  2116. h.transform.position = pos;
  2117. Scene3DManager.Instance.effectCon.addChild(h);
  2118. Laya.timer.once(800, this, this.RecoverBlood, [h], false);
  2119. }
  2120. RecoverBlood(sp) {
  2121. GamePool.Instance.RecoverModel(sp);
  2122. }
  2123. }
  2124. var Event$3 = Laya.Event;
  2125. var MouseManager = Laya.MouseManager;
  2126. var MovieClip = Laya.MovieClip;
  2127. var Animation = Laya.Animation;
  2128. class MouseEvent {
  2129. constructor() {
  2130. this.SWFPath = "res/swf/dragon.swf";
  2131. this.MCWidth = 318;
  2132. this.MCHeight = 406;
  2133. this._switch = false;
  2134. this._isCanClick = true;
  2135. this.clickD = false;
  2136. this._mousePos = MathTool.VecZero;
  2137. this.tempMouse = MathTool.VecZero;
  2138. this.clickCount = 0;
  2139. this.mStartX = 400;
  2140. this.mStartY = 500;
  2141. this.mActionIndex = 0;
  2142. this.mCurrIndex = 0;
  2143. this.mCurrSkinIndex = 0;
  2144. }
  2145. static get Instance() {
  2146. return this.instance || (this.instance = new MouseEvent());
  2147. }
  2148. InitMouseEvent() {
  2149. Laya.stage.on(Event$3.MOUSE_DOWN, this, this.OnClickDown);
  2150. Laya.stage.on(Event$3.MOUSE_OUT, this, this.OnClickUp);
  2151. }
  2152. createMovieClip() {
  2153. var mc = new MovieClip();
  2154. mc.load(this.SWFPath);
  2155. mc.x = (Laya.stage.width - this.MCWidth) / 2;
  2156. mc.y = (Laya.stage.height - this.MCHeight) / 2;
  2157. Laya.stage.addChild(mc);
  2158. }
  2159. OnClickDown(e) {
  2160. if (!this._isCanClick || !this._switch)
  2161. return;
  2162. if (e.target instanceof Laya.UIComponent)
  2163. return;
  2164. this.clickD = true;
  2165. Laya.stage.on(Event$3.MOUSE_UP, this, this.OnClickUp);
  2166. Laya.stage.on(Event$3.MOUSE_MOVE, this, this.OnSlider);
  2167. this._mousePos.x = MouseManager.instance.mouseX;
  2168. this._mousePos.y = MouseManager.instance.mouseY;
  2169. this.MouseD();
  2170. }
  2171. StartGameClick() {
  2172. this._switch = true;
  2173. if (!this._isCanClick)
  2174. return;
  2175. this.clickD = true;
  2176. Laya.stage.on(Event$3.MOUSE_UP, this, this.OnClickUp);
  2177. Laya.stage.on(Event$3.MOUSE_MOVE, this, this.OnSlider);
  2178. this._mousePos.x = MouseManager.instance.mouseX;
  2179. this.MouseD();
  2180. }
  2181. MouseD() {
  2182. MainRoleManager.Instance.SetModelPos(this._mousePos.x);
  2183. MainRoleManager.Instance.CreateShoot();
  2184. }
  2185. OnClickUp(e) {
  2186. if (!this._isCanClick || !this._switch)
  2187. return;
  2188. if (!this.clickD)
  2189. return;
  2190. this.MouseU();
  2191. }
  2192. createAnimation() {
  2193. var ani = new Animation();
  2194. ani.interval = 30;
  2195. ani.index = 1;
  2196. ani.play();
  2197. var bounds = ani.getGraphicBounds();
  2198. ani.pivot(bounds.width / 2, bounds.height / 2);
  2199. ani.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  2200. Laya.stage.addChild(ani);
  2201. }
  2202. OffMouseEvent() {
  2203. Laya.stage.off(Event$3.MOUSE_DOWN, this, this.OnClickDown);
  2204. Laya.stage.off(Event$3.MOUSE_UP, this, this.OnClickUp);
  2205. Laya.stage.off(Event$3.MOUSE_OUT, this, this.OnClickUp);
  2206. }
  2207. MouseU() {
  2208. this.clickD = false;
  2209. Laya.stage.off(Event$3.MOUSE_MOVE, this, this.OnSlider);
  2210. Laya.stage.off(Event$3.MOUSE_UP, this, this.OnClickUp);
  2211. }
  2212. OnSlider(e) {
  2213. this.tempMouse.x = MouseManager.instance.mouseX;
  2214. let offestX = this.tempMouse.x - this._mousePos.x;
  2215. if (offestX >= 0)
  2216. offestX = offestX < 20 ? offestX : 20;
  2217. if (offestX < 0)
  2218. offestX = offestX > -20 ? offestX : -20;
  2219. MainRoleManager.Instance.PlayerSlip(-offestX);
  2220. this._mousePos.x = this.tempMouse.x;
  2221. this._mousePos.y = this.tempMouse.y;
  2222. }
  2223. OpenInput() {
  2224. this.clickCount++;
  2225. if (this.clickCount > 1)
  2226. return;
  2227. this._isCanClick = true;
  2228. }
  2229. CloseInput() {
  2230. this.clickCount--;
  2231. if (this.clickCount > 0)
  2232. return;
  2233. this._isCanClick = false;
  2234. this.clickD = false;
  2235. }
  2236. set _Switch(value) {
  2237. this._switch = value;
  2238. }
  2239. play() {
  2240. this.mCurrIndex++;
  2241. if (this.mCurrIndex >= this.mArmature.getAnimNum()) {
  2242. this.mCurrIndex = 0;
  2243. }
  2244. this.mArmature.play(this.mCurrIndex, false);
  2245. }
  2246. onEvent(e) {
  2247. var tEventData = e;
  2248. Laya.stage.addChild(this.mLabelSprite);
  2249. this.mLabelSprite.x = this.mStartX;
  2250. this.mLabelSprite.y = this.mStartY;
  2251. this.mLabelSprite.graphics.clear();
  2252. this.mLabelSprite.graphics.fillText(tEventData.name, 0, 0, "20px Arial", "#ff0000", "center");
  2253. }
  2254. }
  2255. var Sprite$3 = Laya.Sprite;
  2256. var ColorFilter = Laya.ColorFilter;
  2257. class Street extends Laya.Script3D {
  2258. constructor() {
  2259. super(...arguments);
  2260. this.rotate = MathTool.VecZero;
  2261. this.speed = MathTool.VecZero;
  2262. this.ApePath = "res/apes/monkey2.png";
  2263. }
  2264. onAwake() {
  2265. this.selfobj = this.owner;
  2266. this.tran = this.selfobj.transform;
  2267. }
  2268. SetMoveType() {
  2269. if (this.thing.type == 5) {
  2270. this._transform = this.selfobj.getChildAt(0).transform;
  2271. }
  2272. else {
  2273. this._transform = this.tran;
  2274. if (this.thing.type == 4) {
  2275. StreetManager.Instance.StreetAddCube(this.selfobj);
  2276. }
  2277. }
  2278. if (this.thing.moveType == 1) {
  2279. Laya.timer.frameLoop(3, this, this.CheckRecover);
  2280. return;
  2281. }
  2282. else if (this.thing.moveType == 2) {
  2283. this.rotate.x = 0;
  2284. this.rotate.y = -this.thing.moveSpeed;
  2285. this.rotate.z = 0;
  2286. Laya.timer.frameLoop(2, this, this.MoveType2);
  2287. }
  2288. else if (this.thing.moveType == 3) {
  2289. this.rotate.x = 0;
  2290. this.rotate.y = this.thing.moveSpeed;
  2291. this.rotate.z = 0;
  2292. Laya.timer.frameLoop(2, this, this.MoveType2);
  2293. }
  2294. else if (this.thing.moveType == 4) {
  2295. this.rotate.x = 0;
  2296. this.rotate.y = 0;
  2297. this.rotate.z = this.thing.moveSpeed;
  2298. Laya.timer.frameLoop(1, this, this.MoveType3);
  2299. }
  2300. else if (this.thing.moveType == 5) {
  2301. this.rotate.x = 0;
  2302. this.rotate.y = 0;
  2303. this.rotate.z = -this.thing.moveSpeed;
  2304. Laya.timer.frameLoop(1, this, this.MoveType3);
  2305. }
  2306. else if (this.thing.moveType == 6) {
  2307. this.speed.x = -this.thing.moveSpeed;
  2308. this.speed.y = 0;
  2309. this.speed.z = 0;
  2310. Laya.timer.frameLoop(1, this, this.MoveType4);
  2311. }
  2312. else if (this.thing.moveType == 7) {
  2313. this.speed.x = this.thing.moveSpeed;
  2314. this.speed.y = 0;
  2315. this.speed.z = 0;
  2316. Laya.timer.frameLoop(1, this, this.MoveType4);
  2317. }
  2318. else if (this.thing.moveType == 8) ;
  2319. else if (this.thing.moveType == 9) ;
  2320. }
  2321. setup() {
  2322. this.normalizeApe();
  2323. this.makeRedApe();
  2324. this.grayingApe();
  2325. }
  2326. normalizeApe() {
  2327. var originalApe = this.createApe();
  2328. this.apeTexture = Laya.loader.getRes(this.ApePath);
  2329. originalApe.x = (Laya.stage.width - this.apeTexture.width * 3) / 2;
  2330. originalApe.y = (Laya.stage.height - this.apeTexture.height) / 2;
  2331. }
  2332. makeRedApe() {
  2333. var redMat = [
  2334. 1, 0, 0, 0, 0,
  2335. 0, 0, 0, 0, 0,
  2336. 0, 0, 0, 0, 0,
  2337. 0, 0, 0, 1, 0,
  2338. ];
  2339. var redFilter = new ColorFilter(redMat);
  2340. var redApe = this.createApe();
  2341. redApe.filters = [redFilter];
  2342. var firstChild = Laya.stage.getChildAt(0);
  2343. redApe.x = firstChild.x + this.apeTexture.width;
  2344. redApe.y = firstChild.y;
  2345. }
  2346. grayingApe() {
  2347. 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];
  2348. var grayscaleFilter = new ColorFilter(grayscaleMat);
  2349. var grayApe = this.createApe();
  2350. grayApe.filters = [grayscaleFilter];
  2351. var secondChild = Laya.stage.getChildAt(1);
  2352. grayApe.x = secondChild.x + this.apeTexture.width;
  2353. grayApe.y = secondChild.y;
  2354. }
  2355. createApe() {
  2356. var ape = new Sprite$3();
  2357. ape.loadImage("res/apes/monkey2.png");
  2358. Laya.stage.addChild(ape);
  2359. return ape;
  2360. }
  2361. MoveType4() {
  2362. this._transform.translate(this.speed);
  2363. if (Math.abs(this._transform.localPositionX) >= GlobalParam.blockLRmoveMaxDis)
  2364. this.speed.x = -this.speed.x;
  2365. this.CheckRecover();
  2366. }
  2367. MoveType2() {
  2368. this._transform.rotate(this.rotate);
  2369. this.CheckRecover();
  2370. }
  2371. MoveType3() {
  2372. this._transform.rotate(this.rotate);
  2373. if (Math.abs(this._transform.localRotationEulerZ) >= 50)
  2374. this.rotate.z = -this.rotate.z;
  2375. this.CheckRecover();
  2376. }
  2377. Recover() {
  2378. if (this.thing.type) {
  2379. StreetManager.Instance.StreetResetCube(this.selfobj.id);
  2380. }
  2381. Laya.timer.clearAll(this);
  2382. StreetManager.Instance.RecoverStreet(this.selfobj);
  2383. GamePool.Instance.RecoverModel(this.selfobj);
  2384. }
  2385. CheckRecover() {
  2386. if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 10) {
  2387. console.log("回收block", this.selfobj.name);
  2388. this.Recover();
  2389. return;
  2390. }
  2391. }
  2392. SetStreet(thing) {
  2393. this.tran.localPositionZ = Number(thing.z);
  2394. this.tran.localPositionX = Number(thing.x);
  2395. this.tran.rotationEuler = MathTool.VecZero;
  2396. this.thing = thing;
  2397. if (!MainRoleManager.Instance.player)
  2398. return;
  2399. this.tarTran = MainRoleManager.Instance.player.transform;
  2400. this.SetMoveType();
  2401. }
  2402. }
  2403. var Input = Laya.Input;
  2404. class GuideController {
  2405. constructor() {
  2406. this.guideonepos = new Laya.Vector3(2.5, 0, 59.4);
  2407. this.guidetwoPos = new Laya.Vector3(-5, 2, 104.4);
  2408. this.index = 0;
  2409. this._guide = false;
  2410. }
  2411. static get Instance() {
  2412. return this.instance || (this.instance = new GuideController());
  2413. }
  2414. GuideOn() {
  2415. if (this._guide) {
  2416. Laya.timer.once(500, this, this.Guide);
  2417. }
  2418. }
  2419. Guide() {
  2420. }
  2421. GuideOff() {
  2422. this._guide = false;
  2423. ViewManager.Instance.CloseGuideView();
  2424. }
  2425. GameOver() {
  2426. if (this._guide) {
  2427. ViewManager.Instance.CloseGuideView();
  2428. }
  2429. }
  2430. createInput() {
  2431. var inputText = new Input();
  2432. inputText.size(350, 100);
  2433. inputText.x = Laya.stage.width - inputText.width >> 1;
  2434. inputText.y = Laya.stage.height - inputText.height >> 1;
  2435. inputText.text = "这段文本不可编辑,但可复制";
  2436. inputText.editable = false;
  2437. inputText.bold = true;
  2438. inputText.bgColor = "#666666";
  2439. inputText.color = "#ffffff";
  2440. inputText.fontSize = 20;
  2441. Laya.stage.addChild(inputText);
  2442. }
  2443. InitGuide(p) {
  2444. if (this.index == 0) {
  2445. this.guideonepos.z = p;
  2446. this.index++;
  2447. }
  2448. else if (this.index == 1) {
  2449. this.guidetwoPos.z = p;
  2450. this.index++;
  2451. }
  2452. }
  2453. RequireGuide() {
  2454. let t = Laya.LocalStorage.getItem("guide");
  2455. if (PlayerManager.Instance.stage == 1) {
  2456. Laya.LocalStorage.setItem("guide", "1");
  2457. this._guide = true;
  2458. return true;
  2459. }
  2460. this._guide = false;
  2461. return false;
  2462. }
  2463. }
  2464. var Sprite$4 = Laya.Sprite;
  2465. class RoadArr {
  2466. constructor(blocks, blockPos) {
  2467. this.blocks = blocks;
  2468. this.blockPos = blockPos;
  2469. }
  2470. }
  2471. class BlockArr {
  2472. constructor(things, thingPos, blockHp) {
  2473. this.things = things;
  2474. this.thingPos = thingPos;
  2475. this.blockHp = blockHp;
  2476. }
  2477. }
  2478. class ThingArr {
  2479. constructor(type, prrfabName, moveType, moveSpeed) {
  2480. this.type = type;
  2481. this.prrfabName = prrfabName;
  2482. this.moveType = moveType;
  2483. this.moveSpeed = moveSpeed;
  2484. }
  2485. }
  2486. class StreetManager {
  2487. constructor() {
  2488. this.isover = false;
  2489. this.curindex = 1;
  2490. this.texture1 = "res/apes/monkey2.png";
  2491. this.texture2 = "res/apes/monkey3.png";
  2492. this.flag = false;
  2493. this.blockDic = new Dictionary();
  2494. this.cubeBlockDic = new Dictionary();
  2495. }
  2496. static get Instance() {
  2497. return StreetManager.instance || (StreetManager.instance = new StreetManager());
  2498. }
  2499. Init(BlockContainer) {
  2500. this.BlockContainer = BlockContainer;
  2501. }
  2502. SetBlock() {
  2503. this.isover = false;
  2504. this.curindex = 1;
  2505. this.CreateStreet();
  2506. }
  2507. onAssetsLoaded() {
  2508. this.ape = new Sprite$4();
  2509. Laya.stage.addChild(this.ape);
  2510. this.ape.pivot(55, 72);
  2511. this.ape.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  2512. this.switchTexture();
  2513. this.ape.on("click", this, this.switchTexture);
  2514. }
  2515. switchTexture() {
  2516. var textureUrl = (this.flag = !this.flag) ? this.texture1 : this.texture2;
  2517. this.ape.graphics.clear();
  2518. var texture = Laya.loader.getRes(textureUrl);
  2519. this.ape.graphics.drawTexture(texture, 0, 0);
  2520. this.ape.size(texture.width, texture.height);
  2521. }
  2522. CheckPlayerRoadPos(_zp) {
  2523. if (this.isover)
  2524. return;
  2525. let d = this.tarDis - _zp;
  2526. if (d > 0)
  2527. return;
  2528. this.StreetSwitch();
  2529. }
  2530. StreetSwitch() {
  2531. this.curindex++;
  2532. this.CreateStreet();
  2533. }
  2534. CreateSprite(road) {
  2535. if (GuideController.Instance._guide) {
  2536. GuideController.Instance.InitGuide(road.blockPos[0]);
  2537. }
  2538. let blocks = road.blocks;
  2539. let blockPos = road.blockPos;
  2540. let j = 0;
  2541. for (let index = 0; index < blocks.length; index++) {
  2542. const element = blocks[index];
  2543. const p = blockPos[index];
  2544. let things = element.things;
  2545. let thingPos = element.thingPos;
  2546. let blockHp = element.blockHp;
  2547. let isr = blockHp.length > 1;
  2548. for (let index = 0; index < things.length; index++) {
  2549. const element1 = things[index];
  2550. element1.z = p;
  2551. element1.x = thingPos[index];
  2552. element1.towerR = isr;
  2553. element1.hp = blockHp[index];
  2554. j++;
  2555. Laya.timer.frameOnce(j, this, this.Create, [element1], false);
  2556. }
  2557. }
  2558. }
  2559. Create(thing) {
  2560. if (thing.type == 1 || thing.type == 2) {
  2561. MoundManager.Instance.MakeMound(thing);
  2562. }
  2563. else {
  2564. let p = GamePool.Instance.GetModel(thing.prrfabName);
  2565. if (!p)
  2566. return;
  2567. this.BlockContainer.addChild(p);
  2568. let ts = p.getComponent(Street);
  2569. if (!ts)
  2570. ts = p.addComponent(Street);
  2571. ts.SetStreet(thing);
  2572. this.blockDic.set(p.id, ts);
  2573. }
  2574. }
  2575. RecoverStreet(sp) {
  2576. this.blockDic.delete(sp.id);
  2577. }
  2578. StreetAtkedCube(sp) {
  2579. sp.active = false;
  2580. ParticleManager.Instance.ExplodeEffect(sp.transform.position);
  2581. }
  2582. Reset() {
  2583. this.isover = false;
  2584. let arr = [];
  2585. for (const key in this.blockDic.container) {
  2586. arr.push(key);
  2587. }
  2588. let j = 1;
  2589. if (arr.length > 0) {
  2590. for (let index = 0; index < arr.length; index++) {
  2591. const element = arr[index];
  2592. let s = this.blockDic.get(element);
  2593. if (s)
  2594. s.Recover();
  2595. if (this.cubeBlockDic.has(element)) {
  2596. Laya.timer.frameOnce(j, this, this.StreetResetCube, [element], false);
  2597. j++;
  2598. }
  2599. }
  2600. }
  2601. }
  2602. StreetAddCube(sp) {
  2603. if (this.cubeBlockDic.has(sp.id))
  2604. return;
  2605. this.cubeBlockDic.set(sp.id, sp);
  2606. }
  2607. StreetResetCube(id) {
  2608. let sp = this.cubeBlockDic.get(id);
  2609. this.cubeBlockDic.delete(id);
  2610. if (!sp)
  2611. return;
  2612. console.log("回收CubeBlock,", sp.name);
  2613. for (let index = 0; index < sp.numChildren; index++) {
  2614. const element = sp.getChildAt(index);
  2615. element.active = true;
  2616. }
  2617. }
  2618. createApes() {
  2619. var gap = 300;
  2620. this.sp1 = new Sprite$4();
  2621. this.sp1.pos((Laya.stage.width - gap) / 2, Laya.stage.height / 2);
  2622. this.sp1.pivot(55, 72);
  2623. Laya.stage.addChild(this.sp1);
  2624. this.sp2 = new Sprite$4();
  2625. this.sp2.pos((Laya.stage.width + gap) / 2, Laya.stage.height / 2);
  2626. Laya.stage.addChild(this.sp2);
  2627. Laya.timer.frameLoop(1, this, this.animate);
  2628. }
  2629. animate(e) {
  2630. this.sp1.rotation += 2;
  2631. this.sp2.rotation += 2;
  2632. }
  2633. CreateStreet() {
  2634. let road_list = LevelController.Instance._level.road_list;
  2635. if (this.curindex > road_list.length - 1) {
  2636. this.isover = true;
  2637. console.log("没有障碍物了");
  2638. return;
  2639. }
  2640. this.tarDis =
  2641. this.curindex * GlobalParam.barrierRoadLength;
  2642. let roadindex = road_list[this.curindex];
  2643. if (roadindex == 0)
  2644. return;
  2645. let roads = NetInfoManager.Instance.GetRoad(roadindex);
  2646. if (!roads)
  2647. return;
  2648. let blocks = GameTool.SpliteString(roads["blocks"]);
  2649. let blockPoss = GameTool.SpliteString(roads["position"]);
  2650. let bps = [];
  2651. let d = GlobalParam.barrierRoadLength / GlobalParam.barrierRoadAverageNum;
  2652. blockPoss.forEach(element => {
  2653. bps.push(this.tarDis + element * d);
  2654. });
  2655. let bbs = [];
  2656. blocks.forEach(element => {
  2657. let thing = NetInfoManager.Instance.GetStreet(element);
  2658. let tss = GameTool.SpliteString(thing["block_things"]);
  2659. let tps = GameTool.SpliteString(thing["thing_position"]);
  2660. let ths = GameTool.SpliteString(thing["block_hp"]);
  2661. let ttt = [];
  2662. tss.forEach(element1 => {
  2663. let t = NetInfoManager.Instance.GetThing(element1);
  2664. let tt = new ThingArr(t["type"], t["prefabs"], t["dynamic_type"], t["dynamic_speed"]);
  2665. ttt.push(tt);
  2666. });
  2667. let things = new BlockArr(ttt, tps, ths);
  2668. bbs.push(things);
  2669. });
  2670. let blockB = new RoadArr(bbs, bps);
  2671. this.CreateSprite(blockB);
  2672. }
  2673. }
  2674. var Vector3 = Laya.Vector3;
  2675. var Quaternion = Laya.Quaternion;
  2676. var Animation$1 = Laya.Animation;
  2677. var Tween = Laya.Tween;
  2678. class Opponent extends Laya.Script3D {
  2679. constructor() {
  2680. super(...arguments);
  2681. this._up = new Vector3(0, 1, 0);
  2682. this.isArrive1 = false;
  2683. this.phoenixWidth = 550;
  2684. this.phoenixHeight = 400;
  2685. this.bgColorTweener = new Tween();
  2686. this.gradientInterval = 2000;
  2687. this.bgColorChannels = { r: 99, g: 0, b: 0xFF };
  2688. }
  2689. onAwake() {
  2690. this.selfobj = this.owner;
  2691. this.tran = this.selfobj.transform;
  2692. this.forW = MathTool.VecZero;
  2693. this.speed = GlobalParam.enemySpeed;
  2694. this.quaternion1 = new Quaternion();
  2695. }
  2696. Run() {
  2697. if (this.isArrive1) {
  2698. if (this.tarSp == null)
  2699. return;
  2700. if (!this.tarSp.active) {
  2701. this.tarSp = RoleManager.Instance.GetTar();
  2702. if (this.tarSp == null)
  2703. return;
  2704. this.tarPos = this.tarSp.transform.position.clone();
  2705. }
  2706. Vector3.subtract(this.tarPos, this.tran.position, this.forW);
  2707. Vector3.normalize(this.forW, this.forW);
  2708. this.forW = new Vector3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
  2709. this.tran.translate(this.forW, false);
  2710. if (Vector3.distance(this.tran.position, this.tarPos) < 0.1) {
  2711. return;
  2712. }
  2713. Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1);
  2714. this.quaternion1.invert(this.quaternion1);
  2715. this.tran.rotation = this.quaternion1.clone();
  2716. }
  2717. else {
  2718. Vector3.subtract(this.tarPos, this.tran.position, this.forW);
  2719. Vector3.normalize(this.forW, this.forW);
  2720. this.forW = new Vector3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
  2721. this.tran.translate(this.forW, false);
  2722. if (Vector3.distance(this.tran.position, this.tarPos) < 0.1) {
  2723. this.tarSp = RoleManager.Instance.GetTar();
  2724. this.isArrive1 = true;
  2725. if (this.tarSp == null)
  2726. return;
  2727. this.tarPos = this.tarSp.transform.position.clone();
  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. }
  2735. createPhoenixes() {
  2736. var scaleFactor = Math.min(Laya.stage.width / (this.phoenixWidth * 2), Laya.stage.height / this.phoenixHeight);
  2737. var blendedPhoenix = this.createAnimation();
  2738. blendedPhoenix.blendMode = "lighter";
  2739. blendedPhoenix.scale(scaleFactor, scaleFactor);
  2740. blendedPhoenix.y = (Laya.stage.height - this.phoenixHeight * scaleFactor) / 2;
  2741. var normalPhoenix = this.createAnimation();
  2742. normalPhoenix.scale(scaleFactor, scaleFactor);
  2743. normalPhoenix.x = this.phoenixWidth * scaleFactor;
  2744. normalPhoenix.y = (Laya.stage.height - this.phoenixHeight * scaleFactor) / 2;
  2745. }
  2746. createAnimation() {
  2747. var frames = [];
  2748. var animation = new Animation$1();
  2749. animation.loadImages(frames);
  2750. Laya.stage.addChild(animation);
  2751. var clips = animation.frames.concat();
  2752. clips = clips.reverse();
  2753. animation.frames = animation.frames.concat(clips);
  2754. animation.play();
  2755. return animation;
  2756. }
  2757. Recovery() {
  2758. Laya.timer.clearAll(this);
  2759. RoleManager.Instance.RecoverEnemy(this.selfobj);
  2760. GamePool.Instance.RecoverModel(this.selfobj);
  2761. }
  2762. InitModel(tar, hp, cloth) {
  2763. this.tarSp = tar;
  2764. this.isArrive1 = false;
  2765. if (this.tarSp == null)
  2766. return;
  2767. this.tarPos = this.tarSp.transform.position.clone();
  2768. if (this.tarPos.x > 0) {
  2769. this.tarPos = PlaneManager.Instance.toured1.clone();
  2770. }
  2771. else {
  2772. this.tarPos = PlaneManager.Instance.toured2.clone();
  2773. }
  2774. this.hp = hp;
  2775. Laya.timer.frameLoop(1, this, this.Run);
  2776. }
  2777. Injured(hitpos) {
  2778. this.hp -= PlayerManager.bulletAttack;
  2779. if (this.hp <= 0) {
  2780. this.Dead();
  2781. return;
  2782. }
  2783. ParticleManager.Instance.AttackEffect(hitpos);
  2784. }
  2785. Dead() {
  2786. ParticleManager.Instance.BloodEffect(this.tran.position);
  2787. this.Recovery();
  2788. RoleManager.Instance.CheckGameOver();
  2789. GameManager.Instance.roleCount++;
  2790. }
  2791. }
  2792. var Sprite$5 = Laya.Sprite;
  2793. class RoleManager {
  2794. constructor() {
  2795. this.frameCount = 10;
  2796. this.enemyDic = new Dictionary();
  2797. }
  2798. static get Instance() {
  2799. return this.instance || (this.instance = new RoleManager());
  2800. }
  2801. Create(hp, texture) {
  2802. let e = GamePool.Instance.GetModel(GamePool.modeltype.Enemy);
  2803. if (!e)
  2804. return;
  2805. MainRoleManager.Instance.playerContainer.addChild(e);
  2806. e.transform.position = this.startPos.clone();
  2807. let ps = e.getComponent(Opponent);
  2808. if (!ps)
  2809. ps = e.addComponent(Opponent);
  2810. let sp = this.GetTar();
  2811. ps.InitModel(sp, hp, texture);
  2812. this.enemyDic.set(e.id, ps);
  2813. }
  2814. CheckGameOver() {
  2815. if (this.enemyDic.size == 0) {
  2816. MouseEvent.Instance.OnClickUp();
  2817. MainRoleManager.Instance.CreateOver();
  2818. GameManager.Instance.Congratulate();
  2819. }
  2820. }
  2821. GetOpponent() {
  2822. for (const key in this.enemyDic.container) {
  2823. const element = this.enemyDic.get(key);
  2824. return element.selfobj;
  2825. }
  2826. return null;
  2827. }
  2828. Reset() {
  2829. let arr = [];
  2830. for (const key in this.enemyDic.container) {
  2831. arr.push(key);
  2832. }
  2833. if (arr.length > 0) {
  2834. for (let index = 0; index < arr.length; index++) {
  2835. const element = arr[index];
  2836. let s = this.enemyDic.get(element);
  2837. if (s)
  2838. s.Recovery();
  2839. }
  2840. }
  2841. }
  2842. CreateOpponent(startPos) {
  2843. this.startPos = startPos;
  2844. let count = LevelController.Instance._level.enemy;
  2845. let hp = LevelController.Instance._level.enemy_hp;
  2846. let texture = LevelController.Instance._level.enemy_cloth;
  2847. for (let index = 0; index < count; index++) {
  2848. let a = index;
  2849. Laya.timer.frameOnce(a * this.frameCount, this, this.Create, [hp, texture], false);
  2850. }
  2851. }
  2852. createCoralRect() {
  2853. var coralRect = new Sprite$5();
  2854. coralRect.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height / 2, "#FF7F50");
  2855. coralRect.name = "珊瑚色容器";
  2856. coralRect.size(Laya.stage.width, Laya.stage.height / 2);
  2857. Laya.stage.addChild(coralRect);
  2858. }
  2859. createDeepSkyblueRect() {
  2860. var deepSkyblueRect = new Sprite$5();
  2861. deepSkyblueRect.graphics.drawRect(0, 0, 100, 100, "#00BFFF");
  2862. deepSkyblueRect.name = "天蓝色矩形";
  2863. deepSkyblueRect.size(100, 100);
  2864. deepSkyblueRect.pos(10, 10);
  2865. Laya.stage.addChild(deepSkyblueRect);
  2866. }
  2867. GetTar() {
  2868. let p = MainRoleManager.Instance.NearIsdead();
  2869. if (!p) {
  2870. if (Math.random() > 0.5) {
  2871. return MainRoleManager.Instance.playerScript.body;
  2872. }
  2873. else {
  2874. let s = MateManager.Instance.GetSprite();
  2875. if (!s)
  2876. return MainRoleManager.Instance.playerScript.body;
  2877. else
  2878. return s;
  2879. }
  2880. }
  2881. else {
  2882. let s = MateManager.Instance.GetSprite();
  2883. if (!s)
  2884. return null;
  2885. else
  2886. return s;
  2887. }
  2888. }
  2889. RecoverEnemy(sp) {
  2890. this.enemyDic.delete(sp.id);
  2891. }
  2892. }
  2893. class GameManager {
  2894. constructor() {
  2895. this.towerCount = 0;
  2896. this.roleCount = 0;
  2897. this.blockCount = 0;
  2898. }
  2899. static get Instance() {
  2900. return GameManager.instance || (GameManager.instance = new GameManager());
  2901. }
  2902. Start() {
  2903. this.towerCount = 0;
  2904. this.roleCount = 0;
  2905. this.blockCount = 0;
  2906. }
  2907. Win() {
  2908. WXSdk.LongVibrate();
  2909. GameManager.WINORLOSE = true;
  2910. if (FYHD_Sdk.iswhite && GameManager.GameCount == 1) {
  2911. ViewManager.Instance.AddView(ViewType.ExitView, true);
  2912. }
  2913. else {
  2914. ViewManager.Instance.AddView(ViewType.CompleteView, true);
  2915. }
  2916. MoundManager.Instance.Reset();
  2917. StreetManager.Instance.Reset();
  2918. MateManager.Instance.Reset();
  2919. MainRoleManager.Instance.Reset();
  2920. RoleManager.Instance.Reset();
  2921. }
  2922. Congratulate(isglod = false) {
  2923. MainRoleManager.Instance.GoToTiaoWu();
  2924. if (isglod)
  2925. MateManager.Instance.TiaoWu1();
  2926. else
  2927. MateManager.Instance.TiaoWu();
  2928. CameraManager.Instance.SetCameraAction(CameraState.jump, 0.03);
  2929. Laya.timer.once(4000, this, this.Win);
  2930. }
  2931. Over() {
  2932. GuideController.Instance.GameOver();
  2933. MouseEvent.Instance.OnClickUp();
  2934. MainRoleManager.Instance.CreateOver();
  2935. MouseEvent.Instance._Switch = false;
  2936. WXSdk.LongVibrate();
  2937. GameManager.WINORLOSE = false;
  2938. if (FYHD_Sdk.iswhite && GameManager.GameCount == 1) {
  2939. ViewManager.Instance.AddView(ViewType.ExitView, true);
  2940. }
  2941. else {
  2942. ViewManager.Instance.AddView(ViewType.CompleteView, false);
  2943. }
  2944. MoundManager.Instance.Reset();
  2945. StreetManager.Instance.Reset();
  2946. MateManager.Instance.Reset();
  2947. MainRoleManager.Instance.Reset();
  2948. MainRoleManager.Instance.HidePlayer();
  2949. RoleManager.Instance.Reset();
  2950. }
  2951. loadUI() {
  2952. Laya.loader.load(["res/threeDimen/ui/button.png"], Laya.Handler.create(this, function () {
  2953. this.changeActionButton = Laya.stage.addChild(new Laya.Button("res/threeDimen/ui/button.png", "切换Mesh"));
  2954. this.changeActionButton.size(160, 40);
  2955. this.changeActionButton.labelBold = true;
  2956. this.changeActionButton.labelSize = 30;
  2957. this.changeActionButton.sizeGrid = "4,4,4,4";
  2958. this.changeActionButton.scale(Laya.Browser.pixelRatio, Laya.Browser.pixelRatio);
  2959. this.changeActionButton.pos(Laya.stage.width / 2 - this.changeActionButton.width * Laya.Browser.pixelRatio / 2, Laya.stage.height - 100 * Laya.Browser.pixelRatio);
  2960. this.changeActionButton.on(Laya.Event.CLICK, this, function () {
  2961. this.index++;
  2962. if (this.index % 5 === 1) {
  2963. this.sphere.meshFilter.sharedMesh = this.box;
  2964. }
  2965. else if (this.index % 5 === 2) {
  2966. this.sphere.meshFilter.sharedMesh = this.capsule;
  2967. }
  2968. else if (this.index % 5 === 3) {
  2969. this.sphere.meshFilter.sharedMesh = this.cylinder;
  2970. }
  2971. else if (this.index % 5 === 3) {
  2972. this.sphere.meshFilter.sharedMesh = this.cone;
  2973. }
  2974. else {
  2975. this.sphere.meshFilter.sharedMesh = this.sphereMesh;
  2976. }
  2977. });
  2978. }));
  2979. }
  2980. Near() {
  2981. MoundManager.Instance.Reset();
  2982. StreetManager.Instance.Reset();
  2983. }
  2984. ReStart() {
  2985. MateManager.Instance.Reset();
  2986. Scene3DManager.Instance.InItScene();
  2987. DispatcherManager.event(EventType.Event.ShowMainUi);
  2988. DispatcherManager.event(EventType.Event.SetStagePro, 0);
  2989. }
  2990. LevelUp() {
  2991. PlayerManager.Instance.stage++;
  2992. Scene3DManager.Instance.InItScene();
  2993. ViewManager.Instance.CloseView(ViewType.CompleteView);
  2994. DispatcherManager.event(EventType.Event.ShowMainUi);
  2995. DispatcherManager.event(EventType.Event.SetStage);
  2996. DispatcherManager.event(EventType.Event.SetStagePro, 0);
  2997. }
  2998. }
  2999. GameManager.GameNum = 0;
  3000. GameManager.WINORLOSE = false;
  3001. GameManager.GameCount = 0;
  3002. class Mound extends Laya.Script3D {
  3003. constructor() {
  3004. super(...arguments);
  3005. this.guideSteps = [
  3006. { x: 151, y: 575, radius: 150, tip: "res/guide/help6.png", tipx: 200, tipy: 250 },
  3007. { x: 883, y: 620, radius: 100, tip: "res/guide/help4.png", tipx: 730, tipy: 380 },
  3008. { x: 1128, y: 583, radius: 110, tip: "res/guide/help3.png", tipx: 900, tipy: 300 }
  3009. ];
  3010. this.guideStep = 0;
  3011. }
  3012. onAwake() {
  3013. this.selfobj = this.owner;
  3014. this.tran = this.selfobj.transform;
  3015. this.FriendSpawnPoint = this.selfobj.getChildByName("FriendSpawnPoint").transform;
  3016. this.HealthText = this.selfobj.getChildByName("HealthText").transform;
  3017. let we = this.selfobj.getChildByName("WallsEnd");
  3018. this.WallsEnd = we.transform;
  3019. this._reflect = we.getChildAt(0).meshRenderer.material;
  3020. }
  3021. HpUi() {
  3022. let p = MatrixTransform.WorldToScreen2(this._camera, this.HealthText.position.clone());
  3023. if (p.x <= 0 || p.x >= Laya.stage.width || p.y <= 0 || p.y >= Laya.stage.height)
  3024. this.hpText.visible = false;
  3025. else {
  3026. if (!this.hpText.visible)
  3027. this.hpText.visible = true;
  3028. this.hpText.x = p.x;
  3029. this.hpText.y = p.y;
  3030. }
  3031. }
  3032. CheckHp() {
  3033. if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 5) {
  3034. this.Recovery();
  3035. return;
  3036. }
  3037. this.HpUi();
  3038. }
  3039. nextStep() {
  3040. if (this.guideStep == this.guideSteps.length) {
  3041. Laya.stage.removeChild(this.guideContainer);
  3042. Laya.stage.removeChild(this.tipContainer);
  3043. }
  3044. else {
  3045. var step = this.guideSteps[this.guideStep++];
  3046. this.hitArea.unHit.clear();
  3047. this.hitArea.unHit.drawCircle(step.x, step.y, step.radius, "#000000");
  3048. this.interactionArea.graphics.clear();
  3049. this.interactionArea.graphics.drawCircle(step.x, step.y, step.radius, "#000000");
  3050. this.tipContainer.graphics.clear();
  3051. this.tipContainer.loadImage(step.tip);
  3052. this.tipContainer.pos(step.tipx, step.tipy);
  3053. }
  3054. }
  3055. MakeMate() {
  3056. this._mate = MateManager.Instance.MadeMate(this.FriendSpawnPoint);
  3057. }
  3058. Rescue() {
  3059. if (this._mate) {
  3060. this._mate.FallDown();
  3061. this._mate = null;
  3062. }
  3063. }
  3064. ReflectSet() {
  3065. this._reflect.albedoIntensity = 4;
  3066. Laya.timer.once(100, this, () => {
  3067. this._reflect.albedoIntensity = 1;
  3068. });
  3069. }
  3070. Recovery() {
  3071. Laya.timer.clearAll(this);
  3072. if (this.hpText) {
  3073. GamePool.Instance.RecoverUi(PoolType.HpText, this.hpText);
  3074. this.hpText = null;
  3075. }
  3076. this._reflect.albedoIntensity = 1;
  3077. MoundManager.Instance.RecoverMound(this.selfobj);
  3078. GamePool.Instance.RecoverModel(this.selfobj);
  3079. if (this._mate) {
  3080. this._mate.Recover();
  3081. this._mate = null;
  3082. }
  3083. }
  3084. Injured(hitpos) {
  3085. this._hp -= PlayerManager.bulletAttack;
  3086. if (this._hp <= 0) {
  3087. this.Rescue();
  3088. ParticleManager.Instance.ExplodeEffect(this.tran.position);
  3089. this.Recovery();
  3090. GameManager.Instance.towerCount++;
  3091. return;
  3092. }
  3093. ParticleManager.Instance.AttackEffect(hitpos);
  3094. let t = Math.ceil(this._hp);
  3095. this.hpText.text = t.toString();
  3096. this.ReflectSet();
  3097. }
  3098. SetMound(data) {
  3099. this._mate = null;
  3100. this.tarTran = MainRoleManager.Instance.player.transform;
  3101. this.tran.localPositionX = data.x;
  3102. this.tran.localPositionY = 0;
  3103. this.tran.localPositionZ = data.z;
  3104. if (data.towerR)
  3105. this.WallsEnd.localRotationEulerY = 30;
  3106. else
  3107. this.WallsEnd.localRotationEulerY = 0;
  3108. if (data.type == 1) {
  3109. this.MakeMate();
  3110. }
  3111. this._hp = data.hp;
  3112. if (!this.hpText) {
  3113. this.hpText = MoundManager.Instance.HpUi();
  3114. this.hpText.text = this._hp.toString();
  3115. if (!this._camera)
  3116. this._camera = CameraManager.Instance._maincamera;
  3117. ViewManager.Instance.popNode.addChild(this.hpText);
  3118. }
  3119. this.HpUi();
  3120. Laya.timer.frameLoop(1, this, this.CheckHp);
  3121. }
  3122. }
  3123. var Vector3$1 = Laya.Vector3;
  3124. var Sprite$6 = Laya.Sprite;
  3125. class MainRoleShot extends Laya.Script3D {
  3126. constructor() {
  3127. super(...arguments);
  3128. this.speed = MathTool.VecZero;
  3129. this._forward = new Vector3$1(0, 0, 1);
  3130. this.over = false;
  3131. }
  3132. onAwake() {
  3133. this.selfobj = this.owner;
  3134. this.tran = this.selfobj.transform;
  3135. this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
  3136. this.speed.z = GlobalParam.shootspeed;
  3137. }
  3138. Run() {
  3139. this.tran.translate(this.speed);
  3140. let d = Vector3$1.distance(this.tarTran.position, this.tran.position);
  3141. if (d >= GlobalParam.bulletMaxDis) {
  3142. this.RecoverBullet();
  3143. return;
  3144. }
  3145. this.RayReset();
  3146. }
  3147. RecoverBullet() {
  3148. Laya.timer.clearAll(this);
  3149. GamePool.Instance.RecoverModel(this.selfobj);
  3150. GamePool.bulletCount--;
  3151. }
  3152. drawSomething() {
  3153. this.sp = new Sprite$6();
  3154. Laya.stage.addChild(this.sp);
  3155. this.sp.graphics.drawLine(10, 58, 146, 58, "#ff0000", 3);
  3156. this.sp.graphics.drawLines(176, 58, [0, 0, 39, -50, 78, 0, 117, 50, 156, 0], "#ff0000", 5);
  3157. 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);
  3158. this.sp.graphics.drawRect(10, 166, 166, 90, "#ffff00");
  3159. this.sp.graphics.drawPoly(264, 166, [0, 0, 60, 0, 78.48, 57, 30, 93.48, -18.48, 57], "#ffff00");
  3160. this.sp.graphics.drawPoly(400, 166, [0, 100, 50, 0, 100, 100], "#ffff00");
  3161. this.sp.graphics.drawCircle(98, 332, 50, "#00ffff");
  3162. this.sp.graphics.drawPie(240, 290, 100, 10, 60, "#00ffff");
  3163. 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" });
  3164. }
  3165. RayReset() {
  3166. let origP = this.rayPoint.position.clone();
  3167. if (!this._scene) {
  3168. this._scene = Scene3DManager.Instance.MainScene;
  3169. }
  3170. if (!this.ray) {
  3171. if (!this.forward)
  3172. this.forward = MathTool.VecZero;
  3173. this.ray = new Laya.Ray(MathTool.VecZero, this._forward);
  3174. this.outHit = new Laya.HitResult();
  3175. }
  3176. this.ray.origin = origP;
  3177. if (this.over) {
  3178. this.tran.getForward(this.forward);
  3179. this.forward.x = -this.forward.x;
  3180. this.forward.y = -this.forward.y;
  3181. this.forward.z = -this.forward.z;
  3182. this.ray.direction = this.forward;
  3183. }
  3184. else {
  3185. this.ray.direction = this._forward;
  3186. }
  3187. let isHItF = this._scene.physicsSimulation.rayCast(this.ray, this.outHit, GlobalParam.bulletRayLength);
  3188. if (isHItF) {
  3189. let obj = this.outHit.collider.owner;
  3190. if (obj.layer == ColliderGroup.mound) {
  3191. let tower = obj.getComponent(Mound);
  3192. if (tower) {
  3193. tower.Injured(this.outHit.point);
  3194. }
  3195. }
  3196. else if (obj.layer == ColliderGroup.opponent) {
  3197. let tower = obj.getComponent(Opponent);
  3198. if (tower) {
  3199. tower.Injured(this.outHit.point);
  3200. }
  3201. }
  3202. else if (obj.layer == ColliderGroup.obstacle1 || obj.layer == ColliderGroup.obstacle2 || obj.layer == ColliderGroup.obstacle3) {
  3203. StreetManager.Instance.StreetAtkedCube(obj);
  3204. GameManager.Instance.blockCount++;
  3205. }
  3206. else {
  3207. ParticleManager.Instance.AttackEffect(this.outHit.point);
  3208. }
  3209. this.RecoverBullet();
  3210. return;
  3211. }
  3212. }
  3213. Start(tarTran, isover = false) {
  3214. this.tarTran = tarTran;
  3215. this.over = isover;
  3216. Laya.timer.frameLoop(1, this, this.Run);
  3217. }
  3218. }
  3219. var Vector3$2 = Laya.Vector3;
  3220. var Quaternion$1 = Laya.Quaternion;
  3221. var Sprite$7 = Laya.Sprite;
  3222. var Text$2 = Laya.Text;
  3223. class Mate extends Laya.Script3D {
  3224. constructor() {
  3225. super(...arguments);
  3226. this._up = new Vector3$2(0, 1, 0);
  3227. this.isreturn = false;
  3228. this.isover = false;
  3229. this.isClickCom = true;
  3230. this.isStop = true;
  3231. this.texture1 = "res/apes/monkey2.png";
  3232. this.texture2 = "res/apes/monkey3.png";
  3233. this.flag = false;
  3234. this.isFristShoot = true;
  3235. this.ts = new Vector3$2(0, 0, 0.01);
  3236. }
  3237. onAwake() {
  3238. this.selfobj = this.owner;
  3239. this.tran = this.selfobj.transform;
  3240. this.animator = this.selfobj.getChildAt(0).getComponent(Laya.Animator);
  3241. this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
  3242. this.bulletPos = this.selfobj.getChildByName("bulletPos").transform;
  3243. this.forW = MathTool.VecZero;
  3244. this.speed = GlobalParam.matespeed;
  3245. this.quaternion1 = new Quaternion$1();
  3246. }
  3247. setup() {
  3248. var textBox = new Sprite$7();
  3249. var text;
  3250. for (var i = 0; i < 1000; i++) {
  3251. text = new Text$2();
  3252. text.fontSize = 20;
  3253. text.text = (Math.random() * 100).toFixed(0);
  3254. text.rotation = Math.random() * 360;
  3255. text.color = "#CCCCCC";
  3256. text.x = Math.random() * Laya.stage.width;
  3257. text.y = Math.random() * Laya.stage.height;
  3258. textBox.addChild(text);
  3259. }
  3260. textBox.cacheAs = "bitmap";
  3261. Laya.stage.addChild(textBox);
  3262. }
  3263. TrialAdd(dataPar) {
  3264. this.AnimatorPlayByType(MusicType.Idle, 1);
  3265. this.dataPar = dataPar;
  3266. this.dataPar["ishave"] = true;
  3267. this.isClickCom = true;
  3268. this.isStop = true;
  3269. this.isreturn = true;
  3270. this.isover = false;
  3271. MateManager.Instance.AddModelToDic(this.selfobj.id, this);
  3272. this.ShootFunc();
  3273. if (MainRoleManager.Instance.IsShoot())
  3274. this.CreateShoot();
  3275. Laya.timer.frameLoop(1, this, this.Move);
  3276. }
  3277. SetTar() {
  3278. this.isreturn = false;
  3279. this.isClickCom = true;
  3280. this.isStop = true;
  3281. this.isover = false;
  3282. this.AnimatorPlayByType(MusicType.Idle, 1);
  3283. DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate);
  3284. }
  3285. FallDown() {
  3286. let tween = Laya.Tween.to(this.tran, { localPositionY: 0 }, 400, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
  3287. let dataPar = MainRoleManager.Instance.GetMatePos();
  3288. if (!dataPar) {
  3289. console.warn("friendPar没有位置了");
  3290. return;
  3291. }
  3292. this.dataPar = dataPar;
  3293. this.dataPar["ishave"] = true;
  3294. this.tar = this.dataPar["sp"];
  3295. this.tarTra = this.tar.transform;
  3296. tween.clear();
  3297. this.Start();
  3298. }, null, false));
  3299. }
  3300. Start() {
  3301. this.AnimatorPlayByType(MusicType.RunAndGun, 2);
  3302. this.isreturn = false;
  3303. this.isClickCom = true;
  3304. this.isStop = true;
  3305. this.isover = false;
  3306. Laya.timer.frameLoop(1, this, this.Move);
  3307. }
  3308. ArriveTarPos() {
  3309. this.isClickCom = true;
  3310. this.isStop = true;
  3311. this.isreturn = true;
  3312. this.tar.addChild(this.selfobj);
  3313. this.tran.localPosition = MathTool.VecZero;
  3314. this.AnimatorPlayByType(MusicType.RunAndGun, 2);
  3315. MateManager.Instance.AddModelToDic(this.selfobj.id, this);
  3316. let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
  3317. tween.clear();
  3318. this.tran.localRotationEuler = MathTool.VecZero;
  3319. this.ShootFunc();
  3320. this.CreateShoot();
  3321. }, null, false));
  3322. }
  3323. RayReset() {
  3324. let origP = this.rayPoint.position;
  3325. if (!this._scene) {
  3326. this._scene = Scene3DManager.Instance.MainScene;
  3327. }
  3328. if (!this.rayF) {
  3329. this.rayF = new Laya.Ray(MathTool.VecZero, new Vector3$2(0, 0, 1));
  3330. this.outHitF = new Laya.HitResult();
  3331. }
  3332. this.rayF.origin = origP;
  3333. let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalParam.playerRayLengthF);
  3334. if (isHItF) {
  3335. let obj = this.outHitF.collider.owner;
  3336. this.Dead(this.outHitF.point);
  3337. return;
  3338. }
  3339. if (!this.rayL) {
  3340. this.rayL = new Laya.Ray(MathTool.VecZero, new Vector3$2(1, 0, 0));
  3341. this.outHitL = new Laya.HitResult();
  3342. }
  3343. this.rayL.origin = origP;
  3344. let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalParam.playerRayLengthLR);
  3345. if (isHItL) {
  3346. let obj = this.outHitL.collider.owner;
  3347. this.Dead(this.outHitL.point);
  3348. return;
  3349. }
  3350. if (!this.rayR) {
  3351. this.rayR = new Laya.Ray(MathTool.VecZero, new Vector3$2(-1, 0, 0));
  3352. this.outHitR = new Laya.HitResult();
  3353. }
  3354. this.rayR.origin = origP;
  3355. let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalParam.playerRayLengthLR);
  3356. if (isHItR) {
  3357. let obj = this.outHitR.collider.owner;
  3358. this.Dead(this.outHitR.point);
  3359. return;
  3360. }
  3361. }
  3362. createApes() {
  3363. this.ape1 = new Sprite$7();
  3364. this.ape2 = new Sprite$7();
  3365. this.ape1.loadImage("res/apes/monkey2.png");
  3366. this.ape2.loadImage("res/apes/monkey2.png");
  3367. this.ape1.pivot(55, 72);
  3368. this.ape2.pivot(55, 72);
  3369. this.ape1.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  3370. this.ape2.pos(200, 0);
  3371. Laya.stage.addChild(this.ape1);
  3372. this.ape1.addChild(this.ape2);
  3373. Laya.timer.frameLoop(1, this, this.animate);
  3374. }
  3375. animate(e) {
  3376. this.ape1.rotation += 2;
  3377. this.ape2.rotation -= 4;
  3378. }
  3379. Move() {
  3380. if (this.isreturn) {
  3381. this.RayReset();
  3382. return;
  3383. }
  3384. let tarPos = this.tarTra.position.clone();
  3385. Vector3$2.subtract(tarPos, this.tran.position, this.forW);
  3386. Vector3$2.normalize(this.forW, this.forW);
  3387. this.forW = new Vector3$2(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
  3388. this.tran.translate(this.forW, false);
  3389. if (Vector3$2.distance(this.tran.position, tarPos) < 0.1) {
  3390. this.ArriveTarPos();
  3391. return;
  3392. }
  3393. Quaternion$1.lookAt(tarPos, this.tran.position, this._up, this.quaternion1);
  3394. this.quaternion1.invert(this.quaternion1);
  3395. Quaternion$1.slerp(this.tran.rotation, this.quaternion1, 0.1, this.quaternion1);
  3396. this.tran.rotation = this.quaternion1.clone();
  3397. }
  3398. AnimatorPlayByType(clip, speed, callback) {
  3399. this.animator.play(clip);
  3400. if (!speed)
  3401. speed = 1;
  3402. this.animator.speed = speed;
  3403. }
  3404. ShootFunc() {
  3405. DispatcherManager.on(EventType.Event.StopShot, this, this.StopCreate);
  3406. }
  3407. LoopCreate() {
  3408. if (this.isStop) {
  3409. Laya.timer.clear(this, this.LoopCreate);
  3410. this.isClickCom = true;
  3411. return;
  3412. }
  3413. this._CreateShoot();
  3414. }
  3415. CreateShoot() {
  3416. this.isStop = false;
  3417. if (!this.isClickCom)
  3418. return;
  3419. this.isClickCom = false;
  3420. this._CreateShoot();
  3421. Laya.timer.loop(PlayerManager.bulletTime * 2 * 1000, this, this.LoopCreate);
  3422. }
  3423. _CreateShoot() {
  3424. let bu = GamePool.Instance.GetModel(GamePool.modeltype.PlayerShoot);
  3425. if (bu) {
  3426. Scene3DManager.Instance.bulletCon.addChild(bu);
  3427. bu.transform.position = this.bulletPos.position.clone();
  3428. bu.transform.localRotationEuler = this.bulletPos.rotationEuler.clone();
  3429. let pb = bu.getComponent(MainRoleShot);
  3430. if (!pb)
  3431. pb = bu.addComponent(MainRoleShot);
  3432. pb.Start(this.bulletPos, this.isover);
  3433. }
  3434. }
  3435. StopCreate() {
  3436. this.isStop = true;
  3437. }
  3438. Dead(pos) {
  3439. if (this.dataPar)
  3440. this.dataPar["ishave"] = false;
  3441. ParticleManager.Instance.BloodEffect(pos);
  3442. MateManager.Instance.RemoveModelToDic(this.selfobj);
  3443. this.Recover();
  3444. MainRoleManager.Instance.CheckGameOver();
  3445. }
  3446. SetPar() {
  3447. let t = this.tran.position.clone();
  3448. MainRoleManager.Instance.playerContainer.addChild(this.selfobj);
  3449. this.tran.position = t.clone();
  3450. }
  3451. TiaoWu(sp) {
  3452. this.AnimatorPlayByType(MusicType.RunAndGun, 2);
  3453. this.danceP = sp.position.clone();
  3454. this.r = sp.rotationEuler.clone();
  3455. Laya.timer.frameLoop(1, this, this._TiaoWu);
  3456. }
  3457. _TiaoWu() {
  3458. Vector3$2.subtract(this.danceP, this.tran.position, this.forW);
  3459. Vector3$2.normalize(this.forW, this.forW);
  3460. this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  3461. this.tran.translate(this.forW);
  3462. if (Vector3$2.distance(this.tran.position, this.danceP) < 0.15) {
  3463. Laya.timer.clear(this, this._TiaoWu);
  3464. this.tran.position = this.danceP.clone();
  3465. this.tran.rotationEuler = this.r.clone();
  3466. this.AnimatorPlayByType(MusicType.Dance, 1);
  3467. return;
  3468. }
  3469. Quaternion$1.lookAt(this.danceP, this.tran.position, this._up, this.quaternion1);
  3470. this.quaternion1.invert(this.quaternion1);
  3471. this.tran.rotation = this.quaternion1.clone();
  3472. }
  3473. onAssetsLoaded() {
  3474. this.ape = new Sprite$7();
  3475. Laya.stage.addChild(this.ape);
  3476. this.ape.pivot(55, 72);
  3477. this.ape.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  3478. }
  3479. Attack() {
  3480. Laya.timer.clear(this, this._Defense);
  3481. this.isover = true;
  3482. this.isFristShoot = true;
  3483. this.enemyTar = null;
  3484. Laya.timer.frameLoop(1, this, this._attack);
  3485. }
  3486. _attack() {
  3487. if (this.enemyTar == null) {
  3488. this.enemyTar = RoleManager.Instance.GetOpponent();
  3489. if (this.enemyTar != null) {
  3490. this.ATKp = this.enemyTar.transform.position.clone();
  3491. Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
  3492. this.quaternion1.invert(this.quaternion1);
  3493. this.tran.rotation = this.quaternion1.clone();
  3494. }
  3495. }
  3496. else {
  3497. if (!this.enemyTar.active) {
  3498. this.enemyTar = RoleManager.Instance.GetOpponent();
  3499. if (this.enemyTar != null) {
  3500. this.ATKp = this.enemyTar.transform.position.clone();
  3501. Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
  3502. this.quaternion1.invert(this.quaternion1);
  3503. this.tran.rotation = this.quaternion1.clone();
  3504. }
  3505. }
  3506. if (this.enemyTar == null) {
  3507. this.StopCreate();
  3508. this.isFristShoot = true;
  3509. return;
  3510. }
  3511. if (this.isFristShoot) {
  3512. this.isFristShoot = false;
  3513. this.CreateShoot();
  3514. }
  3515. this.ATKp = this.enemyTar.transform.position.clone();
  3516. Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
  3517. this.quaternion1.invert(this.quaternion1);
  3518. this.tran.rotation = this.quaternion1.clone();
  3519. }
  3520. }
  3521. _Defense() {
  3522. Vector3$2.subtract(this.tp, this.tran.position, this.forW);
  3523. Vector3$2.normalize(this.forW, this.forW);
  3524. this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  3525. this.tran.translate(this.forW, false);
  3526. if (Vector3$2.distance(this.tran.position, this.tp) < 0.1) {
  3527. Laya.timer.clear(this, this._Defense);
  3528. let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
  3529. tween.clear();
  3530. }, null, false));
  3531. return;
  3532. }
  3533. Quaternion$1.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
  3534. this.quaternion1.invert(this.quaternion1);
  3535. this.tran.rotation = this.quaternion1.clone();
  3536. }
  3537. Defense(pos) {
  3538. this.SetPar();
  3539. this.tp = pos;
  3540. Quaternion$1.lookAt(pos, this.tran.position, this._up, this.quaternion1);
  3541. this.quaternion1.invert(this.quaternion1);
  3542. this.tran.rotation = this.quaternion1.clone();
  3543. this.AnimatorPlayByType(MusicType.CrouchFiring, 1);
  3544. Laya.timer.frameLoop(1, this, this._Defense);
  3545. }
  3546. Recover() {
  3547. if (this.dataPar) {
  3548. this.dataPar["ishave"] = false;
  3549. this.dataPar = null;
  3550. }
  3551. MateManager.Instance.RecoverMateModel(this.selfobj);
  3552. MateManager.Instance.RemoveModelToDic(this.selfobj);
  3553. Laya.timer.clearAll(this);
  3554. Laya.Tween.clearAll(this);
  3555. DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate);
  3556. GamePool.Instance.RecoverModel(this.selfobj);
  3557. }
  3558. }
  3559. var Rectangle$1 = Laya.Rectangle;
  3560. class MateManager {
  3561. constructor() {
  3562. this.ApePath = "res/apes/monkey2.png";
  3563. this.v3 = MathTool.VecZero;
  3564. this.friendDic = new Dictionary();
  3565. this.getDic = new Dictionary();
  3566. }
  3567. static get Instance() {
  3568. return this.instance || (this.instance = new MateManager());
  3569. }
  3570. Trial() {
  3571. for (let index = 0; index < 3; index++) {
  3572. Laya.timer.frameOnce(index, this, this._createtrialmodel, null, false);
  3573. }
  3574. }
  3575. TrialModelPlayAni() {
  3576. for (const key in this.friendDic.container) {
  3577. const element = this.friendDic.get(key);
  3578. element.CreateShoot();
  3579. element.AnimatorPlayByType(MusicType.RunAndGun, 2);
  3580. }
  3581. }
  3582. RecoverMateModel(sp) {
  3583. this.friendDic.delete(sp.id);
  3584. }
  3585. AddModelToDic(id, fr) {
  3586. this.getDic.set(id, fr);
  3587. }
  3588. RemoveModelToDic(sp) {
  3589. this.getDic.delete(sp.id);
  3590. }
  3591. MadeMate(tra) {
  3592. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
  3593. if (p) {
  3594. p.transform.position = tra.position.clone();
  3595. p.transform.rotationEuler = tra.rotationEuler.clone();
  3596. MainRoleManager.Instance.playerContainer.addChild(p);
  3597. let ps = p.getComponent(Mate);
  3598. if (!ps)
  3599. ps = p.addComponent(Mate);
  3600. ps.SetTar();
  3601. this.friendDic.set(p.id, ps);
  3602. return ps;
  3603. }
  3604. return null;
  3605. }
  3606. showDragRegion() {
  3607. var dragWidthLimit = 350;
  3608. var dragHeightLimit = 200;
  3609. this.dragRegion = new Rectangle$1(Laya.stage.width - dragWidthLimit >> 1, Laya.stage.height - dragHeightLimit >> 1, dragWidthLimit, dragHeightLimit);
  3610. Laya.stage.graphics.drawRect(this.dragRegion.x, this.dragRegion.y, this.dragRegion.width, this.dragRegion.height, null, "#FFFFFF", 2);
  3611. }
  3612. onStartDrag(e) {
  3613. this.ape.startDrag(this.dragRegion, true, 100);
  3614. }
  3615. NearDestination() {
  3616. return this.getDic.size;
  3617. }
  3618. Near(count, zs) {
  3619. if (count == 1) {
  3620. for (const key in this.getDic.container) {
  3621. const element = this.getDic.get(key);
  3622. this.v3.x = 0;
  3623. element.Defense(this.v3.clone());
  3624. }
  3625. return;
  3626. }
  3627. let len = 2 * GlobalParam.arriveStandWidth;
  3628. let avr = len / (count - 1);
  3629. let index = 0;
  3630. this.v3.z = zs;
  3631. for (const key in this.getDic.container) {
  3632. const element = this.getDic.get(key);
  3633. this.v3.x = GlobalParam.arriveStandWidth - index * avr;
  3634. element.Defense(this.v3.clone());
  3635. index++;
  3636. }
  3637. }
  3638. Attack() {
  3639. for (const key in this.getDic.container) {
  3640. const element = this.getDic.get(key);
  3641. element.Attack();
  3642. }
  3643. }
  3644. GetSprite() {
  3645. let count = this.getDic.size;
  3646. let a = GameTool.randomInt(1, count);
  3647. let tindex = 1;
  3648. for (const key in this.getDic.container) {
  3649. if (tindex == a) {
  3650. const element = this.getDic.get(key);
  3651. return element.selfobj;
  3652. }
  3653. tindex++;
  3654. }
  3655. return null;
  3656. }
  3657. TiaoWu() {
  3658. for (const key in this.getDic.container) {
  3659. let t = PlaneManager.Instance.GetWuDaoPosition();
  3660. if (!t)
  3661. return;
  3662. const element = this.getDic.get(key);
  3663. element.TiaoWu(t);
  3664. }
  3665. }
  3666. Reset() {
  3667. let arr = [];
  3668. for (const key in this.friendDic.container) {
  3669. arr.push(key);
  3670. }
  3671. if (arr.length > 0) {
  3672. for (let index = 0; index < arr.length; index++) {
  3673. const element = arr[index];
  3674. let s = this.friendDic.get(element);
  3675. if (s)
  3676. s.Recover();
  3677. }
  3678. }
  3679. console.log("this.friendDic.size", this.friendDic.size);
  3680. this.getDic.clear();
  3681. }
  3682. TiaoWu1() {
  3683. for (const key in this.getDic.container) {
  3684. let t = PlaneManager.Instance.GetWuDaoPosition();
  3685. const element = this.getDic.get(key);
  3686. element.SetPar();
  3687. if (t) {
  3688. element.TiaoWu(t);
  3689. }
  3690. }
  3691. }
  3692. _createtrialmodel() {
  3693. let dataPar = MainRoleManager.Instance.GetMatePos();
  3694. if (!dataPar) {
  3695. console.warn("friendPar没有位置了");
  3696. return;
  3697. }
  3698. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
  3699. if (p) {
  3700. let tar = dataPar["sp"];
  3701. tar.addChild(p);
  3702. p.transform.localPosition = MathTool.VecZero;
  3703. p.transform.localRotationEuler = MathTool.VecZero;
  3704. let ps = p.getComponent(Mate);
  3705. if (!ps)
  3706. ps = p.addComponent(Mate);
  3707. ps.TrialAdd(dataPar);
  3708. this.friendDic.set(p.id, ps);
  3709. }
  3710. }
  3711. }
  3712. var Sprite$8 = Laya.Sprite;
  3713. var Text$3 = Laya.Text;
  3714. class PlaneManager {
  3715. constructor() {
  3716. this.airisshow = false;
  3717. this.danceindex = 0;
  3718. }
  3719. static get Instance() {
  3720. return this.instance || (this.instance = new PlaneManager());
  3721. }
  3722. Init(finalP) {
  3723. if (!finalP) {
  3724. console.error("飞机不存在");
  3725. return;
  3726. }
  3727. this.finalTra = finalP.transform;
  3728. this.jumpCamTra = finalP.getChildByName("jumpCamPos").transform;
  3729. this.FinalBlock = finalP.getChildAt(0);
  3730. this.EnemySpawnPoint = this.FinalBlock.getChildByName("EnemySpawnPoint").transform;
  3731. this.PlayerDancePoint = this.FinalBlock.getChildByName("PlayerDancePoint");
  3732. this.helicopter = this.FinalBlock.getChildByName("helicopter");
  3733. this.toured = this.FinalBlock.getChildByName("toured").transform;
  3734. this.FinalBlock.active = false;
  3735. }
  3736. SetAir() {
  3737. this.danceindex = 0;
  3738. this.airisshow = false;
  3739. this.FinalBlock.active = false;
  3740. let count = LevelController.Instance._level.road_list.length;
  3741. this.winPos = (count) * GlobalParam.barrierRoadLength;
  3742. this.finalTra.localPositionZ = this.winPos;
  3743. this.stageProLen = this.winPos - MainRoleManager.Instance.playerStartTra.localPositionZ;
  3744. let isgold = LevelController.Instance._level.isgold;
  3745. this.helicopter.active = isgold;
  3746. this.toured1 = this.FinalBlock.getChildByName("toured1").transform.position.clone();
  3747. this.toured2 = this.FinalBlock.getChildByName("toured2").transform.position.clone();
  3748. }
  3749. createDarkOrchidRect() {
  3750. var darkOrchidRect = new Sprite$8();
  3751. darkOrchidRect.name = "暗紫色矩形容器";
  3752. darkOrchidRect.graphics.drawRect(-100, -100, 200, 200, "#9932CC");
  3753. darkOrchidRect.pos(Laya.stage.width / 2, Laya.stage.height / 2);
  3754. Laya.stage.addChild(darkOrchidRect);
  3755. darkOrchidRect.mouseThrough = true;
  3756. }
  3757. createLogger() {
  3758. this.logger = new Text$3();
  3759. this.logger.size(Laya.stage.width, Laya.stage.height);
  3760. this.logger.align = 'right';
  3761. this.logger.fontSize = 20;
  3762. this.logger.color = "#FFFFFF";
  3763. Laya.stage.addChild(this.logger);
  3764. }
  3765. CheckPlayerRoadPos(_zp) {
  3766. let d = this.winPos - _zp;
  3767. if (d <= 60 && !this.airisshow) {
  3768. this.ShowAir();
  3769. return;
  3770. }
  3771. DispatcherManager.event(EventType.Event.SetStagePro, (this.stageProLen - d) / this.stageProLen);
  3772. if (d <= 0) {
  3773. this.NearDestination();
  3774. }
  3775. }
  3776. ShowAir() {
  3777. this.airisshow = true;
  3778. this.FinalBlock.active = true;
  3779. }
  3780. NearDestination() {
  3781. MainRoleManager.Instance.Destination();
  3782. if (LevelController.Instance._level.isgold) {
  3783. GameManager.Instance.Congratulate(true);
  3784. }
  3785. else {
  3786. let count = 0;
  3787. let isdesd = MainRoleManager.Instance.NearIsdead();
  3788. if (!isdesd) {
  3789. count++;
  3790. }
  3791. let num = MateManager.Instance.NearDestination();
  3792. count += num;
  3793. if (count == 0)
  3794. return;
  3795. MateManager.Instance.Near(count, this.toured.position.z);
  3796. if (!isdesd)
  3797. MainRoleManager.Instance.Near(count, this.toured.position.z);
  3798. Laya.timer.once(1300, this, this.CreateOpponent);
  3799. }
  3800. }
  3801. CreateOpponent() {
  3802. MainRoleManager.Instance.Attack();
  3803. MateManager.Instance.Attack();
  3804. RoleManager.Instance.CreateOpponent(this.EnemySpawnPoint.position.clone());
  3805. }
  3806. GetWuDaoPosition() {
  3807. if (this.danceindex > this.PlayerDancePoint.numChildren - 1)
  3808. return null;
  3809. let t = this.PlayerDancePoint.getChildAt(this.danceindex).transform;
  3810. this.danceindex++;
  3811. return t;
  3812. }
  3813. }
  3814. var Vector3$3 = Laya.Vector3;
  3815. var Quaternion$2 = Laya.Quaternion;
  3816. var Sprite$9 = Laya.Sprite;
  3817. class MainRole extends Laya.Script3D {
  3818. constructor() {
  3819. super(...arguments);
  3820. this.isarrive = false;
  3821. this.isdead = false;
  3822. this.isFristShoot = true;
  3823. this._up = new Vector3$3(0, 1, 0);
  3824. this.ts = new Vector3$3(0, 0, 0.01);
  3825. }
  3826. onAwake() {
  3827. this.selfobj = this.owner;
  3828. this._transform = this.selfobj.transform;
  3829. this.body = this.selfobj.getChildAt(0);
  3830. this.animator = this.body.getComponent(Laya.Animator);
  3831. this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
  3832. this.shootPos = this.selfobj.getChildByName("bulletPos").transform;
  3833. this._speed = MathTool.VecZero;
  3834. this._speed.z = GlobalParam.playerspeed;
  3835. this.forW = MathTool.VecZero;
  3836. this.quaternion1 = new Quaternion$2();
  3837. }
  3838. Move() {
  3839. if (this.isarrive) {
  3840. if (this.isdead)
  3841. return;
  3842. this.RayReset();
  3843. return;
  3844. }
  3845. this._transform.translate(this._speed);
  3846. let pz = this._transform.localPositionZ;
  3847. ConstructManager.Instance.CheckMainRolePos(pz);
  3848. PlaneManager.Instance.CheckPlayerRoadPos(pz);
  3849. StreetManager.Instance.CheckPlayerRoadPos(pz);
  3850. CameraManager.Instance.CameraFollow(pz);
  3851. if (this.isdead)
  3852. return;
  3853. this.RayReset();
  3854. }
  3855. Near() {
  3856. this.isarrive = true;
  3857. }
  3858. Start() {
  3859. this.isdead = false;
  3860. this.isarrive = false;
  3861. Laya.timer.frameLoop(1, this, this.Move);
  3862. }
  3863. drawPentagram() {
  3864. var canvas = new Sprite$9();
  3865. Laya.stage.addChild(canvas);
  3866. var path = [];
  3867. path.push(0, -130);
  3868. path.push(33, -33);
  3869. path.push(137, -30);
  3870. path.push(55, 32);
  3871. path.push(85, 130);
  3872. path.push(0, 73);
  3873. path.push(-85, 130);
  3874. path.push(-55, 32);
  3875. path.push(-137, -30);
  3876. path.push(-33, -33);
  3877. canvas.graphics.drawPoly(Laya.stage.width / 2, Laya.stage.height / 2, path, "#FF7F50");
  3878. }
  3879. PlayAni(clip, speed, callback) {
  3880. this.animator.play(clip);
  3881. if (!speed)
  3882. speed = 1;
  3883. this.animator.speed = speed;
  3884. }
  3885. Slider(x) {
  3886. this._transform.localPositionX += x;
  3887. let px = this._transform.localPositionX;
  3888. let abs = Math.abs(px);
  3889. if (abs > GlobalParam.playerMoveMaxX) {
  3890. if (px > 0)
  3891. this._transform.localPositionX = GlobalParam.playerMoveMaxX;
  3892. else
  3893. this._transform.localPositionX = -GlobalParam.playerMoveMaxX;
  3894. }
  3895. }
  3896. CreateBullet() {
  3897. if (this.isdead)
  3898. return null;
  3899. return this.shootPos;
  3900. }
  3901. Dead(pos) {
  3902. this.isdead = true;
  3903. this.body.active = false;
  3904. ParticleManager.Instance.BloodEffect(pos);
  3905. MainRoleManager.Instance.CheckGameOver(true);
  3906. }
  3907. Reset() {
  3908. this.body.active = true;
  3909. this.PlayAni(MusicType.Idle, 1);
  3910. Laya.timer.clearAll(this);
  3911. }
  3912. RayReset() {
  3913. let origP = this.rayPoint.position;
  3914. if (!this._scene) {
  3915. this._scene = Scene3DManager.Instance.MainScene;
  3916. }
  3917. if (!this.rayF) {
  3918. this.rayF = new Laya.Ray(MathTool.VecZero, new Vector3$3(0, 0, 1));
  3919. this.outHitF = new Laya.HitResult();
  3920. }
  3921. this.rayF.origin = origP;
  3922. let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalParam.playerRayLengthF);
  3923. if (isHItF) {
  3924. let obj = this.outHitF.collider.owner;
  3925. this.Dead(this.outHitF.point);
  3926. return;
  3927. }
  3928. if (!this.rayL) {
  3929. this.rayL = new Laya.Ray(MathTool.VecZero, new Vector3$3(1, 0, 0));
  3930. this.outHitL = new Laya.HitResult();
  3931. }
  3932. this.rayL.origin = origP;
  3933. let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalParam.playerRayLengthLR);
  3934. if (isHItL) {
  3935. let obj = this.outHitL.collider.owner;
  3936. this.Dead(this.outHitL.point);
  3937. return;
  3938. }
  3939. if (!this.rayR) {
  3940. this.rayR = new Laya.Ray(MathTool.VecZero, new Vector3$3(-1, 0, 0));
  3941. this.outHitR = new Laya.HitResult();
  3942. }
  3943. this.rayR.origin = origP;
  3944. let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalParam.playerRayLengthLR);
  3945. if (isHItR) {
  3946. let obj = this.outHitR.collider.owner;
  3947. this.Dead(this.outHitR.point);
  3948. return;
  3949. }
  3950. }
  3951. setup() {
  3952. var bg = new Sprite$9();
  3953. bg.loadImage("res/bg2.png");
  3954. Laya.stage.addChild(bg);
  3955. this.bg2 = new Sprite$9();
  3956. this.bg2.loadImage("res/bg2.png");
  3957. Laya.stage.addChild(this.bg2);
  3958. this.bg2.scale(3, 3);
  3959. this.maskSp = new Sprite$9();
  3960. this.maskSp.loadImage("res/mask.png");
  3961. this.maskSp.pivot(50, 50);
  3962. this.bg2.mask = this.maskSp;
  3963. }
  3964. _attack() {
  3965. if (this.isdead)
  3966. return;
  3967. if (this.enemyTar == null) {
  3968. this.enemyTar = RoleManager.Instance.GetOpponent();
  3969. if (this.enemyTar != null) {
  3970. this.tp = this.enemyTar.transform.position.clone();
  3971. Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
  3972. this.quaternion1.invert(this.quaternion1);
  3973. this._transform.rotation = this.quaternion1.clone();
  3974. }
  3975. }
  3976. else {
  3977. if (!this.enemyTar.active) {
  3978. this.enemyTar = RoleManager.Instance.GetOpponent();
  3979. if (this.enemyTar != null) {
  3980. this.tp = this.enemyTar.transform.position.clone();
  3981. Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
  3982. this.quaternion1.invert(this.quaternion1);
  3983. this._transform.rotation = this.quaternion1.clone();
  3984. }
  3985. }
  3986. if (this.enemyTar == null) {
  3987. MainRoleManager.Instance.CreateOver(true);
  3988. this.isFristShoot = true;
  3989. return;
  3990. }
  3991. if (this.isFristShoot) {
  3992. this.isFristShoot = false;
  3993. MainRoleManager.Instance.CreateShoot(true);
  3994. }
  3995. this.tp = this.enemyTar.transform.position.clone();
  3996. Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
  3997. this.quaternion1.invert(this.quaternion1);
  3998. this._transform.rotation = this.quaternion1.clone();
  3999. }
  4000. }
  4001. TiaoWu(sp) {
  4002. this.PlayAni(MusicType.RunAndGun, 2);
  4003. this.dancepos = sp.position.clone();
  4004. this.r = sp.rotationEuler.clone();
  4005. Laya.timer.frameLoop(1, this, this.PlayWuDao);
  4006. }
  4007. PlayWuDao() {
  4008. Vector3$3.subtract(this.dancepos, this._transform.position, this.forW);
  4009. Vector3$3.normalize(this.forW, this.forW);
  4010. this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  4011. this._transform.translate(this.forW);
  4012. if (Vector3$3.distance(this._transform.position, this.dancepos) < 0.15) {
  4013. Laya.timer.clear(this, this.PlayWuDao);
  4014. this._transform.position = this.dancepos.clone();
  4015. this._transform.rotationEuler = this.r.clone();
  4016. this.PlayAni(MusicType.Dance, 1);
  4017. return;
  4018. }
  4019. Quaternion$2.lookAt(this.dancepos, this._transform.position, this._up, this.quaternion1);
  4020. this.quaternion1.invert(this.quaternion1);
  4021. this._transform.rotation = this.quaternion1.clone();
  4022. }
  4023. Defense(pos) {
  4024. if (this.isdead)
  4025. return;
  4026. this.tp = pos;
  4027. Quaternion$2.lookAt(pos, this._transform.position, this._up, this.quaternion1);
  4028. this.quaternion1.invert(this.quaternion1);
  4029. this._transform.rotation = this.quaternion1.clone();
  4030. this.PlayAni(MusicType.CrouchFiring, 1);
  4031. Laya.timer.frameLoop(1, this, this._Defense);
  4032. }
  4033. _Defense() {
  4034. Vector3$3.subtract(this.tp, this._transform.position, this.forW);
  4035. Vector3$3.normalize(this.forW, this.forW);
  4036. this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  4037. this._transform.translate(this.forW);
  4038. if (Vector3$3.distance(this._transform.position, this.tp) < 0.1) {
  4039. Laya.timer.clear(this, this._Defense);
  4040. return;
  4041. }
  4042. Quaternion$2.lookAt(this.tp, this._transform.position, this._up, this.quaternion1);
  4043. this.quaternion1.invert(this.quaternion1);
  4044. this._transform.rotation = this.quaternion1.clone();
  4045. }
  4046. Attack() {
  4047. Laya.timer.clear(this, this._Defense);
  4048. this.isFristShoot = true;
  4049. this.enemyTar = null;
  4050. Laya.timer.frameLoop(1, this, this._attack);
  4051. }
  4052. }
  4053. var Vector3$4 = Laya.Vector3;
  4054. var Text$4 = Laya.Text;
  4055. var HScrollBar = Laya.HScrollBar;
  4056. var VScrollBar = Laya.VScrollBar;
  4057. class MainRoleManager {
  4058. constructor() {
  4059. this.isover = false;
  4060. this.isClickCom = true;
  4061. this.isend = true;
  4062. }
  4063. static get Instance() {
  4064. return this.instance || (this.instance = new MainRoleManager());
  4065. }
  4066. Init(startPos, playerCon) {
  4067. this.playerStartTra = startPos.transform;
  4068. this.playerContainer = playerCon;
  4069. }
  4070. ChangeModel() {
  4071. if (this.player)
  4072. GamePool.Instance.RecoverModel(this.player);
  4073. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
  4074. if (p) {
  4075. this.player = p;
  4076. this.SetMatePos(p);
  4077. this.playerTra = this.player.transform;
  4078. this.playerTra.position = this.playerStartTra.position.clone();
  4079. this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
  4080. this.playerContainer.addChild(this.player);
  4081. let ps = this.player.getComponent(MainRole);
  4082. if (ps)
  4083. this.playerScript = ps;
  4084. else
  4085. this.playerScript = this.player.addComponent(MainRole);
  4086. }
  4087. }
  4088. SetMatePos(player) {
  4089. this.MateArrPosition = [];
  4090. let par = player.getChildByName("FriendSpawPos");
  4091. if (!par)
  4092. console.error("friend父物体不存在");
  4093. for (let index = 0; index < par.numChildren; index++) {
  4094. let data = {};
  4095. data["ishave"] = false;
  4096. data["sp"] = par.getChildAt(index);
  4097. this.MateArrPosition.push(data);
  4098. }
  4099. }
  4100. GetMatePos() {
  4101. for (let index = 0; index < this.MateArrPosition.length; index++) {
  4102. const element = this.MateArrPosition[index];
  4103. if (!element["ishave"])
  4104. return element;
  4105. }
  4106. return null;
  4107. }
  4108. createTexts() {
  4109. var t1 = this.createText();
  4110. t1.overflow = Text$4.VISIBLE;
  4111. t1.pos(10, 10);
  4112. var t2 = this.createText();
  4113. t2.overflow = Text$4.SCROLL;
  4114. t2.pos(10, 110);
  4115. var t3 = this.createText();
  4116. t3.overflow = Text$4.HIDDEN;
  4117. t3.pos(10, 210);
  4118. }
  4119. createText() {
  4120. var txt = new Text$4();
  4121. txt.text =
  4122. "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!\n" +
  4123. "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!\n" +
  4124. "Layabox是HTML5引擎技术提供商与优秀的游戏发行商,面向AS/JS/TS开发者提供HTML5开发技术方案!";
  4125. txt.borderColor = "#FFFF00";
  4126. txt.size(300, 50);
  4127. txt.fontSize = 20;
  4128. txt.color = "#ffffff";
  4129. Laya.stage.addChild(txt);
  4130. return txt;
  4131. }
  4132. PlayerSlip(offsetX) {
  4133. let x = offsetX.toFixed(2);
  4134. let x1 = Number(x) * GlobalParam.sliderFactor;
  4135. if (this.playerScript)
  4136. this.playerScript.Slider(x1);
  4137. }
  4138. CreateOver(isgameover = false) {
  4139. this.isend = true;
  4140. if (!isgameover)
  4141. DispatcherManager.event(EventType.Event.StopShot);
  4142. }
  4143. IsShoot() {
  4144. return !this.isend;
  4145. }
  4146. Destination() {
  4147. MouseEvent.Instance.OnClickUp();
  4148. MainRoleManager.Instance.CreateOver();
  4149. MouseEvent.Instance._Switch = false;
  4150. GameManager.Instance.Near();
  4151. if (!this.playerScript)
  4152. return;
  4153. this.playerScript.Near();
  4154. }
  4155. NearIsdead() {
  4156. if (!this.playerScript)
  4157. return true;
  4158. return this.playerScript.isdead;
  4159. }
  4160. Near(count, z) {
  4161. if (!this.playerScript)
  4162. return;
  4163. if (count == 1) {
  4164. this.playerScript.Defense(new Vector3$4(0, 0, z));
  4165. }
  4166. else {
  4167. this.playerScript.Defense(new Vector3$4(-GlobalParam.arriveStandWidth, 0, z));
  4168. }
  4169. }
  4170. Attack() {
  4171. if (!this.playerScript)
  4172. return;
  4173. this.isover = true;
  4174. this.playerScript.Attack();
  4175. }
  4176. CreateShoot(isgameover = false) {
  4177. if (!this.playerScript)
  4178. return;
  4179. this.isend = false;
  4180. if (!this.isClickCom)
  4181. return;
  4182. console.log("开始创建子弹");
  4183. this.isClickCom = false;
  4184. this._CreateShoot();
  4185. Laya.timer.loop(PlayerManager.bulletTime * 1000, this, this._Loop);
  4186. }
  4187. _Loop() {
  4188. if (this.isend) {
  4189. Laya.timer.clear(this, this._Loop);
  4190. this.isClickCom = true;
  4191. return;
  4192. }
  4193. this._CreateShoot();
  4194. }
  4195. _CreateShoot() {
  4196. WXSdk.ShortVibrate();
  4197. SettingController.Instance.PlaySound(SoundType.hit);
  4198. let bulletPos = this.playerScript.CreateBullet();
  4199. if (bulletPos == null)
  4200. return;
  4201. let bu = GamePool.Instance.GetModel(GamePool.modeltype.PlayerShoot);
  4202. if (bu) {
  4203. Scene3DManager.Instance.bulletCon.addChild(bu);
  4204. bu.transform.position = bulletPos.position.clone();
  4205. bu.transform.localRotationEuler = bulletPos.rotationEuler.clone();
  4206. let pb = bu.getComponent(MainRoleShot);
  4207. if (!pb)
  4208. pb = bu.addComponent(MainRoleShot);
  4209. pb.Start(bulletPos, this.isover);
  4210. }
  4211. }
  4212. CheckGameOver(isplayer) {
  4213. if (isplayer) {
  4214. let count = MateManager.Instance.NearDestination();
  4215. if (count == 0) {
  4216. this.playerScript.Near();
  4217. GameManager.Instance.Over();
  4218. }
  4219. }
  4220. else {
  4221. let count = MateManager.Instance.NearDestination();
  4222. if (count == 0) {
  4223. let isplayerdead = this.playerScript.isdead;
  4224. if (isplayerdead) {
  4225. this.playerScript.Near();
  4226. GameManager.Instance.Over();
  4227. }
  4228. }
  4229. }
  4230. }
  4231. GoToTiaoWu() {
  4232. if (!this.playerScript)
  4233. return;
  4234. let t = PlaneManager.Instance.GetWuDaoPosition();
  4235. if (!t)
  4236. return;
  4237. this.playerScript.TiaoWu(t);
  4238. }
  4239. Reset() {
  4240. for (let index = 0; index < this.MateArrPosition.length; index++) {
  4241. const element = this.MateArrPosition[index];
  4242. element["ishave"] = false;
  4243. }
  4244. this.isover = false;
  4245. if (!this.playerScript)
  4246. return;
  4247. this.playerScript.Reset();
  4248. }
  4249. HidePlayer() {
  4250. if (this.player)
  4251. this.player.active = false;
  4252. }
  4253. onSkinLoadComplete() {
  4254. this.placeHScroller();
  4255. this.placeVScroller();
  4256. }
  4257. placeHScroller() {
  4258. var hs = new HScrollBar();
  4259. hs.skin = "res/ui/hscroll.png";
  4260. hs.width = 300;
  4261. hs.pos(50, 170);
  4262. hs.min = 0;
  4263. hs.max = 100;
  4264. }
  4265. placeVScroller() {
  4266. var vs = new VScrollBar();
  4267. vs.skin = "res/ui/vscroll.png";
  4268. vs.height = 300;
  4269. vs.pos(400, 50);
  4270. vs.min = 0;
  4271. vs.max = 100;
  4272. Laya.stage.addChild(vs);
  4273. }
  4274. MadePlayer() {
  4275. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + PlayerManager.Instance.equipId);
  4276. if (p) {
  4277. this.player = p;
  4278. this.SetMatePos(p);
  4279. this.playerTra = this.player.transform;
  4280. this.playerTra.position = this.playerStartTra.position.clone();
  4281. this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
  4282. this.playerContainer.addChild(this.player);
  4283. let ps = this.player.getComponent(MainRole);
  4284. if (ps)
  4285. this.playerScript = ps;
  4286. else
  4287. this.playerScript = this.player.addComponent(MainRole);
  4288. }
  4289. else {
  4290. console.error("player不存在");
  4291. }
  4292. }
  4293. SetPlayerPosition() {
  4294. this.player.active = true;
  4295. this.playerTra.position = this.playerStartTra.position.clone();
  4296. this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
  4297. this.playerScript.PlayAni(MusicType.Idle, 1);
  4298. }
  4299. SetModelPos(x) {
  4300. if (!this.player) {
  4301. this.MadePlayer();
  4302. this.SetPlayerPosition();
  4303. }
  4304. if (!this._maincamera) {
  4305. this._maincamera = CameraManager.Instance._maincamera;
  4306. this._distance = -Vector3$4.distance(this.playerTra.position, this._maincamera.transform.position);
  4307. this._posy = MatrixTransform.WorldToScreen2(this._maincamera, this.playerTra.position).y;
  4308. }
  4309. let uiP = new Vector3$4(x, this._posy, this._distance);
  4310. let p = MatrixTransform.ScreenToWorld(this._maincamera, uiP);
  4311. this.playerTra.localPositionX = p.x;
  4312. }
  4313. Start() {
  4314. if (this.playerScript) {
  4315. this.playerScript.Start();
  4316. this.playerScript.PlayAni(MusicType.RunAndGun, 2);
  4317. }
  4318. }
  4319. }
  4320. var Vector3$5 = Laya.Vector3;
  4321. var CameraState;
  4322. (function (CameraState) {
  4323. CameraState[CameraState["game"] = 1] = "game";
  4324. CameraState[CameraState["jump"] = 2] = "jump";
  4325. })(CameraState || (CameraState = {}));
  4326. class Camera extends Laya.Script3D {
  4327. constructor() {
  4328. super();
  4329. this.arg = 0.1;
  4330. this.startShake = false;
  4331. this.seconds = 0;
  4332. this.started = false;
  4333. this.quake = 0.3;
  4334. this._position = new Laya.Vector3();
  4335. this._outPos = new Laya.Vector3();
  4336. this.scaleDelta = 0;
  4337. this.scale = new Laya.Vector3(0.1, 0.1, 0.1);
  4338. this.canmovegame = false;
  4339. }
  4340. onAwake() {
  4341. this.selfObj = this.owner;
  4342. this._tran = this.selfObj.transform;
  4343. this.nowP = MathTool.VecZero;
  4344. this.nowR = MathTool.VecZero;
  4345. this.dis = MathTool.VecZero;
  4346. this.temp = MathTool.VecZero;
  4347. }
  4348. Init() {
  4349. let t = CameraManager.Instance.startPosTra;
  4350. this._tran.position = t.position.clone();
  4351. this._tran.localRotationEuler = MathTool.SpToCam(t.localRotationEuler.clone());
  4352. this.dis.x = MainRoleManager.Instance.playerStartTra.position.x - this._tran.position.x;
  4353. this.dis.y = MainRoleManager.Instance.playerStartTra.position.y - this._tran.position.y;
  4354. this.dis.z = MainRoleManager.Instance.playerStartTra.position.z - this._tran.position.z;
  4355. }
  4356. StopMove() {
  4357. Laya.timer.clear(this, this.JumpCameraMove);
  4358. }
  4359. JumpCameraMove() {
  4360. let p, r;
  4361. if (this.arg == 1) {
  4362. p = this._transform.position;
  4363. r = MathTool.SpToCam(this._transform.localRotationEuler.clone());
  4364. }
  4365. else {
  4366. p = MathTool.MixVector3(this._tran.position.clone(), this._transform.position, this.arg, this.nowP);
  4367. r = MathTool.MixVector3(this._tran.localRotationEuler, MathTool.SpToCam(this._transform.localRotationEuler.clone()), this.arg, this.nowR);
  4368. }
  4369. this._tran.position = p;
  4370. this._tran.localRotationEuler = r;
  4371. }
  4372. CameraAction(type, arg) {
  4373. this.arg = arg;
  4374. switch (type) {
  4375. case CameraState.game:
  4376. this._transform = MainRoleManager.Instance.playerTra;
  4377. if (!this._transform)
  4378. return;
  4379. let t = CameraManager.Instance.startPosTra;
  4380. this._tran.position = t.position.clone();
  4381. this._tran.localRotationEuler = MathTool.SpToCam(t.localRotationEuler.clone());
  4382. this.canmovegame = true;
  4383. break;
  4384. case CameraState.jump:
  4385. this._transform = PlaneManager.Instance.jumpCamTra;
  4386. if (!this._transform)
  4387. return;
  4388. this.canmovegame = false;
  4389. Laya.timer.frameLoop(1, this, this.JumpCameraMove);
  4390. Laya.timer.once(3000, this, this.StopMove);
  4391. break;
  4392. }
  4393. }
  4394. onComplete() {
  4395. var grid = this._scene.addChild(Laya.Loader.getRes("res/threeDimen/staticModel/grid/plane.lh"));
  4396. grid.getChildAt(0).meshRenderer.receiveShadow = true;
  4397. grid.getChildAt(0).layer = 5;
  4398. var staticLayaMonkey = new Laya.MeshSprite3D(Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/Assets/LayaMonkey/LayaMonkey-LayaMonkey.lm"));
  4399. this._scene.addChild(staticLayaMonkey);
  4400. staticLayaMonkey.meshRenderer.material = Laya.Loader.getRes("res/threeDimen/skinModel/LayaMonkey/Assets/LayaMonkey/Materials/T_Diffuse.lmat");
  4401. staticLayaMonkey.layer = 1;
  4402. staticLayaMonkey.transform.position = new Laya.Vector3(0, 0, 0.5);
  4403. staticLayaMonkey.transform.localScale = new Laya.Vector3(0.3, 0.3, 0.3);
  4404. staticLayaMonkey.transform.rotation = new Laya.Quaternion(0.7071068, 0, 0, -0.7071067);
  4405. staticLayaMonkey.meshRenderer.castShadow = true;
  4406. var layaMonkey_clone1 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5));
  4407. var layaMonkey_clone2 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5));
  4408. var layaMonkey_clone3 = Laya.Sprite3D.instantiate(staticLayaMonkey, this._scene, false, new Laya.Vector3(0.0, 0, 0.5));
  4409. layaMonkey_clone1.layer = 2;
  4410. layaMonkey_clone2.layer = 3;
  4411. layaMonkey_clone3.layer = 0;
  4412. layaMonkey_clone1.transform.translate(new Laya.Vector3(1.5, 0, 0.0));
  4413. layaMonkey_clone2.transform.translate(new Laya.Vector3(-1.5, 0, 0.0));
  4414. layaMonkey_clone3.transform.translate(new Laya.Vector3(2.5, 0, 0.0));
  4415. layaMonkey_clone2.transform.rotate(new Laya.Vector3(0, 60, 0), false, false);
  4416. var scale = new Laya.Vector3(0.1, 0.1, 0.1);
  4417. layaMonkey_clone3.transform.localScale = scale;
  4418. }
  4419. onDestroy() {
  4420. Laya.timer.clearAll(this);
  4421. }
  4422. ShakeFor(a, b) {
  4423. this.camPOS = this.selfObj.transform.position.clone();
  4424. this.seconds = a;
  4425. this.started = true;
  4426. this.startShake = true;
  4427. this.quake = b;
  4428. }
  4429. Shake() {
  4430. var x = GameTool.random_1to1() * this.quake;
  4431. var y = GameTool.random_1to1() * this.quake;
  4432. var z = GameTool.random_1to1() * this.quake;
  4433. 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);
  4434. this.selfObj.transform.position = temp;
  4435. }
  4436. onLateUpdate() {
  4437. if (this.startShake) {
  4438. this.Shake();
  4439. }
  4440. if (this.started) {
  4441. this.started = false;
  4442. Laya.timer.once(this.seconds * 1000, this, () => {
  4443. this.startShake = false;
  4444. this.selfObj.transform.position = this.camPOS;
  4445. });
  4446. }
  4447. }
  4448. animate() {
  4449. this._position.x = Math.sin(this.scaleDelta += 0.01);
  4450. this.layaMonkey3D.transform.position = this._position;
  4451. this.layaMonkey3D.transform.scale = this.scale;
  4452. this.camera.viewport.project(this.layaMonkey3D.transform.position, this.camera.projectionViewMatrix, this._outPos);
  4453. this.layaMonkey2D.pos(this._outPos.x / Laya.stage.clientScaleX, this._outPos.y / Laya.stage.clientScaleY);
  4454. }
  4455. MoveGame(z) {
  4456. if (!this.canmovegame)
  4457. return;
  4458. this.temp.z = z - this.dis.z;
  4459. this._tran.localPositionZ = this.temp.z;
  4460. }
  4461. }
  4462. var Sprite$a = Laya.Sprite;
  4463. var BlurFilter = Laya.BlurFilter;
  4464. class Scene3DManager {
  4465. constructor() {
  4466. this.apePath = "res/apes/monkey2.png";
  4467. }
  4468. static get Instance() {
  4469. return Scene3DManager.instance || (Scene3DManager.instance = new Scene3DManager());
  4470. }
  4471. InitGame() {
  4472. Laya.timer.frameOnce(10, this, () => {
  4473. MainRoleManager.Instance.MadePlayer();
  4474. this.InItScene();
  4475. });
  4476. }
  4477. ;
  4478. Init(_s) {
  4479. if (_s) {
  4480. this.MainScene = _s;
  4481. Laya.stage.addChild(_s);
  4482. }
  4483. else {
  4484. console.error("场景不存在");
  4485. return;
  4486. }
  4487. let sceneNode;
  4488. sceneNode = this.MainScene.getChildByName("scene");
  4489. if (!sceneNode) {
  4490. console.error("场景资源配置错误!");
  4491. return;
  4492. }
  4493. this.MainCamera = this.MainScene.getChildByName("Main Camera");
  4494. this.MainCamera.enableHDR = false;
  4495. this.bulletCon = sceneNode.getChildByName("bulletContainer");
  4496. this.effectCon = sceneNode.getChildByName("effectPos");
  4497. this.SetSceneMaterial();
  4498. let build = sceneNode.getChildByName("buildings");
  4499. ConstructManager.Instance.Init(build);
  4500. let playerStartPos = sceneNode.getChildByName("playerstartPoint");
  4501. let playerCon = sceneNode.getChildByName("playerContainer");
  4502. MainRoleManager.Instance.Init(playerStartPos, playerCon);
  4503. let moveBlockContainer = sceneNode.getChildByName("BlockContainer");
  4504. StreetManager.Instance.Init(moveBlockContainer);
  4505. let towerContainer = sceneNode.getChildByName("towerContainer");
  4506. MoundManager.Instance.Init(towerContainer);
  4507. let startCampos1 = sceneNode.getChildByName("startCamPos");
  4508. let startCamposX = sceneNode.getChildByName("startXCamPos");
  4509. let ps;
  4510. if (GameVersion.isX)
  4511. ps = startCamposX;
  4512. else
  4513. ps = startCampos1;
  4514. CameraManager.Instance.Init(this.MainCamera, ps);
  4515. let finalPos = sceneNode.getChildByName("finalPos");
  4516. PlaneManager.Instance.Init(finalPos);
  4517. this.InitGame();
  4518. }
  4519. createApe() {
  4520. var ape = new Sprite$a();
  4521. ape.loadImage(this.apePath);
  4522. ape.x = (Laya.stage.width - ape.width) / 2;
  4523. ape.y = (Laya.stage.height - ape.height) / 2;
  4524. Laya.stage.addChild(ape);
  4525. this.applayFilter(ape);
  4526. }
  4527. applayFilter(ape) {
  4528. var blurFilter = new BlurFilter();
  4529. blurFilter.strength = 5;
  4530. ape.filters = [blurFilter];
  4531. }
  4532. SetSceneMaterial() {
  4533. this.MainCamera.clearFlag = Laya.BaseCamera.CLEARFLAG_SKY;
  4534. let skyRenderer = this.MainScene.skyRenderer;
  4535. skyRenderer.mesh = Laya.SkyDome.instance;
  4536. let mat = new Laya.SkyProceduralMaterial();
  4537. skyRenderer.material = mat;
  4538. mat.sunDisk = Laya.SkyProceduralMaterial.SUN_NODE;
  4539. mat.skyTint = new Laya.Vector4(1, 0.74, 0.74, 1);
  4540. }
  4541. InItScene() {
  4542. LevelController.Instance.SetLevel();
  4543. PlaneManager.Instance.SetAir();
  4544. ConstructManager.Instance.SetConstruct();
  4545. CameraManager.Instance.SetCameraAction(CameraState.game, 1);
  4546. MainRoleManager.Instance.SetPlayerPosition();
  4547. }
  4548. }
  4549. var Sprite$b = Laya.Sprite;
  4550. var GlowFilter = Laya.GlowFilter;
  4551. class ResourcesManager {
  4552. constructor() {
  4553. this.cloth = [];
  4554. this.apePath = "res/apes/monkey2.png";
  4555. }
  4556. static get Instance() {
  4557. return this.instance || (this.instance = new ResourcesManager());
  4558. }
  4559. static LoadResource(path, complet) {
  4560. Laya.loader.retryNum = 2;
  4561. Laya.loader.maxLoader = 3;
  4562. Laya.loader.retryDelay = 100;
  4563. Laya.loader.create(path, new Laya.Handler(this, complet));
  4564. Laya.loader.on(Laya.Event.ERROR, this, (data) => {
  4565. console.log(data + " 资源加载失败");
  4566. });
  4567. }
  4568. InitAsset() {
  4569. AssetPath.Player.forEach(element => {
  4570. let _player = Laya.loader.getRes(element);
  4571. Laya.loader.clearRes(element);
  4572. this.LoadPoolRes(_player.name, _player);
  4573. });
  4574. AssetPath.Particle.forEach(element => {
  4575. let _effect = Laya.loader.getRes(element);
  4576. Laya.loader.clearRes(element);
  4577. this.LoadPoolRes(_effect.name, _effect);
  4578. });
  4579. let _enemy = Laya.loader.getRes(AssetPath.Enemy);
  4580. Laya.loader.clearRes(AssetPath.Enemy);
  4581. this.LoadPoolRes(_enemy.name, _enemy);
  4582. let _playerbullet = Laya.loader.getRes(AssetPath.PlayerShot);
  4583. Laya.loader.clearRes(AssetPath.PlayerShot);
  4584. this.LoadPoolRes(_playerbullet.name, _playerbullet);
  4585. let _tower = Laya.loader.getRes(AssetPath.Mound);
  4586. Laya.loader.clearRes(AssetPath.Mound);
  4587. this.LoadPoolRes(_tower.name, _tower);
  4588. let _scene = Laya.loader.getRes(AssetPath.MainScene);
  4589. Laya.loader.clearRes(AssetPath.MainScene);
  4590. AssetPath.Barrier.forEach(element => {
  4591. let _barrier = Laya.loader.getRes(element);
  4592. Laya.loader.clearRes(element);
  4593. this.LoadPoolRes(_barrier.name, _barrier);
  4594. });
  4595. Scene3DManager.Instance.Init(_scene);
  4596. }
  4597. LoadPoolRes(name, prefab) {
  4598. GamePool.Instance.InitSelf(name, prefab);
  4599. }
  4600. setup() {
  4601. this.createApe();
  4602. this.applayFilter();
  4603. }
  4604. createApe() {
  4605. this.ape = new Sprite$b();
  4606. this.ape.loadImage(this.apePath);
  4607. var texture = Laya.loader.getRes(this.apePath);
  4608. this.ape.x = (Laya.stage.width - texture.width) / 2;
  4609. this.ape.y = (Laya.stage.height - texture.height) / 2;
  4610. Laya.stage.addChild(this.ape);
  4611. }
  4612. applayFilter() {
  4613. var glowFilter = new GlowFilter("#ffff00", 10, 0, 0);
  4614. this.ape.filters = [glowFilter];
  4615. }
  4616. Load(callback) {
  4617. var arr = [
  4618. AssetPath.MainScene,
  4619. AssetPath.Enemy,
  4620. AssetPath.PlayerShot,
  4621. AssetPath.Mound,
  4622. ];
  4623. let arr1 = arr.concat(AssetPath.Player);
  4624. let arr2 = arr1.concat(AssetPath.Barrier);
  4625. let arr3 = arr2.concat(AssetPath.Particle);
  4626. ResourcesManager.LoadResource(arr3, () => {
  4627. this.InitAsset();
  4628. if (callback)
  4629. callback();
  4630. });
  4631. }
  4632. }
  4633. var REG = Laya.ClassUtils.regClass;
  4634. var ui;
  4635. (function (ui) {
  4636. class AttributeUpViewUI extends Laya.Scene {
  4637. constructor() { super(); }
  4638. createChildren() {
  4639. super.createChildren();
  4640. this.createView(AttributeUpViewUI.uiView);
  4641. }
  4642. }
  4643. AttributeUpViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "14,14,13,15", "right": 0, "left": 0, "bottom": 0, "alpha": 1 }, "compId": 3 }, { "type": "Box", "props": { "y": 253, "x": 42, "width": 636, "height": 538 }, "compId": 4, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/webp.webp.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 31, "child": [{ "type": "Image", "props": { "y": 40, "x": -9, "width": 655, "skin": "Main/shengji-biaoti.png", "height": 102 }, "compId": 32 }] }, { "type": "Button", "props": { "y": 556, "x": 350, "var": "rateBtn", "stateNum": 1, "skin": "Main/landi.png" }, "compId": 34, "child": [{ "type": "Image", "props": { "y": 19, "x": 44, "skin": "Main/gongjisudu-1.png" }, "compId": 35 }, { "type": "Image", "props": { "y": 124, "x": 4, "width": 236, "var": "_rate", "stateNum": 1, "height": 71 }, "compId": 36, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 37 }, { "type": "Image", "props": { "y": 13, "x": 57, "skin": "Main/jinbi-zhu.png" }, "compId": 38, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 39 }] }] }, { "type": "Text", "props": { "y": 71, "x": 72, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 40 }, { "type": "Image", "props": { "y": 124, "x": 5, "width": 235, "visible": false, "var": "_rateVideo", "stateNum": 1, "height": 71 }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 42 }, { "type": "Image", "props": { "y": 16.5, "x": 117.5, "skin": "Main/shipin-biao.png" }, "compId": 43 }] }, { "type": "Image", "props": { "y": 154, "x": 137, "var": "click2", "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 49 }] }, { "type": "Button", "props": { "y": 558, "x": 54, "var": "atkBtn", "stateNum": 1, "skin": "Main/hong-di.png" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 19, "x": 66, "skin": "Main/gongjili-2.png" }, "compId": 10 }, { "type": "Image", "props": { "y": 124, "x": 3, "width": 236, "var": "_atk", "stateNum": 1, "height": 71 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 33 }, { "type": "Image", "props": { "y": 15, "x": 61, "skin": "Main/jinbi-zhu.png" }, "compId": 14, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }] }, { "type": "Text", "props": { "y": 71, "x": 57, "width": 136, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 124, "x": 2, "width": 238, "visible": false, "var": "_atkVideo", "stateNum": 1, "height": 71 }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "Main/shengji-tubiao-1.png" }, "compId": 46 }, { "type": "Image", "props": { "y": 16.5, "x": 119, "skin": "Main/shipin-biao.png" }, "compId": 47 }] }, { "type": "Image", "props": { "y": 154.5, "x": 137, "var": "click1", "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 48 }] }, { "type": "Image", "props": { "x": 201, "var": "backBtn", "skin": "Main/jixuyouxi-bt.png", "runtime": "View/Com/ButtonRunTime.ts", "centerY": 620 }, "compId": 8 }] }, { "type": "Box", "props": { "y": 384, "x": 75, "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 }] }] }, { "type": "Button", "props": { "y": 176, "x": 578, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 94 }], "animations": [{ "nodes": [{ "target": 48, "keyframes": { "y": [{ "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 0 }, { "value": 207, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 5 }, { "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 48, "key": "y", "index": 10 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 49, "keyframes": { "y": [{ "value": 154, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 0 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 5 }, { "value": 154.5, "tweenMethod": "linearNone", "tween": true, "target": 49, "key": "y", "index": 10 }] } }], "name": "ani2", "id": 2, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 68, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 68, "key": "rotation", "index": 20 }] } }, { "target": 73, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 73, "key": "rotation", "index": 20 }] } }, { "target": 77, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 77, "key": "rotation", "index": 20 }] } }, { "target": 81, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 81, "key": "rotation", "index": 20 }] } }, { "target": 82, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 82, "key": "rotation", "index": 20 }] } }, { "target": 83, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 83, "key": "rotation", "index": 20 }] } }], "name": "shakeani", "id": 3, "frameRate": 24, "action": 0 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/webp.webp.png", "Main/shengji-biaoti.png", "Main/landi.png", "Main/gongjisudu-1.png", "Main/shengji-tubiao-1.png", "Main/jinbi-zhu.png", "Main/shipin-biao.png", "Main/shou.png", "Main/hong-di.png", "Main/gongjili-2.png", "Main/jixuyouxi-bt.png", "Main/exit2.png"], "loadList3D": [] };
  4644. ui.AttributeUpViewUI = AttributeUpViewUI;
  4645. REG("ui.AttributeUpViewUI", AttributeUpViewUI);
  4646. class CompleteViewUI extends Laya.Scene {
  4647. constructor() { super(); }
  4648. createChildren() {
  4649. super.createChildren();
  4650. this.createView(CompleteViewUI.uiView);
  4651. }
  4652. }
  4653. CompleteViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "10,10,12,11", "right": 0, "left": 0, "bottom": 0, "alpha": 1 }, "compId": 22 }, { "type": "Image", "props": { "y": 1196, "x": 298, "var": "nextBtn", "skin": "Main/no.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 46 }, { "type": "Image", "props": { "x": 214, "var": "doublegetBtn", "skin": "Main/sanbeilingqu.png", "runtime": "View/Com/ButtonRunTime.ts", "bottom": 350 }, "compId": 28 }, { "type": "Image", "props": { "x": 41, "var": "shibaiTop", "skin": "Main/shibai-di bg.png", "centerY": -182 }, "compId": 68, "child": [{ "type": "Image", "props": { "y": 136, "x": 76, "skin": "Main/shibai-jiesuan-b.png" }, "compId": 121 }] }, { "type": "Image", "props": { "x": 41.5, "var": "winTop", "skin": "Main/shengli-beidi.png", "centerY": -182 }, "compId": 44, "child": [{ "type": "Image", "props": { "y": 132, "x": 76, "skin": "Main/tonggun-biao.png" }, "compId": 122 }] }, { "type": "Image", "props": { "x": 243, "width": 60, "skin": "Main/jinbi-zhu.png", "height": 60, "centerY": 120 }, "compId": 69, "child": [{ "type": "Text", "props": { "y": -8, "x": 77, "width": 165, "var": "valueText", "valign": "middle", "text": "50(+100)", "height": 75, "fontSize": 40, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 70 }] }, { "type": "Box", "props": { "x": 136, "width": 447, "height": 419, "centerY": -138 }, "compId": 71, "child": [{ "type": "Image", "props": { "y": 58, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 76, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 80, "child": [{ "type": "Image", "props": { "y": 15, "x": 17, "skin": "Main/baolei.png" }, "compId": 118 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 83 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "towerValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#48efcc", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 82 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "towerCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#48efcc", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 81 }] }, { "type": "Image", "props": { "y": 179, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 84, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 85, "child": [{ "type": "Image", "props": { "y": 15, "x": 13.5, "skin": "Main/rentou.png" }, "compId": 119 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 88 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "roleCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#99ff53", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 86 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "roleValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#99ff53", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 87 }] }, { "type": "Image", "props": { "y": 301, "x": 0, "width": 448, "skin": "Main/zhengchang-di.png", "height": 100 }, "compId": 89, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "Main/biaozhi-di8.png" }, "compId": 90, "child": [{ "type": "Image", "props": { "y": 13, "x": 16, "skin": "Main/baohe.png" }, "compId": 120 }] }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "Main/jinbi-zhu.png", "height": 50 }, "compId": 93 }, { "type": "Text", "props": { "y": 18, "x": 97, "width": 78, "var": "blockCount", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffe92e", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 91 }, { "type": "Text", "props": { "y": 18, "x": 300, "width": 78, "var": "blockValue", "valign": "middle", "text": "X10", "height": 63, "fontSize": 36, "color": "#ffe92e", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 92 }] }] }, { "type": "Button", "props": { "y": 423, "width": 109, "var": "LeftTopPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 14, "height": 128 }, "compId": 96, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 98 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 99 }] }, { "type": "Button", "props": { "y": 640, "width": 109, "var": "LeftBottomPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 14, "height": 128 }, "compId": 102, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 103 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Button", "props": { "y": 423, "width": 109, "var": "RightTopPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 595, "height": 128 }, "compId": 105, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 107 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 108 }] }, { "type": "Button", "props": { "y": 640, "width": 109, "var": "RightBottomPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 64, "pivotX": 55, "left": 595, "height": 128 }, "compId": 106, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 109, "name": "icon", "height": 91 }, "compId": 109 }, { "type": "Text", "props": { "y": 110, "x": 69, "width": 110, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 17, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 110 }] }, { "type": "Button", "props": { "y": 175, "x": 568.5, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 123 }], "animations": [{ "nodes": [{ "target": 18, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 0 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 20 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleY", "index": 40 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 0 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 20 }, { "value": 0.5, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 18, "key": "scaleX", "index": 40 }] } }], "name": "aim", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 96, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 96, "key": "rotation", "index": 20 }] } }, { "target": 102, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 102, "key": "rotation", "index": 20 }] } }, { "target": 105, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 105, "key": "rotation", "index": 20 }] } }, { "target": 106, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 106, "key": "rotation", "index": 20 }] } }], "name": "pushshake", "id": 2, "frameRate": 24, "action": 0 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/no.png", "Main/sanbeilingqu.png", "Main/shibai-di bg.png", "Main/shibai-jiesuan-b.png", "Main/shengli-beidi.png", "Main/tonggun-biao.png", "Main/jinbi-zhu.png", "Main/zhengchang-di.png", "Main/biaozhi-di8.png", "Main/baolei.png", "Main/rentou.png", "Main/baohe.png", "Main/hutui-1-4.png", "Main/exit2.png"], "loadList3D": [] };
  4654. ui.CompleteViewUI = CompleteViewUI;
  4655. REG("ui.CompleteViewUI", CompleteViewUI);
  4656. class ExitViewUI extends Laya.Scene {
  4657. constructor() { super(); }
  4658. createChildren() {
  4659. super.createChildren();
  4660. this.createView(ExitViewUI.uiView);
  4661. }
  4662. }
  4663. ExitViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/hutui-1-4.png", "sizeGrid": "16,16,14,14", "right": 0, "name": "BG", "left": 0, "bottom": 0 }, "compId": 5 }, { "type": "Image", "props": { "x": 0, "width": 720, "top": 0, "skin": "Main/hutui-1-3.png", "height": 131 }, "compId": 4, "child": [{ "type": "Text", "props": { "y": 84, "x": 360, "width": 135, "valign": "middle", "text": "小程序", "pivotY": 31, "pivotX": 68, "height": 61, "fontSize": 35, "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 6 }, { "type": "Text", "props": { "y": 154, "x": 56, "width": 92, "valign": "middle", "text": "最近使用", "pivotY": 18, "pivotX": 46, "height": 36, "fontSize": 23, "color": "#5d5353", "align": "center", "runtime": "laya.display.Text" }, "compId": 8 }, { "type": "Image", "props": { "y": 174, "width": 753, "skin": "Main/hutui_line.png", "right": 0, "pivotY": 2, "pivotX": 320, "height": 7 }, "compId": 19 }] }, { "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": 101 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 100, "x": 123, "width": 538, "skin": "Main/hutui_line.png", "name": "line", "height": 5 }, "compId": 18 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 100, "name": "icon", "height": 100 }, "compId": 11 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 101, "skin": "Main/zhezhao.png", "name": "zhezhao", "height": 101 }, "compId": 17 }, { "type": "Text", "props": { "y": 0, "x": 150, "width": 473, "valign": "middle", "text": "冲冲冲冲", "name": "name", "height": 100, "fontSize": 30, "align": "left", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 65, "x": 598.5, "width": 49, "skin": "Main/hutui-1-1.png", "pivotY": 23, "pivotX": 25, "name": "star", "height": 46 }, "compId": 13 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 14 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 16 }] }] }], "loadList": ["Main/hutui-1-4.png", "Main/hutui-1-3.png", "Main/hutui_line.png", "Main/zhezhao.png", "Main/hutui-1-1.png"], "loadList3D": [] };
  4664. ui.ExitViewUI = ExitViewUI;
  4665. REG("ui.ExitViewUI", ExitViewUI);
  4666. class ExportViewUI extends Laya.Scene {
  4667. constructor() { super(); }
  4668. createChildren() {
  4669. super.createChildren();
  4670. this.createView(ExportViewUI.uiView);
  4671. }
  4672. }
  4673. ExportViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "var": "BG", "top": 0, "skin": "Main/111111.png", "sizeGrid": "10,12,14,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 5 }, { "type": "Image", "props": { "top": 130, "skin": "Main/haoyourwBg.png", "right": 10, "left": 10, "height": 200 }, "compId": 3, "child": [{ "type": "List", "props": { "y": 52, "x": 11.5, "width": 697, "var": "TopList", "spaceX": 20, "height": 130 }, "compId": 8, "child": [{ "type": "Box", "props": { "y": 0, "x": 0, "width": 130, "renderType": "render", "height": 130 }, "compId": 9, "child": [{ "type": "Image", "props": { "width": 131, "name": "icon", "height": 131 }, "compId": 10 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 11 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 23 }] }] }] }, { "type": "Image", "props": { "top": 360, "skin": "Main/baokuanrwbg.png", "right": 10, "left": 10, "height": 36 }, "compId": 4 }, { "type": "Image", "props": { "x": 209.5, "top": 50, "skin": "Main/hotGameTitle.png" }, "compId": 6 }, { "type": "Button", "props": { "x": 8, "width": 172, "var": "CloseBtn", "top": 50, "stateNum": 1, "skin": "Main/backBtn.png", "height": 51 }, "compId": 7 }, { "type": "List", "props": { "x": 10, "var": "BottomList", "top": 400, "spaceY": 15, "spaceX": 40, "right": 0, "repeatX": 3, "left": 0, "bottom": 150 }, "compId": 12, "child": [{ "type": "Box", "props": { "y": 0, "x": 32, "width": 190, "renderType": "render", "height": 230 }, "compId": 13, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/bg-box.png", "sizeGrid": "33,36,40,30", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 18 }, { "type": "Image", "props": { "y": 40, "x": 0, "width": 190, "name": "icon", "height": 150 }, "compId": 14 }, { "type": "Text", "props": { "y": 190, "x": 1, "width": 189, "valign": "middle", "text": "text", "name": "tip", "height": 41, "fontSize": 23, "align": "center", "runtime": "laya.display.Text" }, "compId": 15 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 190, "name": "bottom", "height": 40 }, "compId": 16 }, { "type": "Text", "props": { "y": 0, "x": 0, "width": 189, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 17 }, { "type": "Button", "props": { "top": 0, "right": 0, "name": "btn", "left": 0, "bottom": 0 }, "compId": 19 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 24 }] }] }, { "type": "Button", "props": { "x": 228, "width": 241, "var": "ContinueBtn", "stateNum": 1, "skin": "Main/zhengchang-di2.png", "sizeGrid": "17,31,12,28", "height": 65, "bottom": 50 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 11, "x": 33.5, "skin": "Main/jixuyouxi.png" }, "compId": 21 }] }], "loadList": ["Main/111111.png", "Main/haoyourwBg.png", "Main/baokuanrwbg.png", "Main/hotGameTitle.png", "Main/backBtn.png", "Main/bg-box.png", "Main/zhengchang-di2.png", "Main/jixuyouxi.png"], "loadList3D": [] };
  4674. ui.ExportViewUI = ExportViewUI;
  4675. REG("ui.ExportViewUI", ExportViewUI);
  4676. class GiftViewUI extends Laya.Scene {
  4677. constructor() { super(); }
  4678. createChildren() {
  4679. super.createChildren();
  4680. this.createView(GiftViewUI.uiView);
  4681. }
  4682. }
  4683. GiftViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "var": "BG", "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "8,10,11,9", "right": 0, "left": 0, "bottom": 0 }, "compId": 6 }, { "type": "Image", "props": { "y": 504, "x": 360, "width": 467, "skin": "Main/liwukuang.png", "pivotY": 234, "pivotX": 234, "name": "kuang", "height": 467 }, "compId": 3, "child": [{ "type": "Image", "props": { "y": 233.5, "x": 233.5, "width": 183, "skin": "Main/lihe.png", "pivotY": 102, "pivotX": 92, "name": "gift", "height": 203 }, "compId": 4 }, { "type": "Image", "props": { "y": 233.5, "x": 233.5, "width": 85, "skin": "Main/wenhao.png", "pivotY": 66, "pivotX": 43, "name": "wenhao", "height": 132 }, "compId": 5 }] }, { "type": "Button", "props": { "x": 352, "width": 200, "var": "HitBtn", "stateNum": 1, "pivotY": 67, "pivotX": 100, "height": 133, "bottom": 8 }, "compId": 9, "child": [{ "type": "Image", "props": { "y": -51, "x": 108, "width": 89, "var": "shou", "skin": "Main/shou1.png", "pivotY": 59, "pivotX": 45, "height": 118 }, "compId": 12 }, { "type": "Image", "props": { "y": 34, "x": 0, "skin": "Main/eee 1@2x.png" }, "compId": 24 }, { "type": "Image", "props": { "y": 45, "x": 100, "width": 174, "skin": "Main/anniu.png", "pivotY": 41, "pivotX": 87, "height": 82 }, "compId": 10 }] }, { "type": "Text", "props": { "y": 356, "x": 360, "width": 199, "valign": "middle", "text": "神秘礼盒", "pivotY": 34, "pivotX": 100, "name": "name", "height": 67, "fontSize": 30, "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 13 }, { "type": "ProgressBar", "props": { "y": 666, "x": 360, "width": 268, "var": "jinduBar", "value": 0, "skin": "Main/di.png", "pivotY": 11, "pivotX": 134, "height": 22 }, "compId": 14 }], "animations": [{ "nodes": [{ "target": 12, "keyframes": { "y": [{ "value": -51, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 0 }, { "value": -90, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 5 }, { "value": -51, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 10 }, { "value": -90, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 15 }, { "value": -51, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "y", "index": 20 }], "x": [{ "value": 108, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "x", "index": 0 }] } }], "name": "click", "id": 1, "frameRate": 24, "action": 0 }], "loadList": ["Main/chunhei.png", "Main/liwukuang.png", "Main/lihe.png", "Main/wenhao.png", "Main/shou1.png", "Main/eee 1@2x.png", "Main/anniu.png", "Main/di.png"], "loadList3D": [] };
  4684. ui.GiftViewUI = GiftViewUI;
  4685. REG("ui.GiftViewUI", GiftViewUI);
  4686. class GoldEggViewUI extends Laya.Scene {
  4687. constructor() { super(); }
  4688. createChildren() {
  4689. super.createChildren();
  4690. this.createView(GoldEggViewUI.uiView);
  4691. }
  4692. }
  4693. GoldEggViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "BG", "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "8,11,10,8", "right": 0, "left": 0, "bottom": 0 }, "compId": 4 }, { "type": "Image", "props": { "y": 288, "x": 177.5, "skin": "Main/zajindan_3.png" }, "compId": 3, "child": [{ "type": "Image", "props": { "y": 284, "x": 456, "width": 137, "skin": "Main/zajindan_5_3.png", "pivotY": 177, "pivotX": 77, "height": 177 }, "compId": 6 }] }, { "type": "ProgressBar", "props": { "y": 725.5, "x": 21, "var": "jindu", "value": 0, "skin": "Main/zadanjindu.png", "rotation": -90 }, "compId": 5 }, { "type": "Button", "props": { "y": 1157, "x": 360, "var": "HitBtn", "stateNum": 1, "skin": "Main/zadan.png", "scaleY": 1.01, "scaleX": 1.01, "anchorY": 0.5, "anchorX": 0.5 }, "compId": 7 }, { "type": "Image", "props": { "y": 1007, "x": 506, "var": "kuangdian", "skin": "Main/kuangdian-2.png" }, "compId": 9 }], "animations": [{ "nodes": [{ "target": 6, "keyframes": { "y": [{ "value": 107, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "y", "index": 0 }, { "value": 284, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "y", "index": 1 }], "x": [{ "value": 379, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 0 }, { "value": 448, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 1 }], "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 0 }, { "value": -6, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 1 }, { "value": -17, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 2 }, { "value": -46, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 3 }, { "value": -19, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 4 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "rotation", "index": 5 }], "pivotY": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "pivotY", "index": 0 }, { "value": 177, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "pivotY", "index": 1 }], "pivotX": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "pivotX", "index": 0 }, { "value": 69, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "pivotX", "index": 1 }] } }, { "target": 4, "keyframes": { "var": [{ "value": "BG", "tweenMethod": "linearNone", "tween": false, "target": 4, "key": "var", "index": 0 }, { "value": "Black", "tweenMethod": "linearNone", "tween": false, "target": 4, "key": "var", "index": 5 }], "name": [{ "value": "BG", "tweenMethod": "linearNone", "tween": false, "target": 4, "key": "name", "index": 0 }, { "value": "", "tweenMethod": "linearNone", "tween": false, "target": 4, "key": "name", "index": 5 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 7, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 0 }, { "value": 0.9, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 20 }, { "value": 1.1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleY", "index": 40 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 0 }, { "value": 0.9, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 10 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 20 }, { "value": 1.1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 30 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 7, "key": "scaleX", "index": 40 }] } }], "name": "btnscale", "id": 2, "frameRate": 24, "action": 0 }], "loadList": ["Main/chunhei.png", "Main/zajindan_3.png", "Main/zajindan_5_3.png", "Main/zadanjindu.png", "Main/zadan.png", "Main/kuangdian-2.png"], "loadList3D": [] };
  4694. ui.GoldEggViewUI = GoldEggViewUI;
  4695. REG("ui.GoldEggViewUI", GoldEggViewUI);
  4696. class GuideViewUI extends Laya.Scene {
  4697. constructor() { super(); }
  4698. createChildren() {
  4699. super.createChildren();
  4700. this.createView(GuideViewUI.uiView);
  4701. }
  4702. }
  4703. GuideViewUI.uiView = { "type": "Scene", "props": { "width": 720, "mouseThrough": true, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "y": 30, "x": 958, "width": 104, "var": "guide1Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 3, "x": -3, "skin": "Main/guangquan(1).png" }, "compId": 8 }, { "type": "Image", "props": { "y": -123, "x": 2, "skin": "Main/jiantou(1).png" }, "compId": 9 }] }, { "type": "Box", "props": { "y": 154, "x": 969, "width": 207, "var": "guide2Box", "scaleY": 0.8, "scaleX": 0.8, "height": 56, "anchorY": 0.5, "anchorX": 0 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 28, "x": 207, "width": 0, "skin": "Main/zuoyou-jiantou(1).png", "rotation": 180, "pivotY": 48, "height": 96 }, "compId": 12 }, { "type": "Image", "props": { "y": 15, "x": 181, "skin": "Main/shou.png" }, "compId": 11 }] }, { "type": "Box", "props": { "y": 298, "x": 1790, "width": 207, "var": "guide3Box", "scaleY": 0.8, "scaleX": 0.8, "height": 48, "anchorY": 0.5, "anchorX": 1 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 22, "x": 0, "width": 0, "skin": "Main/zuoyou-jiantou(1).png", "pivotY": 48, "height": 96 }, "compId": 14 }, { "type": "Image", "props": { "y": 6, "x": -17, "width": 61, "skin": "Main/shou.png" }, "compId": 15 }] }, { "type": "Box", "props": { "y": 278, "x": -163, "width": 104, "var": "guide4Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 19, "child": [{ "type": "Image", "props": { "y": -106, "x": 4, "skin": "Main/jiantou(1).png" }, "compId": 21 }] }, { "type": "Image", "props": { "x": 183, "var": "guide1Image", "skin": "Main/biaoyu.png", "bottom": 220 }, "compId": 16 }, { "type": "Image", "props": { "x": 164, "var": "guide2Image", "skin": "Main/biaoyu4.png", "bottom": 218 }, "compId": 17 }, { "type": "Image", "props": { "x": 136, "var": "guide3Image", "skin": "Main/biaoyu2.png", "bottom": 220 }, "compId": 18 }], "animations": [{ "nodes": [{ "target": 9, "keyframes": { "y": [{ "value": -116, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 0 }, { "value": -197, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 5 }, { "value": -115, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 10 }] } }], "name": "guide1", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 11, "keyframes": { "x": [{ "value": 181, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 0 }, { "value": 21, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 10 }] } }, { "target": 12, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 0 }, { "value": 188, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 10 }] } }], "name": "guide2", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 15, "keyframes": { "x": [{ "value": -17, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 0 }, { "value": 122, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 10 }] } }, { "target": 14, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 0 }, { "value": 149, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 10 }] } }], "name": "guide3", "id": 3, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 21, "keyframes": { "y": [{ "value": -212, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 0 }, { "value": -106, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 10 }] } }], "name": "guide4", "id": 4, "frameRate": 24, "action": 0 }], "loadList": ["Main/guangquan(1).png", "Main/jiantou(1).png", "Main/zuoyou-jiantou(1).png", "Main/shou.png", "Main/biaoyu.png", "Main/biaoyu4.png", "Main/biaoyu2.png"], "loadList3D": [] };
  4704. ui.GuideViewUI = GuideViewUI;
  4705. REG("ui.GuideViewUI", GuideViewUI);
  4706. class InGameViewUI extends Laya.Scene {
  4707. constructor() { super(); }
  4708. createChildren() {
  4709. super.createChildren();
  4710. this.createView(InGameViewUI.uiView);
  4711. }
  4712. }
  4713. InGameViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] };
  4714. ui.InGameViewUI = InGameViewUI;
  4715. REG("ui.InGameViewUI", InGameViewUI);
  4716. class IntensifyViewUI extends Laya.Scene {
  4717. constructor() { super(); }
  4718. createChildren() {
  4719. super.createChildren();
  4720. this.createView(IntensifyViewUI.uiView);
  4721. }
  4722. }
  4723. IntensifyViewUI.uiView = { "type": "Scene", "props": { "width": 720, "sizeGrid": "0,0,0,0", "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "15,13,12,13", "right": 0, "left": 0, "bottom": 0 }, "compId": 64 }, { "type": "Image", "props": { "top": 0, "skin": "Main/bg-sheng.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.8 }, "compId": 3 }, { "type": "Image", "props": { "y": 139, "x": 63.5, "skin": "Main/beijing-di.png" }, "compId": 36 }, { "type": "Box", "props": { "y": 402, "x": 42, "width": 636, "height": 645 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 17, "x": 44.5, "var": "atkBox", "skin": "Main/wenzi-di5.png" }, "compId": 37, "child": [{ "type": "Image", "props": { "y": 43, "x": 183, "skin": "Main/gongji-2-3.png" }, "compId": 38 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 60 }, { "type": "Image", "props": { "y": 58.5, "x": 34, "skin": "Main/gongji-icon.png" }, "compId": 39 }, { "type": "Image", "props": { "y": 125, "x": 179, "skin": "Main/gongji-1-3.png" }, "compId": 40 }, { "type": "Button", "props": { "y": 95.5, "x": 358, "var": "atkupBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 7, "x": 15, "width": 45, "skin": "Main/jinbi-zhu.png", "height": 45 }, "compId": 43, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 44 }] }] }, { "type": "Text", "props": { "y": 38, "x": 390, "width": 106, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 50, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 42 }] }, { "type": "Image", "props": { "y": 226, "x": 44.5, "var": "rateBox", "skin": "Main/wenzi-di5.png" }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 43, "x": 170, "skin": "Main/gongji-2-2.png" }, "compId": 46 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 62 }, { "type": "Image", "props": { "y": 63.5, "x": 35, "skin": "Main/iconqiang.png" }, "compId": 47 }, { "type": "Image", "props": { "y": 125, "x": 164, "skin": "Main/gongji-1-2.png" }, "compId": 48 }, { "type": "Button", "props": { "y": 94.5, "x": 360, "var": "rateupBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 49, "child": [{ "type": "Image", "props": { "y": 7, "x": 12, "width": 45, "skin": "Main/jinbi-zhu.png", "height": 45 }, "compId": 51, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 52 }] }] }, { "type": "Text", "props": { "y": 33, "x": 392, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 50, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 50 }] }, { "type": "Image", "props": { "y": 445, "x": 44.5, "var": "coinBox", "skin": "Main/wenzi-di5.png" }, "compId": 53, "child": [{ "type": "Image", "props": { "y": 43, "x": 161, "skin": "Main/gongji-2.png" }, "compId": 54 }, { "type": "Image", "props": { "y": 48, "x": 26, "skin": "Main/zhuangbei-tubiao-di.png" }, "compId": 63 }, { "type": "Image", "props": { "y": 63.5, "x": 30, "skin": "Main/jinbi.png" }, "compId": 55 }, { "type": "Image", "props": { "y": 124, "x": 161, "skin": "Main/gongji-1.png" }, "compId": 56 }, { "type": "Button", "props": { "y": 94, "x": 351, "var": "getcoinBtn", "stateNum": 1, "skin": "Main/zheng-qianbi-di.png" }, "compId": 57, "child": [{ "type": "Image", "props": { "y": 7, "x": 12, "width": 45, "skin": "Main/shipin-biao.png", "height": 45 }, "compId": 58, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "coinValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 59 }] }] }] }] }, { "type": "Button", "props": { "y": 174.5, "x": 573, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 65 }, { "type": "Button", "props": { "y": 139, "x": 14, "var": "backBtn", "stateNum": 1, "skin": "Main/p__fanhui.png" }, "compId": 66 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/bg-sheng.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", "Main/exit2.png", "Main/p__fanhui.png"], "loadList3D": [] };
  4724. ui.IntensifyViewUI = IntensifyViewUI;
  4725. REG("ui.IntensifyViewUI", IntensifyViewUI);
  4726. class LoadViewUI extends Laya.Scene {
  4727. constructor() { super(); }
  4728. createChildren() {
  4729. super.createChildren();
  4730. this.createView(LoadViewUI.uiView);
  4731. }
  4732. }
  4733. 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": [] };
  4734. ui.LoadViewUI = LoadViewUI;
  4735. REG("ui.LoadViewUI", LoadViewUI);
  4736. class MainViewUI extends Laya.Scene {
  4737. constructor() { super(); }
  4738. createChildren() {
  4739. super.createChildren();
  4740. this.createView(MainViewUI.uiView);
  4741. }
  4742. }
  4743. MainViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "x": 0, "top": 82, "right": 0, "left": 0, "height": 70 }, "compId": 265, "child": [{ "type": "Image", "props": { "y": 21, "x": 282, "width": 157, "var": "pro", "skin": "Main/jindu-duan.png" }, "compId": 302, "child": [{ "type": "Image", "props": { "y": 4, "x": 1, "width": 150, "var": "pro1", "skin": "Main/jindu-guan-do.png", "height": 20 }, "compId": 305 }, { "type": "Image", "props": { "y": -11, "x": -49, "skin": "Main/guanshu.png" }, "compId": 303, "child": [{ "type": "Text", "props": { "y": -1, "x": -3, "width": 54, "var": "stageValue", "valign": "middle", "text": "10", "height": 51, "fontSize": 32, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 264 }] }, { "type": "Image", "props": { "y": -11, "x": 155, "skin": "Main/shadi.png" }, "compId": 304 }] }, { "type": "Image", "props": { "width": 187, "top": 130, "skin": "Main/jinbi-di.png", "right": 522 }, "compId": 261, "child": [{ "type": "Image", "props": { "y": 4.5, "x": 0, "skin": "Main/jinbi-zhu.png" }, "compId": 262 }, { "type": "Text", "props": { "y": 3.5, "x": 37, "width": 142, "var": "countValue", "valign": "middle", "text": "100000", "italic": true, "height": 47, "fontSize": 36, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 263 }] }] }, { "type": "Box", "props": { "var": "mainBox", "top": 0, "right": 0, "name": "mainBox", "left": 0, "bottom": 0 }, "compId": 284, "child": [{ "type": "Image", "props": { "x": 30, "var": "settingBtn", "top": 104, "skin": "Main/shezhi.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 260 }, { "type": "Box", "props": { "x": 29, "width": 63, "visible": false, "var": "settingBox", "top": 179, "height": 134 }, "compId": 291, "child": [{ "type": "Button", "props": { "x": 2, "width": 59, "var": "shake_btn", "stateNum": 1, "height": 59 }, "compId": 285, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/ButtonVibrationOff.png", "name": "kai" }, "compId": 287 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "Main/ButtonVibrationOn.png", "name": "guan" }, "compId": 288 }] }, { "type": "Button", "props": { "y": 74, "width": 62, "var": "sound_btn", "stateNum": 1, "height": 60 }, "compId": 286, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/Icon_SoundOn.png", "name": "kai" }, "compId": 289 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "Main/Icon_SoundOff.png", "name": "guan" }, "compId": 290 }] }] }, { "type": "Box", "props": { "var": "startBox", "right": 0, "left": 0, "height": 5, "bottom": 208 }, "compId": 259, "child": [{ "type": "Image", "props": { "var": "updateBtn", "skin": "Main/shengji.png", "runtime": "View/Com/ButtonRunTime.ts", "left": 0, "bottom": 0 }, "compId": 257 }, { "type": "Image", "props": { "var": "skinBtn", "skin": "Main/shangdain.png", "runtime": "View/Com/ButtonRunTime.ts", "right": 0, "bottom": 0 }, "compId": 258 }] }, { "type": "Text", "props": { "y": 0, "x": 0, "width": 194, "var": "user_id", "valign": "middle", "text": "user_id:12", "height": 25, "fontSize": 25, "color": "#000000", "runtime": "laya.display.Text" }, "compId": 270 }, { "type": "Button", "props": { "y": 689, "x": 196, "var": "MoreFunBtn2", "stateNum": 1, "skin": "Main/gengduoyouxo-2.png" }, "compId": 336 }] }, { "type": "Image", "props": { "x": 168.5, "var": "sliderBox", "skin": "Main/zhiyin-di.png", "mouseEnabled": false, "gray": false, "bottom": 325 }, "compId": 253, "child": [{ "type": "Image", "props": { "y": -71, "x": 27, "skin": "Main/pause1.png" }, "compId": 334 }, { "type": "Image", "props": { "y": 18, "x": 191.5, "skin": "Main/shouzhi.png", "anchorX": 0.5 }, "compId": 293 }, { "type": "Image", "props": { "y": 13.5, "x": 18, "skin": "Main/fangxiangzuo.png" }, "compId": 331 }, { "type": "Image", "props": { "y": 13.5, "x": 283, "skin": "Main/fangxiangyou.png" }, "compId": 332 }] }, { "type": "Sprite", "props": { "var": "duohuituiSp" }, "compId": 312 }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "bannerHuiTuiSp" }, "compId": 313 }, { "type": "Box", "props": { "y": 0, "x": 0, "width": 720, "visible": true, "right": 0, "name": "BottomBox", "left": 0, "height": 177, "bottom": 0 }, "compId": 314, "child": [{ "type": "Image", "props": { "width": 720, "top": 0, "skin": "Main/chunhei2.png", "sizeGrid": "12,11,13,10", "right": 0, "name": "BG", "left": 0, "height": 183, "bottom": 0 }, "compId": 317 }, { "type": "List", "props": { "width": 720, "var": "BottomList", "spaceX": 30, "right": 0, "repeatY": 1, "left": 0, "height": 176, "bottom": 0 }, "compId": 318, "child": [{ "type": "Box", "props": { "y": 8, "x": 18, "width": 130, "renderType": "render", "height": 160 }, "compId": 319, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 129, "skin": "Main/bg-box.png", "sizeGrid": "27,27,37,20", "name": "BG", "height": 159 }, "compId": 320 }, { "type": "Image", "props": { "y": 0, "x": 0, "width": 130, "name": "icon", "height": 130 }, "compId": 321 }, { "type": "Text", "props": { "y": 130, "x": 0, "width": 126, "valign": "middle", "text": "冲冲冲冲冲冲", "name": "name", "height": 29, "fontSize": 20, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 322 }, { "type": "Button", "props": { "y": 0, "x": 0, "width": 130, "name": "btn", "height": 160 }, "compId": 323 }, { "type": "Script", "props": { "runtime": "View/Com/ListItem.ts" }, "compId": 335 }] }] }] }, { "type": "Button", "props": { "y": 561, "width": 140, "var": "LeftPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "pivotY": 88, "pivotX": 70, "left": 20, "height": 175 }, "compId": 315, "child": [{ "type": "Image", "props": { "width": 140, "name": "icon", "height": 140 }, "compId": 325 }, { "type": "Text", "props": { "y": 159, "x": 70, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 326 }] }, { "type": "Button", "props": { "y": 561, "width": 140, "var": "RightPushIcon", "skin": "Main/hutui-1-4.png", "sizeGrid": "5,16,5,11", "right": 21, "pivotY": 88, "pivotX": 70, "height": 175 }, "compId": 316, "child": [{ "type": "Image", "props": { "width": 140, "name": "icon", "height": 140 }, "compId": 327 }, { "type": "Text", "props": { "y": 159, "x": 70, "width": 140, "valign": "middle", "text": "冲冲冲冲冲冲", "pivotY": 19, "pivotX": 70, "name": "name", "height": 37, "fontSize": 22, "font": "Microsoft YaHei", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 328 }] }, { "type": "Button", "props": { "y": 211, "x": 561, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 330 }, { "type": "Button", "props": { "y": 726, "x": 0, "var": "MoreGameBtn", "stateNum": 1, "skin": "Main/gengduoyouxi.png" }, "compId": 333 }, { "type": "Image", "props": { "visible": false, "var": "BoxPanel", "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "10,12,14,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 337, "child": [{ "type": "Image", "props": { "y": 114, "x": 158.5, "skin": "Main/baoxiang-1-1.png" }, "compId": 339 }, { "type": "Image", "props": { "y": 272, "x": 165, "skin": "Main/baoxiang-1-2.png" }, "compId": 341 }, { "type": "Image", "props": { "y": 371, "x": 236, "skin": "Main/baoxiang-1-3.png" }, "compId": 340 }, { "type": "Button", "props": { "y": 756, "x": 205.5, "var": "VideoGetCoinBtn", "stateNum": 1, "skin": "Main/baoxiang-1-4.png" }, "compId": 342 }, { "type": "Button", "props": { "y": 912, "x": 312, "var": "CloseVideoBtn", "stateNum": 1, "skin": "Main/baoxiang-1-5.png" }, "compId": 344 }] }], "animations": [{ "nodes": [{ "target": 293, "keyframes": { "x": [{ "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 15 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 30 }, { "value": 326, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 45 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 60 }] } }], "name": "gameStart", "id": 1, "frameRate": 24, "action": 2 }, { "nodes": [{ "target": 315, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 315, "key": "rotation", "index": 20 }] } }], "name": "lefticon", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 316, "keyframes": { "rotation": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 0 }, { "value": -15, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 5 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 10 }, { "value": 15, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 15 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 316, "key": "rotation", "index": 20 }] } }], "name": "righticon", "id": 3, "frameRate": 24, "action": 0 }], "loadList": ["Main/jindu-duan.png", "Main/jindu-guan-do.png", "Main/guanshu.png", "Main/shadi.png", "Main/jinbi-di.png", "Main/jinbi-zhu.png", "Main/shezhi.png", "Main/ButtonVibrationOff.png", "Main/ButtonVibrationOn.png", "Main/Icon_SoundOn.png", "Main/Icon_SoundOff.png", "Main/shengji.png", "Main/shangdain.png", "Main/gengduoyouxo-2.png", "Main/zhiyin-di.png", "Main/pause1.png", "Main/shouzhi.png", "Main/fangxiangzuo.png", "Main/fangxiangyou.png", "Main/chunhei2.png", "Main/bg-box.png", "Main/hutui-1-4.png", "Main/exit2.png", "Main/gengduoyouxi.png", "Main/chunhei.png", "Main/baoxiang-1-1.png", "Main/baoxiang-1-2.png", "Main/baoxiang-1-3.png", "Main/baoxiang-1-4.png", "Main/baoxiang-1-5.png"], "loadList3D": [] };
  4744. ui.MainViewUI = MainViewUI;
  4745. REG("ui.MainViewUI", MainViewUI);
  4746. class ShadeViewUI extends Laya.View {
  4747. constructor() { super(); }
  4748. createChildren() {
  4749. super.createChildren();
  4750. this.createView(ShadeViewUI.uiView);
  4751. }
  4752. }
  4753. ShadeViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] };
  4754. ui.ShadeViewUI = ShadeViewUI;
  4755. REG("ui.ShadeViewUI", ShadeViewUI);
  4756. class SkinShopViewUI extends Laya.View {
  4757. constructor() { super(); }
  4758. createChildren() {
  4759. super.createChildren();
  4760. this.createView(SkinShopViewUI.uiView);
  4761. }
  4762. }
  4763. SkinShopViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "13,14,14,13", "right": 0, "left": 0, "bottom": 0 }, "compId": 115 }, { "type": "Image", "props": { "top": 0, "skin": "Main/bg-sheng1.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 238, "x": 0, "skin": "Main/pifu-biaoti.png" }, "compId": 92 }, { "type": "Box", "props": { "x": 50, "width": 626, "height": 102, "centerY": -70 }, "compId": 100, "child": [{ "type": "Button", "props": { "y": 0, "x": 0, "width": 83, "var": "leftBtn", "stateNum": 1, "height": 88 }, "compId": 93, "child": [{ "type": "Image", "props": { "y": 3, "x": 3, "skin": "Main/wu-you.png", "name": "leftFalse" }, "compId": 95 }, { "type": "Image", "props": { "y": 3, "x": 3, "skin": "Main/you-zuo.png", "name": "leftTrue" }, "compId": 96 }] }, { "type": "Button", "props": { "y": 51, "x": 572, "width": 94, "var": "rightBtn", "stateNum": 1, "pivotY": 51, "pivotX": 51, "height": 97 }, "compId": 97, "child": [{ "type": "Image", "props": { "y": 51, "x": 51, "width": 80, "skin": "Main/wu-zuo.png", "rotation": 180, "pivotY": 42, "pivotX": 40, "name": "rightFalse", "height": 84 }, "compId": 98 }, { "type": "Image", "props": { "y": 51, "x": 51, "width": 80, "skin": "Main/you-you.png", "pivotY": 42, "pivotX": 40, "name": "rightTrue", "height": 84 }, "compId": 99 }] }] }, { "type": "Image", "props": { "x": 163.5, "skin": "Main/dizuo.png", "centerY": 199 }, "compId": 101 }, { "type": "Image", "props": { "x": 173.5, "width": 379, "var": "viewPort", "height": 426, "centerY": 14 }, "compId": 102 }, { "type": "Box", "props": { "x": 196, "width": 331, "var": "btnBox", "height": 127, "centerY": 396 }, "compId": 113, "child": [{ "type": "Image", "props": { "y": 9, "x": 0, "var": "using", "skin": "Main/bt.png" }, "compId": 103, "child": [{ "type": "Text", "props": { "y": 22, "x": 54.5, "width": 202, "valign": "middle", "text": "使用中", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "use", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 105, "child": [{ "type": "Text", "props": { "y": 22, "x": 54.5, "width": 202, "valign": "middle", "text": "使用", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 106 }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "coin", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 107, "child": [{ "type": "Image", "props": { "y": 26.5, "x": 40, "width": 53, "skin": "Main/jinbi-zhu.png", "height": 56 }, "compId": 109, "child": [{ "type": "Text", "props": { "y": -4.5, "x": 37, "width": 202, "valign": "middle", "text": "500", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 108 }] }] }, { "type": "Image", "props": { "y": 9, "x": 0, "var": "video", "skin": "Main/bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 110, "child": [{ "type": "Image", "props": { "y": 24, "x": 46, "width": 65, "skin": "Main/shipin-biao.png", "height": 61 }, "compId": 111, "child": [{ "type": "Text", "props": { "y": -2, "x": 63, "width": 202, "valign": "middle", "text": "1/3", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 112 }] }] }] }, { "type": "Button", "props": { "y": 155, "x": 562.5, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 116 }, { "type": "Button", "props": { "y": 131, "x": 18, "var": "CloseBtn", "stateNum": 1, "skin": "Main/guanbi-bt.png" }, "compId": 117 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/bg-sheng1.png", "Main/pifu-biaoti.png", "Main/wu-you.png", "Main/you-zuo.png", "Main/wu-zuo.png", "Main/you-you.png", "Main/dizuo.png", "Main/bt.png", "Main/jinbi-zhu.png", "Main/shipin-biao.png", "Main/exit2.png", "Main/guanbi-bt.png"], "loadList3D": [] };
  4764. ui.SkinShopViewUI = SkinShopViewUI;
  4765. REG("ui.SkinShopViewUI", SkinShopViewUI);
  4766. class TopTipUiUI extends Laya.Scene {
  4767. constructor() { super(); }
  4768. createChildren() {
  4769. super.createChildren();
  4770. this.createView(TopTipUiUI.uiView);
  4771. }
  4772. }
  4773. TopTipUiUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "bg", "top": 0, "skin": "Main/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 647, "x": 159, "width": 402, "var": "sliderBox", "skin": "Main/huadong-tiao.png", "height": 33, "gray": false, "centerY": 23 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 124, "x": 37, "skin": "Main/pause1.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 0, "x": 201, "skin": "Main/shou.png", "anchorX": 0.5 }, "compId": 6 }] }], "animations": [{ "nodes": [{ "target": 6, "keyframes": { "x": [{ "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 0 }, { "value": 13, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 15 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 30 }, { "value": 402, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 45 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 60 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/huadong-tiao.png", "Main/pause1.png", "Main/shou.png"], "loadList3D": [] };
  4774. ui.TopTipUiUI = TopTipUiUI;
  4775. REG("ui.TopTipUiUI", TopTipUiUI);
  4776. class TrialViewUI extends Laya.Scene {
  4777. constructor() { super(); }
  4778. createChildren() {
  4779. super.createChildren();
  4780. this.createView(TrialViewUI.uiView);
  4781. }
  4782. }
  4783. TrialViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/zhujiemian-1-20.png", "sizeGrid": "11,11,13,10", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "y": 97, "x": 125, "skin": "Main/biaoti.png" }, "compId": 4 }, { "type": "Image", "props": { "y": 221, "x": 98, "visible": false, "skin": "Main/shiyong-bg.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 657, "x": 170, "skin": "Main/dizuo.png" }, "compId": 6 }, { "type": "Image", "props": { "y": 357, "x": 169, "width": 380, "var": "viewPort", "height": 398 }, "compId": 8 }, { "type": "Button", "props": { "y": 203, "x": 570, "var": "ExitBtn", "stateNum": 1, "skin": "Main/exit2.png" }, "compId": 13 }, { "type": "Image", "props": { "y": 1192, "x": 287, "var": "backBtn", "skin": "Main/no-bt.png", "runtime": "View/Com/ButtonRunTime.ts" }, "compId": 9 }, { "type": "Image", "props": { "x": 212, "var": "videoBtn", "skin": "Main/sanbeilingqu--s.png", "runtime": "View/Com/ButtonRunTime.ts", "bottom": 350 }, "compId": 10 }], "loadList": ["Main/zhujiemian-1-20.png", "Main/biaoti.png", "Main/shiyong-bg.png", "Main/dizuo.png", "Main/exit2.png", "Main/no-bt.png", "Main/sanbeilingqu--s.png"], "loadList3D": [] };
  4784. ui.TrialViewUI = TrialViewUI;
  4785. REG("ui.TrialViewUI", TrialViewUI);
  4786. })(ui || (ui = {}));
  4787. class GuangGao {
  4788. constructor() {
  4789. GuangGao.ins = this;
  4790. }
  4791. static get Instance() {
  4792. if (GuangGao.ins == null) {
  4793. return new GuangGao();
  4794. }
  4795. return GuangGao.ins;
  4796. }
  4797. static InitVideo() {
  4798. if (!Laya.Browser.onWeiXin)
  4799. return;
  4800. this.fsaasfafssfa = Laya.Browser.window.wx.createRewardedVideoAd({ adUnitId: this.videlAdUnitId });
  4801. this.fsaasfafssfa.onLoad(() => {
  4802. console.log('激励视频 广告加载成功');
  4803. this.asfasfsaffsa = true;
  4804. });
  4805. this.fsaasfafssfa.onError(err => {
  4806. console.log("激励视屏加载失败:" + err);
  4807. this.asfasfsaffsa = false;
  4808. });
  4809. this.afsfsaafsfsa = true;
  4810. }
  4811. static ShowVideo(callback) {
  4812. if (this.asfasfsaffsa) {
  4813. console.log("showVideoAd:" + this.asfasfsaffsa);
  4814. this.SetVideoCallBack(callback);
  4815. this.fsaasfafssfa.show().catch(err => {
  4816. this.fsaasfafssfa.load().then(() => {
  4817. this.SetVideoCallBack(callback);
  4818. this.fsaasfafssfa.show();
  4819. });
  4820. });
  4821. }
  4822. }
  4823. static SetVideoCallBack(callback) {
  4824. this.fsaasfafssfa.offClose();
  4825. this.fsaasfafssfa.onClose(res => {
  4826. console.log("激励视频关闭:" + res.isEnded);
  4827. if (res && res.isEnded || res === undefined) {
  4828. callback && callback(true);
  4829. }
  4830. else {
  4831. callback && callback(false);
  4832. }
  4833. this.fsaasfafssfa.offClose();
  4834. });
  4835. }
  4836. static OpenBanner(gap = 0, callVack = null, iswait = false) {
  4837. if (!Laya.Browser.onWeiXin) {
  4838. callVack && callVack(null);
  4839. return;
  4840. }
  4841. this.canshowbanner = true;
  4842. var idd = this.bannerAdUnitId;
  4843. console.log("adUnitId:" + idd);
  4844. let newBanner = Laya.Browser.window.wx.createBannerAd({
  4845. adUnitId: idd,
  4846. style: {
  4847. left: 0,
  4848. top: 0,
  4849. width: 460
  4850. }
  4851. });
  4852. newBanner.onError(err => {
  4853. console.log(err);
  4854. callVack && callVack(null);
  4855. });
  4856. newBanner.onLoad(() => {
  4857. if (this.curbanner)
  4858. this.curbanner.destroy();
  4859. this.curbanner = newBanner;
  4860. var hight = this.GetRealHight(gap);
  4861. if (callVack != null) {
  4862. callVack(hight);
  4863. }
  4864. if (this.canshowbanner && !iswait) {
  4865. this.curbanner.show();
  4866. }
  4867. else {
  4868. this.curbanner.hide();
  4869. }
  4870. });
  4871. }
  4872. static GetRealHight(gap) {
  4873. if (this.curbanner) {
  4874. let info = Laya.Browser.window.wx.getSystemInfoSync();
  4875. this.curbanner.style.width = info.windowWidth;
  4876. this.curbanner.style.top = info.windowHeight - this.curbanner.style.realHeight - gap;
  4877. return Laya.stage.height / info.windowHeight * this.curbanner.style.realHeight;
  4878. }
  4879. }
  4880. static Clear() {
  4881. Laya.timer.clearAll(this);
  4882. Laya.Tween.clearAll(this);
  4883. this.canshowbanner = false;
  4884. if (this.curbanner)
  4885. this.curbanner.hide();
  4886. }
  4887. static hidebanner() {
  4888. if (!Laya.Browser.onWeiXin)
  4889. return;
  4890. if (this.curbanner)
  4891. this.curbanner.hide();
  4892. }
  4893. static showbanner() {
  4894. if (!Laya.Browser.onWeiXin)
  4895. return;
  4896. if (this.curbanner)
  4897. this.curbanner.show();
  4898. }
  4899. static get cancheat() {
  4900. if (!UserInfoManager.Cheat) {
  4901. console.log("cheat:false-> CurAccountData.cheat != 1");
  4902. return false;
  4903. }
  4904. var checkscence = UserInfoManager.CheckScene;
  4905. if (checkscence == false) {
  4906. console.log("cheat:true-> " + GameVersion.wxValue);
  4907. return true;
  4908. }
  4909. if (GameVersion.wxValue == "1037" || GameVersion.wxValue == "1058" || GameVersion.wxValue == "1067" || GameVersion.wxValue == "1095") {
  4910. console.log("cheat:true-> " + GameVersion.wxValue);
  4911. return true;
  4912. }
  4913. console.log("cheat:false-> " + GameVersion.wxValue);
  4914. return false;
  4915. }
  4916. showBanner(success = null, fail = null, gap = 0) {
  4917. if (!Laya.Browser.onWeiXin) {
  4918. success && success(null);
  4919. return;
  4920. }
  4921. let ad = GuangGao.bannerAdUnitId;
  4922. let bannerAd = Laya.Browser.window.wx.createBannerAd({
  4923. adUnitId: ad,
  4924. style: {
  4925. left: 0,
  4926. top: 0,
  4927. width: 460
  4928. }
  4929. });
  4930. bannerAd.onLoad(() => {
  4931. console.log("[LOG] Banner广告加载成功");
  4932. this.hideBanner();
  4933. this._bannerAd = bannerAd;
  4934. let info = Laya.Browser.window.wx.getSystemInfoSync();
  4935. this._bannerAd.style.width = info.windowWidth;
  4936. this._bannerAd.style.top = info.windowHeight - this._bannerAd.style.realHeight - 10;
  4937. this._bannerAd.show();
  4938. var hight = GuangGao.GetRealHight2(this._bannerAd, gap);
  4939. let data = {};
  4940. data["banner"] = this._bannerAd;
  4941. data["gap"] = hight;
  4942. success && success(data);
  4943. });
  4944. bannerAd.onError(err => {
  4945. console.log("[LOG] Banner广告加载失败");
  4946. console.log(err);
  4947. fail && fail();
  4948. });
  4949. }
  4950. hideBanner() {
  4951. if (!Laya.Browser.onWeiXin)
  4952. return;
  4953. if (this._bannerAd) {
  4954. this._bannerAd.hide();
  4955. this._bannerAd.destroy();
  4956. this._bannerAd = null;
  4957. }
  4958. }
  4959. showBanner2(success = null, fail = null, gap = 0) {
  4960. if (!Laya.Browser.onWeiXin) {
  4961. success && success(null);
  4962. return;
  4963. }
  4964. let ad = GuangGao.bannerAdUnitId2;
  4965. let bannerAd = Laya.Browser.window.wx.createBannerAd({
  4966. adUnitId: ad,
  4967. style: {
  4968. left: 0,
  4969. top: 0,
  4970. width: 460
  4971. }
  4972. });
  4973. bannerAd.onLoad(() => {
  4974. console.log("[LOG] Banner广告加载成功");
  4975. this.hideBanner2();
  4976. this._bannerAd2 = bannerAd;
  4977. let info = Laya.Browser.window.wx.getSystemInfoSync();
  4978. this._bannerAd2.style.width = info.windowWidth;
  4979. this._bannerAd2.style.top = info.windowHeight - this._bannerAd2.style.realHeight - 10;
  4980. this._bannerAd2.show();
  4981. var hight = GuangGao.GetRealHight2(this._bannerAd2, gap);
  4982. let data = {};
  4983. data["banner"] = this._bannerAd2;
  4984. data["gap"] = hight;
  4985. console.log("data>>>>>", data);
  4986. success && success(data);
  4987. });
  4988. bannerAd.onError(err => {
  4989. console.log("[LOG] Banner广告加载失败");
  4990. console.log(err);
  4991. fail && fail();
  4992. });
  4993. }
  4994. hideBanner2() {
  4995. if (!Laya.Browser.onWeiXin)
  4996. return;
  4997. if (this._bannerAd2) {
  4998. this._bannerAd2.hide();
  4999. this._bannerAd2.destroy();
  5000. this._bannerAd2 = null;
  5001. }
  5002. }
  5003. showBanner3(success = null, fail = null, gap = 0) {
  5004. if (!Laya.Browser.onWeiXin) {
  5005. success && success(null);
  5006. return;
  5007. }
  5008. let ad = GuangGao.bannerAdUnitId3;
  5009. let bannerAd = Laya.Browser.window.wx.createBannerAd({
  5010. adUnitId: ad,
  5011. style: {
  5012. left: 0,
  5013. top: 0,
  5014. width: 460
  5015. }
  5016. });
  5017. bannerAd.onLoad(() => {
  5018. console.log("[LOG] Banner广告加载成功");
  5019. this.hideBanner3();
  5020. this._bannerAd3 = bannerAd;
  5021. let info = Laya.Browser.window.wx.getSystemInfoSync();
  5022. this._bannerAd3.style.width = info.windowWidth;
  5023. this._bannerAd3.style.top = info.windowHeight - this._bannerAd3.style.realHeight - 10;
  5024. this._bannerAd3.show();
  5025. var hight = GuangGao.GetRealHight2(this._bannerAd3, gap);
  5026. let data = {};
  5027. data["banner"] = this._bannerAd2;
  5028. data["gap"] = hight;
  5029. success && success(data);
  5030. });
  5031. bannerAd.onError(err => {
  5032. console.log("[LOG] Banner广告加载失败");
  5033. console.log(err);
  5034. fail && fail();
  5035. });
  5036. }
  5037. hideBanner3() {
  5038. if (!Laya.Browser.onWeiXin)
  5039. return;
  5040. if (this._bannerAd3) {
  5041. this._bannerAd3.hide();
  5042. this._bannerAd3.destroy();
  5043. this._bannerAd3 = null;
  5044. }
  5045. }
  5046. static CheatBanner(btn, complete = null, gap = 0) {
  5047. btn.mouseEnabled = false;
  5048. GuangGao.Instance.showBanner((height) => {
  5049. if (height == null) {
  5050. btn.mouseEnabled = true;
  5051. }
  5052. else {
  5053. let _height = Number(height["gap"]);
  5054. height["banner"].hide();
  5055. console.log("cheatstart", "bottom:100");
  5056. btn.mouseEnabled = false;
  5057. console.log("——height--", _height);
  5058. var end = Laya.stage.height - _height - btn.height - 50;
  5059. console.log("y:" + end);
  5060. Laya.timer.once(UserInfoManager.CheatTime * 1000, this, () => {
  5061. height["banner"].show();
  5062. Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
  5063. btn.mouseEnabled = true;
  5064. console.log("上移成功cheat1--");
  5065. if (complete != null) {
  5066. complete();
  5067. }
  5068. }));
  5069. });
  5070. }
  5071. });
  5072. }
  5073. static CheatBanner2(btn, complete = null, gap = 0) {
  5074. btn.mouseEnabled = false;
  5075. GuangGao.Instance.showBanner2((height) => {
  5076. if (height == null) {
  5077. btn.mouseEnabled = true;
  5078. }
  5079. else {
  5080. let _height = Number(height["gap"]);
  5081. height["banner"].hide();
  5082. console.log("cheatstart", "bottom:100");
  5083. console.log("——height--", _height);
  5084. var end = Laya.stage.height - _height - btn.height - 50;
  5085. console.log("y:" + end);
  5086. Laya.timer.once(UserInfoManager.CheatTime * 1000, this, () => {
  5087. height["banner"].show();
  5088. Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
  5089. btn.mouseEnabled = true;
  5090. console.log("上移成功cheat2---");
  5091. height["banner"].hide();
  5092. GuangGao.Instance.showBanner3();
  5093. if (complete != null) {
  5094. complete();
  5095. }
  5096. }));
  5097. });
  5098. }
  5099. });
  5100. }
  5101. static CheatBanner3(btn, complete = null, gap = 0) {
  5102. btn.mouseEnabled = false;
  5103. GuangGao.Instance.showBanner3((height) => {
  5104. if (height == null) {
  5105. btn.mouseEnabled = true;
  5106. }
  5107. else {
  5108. let _height = Number(height["gap"]);
  5109. height["banner"].hide();
  5110. console.log("cheatstart", "bottom:100");
  5111. console.log("——height--", _height);
  5112. var end = Laya.stage.height - _height - btn.height - 50;
  5113. console.log("y:" + end);
  5114. Laya.timer.once(UserInfoManager.CheatTime * 1000, this, () => {
  5115. height["banner"].show();
  5116. Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
  5117. console.log("上移成功cheat3--");
  5118. btn.mouseEnabled = true;
  5119. height["banner"].hide();
  5120. GuangGao.Instance.showBanner();
  5121. if (complete != null) {
  5122. complete();
  5123. }
  5124. }));
  5125. });
  5126. }
  5127. });
  5128. }
  5129. static GetRealHight2(banner, gap) {
  5130. if (banner) {
  5131. let info = Laya.Browser.window.wx.getSystemInfoSync();
  5132. banner.style.width = info.windowWidth;
  5133. banner.style.top = info.windowHeight - banner.style.realHeight - gap;
  5134. console.log("banner真实高度为---", Laya.stage.height / info.windowHeight * banner.style.realHeight);
  5135. return Laya.stage.height / info.windowHeight * banner.style.realHeight;
  5136. }
  5137. }
  5138. }
  5139. GuangGao.videlAdUnitId = "adunit-0fb53ab4969d46bb";
  5140. GuangGao.bannerAdUnitId = "adunit-de3afc5da6054394";
  5141. GuangGao.bannerAdUnitId2 = "adunit-72492b628fc3dee9";
  5142. GuangGao.bannerAdUnitId3 = "adunit-a0e0b5dbf2b6c840";
  5143. GuangGao.afsfsaafsfsa = false;
  5144. GuangGao.asfasfsaffsa = false;
  5145. GuangGao.canshowbanner = true;
  5146. GuangGao.bannerhigt = 0;
  5147. var Tween$1 = Laya.Tween;
  5148. class LoadView extends ui.LoadViewUI {
  5149. constructor() {
  5150. super();
  5151. this.proCom = false;
  5152. this.a = new Laya.Vector3();
  5153. this.loadResCom = false;
  5154. this.loginCom = false;
  5155. this.errorTime = 0;
  5156. this.timers = 0;
  5157. this.subLoadCom = false;
  5158. LoadView.instance = this;
  5159. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5160. }
  5161. static get Instance() {
  5162. return LoadView.instance;
  5163. }
  5164. Resize() {
  5165. this.height = Laya.stage.height;
  5166. }
  5167. OnShow(data) {
  5168. this.proTex.text = "0%";
  5169. this.pro1.width = 0;
  5170. this.RefreshUI();
  5171. this.LoginGame();
  5172. this.LoadSubpackage();
  5173. Laya.timer.frameOnce(5, this, () => {
  5174. this.Resize();
  5175. });
  5176. WXSdk.AldEvent("进入加载加载界面!");
  5177. let _new = Laya.LocalStorage.getItem("newuser");
  5178. if (_new) {
  5179. this.newuser = false;
  5180. }
  5181. else {
  5182. this.newuser = true;
  5183. Laya.LocalStorage.setItem("newuser", "1");
  5184. }
  5185. }
  5186. RefreshData() {
  5187. this.proLen = this.pro.width;
  5188. }
  5189. RegButton() {
  5190. }
  5191. RefreshUI() {
  5192. Tween$1.to(this.a, {
  5193. x: 1, update: new Laya.Handler(this, () => {
  5194. var num = this.a.x;
  5195. this.pro1.width = this.proLen * num;
  5196. num = num * 100;
  5197. this.proTex.text = Math.ceil(num) + "%";
  5198. })
  5199. }, 1500, Laya.Ease.quadInOut, new Laya.Handler(this, () => {
  5200. this.proTex.text = "100%";
  5201. this.pro1.width = this.proLen;
  5202. this.proCom = true;
  5203. this.AllCom();
  5204. }));
  5205. }
  5206. LoadRes() {
  5207. if (this.subLoadCom && this.loginCom) {
  5208. ResourcesManager.Instance.Load(() => {
  5209. WXSdk.AldEvent("资源加载成功");
  5210. this.loadResCom = true;
  5211. this.AllCom();
  5212. });
  5213. }
  5214. }
  5215. LoginGame() {
  5216. if (GameVersion.isWx) {
  5217. WXSdk.Login((data) => {
  5218. this.onWxLoginHandler(data);
  5219. });
  5220. }
  5221. else {
  5222. this.LocalLogin();
  5223. }
  5224. }
  5225. onWxLoginHandler(params) {
  5226. console.log("微信回调成功!");
  5227. console.log(params);
  5228. if (params == "error" || params.code == null) {
  5229. if (this.errorTime == 0) {
  5230. WXSdk.AldEvent("微信登录失败");
  5231. }
  5232. this.errorTime++;
  5233. if (this.errorTime >= 3)
  5234. return;
  5235. WXSdk.Login((data) => {
  5236. this.onWxLoginHandler(data);
  5237. });
  5238. }
  5239. else {
  5240. if (this.errorTime == 0) {
  5241. WXSdk.AldEvent("微信登录成功!");
  5242. }
  5243. let systemInfo = WXSdk.SystemInfo();
  5244. let platformModel = "ipx";
  5245. if (systemInfo != null) {
  5246. var model = systemInfo.model;
  5247. platformModel = `${systemInfo.brand}_${model}_${systemInfo.system}_wx${systemInfo.version}_SDKVer${systemInfo.SDKVersion}`;
  5248. console.log("platformModel:" + platformModel);
  5249. }
  5250. new UserModel(params.code, params.nickName, params.avatarUrl, params.gender, params.country, params.province, params.city, platformModel, WXSdk.ShareId, WXSdk.Chanel);
  5251. this.LocalLogin();
  5252. }
  5253. }
  5254. LocalLogin() {
  5255. NetManager.Instance.login(null, (data) => {
  5256. this.OnLoginComplete(data);
  5257. }, (data) => {
  5258. this.OnLoginError(data);
  5259. });
  5260. }
  5261. OnLoginComplete(data) {
  5262. if (data["code"] != "0") {
  5263. console.log("登录异常错误!");
  5264. WXSdk.AldEvent("本地登录成功!");
  5265. this.timers++;
  5266. if (this.timers >= 4)
  5267. return;
  5268. if (GameVersion.isWx) {
  5269. WXSdk.Login((data) => {
  5270. this.onWxLoginHandler(data);
  5271. });
  5272. }
  5273. else {
  5274. this.LocalLogin();
  5275. }
  5276. }
  5277. else {
  5278. this.loginCom = true;
  5279. this.LoadRes();
  5280. FYHD_Sdk.InitSdk();
  5281. this.AllCom();
  5282. }
  5283. }
  5284. OnLoginError(data) {
  5285. console.log("登录错误");
  5286. WXSdk.AldEvent("本地登陆失败");
  5287. }
  5288. LoadSubpackage() {
  5289. WXSdk.LoadSubPackage("subpackage", (com) => {
  5290. if (com) {
  5291. console.log("subpackage com++++++++++++++++");
  5292. LoadView.instance.subLoadCom = true;
  5293. LoadView.instance.LoadRes();
  5294. }
  5295. });
  5296. }
  5297. AllCom() {
  5298. if (this.proCom && this.loadResCom && this.loginCom) {
  5299. GuangGao.InitVideo();
  5300. Laya.timer.once(1000, this, () => {
  5301. FYHD_Sdk.ValueUser();
  5302. WXSdk.AldEvent("进入主界面");
  5303. ViewManager.Instance.OpenView(ViewType.MainView);
  5304. if (!this.newuser && FYHD_Sdk.iswhite) {
  5305. ViewManager.Instance.AddView(ViewType.GiftView);
  5306. }
  5307. MouseEvent.Instance.InitMouseEvent();
  5308. ShareModule.OnShowHandle();
  5309. SettingController.Instance.Init();
  5310. OnHideHandler.Reg();
  5311. SettingController.Instance._playMusic();
  5312. });
  5313. }
  5314. }
  5315. OnClose() {
  5316. LoadView.instance = null;
  5317. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5318. }
  5319. }
  5320. class MainView extends ui.MainViewUI {
  5321. constructor() {
  5322. super();
  5323. this.isTryed = false;
  5324. MainView.instance = this;
  5325. this.Resize();
  5326. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5327. }
  5328. static get Instance() {
  5329. return MainView.instance;
  5330. }
  5331. OnShow(data) {
  5332. this.RefreshData();
  5333. this.RegButton();
  5334. this.RefreshUI();
  5335. this.SetData();
  5336. this.SetTopAd();
  5337. }
  5338. RefreshUI() {
  5339. this.user_id.text = "user_id:" + UserModel.Instance.CurModel.m_userid;
  5340. this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5341. this.SetStage();
  5342. this.SetStagePro(0);
  5343. this.SetSettingBox(false);
  5344. this.MoreFunBtn2.bottom = this.sliderBox.bottom + 155;
  5345. }
  5346. RefreshData() {
  5347. this.GetImage();
  5348. this.coinFollow = new FollowNumber(0.1, 0, 0, 0.1);
  5349. this.proWidth = this.pro.width;
  5350. this.isTryed = false;
  5351. }
  5352. AdaptiveUI() {
  5353. }
  5354. moreFunc(ist) {
  5355. if (ist) ;
  5356. else {
  5357. console.log("mainui");
  5358. }
  5359. }
  5360. RegButton() {
  5361. this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5362. this.settingBtn.CZ = () => {
  5363. this.SetSettingBox();
  5364. };
  5365. this.skinBtn.CZ = () => {
  5366. ViewManager.Instance.AddView(ViewType.SKinShopView);
  5367. };
  5368. this.updateBtn.CZ = () => {
  5369. ViewManager.Instance.AddView(ViewType.IntensifyView);
  5370. };
  5371. DispatcherManager.on(EventType.Event.ShowMainUi, this, this.ShowMainBox);
  5372. DispatcherManager.on(EventType.Event.SetMonery, this, this.SetPlayerGrade);
  5373. DispatcherManager.on(EventType.Event.SetStage, this, this.SetStage);
  5374. DispatcherManager.on(EventType.Event.SetStagePro, this, this.SetStagePro);
  5375. this.sound_btn.clickHandler = new Laya.Handler(this, () => {
  5376. this.ClickSound();
  5377. });
  5378. this.shake_btn.clickHandler = new Laya.Handler(this, () => {
  5379. this.ClickShake();
  5380. });
  5381. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  5382. this.MoreGameBtn.clickHandler = new Laya.Handler(this, this.ClickExport);
  5383. this.MoreFunBtn2.clickHandler = new Laya.Handler(this, this.ClickExport);
  5384. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  5385. this.VideoGetCoinBtn.clickHandler = new Laya.Handler(this, this.VideoGet);
  5386. this.CloseVideoBtn.clickHandler = new Laya.Handler(this, this.CloseVideoGet);
  5387. }
  5388. ClickExit() {
  5389. ViewManager.Instance.AddView(ViewType.ExitView);
  5390. }
  5391. ClickExport() {
  5392. ViewManager.Instance.AddView(ViewType.ExportView);
  5393. }
  5394. SetStage() {
  5395. this.stageValue.text = PlayerManager.Instance.stage.toString();
  5396. }
  5397. SetStagePro(value) {
  5398. value = value >= 1 ? 1 : value;
  5399. this.pro1.width = this.proWidth * value;
  5400. }
  5401. SetPlayerGrade(num) {
  5402. this.tempTarGrade = num;
  5403. this.coinFollow.target = num;
  5404. Laya.timer.frameLoop(1, this, this.T2);
  5405. }
  5406. T2() {
  5407. this.coinFollow.update();
  5408. let v = Math.ceil(this.coinFollow.follow);
  5409. this.countValue.text = v.toString();
  5410. if (v >= this.tempTarGrade) {
  5411. this.countValue.text = this.tempTarGrade.toString();
  5412. Laya.timer.clear(this, this.T2);
  5413. }
  5414. }
  5415. StartGame(e) {
  5416. if (this.isTryed) {
  5417. this.TryStartGame();
  5418. return;
  5419. }
  5420. if (e.target instanceof Laya.UIComponent) {
  5421. if (e.target.name != "mainBox")
  5422. return;
  5423. }
  5424. console.log("click");
  5425. let param = [{ "t": UserModel.Instance.CurModel.ServerTime }];
  5426. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Start, param, (data) => {
  5427. if (data["play_id"]) {
  5428. PlayerManager.Instance.Play_Id = data["play_id"];
  5429. }
  5430. WXSdk.Start(PlayerManager.Instance.stage.toString());
  5431. if (GameManager.GameCount == 1) {
  5432. ViewManager.Instance.AddView(ViewType.TrialView);
  5433. }
  5434. else {
  5435. this.MainStartGame();
  5436. }
  5437. }, (data) => {
  5438. });
  5439. }
  5440. MainStartGame() {
  5441. GameManager.GameCount++;
  5442. GameManager.GameNum++;
  5443. this.mainBox.visible = false;
  5444. this.sliderBox.visible = false;
  5445. this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5446. this.gameStart.stop();
  5447. GameManager.Instance.Start();
  5448. MouseEvent.Instance.StartGameClick();
  5449. MainRoleManager.Instance.Start();
  5450. MateManager.Instance.TrialModelPlayAni();
  5451. StreetManager.Instance.SetBlock();
  5452. }
  5453. TryStartGame() {
  5454. GameManager.GameCount++;
  5455. GameManager.GameNum++;
  5456. this.sliderBox.visible = false;
  5457. this.gameStart.stop();
  5458. this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5459. GameManager.Instance.Start();
  5460. MouseEvent.Instance.StartGameClick();
  5461. MainRoleManager.Instance.Start();
  5462. MateManager.Instance.TrialModelPlayAni();
  5463. StreetManager.Instance.SetBlock();
  5464. }
  5465. TryClick() {
  5466. this.isTryed = true;
  5467. this.mainBox.visible = false;
  5468. }
  5469. ShowMainBox() {
  5470. this.mainBox.visible = true;
  5471. this.sliderBox.visible = true;
  5472. this.gameStart.play(0, true);
  5473. this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5474. this.isTryed = false;
  5475. this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5476. }
  5477. SetSettingBox(ist = true) {
  5478. if (!ist) {
  5479. this.settingBox.visible = false;
  5480. return;
  5481. }
  5482. this.settingBox.visible = !this.settingBox.visible;
  5483. }
  5484. GetImage() {
  5485. this.sound_open = this.sound_btn.getChildByName("kai");
  5486. this.sound_guan = this.sound_btn.getChildByName("guan");
  5487. this.shake_open = this.shake_btn.getChildByName("kai");
  5488. this.shake_guan = this.shake_btn.getChildByName("guan");
  5489. this.ShowSound(SettingController.Instance.sound);
  5490. this.ShowShake(SettingController.Instance.vibrate);
  5491. }
  5492. ClickSound() {
  5493. SettingController.Instance.sound = !SettingController.Instance.sound;
  5494. this.ShowSound(SettingController.Instance.sound);
  5495. }
  5496. ShowSound(isshow) {
  5497. if (!isshow) {
  5498. this.sound_open.visible = false;
  5499. this.sound_guan.visible = true;
  5500. SettingController.Instance.SettingSound(0);
  5501. Laya.LocalStorage.setItem("sound", "0");
  5502. console.log("关闭声音");
  5503. }
  5504. else {
  5505. this.sound_open.visible = true;
  5506. this.sound_guan.visible = false;
  5507. SettingController.Instance.SettingSound(1);
  5508. Laya.LocalStorage.setItem("sound", "1");
  5509. console.log("开启声音");
  5510. }
  5511. }
  5512. ClickShake() {
  5513. SettingController.Instance.vibrate = !SettingController.Instance.vibrate;
  5514. this.ShowShake(SettingController.Instance.vibrate);
  5515. }
  5516. ShowShake(isshow) {
  5517. if (!isshow) {
  5518. this.shake_open.visible = false;
  5519. this.shake_guan.visible = true;
  5520. Laya.LocalStorage.setItem("vibrate", "0");
  5521. console.log("关闭震动");
  5522. }
  5523. else {
  5524. this.shake_open.visible = true;
  5525. this.shake_guan.visible = false;
  5526. Laya.LocalStorage.setItem("vibrate", "1");
  5527. console.log("开启震动");
  5528. }
  5529. }
  5530. OnClose() {
  5531. this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
  5532. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5533. DispatcherManager.off(EventType.Event.ShowMainUi, this, this.ShowMainBox);
  5534. DispatcherManager.off(EventType.Event.SetMonery, this, this.SetPlayerGrade);
  5535. DispatcherManager.off(EventType.Event.SetStage, this, this.SetStage);
  5536. DispatcherManager.off(EventType.Event.SetStagePro, this, this.SetStagePro);
  5537. MainView.instance = null;
  5538. Laya.timer.clearAll(this);
  5539. }
  5540. Resize() {
  5541. this.height = Laya.stage.height;
  5542. }
  5543. SetData() {
  5544. FYHD_Sdk.SetHuTuiList(this.BottomList, 2, "");
  5545. this.GunGun();
  5546. }
  5547. GunGun() {
  5548. var maxBtm;
  5549. try {
  5550. this.BottomList.scrollBar.value = 0;
  5551. maxBtm = this.BottomList.scrollBar.max;
  5552. }
  5553. catch (error) {
  5554. console.error(error);
  5555. return;
  5556. }
  5557. var tempBtm = 1;
  5558. Laya.timer.frameLoop(1, this, () => {
  5559. this.BottomList.scrollBar.value += tempBtm;
  5560. if (this.BottomList.scrollBar.value >= maxBtm || this.BottomList.scrollBar.value <= 0) {
  5561. tempBtm = -tempBtm;
  5562. }
  5563. });
  5564. }
  5565. SetTopAd() {
  5566. if (Laya.Browser.onPC)
  5567. return;
  5568. this.topAdData = FYHD_Sdk.pushData || [];
  5569. this.LeftPushIcon.visible = this.RightPushIcon.visible = this.topAdData.length >= 2;
  5570. if (this.topAdData.length < 2)
  5571. return;
  5572. this.topLeftAdIndex = { index: 0 };
  5573. this.topRightAdIndex = { index: 1 };
  5574. this._setTopAd(this.LeftPushIcon, this.topLeftAdIndex);
  5575. this._setTopAd(this.RightPushIcon, this.topRightAdIndex);
  5576. }
  5577. _setTopAd(topAd, adIndex) {
  5578. let _icon = topAd.getChildByName("icon");
  5579. let _name = topAd.getChildByName("name");
  5580. topAd.clickHandler = new Laya.Handler(this, () => {
  5581. FYHD_Sdk.ShowHuTuiJump(this.topAdData[adIndex.index]);
  5582. });
  5583. this._setIcon(_icon, _name, adIndex);
  5584. Laya.timer.loop(3000, this, () => {
  5585. this._setIcon(_icon, _name, adIndex);
  5586. this.lefticon.play(null, false);
  5587. this.righticon.play(null, false);
  5588. });
  5589. }
  5590. _setIcon(_icon, _name, adIndex) {
  5591. adIndex.index = (adIndex.index + 2) % this.topAdData.length;
  5592. _icon.skin = this.topAdData[adIndex.index].icon;
  5593. _name.text = this.topAdData[adIndex.index].togame_name;
  5594. }
  5595. ShowBoxPanel() {
  5596. this.BoxPanel.visible = true;
  5597. this.CloseVideoBtn.visible = false;
  5598. Laya.timer.once(2000, this, () => {
  5599. this.CloseVideoBtn.visible = true;
  5600. });
  5601. GuangGao.Instance.showBanner2((_banner) => {
  5602. if (_banner) {
  5603. this.banner = _banner["banner"];
  5604. }
  5605. });
  5606. }
  5607. HideBoxPanel() {
  5608. this.BoxPanel.visible = false;
  5609. if (this.banner) {
  5610. this.banner.hide();
  5611. }
  5612. }
  5613. VideoGet() {
  5614. GuangGao.ShowVideo((isLoad) => {
  5615. if (isLoad) {
  5616. var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": "200" }];
  5617. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
  5618. ViewManager.Instance.ShowTips("金币:X" + 200);
  5619. this.HideBoxPanel();
  5620. }, (data) => {
  5621. });
  5622. }
  5623. });
  5624. }
  5625. CloseVideoGet() {
  5626. this.HideBoxPanel();
  5627. }
  5628. }
  5629. class CompleteView extends ui.CompleteViewUI {
  5630. constructor() {
  5631. super();
  5632. this.isWin = false;
  5633. this.clicknum = 0;
  5634. CompleteView.instance = this;
  5635. this.Resize();
  5636. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5637. }
  5638. static get Instance() {
  5639. return CompleteView.instance;
  5640. }
  5641. OnShow(data) {
  5642. this.isWin = data;
  5643. this.RefreshData();
  5644. this.RegButton();
  5645. this.RefreshUI();
  5646. this.SetTopAd();
  5647. if (GameManager.GameCount == 1 || GameManager.GameCount >= 4) {
  5648. GuangGao.Instance.showBanner((_banner) => {
  5649. if (_banner) {
  5650. this.banner = _banner["banner"];
  5651. console.log("banner加载完毕---", this.banner);
  5652. }
  5653. });
  5654. this.nextBtn.y = Laya.stage.height - this.nextBtn.height - 300;
  5655. }
  5656. else {
  5657. if (FYHD_Sdk.iswhite) {
  5658. this.nextBtn.y = Laya.stage.height - this.nextBtn.height - 50;
  5659. }
  5660. else {
  5661. GuangGao.Instance.showBanner((_banner) => {
  5662. if (_banner) {
  5663. this.banner = _banner["banner"];
  5664. console.log("banner加载完毕---", this.banner);
  5665. }
  5666. });
  5667. this.nextBtn.y = Laya.stage.height - this.nextBtn.height - 300;
  5668. }
  5669. }
  5670. }
  5671. Resize() {
  5672. this.height = Laya.stage.height;
  5673. }
  5674. RefreshData() {
  5675. this.coinValue = this.isWin == true ? LevelController.Instance._level.gold : LevelController.Instance._level.fail_gold;
  5676. this.tes1 = this.coinValue;
  5677. this.coinValue += (PlayerManager.tower_reward * GameManager.Instance.towerCount + PlayerManager.enemy_reward * GameManager.Instance.roleCount + PlayerManager.block_reward * GameManager.Instance.blockCount);
  5678. let iswin = this.isWin == true ? 1 : 0;
  5679. let count = this.coinValue;
  5680. let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "play_id": PlayerManager.Instance.Play_Id }, { "win": iswin }, { "money": count }];
  5681. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.GameResult, param, (data) => {
  5682. }, (data) => {
  5683. ViewManager.Instance.ShowTips("结算失败");
  5684. });
  5685. if (this.isWin) {
  5686. SettingController.Instance.PlaySound(SoundType.win);
  5687. WXSdk.Success(PlayerManager.Instance.stage.toString());
  5688. }
  5689. else {
  5690. SettingController.Instance.PlaySound(SoundType.defeat);
  5691. WXSdk.Fail(PlayerManager.Instance.stage.toString());
  5692. }
  5693. }
  5694. RegButton() {
  5695. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  5696. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  5697. this.doublegetBtn.CZ = () => {
  5698. this.DoubleGet();
  5699. };
  5700. this.nextBtn.CZ = () => {
  5701. this.clicknum++;
  5702. if (GameManager.GameCount <= 1 || GameManager.GameCount >= 4) {
  5703. if (this.isWin) {
  5704. this.Next();
  5705. }
  5706. else {
  5707. this.Resset();
  5708. }
  5709. }
  5710. else {
  5711. if (FYHD_Sdk.iswhite) {
  5712. if (this.clicknum <= 1) {
  5713. GuangGao.CheatBanner3(this.nextBtn, () => {
  5714. });
  5715. }
  5716. else {
  5717. if (this.isWin) {
  5718. this.Next();
  5719. }
  5720. else {
  5721. this.Resset();
  5722. }
  5723. }
  5724. }
  5725. else {
  5726. if (this.isWin) {
  5727. this.Next();
  5728. }
  5729. else {
  5730. this.Resset();
  5731. }
  5732. }
  5733. }
  5734. };
  5735. }
  5736. ClickExit() {
  5737. ViewManager.Instance.AddView(ViewType.ExitView);
  5738. }
  5739. Next() {
  5740. GameManager.Instance.LevelUp();
  5741. }
  5742. Resset() {
  5743. ViewManager.Instance.CloseView(ViewType.CompleteView);
  5744. GameManager.Instance.ReStart();
  5745. }
  5746. OnClose() {
  5747. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5748. CompleteView.instance = null;
  5749. Laya.timer.clearAll(this);
  5750. if (FYHD_Sdk.iswhite) {
  5751. if (GuangGao.Instance._bannerAd3) {
  5752. GuangGao.Instance._bannerAd3.hide();
  5753. }
  5754. if (GuangGao.Instance._bannerAd) {
  5755. GuangGao.Instance._bannerAd.hide();
  5756. }
  5757. }
  5758. if (GameManager.GameNum == 1) {
  5759. if (GameManager.GameCount <= 3 && FYHD_Sdk.iswhite) {
  5760. ViewManager.Instance.AddView(ViewType.GoldEggView);
  5761. }
  5762. ViewManager.Instance.AddView(ViewType.ExportView);
  5763. }
  5764. else {
  5765. if (GameManager.GameCount <= 3 && FYHD_Sdk.iswhite) {
  5766. ViewManager.Instance.AddView(ViewType.GoldEggView);
  5767. }
  5768. ViewManager.Instance.AddView(ViewType.ExportView, true);
  5769. }
  5770. }
  5771. RefreshUI() {
  5772. this.winTop.visible = this.isWin;
  5773. this.shibaiTop.visible = !this.isWin;
  5774. this.valueText.text = "+" + this.coinValue;
  5775. this.towerCount.text = "X" + GameManager.Instance.towerCount.toString();
  5776. this.towerValue.text = (PlayerManager.tower_reward * GameManager.Instance.towerCount).toString();
  5777. this.roleCount.text = "X" + GameManager.Instance.roleCount.toString();
  5778. this.roleValue.text = (PlayerManager.enemy_reward * GameManager.Instance.roleCount).toString();
  5779. this.blockCount.text = "X" + GameManager.Instance.blockCount.toString();
  5780. this.blockValue.text = (PlayerManager.block_reward * GameManager.Instance.blockCount).toString();
  5781. }
  5782. DoubleGet() {
  5783. GuangGao.ShowVideo((isok) => {
  5784. if (isok) {
  5785. WXSdk.AldEvent("结束界面看视屏获得钱");
  5786. var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.coinValue * 2).toString() }];
  5787. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
  5788. ViewManager.Instance.ShowTips("金币:X" + (this.coinValue * 3));
  5789. this.Next();
  5790. }, (data) => {
  5791. });
  5792. }
  5793. });
  5794. }
  5795. SetTopAd() {
  5796. if (Laya.Browser.onPC)
  5797. return;
  5798. this.topAdData = FYHD_Sdk.pushData || [];
  5799. if (this.topAdData.length < 4)
  5800. return;
  5801. this.topLeftAdIndex = { index: 0 };
  5802. this.topRightAdIndex = { index: 1 };
  5803. this.bottomleftAdIndex = { index: 2 };
  5804. this.bottomRightAdIndex = { index: 3 };
  5805. this._setTopAd(this.LeftTopPushIcon, this.topLeftAdIndex);
  5806. this._setTopAd(this.LeftBottomPushIcon, this.bottomleftAdIndex);
  5807. this._setTopAd(this.RightTopPushIcon, this.topRightAdIndex);
  5808. this._setTopAd(this.RightBottomPushIcon, this.bottomRightAdIndex);
  5809. }
  5810. _setTopAd(topAd, adIndex) {
  5811. let _icon = topAd.getChildByName("icon");
  5812. let _name = topAd.getChildByName("name");
  5813. topAd.clickHandler = new Laya.Handler(this, () => {
  5814. FYHD_Sdk.ShowHuTuiJump(this.topAdData[adIndex.index]);
  5815. });
  5816. this._setIcon(_icon, _name, adIndex);
  5817. Laya.timer.loop(3000, this, () => {
  5818. this._setIcon(_icon, _name, adIndex);
  5819. this.pushshake.play(null, false);
  5820. });
  5821. }
  5822. _setIcon(_icon, _name, adIndex) {
  5823. adIndex.index = (adIndex.index + 4) % this.topAdData.length;
  5824. _icon.skin = this.topAdData[adIndex.index].icon;
  5825. _name.text = this.topAdData[adIndex.index].togame_name;
  5826. }
  5827. }
  5828. class InGameView extends ui.InGameViewUI {
  5829. static get Instance() {
  5830. return InGameView.instance;
  5831. }
  5832. constructor() {
  5833. super();
  5834. InGameView.instance = this;
  5835. this.Resize();
  5836. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5837. }
  5838. OnShow(data) {
  5839. this.RefreshData();
  5840. this.RegButton();
  5841. this.RefreshUI();
  5842. }
  5843. Resize() {
  5844. this.height = Laya.stage.height;
  5845. }
  5846. RefreshData() {
  5847. }
  5848. RegButton() {
  5849. }
  5850. RefreshUI() {
  5851. }
  5852. OnClose() {
  5853. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  5854. InGameView.instance = null;
  5855. Laya.timer.clearAll(this);
  5856. }
  5857. }
  5858. class IntensifyView extends ui.IntensifyViewUI {
  5859. constructor() {
  5860. super();
  5861. this.iscoinShowfreecoinbtn = false;
  5862. this.Resize();
  5863. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  5864. }
  5865. OnShow(data) {
  5866. this.RefreshData();
  5867. this.RegButton();
  5868. this.RefreshUI();
  5869. GuangGao.Instance.showBanner2((_banner) => {
  5870. if (_banner) {
  5871. this.banner = _banner["banner"];
  5872. console.log("banner加载成功--");
  5873. }
  5874. });
  5875. }
  5876. RefreshUI() {
  5877. this.InitUi();
  5878. this.RefreshCoinShow();
  5879. let t = this.cost1 < this.cost2 ? this.cost1 : this.cost2;
  5880. this.freecoinValue = Math.floor(t * 1.2);
  5881. this.coinValue.text = this.freecoinValue.toString();
  5882. }
  5883. RefreshData() {
  5884. this.tempPowerLevel = PlayerManager.Instance.powerLevel;
  5885. this.tempRateLevel = PlayerManager.Instance.rateLevel;
  5886. this.RefreshData2();
  5887. }
  5888. RefreshData2() {
  5889. let detail = UserModel.Instance.CurModel.user_video.detail;
  5890. if (!detail)
  5891. this.iscoinShowfreecoinbtn = true;
  5892. else {
  5893. let freet = detail.freecoin;
  5894. if (!freet) {
  5895. this.iscoinShowfreecoinbtn = true;
  5896. return;
  5897. }
  5898. if (freet < AppSetting.freeGetcoinTime) {
  5899. this.iscoinShowfreecoinbtn = true;
  5900. return;
  5901. }
  5902. this.iscoinShowfreecoinbtn = false;
  5903. }
  5904. }
  5905. RegButton() {
  5906. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  5907. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  5908. this.backBtn.visible = false;
  5909. Laya.timer.once(3000, this, () => {
  5910. this.backBtn.visible = true;
  5911. this.backBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
  5912. });
  5913. this.atkupBtn.clickHandler = new Laya.Handler(this, this.AtkUp);
  5914. this.rateupBtn.clickHandler = new Laya.Handler(this, this.RateUp);
  5915. this.getcoinBtn.clickHandler = new Laya.Handler(this, this.GetCoin);
  5916. }
  5917. ClickExit() {
  5918. ViewManager.Instance.AddView(ViewType.ExitView);
  5919. }
  5920. ClickClose() {
  5921. ViewManager.Instance.CloseView(ViewType.IntensifyView);
  5922. }
  5923. AtkUp() {
  5924. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
  5925. ViewManager.Instance.ShowTips("金币不足!", 1);
  5926. return;
  5927. }
  5928. PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => {
  5929. if (iscom) {
  5930. WXSdk.AldEvent("升级界面花钱升级攻击力");
  5931. this.tempPowerLevel++;
  5932. this.InitUi();
  5933. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5934. }
  5935. });
  5936. }
  5937. RateUp() {
  5938. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
  5939. ViewManager.Instance.ShowTips("金币不足!", 1);
  5940. return;
  5941. }
  5942. PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "money", this.cost2, (iscom) => {
  5943. if (iscom) {
  5944. WXSdk.AldEvent("升级界面花钱升级速度");
  5945. this.tempRateLevel++;
  5946. this.InitUi();
  5947. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5948. }
  5949. });
  5950. }
  5951. GetCoin() {
  5952. GuangGao.ShowVideo((isok) => {
  5953. if (isok) {
  5954. var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.freecoinValue).toString() }, { "channel": "video:freecoin" }];
  5955. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
  5956. WXSdk.AldEvent("升级界面看视屏获得钱");
  5957. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  5958. this.RefreshData();
  5959. this.RefreshCoinShow();
  5960. }, (data) => {
  5961. });
  5962. }
  5963. });
  5964. }
  5965. RefreshCoinShow() {
  5966. if (this.iscoinShowfreecoinbtn) {
  5967. this.getcoinBtn.gray = false;
  5968. this.getcoinBtn.mouseEnabled = true;
  5969. }
  5970. else {
  5971. this.getcoinBtn.gray = true;
  5972. this.getcoinBtn.mouseEnabled = false;
  5973. }
  5974. }
  5975. InitUi() {
  5976. this.atkLv.text = "LV" + this.tempPowerLevel;
  5977. let al = NetInfoManager.Instance._atk.length;
  5978. let t = this.tempPowerLevel > al ? al : this.tempPowerLevel;
  5979. this.cost1 = NetInfoManager.Instance.GetAtk(t)["cost"];
  5980. this.atkValue.text = this.cost1.toString();
  5981. this.rateLv.text = "LV" + this.tempRateLevel;
  5982. let al1 = NetInfoManager.Instance._rate.length;
  5983. let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel;
  5984. this.cost2 = NetInfoManager.Instance.GetRate(t1)["cost"];
  5985. this.rateValue.text = this.cost2.toString();
  5986. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
  5987. this.atkupBtn.gray = true;
  5988. this.atkupBtn.mouseEnabled = false;
  5989. }
  5990. else {
  5991. this.atkupBtn.gray = false;
  5992. this.atkupBtn.mouseEnabled = true;
  5993. }
  5994. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
  5995. this.rateupBtn.gray = true;
  5996. this.rateupBtn.mouseEnabled = false;
  5997. }
  5998. else {
  5999. this.rateupBtn.gray = false;
  6000. this.rateupBtn.mouseEnabled = true;
  6001. }
  6002. }
  6003. OnClose() {
  6004. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6005. if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
  6006. PlayerManager.Instance.SetInfo();
  6007. }
  6008. if (FYHD_Sdk.iswhite) {
  6009. this.banner.hide();
  6010. }
  6011. else {
  6012. GuangGao.Instance.hideBanner2();
  6013. }
  6014. }
  6015. Resize() {
  6016. this.height = Laya.stage.height;
  6017. }
  6018. }
  6019. class AttributeUpView extends ui.AttributeUpViewUI {
  6020. constructor() {
  6021. super();
  6022. this.iscanShowVideoBtn = true;
  6023. this.isatkvideo = false;
  6024. this.isfirstatkvideo = true;
  6025. this.isfirstratevideo = true;
  6026. this.isratevideo = false;
  6027. this.atkShow = false;
  6028. this.PushDataArray = [];
  6029. this.doudongcishu = 2;
  6030. this.Resize();
  6031. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  6032. }
  6033. OnShow(data) {
  6034. this.RefreshData();
  6035. this.RegButton();
  6036. this.RefreshUI();
  6037. this.InitPushData();
  6038. }
  6039. RefreshUI() {
  6040. this.SetUi();
  6041. }
  6042. SetUi() {
  6043. this.atkLv.text = "LV" + this.tempPowerLevel;
  6044. let al = NetInfoManager.Instance._atk.length;
  6045. let t = this.tempPowerLevel > al ? al : this.tempPowerLevel;
  6046. this.cost1 = NetInfoManager.Instance.GetAtk(t)["cost"];
  6047. this.atkValue.text = this.cost1.toString();
  6048. this.rateLv.text = "LV" + this.tempRateLevel;
  6049. let al1 = NetInfoManager.Instance._rate.length;
  6050. let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel;
  6051. this.cost2 = NetInfoManager.Instance.GetRate(t1)["cost"];
  6052. this.rateValue.text = this.cost2.toString();
  6053. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
  6054. if (this.iscanShowVideoBtn && this.isfirstatkvideo) {
  6055. this.isatkvideo = true;
  6056. this._atk.visible = false;
  6057. this._atkVideo.visible = true;
  6058. this.atkBtn.mouseEnabled = true;
  6059. this.atkBtn.gray = false;
  6060. this.click1.visible = true;
  6061. this.atkShow = true;
  6062. }
  6063. else {
  6064. this.atkBtn.mouseEnabled = false;
  6065. this.atkBtn.gray = true;
  6066. this.isatkvideo = false;
  6067. this.click1.visible = false;
  6068. this.atkShow = false;
  6069. }
  6070. }
  6071. else {
  6072. this._atk.visible = true;
  6073. this._atkVideo.visible = false;
  6074. this.atkBtn.gray = false;
  6075. this.atkBtn.mouseEnabled = true;
  6076. this.isatkvideo = false;
  6077. this.click1.visible = true;
  6078. this.atkShow = true;
  6079. }
  6080. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
  6081. if (this.iscanShowVideoBtn && this.isfirstratevideo) {
  6082. this.isratevideo = true;
  6083. this._rate.visible = false;
  6084. this._rateVideo.visible = true;
  6085. this.rateBtn.mouseEnabled = true;
  6086. this.rateBtn.gray = false;
  6087. if (this.atkShow)
  6088. this.click2.visible = false;
  6089. else
  6090. this.click2.visible = true;
  6091. }
  6092. else {
  6093. this.rateBtn.mouseEnabled = false;
  6094. this.rateBtn.gray = true;
  6095. this.isratevideo = false;
  6096. this.click2.visible = false;
  6097. }
  6098. }
  6099. else {
  6100. this._rate.visible = true;
  6101. this._rateVideo.visible = false;
  6102. this.rateBtn.gray = false;
  6103. this.rateBtn.mouseEnabled = true;
  6104. this.isratevideo = false;
  6105. if (this.atkShow)
  6106. this.click2.visible = false;
  6107. else
  6108. this.click2.visible = true;
  6109. }
  6110. }
  6111. RefreshData() {
  6112. this.tempPowerLevel = PlayerManager.Instance.powerLevel;
  6113. this.tempRateLevel = PlayerManager.Instance.rateLevel;
  6114. let detail = UserModel.Instance.CurModel.user_video.detail;
  6115. if (!detail)
  6116. this.iscanShowVideoBtn = true;
  6117. else {
  6118. let freet = detail.free;
  6119. if (!freet) {
  6120. this.iscanShowVideoBtn = true;
  6121. return;
  6122. }
  6123. if (freet < AppSetting.freeUpdateVideotime) {
  6124. this.iscanShowVideoBtn = true;
  6125. return;
  6126. }
  6127. {
  6128. this.iscanShowVideoBtn = false;
  6129. }
  6130. }
  6131. }
  6132. RegButton() {
  6133. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  6134. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  6135. this.backBtn.CZ = () => {
  6136. this.BackClickHandler();
  6137. };
  6138. this.atkBtn.clickHandler = new Laya.Handler(this, this.AtkBtnHandler);
  6139. this.rateBtn.clickHandler = new Laya.Handler(this, this.RateBtnHandler);
  6140. }
  6141. ClickExit() {
  6142. ViewManager.Instance.AddView(ViewType.ExitView);
  6143. }
  6144. AtkBtnHandler() {
  6145. if (this.isatkvideo) {
  6146. GuangGao.ShowVideo((iscom) => {
  6147. if (iscom) {
  6148. PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "video:free", this.cost1, (iscom) => {
  6149. if (iscom) {
  6150. WXSdk.AldEvent("失败界面看视屏升级攻击力");
  6151. this.tempPowerLevel++;
  6152. this.isfirstatkvideo = false;
  6153. this.SetUi();
  6154. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  6155. }
  6156. });
  6157. }
  6158. });
  6159. }
  6160. else {
  6161. PlayerManager.Instance.PowerUp(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => {
  6162. if (iscom) {
  6163. WXSdk.AldEvent("失败界面花钱升级攻击力");
  6164. this.tempPowerLevel++;
  6165. this.SetUi();
  6166. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  6167. }
  6168. });
  6169. }
  6170. }
  6171. RateBtnHandler() {
  6172. if (this.isratevideo) {
  6173. GuangGao.ShowVideo((iscom) => {
  6174. if (iscom) {
  6175. PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "video:free", this.cost2, (iscom) => {
  6176. if (iscom) {
  6177. WXSdk.AldEvent("失败界面看视屏升级速度");
  6178. this.tempRateLevel++;
  6179. this.isfirstratevideo = false;
  6180. this.SetUi();
  6181. }
  6182. });
  6183. }
  6184. });
  6185. }
  6186. else {
  6187. PlayerManager.Instance.SpeedUp(this.tempRateLevel + 1, "money", this.cost2, (iscom) => {
  6188. if (iscom) {
  6189. WXSdk.AldEvent("失败界面花钱升级速度");
  6190. this.tempRateLevel++;
  6191. this.SetUi();
  6192. }
  6193. });
  6194. }
  6195. }
  6196. BackClickHandler() {
  6197. ViewManager.Instance.CloseView(ViewType.AttributeUpView);
  6198. GameManager.Instance.ReStart();
  6199. }
  6200. OnClose() {
  6201. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6202. if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
  6203. PlayerManager.Instance.SetInfo();
  6204. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  6205. }
  6206. }
  6207. Resize() {
  6208. this.height = Laya.stage.height;
  6209. }
  6210. InitPushData() {
  6211. for (let i = 0; i < FYHD_Sdk.pushData.length; i++) {
  6212. if (i < 6) {
  6213. this.PushDataArray.push(FYHD_Sdk.pushData[i]);
  6214. }
  6215. }
  6216. for (let j = 0; j < this.PushBox.numChildren; j++) {
  6217. let box = this.PushBox.getChildAt(j);
  6218. let icon = box.getChildByName("icon");
  6219. let btn = box.getChildByName("btn");
  6220. let name = box.getChildByName("name");
  6221. icon.skin = this.PushDataArray[j].icon;
  6222. name.text = this.PushDataArray[j].togame_name;
  6223. btn.clickHandler = new Laya.Handler(this, this.clickAd, [this.PushDataArray[j]]);
  6224. }
  6225. Laya.timer.loop(3000, this, this.Doudong);
  6226. }
  6227. clickAd(_data) {
  6228. FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
  6229. FYHD_Sdk.ShowHuTuiJump(_data);
  6230. }
  6231. PlayAni() {
  6232. this.shakeani.play(null, false);
  6233. }
  6234. Doudong() {
  6235. this.PlayAni();
  6236. this.doudongcishu++;
  6237. let _arr = [];
  6238. if (this.doudongcishu % 2 == 0) {
  6239. for (let i = 0; i < FYHD_Sdk.pushData.length; i++) {
  6240. if (i < 6) {
  6241. _arr.push(FYHD_Sdk.pushData[i]);
  6242. }
  6243. }
  6244. for (let j = 0; j < this.PushBox.numChildren; j++) {
  6245. let box = this.PushBox.getChildAt(j);
  6246. let icon = box.getChildByName("icon");
  6247. let btn = box.getChildByName("btn");
  6248. icon.skin = _arr[j].icon;
  6249. btn.clickHandler = new Laya.Handler(this, this.clickAd, [_arr[j]]);
  6250. }
  6251. }
  6252. else {
  6253. let num = 0;
  6254. for (let i = FYHD_Sdk.pushData.length - 1; i > -1; i--) {
  6255. if (num < 6) {
  6256. _arr.push(FYHD_Sdk.pushData[i]);
  6257. }
  6258. num++;
  6259. }
  6260. for (let j = 0; j < this.PushBox.numChildren; j++) {
  6261. let box = this.PushBox.getChildAt(j);
  6262. let icon = box.getChildByName("icon");
  6263. let btn = box.getChildByName("btn");
  6264. icon.skin = _arr[j].icon;
  6265. btn.clickHandler = new Laya.Handler(this, this.clickAd, [_arr[j]]);
  6266. }
  6267. }
  6268. }
  6269. }
  6270. var Vector3$6 = Laya.Vector3;
  6271. class DisplayerCarController {
  6272. static get Instance() {
  6273. return DisplayerCarController.instance || (DisplayerCarController.instance = new DisplayerCarController());
  6274. }
  6275. CreatePlayer(id) {
  6276. if (!id)
  6277. id = PlayerManager.Instance.equipId;
  6278. if (!this.player) {
  6279. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + id);
  6280. if (p)
  6281. this.player = p;
  6282. this.mainscene.addChild(this.player);
  6283. this.player.transform.localPosition = MathTool.VecZero;
  6284. this.player.transform.localRotationEuler = MathTool.VecZero;
  6285. }
  6286. else {
  6287. GamePool.Instance.RecoverModel(this.player);
  6288. let p = GamePool.Instance.GetModel(GamePool.modeltype.Player + id);
  6289. if (p)
  6290. this.player = p;
  6291. this.mainscene.addChild(this.player);
  6292. this.player.transform.localPosition = MathTool.VecZero;
  6293. this.player.transform.localRotationEuler = MathTool.VecZero;
  6294. }
  6295. let anima = this.player.getChildAt(0).getComponent(Laya.Animator);
  6296. anima.play(MusicType.Dance);
  6297. anima.speed = 1;
  6298. }
  6299. Reset() {
  6300. if (this.mainscene) {
  6301. this.mainscene.removeSelf();
  6302. }
  6303. if (this.player) {
  6304. GamePool.Instance.RecoverModel(this.player);
  6305. this.player = null;
  6306. }
  6307. }
  6308. InitDis(par) {
  6309. if (!this.mainscene) {
  6310. this.mainscene = new Laya.Scene3D();
  6311. this.maincamera = new Laya.Camera();
  6312. this.maincamera.enableHDR = false;
  6313. this.mainscene.addChild(this.maincamera);
  6314. this.light = new Laya.DirectionLight();
  6315. this.light.transform.rotation = new Laya.Quaternion(-0.24776, 0, 0, 0.9688215);
  6316. this.light.intensity = 0.45;
  6317. this.light.color = new Vector3$6(1, 1, 1);
  6318. this.mainscene.addChild(this.light);
  6319. let or = 1;
  6320. this.maincamera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or);
  6321. this.maincamera.orthographic = false;
  6322. this.maincamera.enableHDR = false;
  6323. this.maincamera.clearFlag = 2;
  6324. this.maincamera.fieldOfView = 60;
  6325. this.maincamera.transform.position = new Vector3$6(0, 1.52, 3.12);
  6326. this.maincamera.transform.rotation = new Laya.Quaternion(0, 0, 0, 1);
  6327. }
  6328. let or = 1;
  6329. this.maincamera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or);
  6330. par.addChild(this.mainscene);
  6331. this.CreatePlayer();
  6332. }
  6333. }
  6334. class SKinShopView extends ui.SkinShopViewUI {
  6335. static get Instance() {
  6336. return SKinShopView.instance;
  6337. }
  6338. constructor() {
  6339. super();
  6340. SKinShopView.instance = this;
  6341. this.Resize();
  6342. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  6343. }
  6344. Resize() {
  6345. this.height = Laya.stage.height;
  6346. }
  6347. OnShow(data) {
  6348. this.RefreshData();
  6349. this.RegButton();
  6350. this.RefreshUI();
  6351. WXSdk.AldEvent("打开皮肤界面");
  6352. }
  6353. RefreshData() {
  6354. this.oignPlayerid = PlayerManager.Instance.equipId;
  6355. this.operateIndex = this.oignPlayerid;
  6356. }
  6357. RefreshUI(data) {
  6358. this.SetBtnUi(this.operateIndex);
  6359. this.RefreshBtnUi(this.operateIndex);
  6360. DisplayerCarController.Instance.InitDis(this.viewPort);
  6361. }
  6362. RefreshBtnUi(index) {
  6363. if (PlayerManager.Instance.equipId == index) {
  6364. this.using.visible = true;
  6365. this.use.visible = false;
  6366. this.coin.visible = false;
  6367. this.video.visible = false;
  6368. return;
  6369. }
  6370. if (UserModel.Instance.CurModel.HasTheme(index)) {
  6371. this.using.visible = false;
  6372. this.use.visible = true;
  6373. this.coin.visible = false;
  6374. this.video.visible = false;
  6375. return;
  6376. }
  6377. let data = NetInfoManager.Instance.GetTheme(index);
  6378. if (data.require_type == 2) {
  6379. this.using.visible = false;
  6380. this.use.visible = false;
  6381. this.coin.visible = true;
  6382. this.video.visible = false;
  6383. this.coinValue = Number(data.require_num);
  6384. this.coin.getChildAt(0).getChildAt(0).text = this.coinValue.toString();
  6385. return;
  6386. }
  6387. if (data.require_type == 3) {
  6388. this.using.visible = false;
  6389. this.use.visible = false;
  6390. this.coin.visible = false;
  6391. this.video.visible = true;
  6392. this.video.getChildAt(0).getChildAt(0).text = UserModel.Instance.CurModel.GetThemeProgress(data.id) + "/" + data.require_num;
  6393. return;
  6394. }
  6395. }
  6396. SetBtnUi(index) {
  6397. if (index == 1) {
  6398. this.leftBtn.getChildByName("leftFalse").visible = true;
  6399. this.leftBtn.getChildByName("leftTrue").visible = false;
  6400. this.rightBtn.getChildByName("rightFalse").visible = false;
  6401. this.rightBtn.getChildByName("rightTrue").visible = true;
  6402. return;
  6403. }
  6404. if (index == 8) {
  6405. this.leftBtn.getChildByName("leftFalse").visible = false;
  6406. this.leftBtn.getChildByName("leftTrue").visible = true;
  6407. this.rightBtn.getChildByName("rightFalse").visible = true;
  6408. this.rightBtn.getChildByName("rightTrue").visible = false;
  6409. return;
  6410. }
  6411. this.leftBtn.getChildByName("leftFalse").visible = false;
  6412. this.leftBtn.getChildByName("leftTrue").visible = true;
  6413. this.rightBtn.getChildByName("rightFalse").visible = false;
  6414. this.rightBtn.getChildByName("rightTrue").visible = true;
  6415. }
  6416. ClickClose() {
  6417. DisplayerCarController.Instance.Reset();
  6418. if (this.oignPlayerid != PlayerManager.Instance.equipId) {
  6419. MainRoleManager.Instance.ChangeModel();
  6420. }
  6421. ViewManager.Instance.CloseView(ViewType.SKinShopView);
  6422. }
  6423. ClickVideo() {
  6424. GuangGao.ShowVideo((done) => {
  6425. if (done) {
  6426. WXSdk.AldEvent("商店中看视屏获得皮肤");
  6427. this.VideoGet();
  6428. }
  6429. });
  6430. }
  6431. ;
  6432. VideoGet() {
  6433. var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "id": this.operateIndex }, { "channel": "video" }];
  6434. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.themefission, param, (data) => {
  6435. var usermodel = UserModel.Instance.CurModel;
  6436. PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
  6437. this.RefreshBtnUi(this.operateIndex);
  6438. }, (data) => {
  6439. });
  6440. }
  6441. Buy() {
  6442. var param = [{ "id": this.operateIndex }];
  6443. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Buy, param, (data) => {
  6444. var usermodel = UserModel.Instance.CurModel;
  6445. PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
  6446. DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
  6447. this.RefreshBtnUi(this.operateIndex);
  6448. }, (data) => {
  6449. });
  6450. }
  6451. Equip() {
  6452. var param = [{ "id": this.operateIndex }];
  6453. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Equip, param, (data) => {
  6454. var usermodel = UserModel.Instance.CurModel;
  6455. PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
  6456. this.RefreshBtnUi(this.operateIndex);
  6457. }, (data) => {
  6458. });
  6459. }
  6460. RegButton() {
  6461. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  6462. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  6463. this.CloseBtn.visible = false;
  6464. Laya.timer.once(3000, this, () => {
  6465. this.CloseBtn.visible = true;
  6466. this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
  6467. });
  6468. this.leftBtn.clickHandler = Laya.Handler.create(this, () => {
  6469. if (this.operateIndex == 1)
  6470. return;
  6471. this.operateIndex--;
  6472. this.SetBtnUi(this.operateIndex);
  6473. this.RefreshBtnUi(this.operateIndex);
  6474. DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
  6475. }, null, false);
  6476. this.rightBtn.clickHandler = Laya.Handler.create(this, () => {
  6477. if (this.operateIndex == 8)
  6478. return;
  6479. this.operateIndex++;
  6480. this.SetBtnUi(this.operateIndex);
  6481. this.RefreshBtnUi(this.operateIndex);
  6482. DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
  6483. }, null, false);
  6484. this.use.CZ = () => {
  6485. this.Equip();
  6486. };
  6487. this.coin.CZ = () => {
  6488. if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.coinValue)
  6489. ViewManager.Instance.ShowTips("金币不足!", 2);
  6490. else
  6491. this.Buy();
  6492. };
  6493. this.video.CZ = () => {
  6494. this.ClickVideo();
  6495. };
  6496. }
  6497. ClickExit() {
  6498. ViewManager.Instance.AddView(ViewType.ExitView);
  6499. }
  6500. OnClose() {
  6501. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6502. SKinShopView.instance = null;
  6503. WXSdk.AldEvent("关闭皮肤界面");
  6504. }
  6505. }
  6506. class TrialView extends ui.TrialViewUI {
  6507. constructor() {
  6508. super();
  6509. this.clicknum = 0;
  6510. this.Resize();
  6511. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  6512. }
  6513. OnShow(data) {
  6514. this.RegButton();
  6515. this.RefreshData();
  6516. this.RegButton();
  6517. this.RefreshUI();
  6518. if (GameManager.GameCount < 1 || GameManager.GameCount >= 3) {
  6519. console.log("第一局游戏》》》》");
  6520. GuangGao.Instance.showBanner2((_banner) => {
  6521. if (_banner) {
  6522. this.banner = _banner["banner"];
  6523. }
  6524. });
  6525. this.backBtn.y = Laya.stage.height - this.backBtn.height - 300;
  6526. }
  6527. else {
  6528. console.log("非第一局游戏1》》》》");
  6529. if (FYHD_Sdk.iswhite) {
  6530. this.backBtn.y = Laya.stage.height - this.backBtn.height - 50;
  6531. }
  6532. else {
  6533. GuangGao.Instance.showBanner2();
  6534. this.backBtn.y = Laya.stage.height - this.backBtn.height - 300;
  6535. }
  6536. }
  6537. }
  6538. RefreshUI() {
  6539. DisplayerCarController.Instance.InitDis(this.viewPort);
  6540. }
  6541. RefreshData() {
  6542. }
  6543. RegButton() {
  6544. this.ExitBtn.visible = FYHD_Sdk.iswhite;
  6545. this.ExitBtn.clickHandler = new Laya.Handler(this, this.ClickExit);
  6546. this.videoBtn.CZ = () => {
  6547. this.VideoHandler();
  6548. };
  6549. this.backBtn.CZ = () => {
  6550. this.clicknum++;
  6551. if (GameManager.GameCount < 1 || GameManager.GameCount >= 3) {
  6552. console.log("第一局游戏2》》》》");
  6553. DisplayerCarController.Instance.Reset();
  6554. this.BackUi();
  6555. }
  6556. else {
  6557. console.log("非第一局游戏2》》》》");
  6558. if (FYHD_Sdk.iswhite) {
  6559. if (this.clicknum <= 1) {
  6560. GuangGao.CheatBanner2(this.backBtn);
  6561. }
  6562. else {
  6563. DisplayerCarController.Instance.Reset();
  6564. this.BackUi();
  6565. }
  6566. }
  6567. else {
  6568. DisplayerCarController.Instance.Reset();
  6569. this.BackUi();
  6570. }
  6571. }
  6572. };
  6573. }
  6574. ClickExit() {
  6575. ViewManager.Instance.AddView(ViewType.ExitView);
  6576. }
  6577. VideoHandler() {
  6578. GuangGao.ShowVideo((isok) => {
  6579. if (isok) {
  6580. WXSdk.AldEvent("看视屏试用");
  6581. this.VideoCom();
  6582. }
  6583. });
  6584. }
  6585. VideoCom() {
  6586. DisplayerCarController.Instance.Reset();
  6587. this.BackUi();
  6588. MateManager.Instance.Trial();
  6589. }
  6590. BackUi() {
  6591. ViewManager.Instance.CloseView(ViewType.TrialView);
  6592. if (MainView.Instance)
  6593. MainView.Instance.TryClick();
  6594. }
  6595. OnClose() {
  6596. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6597. if (FYHD_Sdk.iswhite) {
  6598. if (GuangGao.Instance._bannerAd2) {
  6599. GuangGao.Instance._bannerAd2.hide();
  6600. }
  6601. if (GuangGao.Instance._bannerAd3) {
  6602. GuangGao.Instance._bannerAd3.hide();
  6603. }
  6604. }
  6605. else {
  6606. GuangGao.Instance.hideBanner2();
  6607. }
  6608. }
  6609. Resize() {
  6610. this.height = Laya.stage.height;
  6611. }
  6612. }
  6613. class GuideView extends ui.GuideViewUI {
  6614. constructor() {
  6615. super();
  6616. this.isguide2or3 = false;
  6617. this.guide1pos = MathTool.VecZero;
  6618. this.guide1Com = false;
  6619. GuideView.instance = this;
  6620. this.Resize();
  6621. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  6622. }
  6623. static get Instance() {
  6624. return GuideView.instance;
  6625. }
  6626. OnShow(data) {
  6627. this.RegButton();
  6628. this.RefreshData();
  6629. this.RefreshUI();
  6630. }
  6631. RefreshUI() {
  6632. }
  6633. RefreshData() {
  6634. }
  6635. RegButton() {
  6636. }
  6637. TwoGuide() {
  6638. this.guide3Box.visible = true;
  6639. this.guide4Box.visible = true;
  6640. this.guide2Image.visible = true;
  6641. this.guide3.play(0, true);
  6642. this.guide4.play(0, true);
  6643. Laya.timer.frameLoop(1, this, this._twoguide);
  6644. this.guide1pos.x = -4.5;
  6645. this.guide1pos.y = 0;
  6646. }
  6647. _twoguide() {
  6648. let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guidetwoPos.clone());
  6649. this.guide4Box.pos(p.x, p.y);
  6650. this.guide1pos.z = this.playerTran.localPositionZ + 5;
  6651. let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos);
  6652. this.guide3Box.pos(p1.x, p1.y);
  6653. if (this.playerTran.localPositionZ >= GuideController.Instance.guidetwoPos.z - 10) {
  6654. this.guide3Box.visible = false;
  6655. this.guide4Box.visible = false;
  6656. this.guide2Image.visible = false;
  6657. this.guide3Image.visible = true;
  6658. this.guide3.stop();
  6659. this.guide4.stop();
  6660. Laya.timer.clear(this, this._twoguide);
  6661. Laya.timer.once(5000, this, () => {
  6662. GuideController.Instance.GuideOff();
  6663. });
  6664. }
  6665. }
  6666. SetGuide(type) {
  6667. if (!this.playerTran)
  6668. this.playerTran = MainRoleManager.Instance.playerTra;
  6669. if (!this._camera)
  6670. this._camera = CameraManager.Instance._maincamera;
  6671. if (type == 1) {
  6672. this.guide1Image.visible = true;
  6673. this.guide2Image.visible = false;
  6674. this.guide3Image.visible = false;
  6675. this.guide1Box.visible = true;
  6676. this.guide1.play(0, true);
  6677. this.guide4Box.visible = false;
  6678. if (this.playerTran.localPositionX <= GuideController.Instance.guideonepos.x) {
  6679. this.guide2Box.visible = true;
  6680. this.guide3Box.visible = false;
  6681. this.isguide2or3 = true;
  6682. this.guide2.play(0, true);
  6683. }
  6684. else {
  6685. this.guide2Box.visible = false;
  6686. this.guide3Box.visible = true;
  6687. this.isguide2or3 = false;
  6688. this.guide3.play(0, true);
  6689. }
  6690. this.guide1pos = GuideController.Instance.guideonepos.clone();
  6691. Laya.timer.frameLoop(1, this, this.OneGuide);
  6692. this.guide1Com = false;
  6693. }
  6694. }
  6695. OnClose() {
  6696. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6697. GuideView.instance = null;
  6698. Laya.timer.clearAll(this);
  6699. }
  6700. Resize() {
  6701. this.height = Laya.stage.height;
  6702. }
  6703. OneGuide() {
  6704. if (!this.guide1Com) {
  6705. let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guideonepos.clone());
  6706. this.guide1Box.pos(p.x, p.y);
  6707. this.guide1pos.z = this.playerTran.localPositionZ + 10;
  6708. let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos);
  6709. if (this.isguide2or3) {
  6710. this.guide2Box.pos(p1.x, p1.y);
  6711. }
  6712. else {
  6713. this.guide3Box.pos(p1.x, p1.y);
  6714. }
  6715. if (this.playerTran.localPositionZ >= GuideController.Instance.guideonepos.z - 5) {
  6716. this.guide2.stop();
  6717. this.guide3.stop();
  6718. this.guide2Box.visible = false;
  6719. this.guide3Box.visible = false;
  6720. this.guide1Box.visible = false;
  6721. this.guide1Com = true;
  6722. this.guide1Image.visible = false;
  6723. }
  6724. }
  6725. else {
  6726. if (this.playerTran.localPositionZ >= GuideController.Instance.guideonepos.z) {
  6727. console.log(111);
  6728. Laya.timer.clear(this, this.OneGuide);
  6729. this.TwoGuide();
  6730. }
  6731. }
  6732. }
  6733. }
  6734. class ShadeView extends ui.ShadeViewUI {
  6735. constructor() {
  6736. super();
  6737. this.Resize();
  6738. DispatcherManager.on(Laya.Event.RESIZE, this, this.Resize);
  6739. }
  6740. OnShow(data) {
  6741. this.RegButton();
  6742. }
  6743. RefreshUI() {
  6744. }
  6745. RefreshData() {
  6746. }
  6747. RegButton() {
  6748. this.on(Laya.Event.CLICK, this, this.Test);
  6749. }
  6750. Test() {
  6751. }
  6752. OnClose() {
  6753. DispatcherManager.off(Laya.Event.RESIZE, this, this.Resize);
  6754. this.off(Laya.Event.CLICK, this, this.Test);
  6755. }
  6756. Resize() {
  6757. this.height = Laya.stage.height;
  6758. }
  6759. }
  6760. class ExportView extends ui.ExportViewUI {
  6761. constructor() {
  6762. super(...arguments);
  6763. this.jump = false;
  6764. this.clicknum = 0;
  6765. }
  6766. OnShow(data) {
  6767. if (data) {
  6768. this.CloseBtn.clickHandler = Laya.Handler.create(this, this.ClickClose, [data], false);
  6769. }
  6770. else {
  6771. this.CloseBtn.clickHandler = Laya.Handler.create(this, this.ClickClose, null, false);
  6772. }
  6773. this.ContinueBtn.clickHandler = Laya.Handler.create(this, this.ClickContinue, null, false);
  6774. this.SetData();
  6775. this.ContinueBtn.visible = FYHD_Sdk.iswhite;
  6776. this.CloseBtn.visible = false;
  6777. Laya.timer.once(3000, this, () => {
  6778. this.CloseBtn.visible = true;
  6779. });
  6780. if (GameManager.GameCount > 1 && GameManager.GameCount < 4 && FYHD_Sdk.iswhite) {
  6781. if (GuangGao.Instance._bannerAd) {
  6782. this._banner = GuangGao.Instance._bannerAd;
  6783. this._banner.hide();
  6784. console.log("banner加载完毕--", this._banner);
  6785. }
  6786. }
  6787. this.height = Laya.stage.height;
  6788. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  6789. this.height = Laya.stage.height;
  6790. });
  6791. }
  6792. OnClose() {
  6793. Laya.timer.clearAll(this);
  6794. }
  6795. ClickClose(_data) {
  6796. ViewManager.Instance.CloseView(ViewType.ExportView);
  6797. if (_data) {
  6798. ViewManager.Instance.AddView(ViewType.IntensifyView);
  6799. }
  6800. }
  6801. ClickContinue() {
  6802. this.clicknum++;
  6803. if (FYHD_Sdk.iswhite) {
  6804. if (GameManager.GameCount <= 1 || GameManager.GameCount >= 4) {
  6805. let ran = GameTool.randomInt(0, FYHD_Sdk.pushData.length);
  6806. let item = FYHD_Sdk.pushData[ran];
  6807. FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
  6808. FYHD_Sdk.ShowHuTuiJump(item);
  6809. }
  6810. else {
  6811. if (this.clicknum == 1) {
  6812. this.ContinueBtn.mouseEnabled = false;
  6813. if (this._banner) {
  6814. console.log("展示banner");
  6815. this._banner.show();
  6816. Laya.timer.once(1000, this, () => {
  6817. this._banner.hide();
  6818. this.ContinueBtn.mouseEnabled = true;
  6819. });
  6820. }
  6821. else {
  6822. Laya.timer.once(1000, this, () => {
  6823. this.ContinueBtn.mouseEnabled = true;
  6824. });
  6825. }
  6826. }
  6827. else {
  6828. let ran = GameTool.randomInt(0, FYHD_Sdk.pushData.length);
  6829. let item = FYHD_Sdk.pushData[ran];
  6830. FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
  6831. FYHD_Sdk.ShowHuTuiJump(item);
  6832. }
  6833. }
  6834. }
  6835. else {
  6836. ViewManager.Instance.CloseView(ViewType.ExportView);
  6837. }
  6838. }
  6839. SetData() {
  6840. FYHD_Sdk.SetHuTuiList(this.TopList, 2, "");
  6841. FYHD_Sdk.SetHuTuiList(this.BottomList, 1, "");
  6842. this.GunGun();
  6843. }
  6844. GunGun() {
  6845. var maxTop;
  6846. var maxBtm;
  6847. try {
  6848. this.TopList.scrollBar.value = 0;
  6849. this.BottomList.scrollBar.value = 0;
  6850. maxTop = this.TopList.scrollBar.max;
  6851. maxBtm = this.BottomList.scrollBar.max;
  6852. }
  6853. catch (error) {
  6854. console.error(error);
  6855. return;
  6856. }
  6857. var tempTop = 1;
  6858. var tempBtm = 1;
  6859. Laya.timer.frameLoop(1, this, () => {
  6860. this.TopList.scrollBar.value += tempTop;
  6861. if (this.TopList.scrollBar.value >= maxTop || this.TopList.scrollBar.value <= 0) {
  6862. tempTop = -tempTop;
  6863. }
  6864. this.BottomList.scrollBar.value += tempBtm;
  6865. if (this.BottomList.scrollBar.value >= maxBtm || this.BottomList.scrollBar.value <= 0) {
  6866. tempBtm = -tempBtm;
  6867. }
  6868. });
  6869. }
  6870. }
  6871. class ExitView extends ui.ExitViewUI {
  6872. constructor() {
  6873. super();
  6874. this.jump = false;
  6875. ExitView.ins = this;
  6876. }
  6877. static get Instance() {
  6878. if (ExitView.ins) {
  6879. return ExitView.ins;
  6880. }
  6881. else {
  6882. return new ExitView();
  6883. }
  6884. }
  6885. OnShow(data) {
  6886. this.SetData();
  6887. this.Jump();
  6888. if (data) {
  6889. this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose, [data]);
  6890. }
  6891. else {
  6892. this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
  6893. }
  6894. this.CloseBtn.visible = false;
  6895. Laya.timer.once(2000, this, () => {
  6896. this.CloseBtn.visible = true;
  6897. });
  6898. this.height = Laya.stage.height;
  6899. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  6900. this.height = Laya.stage.height;
  6901. });
  6902. }
  6903. OnClose() {
  6904. }
  6905. ClickClose(data) {
  6906. ViewManager.Instance.CloseView(ViewType.ExitView);
  6907. if (data) {
  6908. ViewManager.Instance.AddView(ViewType.CompleteView, GameManager.WINORLOSE);
  6909. }
  6910. }
  6911. SetData() {
  6912. FYHD_Sdk.SetHuTuiList(this.PushList, 1, "");
  6913. }
  6914. Jump() {
  6915. let ran = GameTool.randomInt(0, FYHD_Sdk.pushData.length);
  6916. let item = FYHD_Sdk.pushData[ran];
  6917. FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
  6918. FYHD_Sdk.ShowHuTuiJump(item);
  6919. }
  6920. }
  6921. class GoldEggView extends ui.GoldEggViewUI {
  6922. constructor() {
  6923. super();
  6924. this._isComplete = false;
  6925. this._isShowBanner = false;
  6926. this._bannerVal = 0.5;
  6927. this._maxClickCnt = 12;
  6928. this._clickCnt = 0;
  6929. this._interval = 500;
  6930. this._decrement = 0.03;
  6931. this.shownum = 3;
  6932. this.nowshownum = 0;
  6933. GoldEggView.ins = this;
  6934. }
  6935. static get Instance() {
  6936. if (GoldEggView.ins) {
  6937. return GoldEggView.ins;
  6938. }
  6939. else {
  6940. return new GoldEggView();
  6941. }
  6942. }
  6943. RefreshData() {
  6944. }
  6945. RegButton() {
  6946. }
  6947. Resize() {
  6948. }
  6949. RefreshUI(data) {
  6950. }
  6951. OnShow(data = null) {
  6952. this.HitBtn.y = Laya.stage.height - this.HitBtn.height - 50;
  6953. this.kuangdian.y = Laya.stage.height - this.HitBtn.height - 200;
  6954. this.btnscale.play(null, true);
  6955. this.HitBtn.clickHandler = Laya.Handler.create(this, this.QiaoDa, null, false);
  6956. this._bannerVal = GameTool.randRangefloat(0.35, 0.75);
  6957. this.jindu.value = 0;
  6958. Laya.timer.loop(this._interval, this, this.Daojishi);
  6959. WXSdk.OnShow(this.onBannerHide);
  6960. if (GuangGao.Instance._bannerAd) {
  6961. this.banner = GuangGao.Instance._bannerAd;
  6962. this.banner.hide();
  6963. console.log("金蛋界面banner加载完毕--", this.banner);
  6964. }
  6965. this.height = Laya.stage.height;
  6966. this.BG.height = Laya.stage.height;
  6967. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  6968. this.BG.height = Laya.stage.height;
  6969. this.height = Laya.stage.height;
  6970. });
  6971. }
  6972. ClosePanel() {
  6973. ViewManager.Instance.CloseView(ViewType.AttributeUpView);
  6974. }
  6975. OnClose() {
  6976. console.log("设置界面关闭---");
  6977. }
  6978. QiaoDa() {
  6979. this.ani1.play(null, false);
  6980. this.btnscale.stop();
  6981. this.kuangdian.visible = false;
  6982. if (!this._isComplete) {
  6983. this._clickCnt++;
  6984. if (this._clickCnt > this._maxClickCnt)
  6985. this._clickCnt = this._maxClickCnt;
  6986. let pv = this._clickCnt / this._maxClickCnt;
  6987. if (pv >= 1) {
  6988. pv = 1;
  6989. }
  6990. this.jindu.value = pv;
  6991. if (pv >= this._bannerVal && this.nowshownum < this.shownum) {
  6992. if (this.banner) {
  6993. this.nowshownum++;
  6994. this.banner.show();
  6995. Laya.timer.once(2000, this, () => {
  6996. this.banner.hide();
  6997. this._bannerVal = GameTool.randRangefloat(0.35, 0.75);
  6998. });
  6999. }
  7000. }
  7001. if (pv >= 1) {
  7002. this._isComplete = true;
  7003. this.onBannerHide();
  7004. }
  7005. }
  7006. }
  7007. Daojishi() {
  7008. let pv = this.jindu.value;
  7009. pv -= this._decrement;
  7010. if (pv <= 0)
  7011. pv = 0;
  7012. this.jindu.value = pv;
  7013. if (this._clickCnt > 2) {
  7014. this._clickCnt -= 2;
  7015. }
  7016. }
  7017. onBannerHide() {
  7018. GoldEggView.Instance._isComplete = true;
  7019. ViewManager.Instance.CloseView(ViewType.GoldEggView);
  7020. MainView.Instance.ShowBoxPanel();
  7021. WXSdk.OffShow(this.onBannerHide);
  7022. var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": "200" }];
  7023. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
  7024. ViewManager.Instance.ShowTips("金币:X" + 200);
  7025. }, (data) => {
  7026. });
  7027. if (GuangGao.Instance._bannerAd) {
  7028. GuangGao.Instance._bannerAd.hide();
  7029. }
  7030. }
  7031. }
  7032. class GiftView extends ui.GiftViewUI {
  7033. constructor() {
  7034. super();
  7035. this.shownum = 3;
  7036. this.nowshownum = 0;
  7037. this._isComplete = false;
  7038. this._bannerVal = 0.5;
  7039. this._maxClickCnt = 12;
  7040. this._clickCnt = 0;
  7041. this._interval = 500;
  7042. this._decrement = 0.03;
  7043. GiftView.ins = this;
  7044. }
  7045. static get Instance() {
  7046. if (GiftView.ins == null) {
  7047. return new GiftView();
  7048. }
  7049. return GiftView.ins;
  7050. }
  7051. RefreshData() {
  7052. }
  7053. RegButton() {
  7054. }
  7055. Resize() {
  7056. }
  7057. RefreshUI(data) {
  7058. }
  7059. OnShow() {
  7060. this.HitBtn.clickHandler = Laya.Handler.create(this, this.QiaoDa, null, false);
  7061. this._bannerVal = GameTool.randRangefloat(0.35, 0.75);
  7062. this.click.play(0, true);
  7063. this.jinduBar.value = 0;
  7064. Laya.timer.loop(this._interval, this, this.Daojishi);
  7065. WXSdk.OnShow(this.onBannerHide);
  7066. GuangGao.Instance.showBanner((banner) => {
  7067. console.log("礼盒界面出现banner---");
  7068. console.log("banner加载完毕--", banner);
  7069. this.banner = banner["banner"];
  7070. banner["banner"].hide();
  7071. }, () => {
  7072. });
  7073. this.height = Laya.stage.height;
  7074. this.BG.height = Laya.stage.height;
  7075. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  7076. this.BG.height = Laya.stage.height;
  7077. this.height = Laya.stage.height;
  7078. });
  7079. }
  7080. OnClose() {
  7081. }
  7082. QiaoDa() {
  7083. this.click.stop();
  7084. this.shou.visible = false;
  7085. if (!this._isComplete) {
  7086. this._clickCnt++;
  7087. if (this._clickCnt > this._maxClickCnt)
  7088. this._clickCnt = this._maxClickCnt;
  7089. let pv = this._clickCnt / this._maxClickCnt;
  7090. if (pv >= 1) {
  7091. pv = 1;
  7092. }
  7093. this.jinduBar.value = pv;
  7094. if (pv >= this._bannerVal && this.nowshownum < this.shownum) {
  7095. if (this.banner) {
  7096. console.log("有banner", this.banner);
  7097. this.banner.show();
  7098. this.nowshownum++;
  7099. Laya.timer.once(2000, this, () => {
  7100. this.banner.hide();
  7101. this._bannerVal = GameTool.randRangefloat(0.35, 0.75);
  7102. });
  7103. }
  7104. }
  7105. if (pv >= 1) {
  7106. this._isComplete = true;
  7107. this.onBannerHide();
  7108. }
  7109. }
  7110. }
  7111. Daojishi() {
  7112. let pv = this.jinduBar.value;
  7113. pv -= this._decrement;
  7114. if (pv <= 0)
  7115. pv = 0;
  7116. this.jinduBar.value = pv;
  7117. if (this._clickCnt > 2) {
  7118. this._clickCnt -= 2;
  7119. }
  7120. }
  7121. onBannerHide() {
  7122. if (GiftView.Instance.banner)
  7123. GiftView.Instance.banner.hide();
  7124. WXSdk.OffShow(this.onBannerHide);
  7125. ViewManager.Instance.CloseView(ViewType.GiftView);
  7126. var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": "200" }];
  7127. NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
  7128. ViewManager.Instance.ShowTips("金币:X" + 200);
  7129. }, (data) => {
  7130. });
  7131. }
  7132. }
  7133. var ViewType;
  7134. (function (ViewType) {
  7135. ViewType[ViewType["InGameView"] = 0] = "InGameView";
  7136. ViewType[ViewType["ShadeView"] = 1] = "ShadeView";
  7137. ViewType[ViewType["CompleteView"] = 2] = "CompleteView";
  7138. ViewType[ViewType["LoadView"] = 3] = "LoadView";
  7139. ViewType[ViewType["MainView"] = 4] = "MainView";
  7140. ViewType[ViewType["SettingUi"] = 5] = "SettingUi";
  7141. ViewType[ViewType["SKinShopView"] = 6] = "SKinShopView";
  7142. ViewType[ViewType["TrialView"] = 7] = "TrialView";
  7143. ViewType[ViewType["IntensifyView"] = 8] = "IntensifyView";
  7144. ViewType[ViewType["AttributeUpView"] = 9] = "AttributeUpView";
  7145. ViewType[ViewType["ExportView"] = 10] = "ExportView";
  7146. ViewType[ViewType["ExitView"] = 11] = "ExitView";
  7147. ViewType[ViewType["GoldEggView"] = 12] = "GoldEggView";
  7148. ViewType[ViewType["GiftView"] = 13] = "GiftView";
  7149. })(ViewType || (ViewType = {}));
  7150. class ViewManager {
  7151. constructor() {
  7152. this.viewDic = [];
  7153. this.addViewDic = new Dictionary();
  7154. this.showpushview = 0;
  7155. this._maskCnt = 0;
  7156. this.init();
  7157. }
  7158. static get Instance() {
  7159. return this.instance || (this.instance = new ViewManager());
  7160. }
  7161. init() {
  7162. this._maskCnt = 0;
  7163. this.viewDic[ViewType.InGameView] = InGameView;
  7164. this.viewDic[ViewType.LoadView] = LoadView;
  7165. this.viewDic[ViewType.MainView] = MainView;
  7166. this.viewDic[ViewType.IntensifyView] = IntensifyView;
  7167. this.viewDic[ViewType.CompleteView] = CompleteView;
  7168. this.viewDic[ViewType.SKinShopView] = SKinShopView;
  7169. this.viewDic[ViewType.TrialView] = TrialView;
  7170. this.viewDic[ViewType.ShadeView] = ShadeView;
  7171. this.viewDic[ViewType.ExportView] = ExportView;
  7172. this.viewDic[ViewType.ExitView] = ExitView;
  7173. this.viewDic[ViewType.AttributeUpView] = AttributeUpView;
  7174. this.viewDic[ViewType.GoldEggView] = GoldEggView;
  7175. this.viewDic[ViewType.GiftView] = GiftView;
  7176. this.uiNode = new Laya.Sprite();
  7177. this.popNode = new Laya.Sprite();
  7178. Laya.stage.addChild(this.uiNode);
  7179. Laya.stage.addChild(this.popNode);
  7180. this.uiNode.zOrder = 3;
  7181. this.popNode.zOrder = 4;
  7182. }
  7183. OpenView(view, data) {
  7184. if (this.curView != null) {
  7185. this.curView.OnClose();
  7186. this.uiNode.removeChild(this.curView);
  7187. this.curView.destroy(true);
  7188. this.curView = null;
  7189. }
  7190. this.curView = new this.viewDic[view];
  7191. this.uiNode.addChild(this.curView);
  7192. this.curView.OnShow(data);
  7193. }
  7194. get getCurView() {
  7195. return this.curView;
  7196. }
  7197. AddView(view, data) {
  7198. if (this.addViewDic.has(view))
  7199. return;
  7200. let t_view = new this.viewDic[view];
  7201. this.addViewDic.set(view, t_view);
  7202. this.uiNode.addChild(t_view);
  7203. t_view.OnShow(data);
  7204. MouseEvent.Instance.CloseInput();
  7205. }
  7206. RemoveView() {
  7207. if (this.curView != null) {
  7208. this.curView.OnClose();
  7209. this.uiNode.removeChild(this.curView);
  7210. this.curView.destroy(true);
  7211. this.curView = null;
  7212. }
  7213. }
  7214. HaveView(view) {
  7215. return this.addViewDic.has(view);
  7216. }
  7217. CloseView(view) {
  7218. if (!this.addViewDic.has(view))
  7219. return;
  7220. let t_view = this.addViewDic.get(view);
  7221. t_view.OnClose();
  7222. this.uiNode.removeChild(t_view);
  7223. t_view.destroy(true);
  7224. this.addViewDic.delete(view);
  7225. MouseEvent.Instance.OpenInput();
  7226. }
  7227. OpenMask() {
  7228. this._maskCnt++;
  7229. if (this._maskCnt > 1)
  7230. return;
  7231. if (this.curMask != null) {
  7232. this.curMask.OnClose();
  7233. this.popNode.removeChild(this.curView);
  7234. this.curMask.destroy();
  7235. this.curMask = null;
  7236. return;
  7237. }
  7238. this.curMask = new this.viewDic[ViewType.ShadeView];
  7239. if (!this.curMask)
  7240. return;
  7241. console.log("打开遮罩");
  7242. this.popNode.addChild(this.curMask);
  7243. this.curMask.OnShow();
  7244. }
  7245. CloseMask() {
  7246. this._maskCnt--;
  7247. if (this._maskCnt > 0)
  7248. return;
  7249. if (this.curMask != null) {
  7250. this.curMask.OnClose();
  7251. this.popNode.removeChild(this.curMask);
  7252. this.curMask.destroy(true);
  7253. console.log("关闭遮罩");
  7254. this.curMask = null;
  7255. }
  7256. }
  7257. ShowTips(value, type = 1) {
  7258. var warn = GamePool.Instance.GetUi(PoolType.WarnTips);
  7259. if (!warn)
  7260. return;
  7261. if (type == 1) {
  7262. warn.y = 0;
  7263. warn.text = value;
  7264. warn.x = Laya.stage.width >> 1;
  7265. this.popNode.addChild(warn);
  7266. let _end = (Laya.stage.height >> 1) - 300;
  7267. var tw = Laya.Tween.to(warn, { y: _end }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
  7268. tw.clear();
  7269. GamePool.Instance.RecoverUi(PoolType.WarnTips, warn);
  7270. }));
  7271. }
  7272. else if (type == 2) {
  7273. warn.y = Laya.stage.height - 400;
  7274. warn.text = value;
  7275. warn.x = Laya.stage.width >> 1;
  7276. this.popNode.addChild(warn);
  7277. var tw = Laya.Tween.to(warn, { alpha: 0 }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
  7278. tw.clear();
  7279. GamePool.Instance.RecoverUi(PoolType.WarnTips, warn);
  7280. warn.alpha = 1;
  7281. }));
  7282. }
  7283. }
  7284. ShowGuideView() {
  7285. if (!this.GuideView) {
  7286. this.GuideView = new GuideView();
  7287. this.popNode.addChild(this.GuideView);
  7288. }
  7289. this.GuideView.OnShow();
  7290. }
  7291. CloseGuideView() {
  7292. if (this.GuideView) {
  7293. this.GuideView.OnClose();
  7294. this.GuideView.removeSelf();
  7295. this.GuideView.destroy();
  7296. }
  7297. }
  7298. }
  7299. class FYHD_Sdk {
  7300. static InitSdk() {
  7301. Laya.Browser.window.sdk.getFyhd().startSdk();
  7302. FYHD_Sdk.UserInfoAuth();
  7303. let white = Laya.LocalStorage.getItem("is_white");
  7304. if (white) {
  7305. FYHD_Sdk.iswhite = true;
  7306. }
  7307. else {
  7308. FYHD_Sdk.getWhiteConfig();
  7309. }
  7310. let newuser = Laya.LocalStorage.getItem("is_newuser");
  7311. if (!newuser) {
  7312. FYHD_Sdk.isnewuser = true;
  7313. Laya.LocalStorage.setItem("is_newuser", "1");
  7314. }
  7315. else {
  7316. FYHD_Sdk.isnewuser = false;
  7317. }
  7318. FYHD_Sdk.PushData();
  7319. }
  7320. static UserInfoAuth() {
  7321. if (!Laya.Browser.onWeiXin)
  7322. return;
  7323. Laya.Browser.window.sdk.getFyhd().getFyhdUserInfo(null, false, (data) => {
  7324. console.log("无授权回调:" + JSON.stringify(data));
  7325. if (data.result.user) {
  7326. FYHD_Sdk.openid = data.result.user.openid;
  7327. FYHD_Sdk.AuthInfo();
  7328. }
  7329. });
  7330. }
  7331. static AuthInfo() {
  7332. var args = {
  7333. openid: FYHD_Sdk.openid,
  7334. };
  7335. Laya.Browser.window.sdk.getFyhd().loginData(args, (data) => {
  7336. console.log("授权上报回调:" + JSON.stringify(data));
  7337. });
  7338. }
  7339. static ValueUser() {
  7340. var args = {
  7341. openid: FYHD_Sdk.openid,
  7342. };
  7343. Laya.Browser.window.sdk.getFyhd().valueuser(args, (data) => {
  7344. console.log("有效用户上报:" + JSON.stringify(data));
  7345. });
  7346. }
  7347. static getWhiteConfig() {
  7348. Laya.Browser.window.sdk.getFyhd().whiteConfig(function (e) {
  7349. FYHD_Sdk.iswhite = e.data.is_white;
  7350. if (FYHD_Sdk.iswhite) {
  7351. Laya.LocalStorage.setItem("is_white", "1");
  7352. }
  7353. console.log("白名单---", e);
  7354. });
  7355. }
  7356. static SetHuTuiList(list, scrol = 1, type = "") {
  7357. let arr = this.pushData;
  7358. if (!arr || arr.length == 0)
  7359. return;
  7360. list.selectEnable = false;
  7361. scrol == 1 ? list.vScrollBarSkin = "" : list.hScrollBarSkin = "";
  7362. list.renderHandler = Laya.Handler.create(this, this.updateItem, [type], false);
  7363. list.array = arr;
  7364. list.refresh();
  7365. }
  7366. static updateItem(type, cell, index) {
  7367. var aditem = cell.getComponent(ListItem);
  7368. aditem.Refresh(type);
  7369. }
  7370. static ClickAd(ad_type) {
  7371. console.log("上报类型---", ad_type);
  7372. if (!Laya.Browser.onWeiXin)
  7373. return;
  7374. var param = {
  7375. ad_type: ad_type,
  7376. openid: FYHD_Sdk.openid
  7377. };
  7378. console.log("点击参数:" + param);
  7379. Laya.Browser.window.sdk.getFyhd().advertisement(param, (data) => {
  7380. console.log("点击结果:" + JSON.stringify(data));
  7381. });
  7382. }
  7383. static PushData() {
  7384. if (!Laya.Browser.onWeiXin)
  7385. return;
  7386. var param = {};
  7387. Laya.Browser.window.sdk.getFyhd().shareRecommend(param, (data) => {
  7388. console.log("热门游戏数据--", data);
  7389. if (data.data) {
  7390. FYHD_Sdk.pushData = data.data;
  7391. FYHD_Sdk.pushData.sort(FYHD_Sdk.ListSort);
  7392. FYHD_Sdk.isHaveDate = true;
  7393. }
  7394. console.log("获取互推信息:" + JSON.stringify(FYHD_Sdk.pushData));
  7395. });
  7396. }
  7397. static ShowHuTuiJump(data) {
  7398. if (!Laya.Browser.onWeiXin)
  7399. return;
  7400. if (data.jump_type == 2) {
  7401. Laya.Browser.window.wx.previewImage({ current: data.qrcode, urls: [data.qrcode] });
  7402. }
  7403. else if (data.jump_type == 1) {
  7404. Laya.Browser.window.wx.navigateToMiniProgram({
  7405. appId: data.to_appid,
  7406. path: data.jump_path,
  7407. success(res) {
  7408. console.log("上报成功:" + JSON.stringify(res));
  7409. FYHD_Sdk.PushClick(data.to_appid);
  7410. },
  7411. fail(res) {
  7412. ViewManager.Instance.AddView(ViewType.ExportView);
  7413. }
  7414. });
  7415. }
  7416. else if (data.jump_type == 0) {
  7417. Laya.Browser.window.wx.navigateToMiniProgram({
  7418. appId: data.platform_appid,
  7419. path: data.jump_path,
  7420. success(res) {
  7421. console.log("上报成功:" + JSON.stringify(res));
  7422. FYHD_Sdk.PushClick(data.to_appid);
  7423. },
  7424. fail(res) {
  7425. }
  7426. });
  7427. }
  7428. }
  7429. static PushClick(to_appid) {
  7430. if (!Laya.Browser.onWeiXin)
  7431. return;
  7432. var param = {
  7433. openid: FYHD_Sdk.openid,
  7434. to_appid: to_appid,
  7435. };
  7436. Laya.Browser.window.sdk.getFyhd().sharePlay(param, (data) => {
  7437. console.log("点击上报结果:" + JSON.stringify(data));
  7438. });
  7439. }
  7440. static ListSort(a, b) {
  7441. if (Number(a["panel"]) < Number(b["panel"])) {
  7442. return -1;
  7443. }
  7444. if (Number(a["panel"]) == Number(b["panel"])) {
  7445. return 0;
  7446. }
  7447. if (Number(a["panel"]) > Number(b["panel"])) {
  7448. return 1;
  7449. }
  7450. }
  7451. }
  7452. FYHD_Sdk.Ad_ClickType = {
  7453. Video: "video_click",
  7454. Watch: "watch",
  7455. Share: "share",
  7456. Banner: "banner",
  7457. Push: "push",
  7458. PushClick: "icon_click"
  7459. };
  7460. FYHD_Sdk.pushData = [];
  7461. FYHD_Sdk.isHaveDate = false;
  7462. FYHD_Sdk.ShowAd = "ShowAd";
  7463. class ListItem extends Laya.Script {
  7464. constructor() { super(); }
  7465. onAwake() {
  7466. this.self = this.owner;
  7467. this.icon = this.self.getChildByName("icon");
  7468. this.btn = this.self.getChildByName("btn");
  7469. this.name = this.self.getChildByName("name");
  7470. this._tip = this.self.getChildByName("tip");
  7471. this.bottom = this.self.getChildByName("bottom");
  7472. this.remen = this.self.getChildByName("remen");
  7473. this.star = this.self.getChildByName("star");
  7474. this.diandian = this.icon.getChildAt(0);
  7475. this.btn.clickHandler = new Laya.Handler(this, this.clickAd);
  7476. }
  7477. Refresh(type) {
  7478. this.data = this.self.dataSource;
  7479. this.type = type;
  7480. if (this.name) {
  7481. this.name.text = this.data.togame_name;
  7482. }
  7483. if (this._tip) {
  7484. this._tip.visible = true;
  7485. let rnd = GameTool.randomInt(1, 200000);
  7486. let text = rnd.toString() + "人在玩";
  7487. this._tip.text = text;
  7488. }
  7489. if (this.diandian) {
  7490. this.diandian.visible = false;
  7491. }
  7492. if (this.bottom) {
  7493. let num = GameTool.randomInt(1, 6);
  7494. this.bottom.skin = "subpackage/bottom/icontitle" + num + ".png";
  7495. }
  7496. if (this.remen) {
  7497. this.remen.visible = Math.random() < 0.2 ? true : false;
  7498. }
  7499. if (this.star) {
  7500. this.star.visible = Math.random() < 0.2 ? true : false;
  7501. }
  7502. this.icon.skin = this.data.icon;
  7503. }
  7504. clickAd() {
  7505. FYHD_Sdk.ClickAd(FYHD_Sdk.Ad_ClickType.PushClick);
  7506. FYHD_Sdk.ShowHuTuiJump(this.data);
  7507. }
  7508. onDestroy() {
  7509. this.btn.clickHandler = null;
  7510. }
  7511. }
  7512. class GameConfig {
  7513. constructor() { }
  7514. static init() {
  7515. var reg = Laya.ClassUtils.regClass;
  7516. reg("View/Com/ButtonRunTime.ts", ImageRunTime);
  7517. reg("View/Com/ListItem.ts", ListItem);
  7518. }
  7519. }
  7520. GameConfig.width = 720;
  7521. GameConfig.height = 1280;
  7522. GameConfig.scaleMode = "fixedwidth";
  7523. GameConfig.screenMode = "vertical";
  7524. GameConfig.alignV = "middle";
  7525. GameConfig.alignH = "center";
  7526. GameConfig.startScene = "MainView.scene";
  7527. GameConfig.sceneRoot = "";
  7528. GameConfig.debug = false;
  7529. GameConfig.stat = false;
  7530. GameConfig.physicsDebug = false;
  7531. GameConfig.exportSceneToJson = true;
  7532. GameConfig.init();
  7533. class Main {
  7534. constructor() {
  7535. window['Config3D'] && (window['Config3D']["_config"]["_defaultPhysicsMemory"] = 128);
  7536. window['Config3D'] && (window['Config3D']["_config"]["isAntialias"] = true);
  7537. if (window["Laya3D"])
  7538. Laya3D.init(GameConfig.width, GameConfig.height);
  7539. else
  7540. Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]);
  7541. Laya["Physics"] && Laya["Physics"].enable();
  7542. Laya["DebugPanel"] && Laya["DebugPanel"].enable();
  7543. Laya.stage.scaleMode = GameConfig.scaleMode;
  7544. Laya.stage.screenMode = GameConfig.screenMode;
  7545. Laya.stage.alignV = GameConfig.alignV;
  7546. Laya.stage.alignH = GameConfig.alignH;
  7547. Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson;
  7548. if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true")
  7549. Laya.enableDebugPanel();
  7550. if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"])
  7551. Laya["PhysicsDebugDraw"].enable();
  7552. if (GameConfig.stat)
  7553. Laya.Stat.show();
  7554. Laya.alertGlobalError = true;
  7555. GameVersion.isWx = Laya.Browser.onWeiXin;
  7556. if (GameVersion.isWx) {
  7557. WXSdk.init();
  7558. }
  7559. Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
  7560. WXSdk.IsNeedUpdate();
  7561. }
  7562. onVersionLoaded() {
  7563. Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
  7564. Laya.MouseManager.multiTouchEnabled = false;
  7565. }
  7566. onConfigLoaded() {
  7567. ViewManager.Instance.OpenView(ViewType.LoadView);
  7568. GameVersion.isX = Laya.Browser.clientHeight / Laya.Browser.clientWidth > 2;
  7569. }
  7570. }
  7571. new Main();
  7572. }());
  7573. //# sourceMappingURL=bundle.js.map