12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966 |
- (function () {
- 'use strict';
- class ImageRunTime extends Laya.Image {
- constructor() {
- super();
- this.scaleTime = 80;
- this.clickId = false;
- this.on(Laya.Event.MOUSE_DOWN, this, this.scaleSmall);
- this.on(Laya.Event.MOUSE_OVER, this, this.overs);
- this.on(Laya.Event.MOUSE_UP, this, this.scaleBig);
- this.on(Laya.Event.MOUSE_OUT, this, this.mouseout);
- }
- scaleBig(e) {
- if (!this.clickId)
- return;
- this.clickId = false;
- this.alpha = 1;
- if (this.CZ) {
- this.CZ();
- }
- }
- overs() {
- this.alpha = 0.7;
- }
- mouseout() {
- this.alpha = 1;
- }
- scaleSmall(e) {
- this.clickId = true;
- }
- onDestroy() {
- this.ClearRunTime();
- }
- ClearRunTime() {
- this.off(Laya.Event.MOUSE_DOWN, this, this.scaleSmall);
- this.off(Laya.Event.MOUSE_UP, this, this.scaleBig);
- this.off(Laya.Event.MOUSE_OUT, this, this.mouseout);
- this.off(Laya.Event.MOUSE_OVER, this, this.overs);
- this.CZ = null;
- }
- }
- class GameConfig {
- constructor() { }
- static init() {
- var reg = Laya.ClassUtils.regClass;
- reg("Window/Com/ButtonRunTime.ts", ImageRunTime);
- }
- }
- GameConfig.width = 720;
- GameConfig.height = 1280;
- GameConfig.scaleMode = "fixedwidth";
- GameConfig.screenMode = "vertical";
- GameConfig.alignV = "middle";
- GameConfig.alignH = "center";
- GameConfig.startScene = "ShadeView.scene";
- GameConfig.sceneRoot = "";
- GameConfig.debug = false;
- GameConfig.stat = false;
- GameConfig.physicsDebug = false;
- GameConfig.exportSceneToJson = true;
- GameConfig.init();
- class GameSetting {
- }
- GameSetting.VER = "1.0.7";
- GameSetting.CFG = "CFG";
- GameSetting.wxValue = "";
- GameSetting.isX = false;
- GameSetting.mSharePeopleScene = null;
- var SoundManager = Laya.SoundManager;
- var SoundType;
- (function (SoundType) {
- SoundType[SoundType["hit"] = 0] = "hit";
- SoundType[SoundType["click"] = 1] = "click";
- SoundType[SoundType["win"] = 2] = "win";
- SoundType[SoundType["defeat"] = 3] = "defeat";
- })(SoundType || (SoundType = {}));
- class SettingController {
- constructor() {
- this.vibrate = true;
- this.sound = true;
- this.SoundS = {
- click: "subpackage1/sound/click.mp3",
- win: "subpackage1/sound/vector.mp3",
- defeat: "subpackage1/sound/defeat.mp3",
- car_crush_1: "subpackage1/sound/car_crush_1.mp3",
- car_crush_2: "subpackage1/sound/car_crush_2.mp3",
- car_crush_3: "subpackage1/sound/car_crush_3.mp3",
- explotion1: "subpackage1/sound/explotion1.mp3",
- explotion2: "subpackage1/sound/explotion2.mp3",
- gun_fire_1: "subpackage1/sound/gun_fire_1.mp3",
- gun_fire_2: "subpackage1/sound/gun_fire_2.mp3",
- gun_fire_3: "subpackage1/sound/gun_fire_3.mp3",
- reload_gun_1: "subpackage1/sound/reload_gun_1.mp3",
- reload_gun_2: "subpackage1/sound/reload_gun_2.mp3",
- hitcar: "subpackage1/sound/hitcar.mp3",
- hitrole: "subpackage1/sound/hitrole.mp3",
- hit: "subpackage1/sound/hit.mp3"
- };
- this.bg = "subpackage1/sound/bgm.mp3";
- }
- static get Instance() {
- return this.instasnce || (this.instasnce = new SettingController());
- }
- Init() {
- var v = Laya.LocalStorage.getItem("vibrate");
- this.vibrate = Number(v) ? v == "1" ? true : false : true;
- var s = Laya.LocalStorage.getItem("sound");
- this.sound = Number(s) ? s == "1" ? true : false : true;
- }
- SettingSound(value) {
- if (this.soundChannel)
- this.soundChannel.volume = value;
- }
- _playMusic(on) {
- if (on == null)
- on = this.sound;
- if (on) {
- if (this.soundChannel == null) {
- this.soundChannel = SoundManager.playMusic(this.bg, 0, new Laya.Handler(this, () => {
- this.soundChannel.play();
- }));
- }
- else {
- this.soundChannel.resume();
- }
- }
- else {
- if (this.soundChannel) {
- this.soundChannel.pause();
- }
- }
- }
- SetSoundV(value) {
- }
- PlaySound(type) {
- if (!this.sound)
- return;
- var _name = SoundType[type];
- SoundManager.playSound(this.SoundS[_name]);
- }
- StopSound(type) {
- if (!this.sound)
- return;
- var _name = SoundType[type];
- SoundManager.stopSound(this.SoundS[_name]);
- }
- }
- class Dictionary {
- constructor() {
- this._container = {};
- this._length = 0;
- }
- get container() {
- return this._container;
- }
- get size() {
- return this._length;
- }
- set(key, value) {
- if (!this._container.hasOwnProperty(key)) {
- this._length++;
- }
- this._container[key] = value;
- }
- delete(key) {
- if (this._container.hasOwnProperty(key)) {
- delete this._container[key];
- this._length--;
- }
- }
- has(key) {
- return this._container.hasOwnProperty(key) ? true : false;
- }
- get(key) {
- if (this._container.hasOwnProperty(key)) {
- return this._container[key];
- }
- else {
- return undefined;
- }
- }
- clear() {
- this._container = {};
- this._length = 0;
- }
- }
- class DispatcherManager {
- static get Disispatcher() {
- return DispatcherManager.disispatcher || (DispatcherManager.disispatcher = new Laya.EventDispatcher());
- }
- static on(type, call, data) {
- this.Disispatcher.on(type, call, data);
- }
- static off(type, call, data) {
- this.Disispatcher.off(type, call, data);
- }
- static event(type, data = null) {
- this.Disispatcher.event(type, data);
- }
- }
- class EventType {
- }
- EventType.Event = {
- CamFollowArg: "CamFollowArg",
- SetAimPos: "SetAimPos",
- RefreshBulletCount: "RefreshBulletCount",
- RefreshRemainEnemyCount: "RefreshRemainEnemyCount",
- GameShowTips: "GameShowTips",
- StartShot: 'StartShot',
- StopShot: 'StopShot',
- ShowMainUi: "ShowMainUi",
- SetMonery: "SetMonery",
- SetStage: "SetStage",
- SetStagePro: "SetStagePro"
- };
- var Vector3 = Laya.Vector3;
- class GameTool {
- static GetObjKey(obj) {
- if (obj == null)
- return null;
- for (const key in obj) {
- if (obj.hasOwnProperty(key)) {
- return key;
- }
- }
- }
- static randomInt(min, max) {
- if (max < min)
- return parseInt(min);
- return parseInt(Math.random() * (max - min + 1) + min);
- }
- static randomFl(from, to) {
- if (from >= to) {
- return 0;
- }
- var size = to - from;
- var curNumber = Math.random() * size + from;
- return curNumber;
- }
- static getAng(xx, yy, obl) {
- return 180 / Math.PI * GameTool.getRad(xx, yy, obl);
- }
- static getRad(xx, yy, obl) {
- var rad = yy < 0 ? Math.acos(xx / obl) : (Math.PI * 2 - Math.acos(xx / obl));
- return rad;
- }
- static getM_Vector(v1, v2) {
- let temp = new Laya.Vector3();
- Laya.Vector3.add(v1, v2, temp);
- return new Laya.Vector3(temp.x * 0.5, temp.y * 0.5, temp.z * 0.5);
- }
- static SpliteString(s, sp) {
- var _sp = sp ? sp : ";";
- let s_s = s.split(_sp);
- let result = [];
- for (let i = 0; i < s_s.length; i++) {
- result.push(s_s[i]);
- }
- return result;
- }
- static random_1to1() {
- var iszheng = Math.random() > 0.5 ? -1 : 1;
- return Math.random() * iszheng;
- }
- static GetWeight(s) {
- let arr = GameTool.SpliteString(s);
- var sum = 0;
- for (var i = 0; i < arr.length; i++) {
- sum += Number(arr[i]);
- }
- let result = GameTool.randomInt(1, sum);
- let temp_sum = 0;
- for (let i = 0; i < arr.length; i++) {
- temp_sum += Number(arr[i]);
- if (result <= temp_sum) {
- return i;
- }
- }
- }
- static get64Encode(str) {
- var c1, c2, c3;
- var base64EncodeChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
- var i = 0, len = str.length, string = '';
- while (i < len) {
- c1 = str.charCodeAt(i++) & 0xff;
- if (i == len) {
- string += base64EncodeChars.charAt(c1 >> 2);
- string += base64EncodeChars.charAt((c1 & 0x3) << 4);
- string += "==";
- break;
- }
- c2 = str.charCodeAt(i++);
- if (i == len) {
- string += base64EncodeChars.charAt(c1 >> 2);
- string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
- string += base64EncodeChars.charAt((c2 & 0xF) << 2);
- string += "=";
- break;
- }
- c3 = str.charCodeAt(i++);
- string += base64EncodeChars.charAt(c1 >> 2);
- string += base64EncodeChars.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
- string += base64EncodeChars.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
- string += base64EncodeChars.charAt(c3 & 0x3F);
- }
- return string;
- }
- static makeRandomArr(arrList, num) {
- if (num > arrList.length) {
- return;
- }
- var tempArr = arrList.slice(0);
- var newArrList = [];
- for (var i = 0; i < num; i++) {
- var random = Math.floor(Math.random() * (tempArr.length - 1));
- var arr = tempArr[random];
- tempArr.splice(random, 1);
- newArrList.push(arr);
- }
- return newArrList;
- }
- static CopyArr(o) {
- var arr = [];
- for (let index = 0; index < o.length; index++) {
- const element = o[index];
- arr.push(element);
- }
- return arr;
- }
- static clamp(n, min, max) {
- return n > max ? max : (n < min ? min : n);
- }
- static GetVecByArr(arr) {
- if (!arr)
- return null;
- var vec = new Vector3();
- vec.x = arr[0];
- vec.y = arr[1];
- vec.z = arr[2];
- return vec;
- }
- static IsNext() {
- let uuid = Laya.LocalStorage.getItem("isNext");
- if (uuid) {
- let lastSignTime = new Date(Number(Laya.LocalStorage.getItem("isNext")));
- let todayZero = new Date(Laya.timer.currTimer);
- todayZero.setHours(0, 0, 0, 0);
- if (lastSignTime.valueOf() < todayZero.valueOf()) {
- Laya.LocalStorage.setItem("isNext", Laya.timer.currTimer.toString());
- return true;
- }
- else {
- return false;
- }
- }
- else {
- Laya.LocalStorage.setItem("isNext", Laya.timer.currTimer.toString());
- return true;
- }
- }
- static ToTimeStr1(l) {
- let str = "";
- let minute = 0;
- let second = 0;
- second = l;
- if (second > 60) {
- minute = Math.floor(second / 60);
- second = second % 60;
- }
- str = second < 10 ? "0" + second : second + "";
- return (minute + ":" + str);
- }
- static ToTimeStr(l, isHour = false) {
- let hour = 0;
- let minute = 0;
- let second = 0;
- second = l;
- if (second > 60) {
- minute = Math.floor(second / 60);
- second = second % 60;
- }
- if (isHour && minute > 60) {
- hour = Math.floor(minute / 60);
- minute = minute % 60;
- let ss = second >= 10 ? second + "" : "0" + second.toString();
- let mm = minute >= 10 ? minute + "" : "0" + minute.toString();
- let hh = hour >= 10 ? hour + "" : "0" + hour.toString();
- return (hh + ":" + mm + ":" + ss);
- }
- else {
- if (minute > 60) {
- minute = Math.floor(second / 60);
- second = second % 60;
- }
- let ss = second >= 10 ? second + "" : "0" + second.toString();
- let mm = minute >= 10 ? minute + "" : "0" + minute.toString();
- return (mm + ":" + ss);
- }
- }
- }
- class CfgManager {
- static get Instance() {
- return this.instance || (this.instance = new CfgManager());
- }
- GetSign(id) {
- if (this.sign) {
- return this.sign[id - 1];
- }
- }
- GetReward(id) {
- if (this.rewards) {
- for (let index = 0; index < this.rewards.length; index++) {
- const element = this.rewards[index];
- if (element.id == id) {
- return element;
- }
- }
- }
- }
- GetMission(id) {
- if (this.mission) {
- return this.mission[id - 1];
- }
- return null;
- }
- GetEnemyTeam(id) {
- if (this.enemyteam) {
- return this.enemyteam[id - 1];
- }
- return null;
- }
- GetRole(id) {
- if (this.role) {
- return this.role[id - 1];
- }
- return null;
- }
- GetLevel(id) {
- if (this._level) {
- return this._level[id - 1];
- }
- return null;
- }
- GetRoad(id) {
- if (this._road) {
- return this._road[id - 1];
- }
- return null;
- }
- GetBlock(id) {
- if (this._block) {
- return this._block[id - 1];
- }
- return null;
- }
- GetThing(id) {
- if (this._thing) {
- return this._thing[id - 1];
- }
- return null;
- }
- GetAtk(id) {
- if (this._atk) {
- return this._atk[id - 1];
- }
- return null;
- }
- GetRate(id) {
- if (this._rate) {
- return this._rate[id - 1];
- }
- return null;
- }
- GetCar(id) {
- if (this.car) {
- return this.car[id - 1];
- }
- return null;
- }
- GetGlobe(key) {
- if (this._globe) {
- for (let index = 0; index < this._globe.length; index++) {
- const element = this._globe[index];
- if (element.key == key) {
- return element.value;
- }
- }
- }
- }
- GetTheme(id) {
- if (this._theme) {
- return this._theme[id - 1];
- }
- return null;
- }
- GetLottery(id) {
- if (this._lottery) {
- return this._lottery[id - 1];
- }
- return null;
- }
- GetAchievement(type, level) {
- if (this._achievement) {
- for (let index = 0; index < this._achievement.length; index++) {
- if (this._achievement[index].type == type) {
- if (this._achievement[index].level == level) {
- return this._achievement[index];
- }
- }
- }
- }
- }
- GetTypeLevel(type) {
- var count = 0;
- if (this._achievement) {
- for (let index = 0; index < this._achievement.length; index++) {
- if (this._achievement[index].type == type) {
- count++;
- }
- }
- return count;
- }
- }
- GetachieveType() {
- if (this._achieveType == null) {
- if (this._achievement) {
- for (let index = 0; index < this._achievement.length; index++) {
- this._achieveType = this._achievement[index].type;
- }
- }
- }
- return this._achieveType;
- }
- }
- class AssetPath {
- }
- AssetPath.main_path = "subpackage/LayaScene_main/Conventional/main.ls";
- AssetPath.player_path = ["subpackage/LayaScene_role/Conventional/player1.lh",
- "subpackage/LayaScene_role/Conventional/player2.lh",
- "subpackage/LayaScene_role/Conventional/player3.lh",
- "subpackage/LayaScene_role/Conventional/player4.lh",
- "subpackage/LayaScene_role/Conventional/player5.lh",
- "subpackage/LayaScene_role/Conventional/player6.lh",
- "subpackage/LayaScene_role/Conventional/player7.lh",
- ];
- AssetPath.enemytexture = [
- "subpackage/EnemyTexture/enemy_1.png",
- "subpackage/EnemyTexture/enemy_2.png",
- "subpackage/EnemyTexture/enemy_3.png",
- ];
- AssetPath.enemy_path = "subpackage/LayaScene_role/Conventional/enemy.lh";
- AssetPath.playerBullet_path = "subpackage/LayaScene_prop/Conventional/PlayerBullet.lh";
- AssetPath.tower_path = "subpackage/LayaScene_prop/Conventional/Tower.lh";
- AssetPath.barrier_paths = [
- "subpackage/LayaScene_barrier/Conventional/barrier_1.lh",
- "subpackage/LayaScene_barrier/Conventional/barrier_2.lh",
- "subpackage/LayaScene_barrier/Conventional/barrier_3.lh",
- "subpackage/LayaScene_barrier/Conventional/barrier_4.lh",
- "subpackage/LayaScene_barrier/Conventional/move_barrier.lh",
- "subpackage/LayaScene_barrier/Conventional/stone_1.lh",
- "subpackage/LayaScene_barrier/Conventional/stone_2.lh",
- "subpackage/LayaScene_barrier/Conventional/stone_3.lh",
- "subpackage/LayaScene_barrier/Conventional/stone_4.lh",
- "subpackage/LayaScene_barrier/Conventional/Block1.lh",
- ];
- AssetPath.effect_path = [
- "subpackage/LayaScene_effect/Conventional/boom.lh",
- "subpackage/LayaScene_effect/Conventional/hit.lh",
- "subpackage/LayaScene_effect/Conventional/xue.lh",
- ];
- AssetPath.muchs = [
- "100万",
- "61万",
- "8万",
- "16万", "55万",
- "123万",
- "1004万",
- "88万",
- "69万",
- "90万",
- "7万",
- "14万",
- "6万",
- "12万",
- ];
- AssetPath.tableName = {
- level: "level",
- road: "road",
- block: "block",
- thing: "thing",
- atk: "atk",
- rate: "rate",
- global: "global",
- theme: "theme"
- };
- class AppSetting {
- }
- AppSetting.moveTime = 1;
- class PlayerManager {
- constructor() {
- this.stage = 1;
- this.killCount = 0;
- this.istry = false;
- this.equipId = 1;
- }
- static get Instance() {
- return PlayerManager.instance || (PlayerManager.instance = new PlayerManager());
- }
- ;
- SetTheme() {
- }
- SetTryOutById(id) {
- }
- static SetGlobe() {
- PlayerManager.tower_reward = Number(CfgManager.Instance.GetGlobe("tower_reward"));
- PlayerManager.block_reward = Number(CfgManager.Instance.GetGlobe("block_reward"));
- PlayerManager.enemy_reward = Number(CfgManager.Instance.GetGlobe("enemy_reward"));
- }
- SetPlayer() {
- var usermodel = UserModel.Instance.CurModel;
- PlayerManager.instance.stage = (Number(usermodel.GetUserAttr(UserAttr.stage)) + 1);
- PlayerManager.instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
- this.SetArr();
- }
- SetArr() {
- let power = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["power"];
- if (power)
- this.powerLevel = Number(power);
- else
- this.powerLevel = 1;
- let al = CfgManager.Instance._atk.length;
- let t = this.powerLevel > al ? al : this.powerLevel;
- PlayerManager.bulletAttack = CfgManager.Instance.GetAtk(t)["atk"];
- let rate = UserModel.Instance.CurModel.GetUserAttr(UserAttr.attrs)["rate"];
- if (rate)
- this.rateLevel = Number(rate);
- else
- this.rateLevel = 1;
- let al1 = CfgManager.Instance._rate.length;
- let t1 = this.rateLevel > al1 ? al1 : this.rateLevel;
- PlayerManager.bulletTime = CfgManager.Instance.GetRate(t1)["rate"];
- }
- GradePower(level, chanel, count, callback) {
- let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "power" }, { "level": level }, { "channel": chanel }, { "amount": count }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {
- if (callback)
- callback(true);
- }, (data) => {
- if (callback)
- callback(false);
- });
- }
- GradeRate(level, chanel, count, callback) {
- let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "attr": "rate" }, { "level": level }, { "channel": chanel }, { "amount": count }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.UpgradeAttr, param, (data) => {
- if (callback)
- callback(true);
- }, (data) => {
- if (callback)
- callback(false);
- });
- }
- }
- PlayerManager.bulletAttack = 1;
- PlayerManager.bulletTime = 0.3;
- class GlobalVariable {
- }
- GlobalVariable.playerspeed = 0.1;
- GlobalVariable.friendspeed = 0.2;
- GlobalVariable.bulletspeed = 0.8;
- GlobalVariable.sliderFactor = 0.02;
- GlobalVariable.playerMoveMaxX = 4.5;
- GlobalVariable.playerRayLengthF = 1.3;
- GlobalVariable.playerRayLengthLR = 0.3;
- GlobalVariable.bulletRayLength = 1;
- GlobalVariable.bulletMaxDis = 40;
- GlobalVariable.barrierRoadLength = 50;
- GlobalVariable.barrierRoadAverageNum = 50;
- GlobalVariable.hitmaxcount = 2;
- GlobalVariable.boommaxcount = 2;
- GlobalVariable.blockLRmoveMaxDis = 5;
- GlobalVariable.arriveStandWidth = 5;
- GlobalVariable.enemySpeed = 0.1;
- class UserInfoManager {
- static GameInfo() {
- PlayerManager.Instance.SetPlayer();
- }
- static SetCfg(cfg) {
- CfgManager.Instance._level = cfg[AssetPath.tableName.level];
- CfgManager.Instance._road = cfg[AssetPath.tableName.road];
- CfgManager.Instance._block = cfg[AssetPath.tableName.block];
- CfgManager.Instance._thing = cfg[AssetPath.tableName.thing];
- CfgManager.Instance._atk = cfg[AssetPath.tableName.atk];
- CfgManager.Instance._rate = cfg[AssetPath.tableName.rate];
- CfgManager.Instance._theme = cfg[AssetPath.tableName.theme];
- CfgManager.Instance._globe = cfg[AssetPath.tableName.global];
- PlayerManager.SetGlobe();
- }
- static Appseting(data) {
- AppSetting.shareimage = data["shareimage"];
- AppSetting.sharetitle = data["sharetitle"];
- AppSetting.bannerCanMove = Number(data["bannerCanMove"]);
- AppSetting.moveTime = Number(data["moveTime"]);
- AppSetting.OpenSceneValue = Number(data["OpenSceneValue"]);
- AppSetting.freeUpdateVideotime = Number(data["freeUpdateVideotime"]);
- AppSetting.freecoinValue = Number(data["freecoinValue"]);
- AppSetting.freeGetcoinTime = Number(data["freeGetcoinTime"]);
- GlobalVariable.playerspeed = Number(data["playerspeed"]);
- GlobalVariable.friendspeed = Number(data["friendspeed"]);
- GlobalVariable.bulletspeed = Number(data["bulletspeed"]);
- GlobalVariable.sliderFactor = Number(data["sliderFactor"]);
- GlobalVariable.playerMoveMaxX = Number(data["playerMoveMaxX"]);
- GlobalVariable.playerRayLengthF = Number(data["playerRayLengthF"]);
- GlobalVariable.playerRayLengthLR = Number(data["playerRayLengthLR"]);
- GlobalVariable.bulletRayLength = Number(data["bulletRayLength"]);
- GlobalVariable.bulletMaxDis = Number(data["bulletMaxDis"]);
- GlobalVariable.barrierRoadLength = Number(data["barrierRoadLength"]);
- GlobalVariable.barrierRoadAverageNum = Number(data["barrierRoadAverageNum"]);
- GlobalVariable.hitmaxcount = Number(data["hitmaxcount"]);
- GlobalVariable.boommaxcount = Number(data["boommaxcount"]);
- GlobalVariable.blockLRmoveMaxDis = Number(data["blockLRmoveMaxDis"]);
- GlobalVariable.arriveStandWidth = Number(data["arriveStandWidth"]);
- GlobalVariable.enemySpeed = Number(data["enemySpeed"]);
- }
- }
- var Event = Laya.Event;
- var HttpRequest = Laya.HttpRequest;
- const PROTOCOL_URL = "https://gungangapi.xwxgame.com/";
- class PROTOCOLS {
- }
- PROTOCOLS.protocols = {
- Login: "user/login",
- Userauth: "user/auth",
- BuyLand: "shop/land",
- UserSync: "user/sync",
- ShopBuild: "shop/build",
- ShopUpgrade: "shop/upgrade",
- ShopSale: "shop/sale",
- RoleUpgrade: "role/upgrade",
- Fissionvd: "fission/vd",
- DailyTaskrefresh: "dailytask/refresh",
- DailyTaskrewards: "dailytask/rewards",
- Rankingvmoney: "ranking/vmoney",
- Lotterylottery: "lottery/lottery",
- AchievementgetRewards: "achievement/getRewards",
- Fissiondeduct: "fission/deduct",
- Sign: "sign/sign",
- InvitegetRewards: "invite/getRewards",
- InvitetargetRewards: "invite/targetRewards",
- GameResult: "game/play",
- Easter: "game/revival",
- GetCfg: "config/table",
- DoubleAward: "fission/vd",
- KunDiscard: "kun/discard",
- KunEquip: "kun/equip",
- KunMove: "kun/move",
- KunBuy: "kun/buy",
- Opentreasure: "treasure/open",
- Entertreasure: "treasure/enter",
- Buy: "theme/buy",
- Equip: "theme/equip",
- themefission: "theme/fission",
- Start: "game/start",
- UpgradeAttr: "attr/upgrade"
- };
- class NetManager {
- PostTokenRequest(protocol, completecb, errorcb, isload = true) {
- let args = "";
- let url = PROTOCOL_URL + protocol;
- args = args = `token=${UserModel.Instance.CurModel.m_token}`;
- let httpRequest = new HttpRequest();
- httpRequest.once(Event.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
- httpRequest.once(Event.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
- httpRequest.send(url, args, "post", "text");
- if (isload) {
- WXSdk.ShowLoading("");
- }
- }
- onHttpRequestComplete(succeedcb, failurecb, httpRequest, isload) {
- let data;
- if (isload) {
- WXSdk.HideLoading();
- }
- data = JSON.parse(httpRequest.data);
- console.log("请求成功:" + JSON.stringify(data));
- if (data["code"] == 0) {
- UserModel.Instance.RefreshModel(data);
- if (succeedcb != null) {
- succeedcb(data);
- }
- }
- else {
- if (failurecb != null) {
- var mess = GameTool.SpliteString(data["message"], ",")[0];
- failurecb(mess);
- }
- }
- }
- onHttpRequestError(errorcb, httpRequest, isload) {
- if (errorcb != null) {
- var data = JSON.parse(httpRequest.data);
- errorcb(data);
- }
- console.log("Error! Http request error, code: " + data);
- if (isload) {
- WXSdk.HideLoading();
- }
- }
- static get Instance() {
- return NetManager.instance || (NetManager.instance = new NetManager());
- }
- login(progresscb, completecb, errorcb) {
- console.log("发送登录请求");
- var userInfor = UserModel.Instance;
- var ver = GameSetting.VER;
- 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}`;
- console.log("登录 参数: " + args);
- let httpRequest = new HttpRequest();
- httpRequest.once(Event.PROGRESS, this, this.onHttpRequestProgress, [progresscb, httpRequest]);
- httpRequest.once(Event.COMPLETE, this, this.onLoginRequestComplete, [completecb, httpRequest]);
- httpRequest.once(Event.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest]);
- httpRequest.send(PROTOCOL_URL + PROTOCOLS.protocols.Login, args, "post", "text");
- }
- onHttpRequestProgress() {
- }
- onLoginRequestComplete(completecb, httpRequest) {
- let data = JSON.parse(httpRequest.data);
- console.log(data);
- console.log("登录完成");
- if (data["code"] != "0") {
- var errInfo = JSON.stringify(httpRequest.data);
- console.log("登录异常错误!错误信息:", errInfo);
- completecb(data);
- return;
- }
- 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"]));
- UserInfoManager.Appseting(data["app_setting"]);
- var ver = data["table_version"];
- UserModel.Instance.CurModel.JundgCfg(ver, (c) => {
- if (c) {
- UserInfoManager.GameInfo();
- completecb(data);
- }
- });
- WXSdk.ShareMessage();
- }
- PostCfgRequest(completecb, errorcb) {
- let args = "";
- let url = PROTOCOL_URL + PROTOCOLS.protocols.GetCfg;
- args = `token=${UserModel.Instance.CurModel.m_token}`;
- let httpRequest = new HttpRequest();
- httpRequest.once(Event.COMPLETE, this, () => {
- var data = JSON.parse(httpRequest.data);
- if (data["code"] == 0) {
- if (completecb != null) {
- if (data["configs"]) {
- completecb(data["configs"]);
- }
- }
- }
- else {
- if (errorcb != null) {
- errorcb(data);
- }
- }
- });
- httpRequest.once(Event.ERROR, this, () => {
- var data = JSON.parse(httpRequest.data);
- if (errorcb != null) {
- errorcb(data);
- }
- });
- httpRequest.send(url, args, "post", "text");
- }
- HttpPostRequest(protocol, param, completecb, errorcb, hasToken = true, isload = true) {
- let args = "";
- let url = PROTOCOL_URL + protocol;
- if (hasToken == true) {
- args = `token=${UserModel.Instance.CurModel.m_token}&`;
- }
- if (protocol == PROTOCOLS.protocols.UserSync || protocol == PROTOCOLS.protocols.Fissionvd || protocol == PROTOCOLS.protocols.Lotterylottery
- || protocol == PROTOCOLS.protocols.Fissiondeduct || protocol == PROTOCOLS.protocols.KunBuy || protocol == PROTOCOLS.protocols.KunDiscard
- || protocol == PROTOCOLS.protocols.KunEquip || protocol == PROTOCOLS.protocols.KunMove || protocol == PROTOCOLS.protocols.Start || protocol == PROTOCOLS.protocols.GameResult
- || protocol == PROTOCOLS.protocols.themefission || protocol == PROTOCOLS.protocols.Opentreasure || protocol == PROTOCOLS.protocols.UpgradeAttr) {
- let str = "abcdefghijkimnopqrstuvwxyz0123456789";
- let code = "{";
- let mask = "";
- for (let i = 0; i < 4; i++) {
- mask += str[Math.floor(Math.random() * 100) % str.length];
- }
- for (let i = 0; i < param.length; i++) {
- for (let key in param[i]) {
- code += "\"" + key + "\":";
- if (typeof param[i][key] === 'string') {
- code += "\"" + param[i][key] + "\"";
- }
- else {
- code += param[i][key];
- }
- }
- if (i < param.length - 1) {
- code += ",";
- }
- else {
- code += "}";
- }
- }
- args += "_r=" + mask + GameTool.get64Encode(code);
- }
- else {
- if (param != null) {
- for (let i = 0; i < param.length; i++) {
- for (let key in param[i]) {
- let val = param[i][key];
- args += `${key}=${val}`;
- if (i < param.length - 1) {
- args += "&";
- }
- }
- }
- }
- }
- let httpRequest = new HttpRequest();
- httpRequest.once(Event.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest, isload]);
- httpRequest.once(Event.ERROR, this, this.onHttpRequestError, [errorcb, httpRequest, isload]);
- httpRequest.send(url, args, "post", "text");
- if (isload) {
- WXSdk.ShowLoading("");
- }
- }
- static errorRequest(arg, callback) {
- let httpRequest = new Laya.HttpRequest();
- if (callback) {
- httpRequest.once(Laya.Event.PROGRESS, this, () => { callback.progress && callback.progress(httpRequest); });
- httpRequest.once(Laya.Event.ERROR, this, () => { callback.error && callback.error(httpRequest); });
- httpRequest.once(Laya.Event.COMPLETE, this, () => { callback.complete && callback.complete(httpRequest); });
- }
- httpRequest.send("https://r.94xj.net/e", arg, "post", "json", ["Content-Type", "application/json"]);
- }
- static ErrorReport() {
- let arg = {
- "code": 1003,
- "msg": "invalid code",
- "user_id": 0,
- "game": "parkourrace",
- "type": "backend",
- "platform": "weixin"
- };
- this.errorRequest(arg, {
- complete: (request) => {
- },
- error: (request) => {
- }
- });
- }
- }
- var UserConfigName;
- (function (UserConfigName) {
- UserConfigName[UserConfigName["train"] = 0] = "train";
- UserConfigName[UserConfigName["sign"] = 1] = "sign";
- UserConfigName[UserConfigName["rewards"] = 2] = "rewards";
- })(UserConfigName || (UserConfigName = {}));
- var UserAttr;
- (function (UserAttr) {
- UserAttr[UserAttr["user_id"] = 0] = "user_id";
- UserAttr[UserAttr["diamond"] = 1] = "diamond";
- UserAttr[UserAttr["energy"] = 2] = "energy";
- UserAttr[UserAttr["list_kun"] = 3] = "list_kun";
- UserAttr[UserAttr["stage"] = 4] = "stage";
- UserAttr[UserAttr["vmoney"] = 5] = "vmoney";
- UserAttr[UserAttr["equip_kun"] = 6] = "equip_kun";
- UserAttr[UserAttr["unlock_kun"] = 7] = "unlock_kun";
- UserAttr[UserAttr["buyed_kun"] = 8] = "buyed_kun";
- UserAttr[UserAttr["money"] = 9] = "money";
- UserAttr[UserAttr["progress_themes"] = 10] = "progress_themes";
- UserAttr[UserAttr["equip_themes"] = 11] = "equip_themes";
- UserAttr[UserAttr["get_themes"] = 12] = "get_themes";
- UserAttr[UserAttr["attrs"] = 13] = "attrs";
- })(UserAttr || (UserAttr = {}));
- class NetUserModel {
- 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) {
- this.loginSeverTime = 0;
- this.m_avatar = "";
- this.localTime = Laya.timer.currTimer;
- this.loginSeverTime = t;
- this.m_token = _token;
- this.m_user = _user;
- this.m_base = _userbase;
- this.m_invite = _useInvite;
- this.m_lottery = _user_lottery;
- this.m_treasure = _user_treasure;
- this.m_achievement = _user_achievement;
- this.m_sign = _user_sign;
- this.m_arena = _user_arena;
- this.m_shop = user_shop;
- this.user_video = user_video;
- this.user_daily_task = user_daily_task;
- this.m_userid = this.m_user["user_id"];
- this.m_openid = this.m_base["openid"];
- this.m_nickname = this.m_base["nickname"];
- this.is_new = Number(is_new);
- }
- GetUserAttr(_attr) {
- var attr = UserAttr[_attr];
- return this.m_user[attr];
- }
- get ServerTime() {
- let time = Laya.timer.currTimer;
- let stime = this.loginSeverTime + Math.ceil((time - this.localTime) / 1000);
- return stime;
- }
- HasTheme(_id) {
- var data = this.GetUserAttr(UserAttr.get_themes);
- for (var i = 0; i < data.length; i++) {
- var hd = data[i];
- if (_id == hd) {
- return true;
- }
- }
- return false;
- }
- GetThemeProgress(_id) {
- var config = this.GetUserAttr(UserAttr.progress_themes);
- var progress = config[_id] ? config[_id] : 0;
- return progress;
- }
- JundgCfg(ver, callball) {
- var cfg = Laya.LocalStorage.getJSON(GameSetting.CFG);
- if (cfg) {
- if (cfg.VER == ver) {
- console.log("已经拥有,不用更新");
- UserInfoManager.SetCfg(cfg);
- callball(true);
- }
- else {
- console.log("cfg存在但是过期了");
- Laya.LocalStorage.removeItem(GameSetting.CFG);
- NetManager.Instance.PostCfgRequest((data) => {
- data.VER = ver;
- Laya.LocalStorage.setJSON(GameSetting.CFG, data);
- UserInfoManager.SetCfg(data);
- callball(true);
- }, (data) => {
- console.log("配置获取失败" + data);
- callball(false);
- return;
- });
- }
- }
- else {
- console.log("本地没有cfg");
- NetManager.Instance.PostCfgRequest((data) => {
- console.log("cfg" + data);
- data.VER = ver;
- Laya.LocalStorage.setJSON(GameSetting.CFG, data);
- UserInfoManager.SetCfg(data);
- callball(true);
- }, (data) => {
- console.log("配置获取失败" + data);
- });
- }
- }
- }
- class UserModel {
- get CurModel() {
- return this.curModel;
- }
- constructor(code, nickname, avatar, gender, country, province, city, device, share_id, channel) {
- UserModel.instance = this;
- this.m_code = code;
- this.m_nickname = nickname ? nickname : "";
- this.m_avatar = avatar ? avatar : "";
- this.m_gender = gender ? gender : 0;
- this.m_city = city ? city : "";
- this.m_device = device ? device : "";
- this.m_share_id = share_id ? share_id : "";
- this.channel = channel ? channel : "";
- this.m_country = country ? country : "";
- this.m_province = province ? province : "";
- }
- static get Instance() {
- if (UserModel.instance) {
- return UserModel.instance;
- }
- else {
- UserModel.instance = new UserModel("11", "", "", 0, "", "", "", "", "", "");
- return UserModel.instance;
- }
- }
- SetUserModel(_model) {
- this.curModel = _model;
- }
- RefreshModel(data) {
- if (data["user"])
- this.curModel.m_user = data["user"];
- if (data["user_invite"])
- this.curModel.m_invite = data["user_invite"];
- if (data["user_lottery"])
- this.curModel.m_lottery = data["user_lottery"];
- if (data["user_achievement"]) {
- this.curModel.m_achievement = data["user_achievement"];
- }
- if (data["user_sign"])
- this.curModel.m_sign = data["user_sign"];
- if (data["user_shop"])
- this.curModel.m_shop = data["user_shop"];
- if (data["user_daily_task"])
- this.curModel.user_daily_task = data["user_daily_task"];
- if (data["user_video"])
- this.curModel.user_video = data["user_video"];
- }
- }
- var Sprite3D = Laya.Sprite3D;
- var PoolType;
- (function (PoolType) {
- PoolType[PoolType["WarnTips"] = 1] = "WarnTips";
- PoolType[PoolType["HpText"] = 2] = "HpText";
- })(PoolType || (PoolType = {}));
- class GamePool {
- constructor() {
- this.poolDic = new Dictionary();
- this.prefabDic = new Dictionary();
- this.singleobjDic = new Dictionary();
- }
- static get Instance() {
- return GamePool.instance || (GamePool.instance = new GamePool());
- }
- InitData(name, prefab) {
- if (prefab != null) {
- if (!this.prefabDic.has(name))
- this.prefabDic.set(name, prefab);
- }
- }
- HasSprInPool(name) {
- return this.prefabDic.has(name);
- }
- SetActiveObject(name) {
- if (name == "PlayerBullet")
- GamePool.bulletCount++;
- if (this.poolDic.has(name)) {
- if (this.poolDic.get(name).length > 0) {
- var result = this.poolDic.get(name).shift();
- result.active = true;
- return result;
- }
- else {
- if (this.prefabDic.has(name)) {
- var curObj = Sprite3D.instantiate(this.prefabDic.get(name));
- curObj.name = name;
- console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id);
- return curObj;
- }
- else {
- return null;
- }
- }
- }
- else {
- if (this.prefabDic.has(name)) {
- var curObj = Sprite3D.instantiate(this.prefabDic.get(name));
- curObj.name = name;
- console.log("正在克隆中>>>>>" + name + "__id:" + curObj.id);
- return curObj;
- }
- else {
- return null;
- }
- }
- }
- SetActiveForUi(type) {
- if (this.singleobjDic.has(type)) {
- if (this.singleobjDic.get(type).length > 0) {
- var result = this.singleobjDic.get(type).shift();
- result.visible = true;
- return result;
- }
- else {
- return this.GetByType(type);
- }
- }
- else {
- return this.GetByType(type);
- }
- }
- GetByType(type) {
- if (type == PoolType.WarnTips) {
- var _t = new Laya.Text();
- _t.width = 720;
- _t.height = 60;
- _t.align = "center";
- _t.valign = "middle";
- _t.fontSize = 35;
- _t.bold = true;
- _t.pivotX = 360;
- _t.pivotY = 30;
- _t.color = "#ffffff";
- _t.stroke = 5;
- _t.strokeColor = "#000000";
- return _t;
- }
- else if (type == PoolType.HpText) {
- var _t = new Laya.Text();
- _t.font = "Microsoft YaHei";
- _t.width = 260;
- _t.height = 50;
- _t.align = "center";
- _t.valign = "middle";
- _t.fontSize = 30;
- _t.bold = true;
- _t.pivotX = 130;
- _t.pivotY = 25;
- _t.color = "#ffffff";
- return _t;
- }
- }
- SetDisableForUi(type, go) {
- go.visible = false;
- go.removeSelf();
- if (!this.singleobjDic.has(type)) {
- this.singleobjDic.set(type, new Array());
- }
- this.singleobjDic.get(type).push(go);
- }
- SetDisableObject(go) {
- if (!go)
- return;
- go.active = false;
- go.removeSelf();
- var key = go.name;
- if (!this.poolDic.has(key)) {
- this.poolDic.set(key, new Array());
- }
- this.poolDic.get(key).push(go);
- }
- SetDisableMutiObject(go, timer) {
- Laya.timer.once(timer, this, () => {
- if (go)
- go.active = false;
- var key = go.name;
- if (!this.poolDic.has(key)) {
- this.poolDic.set(key, new Array());
- }
- this.poolDic.get(key).push(go);
- });
- }
- }
- GamePool.pooltype = {
- Tower: "Tower",
- PlayerBullet: "PlayerBullet",
- player: "player",
- enemy: "enemy"
- };
- GamePool.bulletCount = 0;
- class Mathf {
- static GetData(value) {
- var theTime = Math.floor(value);
- var theTime1 = 0;
- var theTime2 = 0;
- var theTime3 = 0;
- if (theTime > 60) {
- theTime1 = Math.floor(theTime / 60);
- theTime = theTime % 60;
- if (theTime1 > 60) {
- theTime2 = Math.floor(theTime1 / 60);
- theTime1 = theTime1 % 60;
- if (theTime2 > 24) {
- theTime3 = Math.floor(theTime2 / 24);
- theTime2 = theTime2 % 24;
- }
- }
- }
- var result = '';
- result = "" + theTime1 + "分" + result;
- result = "" + theTime2 + "时" + result;
- result = "" + theTime3 + "天" + result;
- return result;
- }
- static GetNumAccuracy(num) {
- var b = Math.ceil(num * 10) / 10;
- if (Math.abs(b - num) < 0.0001) {
- return b;
- }
- var a = Math.floor(num * 10) / 10;
- if (Math.abs(a - num) < 0.0001) {
- return a;
- }
- return num;
- }
- static get VecZero() {
- return new Laya.Vector3();
- }
- static RandomNumber(from, to) {
- if (from >= to) {
- return 0;
- }
- var size = to - from;
- var curNumber = Math.random() * size + from;
- return curNumber;
- }
- static SpToCam(v3) {
- v3.x = -v3.x;
- v3.y = v3.y - 180;
- v3.z = -v3.z;
- return v3;
- }
- static get Gravity() {
- return new Laya.Vector3(0, -10, 0);
- }
- static MixVector3(from, to, t, res = null) {
- if (res == null) {
- res = this.m_mixVector;
- }
- res.x = Mathf.MixNumber(from.x, to.x, t);
- res.y = Mathf.MixNumber(from.y, to.y, t);
- res.z = Mathf.MixNumber(from.z, to.z, t);
- return res;
- }
- static MixVector4(from, to, t, res) {
- res.x = Mathf.MixNumber(from.x, to.x, t);
- res.y = Mathf.MixNumber(from.y, to.y, t);
- res.z = Mathf.MixNumber(from.z, to.z, t);
- res.w = Mathf.MixNumber(from.w, to.w, t);
- return res;
- }
- static MixNumber(from, to, t) {
- t = Mathf.Clamp(t, 0, 1);
- from = (to - from) * t + from;
- return from;
- }
- static Clamp(value, from, to) {
- if (value < from) {
- value = from;
- }
- if (value > to) {
- value = to;
- }
- return value;
- }
- }
- Mathf.m_mixVector = new Laya.Vector3();
- class FollowNumber {
- constructor(t, from = 0, to = 0, tiny = 0) {
- this.m_t = 0;
- this.target = 0;
- this.follow = 0;
- this.m_tiny = 0;
- this.m_t = t;
- this.target = to;
- this.follow = from;
- this.m_tiny = tiny;
- }
- ChangeT(value) {
- this.m_t = value;
- }
- get t() { return this.m_t; }
- update() {
- this.follow = Mathf.MixNumber(this.follow, this.target, this.m_t);
- if (this.m_tiny != 0 && this.target != this.follow) {
- if (Math.abs(this.target - this.follow) <= this.m_tiny) {
- this.follow = this.target;
- }
- }
- }
- }
- var ColliderGroup;
- (function (ColliderGroup) {
- ColliderGroup[ColliderGroup["mound"] = 8] = "mound";
- ColliderGroup[ColliderGroup["wall"] = 9] = "wall";
- ColliderGroup[ColliderGroup["opponent"] = 10] = "opponent";
- ColliderGroup[ColliderGroup["obstacle1"] = 11] = "obstacle1";
- ColliderGroup[ColliderGroup["obstacle2"] = 12] = "obstacle2";
- ColliderGroup[ColliderGroup["obstacle3"] = 13] = "obstacle3";
- })(ColliderGroup || (ColliderGroup = {}));
- class MusicType {
- }
- MusicType.Idle = "Idle";
- MusicType.CrouchFiring = "CrouchFiring";
- MusicType.Dance = "Dance";
- MusicType.RunAndGun = "RunAndGun";
- MusicType.RunningHysteric = "RunningHysteric";
- class CameraManager {
- static get Instance() {
- return this.instance || (this.instance = new CameraManager());
- }
- Init(cam, startPos) {
- this.startPosTra = startPos.transform;
- if (cam) {
- this._camer = cam;
- this.Camera = this._camer.addComponent(Camera);
- this.Camera.Init();
- }
- }
- SetCamState(type, arg) {
- if (this.Camera)
- this.Camera.SetCameraByState(type, arg);
- }
- CameraMoveIngame(z) {
- if (this.Camera)
- this.Camera.MoveGame(z);
- }
- }
- class ConstructManager {
- constructor() {
- this.tarDis = 100;
- this.buildArr = [];
- }
- static get Instance() {
- return this.instance || (this.instance = new ConstructManager());
- }
- Init(builds) {
- this.buildArr.push(builds.getChildAt(1));
- this.buildArr.push(builds.getChildAt(0));
- }
- SetBuild() {
- for (let index = this.buildArr.length - 1; index >= 0; index--) {
- const element = this.buildArr[index];
- element.transform.localPositionZ = (1 - index) * 100;
- }
- this.tarDis = 70;
- }
- CheckPlayerRoadPos(_zp) {
- let d = this.tarDis - _zp;
- if (d > 0)
- return;
- this.SwitchRoad();
- }
- SwitchRoad() {
- let rs = this.buildArr.pop();
- rs.transform.localPositionZ = this.tarDis + 30 + 100;
- this.buildArr.unshift(rs);
- this.tarDis = this.tarDis + 100;
- }
- }
- class Level {
- constructor() {
- this.road_list = [];
- this.fail_gold = 0;
- }
- SetLevel(data) {
- this.road_list = GameTool.SpliteString(data["road_list"]);
- this.gold = Number(data["gold"]);
- this.fail_gold = Number(data["fail_gold"]);
- this.enemy = data["enemy"];
- this.enemy_hp = data["enemy_hp"];
- this.isgold = Number(data["isgold"]) == 1;
- this.enemy_cloth = data["enemy_cloth"] ? Number(data["enemy_cloth"]) : 1;
- }
- }
- class LevelController {
- static get Instance() {
- return LevelController.instance || (LevelController.instance = new LevelController());
- }
- SetLevel(level) {
- let len = CfgManager.Instance._level.length;
- let index = PlayerManager.Instance.stage;
- if (PlayerManager.Instance.stage > len)
- index = GameTool.randomInt(1, len);
- this.curLevelData = CfgManager.Instance.GetLevel(index);
- if (!this._level)
- this._level = new Level();
- this._level.SetLevel(this.curLevelData);
- }
- }
- class MoundManager {
- static get Instance() {
- return this.instance || (this.instance = new MoundManager());
- }
- constructor() {
- this.towerDic = new Dictionary();
- }
- Init(da) {
- this.towerContainer = da;
- }
- CreateTower(data) {
- let tower = GamePool.Instance.SetActiveObject(GamePool.pooltype.Tower);
- if (!tower)
- return;
- this.towerContainer.addChild(tower);
- let ts = tower.getComponent(Mound);
- if (!ts)
- ts = tower.addComponent(Mound);
- ts.SetTower(data);
- this.towerDic.set(tower.id, ts);
- }
- RemoveTower(sp) {
- this.towerDic.delete(sp.id);
- }
- CreateHpText() {
- return GamePool.Instance.SetActiveForUi(PoolType.HpText);
- }
- Reset() {
- let arr = [];
- for (const key in this.towerDic.container) {
- arr.push(key);
- }
- if (arr.length > 0) {
- for (let index = 0; index < arr.length; index++) {
- const element = arr[index];
- let s = this.towerDic.get(element);
- if (s)
- s.Des();
- }
- }
- console.log("this.towerDic.size", this.towerDic.size);
- }
- }
- class MatrixTransform {
- static WorldToScreen2(camera, point) {
- var pointA = this.InverseTransformPoint(camera.transform, point);
- var distance = pointA.z;
- var out = new Laya.Vector3();
- camera.viewport.project(point, camera.projectionViewMatrix, out);
- var value = new Laya.Vector3(out.x / Laya.stage.clientScaleX, out.y / Laya.stage.clientScaleY, distance);
- return value;
- }
- static ScreenToWorld(camera, point) {
- var halfFOV = (camera.fieldOfView * 0.5) * Math.PI / 180;
- let height = point.z * Math.tan(halfFOV);
- let width = height * camera.aspectRatio;
- let lowerLeft = this.GetLowerLeft(camera.transform, point.z, width, height);
- let v = this.GetScreenScale(width, height);
- var value = new Laya.Vector3();
- var lowerLeftA = this.InverseTransformPoint(camera.transform, lowerLeft);
- value = new Laya.Vector3(-point.x / v.x, point.y / v.y, 0);
- Laya.Vector3.add(lowerLeftA, value, value);
- value = this.TransformPoint(camera.transform, value);
- return value;
- }
- static GetScreenScale(width, height) {
- var v = new Laya.Vector3();
- v.x = Laya.stage.width / width / 2;
- v.y = Laya.stage.height / height / 2;
- return v;
- }
- static GetLowerLeft(transform, distance, width, height) {
- var lowerLeft = new Laya.Vector3();
- var right = new Laya.Vector3();
- transform.getRight(right);
- Laya.Vector3.normalize(right, right);
- var xx = new Laya.Vector3(right.x * width, right.y * width, right.z * width);
- Laya.Vector3.add(transform.position, xx, lowerLeft);
- var up = new Laya.Vector3();
- transform.getUp(up);
- Laya.Vector3.normalize(up, up);
- var yy = new Laya.Vector3(up.x * height, up.y * height, up.z * height);
- Laya.Vector3.subtract(lowerLeft, yy, lowerLeft);
- var forward = new Laya.Vector3();
- transform.getForward(forward);
- Laya.Vector3.normalize(forward, forward);
- var zz = new Laya.Vector3(forward.x * distance, forward.y * distance, forward.z * distance);
- Laya.Vector3.subtract(lowerLeft, zz, lowerLeft);
- return lowerLeft;
- }
- static InverseTransformPoint(origin, point) {
- var xx = new Laya.Vector3();
- origin.getRight(xx);
- var yy = new Laya.Vector3();
- origin.getUp(yy);
- var zz = new Laya.Vector3();
- origin.getForward(zz);
- var zz1 = new Laya.Vector3(-zz.x, -zz.y, -zz.z);
- var x = this.ProjectDistance(point, origin.position, xx);
- var y = this.ProjectDistance(point, origin.position, yy);
- var z = this.ProjectDistance(point, origin.position, zz1);
- var value = new Laya.Vector3(x, y, z);
- return value;
- }
- static TransformPoint(origin, point) {
- var value = new Laya.Vector3();
- Laya.Vector3.transformQuat(point, origin.rotation, value);
- Laya.Vector3.add(value, origin.position, value);
- return value;
- }
- static ProjectDistance(A, C, B) {
- var CA = new Laya.Vector3();
- Laya.Vector3.subtract(A, C, CA);
- var angle = this.Angle2(CA, B) * Math.PI / 180;
- var distance = Laya.Vector3.distance(A, C);
- distance *= Math.cos(angle);
- return distance;
- }
- static Angle2(ma, mb) {
- var v1 = (ma.x * mb.x) + (ma.y * mb.y) + (ma.z * mb.z);
- var ma_val = Math.sqrt(ma.x * ma.x + ma.y * ma.y + ma.z * ma.z);
- var mb_val = Math.sqrt(mb.x * mb.x + mb.y * mb.y + mb.z * mb.z);
- var cosM = v1 / (ma_val * mb_val);
- if (cosM < -1)
- cosM = -1;
- if (cosM > 1)
- cosM = 1;
- var angleAMB = Math.acos(cosM) * 180 / Math.PI;
- return angleAMB;
- }
- }
- class ParticleManager {
- constructor() {
- this.hitmaxcount = 0;
- this.boommaxcount = 0;
- }
- static get Instance() {
- return ParticleManager.instance || (ParticleManager.instance = new ParticleManager());
- }
- CreateHitEffect(pos) {
- if (this.hitmaxcount >= GlobalVariable.hitmaxcount)
- return;
- let h = GamePool.Instance.SetActiveObject("hit");
- h.transform.position = pos;
- Scene3DManager.Instance.effectCon.addChild(h);
- this.hitmaxcount++;
- Laya.timer.once(800, this, this.DisSpH, [h], false);
- }
- DisSpH(sp) {
- GamePool.Instance.SetDisableObject(sp);
- this.hitmaxcount--;
- }
- CreateBoomEffect(pos) {
- if (this.boommaxcount >= GlobalVariable.boommaxcount)
- return;
- let h = GamePool.Instance.SetActiveObject("boom");
- h.transform.position = pos;
- Scene3DManager.Instance.effectCon.addChild(h);
- this.boommaxcount++;
- Laya.timer.once(800, this, this.DisSpB, [h], false);
- }
- DisSpB(sp) {
- GamePool.Instance.SetDisableObject(sp);
- this.boommaxcount--;
- }
- CreateXueEffect(pos) {
- let h = GamePool.Instance.SetActiveObject("xue");
- h.transform.position = pos;
- Scene3DManager.Instance.effectCon.addChild(h);
- Laya.timer.once(800, this, this.DisSpX, [h], false);
- }
- DisSpX(sp) {
- GamePool.Instance.SetDisableObject(sp);
- }
- }
- ParticleManager.effectName = {
- hit: "hit",
- xue: "xue",
- boom: "boom"
- };
- var Event$1 = Laya.Event;
- var MouseManager = Laya.MouseManager;
- class MouseEvent {
- constructor() {
- this._switch = false;
- this._isCanClick = true;
- this.clickD = false;
- this._mousePos = Mathf.VecZero;
- this.tempMouse = Mathf.VecZero;
- this.clickCount = 0;
- }
- static get Instance() {
- return this.instance || (this.instance = new MouseEvent());
- }
- InitMouseEvent() {
- Laya.stage.on(Event$1.MOUSE_DOWN, this, this.OnClickDown);
- Laya.stage.on(Event$1.MOUSE_OUT, this, this.OnClickUp);
- }
- OnClickDown(e) {
- if (!this._isCanClick || !this._switch)
- return;
- if (e.target instanceof Laya.UIComponent)
- return;
- this.clickD = true;
- Laya.stage.on(Event$1.MOUSE_UP, this, this.OnClickUp);
- Laya.stage.on(Event$1.MOUSE_MOVE, this, this.OnSlider);
- this._mousePos.x = MouseManager.instance.mouseX;
- this._mousePos.y = MouseManager.instance.mouseY;
- this.MouseD();
- }
- StartGameClick() {
- this._switch = true;
- if (!this._isCanClick)
- return;
- this.clickD = true;
- Laya.stage.on(Event$1.MOUSE_UP, this, this.OnClickUp);
- Laya.stage.on(Event$1.MOUSE_MOVE, this, this.OnSlider);
- this._mousePos.x = MouseManager.instance.mouseX;
- this.MouseD();
- }
- MouseD() {
- MainRoleManager.Instance.SetPlayerPos(this._mousePos.x);
- MainRoleManager.Instance.CreateBullet();
- }
- OnClickUp(e) {
- if (!this._isCanClick || !this._switch)
- return;
- if (!this.clickD)
- return;
- this.MouseU();
- }
- OffMouseEvent() {
- Laya.stage.off(Event$1.MOUSE_DOWN, this, this.OnClickDown);
- Laya.stage.off(Event$1.MOUSE_UP, this, this.OnClickUp);
- Laya.stage.off(Event$1.MOUSE_OUT, this, this.OnClickUp);
- }
- MouseU() {
- this.clickD = false;
- Laya.stage.off(Event$1.MOUSE_MOVE, this, this.OnSlider);
- Laya.stage.off(Event$1.MOUSE_UP, this, this.OnClickUp);
- }
- OnSlider(e) {
- this.tempMouse.x = MouseManager.instance.mouseX;
- let offestX = this.tempMouse.x - this._mousePos.x;
- if (offestX >= 0)
- offestX = offestX < 20 ? offestX : 20;
- if (offestX < 0)
- offestX = offestX > -20 ? offestX : -20;
- MainRoleManager.Instance.SliderPlayer(-offestX);
- this._mousePos.x = this.tempMouse.x;
- this._mousePos.y = this.tempMouse.y;
- }
- OpenInput() {
- this.clickCount++;
- if (this.clickCount > 1)
- return;
- this._isCanClick = true;
- }
- CloseInput() {
- this.clickCount--;
- if (this.clickCount > 0)
- return;
- this._isCanClick = false;
- this.clickD = false;
- }
- set _Switch(value) {
- this._switch = value;
- }
- }
- class Street extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this.rotate = Mathf.VecZero;
- this.speed = Mathf.VecZero;
- }
- onAwake() {
- this.selfobj = this.owner;
- this.tran = this.selfobj.transform;
- }
- SetBlock(thing) {
- this.tran.localPositionZ = Number(thing.z);
- this.tran.localPositionX = Number(thing.x);
- this.tran.rotationEuler = Mathf.VecZero;
- this.thing = thing;
- if (!MainRoleManager.Instance.player)
- return;
- this.tarTran = MainRoleManager.Instance.player.transform;
- this.SetDate();
- }
- SetDate() {
- if (this.thing.type == 5) {
- this.ttttt = this.selfobj.getChildAt(0).transform;
- }
- else {
- this.ttttt = this.tran;
- if (this.thing.type == 4) {
- StreetManager.Instance.AddCubeBlock(this.selfobj);
- }
- }
- if (this.thing.moveType == 1) {
- Laya.timer.frameLoop(3, this, this.Cheack);
- return;
- }
- else if (this.thing.moveType == 2) {
- this.rotate.x = 0;
- this.rotate.y = -this.thing.moveSpeed;
- this.rotate.z = 0;
- Laya.timer.frameLoop(2, this, this.Move2);
- }
- else if (this.thing.moveType == 3) {
- this.rotate.x = 0;
- this.rotate.y = this.thing.moveSpeed;
- this.rotate.z = 0;
- Laya.timer.frameLoop(2, this, this.Move2);
- }
- else if (this.thing.moveType == 4) {
- this.rotate.x = 0;
- this.rotate.y = 0;
- this.rotate.z = this.thing.moveSpeed;
- Laya.timer.frameLoop(1, this, this.Move3);
- }
- else if (this.thing.moveType == 5) {
- this.rotate.x = 0;
- this.rotate.y = 0;
- this.rotate.z = -this.thing.moveSpeed;
- Laya.timer.frameLoop(1, this, this.Move3);
- }
- else if (this.thing.moveType == 6) {
- this.speed.x = -this.thing.moveSpeed;
- this.speed.y = 0;
- this.speed.z = 0;
- Laya.timer.frameLoop(1, this, this.Move4);
- }
- else if (this.thing.moveType == 7) {
- this.speed.x = this.thing.moveSpeed;
- this.speed.y = 0;
- this.speed.z = 0;
- Laya.timer.frameLoop(1, this, this.Move4);
- }
- else if (this.thing.moveType == 8) ;
- else if (this.thing.moveType == 9) ;
- }
- Move2() {
- this.ttttt.rotate(this.rotate);
- this.Cheack();
- }
- Move3() {
- this.ttttt.rotate(this.rotate);
- if (Math.abs(this.ttttt.localRotationEulerZ) >= 50)
- this.rotate.z = -this.rotate.z;
- this.Cheack();
- }
- Move4() {
- this.ttttt.translate(this.speed);
- if (Math.abs(this.ttttt.localPositionX) >= GlobalVariable.blockLRmoveMaxDis)
- this.speed.x = -this.speed.x;
- this.Cheack();
- }
- Cheack() {
- if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 10) {
- console.log("回收block", this.selfobj.name);
- this.Des();
- return;
- }
- }
- Des() {
- if (this.thing.type) {
- StreetManager.Instance.ResetCubBlock(this.selfobj.id);
- }
- Laya.timer.clearAll(this);
- StreetManager.Instance.RemoveBlock(this.selfobj);
- GamePool.Instance.SetDisableObject(this.selfobj);
- }
- onDestroy() {
- }
- }
- var REG = Laya.ClassUtils.regClass;
- var ui;
- (function (ui) {
- class AttributeUpViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(AttributeUpViewUI.uiView);
- }
- }
- AttributeUpViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.8, "sizeGrid": "18,18,15,19" }, "compId": 3 }, { "type": "Box", "props": { "x": 52, "width": 636, "height": 538, "centerY": -41 }, "compId": 4, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/d0bg-shengji.png", "right": 0, "left": 0, "bottom": 0, "sizeGrid": "13,14,14,15" }, "compId": 31, "child": [{ "type": "Image", "props": { "y": -43, "x": 134, "skin": "gameRes1/aasudu-bg-2 (2).png" }, "compId": 32 }] }, { "type": "Button", "props": { "y": 116, "x": 342, "var": "rateBtn", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (1).png" }, "compId": 34, "child": [{ "type": "Image", "props": { "y": 19, "x": 44, "skin": "gameRes1/aasudu-bg-2 (5).png" }, "compId": 35 }, { "type": "Image", "props": { "y": 124, "x": 11, "var": "_rate", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (8).png" }, "compId": 36, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "gameRes1/aasudu-bg-2 (9).png" }, "compId": 37 }, { "type": "Image", "props": { "y": 13, "x": 57, "skin": "gameRes1/aasudu-bg-2 (6).png" }, "compId": 38, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 39 }] }] }, { "type": "Text", "props": { "y": 71, "x": 72, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 40 }, { "type": "Image", "props": { "y": 124, "x": 11, "visible": false, "var": "_rateVideo", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (8).png" }, "compId": 41, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "gameRes1/aasudu-bg-2 (9).png" }, "compId": 42 }, { "type": "Image", "props": { "y": 12, "x": 117, "skin": "gameRes1/aasudu-bg-2 (10).png" }, "compId": 43 }] }, { "type": "Image", "props": { "y": 154, "x": 137, "var": "click2", "skin": "gameRes1/shou.png", "anchorX": 0.5 }, "compId": 49 }] }, { "type": "Button", "props": { "y": 116, "x": 46, "var": "atkBtn", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (3).png" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 19, "x": 66, "skin": "gameRes1/aasudu-bg-2 (4).png" }, "compId": 10 }, { "type": "Image", "props": { "y": 124, "x": 11, "var": "_atk", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (8).png" }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "gameRes1/aasudu-bg-2 (9).png" }, "compId": 33 }, { "type": "Image", "props": { "y": 13, "x": 57, "skin": "gameRes1/aasudu-bg-2 (6).png" }, "compId": 14, "child": [{ "type": "Text", "props": { "y": 2, "x": 38, "width": 133, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }] }, { "type": "Text", "props": { "y": 71, "x": 57, "width": 136, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 42, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 12 }, { "type": "Image", "props": { "y": 124, "x": 11, "visible": false, "var": "_atkVideo", "stateNum": 1, "skin": "gameRes1/aasudu-bg-2 (8).png" }, "compId": 45, "child": [{ "type": "Image", "props": { "y": 9, "x": 3, "skin": "gameRes1/aasudu-bg-2 (9).png" }, "compId": 46 }, { "type": "Image", "props": { "y": 12, "x": 117, "skin": "gameRes1/aasudu-bg-2 (10).png" }, "compId": 47 }] }, { "type": "Image", "props": { "y": 154.5, "x": 137, "var": "click1", "skin": "gameRes1/shou.png", "anchorX": 0.5 }, "compId": 48 }] }, { "type": "Image", "props": { "y": 426, "x": 209, "var": "backBtn", "skin": "gameRes1/aasudu-bg-2 (7).png", "runtime": "Window/Com/ButtonRunTime.ts", "centerY": 180 }, "compId": 8 }] }], "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 }], "loadList": ["gameRes1/zhujiemian-1-20.png", "gameRes1/d0bg-shengji.png", "gameRes1/aasudu-bg-2 (2).png", "gameRes1/aasudu-bg-2 (1).png", "gameRes1/aasudu-bg-2 (5).png", "gameRes1/aasudu-bg-2 (8).png", "gameRes1/aasudu-bg-2 (9).png", "gameRes1/aasudu-bg-2 (6).png", "gameRes1/aasudu-bg-2 (10).png", "gameRes1/shou.png", "gameRes1/aasudu-bg-2 (3).png", "gameRes1/aasudu-bg-2 (4).png", "gameRes1/aasudu-bg-2 (7).png"], "loadList3D": [] };
- ui.AttributeUpViewUI = AttributeUpViewUI;
- REG("ui.AttributeUpViewUI", AttributeUpViewUI);
- class CompleteViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(CompleteViewUI.uiView);
- }
- }
- CompleteViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.9, "sizeGrid": "18,18,15,19" }, "compId": 22 }, { "type": "Box", "props": { "x": 178, "width": 364, "var": "winbtnBox", "height": 226, "bottom": 292 }, "compId": 47, "child": [{ "type": "Image", "props": { "x": 130, "var": "nextBtn", "skin": "gameRes1/no.png", "runtime": "Window/Com/ButtonRunTime.ts", "bottom": 0 }, "compId": 46 }, { "type": "Image", "props": { "y": 0, "x": 9, "var": "doublegetBtn", "skin": "gameRes1/sanbei-bt.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 28 }, { "type": "Image", "props": { "y": 74, "x": 33, "skin": "gameRes1/jinbi-da.png" }, "compId": 66, "child": [{ "type": "Text", "props": { "y": 3, "x": 81, "width": 218, "var": "doubleText", "valign": "middle", "text": "50", "strokeColor": "#714800", "stroke": 2, "height": 71, "fontSize": 56, "color": "#bc3e01", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 67 }] }] }, { "type": "Image", "props": { "x": 80, "var": "shibaiTop", "skin": "gameRes1/shibai.png", "centerY": -481 }, "compId": 68 }, { "type": "Image", "props": { "x": 92, "var": "winTop", "skin": "gameRes1/win-biao.png", "centerY": -481 }, "compId": 44 }, { "type": "Image", "props": { "x": 238, "width": 60, "skin": "gameRes1/jinbi-da.png", "height": 60, "centerY": 82 }, "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": { "y": 258, "x": 138, "width": 444, "height": 429, "centerY": -168 }, "compId": 71, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 444, "skin": "gameRes1/zhengchang-di.png", "height": 100, "sizeGrid": "17,31,12,28" }, "compId": 72, "child": [{ "type": "Image", "props": { "y": 31, "x": 52, "skin": "gameRes1/jianxingzhuang.png" }, "compId": 73 }, { "type": "Image", "props": { "y": 31, "x": 343, "skin": "gameRes1/jianxingzhuang.png" }, "compId": 74 }, { "type": "Image", "props": { "y": 31, "x": 177, "skin": "gameRes1/jiangli.png" }, "compId": 75 }] }, { "type": "Image", "props": { "y": 107, "x": 0, "width": 444, "skin": "gameRes1/zhengchang-di.png", "height": 100, "sizeGrid": "17,31,12,28" }, "compId": 76, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "gameRes1/baolei.png" }, "compId": 80 }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "gameRes1/jinbi-da.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": "#ffffff", "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": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 81 }] }, { "type": "Image", "props": { "y": 214, "x": 0, "width": 444, "skin": "gameRes1/zhengchang-di.png", "height": 100, "sizeGrid": "17,31,12,28" }, "compId": 84, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "gameRes1/rentu.png" }, "compId": 85 }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "gameRes1/jinbi-da.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": "#ffffff", "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": "#ffffff", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 87 }] }, { "type": "Image", "props": { "y": 321, "x": 0, "width": 444, "skin": "gameRes1/zhengchang-di.png", "height": 100, "sizeGrid": "17,31,12,28" }, "compId": 89, "child": [{ "type": "Image", "props": { "y": 18, "x": 26, "skin": "gameRes1/baohe.png" }, "compId": 90 }, { "type": "Image", "props": { "y": 25, "x": 384, "width": 50, "skin": "gameRes1/jinbi-da.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": "#ffffff", "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": "#ffffff", "bold": true, "align": "right", "runtime": "laya.display.Text" }, "compId": 92 }] }] }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "duohuituiSp" }, "compId": 94 }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "bannerHuiTuiSp" }, "compId": 95 }], "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 }], "loadList": ["gameRes1/zhujiemian-1-20.png", "gameRes1/no.png", "gameRes1/sanbei-bt.png", "gameRes1/jinbi-da.png", "gameRes1/shibai.png", "gameRes1/win-biao.png", "gameRes1/zhengchang-di.png", "gameRes1/jianxingzhuang.png", "gameRes1/jiangli.png", "gameRes1/baolei.png", "gameRes1/rentu.png", "gameRes1/baohe.png"], "loadList3D": [] };
- ui.CompleteViewUI = CompleteViewUI;
- REG("ui.CompleteViewUI", CompleteViewUI);
- class GuideViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(GuideViewUI.uiView);
- }
- }
- GuideViewUI.uiView = { "type": "Scene", "props": { "width": 720, "mouseThrough": true, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "y": 30, "x": 958, "width": 104, "var": "guide1Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 3, "x": -3, "skin": "gameRes1/zzzzzzguangquan(1).png" }, "compId": 8 }, { "type": "Image", "props": { "y": -123, "x": 2, "skin": "gameRes1/zzzzz1.png" }, "compId": 9 }] }, { "type": "Box", "props": { "y": 154, "x": 969, "width": 207, "var": "guide2Box", "scaleY": 0.8, "scaleX": 0.8, "height": 56, "anchorY": 0.5, "anchorX": 0 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 28, "x": 207, "width": 0, "skin": "gameRes1/zzzzzuoyou-jiantou(1).png", "rotation": 180, "pivotY": 48, "height": 96 }, "compId": 12 }, { "type": "Image", "props": { "y": 15, "x": 181, "skin": "gameRes1/shou.png" }, "compId": 11 }] }, { "type": "Box", "props": { "y": 298, "x": 1790, "width": 207, "var": "guide3Box", "scaleY": 0.8, "scaleX": 0.8, "height": 48, "anchorY": 0.5, "anchorX": 1 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 22, "x": 0, "width": 0, "skin": "gameRes1/zzzzzuoyou-jiantou(1).png", "pivotY": 48, "height": 96 }, "compId": 14 }, { "type": "Image", "props": { "y": 6, "x": -17, "width": 61, "skin": "gameRes1/shou.png" }, "compId": 15 }] }, { "type": "Box", "props": { "y": 278, "x": -163, "width": 104, "var": "guide4Box", "scaleY": 0.8, "scaleX": 0.8, "height": 44, "anchorY": 1, "anchorX": 0.5 }, "compId": 19, "child": [{ "type": "Image", "props": { "y": -106, "x": 4, "skin": "gameRes1/zzzzz1.png" }, "compId": 21 }] }, { "type": "Image", "props": { "x": 203, "var": "guide1Image", "skin": "gameRes1/zzzzbiaoyu(2).png", "bottom": 213 }, "compId": 16 }, { "type": "Image", "props": { "x": 164, "var": "guide2Image", "skin": "gameRes1/zzzzbiaoyu(1).png", "bottom": 218 }, "compId": 17 }, { "type": "Image", "props": { "x": 136, "var": "guide3Image", "skin": "gameRes1/zzzzbiaoyu.png", "bottom": 220 }, "compId": 18 }], "animations": [{ "nodes": [{ "target": 9, "keyframes": { "y": [{ "value": -116, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 0 }, { "value": -197, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 5 }, { "value": -115, "tweenMethod": "linearNone", "tween": true, "target": 9, "key": "y", "index": 10 }] } }], "name": "guide1", "id": 1, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 11, "keyframes": { "x": [{ "value": 181, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 0 }, { "value": 21, "tweenMethod": "linearNone", "tween": true, "target": 11, "key": "x", "index": 10 }] } }, { "target": 12, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 0 }, { "value": 188, "tweenMethod": "linearNone", "tween": true, "target": 12, "key": "width", "index": 10 }] } }], "name": "guide2", "id": 2, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 15, "keyframes": { "x": [{ "value": -17, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 0 }, { "value": 122, "tweenMethod": "linearNone", "tween": true, "target": 15, "key": "x", "index": 10 }] } }, { "target": 14, "keyframes": { "width": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 0 }, { "value": 149, "tweenMethod": "linearNone", "tween": true, "target": 14, "key": "width", "index": 10 }] } }], "name": "guide3", "id": 3, "frameRate": 24, "action": 0 }, { "nodes": [{ "target": 21, "keyframes": { "y": [{ "value": -212, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 0 }, { "value": -106, "tweenMethod": "linearNone", "tween": true, "target": 21, "key": "y", "index": 10 }] } }], "name": "guide4", "id": 4, "frameRate": 24, "action": 0 }], "loadList": ["gameRes1/zzzzzzguangquan(1).png", "gameRes1/zzzzz1.png", "gameRes1/zzzzzuoyou-jiantou(1).png", "gameRes1/shou.png", "gameRes1/zzzzbiaoyu(2).png", "gameRes1/zzzzbiaoyu(1).png", "gameRes1/zzzzbiaoyu.png"], "loadList3D": [] };
- ui.GuideViewUI = GuideViewUI;
- REG("ui.GuideViewUI", GuideViewUI);
- class InGameViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(InGameViewUI.uiView);
- }
- }
- InGameViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] };
- ui.InGameViewUI = InGameViewUI;
- REG("ui.InGameViewUI", InGameViewUI);
- class IntensifyViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(IntensifyViewUI.uiView);
- }
- }
- IntensifyViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/111111.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0.8, "sizeGrid": "22,12,11,12" }, "compId": 3 }, { "type": "Box", "props": { "x": 52, "width": 636, "height": 626, "centerY": -18 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "width": 636, "var": "atkBox", "skin": "gameRes1/11.png", "height": 185, "sizeGrid": "21,22,21,22" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 43, "x": 183, "skin": "gameRes1/gongji-2.png" }, "compId": 10 }, { "type": "Image", "props": { "y": 43, "x": 34, "skin": "gameRes1/gongji-icon.png" }, "compId": 9 }, { "type": "Image", "props": { "y": 125, "x": 179, "skin": "gameRes1/gongji-1.png" }, "compId": 11 }, { "type": "Button", "props": { "y": 89, "x": 412, "var": "atkBtn", "stateNum": 1, "skin": "gameRes1/lv-di.png" }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 13, "x": 12, "width": 45, "skin": "gameRes1/jinbi.png", "height": 45 }, "compId": 14, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "atkValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }] }, { "type": "Text", "props": { "y": 31, "x": 449, "width": 106, "var": "atkLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 12 }] }, { "type": "Image", "props": { "y": 226, "x": 0, "width": 636, "var": "rateBox", "skin": "gameRes1/11.png", "height": 185, "sizeGrid": "21,22,21,22" }, "compId": 6, "child": [{ "type": "Image", "props": { "y": 43, "x": 161, "skin": "gameRes1/sudu-2.png" }, "compId": 17 }, { "type": "Image", "props": { "y": 43, "x": 34, "skin": "gameRes1/iconqiang.png" }, "compId": 18 }, { "type": "Image", "props": { "y": 125, "x": 164, "skin": "gameRes1/sudu-1(1).png" }, "compId": 19 }, { "type": "Button", "props": { "y": 89, "x": 412, "var": "rateBtn", "stateNum": 1, "skin": "gameRes1/lv-di.png" }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 13, "x": 12, "width": 45, "skin": "gameRes1/jinbi.png", "height": 45 }, "compId": 22, "child": [{ "type": "Text", "props": { "y": 2, "x": 47, "width": 134, "var": "rateValue", "valign": "middle", "text": "800", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 23 }] }] }, { "type": "Text", "props": { "y": 31, "x": 449, "width": 106, "var": "rateLv", "valign": "middle", "text": "LV8", "height": 41, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 21 }] }, { "type": "Image", "props": { "y": 444, "x": 0, "width": 636, "visible": true, "var": "coinBox", "skin": "gameRes1/11.png", "height": 185, "sizeGrid": "21,22,21,22" }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 43, "x": 161, "skin": "gameRes1/huode.png" }, "compId": 24 }, { "type": "Image", "props": { "y": 43, "x": 34, "skin": "gameRes1/jinbi (2).png" }, "compId": 25 }, { "type": "Image", "props": { "y": 125, "x": 156, "skin": "gameRes1/tishengjinbi3.png" }, "compId": 26 }, { "type": "Button", "props": { "y": 57, "x": 412, "var": "coinBtn", "stateNum": 1, "skin": "gameRes1/lv-di.png" }, "compId": 27, "child": [{ "type": "Image", "props": { "y": 13, "x": 12, "width": 45, "skin": "gameRes1/shipin-icon.png", "height": 45 }, "compId": 29, "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": 30 }] }] }] }] }, { "type": "Image", "props": { "x": 17, "var": "backBtn", "skin": "gameRes1/p__fanhui.png", "runtime": "Window/Com/ButtonRunTime.ts", "centerY": -436 }, "compId": 8 }, { "type": "Image", "props": { "x": 290, "skin": "gameRes1/shengji.png", "centerY": -478 }, "compId": 31 }], "loadList": ["gameRes1/111111.png", "gameRes1/11.png", "gameRes1/gongji-2.png", "gameRes1/gongji-icon.png", "gameRes1/gongji-1.png", "gameRes1/lv-di.png", "gameRes1/jinbi.png", "gameRes1/sudu-2.png", "gameRes1/iconqiang.png", "gameRes1/sudu-1(1).png", "gameRes1/huode.png", "gameRes1/jinbi (2).png", "gameRes1/tishengjinbi3.png", "gameRes1/shipin-icon.png", "gameRes1/p__fanhui.png", "gameRes1/shengji.png"], "loadList3D": [] };
- ui.IntensifyViewUI = IntensifyViewUI;
- REG("ui.IntensifyViewUI", IntensifyViewUI);
- class LoadViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(LoadViewUI.uiView);
- }
- }
- LoadViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "bg", "top": 0, "skin": "load/bg.jpg", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 6 }, { "type": "Image", "props": { "x": 360, "var": "prepan", "centerY": -68 }, "compId": 14 }, { "type": "Image", "props": { "y": 124, "x": 52, "skin": "load/logo.png", "centerY": -360 }, "compId": 17 }, { "type": "Image", "props": { "y": 932, "x": 137, "var": "pro", "skin": "load/jindu-1.png", "centerY": 309 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 4, "x": 4, "width": 438, "var": "pro1", "skin": "load/jindu-2.png" }, "compId": 21 }, { "type": "Image", "props": { "y": 52, "x": 174, "skin": "load/jiazai-1-2.png" }, "compId": 8, "child": [{ "type": "Image", "props": { "x": 105, "width": 6, "skin": "load/jiazai-1-3.png", "height": 6, "bottom": 9 }, "compId": 9 }, { "type": "Image", "props": { "x": 120, "skin": "load/jiazai-1-3.png", "bottom": 10 }, "compId": 10 }, { "type": "Image", "props": { "x": 136, "skin": "load/jiazai-1-3.png", "bottom": 10 }, "compId": 11 }] }, { "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 }] }], "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.jpg", "load/logo.png", "load/jindu-1.png", "load/jindu-2.png", "load/jiazai-1-2.png", "load/jiazai-1-3.png"], "loadList3D": [] };
- ui.LoadViewUI = LoadViewUI;
- REG("ui.LoadViewUI", LoadViewUI);
- class MainViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(MainViewUI.uiView);
- }
- }
- MainViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "x": 0, "top": 82, "right": 0, "left": 0, "height": 70 }, "compId": 265, "child": [{ "type": "Image", "props": { "y": 21, "x": 282, "width": 157, "var": "pro", "skin": "gameRes1/jindu-duan.png" }, "compId": 302, "child": [{ "type": "Image", "props": { "y": 4, "x": 0, "var": "pro1", "skin": "gameRes1/jindu-guan-do.png" }, "compId": 305 }, { "type": "Image", "props": { "y": -11, "x": -49, "skin": "gameRes1/guanshu.png" }, "compId": 303, "child": [{ "type": "Text", "props": { "y": -1, "x": -3, "width": 54, "var": "stageValue", "valign": "middle", "text": "10", "height": 51, "fontSize": 32, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 264 }] }, { "type": "Image", "props": { "y": -11, "x": 155, "skin": "gameRes1/shadi.png" }, "compId": 304 }] }, { "type": "Image", "props": { "x": 533, "width": 187, "top": 85, "skin": "gameRes1/jinbi-bg.png", "right": 0 }, "compId": 261, "child": [{ "type": "Image", "props": { "y": 11, "x": 5, "skin": "gameRes1/jinbi.png" }, "compId": 262 }, { "type": "Text", "props": { "y": 6, "x": 41, "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": "Button", "props": { "var": "coutiBtn", "stateNum": 1, "skin": "gameRes1/Begin-gengduoyouxi.png", "left": 0, "centerY": 0 }, "compId": 294 }, { "type": "Image", "props": { "x": 24, "var": "settingBtn", "top": 101, "skin": "gameRes1/setBtn.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 260 }, { "type": "Box", "props": { "x": 29, "width": 63, "visible": false, "var": "settingBox", "top": 179, "height": 134 }, "compId": 291, "child": [{ "type": "Button", "props": { "x": 2, "width": 59, "var": "shake_btn", "stateNum": 1, "height": 59 }, "compId": 285, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "gameRes1/ButtonVibrationOn.png", "name": "kai" }, "compId": 287 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "gameRes1/ButtonVibrationOff.png", "name": "guan" }, "compId": 288 }] }, { "type": "Button", "props": { "y": 74, "width": 62, "var": "sound_btn", "stateNum": 1, "height": 60 }, "compId": 286, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "gameRes1/Icon_SoundOn.png", "name": "kai" }, "compId": 289 }, { "type": "Image", "props": { "y": 0, "x": 0, "visible": false, "skin": "gameRes1/Icon_SoundOff.png", "name": "guan" }, "compId": 290 }] }] }, { "type": "Box", "props": { "var": "startBox", "right": 0, "left": 0, "height": 5, "bottom": 208 }, "compId": 259, "child": [{ "type": "Image", "props": { "var": "updateBtn", "skin": "gameRes1/updateBtn.png", "runtime": "Window/Com/ButtonRunTime.ts", "left": 0, "bottom": 0 }, "compId": 257 }, { "type": "Image", "props": { "var": "skinBtn", "skin": "gameRes1/skinBtn.png", "runtime": "Window/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": { "var": "moreGameBtn", "stateNum": 1, "skin": "youziTexture/btn-entrance-nogift.png", "left": 587, "centerY": 133 }, "compId": 311 }] }, { "type": "Image", "props": { "x": 195, "var": "sliderBox", "skin": "gameRes1/huadong-tiao.png", "gray": false, "bottom": 304 }, "compId": 253, "child": [{ "type": "Image", "props": { "y": -45, "x": 95, "skin": "gameRes1/huadong.png" }, "compId": 292 }, { "type": "Image", "props": { "y": 0, "x": 164, "skin": "gameRes1/shou.png", "anchorX": 0.5 }, "compId": 293 }] }, { "type": "Sprite", "props": { "var": "duohuituiSp" }, "compId": 312 }, { "type": "Sprite", "props": { "y": 0, "x": 0, "var": "bannerHuiTuiSp" }, "compId": 313 }], "animations": [{ "nodes": [{ "target": 293, "keyframes": { "x": [{ "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 0 }, { "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 15 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 30 }, { "value": 326, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 45 }, { "value": 164, "tweenMethod": "linearNone", "tween": true, "target": 293, "key": "x", "index": 60 }] } }, { "target": 292, "keyframes": { "x": [{ "value": 0, "tweenMethod": "linearNone", "tween": true, "target": 292, "key": "x", "index": 0 }], "skin": [{ "value": "gameRes1/pause1.png", "tweenMethod": "linearNone", "tween": false, "target": 292, "key": "skin", "index": 0 }] } }], "name": "gameStart", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["gameRes1/jindu-duan.png", "gameRes1/jindu-guan-do.png", "gameRes1/guanshu.png", "gameRes1/shadi.png", "gameRes1/jinbi-bg.png", "gameRes1/jinbi.png", "gameRes1/Begin-gengduoyouxi.png", "gameRes1/setBtn.png", "gameRes1/ButtonVibrationOn.png", "gameRes1/ButtonVibrationOff.png", "gameRes1/Icon_SoundOn.png", "gameRes1/Icon_SoundOff.png", "gameRes1/updateBtn.png", "gameRes1/skinBtn.png", "youziTexture/btn-entrance-nogift.png", "gameRes1/huadong-tiao.png", "gameRes1/huadong.png", "gameRes1/shou.png", "gameRes1/pause1.png"], "loadList3D": [] };
- ui.MainViewUI = MainViewUI;
- REG("ui.MainViewUI", MainViewUI);
- class ShadeViewUI extends Laya.View {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(ShadeViewUI.uiView);
- }
- }
- ShadeViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "loadList": [], "loadList3D": [] };
- ui.ShadeViewUI = ShadeViewUI;
- REG("ui.ShadeViewUI", ShadeViewUI);
- class SkinShopViewUI extends Laya.View {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(SkinShopViewUI.uiView);
- }
- }
- SkinShopViewUI.uiView = { "type": "View", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/sssdi-3.png", "right": 0, "left": 0, "bottom": 0 }, "compId": 3 }, { "type": "Image", "props": { "x": 17, "var": "backBtn", "skin": "gameRes1/pppguanbi-bt.png", "runtime": "Window/Com/ButtonRunTime.ts", "centerY": -529 }, "compId": 87 }, { "type": "Image", "props": { "skin": "gameRes1/ppppifu-biaoti.png", "centerY": -399 }, "compId": 92 }, { "type": "Box", "props": { "x": 50, "width": 626, "height": 102, "centerY": -70 }, "compId": 100, "child": [{ "type": "Button", "props": { "width": 102, "var": "leftBtn", "stateNum": 1, "height": 102 }, "compId": 93, "child": [{ "type": "Image", "props": { "y": 3, "x": 3, "skin": "gameRes1/pppwu-zuo.png", "name": "leftFalse" }, "compId": 95 }, { "type": "Image", "props": { "y": 3, "x": 3, "skin": "gameRes1/pppyou-zuo.png", "name": "leftTrue" }, "compId": 96 }] }, { "type": "Button", "props": { "x": 521, "width": 102, "var": "rightBtn", "stateNum": 1, "height": 102 }, "compId": 97, "child": [{ "type": "Image", "props": { "y": 3, "x": 3, "skin": "gameRes1/pppwu-you.png", "name": "rightFalse" }, "compId": 98 }, { "type": "Image", "props": { "y": 3, "x": 3, "skin": "gameRes1/pppyou-you.png", "name": "rightTrue" }, "compId": 99 }] }] }, { "type": "Image", "props": { "y": 813, "x": 167, "skin": "gameRes1/sssren-di-2.png", "centerY": 227 }, "compId": 101 }, { "type": "Image", "props": { "y": 469, "x": 209, "width": 302, "var": "viewPort", "height": 398, "centerY": 28 }, "compId": 102 }, { "type": "Box", "props": { "x": 196, "width": 331, "var": "btnBox", "height": 127, "centerY": 396 }, "compId": 113, "child": [{ "type": "Image", "props": { "var": "using", "skin": "gameRes1/pppbt-bg.png" }, "compId": 103, "child": [{ "type": "Text", "props": { "y": 31, "x": 63, "width": 202, "valign": "middle", "text": "使用中", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 104 }] }, { "type": "Image", "props": { "var": "use", "skin": "gameRes1/pppbt-bg.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 105, "child": [{ "type": "Text", "props": { "y": 31, "x": 63, "width": 202, "valign": "middle", "text": "使用", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 106 }] }, { "type": "Image", "props": { "var": "coin", "skin": "gameRes1/pppbt-bg.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 107, "child": [{ "type": "Image", "props": { "y": 22, "x": 25, "skin": "gameRes1/jinbi-da.png" }, "compId": 109, "child": [{ "type": "Text", "props": { "y": 8, "x": 63, "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": { "var": "video", "skin": "gameRes1/pppbt-bg.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 110, "child": [{ "type": "Image", "props": { "y": 33, "x": 54, "width": 65, "skin": "gameRes1/aasudu-bg-2 (10).png", "height": 61 }, "compId": 111, "child": [{ "type": "Text", "props": { "y": -2, "x": 63, "width": 202, "valign": "middle", "text": "1/3", "height": 65, "fontSize": 48, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 112 }] }] }] }], "loadList": ["gameRes1/sssdi-3.png", "gameRes1/pppguanbi-bt.png", "gameRes1/ppppifu-biaoti.png", "gameRes1/pppwu-zuo.png", "gameRes1/pppyou-zuo.png", "gameRes1/pppwu-you.png", "gameRes1/pppyou-you.png", "gameRes1/sssren-di-2.png", "gameRes1/pppbt-bg.png", "gameRes1/jinbi-da.png", "gameRes1/aasudu-bg-2 (10).png"], "loadList3D": [] };
- ui.SkinShopViewUI = SkinShopViewUI;
- REG("ui.SkinShopViewUI", SkinShopViewUI);
- class TopTipUiUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(TopTipUiUI.uiView);
- }
- }
- TopTipUiUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "var": "bg", "top": 0, "skin": "gameRes1/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "alpha": 0, "sizeGrid": "18,18,15,19" }, "compId": 3 }, { "type": "Image", "props": { "y": 647, "x": 159, "width": 402, "var": "sliderBox", "skin": "gameRes1/huadong-tiao.png", "height": 33, "gray": false, "centerY": 23 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 124, "x": 37, "skin": "gameRes1/pause1.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 0, "x": 201, "skin": "gameRes1/shou.png", "anchorX": 0.5 }, "compId": 6 }] }], "animations": [{ "nodes": [{ "target": 6, "keyframes": { "x": [{ "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 0 }, { "value": 13, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 15 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 30 }, { "value": 402, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 45 }, { "value": 201, "tweenMethod": "linearNone", "tween": true, "target": 6, "key": "x", "index": 60 }] } }], "name": "ani1", "id": 1, "frameRate": 24, "action": 2 }], "loadList": ["gameRes1/zhujiemian-1-20.png", "gameRes1/huadong-tiao.png", "gameRes1/pause1.png", "gameRes1/shou.png"], "loadList3D": [] };
- ui.TopTipUiUI = TopTipUiUI;
- REG("ui.TopTipUiUI", TopTipUiUI);
- class TrialViewUI extends Laya.Scene {
- constructor() { super(); }
- createChildren() {
- super.createChildren();
- this.createView(TrialViewUI.uiView);
- }
- }
- TrialViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "gameRes1/zhujiemian-1-20.png", "right": 0, "left": 0, "bottom": 0, "sizeGrid": "18,18,15,19" }, "compId": 3 }, { "type": "Image", "props": { "x": 125, "skin": "gameRes1/sssbiaoti.png", "centerY": -503 }, "compId": 4 }, { "type": "Image", "props": { "x": 104, "visible": false, "skin": "gameRes1/sssdi-3.png", "centerY": -100 }, "compId": 5 }, { "type": "Image", "props": { "x": 167, "skin": "gameRes1/sssren-di-2.png", "centerY": 85 }, "compId": 6 }, { "type": "Image", "props": { "x": 209, "width": 302, "var": "viewPort", "height": 398, "centerY": -108 }, "compId": 8 }, { "type": "Image", "props": { "x": 245, "skin": "gameRes1/x3.png", "centerY": -374 }, "compId": 12 }, { "type": "Box", "props": { "x": 196, "width": 325, "var": "btnBox", "height": 191, "bottom": 289 }, "compId": 11, "child": [{ "type": "Image", "props": { "y": 145, "x": 92, "var": "backBtn", "skin": "gameRes1/sssno-bt.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 9 }, { "type": "Image", "props": { "var": "videoBtn", "skin": "gameRes1/sssbt.png", "runtime": "Window/Com/ButtonRunTime.ts" }, "compId": 10 }] }], "loadList": ["gameRes1/zhujiemian-1-20.png", "gameRes1/sssbiaoti.png", "gameRes1/sssdi-3.png", "gameRes1/sssren-di-2.png", "gameRes1/x3.png", "gameRes1/sssno-bt.png", "gameRes1/sssbt.png"], "loadList3D": [] };
- ui.TrialViewUI = TrialViewUI;
- REG("ui.TrialViewUI", TrialViewUI);
- })(ui || (ui = {}));
- class GuideView extends ui.GuideViewUI {
- constructor() {
- super();
- this.isguide2or3 = false;
- this.guide1pos = Mathf.VecZero;
- this.guide1Com = false;
- GuideView.instance = this;
- this.resizeHander();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
- }
- static get Instance() {
- return GuideView.instance;
- }
- OnShow(data) {
- this.InitHandler();
- this.InitDate();
- this.InitHandler();
- this.InitUi();
- }
- InitUi() {
- }
- InitDate() {
- }
- InitHandler() {
- }
- SetGuide(type) {
- if (!this.playerTran)
- this.playerTran = MainRoleManager.Instance.playerTra;
- if (!this._camera)
- this._camera = CameraManager.Instance._camer;
- if (type == 1) {
- this.guide1Image.visible = true;
- this.guide2Image.visible = false;
- this.guide3Image.visible = false;
- this.guide1Box.visible = true;
- this.guide1.play(0, true);
- this.guide4Box.visible = false;
- if (this.playerTran.localPositionX <= GuideController.Instance.guide1pos.x) {
- this.guide2Box.visible = true;
- this.guide3Box.visible = false;
- this.isguide2or3 = true;
- this.guide2.play(0, true);
- }
- else {
- this.guide2Box.visible = false;
- this.guide3Box.visible = true;
- this.isguide2or3 = false;
- this.guide3.play(0, true);
- }
- this.guide1pos = GuideController.Instance.guide1pos.clone();
- Laya.timer.frameLoop(1, this, this._guide1);
- this.guide1Com = false;
- }
- }
- _guide1() {
- if (!this.guide1Com) {
- let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guide1pos.clone());
- this.guide1Box.pos(p.x, p.y);
- this.guide1pos.z = this.playerTran.localPositionZ + 10;
- let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos);
- if (this.isguide2or3) {
- this.guide2Box.pos(p1.x, p1.y);
- }
- else {
- this.guide3Box.pos(p1.x, p1.y);
- }
- if (this.playerTran.localPositionZ >= GuideController.Instance.guide1pos.z - 5) {
- this.guide2.stop();
- this.guide3.stop();
- this.guide2Box.visible = false;
- this.guide3Box.visible = false;
- this.guide1Box.visible = false;
- this.guide1Com = true;
- this.guide1Image.visible = false;
- }
- }
- else {
- if (this.playerTran.localPositionZ >= GuideController.Instance.guide1pos.z) {
- console.log(111);
- Laya.timer.clear(this, this._guide1);
- this.Guide2();
- }
- }
- }
- Guide2() {
- this.guide3Box.visible = true;
- this.guide4Box.visible = true;
- this.guide2Image.visible = true;
- this.guide3.play(0, true);
- this.guide4.play(0, true);
- Laya.timer.frameLoop(1, this, this._guide2);
- this.guide1pos.x = -4.5;
- this.guide1pos.y = 0;
- }
- _guide2() {
- let p = MatrixTransform.WorldToScreen2(this._camera, GuideController.Instance.guide2Pos.clone());
- this.guide4Box.pos(p.x, p.y);
- this.guide1pos.z = this.playerTran.localPositionZ + 5;
- let p1 = MatrixTransform.WorldToScreen2(this._camera, this.guide1pos);
- this.guide3Box.pos(p1.x, p1.y);
- if (this.playerTran.localPositionZ >= GuideController.Instance.guide2Pos.z - 10) {
- this.guide3Box.visible = false;
- this.guide4Box.visible = false;
- this.guide2Image.visible = false;
- this.guide3Image.visible = true;
- this.guide3.stop();
- this.guide4.stop();
- Laya.timer.clear(this, this._guide2);
- Laya.timer.once(5000, this, () => {
- GuideController.Instance.OverGuide();
- });
- }
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
- GuideView.instance = null;
- Laya.timer.clearAll(this);
- }
- resizeHander() {
- this.height = Laya.stage.height;
- }
- }
- class GuideController {
- constructor() {
- this.isguide = false;
- this.guide1pos = new Laya.Vector3(2.5, 0, 59.4);
- this.guide2Pos = new Laya.Vector3(-5, 2, 104.4);
- this.index = 0;
- }
- static get Instance() {
- return this.instance || (this.instance = new GuideController());
- }
- IsGuide() {
- let t = Laya.LocalStorage.getItem("guide");
- if (PlayerManager.Instance.stage == 1) {
- Laya.LocalStorage.setItem("guide", "1");
- this.isguide = true;
- return true;
- }
- this.isguide = false;
- return false;
- }
- SetGuidePos(p) {
- if (this.index == 0) {
- this.guide1pos.z = p;
- this.index++;
- }
- else if (this.index == 1) {
- this.guide2Pos.z = p;
- this.index++;
- }
- }
- StartGuide() {
- if (this.isguide) {
- Laya.timer.once(500, this, this.Guide1);
- }
- }
- OverGuide() {
- this.isguide = false;
- ViewManager.Instance.CloseGuideView();
- }
- Guide1() {
- ViewManager.Instance.ShowGuideView();
- if (GuideView.Instance) {
- GuideView.Instance.SetGuide(1);
- }
- }
- GameDied() {
- if (this.isguide) {
- ViewManager.Instance.CloseGuideView();
- }
- }
- }
- class RoadArr {
- constructor(blocks, blockPos) {
- this.blocks = blocks;
- this.blockPos = blockPos;
- }
- }
- class BlockArr {
- constructor(things, thingPos, blockHp) {
- this.things = things;
- this.thingPos = thingPos;
- this.blockHp = blockHp;
- }
- }
- class ThingArr {
- constructor(type, prrfabName, moveType, moveSpeed) {
- this.type = type;
- this.prrfabName = prrfabName;
- this.moveType = moveType;
- this.moveSpeed = moveSpeed;
- }
- }
- class StreetManager {
- constructor() {
- this.isover = false;
- this.curindex = 1;
- this.blockDic = new Dictionary();
- this.cubeBlockDic = new Dictionary();
- }
- static get Instance() {
- return StreetManager.instance || (StreetManager.instance = new StreetManager());
- }
- Init(BlockContainer) {
- this.BlockContainer = BlockContainer;
- }
- SetBlock() {
- this.isover = false;
- this.curindex = 1;
- this.CreateBlock();
- }
- CreateBlock() {
- let road_list = LevelController.Instance._level.road_list;
- if (this.curindex > road_list.length - 1) {
- this.isover = true;
- console.log("没有障碍物了");
- return;
- }
- this.tarDis =
- this.curindex * GlobalVariable.barrierRoadLength;
- let roadindex = road_list[this.curindex];
- if (roadindex == 0)
- return;
- let roads = CfgManager.Instance.GetRoad(roadindex);
- if (!roads)
- return;
- let blocks = GameTool.SpliteString(roads["blocks"]);
- let blockPoss = GameTool.SpliteString(roads["position"]);
- let bps = [];
- let d = GlobalVariable.barrierRoadLength / GlobalVariable.barrierRoadAverageNum;
- blockPoss.forEach(element => {
- bps.push(this.tarDis + element * d);
- });
- let bbs = [];
- blocks.forEach(element => {
- let thing = CfgManager.Instance.GetBlock(element);
- let tss = GameTool.SpliteString(thing["block_things"]);
- let tps = GameTool.SpliteString(thing["thing_position"]);
- let ths = GameTool.SpliteString(thing["block_hp"]);
- let ttt = [];
- tss.forEach(element1 => {
- let t = CfgManager.Instance.GetThing(element1);
- let tt = new ThingArr(t["type"], t["prefabs"], t["dynamic_type"], t["dynamic_speed"]);
- ttt.push(tt);
- });
- let things = new BlockArr(ttt, tps, ths);
- bbs.push(things);
- });
- let blockB = new RoadArr(bbs, bps);
- this.CreateSp(blockB);
- }
- CheckPlayerRoadPos(_zp) {
- if (this.isover)
- return;
- let d = this.tarDis - _zp;
- if (d > 0)
- return;
- this.SwitchBlock();
- }
- SwitchBlock() {
- this.curindex++;
- console.log("到达一个障碍物");
- this.CreateBlock();
- }
- CreateSp(road) {
- if (GuideController.Instance.isguide) {
- GuideController.Instance.SetGuidePos(road.blockPos[0]);
- }
- let blocks = road.blocks;
- let blockPos = road.blockPos;
- let j = 0;
- for (let index = 0; index < blocks.length; index++) {
- const element = blocks[index];
- const p = blockPos[index];
- let things = element.things;
- let thingPos = element.thingPos;
- let blockHp = element.blockHp;
- let isr = blockHp.length > 1;
- for (let index = 0; index < things.length; index++) {
- const element1 = things[index];
- element1.z = p;
- element1.x = thingPos[index];
- element1.towerR = isr;
- element1.hp = blockHp[index];
- j++;
- Laya.timer.frameOnce(j, this, this._crete, [element1], false);
- }
- }
- }
- _crete(thing) {
- if (thing.type == 1 || thing.type == 2) {
- MoundManager.Instance.CreateTower(thing);
- }
- else {
- let p = GamePool.Instance.SetActiveObject(thing.prrfabName);
- if (!p)
- return;
- this.BlockContainer.addChild(p);
- let ts = p.getComponent(Street);
- if (!ts)
- ts = p.addComponent(Street);
- ts.SetBlock(thing);
- this.blockDic.set(p.id, ts);
- }
- }
- RemoveBlock(sp) {
- this.blockDic.delete(sp.id);
- }
- AddCubeBlock(sp) {
- if (this.cubeBlockDic.has(sp.id))
- return;
- this.cubeBlockDic.set(sp.id, sp);
- }
- ResetCubBlock(id) {
- let sp = this.cubeBlockDic.get(id);
- this.cubeBlockDic.delete(id);
- if (!sp)
- return;
- console.log("回收CubeBlock,", sp.name);
- for (let index = 0; index < sp.numChildren; index++) {
- const element = sp.getChildAt(index);
- element.active = true;
- }
- }
- CubeBlockAtked(sp) {
- sp.active = false;
- ParticleManager.Instance.CreateBoomEffect(sp.transform.position);
- }
- Reset() {
- this.isover = false;
- let arr = [];
- for (const key in this.blockDic.container) {
- arr.push(key);
- }
- let j = 1;
- if (arr.length > 0) {
- for (let index = 0; index < arr.length; index++) {
- const element = arr[index];
- let s = this.blockDic.get(element);
- if (s)
- s.Des();
- if (this.cubeBlockDic.has(element)) {
- Laya.timer.frameOnce(j, this, this.ResetCubBlock, [element], false);
- j++;
- }
- }
- }
- console.log("this.blockDic.size", this.blockDic.size);
- }
- }
- var Vector3$1 = Laya.Vector3;
- var Quaternion = Laya.Quaternion;
- class Opponent extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this._up = new Vector3$1(0, 1, 0);
- this.isArrive1 = false;
- }
- onAwake() {
- this.selfobj = this.owner;
- this.tran = this.selfobj.transform;
- this.mat = (this.selfobj.getChildAt(0).getChildByName("enemy").skinnedMeshRenderer.material);
- this.forW = Mathf.VecZero;
- this.speed = GlobalVariable.enemySpeed;
- this.quaternion1 = new Quaternion();
- }
- SetTar(tar, hp, cloth) {
- this.tarSp = tar;
- this.isArrive1 = false;
- if (this.tarSp == null)
- return;
- this.tarPos = this.tarSp.transform.position.clone();
- if (this.tarPos.x > 0) {
- this.tarPos = PlaneManager.Instance.toured1.clone();
- }
- else {
- this.tarPos = PlaneManager.Instance.toured2.clone();
- }
- this.hp = hp;
- this.mat.albedoTexture = AssetController.Instance.cloth[cloth - 1];
- this.mat.emissionTexture = AssetController.Instance.cloth[cloth - 1];
- Laya.timer.frameLoop(1, this, this.Move);
- }
- Move() {
- if (this.isArrive1) {
- if (this.tarSp == null)
- return;
- if (!this.tarSp.active) {
- this.tarSp = RoleManager.Instance.GetTar();
- if (this.tarSp == null)
- return;
- this.tarPos = this.tarSp.transform.position.clone();
- }
- Vector3$1.subtract(this.tarPos, this.tran.position, this.forW);
- Vector3$1.normalize(this.forW, this.forW);
- this.forW = new Vector3$1(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
- this.tran.translate(this.forW, false);
- if (Vector3$1.distance(this.tran.position, this.tarPos) < 0.1) {
- return;
- }
- Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- else {
- Vector3$1.subtract(this.tarPos, this.tran.position, this.forW);
- Vector3$1.normalize(this.forW, this.forW);
- this.forW = new Vector3$1(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
- this.tran.translate(this.forW, false);
- if (Vector3$1.distance(this.tran.position, this.tarPos) < 0.1) {
- this.tarSp = RoleManager.Instance.GetTar();
- this.isArrive1 = true;
- if (this.tarSp == null)
- return;
- this.tarPos = this.tarSp.transform.position.clone();
- return;
- }
- Quaternion.lookAt(this.tarPos, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- }
- Atked(hitpos) {
- this.hp -= PlayerManager.bulletAttack;
- if (this.hp <= 0) {
- this.Died();
- return;
- }
- ParticleManager.Instance.CreateHitEffect(hitpos);
- }
- Died() {
- ParticleManager.Instance.CreateXueEffect(this.tran.position);
- this.Des();
- RoleManager.Instance.CheackGame();
- GameManager.Instance.roleCount++;
- }
- Des() {
- Laya.timer.clearAll(this);
- RoleManager.Instance.RemoveEnemy(this.selfobj);
- GamePool.Instance.SetDisableObject(this.selfobj);
- }
- onDestroy() {
- }
- }
- class RoleManager {
- constructor() {
- this.frameCount = 10;
- this.enemyDic = new Dictionary();
- }
- static get Instance() {
- return this.instance || (this.instance = new RoleManager());
- }
- CreateEnemy(startPos) {
- this.startPos = startPos;
- let count = LevelController.Instance._level.enemy;
- let hp = LevelController.Instance._level.enemy_hp;
- let texture = LevelController.Instance._level.enemy_cloth;
- for (let index = 0; index < count; index++) {
- let a = index;
- Laya.timer.frameOnce(a * this.frameCount, this, this._crete, [hp, texture], false);
- }
- }
- _crete(hp, texture) {
- let e = GamePool.Instance.SetActiveObject(GamePool.pooltype.enemy);
- if (!e)
- return;
- MainRoleManager.Instance.playerContainer.addChild(e);
- e.transform.position = this.startPos.clone();
- let ps = e.getComponent(Opponent);
- if (!ps)
- ps = e.addComponent(Opponent);
- let sp = this.GetTar();
- ps.SetTar(sp, hp, texture);
- this.enemyDic.set(e.id, ps);
- }
- GetTar() {
- let p = MainRoleManager.Instance.ArriveIsdead();
- if (!p) {
- if (Math.random() > 0.5) {
- return MainRoleManager.Instance.playerBehavior.body;
- }
- else {
- let s = MateManager.Instance.GetGetSp();
- if (!s)
- return MainRoleManager.Instance.playerBehavior.body;
- else
- return s;
- }
- }
- else {
- let s = MateManager.Instance.GetGetSp();
- if (!s)
- return null;
- else
- return s;
- }
- }
- RemoveEnemy(sp) {
- this.enemyDic.delete(sp.id);
- }
- CheackGame() {
- if (this.enemyDic.size == 0) {
- MouseEvent.Instance.OnClickUp();
- MainRoleManager.Instance.StopCreate();
- GameManager.Instance.ToDance();
- }
- }
- PlayerGetEnemy() {
- for (const key in this.enemyDic.container) {
- const element = this.enemyDic.get(key);
- return element.selfobj;
- }
- return null;
- }
- Reset() {
- let arr = [];
- for (const key in this.enemyDic.container) {
- arr.push(key);
- }
- if (arr.length > 0) {
- for (let index = 0; index < arr.length; index++) {
- const element = arr[index];
- let s = this.enemyDic.get(element);
- if (s)
- s.Des();
- }
- }
- console.log("this.enemyDic.size", this.enemyDic.size);
- }
- }
- class BannerAndVideo1 {
- static InitVideo() {
- if (!GameSetting.isWx)
- return;
- let index = Math.random() > 0.5 ? 0 : 1;
- BannerAndVideo1.curVideo = Laya.Browser.window.wx.createRewardedVideoAd({ adUnitId: BannerAndVideo1.videlAdUnitId[index] });
- BannerAndVideo1.curVideo.onLoad(() => {
- console.log('激励视频 广告加载成功');
- this.videoLoadCom = true;
- });
- BannerAndVideo1.curVideo.onError(err => {
- console.log("激励视屏加载失败:" + err);
- this.videoLoadCom = false;
- });
- BannerAndVideo1.curVideo.onClose(res => {
- console.log("激励视频关闭:" + res.isEnded);
- if (res && res.isEnded || res === undefined) {
- this.videoCallback && this.videoCallback(true);
- }
- else {
- this.videoCallback && this.videoCallback(false);
- }
- });
- }
- static ShowVideo(callback) {
- if (GameSetting.isWx) {
- if (BannerAndVideo1.videoLoadCom) {
- console.log("showVideoAd:" + BannerAndVideo1.videoLoadCom);
- BannerAndVideo1.videoCallback = callback;
- BannerAndVideo1.curVideo.show().catch(err => {
- BannerAndVideo1.curVideo.load().then(() => {
- BannerAndVideo1.curVideo.show();
- });
- });
- }
- else {
- WXSdk.Game_Share(callback);
- }
- }
- else {
- ViewManager.Instance.ShowTips("暂未开放");
- callback(true);
- }
- }
- static OpenBanner(callVack = null, iswait = false) {
- if (!(GameSetting.isWx))
- return;
- BannerAndVideo1.canshowbanner = true;
- var idd;
- this.curBannerId++;
- if (this.curBannerId > 1)
- this.curBannerId = 0;
- idd = BannerAndVideo1.bannerAdUnitId[this.curBannerId];
- console.log("adUnitId:" + idd);
- let newBanner = Laya.Browser.window.wx.createBannerAd({
- adUnitId: idd,
- style: {
- left: 0,
- top: 0,
- width: 460
- }
- });
- newBanner.onError(err => {
- console.log(err);
- callVack(null);
- });
- newBanner.onLoad(() => {
- console.log("新的");
- if (this.curbanner)
- this.curbanner.destroy();
- this.curbanner = newBanner;
- let info = Laya.Browser.window.wx.getSystemInfoSync();
- this.curbanner.style.width = info.windowWidth;
- this.curbanner.style.top = info.windowHeight - this.curbanner.style.realHeight - 5;
- var hight = Laya.stage.height / info.windowHeight * this.curbanner.style.realHeight;
- if (callVack != null) {
- callVack(hight);
- }
- if (this.canshowbanner && !iswait) {
- this.curbanner.show();
- }
- else {
- this.curbanner.hide();
- }
- });
- }
- static Clear() {
- Laya.timer.clearAll(BannerAndVideo1);
- Laya.Tween.clearAll(BannerAndVideo1);
- BannerAndVideo1.canshowbanner = false;
- if (BannerAndVideo1.curbanner)
- BannerAndVideo1.curbanner.hide();
- }
- static showbanner() {
- if (!GameSetting.isWx)
- return;
- if (BannerAndVideo1.curbanner)
- BannerAndVideo1.curbanner.show();
- }
- static CheatBanner(btn, complete = null) {
- if (!AppSetting.bannerCanMove || !btn || !this.WXignore()) {
- console.log("ignorecheat");
- BannerAndVideo1.OpenBanner();
- }
- else {
- btn.bottom = NaN;
- btn.y = Laya.stage.height - btn.height - 40;
- BannerAndVideo1.OpenBanner((height) => {
- if (!height) {
- return;
- }
- else {
- console.log("cheatstart", "bottom:100");
- btn.mouseEnabled = false;
- var end = Laya.stage.height - height - btn.height - 20;
- console.log("y:" + end);
- Laya.timer.once(AppSetting.moveTime * 1000, this, () => {
- btn.mouseEnabled = true;
- this.showbanner();
- Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
- if (complete != null) {
- complete();
- }
- }));
- });
- }
- }, true);
- }
- }
- static WXignore() {
- if (!AppSetting.OpenSceneValue) {
- return true;
- }
- if (GameSetting.wxValue == "1044" || GameSetting.wxValue == "1104" || GameSetting.wxValue == "00000" || GameSetting.wxValue == "1058" || GameSetting.wxValue == "1067" || GameSetting.wxValue == "1095"
- || GameSetting.wxValue == "1089" || GameSetting.wxValue == "1001" || GameSetting.wxValue == "1037" || GameSetting.wxValue == "1007") {
- return true;
- }
- return false;
- }
- }
- BannerAndVideo1.videlAdUnitId = ["adunit-be9371877a88ed51", "adunit-3881e83f08f8b7c9"];
- BannerAndVideo1.bannerAdUnitId = ["adunit-e4f1a4e63109e4ba", "adunit-541ca055934fd3f1"];
- BannerAndVideo1.curBannerId = 0;
- BannerAndVideo1.videoLoadCom = false;
- BannerAndVideo1.canshowbanner = true;
- class GameManager {
- constructor() {
- this.towerCount = 0;
- this.roleCount = 0;
- this.blockCount = 0;
- this.easterCount = 0;
- }
- static get Instance() {
- return GameManager.instance || (GameManager.instance = new GameManager());
- }
- GameStart() {
- this.towerCount = 0;
- this.roleCount = 0;
- this.blockCount = 0;
- }
- GameWin() {
- WXSdk.LongVibrate();
- BannerAndVideo1.Clear();
- ViewManager.Instance.AddView(ViewType.CompleteView, true);
- MoundManager.Instance.Reset();
- StreetManager.Instance.Reset();
- MateManager.Instance.Reset();
- MainRoleManager.Instance.Reset();
- RoleManager.Instance.Reset();
- }
- ToDance(isglod = false) {
- BannerAndVideo1.CheatBanner(null);
- MainRoleManager.Instance.GoToDance();
- if (isglod)
- MateManager.Instance.GoToDance1();
- else
- MateManager.Instance.GoToDance();
- CameraManager.Instance.SetCamState(CameraState.jump, 0.03);
- Laya.timer.once(4000, this, this.GameWin);
- }
- GameOver() {
- GuideController.Instance.GameDied();
- MouseEvent.Instance.OnClickUp();
- MainRoleManager.Instance.StopCreate();
- MouseEvent.Instance._Switch = false;
- WXSdk.LongVibrate();
- BannerAndVideo1.Clear();
- ViewManager.Instance.AddView(ViewType.CompleteView, false);
- MoundManager.Instance.Reset();
- StreetManager.Instance.Reset();
- MateManager.Instance.Reset();
- MainRoleManager.Instance.Reset();
- MainRoleManager.Instance.SetActiveFalse();
- RoleManager.Instance.Reset();
- }
- Pause() {
- if (this.easterCount >= 1) {
- this.GameOver();
- return;
- }
- this.easterCount++;
- }
- Easter() {
- }
- Arrive() {
- MoundManager.Instance.Reset();
- StreetManager.Instance.Reset();
- }
- NextLevel() {
- PlayerManager.Instance.stage++;
- Scene3DManager.Instance.InItScene();
- ViewManager.Instance.CloseView(ViewType.CompleteView);
- DispatcherManager.event(EventType.Event.ShowMainUi);
- DispatcherManager.event(EventType.Event.SetStage);
- DispatcherManager.event(EventType.Event.SetStagePro, 0);
- }
- ReStart() {
- MateManager.Instance.Reset();
- Scene3DManager.Instance.InItScene();
- DispatcherManager.event(EventType.Event.ShowMainUi);
- DispatcherManager.event(EventType.Event.SetStagePro, 0);
- }
- huituiFunc(ist) {
- if (ist) ;
- else {
- console.log("result Close huitui");
- }
- }
- ShowTopTip() {
- }
- }
- class Mound extends Laya.Script3D {
- onAwake() {
- this.selfobj = this.owner;
- this.tran = this.selfobj.transform;
- this.FriendSpawnPoint = this.selfobj.getChildByName("FriendSpawnPoint").transform;
- this.HealthText = this.selfobj.getChildByName("HealthText").transform;
- let we = this.selfobj.getChildByName("WallsEnd");
- this.WallsEnd = we.transform;
- this.mat = we.getChildAt(0).meshRenderer.material;
- }
- Cheack() {
- if (this.tarTran.localPositionZ - this.tran.localPositionZ >= 5) {
- console.log("回收tower");
- this.Des();
- return;
- }
- this.MoveHpText();
- }
- MoveHpText() {
- let p = MatrixTransform.WorldToScreen2(this._camera, this.HealthText.position.clone());
- if (p.x <= 0 || p.x >= Laya.stage.width || p.y <= 0 || p.y >= Laya.stage.height)
- this.hpText.visible = false;
- else {
- if (!this.hpText.visible)
- this.hpText.visible = true;
- this.hpText.x = p.x;
- this.hpText.y = p.y;
- }
- }
- SetTower(data) {
- this._firend = null;
- this.tarTran = MainRoleManager.Instance.player.transform;
- this.tran.localPositionX = data.x;
- this.tran.localPositionY = 0;
- this.tran.localPositionZ = data.z;
- if (data.towerR)
- this.WallsEnd.localRotationEulerY = 30;
- else
- this.WallsEnd.localRotationEulerY = 0;
- if (data.type == 1) {
- this._createFriend();
- }
- this._hp = data.hp;
- if (!this.hpText) {
- this.hpText = MoundManager.Instance.CreateHpText();
- this.hpText.text = this._hp.toString();
- if (!this._camera)
- this._camera = CameraManager.Instance._camer;
- ViewManager.Instance.popNode.addChild(this.hpText);
- }
- this.MoveHpText();
- Laya.timer.frameLoop(1, this, this.Cheack);
- }
- _createFriend() {
- this._firend = MateManager.Instance.CreateFriend(this.FriendSpawnPoint);
- }
- SaveFriend() {
- if (this._firend) {
- this._firend.TweenFall();
- this._firend = null;
- }
- }
- Atked(hitpos) {
- this._hp -= PlayerManager.bulletAttack;
- if (this._hp <= 0) {
- this.SaveFriend();
- ParticleManager.Instance.CreateBoomEffect(this.tran.position);
- this.Des();
- GameManager.Instance.towerCount++;
- return;
- }
- ParticleManager.Instance.CreateHitEffect(hitpos);
- let t = Math.ceil(this._hp);
- this.hpText.text = t.toString();
- this.SetMat();
- }
- SetMat() {
- this.mat.albedoIntensity = 4;
- Laya.timer.once(100, this, () => {
- this.mat.albedoIntensity = 1;
- });
- }
- Des() {
- Laya.timer.clearAll(this);
- if (this.hpText) {
- GamePool.Instance.SetDisableForUi(PoolType.HpText, this.hpText);
- this.hpText = null;
- }
- this.mat.albedoIntensity = 1;
- MoundManager.Instance.RemoveTower(this.selfobj);
- GamePool.Instance.SetDisableObject(this.selfobj);
- if (this._firend) {
- this._firend.Des();
- this._firend = null;
- }
- }
- onDisable() {
- }
- onDestroy() {
- }
- }
- var Vector3$2 = Laya.Vector3;
- class MainRoleShot extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this.speed = Mathf.VecZero;
- this._forward = new Vector3$2(0, 0, 1);
- this.over = false;
- }
- onAwake() {
- this.selfobj = this.owner;
- this.tran = this.selfobj.transform;
- this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
- this.speed.z = GlobalVariable.bulletspeed;
- }
- StartMove(tarTran, isover = false) {
- this.tarTran = tarTran;
- this.over = isover;
- Laya.timer.frameLoop(1, this, this._MOVE);
- }
- _MOVE() {
- this.tran.translate(this.speed);
- let d = Vector3$2.distance(this.tarTran.position, this.tran.position);
- if (d >= GlobalVariable.bulletMaxDis) {
- this.Des();
- return;
- }
- this.CreateRay();
- }
- CreateRay() {
- let origP = this.rayPoint.position.clone();
- if (!this._scene) {
- this._scene = Scene3DManager.Instance._mainscene;
- }
- if (!this.ray) {
- if (!this.forward)
- this.forward = Mathf.VecZero;
- this.ray = new Laya.Ray(Mathf.VecZero, this._forward);
- this.outHit = new Laya.HitResult();
- }
- this.ray.origin = origP;
- if (this.over) {
- this.tran.getForward(this.forward);
- this.forward.x = -this.forward.x;
- this.forward.y = -this.forward.y;
- this.forward.z = -this.forward.z;
- this.ray.direction = this.forward;
- }
- else {
- this.ray.direction = this._forward;
- }
- let isHItF = this._scene.physicsSimulation.rayCast(this.ray, this.outHit, GlobalVariable.bulletRayLength);
- if (isHItF) {
- let obj = this.outHit.collider.owner;
- if (obj.layer == ColliderGroup.mound) {
- let tower = obj.getComponent(Mound);
- if (tower) {
- tower.Atked(this.outHit.point);
- }
- }
- else if (obj.layer == ColliderGroup.opponent) {
- let tower = obj.getComponent(Opponent);
- if (tower) {
- tower.Atked(this.outHit.point);
- }
- }
- else if (obj.layer == ColliderGroup.obstacle1 || obj.layer == ColliderGroup.obstacle2 || obj.layer == ColliderGroup.obstacle3) {
- StreetManager.Instance.CubeBlockAtked(obj);
- GameManager.Instance.blockCount++;
- }
- else {
- ParticleManager.Instance.CreateHitEffect(this.outHit.point);
- }
- this.Des();
- return;
- }
- }
- Des() {
- Laya.timer.clearAll(this);
- GamePool.Instance.SetDisableObject(this.selfobj);
- GamePool.bulletCount--;
- }
- onDestroy() {
- }
- }
- var Vector3$3 = Laya.Vector3;
- var Quaternion$1 = Laya.Quaternion;
- class Mate extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this._up = new Vector3$3(0, 1, 0);
- this.isreturn = false;
- this.isover = false;
- this.isClickCom = true;
- this.isStop = true;
- this.ts = new Vector3$3(0, 0, 0.01);
- this.isFristShoot = true;
- }
- onAwake() {
- this.selfobj = this.owner;
- this.tran = this.selfobj.transform;
- this.animator = this.selfobj.getChildAt(0).getComponent(Laya.Animator);
- this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
- this.bulletPos = this.selfobj.getChildByName("bulletPos").transform;
- this.forW = Mathf.VecZero;
- this.speed = GlobalVariable.friendspeed;
- this.quaternion1 = new Quaternion$1();
- }
- SetTar() {
- this.isreturn = false;
- this.isClickCom = true;
- this.isStop = true;
- this.isover = false;
- this.PlayAni(MusicType.Idle, 1);
- DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate);
- }
- TryAddFriend(dataPar) {
- this.PlayAni(MusicType.Idle, 1);
- this.dataPar = dataPar;
- this.dataPar["ishave"] = true;
- this.isClickCom = true;
- this.isStop = true;
- this.isreturn = true;
- this.isover = false;
- MateManager.Instance.AddGetDic(this.selfobj.id, this);
- this.BulletHandler();
- if (MainRoleManager.Instance.IsBulleting())
- this.CreateBullet();
- Laya.timer.frameLoop(1, this, this.Move);
- }
- TweenFall() {
- let tween = Laya.Tween.to(this.tran, { localPositionY: 0 }, 400, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
- let dataPar = MainRoleManager.Instance.GetFrindPar();
- if (!dataPar) {
- console.warn("friendPar没有位置了");
- return;
- }
- this.dataPar = dataPar;
- this.dataPar["ishave"] = true;
- this.tar = this.dataPar["sp"];
- this.tarTra = this.tar.transform;
- tween.clear();
- this.StartMove();
- }, null, false));
- }
- StartMove() {
- this.PlayAni(MusicType.RunAndGun, 2);
- this.isreturn = false;
- this.isClickCom = true;
- this.isStop = true;
- this.isover = false;
- Laya.timer.frameLoop(1, this, this.Move);
- }
- _createRay() {
- this.CreateRay();
- }
- Move() {
- if (this.isreturn) {
- this._createRay();
- return;
- }
- let tarPos = this.tarTra.position.clone();
- Vector3$3.subtract(tarPos, this.tran.position, this.forW);
- Vector3$3.normalize(this.forW, this.forW);
- this.forW = new Vector3$3(this.forW.x * this.speed, this.forW.y * this.speed, this.forW.z * this.speed);
- this.tran.translate(this.forW, false);
- if (Vector3$3.distance(this.tran.position, tarPos) < 0.1) {
- this.ArriveTarPos();
- return;
- }
- Quaternion$1.lookAt(tarPos, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- Quaternion$1.slerp(this.tran.rotation, this.quaternion1, 0.1, this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- ArriveTarPos() {
- this.isClickCom = true;
- this.isStop = true;
- this.isreturn = true;
- this.tar.addChild(this.selfobj);
- this.tran.localPosition = Mathf.VecZero;
- this.PlayAni(MusicType.RunAndGun, 2);
- MateManager.Instance.AddGetDic(this.selfobj.id, this);
- let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
- tween.clear();
- this.tran.localRotationEuler = Mathf.VecZero;
- this.BulletHandler();
- this.CreateBullet();
- }, null, false));
- }
- CreateRay() {
- let origP = this.rayPoint.position;
- if (!this._scene) {
- this._scene = Scene3DManager.Instance._mainscene;
- }
- if (!this.rayF) {
- this.rayF = new Laya.Ray(Mathf.VecZero, new Vector3$3(0, 0, 1));
- this.outHitF = new Laya.HitResult();
- }
- this.rayF.origin = origP;
- let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalVariable.playerRayLengthF);
- if (isHItF) {
- let obj = this.outHitF.collider.owner;
- this.Died(this.outHitF.point);
- return;
- }
- if (!this.rayL) {
- this.rayL = new Laya.Ray(Mathf.VecZero, new Vector3$3(1, 0, 0));
- this.outHitL = new Laya.HitResult();
- }
- this.rayL.origin = origP;
- let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalVariable.playerRayLengthLR);
- if (isHItL) {
- let obj = this.outHitL.collider.owner;
- this.Died(this.outHitL.point);
- return;
- }
- if (!this.rayR) {
- this.rayR = new Laya.Ray(Mathf.VecZero, new Vector3$3(-1, 0, 0));
- this.outHitR = new Laya.HitResult();
- }
- this.rayR.origin = origP;
- let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalVariable.playerRayLengthLR);
- if (isHItR) {
- let obj = this.outHitR.collider.owner;
- this.Died(this.outHitR.point);
- return;
- }
- }
- PlayAni(clip, speed, callback) {
- this.animator.play(clip);
- if (!speed)
- speed = 1;
- this.animator.speed = speed;
- }
- BulletHandler() {
- DispatcherManager.on(EventType.Event.StopShot, this, this.StopCreate);
- }
- CreateBullet() {
- this.isStop = false;
- if (!this.isClickCom)
- return;
- this.isClickCom = false;
- this._CreateBullet();
- Laya.timer.loop(PlayerManager.bulletTime * 2 * 1000, this, this.LoopCreate);
- }
- LoopCreate() {
- if (this.isStop) {
- Laya.timer.clear(this, this.LoopCreate);
- this.isClickCom = true;
- return;
- }
- this._CreateBullet();
- }
- _CreateBullet() {
- let bu = GamePool.Instance.SetActiveObject(GamePool.pooltype.PlayerBullet);
- if (bu) {
- Scene3DManager.Instance.bulletCon.addChild(bu);
- bu.transform.position = this.bulletPos.position.clone();
- bu.transform.localRotationEuler = this.bulletPos.rotationEuler.clone();
- let pb = bu.getComponent(MainRoleShot);
- if (!pb)
- pb = bu.addComponent(MainRoleShot);
- pb.StartMove(this.bulletPos, this.isover);
- }
- }
- StopCreate() {
- this.isStop = true;
- }
- Died(pos) {
- if (this.dataPar)
- this.dataPar["ishave"] = false;
- ParticleManager.Instance.CreateXueEffect(pos);
- MateManager.Instance.RemoveGet(this.selfobj);
- this.Des();
- MainRoleManager.Instance.CheackGame();
- }
- SetPar() {
- let t = this.tran.position.clone();
- MainRoleManager.Instance.playerContainer.addChild(this.selfobj);
- this.tran.position = t.clone();
- }
- ToStand(pos) {
- this.SetPar();
- this.tp = pos;
- Quaternion$1.lookAt(pos, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- this.PlayAni(MusicType.CrouchFiring, 1);
- Laya.timer.frameLoop(1, this, this._TOSTAND);
- }
- _TOSTAND() {
- Vector3$3.subtract(this.tp, this.tran.position, this.forW);
- Vector3$3.normalize(this.forW, this.forW);
- this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
- this.tran.translate(this.forW, false);
- if (Vector3$3.distance(this.tran.position, this.tp) < 0.1) {
- Laya.timer.clear(this, this._TOSTAND);
- let tween = Laya.Tween.to(this.tran, { localRotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
- tween.clear();
- }, null, false));
- return;
- }
- Quaternion$1.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- Dance(sp) {
- this.PlayAni(MusicType.RunAndGun, 2);
- this.danceP = sp.position.clone();
- this.r = sp.rotationEuler.clone();
- Laya.timer.frameLoop(1, this, this._Dance);
- }
- _Dance() {
- Vector3$3.subtract(this.danceP, this.tran.position, this.forW);
- Vector3$3.normalize(this.forW, this.forW);
- this.forW = new Vector3$3(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
- this.tran.translate(this.forW);
- if (Vector3$3.distance(this.tran.position, this.danceP) < 0.15) {
- Laya.timer.clear(this, this._Dance);
- this.tran.position = this.danceP.clone();
- this.tran.rotationEuler = this.r.clone();
- this.PlayAni(MusicType.Dance, 1);
- return;
- }
- Quaternion$1.lookAt(this.danceP, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- StartAtkEnemy() {
- Laya.timer.clear(this, this._TOSTAND);
- this.isover = true;
- this.isFristShoot = true;
- this.enemyTar = null;
- Laya.timer.frameLoop(1, this, this._atkEnemy);
- }
- _atkEnemy() {
- if (this.enemyTar == null) {
- this.enemyTar = RoleManager.Instance.PlayerGetEnemy();
- if (this.enemyTar != null) {
- this.ATKp = this.enemyTar.transform.position.clone();
- Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- }
- else {
- if (!this.enemyTar.active) {
- this.enemyTar = RoleManager.Instance.PlayerGetEnemy();
- if (this.enemyTar != null) {
- this.ATKp = this.enemyTar.transform.position.clone();
- Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- }
- if (this.enemyTar == null) {
- this.StopCreate();
- this.isFristShoot = true;
- return;
- }
- if (this.isFristShoot) {
- this.isFristShoot = false;
- this.CreateBullet();
- }
- this.ATKp = this.enemyTar.transform.position.clone();
- Quaternion$1.lookAt(this.ATKp, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- }
- Des() {
- if (this.dataPar) {
- this.dataPar["ishave"] = false;
- this.dataPar = null;
- }
- MateManager.Instance.RemoveFriend(this.selfobj);
- MateManager.Instance.RemoveGet(this.selfobj);
- Laya.timer.clearAll(this);
- Laya.Tween.clearAll(this);
- DispatcherManager.off(EventType.Event.StopShot, this, this.StopCreate);
- GamePool.Instance.SetDisableObject(this.selfobj);
- }
- onDestroy() {
- }
- }
- class MateManager {
- constructor() {
- this.v3 = Mathf.VecZero;
- this.friendDic = new Dictionary();
- this.getDic = new Dictionary();
- }
- static get Instance() {
- return this.instance || (this.instance = new MateManager());
- }
- CreateFriend(tra) {
- let p = GamePool.Instance.SetActiveObject(GamePool.pooltype.player + PlayerManager.Instance.equipId);
- if (p) {
- p.transform.position = tra.position.clone();
- p.transform.rotationEuler = tra.rotationEuler.clone();
- MainRoleManager.Instance.playerContainer.addChild(p);
- let ps = p.getComponent(Mate);
- if (!ps)
- ps = p.addComponent(Mate);
- ps.SetTar();
- this.friendDic.set(p.id, ps);
- return ps;
- }
- return null;
- }
- CreateTryOut() {
- for (let index = 0; index < 3; index++) {
- Laya.timer.frameOnce(index, this, this._createtryout, null, false);
- }
- }
- _createtryout() {
- let dataPar = MainRoleManager.Instance.GetFrindPar();
- if (!dataPar) {
- console.warn("friendPar没有位置了");
- return;
- }
- let p = GamePool.Instance.SetActiveObject(GamePool.pooltype.player + PlayerManager.Instance.equipId);
- if (p) {
- let tar = dataPar["sp"];
- tar.addChild(p);
- p.transform.localPosition = Mathf.VecZero;
- p.transform.localRotationEuler = Mathf.VecZero;
- let ps = p.getComponent(Mate);
- if (!ps)
- ps = p.addComponent(Mate);
- ps.TryAddFriend(dataPar);
- this.friendDic.set(p.id, ps);
- }
- }
- TryOutFriendPlayAni() {
- for (const key in this.friendDic.container) {
- const element = this.friendDic.get(key);
- element.CreateBullet();
- element.PlayAni(MusicType.RunAndGun, 2);
- }
- }
- RemoveFriend(sp) {
- this.friendDic.delete(sp.id);
- }
- AddGetDic(id, fr) {
- console.log(22222222);
- this.getDic.set(id, fr);
- }
- RemoveGet(sp) {
- this.getDic.delete(sp.id);
- }
- GetArrive() {
- return this.getDic.size;
- }
- ToArrive(count, zs) {
- if (count == 1) {
- for (const key in this.getDic.container) {
- const element = this.getDic.get(key);
- this.v3.x = 0;
- element.ToStand(this.v3.clone());
- }
- return;
- }
- let len = 2 * GlobalVariable.arriveStandWidth;
- let avr = len / (count - 1);
- let index = 0;
- this.v3.z = zs;
- for (const key in this.getDic.container) {
- const element = this.getDic.get(key);
- this.v3.x = GlobalVariable.arriveStandWidth - index * avr;
- element.ToStand(this.v3.clone());
- index++;
- }
- }
- StartAtkEnemy() {
- for (const key in this.getDic.container) {
- const element = this.getDic.get(key);
- element.StartAtkEnemy();
- }
- }
- GetGetSp() {
- let count = this.getDic.size;
- let a = GameTool.randomInt(1, count);
- let tindex = 1;
- for (const key in this.getDic.container) {
- if (tindex == a) {
- const element = this.getDic.get(key);
- return element.selfobj;
- }
- tindex++;
- }
- return null;
- }
- GoToDance() {
- for (const key in this.getDic.container) {
- let t = PlaneManager.Instance.GetDancePos();
- if (!t)
- return;
- const element = this.getDic.get(key);
- element.Dance(t);
- }
- }
- GoToDance1() {
- for (const key in this.getDic.container) {
- let t = PlaneManager.Instance.GetDancePos();
- const element = this.getDic.get(key);
- element.SetPar();
- if (t) {
- element.Dance(t);
- }
- }
- }
- Reset() {
- let arr = [];
- for (const key in this.friendDic.container) {
- arr.push(key);
- }
- if (arr.length > 0) {
- for (let index = 0; index < arr.length; index++) {
- const element = arr[index];
- let s = this.friendDic.get(element);
- if (s)
- s.Des();
- }
- }
- console.log("this.friendDic.size", this.friendDic.size);
- this.getDic.clear();
- }
- }
- class PlaneManager {
- constructor() {
- this.airisshow = false;
- this.danceindex = 0;
- }
- static get Instance() {
- return this.instance || (this.instance = new PlaneManager());
- }
- Init(finalP) {
- if (!finalP) {
- console.error("飞机不存在");
- return;
- }
- this.finalTra = finalP.transform;
- this.jumpCamTra = finalP.getChildByName("jumpCamPos").transform;
- this.FinalBlock = finalP.getChildAt(0);
- this.EnemySpawnPoint = this.FinalBlock.getChildByName("EnemySpawnPoint").transform;
- this.PlayerDancePoint = this.FinalBlock.getChildByName("PlayerDancePoint");
- this.helicopter = this.FinalBlock.getChildByName("helicopter");
- this.toured = this.FinalBlock.getChildByName("toured").transform;
- this.FinalBlock.active = false;
- }
- SetAir() {
- this.danceindex = 0;
- this.airisshow = false;
- this.FinalBlock.active = false;
- let count = LevelController.Instance._level.road_list.length;
- this.winPos = (count) * GlobalVariable.barrierRoadLength;
- this.finalTra.localPositionZ = this.winPos;
- this.stageProLen = this.winPos - MainRoleManager.Instance.playerStartTra.localPositionZ;
- let isgold = LevelController.Instance._level.isgold;
- this.helicopter.active = isgold;
- this.toured1 = this.FinalBlock.getChildByName("toured1").transform.position.clone();
- this.toured2 = this.FinalBlock.getChildByName("toured2").transform.position.clone();
- }
- CheckPlayerRoadPos(_zp) {
- let d = this.winPos - _zp;
- if (d <= 60 && !this.airisshow) {
- this.ShowAir();
- return;
- }
- DispatcherManager.event(EventType.Event.SetStagePro, (this.stageProLen - d) / this.stageProLen);
- if (d <= 0) {
- this.ArriveFinal();
- }
- }
- ShowAir() {
- this.airisshow = true;
- this.FinalBlock.active = true;
- }
- ArriveFinal() {
- MainRoleManager.Instance.ArriveFinal();
- if (LevelController.Instance._level.isgold) {
- GameManager.Instance.ToDance(true);
- }
- else {
- let count = 0;
- let isdesd = MainRoleManager.Instance.ArriveIsdead();
- if (!isdesd) {
- count++;
- }
- let num = MateManager.Instance.GetArrive();
- count += num;
- if (count == 0)
- return;
- MateManager.Instance.ToArrive(count, this.toured.position.z);
- if (!isdesd)
- MainRoleManager.Instance.ToArrive(count, this.toured.position.z);
- Laya.timer.once(1300, this, this.CreateEnemy);
- }
- }
- CreateEnemy() {
- MainRoleManager.Instance.StartAtkEnemy();
- MateManager.Instance.StartAtkEnemy();
- RoleManager.Instance.CreateEnemy(this.EnemySpawnPoint.position.clone());
- }
- GetDancePos() {
- if (this.danceindex > this.PlayerDancePoint.numChildren - 1)
- return null;
- let t = this.PlayerDancePoint.getChildAt(this.danceindex).transform;
- this.danceindex++;
- return t;
- }
- }
- var Vector3$4 = Laya.Vector3;
- var Quaternion$2 = Laya.Quaternion;
- class MainRole extends Laya.Script3D {
- constructor() {
- super(...arguments);
- this.isarrive = false;
- this.isdead = false;
- this._up = new Vector3$4(0, 1, 0);
- this.ts = new Vector3$4(0, 0, 0.01);
- this.isFristShoot = true;
- }
- onAwake() {
- this.selfobj = this.owner;
- this.tran = this.selfobj.transform;
- this.body = this.selfobj.getChildAt(0);
- this.animator = this.body.getComponent(Laya.Animator);
- this.rayPoint = this.selfobj.getChildByName("rayPoint").transform;
- this.bulletPos = this.selfobj.getChildByName("bulletPos").transform;
- this._speed = Mathf.VecZero;
- this._speed.z = GlobalVariable.playerspeed;
- this.forW = Mathf.VecZero;
- this.quaternion1 = new Quaternion$2();
- }
- StartMove() {
- this.isdead = false;
- this.isarrive = false;
- Laya.timer.frameLoop(1, this, this.Move);
- }
- Move() {
- if (this.isarrive) {
- if (this.isdead)
- return;
- this.CreateRay();
- return;
- }
- this.tran.translate(this._speed);
- let pz = this.tran.localPositionZ;
- ConstructManager.Instance.CheckPlayerRoadPos(pz);
- PlaneManager.Instance.CheckPlayerRoadPos(pz);
- StreetManager.Instance.CheckPlayerRoadPos(pz);
- CameraManager.Instance.CameraMoveIngame(pz);
- if (this.isdead)
- return;
- this.CreateRay();
- }
- Arrive() {
- this.isarrive = true;
- }
- CreateRay() {
- let origP = this.rayPoint.position;
- if (!this._scene) {
- this._scene = Scene3DManager.Instance._mainscene;
- }
- if (!this.rayF) {
- this.rayF = new Laya.Ray(Mathf.VecZero, new Vector3$4(0, 0, 1));
- this.outHitF = new Laya.HitResult();
- }
- this.rayF.origin = origP;
- let isHItF = this._scene.physicsSimulation.rayCast(this.rayF, this.outHitF, GlobalVariable.playerRayLengthF);
- if (isHItF) {
- let obj = this.outHitF.collider.owner;
- this.Died(this.outHitF.point);
- return;
- }
- if (!this.rayL) {
- this.rayL = new Laya.Ray(Mathf.VecZero, new Vector3$4(1, 0, 0));
- this.outHitL = new Laya.HitResult();
- }
- this.rayL.origin = origP;
- let isHItL = this._scene.physicsSimulation.rayCast(this.rayL, this.outHitL, GlobalVariable.playerRayLengthLR);
- if (isHItL) {
- let obj = this.outHitL.collider.owner;
- this.Died(this.outHitL.point);
- return;
- }
- if (!this.rayR) {
- this.rayR = new Laya.Ray(Mathf.VecZero, new Vector3$4(-1, 0, 0));
- this.outHitR = new Laya.HitResult();
- }
- this.rayR.origin = origP;
- let isHItR = this._scene.physicsSimulation.rayCast(this.rayR, this.outHitR, GlobalVariable.playerRayLengthLR);
- if (isHItR) {
- let obj = this.outHitR.collider.owner;
- this.Died(this.outHitR.point);
- return;
- }
- }
- PlayAni(clip, speed, callback) {
- this.animator.play(clip);
- if (!speed)
- speed = 1;
- this.animator.speed = speed;
- }
- Slider(x) {
- this.tran.localPositionX += x;
- let px = this.tran.localPositionX;
- let abs = Math.abs(px);
- if (abs > GlobalVariable.playerMoveMaxX) {
- if (px > 0)
- this.tran.localPositionX = GlobalVariable.playerMoveMaxX;
- else
- this.tran.localPositionX = -GlobalVariable.playerMoveMaxX;
- }
- }
- CreateBullet() {
- if (this.isdead)
- return null;
- return this.bulletPos;
- }
- Died(pos) {
- this.isdead = true;
- this.body.active = false;
- ParticleManager.Instance.CreateXueEffect(pos);
- MainRoleManager.Instance.CheackGame(true);
- }
- Reset() {
- this.body.active = true;
- this.PlayAni(MusicType.Idle, 1);
- Laya.timer.clearAll(this);
- }
- ToStand(pos) {
- if (this.isdead)
- return;
- this.tp = pos;
- Quaternion$2.lookAt(pos, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- this.PlayAni(MusicType.CrouchFiring, 1);
- Laya.timer.frameLoop(1, this, this._TOSTAND);
- }
- _TOSTAND() {
- Vector3$4.subtract(this.tp, this.tran.position, this.forW);
- Vector3$4.normalize(this.forW, this.forW);
- this.forW = new Vector3$4(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
- this.tran.translate(this.forW);
- if (Vector3$4.distance(this.tran.position, this.tp) < 0.1) {
- Laya.timer.clear(this, this._TOSTAND);
- return;
- }
- Quaternion$2.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- StartAtkEnemy() {
- Laya.timer.clear(this, this._TOSTAND);
- this.isFristShoot = true;
- this.enemyTar = null;
- Laya.timer.frameLoop(1, this, this._atkEnemy);
- }
- _atkEnemy() {
- if (this.isdead)
- return;
- if (this.enemyTar == null) {
- this.enemyTar = RoleManager.Instance.PlayerGetEnemy();
- if (this.enemyTar != null) {
- this.tp = this.enemyTar.transform.position.clone();
- Quaternion$2.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- }
- else {
- if (!this.enemyTar.active) {
- this.enemyTar = RoleManager.Instance.PlayerGetEnemy();
- if (this.enemyTar != null) {
- this.tp = this.enemyTar.transform.position.clone();
- Quaternion$2.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- }
- if (this.enemyTar == null) {
- MainRoleManager.Instance.StopCreate(true);
- this.isFristShoot = true;
- return;
- }
- if (this.isFristShoot) {
- this.isFristShoot = false;
- MainRoleManager.Instance.CreateBullet(true);
- }
- this.tp = this.enemyTar.transform.position.clone();
- Quaternion$2.lookAt(this.tp, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- }
- Dance(sp) {
- this.PlayAni(MusicType.RunAndGun, 2);
- this.dancepos = sp.position.clone();
- this.r = sp.rotationEuler.clone();
- Laya.timer.frameLoop(1, this, this._Dance);
- }
- _Dance() {
- Vector3$4.subtract(this.dancepos, this.tran.position, this.forW);
- Vector3$4.normalize(this.forW, this.forW);
- this.forW = new Vector3$4(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
- this.tran.translate(this.forW);
- if (Vector3$4.distance(this.tran.position, this.dancepos) < 0.15) {
- Laya.timer.clear(this, this._Dance);
- this.tran.position = this.dancepos.clone();
- this.tran.rotationEuler = this.r.clone();
- this.PlayAni(MusicType.Dance, 1);
- return;
- }
- Quaternion$2.lookAt(this.dancepos, this.tran.position, this._up, this.quaternion1);
- this.quaternion1.invert(this.quaternion1);
- this.tran.rotation = this.quaternion1.clone();
- }
- onDisable() {
- }
- onDestroy() {
- }
- }
- var Vector3$5 = Laya.Vector3;
- class MainRoleManager {
- constructor() {
- this.isover = false;
- this.isClickCom = true;
- this.isStop = true;
- }
- static get Instance() {
- return this.instance || (this.instance = new MainRoleManager());
- }
- Init(startPos, playerCon) {
- this.playerStartTra = startPos.transform;
- this.playerContainer = playerCon;
- }
- CreatePlayer() {
- let p = GamePool.Instance.SetActiveObject(GamePool.pooltype.player + PlayerManager.Instance.equipId);
- if (p) {
- this.player = p;
- this.SetFriendPoint(p);
- this.playerTra = this.player.transform;
- this.playerTra.position = this.playerStartTra.position.clone();
- this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
- this.playerContainer.addChild(this.player);
- let ps = this.player.getComponent(MainRole);
- if (ps)
- this.playerBehavior = ps;
- else
- this.playerBehavior = this.player.addComponent(MainRole);
- }
- else {
- console.error("player不存在");
- }
- }
- InitPlayerPos() {
- this.player.active = true;
- this.playerTra.position = this.playerStartTra.position.clone();
- this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
- this.playerBehavior.PlayAni(MusicType.Idle, 1);
- }
- ChangePlayer() {
- if (this.player)
- GamePool.Instance.SetDisableObject(this.player);
- let p = GamePool.Instance.SetActiveObject(GamePool.pooltype.player + PlayerManager.Instance.equipId);
- if (p) {
- this.player = p;
- this.SetFriendPoint(p);
- this.playerTra = this.player.transform;
- this.playerTra.position = this.playerStartTra.position.clone();
- this.playerTra.rotationEuler = this.playerStartTra.rotationEuler.clone();
- this.playerContainer.addChild(this.player);
- let ps = this.player.getComponent(MainRole);
- if (ps)
- this.playerBehavior = ps;
- else
- this.playerBehavior = this.player.addComponent(MainRole);
- }
- }
- SetFriendPoint(player) {
- this.FriendArrPos = [];
- let par = player.getChildByName("FriendSpawPos");
- if (!par)
- console.error("friend父物体不存在");
- for (let index = 0; index < par.numChildren; index++) {
- let data = {};
- data["ishave"] = false;
- data["sp"] = par.getChildAt(index);
- this.FriendArrPos.push(data);
- }
- }
- GetFrindPar() {
- for (let index = 0; index < this.FriendArrPos.length; index++) {
- const element = this.FriendArrPos[index];
- if (!element["ishave"])
- return element;
- }
- return null;
- }
- SetPlayerPos(x) {
- if (!this.player) {
- this.CreatePlayer();
- this.InitPlayerPos();
- }
- if (!this._camera) {
- this._camera = CameraManager.Instance._camer;
- this._dis = -Vector3$5.distance(this.playerTra.position, this._camera.transform.position);
- this._y = MatrixTransform.WorldToScreen2(this._camera, this.playerTra.position).y;
- }
- let uiP = new Vector3$5(x, this._y, this._dis);
- let p = MatrixTransform.ScreenToWorld(this._camera, uiP);
- this.playerTra.localPositionX = p.x;
- }
- StartGame() {
- if (this.playerBehavior) {
- this.playerBehavior.StartMove();
- this.playerBehavior.PlayAni(MusicType.RunAndGun, 2);
- }
- }
- SliderPlayer(offsetX) {
- let x = offsetX.toFixed(2);
- let x1 = Number(x) * GlobalVariable.sliderFactor;
- if (this.playerBehavior)
- this.playerBehavior.Slider(x1);
- }
- CreateBullet(isgameover = false) {
- if (!this.playerBehavior)
- return;
- this.isStop = false;
- if (!this.isClickCom)
- return;
- console.log("开始创建子弹");
- this.isClickCom = false;
- this._CreateBullet();
- Laya.timer.loop(PlayerManager.bulletTime * 1000, this, this.LoopCreate);
- }
- LoopCreate() {
- if (this.isStop) {
- Laya.timer.clear(this, this.LoopCreate);
- this.isClickCom = true;
- return;
- }
- this._CreateBullet();
- }
- _CreateBullet() {
- WXSdk.ShortVibrate();
- SettingController.Instance.PlaySound(SoundType.hit);
- let bulletPos = this.playerBehavior.CreateBullet();
- if (bulletPos == null)
- return;
- let bu = GamePool.Instance.SetActiveObject(GamePool.pooltype.PlayerBullet);
- if (bu) {
- Scene3DManager.Instance.bulletCon.addChild(bu);
- bu.transform.position = bulletPos.position.clone();
- bu.transform.localRotationEuler = bulletPos.rotationEuler.clone();
- let pb = bu.getComponent(MainRoleShot);
- if (!pb)
- pb = bu.addComponent(MainRoleShot);
- pb.StartMove(bulletPos, this.isover);
- }
- }
- StopCreate(isgameover = false) {
- this.isStop = true;
- if (!isgameover)
- DispatcherManager.event(EventType.Event.StopShot);
- }
- IsBulleting() {
- return !this.isStop;
- }
- ArriveFinal() {
- MouseEvent.Instance.OnClickUp();
- MainRoleManager.Instance.StopCreate();
- MouseEvent.Instance._Switch = false;
- GameManager.Instance.Arrive();
- if (!this.playerBehavior)
- return;
- this.playerBehavior.Arrive();
- }
- ArriveIsdead() {
- if (!this.playerBehavior)
- return true;
- return this.playerBehavior.isdead;
- }
- ToArrive(count, z) {
- if (!this.playerBehavior)
- return;
- if (count == 1) {
- this.playerBehavior.ToStand(new Vector3$5(0, 0, z));
- }
- else {
- this.playerBehavior.ToStand(new Vector3$5(-GlobalVariable.arriveStandWidth, 0, z));
- }
- }
- StartAtkEnemy() {
- if (!this.playerBehavior)
- return;
- this.isover = true;
- this.playerBehavior.StartAtkEnemy();
- }
- CheackGame(isplayer) {
- if (isplayer) {
- let count = MateManager.Instance.GetArrive();
- if (count == 0) {
- this.playerBehavior.Arrive();
- GameManager.Instance.GameOver();
- }
- }
- else {
- let count = MateManager.Instance.GetArrive();
- if (count == 0) {
- let isplayerdead = this.playerBehavior.isdead;
- if (isplayerdead) {
- this.playerBehavior.Arrive();
- GameManager.Instance.GameOver();
- }
- }
- }
- }
- GoToDance() {
- if (!this.playerBehavior)
- return;
- let t = PlaneManager.Instance.GetDancePos();
- if (!t)
- return;
- this.playerBehavior.Dance(t);
- }
- Reset() {
- for (let index = 0; index < this.FriendArrPos.length; index++) {
- const element = this.FriendArrPos[index];
- element["ishave"] = false;
- }
- this.isover = false;
- if (!this.playerBehavior)
- return;
- this.playerBehavior.Reset();
- }
- SetActiveFalse() {
- if (this.player)
- this.player.active = false;
- }
- }
- var Vector3$6 = Laya.Vector3;
- var CameraState;
- (function (CameraState) {
- CameraState[CameraState["game"] = 1] = "game";
- CameraState[CameraState["jump"] = 2] = "jump";
- })(CameraState || (CameraState = {}));
- class Camera extends Laya.Script3D {
- constructor() {
- super();
- this.arg = 0.1;
- this.canmovegame = false;
- this.startShake = false;
- this.seconds = 0;
- this.started = false;
- this.quake = 0.3;
- }
- onAwake() {
- this.selfObj = this.owner;
- this._tran = this.selfObj.transform;
- this.nowP = Mathf.VecZero;
- this.nowR = Mathf.VecZero;
- this.dis = Mathf.VecZero;
- this.temp = Mathf.VecZero;
- }
- Init() {
- let t = CameraManager.Instance.startPosTra;
- this._tran.position = t.position.clone();
- this._tran.localRotationEuler = Mathf.SpToCam(t.localRotationEuler.clone());
- this.dis.x = MainRoleManager.Instance.playerStartTra.position.x - this._tran.position.x;
- this.dis.y = MainRoleManager.Instance.playerStartTra.position.y - this._tran.position.y;
- this.dis.z = MainRoleManager.Instance.playerStartTra.position.z - this._tran.position.z;
- }
- SetCameraByState(type, arg) {
- this.arg = arg;
- switch (type) {
- case CameraState.game:
- this.tarTra = MainRoleManager.Instance.playerTra;
- if (!this.tarTra)
- return;
- let t = CameraManager.Instance.startPosTra;
- this._tran.position = t.position.clone();
- this._tran.localRotationEuler = Mathf.SpToCam(t.localRotationEuler.clone());
- this.canmovegame = true;
- break;
- case CameraState.jump:
- this.tarTra = PlaneManager.Instance.jumpCamTra;
- if (!this.tarTra)
- return;
- this.canmovegame = false;
- Laya.timer.frameLoop(1, this, this.JumpCameraMove);
- Laya.timer.once(3000, this, this.StopMove);
- break;
- }
- }
- StopMove() {
- Laya.timer.clear(this, this.JumpCameraMove);
- }
- MoveGame(z) {
- if (!this.canmovegame)
- return;
- this.temp.z = z - this.dis.z;
- this._tran.localPositionZ = this.temp.z;
- }
- JumpCameraMove() {
- let p, r;
- if (this.arg == 1) {
- p = this.tarTra.position;
- r = Mathf.SpToCam(this.tarTra.localRotationEuler.clone());
- }
- else {
- p = Mathf.MixVector3(this._tran.position.clone(), this.tarTra.position, this.arg, this.nowP);
- r = Mathf.MixVector3(this._tran.localRotationEuler, Mathf.SpToCam(this.tarTra.localRotationEuler.clone()), this.arg, this.nowR);
- }
- this._tran.position = p;
- this._tran.localRotationEuler = r;
- }
- onDisable() {
- }
- onDestroy() {
- Laya.timer.clearAll(this);
- }
- ShakeFor(a, b) {
- this.camPOS = this.selfObj.transform.position.clone();
- this.seconds = a;
- this.started = true;
- this.startShake = true;
- this.quake = b;
- }
- onLateUpdate() {
- if (this.startShake) {
- this.Quake();
- }
- if (this.started) {
- this.started = false;
- Laya.timer.once(this.seconds * 1000, this, () => {
- this.startShake = false;
- this.selfObj.transform.position = this.camPOS;
- });
- }
- }
- Quake() {
- var x = GameTool.random_1to1() * this.quake;
- var y = GameTool.random_1to1() * this.quake;
- var z = GameTool.random_1to1() * this.quake;
- var temp = new Vector3$6(this.camPOS.x + Math.random() * this.quake, this.camPOS.y + Math.random() * this.quake, this.camPOS.z + Math.random() * this.quake);
- this.selfObj.transform.position = temp;
- }
- }
- class Scene3DManager {
- static get Instance() {
- return Scene3DManager.instance || (Scene3DManager.instance = new Scene3DManager());
- }
- Init(_s) {
- if (_s) {
- this._mainscene = _s;
- Laya.stage.addChild(_s);
- }
- else {
- console.error("场景不存在");
- return;
- }
- let sceneNode;
- sceneNode = this._mainscene.getChildByName("scene");
- if (!sceneNode) {
- console.error("场景资源配置错误!");
- return;
- }
- this._camera = this._mainscene.getChildByName("Main Camera");
- this._camera.enableHDR = false;
- this.bulletCon = sceneNode.getChildByName("bulletContainer");
- this.effectCon = sceneNode.getChildByName("effectPos");
- this.InitSceneArg();
- let build = sceneNode.getChildByName("buildings");
- ConstructManager.Instance.Init(build);
- let playerStartPos = sceneNode.getChildByName("playerstartPoint");
- let playerCon = sceneNode.getChildByName("playerContainer");
- MainRoleManager.Instance.Init(playerStartPos, playerCon);
- let moveBlockContainer = sceneNode.getChildByName("BlockContainer");
- StreetManager.Instance.Init(moveBlockContainer);
- let towerContainer = sceneNode.getChildByName("towerContainer");
- MoundManager.Instance.Init(towerContainer);
- let startCampos1 = sceneNode.getChildByName("startCamPos");
- let startCamposX = sceneNode.getChildByName("startXCamPos");
- let ps;
- if (GameSetting.isX)
- ps = startCamposX;
- else
- ps = startCampos1;
- CameraManager.Instance.Init(this._camera, ps);
- let finalPos = sceneNode.getChildByName("finalPos");
- PlaneManager.Instance.Init(finalPos);
- this.INITGAME();
- }
- INITGAME() {
- Laya.timer.frameOnce(10, this, () => {
- MainRoleManager.Instance.CreatePlayer();
- this.InItScene();
- });
- }
- ;
- InitSceneArg() {
- this._camera.clearFlag = Laya.BaseCamera.CLEARFLAG_SKY;
- let skyRenderer = this._mainscene.skyRenderer;
- skyRenderer.mesh = Laya.SkyDome.instance;
- let mat = new Laya.SkyProceduralMaterial();
- skyRenderer.material = mat;
- mat.sunDisk = Laya.SkyProceduralMaterial.SUN_NODE;
- mat.skyTint = new Laya.Vector4(1, 0.74, 0.74, 1);
- }
- SkyRotate() {
- Laya.timer.frameLoop(2, this, this.St);
- }
- St() {
- if (this.mat)
- this.mat.rotation += 0.1;
- }
- InItScene() {
- LevelController.Instance.SetLevel();
- PlaneManager.Instance.SetAir();
- ConstructManager.Instance.SetBuild();
- CameraManager.Instance.SetCamState(CameraState.game, 1);
- MainRoleManager.Instance.InitPlayerPos();
- }
- }
- class AssetController {
- constructor() {
- this.cloth = [];
- }
- static get Instance() {
- return this.instance || (this.instance = new AssetController());
- }
- LoadAsset(callback) {
- var arr = [
- AssetPath.main_path,
- AssetPath.enemy_path,
- AssetPath.playerBullet_path,
- AssetPath.tower_path,
- ];
- let arr1 = arr.concat(AssetPath.player_path);
- let arr2 = arr1.concat(AssetPath.barrier_paths);
- let arr3 = arr2.concat(AssetPath.effect_path);
- let arr4 = arr3.concat(AssetPath.enemytexture);
- AssetController.LoadResource(arr4, () => {
- this.InitAsset();
- if (callback)
- callback();
- });
- }
- InitAsset() {
- AssetPath.player_path.forEach(element => {
- let _player = Laya.loader.getRes(element);
- Laya.loader.clearRes(element);
- this.LoadPoolRes(_player.name, _player);
- });
- AssetPath.enemytexture.forEach(element => {
- let _tex = Laya.loader.getRes(element);
- Laya.loader.clearRes(element);
- this.cloth.push(_tex);
- });
- AssetPath.effect_path.forEach(element => {
- let _effect = Laya.loader.getRes(element);
- Laya.loader.clearRes(element);
- this.LoadPoolRes(_effect.name, _effect);
- });
- let _enemy = Laya.loader.getRes(AssetPath.enemy_path);
- Laya.loader.clearRes(AssetPath.enemy_path);
- this.LoadPoolRes(_enemy.name, _enemy);
- let _playerbullet = Laya.loader.getRes(AssetPath.playerBullet_path);
- Laya.loader.clearRes(AssetPath.playerBullet_path);
- this.LoadPoolRes(_playerbullet.name, _playerbullet);
- let _tower = Laya.loader.getRes(AssetPath.tower_path);
- Laya.loader.clearRes(AssetPath.tower_path);
- this.LoadPoolRes(_tower.name, _tower);
- let _scene = Laya.loader.getRes(AssetPath.main_path);
- Laya.loader.clearRes(AssetPath.main_path);
- AssetPath.barrier_paths.forEach(element => {
- let _barrier = Laya.loader.getRes(element);
- Laya.loader.clearRes(element);
- this.LoadPoolRes(_barrier.name, _barrier);
- });
- Scene3DManager.Instance.Init(_scene);
- }
- LoadPoolRes(name, prefab) {
- GamePool.Instance.InitData(name, prefab);
- }
- static LoadResource(path, complet) {
- Laya.loader.retryNum = 2;
- Laya.loader.maxLoader = 3;
- Laya.loader.retryDelay = 100;
- Laya.loader.create(path, new Laya.Handler(this, complet));
- Laya.loader.on(Laya.Event.ERROR, this, (data) => {
- console.log(data + " 资源加载失败");
- });
- }
- }
- var Tween = Laya.Tween;
- class LoadView extends ui.LoadViewUI {
- constructor() {
- super();
- this.proCom = false;
- this.a = new Laya.Vector3();
- this.loadResCom = false;
- this.loginCom = false;
- this.errorTime = 0;
- this.timers = 0;
- this.subLoadCom = false;
- LoadView.instance = this;
- DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
- }
- static get Instance() {
- return LoadView.instance;
- }
- resizeHander() {
- this.height = Laya.stage.height;
- }
- OnShow(data) {
- this.proTex.text = "0%";
- this.pro1.width = 0;
- this.InitUi();
- this.LoginGame();
- this.LoadSubpackage();
- Laya.timer.frameOnce(5, this, () => {
- this.resizeHander();
- });
- WXSdk.AldEvent("进入加载加载界面!");
- }
- InitDate() {
- this.proLen = this.pro.width;
- }
- InitHandler() {
- }
- InitUi() {
- Tween.to(this.a, {
- x: 1, update: new Laya.Handler(this, () => {
- var num = this.a.x;
- this.pro1.width = this.proLen * num;
- num = num * 100;
- this.proTex.text = Math.ceil(num) + "%";
- })
- }, 1500, Laya.Ease.quadInOut, new Laya.Handler(this, () => {
- this.proTex.text = "100%";
- this.pro1.width = this.proLen;
- this.proCom = true;
- this.AllCom();
- }));
- }
- LoadRes() {
- if (this.subLoadCom && this.loginCom) {
- AssetController.Instance.LoadAsset(() => {
- WXSdk.AldEvent("资源加载成功");
- this.loadResCom = true;
- this.AllCom();
- });
- }
- }
- LoginGame() {
- if (GameSetting.isWx) {
- WXSdk.Login((data) => {
- this.onWxLoginHandler(data);
- });
- }
- else {
- this.LocalLogin();
- }
- }
- onWxLoginHandler(params) {
- console.log("微信回调成功!");
- console.log(params);
- if (params == "error" || params.code == null) {
- if (this.errorTime == 0) {
- WXSdk.AldEvent("微信登录失败");
- }
- this.errorTime++;
- if (this.errorTime >= 3)
- return;
- WXSdk.Login((data) => {
- this.onWxLoginHandler(data);
- });
- }
- else {
- if (this.errorTime == 0) {
- WXSdk.AldEvent("微信登录成功!");
- }
- let systemInfo = WXSdk.SystemInfo();
- let platformModel = "ipx";
- if (systemInfo != null) {
- var model = systemInfo.model;
- platformModel = `${systemInfo.brand}_${model}_${systemInfo.system}_wx${systemInfo.version}_SDKVer${systemInfo.SDKVersion}`;
- console.log("platformModel:" + platformModel);
- }
- new UserModel(params.code, params.nickName, params.avatarUrl, params.gender, params.country, params.province, params.city, platformModel, WXSdk.ShareId, WXSdk.Chanel);
- this.LocalLogin();
- }
- }
- LocalLogin() {
- NetManager.Instance.login(null, (data) => {
- this.OnLoginComplete(data);
- }, (data) => {
- this.OnLoginError(data);
- });
- }
- OnLoginComplete(data) {
- if (data["code"] != "0") {
- console.log("登录异常错误!");
- WXSdk.AldEvent("本地登录成功!");
- this.timers++;
- if (this.timers >= 4)
- return;
- if (GameSetting.isWx) {
- WXSdk.Login((data) => {
- this.onWxLoginHandler(data);
- });
- }
- else {
- this.LocalLogin();
- }
- }
- else {
- this.loginCom = true;
- this.LoadRes();
- this.AllCom();
- }
- }
- OnLoginError(data) {
- console.log("登录错误");
- WXSdk.AldEvent("本地登陆失败");
- }
- LoadSubpackage() {
- WXSdk.LoadSubPackage("subpackage", (com) => {
- if (com) {
- console.log("subpackage com++++++++++++++++");
- LoadView.instance.subLoadCom = true;
- WXSdk.LoadSubPackage("subpackage1");
- LoadView.instance.LoadRes();
- }
- });
- }
- AllCom() {
- if (this.proCom && this.loadResCom && this.loginCom) {
- BannerAndVideo1.InitVideo();
- Laya.timer.once(1000, this, () => {
- WXSdk.AldEvent("进入主界面");
- ViewManager.Instance.OpenView(ViewType.MainView);
- MouseEvent.Instance.InitMouseEvent();
- ShareModule.OnShowHandle();
- SettingController.Instance.Init();
- OnHideHandler.Reg();
- SettingController.Instance._playMusic();
- });
- }
- }
- OnClose() {
- LoadView.instance = null;
- DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
- }
- }
- class MainView extends ui.MainViewUI {
- constructor() {
- super();
- this.isTryed = false;
- MainView.instance = this;
- this.resizeHander();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
- }
- static get Instance() {
- return MainView.instance;
- }
- OnShow(data) {
- this.InitDate();
- this.InitHandler();
- this.InitUi();
- if (GuideController.Instance.IsGuide()) {
- this.mainBox.visible = false;
- }
- }
- resizeHander() {
- this.height = Laya.stage.height;
- }
- InitUi() {
- this.user_id.text = "user_id:" + UserModel.Instance.CurModel.m_userid;
- this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- this.SetStage();
- this.SetStagePro(0);
- this.SetSettingBox(false);
- }
- InitDate() {
- this.GetImage();
- this.coinFollow = new FollowNumber(0.1, 0, 0, 0.1);
- this.proWidth = this.pro.width;
- this.isTryed = false;
- }
- AdaptiveUI() {
- }
- moreFunc(ist) {
- if (ist) ;
- else {
- console.log("mainui");
- }
- }
- InitHandler() {
- this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame);
- this.settingBtn.CZ = () => {
- this.SetSettingBox();
- };
- this.moreGameBtn.clickHandler = new Laya.Handler(this, () => {
- });
- this.coutiBtn.clickHandler = new Laya.Handler(this, () => {
- });
- this.skinBtn.CZ = () => {
- ViewManager.Instance.AddView(ViewType.SKinShopView);
- };
- this.updateBtn.CZ = () => {
- ViewManager.Instance.AddView(ViewType.IntensifyView);
- };
- DispatcherManager.on(EventType.Event.ShowMainUi, this, this.ShowMainBox);
- DispatcherManager.on(EventType.Event.SetMonery, this, this.SetPlayerGrade);
- DispatcherManager.on(EventType.Event.SetStage, this, this.SetStage);
- DispatcherManager.on(EventType.Event.SetStagePro, this, this.SetStagePro);
- this.sound_btn.clickHandler = new Laya.Handler(this, () => {
- this.SoundSetting();
- });
- this.shake_btn.clickHandler = new Laya.Handler(this, () => {
- this.ShakeSetting();
- });
- }
- SetStage() {
- this.stageValue.text = PlayerManager.Instance.stage.toString();
- }
- SetStagePro(value) {
- value = value >= 1 ? 1 : value;
- this.pro1.width = this.proWidth * value;
- }
- SetPlayerGrade(num) {
- this.tempTarGrade = num;
- this.coinFollow.target = num;
- Laya.timer.frameLoop(1, this, this.T2);
- }
- T2() {
- this.coinFollow.update();
- let v = Math.ceil(this.coinFollow.follow);
- this.countValue.text = v.toString();
- if (v >= this.tempTarGrade) {
- this.countValue.text = this.tempTarGrade.toString();
- Laya.timer.clear(this, this.T2);
- }
- }
- StartGame(e) {
- if (this.isTryed) {
- this.TryStartGame();
- return;
- }
- if (e.target instanceof Laya.UIComponent) {
- if (e.target.name != "mainBox")
- return;
- }
- console.log("click");
- let param = [{ "t": UserModel.Instance.CurModel.ServerTime }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Start, param, (data) => {
- if (data["play_id"]) {
- PlayerManager.Instance.Play_Id = data["play_id"];
- }
- WXSdk.Start(PlayerManager.Instance.stage.toString());
- if (PlayerManager.Instance.stage >= 3) {
- ViewManager.Instance.AddView(ViewType.TrialView);
- }
- else {
- this.MainStartGame();
- }
- }, (data) => {
- });
- }
- MainStartGame() {
- this.mainBox.visible = false;
- this.sliderBox.visible = false;
- this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
- this.gameStart.stop();
- GameManager.Instance.GameStart();
- MouseEvent.Instance.StartGameClick();
- MainRoleManager.Instance.StartGame();
- MateManager.Instance.TryOutFriendPlayAni();
- StreetManager.Instance.SetBlock();
- GuideController.Instance.StartGuide();
- }
- TryStartGame() {
- this.sliderBox.visible = false;
- this.gameStart.stop();
- this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
- GameManager.Instance.GameStart();
- MouseEvent.Instance.StartGameClick();
- MainRoleManager.Instance.StartGame();
- MateManager.Instance.TryOutFriendPlayAni();
- StreetManager.Instance.SetBlock();
- }
- TryClick() {
- this.isTryed = true;
- this.mainBox.visible = false;
- }
- ShowMainBox() {
- this.mainBox.visible = true;
- this.sliderBox.visible = true;
- this.gameStart.play(0, true);
- this.SetPlayerGrade(UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- this.isTryed = false;
- this.on(Laya.Event.MOUSE_DOWN, this, this.StartGame);
- }
- SetSettingBox(ist = true) {
- if (!ist) {
- this.settingBox.visible = false;
- return;
- }
- this.settingBox.visible = !this.settingBox.visible;
- }
- GetImage() {
- this.sound_open = this.sound_btn.getChildByName("kai");
- this.sound_guan = this.sound_btn.getChildByName("guan");
- this.shake_open = this.shake_btn.getChildByName("kai");
- this.shake_guan = this.shake_btn.getChildByName("guan");
- this.SoundShow(SettingController.Instance.sound);
- this.ShakeShow(SettingController.Instance.vibrate);
- }
- SoundSetting() {
- SettingController.Instance.sound = !SettingController.Instance.sound;
- this.SoundShow(SettingController.Instance.sound);
- }
- SoundShow(isshow) {
- if (!isshow) {
- this.sound_open.visible = false;
- this.sound_guan.visible = true;
- SettingController.Instance.SettingSound(0);
- Laya.LocalStorage.setItem("sound", "0");
- console.log("关闭声音");
- }
- else {
- this.sound_open.visible = true;
- this.sound_guan.visible = false;
- SettingController.Instance.SettingSound(1);
- Laya.LocalStorage.setItem("sound", "1");
- console.log("开启声音");
- }
- }
- ShakeSetting() {
- SettingController.Instance.vibrate = !SettingController.Instance.vibrate;
- this.ShakeShow(SettingController.Instance.vibrate);
- }
- ShakeShow(isshow) {
- if (!isshow) {
- this.shake_open.visible = false;
- this.shake_guan.visible = true;
- Laya.LocalStorage.setItem("vibrate", "0");
- console.log("关闭震动");
- }
- else {
- this.shake_open.visible = true;
- this.shake_guan.visible = false;
- Laya.LocalStorage.setItem("vibrate", "1");
- console.log("开启震动");
- }
- }
- OnClose() {
- this.off(Laya.Event.MOUSE_DOWN, this, this.StartGame);
- DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
- DispatcherManager.off(EventType.Event.ShowMainUi, this, this.ShowMainBox);
- DispatcherManager.off(EventType.Event.SetMonery, this, this.SetPlayerGrade);
- DispatcherManager.off(EventType.Event.SetStage, this, this.SetStage);
- DispatcherManager.off(EventType.Event.SetStagePro, this, this.SetStagePro);
- MainView.instance = null;
- Laya.timer.clearAll(this);
- }
- }
- class ShadeView extends ui.ShadeViewUI {
- constructor() {
- super();
- this.resizeHander();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
- }
- OnShow(data) {
- this.InitHandler();
- }
- InitUi() {
- }
- InitDate() {
- }
- InitHandler() {
- this.on(Laya.Event.CLICK, this, this.Test);
- }
- Test() {
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
- this.off(Laya.Event.CLICK, this, this.Test);
- }
- resizeHander() {
- this.height = Laya.stage.height;
- }
- }
- class CompleteView extends ui.CompleteViewUI {
- constructor() {
- super();
- this.isWin = false;
- CompleteView.instance = this;
- this.resizeHander();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
- }
- static get Instance() {
- return CompleteView.instance;
- }
- OnShow(data) {
- this.isWin = data;
- this.InitDate();
- this.InitHandler();
- this.InitUi();
- BannerAndVideo1.CheatBanner(this.winbtnBox);
- }
- BannerMove() {
- }
- resizeHander() {
- this.height = Laya.stage.height;
- }
- InitDate() {
- this.coinValue = this.isWin == true ? LevelController.Instance._level.gold : LevelController.Instance._level.fail_gold;
- this.tes1 = this.coinValue;
- this.coinValue += (PlayerManager.tower_reward * GameManager.Instance.towerCount + PlayerManager.enemy_reward * GameManager.Instance.roleCount + PlayerManager.block_reward * GameManager.Instance.blockCount);
- let iswin = this.isWin == true ? 1 : 0;
- let count = this.coinValue;
- let param = [{ "t": UserModel.Instance.CurModel.ServerTime }, { "play_id": PlayerManager.Instance.Play_Id }, { "win": iswin }, { "money": count }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.GameResult, param, (data) => {
- }, (data) => {
- ViewManager.Instance.ShowTips("结算失败");
- });
- if (this.isWin) {
- SettingController.Instance.PlaySound(SoundType.win);
- WXSdk.Success(PlayerManager.Instance.stage.toString());
- }
- else {
- SettingController.Instance.PlaySound(SoundType.defeat);
- WXSdk.Fail(PlayerManager.Instance.stage.toString());
- }
- }
- InitHandler() {
- this.doublegetBtn.CZ = () => {
- this.DoubleGetHandler();
- };
- this.nextBtn.CZ = () => {
- if (this.isWin) {
- this.NextHandler();
- }
- else {
- this.ResetHandler();
- }
- };
- }
- InitUi() {
- this.winTop.visible = this.isWin;
- this.shibaiTop.visible = !this.isWin;
- this.valueText.text = "+" + this.coinValue;
- this.doubleText.text = (this.coinValue * 3).toString();
- this.towerCount.text = "X" + GameManager.Instance.towerCount.toString();
- this.towerValue.text = (PlayerManager.tower_reward * GameManager.Instance.towerCount).toString();
- this.roleCount.text = "X" + GameManager.Instance.roleCount.toString();
- this.roleValue.text = (PlayerManager.enemy_reward * GameManager.Instance.roleCount).toString();
- this.blockCount.text = "X" + GameManager.Instance.blockCount.toString();
- this.blockValue.text = (PlayerManager.block_reward * GameManager.Instance.blockCount).toString();
- }
- DoubleGetHandler() {
- BannerAndVideo1.ShowVideo((isok) => {
- if (isok) {
- WXSdk.AldEvent("结束界面看视屏获得钱");
- var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.coinValue * 2).toString() }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
- ViewManager.Instance.ShowTips("金币:X" + (this.coinValue * 3));
- this.NextHandler();
- }, (data) => {
- });
- }
- });
- }
- NextHandler() {
- GameManager.Instance.NextLevel();
- }
- ResetHandler() {
- ViewManager.Instance.CloseView(ViewType.CompleteView);
- ViewManager.Instance.AddView(ViewType.AttributeUpView);
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
- CompleteView.instance = null;
- Laya.timer.clearAll(this);
- BannerAndVideo1.Clear();
- }
- }
- class InGameView extends ui.InGameViewUI {
- static get Instance() {
- return InGameView.instance;
- }
- constructor() {
- super();
- InGameView.instance = this;
- this.resizeHander();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
- }
- OnShow(data) {
- this.InitDate();
- this.InitHandler();
- this.InitUi();
- }
- resizeHander() {
- this.height = Laya.stage.height;
- }
- InitDate() {
- }
- InitHandler() {
- }
- InitUi() {
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
- InGameView.instance = null;
- Laya.timer.clearAll(this);
- }
- }
- class IntensifyView extends ui.IntensifyViewUI {
- constructor() {
- super();
- this.iscoinShowfreecoinbtn = false;
- this.resizeHander();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
- }
- OnShow(data) {
- this.InitDate();
- this.InitHandler();
- this.InitUi();
- BannerAndVideo1.CheatBanner(null);
- }
- InitUi() {
- this.SetUi();
- this.RefreshCoinShow();
- let t = this.cost1 < this.cost2 ? this.cost1 : this.cost2;
- this.freecoinValue = Math.floor(t * 1.2);
- this.coinValue.text = this.freecoinValue.toString();
- }
- SetUi() {
- this.atkLv.text = "LV" + this.tempPowerLevel;
- let al = CfgManager.Instance._atk.length;
- let t = this.tempPowerLevel > al ? al : this.tempPowerLevel;
- this.cost1 = CfgManager.Instance.GetAtk(t)["cost"];
- this.atkValue.text = this.cost1.toString();
- this.rateLv.text = "LV" + this.tempRateLevel;
- let al1 = CfgManager.Instance._rate.length;
- let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel;
- this.cost2 = CfgManager.Instance.GetRate(t1)["cost"];
- this.rateValue.text = this.cost2.toString();
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
- this.atkBtn.gray = true;
- this.atkBtn.mouseEnabled = false;
- }
- else {
- this.atkBtn.gray = false;
- this.atkBtn.mouseEnabled = true;
- }
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
- this.rateBtn.gray = true;
- this.rateBtn.mouseEnabled = false;
- }
- else {
- this.rateBtn.gray = false;
- this.rateBtn.mouseEnabled = true;
- }
- }
- InitDate() {
- this.tempPowerLevel = PlayerManager.Instance.powerLevel;
- this.tempRateLevel = PlayerManager.Instance.rateLevel;
- this.RefreshData();
- }
- RefreshData() {
- let detail = UserModel.Instance.CurModel.user_video.detail;
- if (!detail)
- this.iscoinShowfreecoinbtn = true;
- else {
- let freet = detail.freecoin;
- if (!freet) {
- this.iscoinShowfreecoinbtn = true;
- return;
- }
- if (freet < AppSetting.freeGetcoinTime) {
- this.iscoinShowfreecoinbtn = true;
- return;
- }
- this.iscoinShowfreecoinbtn = false;
- }
- }
- RefreshCoinShow() {
- if (this.iscoinShowfreecoinbtn) {
- this.coinBtn.gray = false;
- this.coinBtn.mouseEnabled = true;
- }
- else {
- this.coinBtn.gray = true;
- this.coinBtn.mouseEnabled = false;
- }
- }
- InitHandler() {
- this.backBtn.CZ = () => {
- ViewManager.Instance.CloseView(ViewType.IntensifyView);
- };
- this.atkBtn.clickHandler = new Laya.Handler(this, this.AtkBtnHandler);
- this.rateBtn.clickHandler = new Laya.Handler(this, this.RateBtnHandler);
- this.coinBtn.clickHandler = new Laya.Handler(this, this.CoinBtnHandler);
- }
- AtkBtnHandler() {
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
- ViewManager.Instance.ShowTips("金币不足!", 1);
- return;
- }
- PlayerManager.Instance.GradePower(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => {
- if (iscom) {
- WXSdk.AldEvent("升级界面花钱升级攻击力");
- this.tempPowerLevel++;
- this.SetUi();
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- }
- });
- }
- RateBtnHandler() {
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
- ViewManager.Instance.ShowTips("金币不足!", 1);
- return;
- }
- PlayerManager.Instance.GradeRate(this.tempRateLevel + 1, "money", this.cost2, (iscom) => {
- if (iscom) {
- WXSdk.AldEvent("升级界面花钱升级速度");
- this.tempRateLevel++;
- this.SetUi();
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- }
- });
- }
- CoinBtnHandler() {
- BannerAndVideo1.ShowVideo((isok) => {
- if (isok) {
- var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "reward_item": "1000" }, { "reward_num": (this.freecoinValue).toString() }, { "channel": "video:freecoin" }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Fissionvd, param, (data) => {
- WXSdk.AldEvent("升级界面看视屏获得钱");
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- this.RefreshData();
- this.RefreshCoinShow();
- }, (data) => {
- });
- }
- });
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
- if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
- PlayerManager.Instance.SetArr();
- }
- BannerAndVideo1.Clear();
- }
- resizeHander() {
- this.height = Laya.stage.height;
- }
- }
- class AttributeUpView extends ui.AttributeUpViewUI {
- constructor() {
- super();
- this.iscanShowVideoBtn = true;
- this.isatkvideo = false;
- this.isfirstatkvideo = true;
- this.isfirstratevideo = true;
- this.isratevideo = false;
- this.atkShow = false;
- this.resizeHander();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
- }
- OnShow(data) {
- this.InitDate();
- this.InitHandler();
- this.InitUi();
- BannerAndVideo1.CheatBanner(null);
- }
- InitUi() {
- this.SetUi();
- }
- SetUi() {
- this.atkLv.text = "LV" + this.tempPowerLevel;
- let al = CfgManager.Instance._atk.length;
- let t = this.tempPowerLevel > al ? al : this.tempPowerLevel;
- this.cost1 = CfgManager.Instance.GetAtk(t)["cost"];
- this.atkValue.text = this.cost1.toString();
- this.rateLv.text = "LV" + this.tempRateLevel;
- let al1 = CfgManager.Instance._rate.length;
- let t1 = this.tempRateLevel > al1 ? al1 : this.tempRateLevel;
- this.cost2 = CfgManager.Instance.GetRate(t1)["cost"];
- this.rateValue.text = this.cost2.toString();
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost1) {
- if (this.iscanShowVideoBtn && this.isfirstatkvideo) {
- this.isatkvideo = true;
- this._atk.visible = false;
- this._atkVideo.visible = true;
- this.atkBtn.mouseEnabled = true;
- this.atkBtn.gray = false;
- this.click1.visible = true;
- this.atkShow = true;
- }
- else {
- this.atkBtn.mouseEnabled = false;
- this.atkBtn.gray = true;
- this.isatkvideo = false;
- this.click1.visible = false;
- this.atkShow = false;
- }
- }
- else {
- this._atk.visible = true;
- this._atkVideo.visible = false;
- this.atkBtn.gray = false;
- this.atkBtn.mouseEnabled = true;
- this.isatkvideo = false;
- this.click1.visible = true;
- this.atkShow = true;
- }
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.cost2) {
- if (this.iscanShowVideoBtn && this.isfirstratevideo) {
- this.isratevideo = true;
- this._rate.visible = false;
- this._rateVideo.visible = true;
- this.rateBtn.mouseEnabled = true;
- this.rateBtn.gray = false;
- if (this.atkShow)
- this.click2.visible = false;
- else
- this.click2.visible = true;
- }
- else {
- this.rateBtn.mouseEnabled = false;
- this.rateBtn.gray = true;
- this.isratevideo = false;
- this.click2.visible = false;
- }
- }
- else {
- this._rate.visible = true;
- this._rateVideo.visible = false;
- this.rateBtn.gray = false;
- this.rateBtn.mouseEnabled = true;
- this.isratevideo = false;
- if (this.atkShow)
- this.click2.visible = false;
- else
- this.click2.visible = true;
- }
- }
- InitDate() {
- this.tempPowerLevel = PlayerManager.Instance.powerLevel;
- this.tempRateLevel = PlayerManager.Instance.rateLevel;
- let detail = UserModel.Instance.CurModel.user_video.detail;
- if (!detail)
- this.iscanShowVideoBtn = true;
- else {
- let freet = detail.free;
- if (!freet) {
- this.iscanShowVideoBtn = true;
- return;
- }
- if (freet < AppSetting.freeUpdateVideotime) {
- this.iscanShowVideoBtn = true;
- return;
- }
- {
- this.iscanShowVideoBtn = false;
- }
- }
- }
- InitHandler() {
- this.backBtn.CZ = () => {
- this.BackClickHandler();
- };
- this.atkBtn.clickHandler = new Laya.Handler(this, this.AtkBtnHandler);
- this.rateBtn.clickHandler = new Laya.Handler(this, this.RateBtnHandler);
- }
- AtkBtnHandler() {
- if (this.isatkvideo) {
- BannerAndVideo1.ShowVideo((iscom) => {
- if (iscom) {
- PlayerManager.Instance.GradePower(this.tempPowerLevel + 1, "video:free", this.cost1, (iscom) => {
- if (iscom) {
- WXSdk.AldEvent("失败界面看视屏升级攻击力");
- this.tempPowerLevel++;
- this.isfirstatkvideo = false;
- this.SetUi();
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- }
- });
- }
- });
- }
- else {
- PlayerManager.Instance.GradePower(this.tempPowerLevel + 1, "money", this.cost1, (iscom) => {
- if (iscom) {
- WXSdk.AldEvent("失败界面花钱升级攻击力");
- this.tempPowerLevel++;
- this.SetUi();
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- }
- });
- }
- }
- RateBtnHandler() {
- if (this.isratevideo) {
- BannerAndVideo1.ShowVideo((iscom) => {
- if (iscom) {
- PlayerManager.Instance.GradeRate(this.tempRateLevel + 1, "video:free", this.cost2, (iscom) => {
- if (iscom) {
- WXSdk.AldEvent("失败界面看视屏升级速度");
- this.tempRateLevel++;
- this.isfirstratevideo = false;
- this.SetUi();
- }
- });
- }
- });
- }
- else {
- PlayerManager.Instance.GradeRate(this.tempRateLevel + 1, "money", this.cost2, (iscom) => {
- if (iscom) {
- WXSdk.AldEvent("失败界面花钱升级速度");
- this.tempRateLevel++;
- this.SetUi();
- }
- });
- }
- }
- BackClickHandler() {
- ViewManager.Instance.CloseView(ViewType.AttributeUpView);
- GameManager.Instance.ReStart();
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
- if (this.tempPowerLevel != PlayerManager.Instance.powerLevel || this.tempRateLevel != PlayerManager.Instance.rateLevel) {
- PlayerManager.Instance.SetArr();
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- }
- BannerAndVideo1.Clear();
- }
- resizeHander() {
- this.height = Laya.stage.height;
- }
- }
- var Vector3$7 = Laya.Vector3;
- class DisplayerCarController {
- static get Instance() {
- return DisplayerCarController.instance || (DisplayerCarController.instance = new DisplayerCarController());
- }
- InitDis(par) {
- if (!this._scene) {
- this._scene = new Laya.Scene3D();
- this._camera = new Laya.Camera();
- this._camera.enableHDR = false;
- this._scene.addChild(this._camera);
- this._light = new Laya.DirectionLight();
- this._light.transform.rotation = new Laya.Quaternion(-0.24776, 0, 0, 0.9688215);
- this._light.intensity = 0.45;
- this._light.color = new Vector3$7(1, 1, 1);
- this._scene.addChild(this._light);
- let or = 1;
- this._camera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or);
- this._camera.orthographic = false;
- this._camera.enableHDR = false;
- this._camera.clearFlag = 2;
- this._camera.fieldOfView = 60;
- this._camera.transform.position = new Vector3$7(0, 1.52, 3.12);
- this._camera.transform.rotation = new Laya.Quaternion(0, 0, 0, 1);
- }
- let or = 1;
- this._camera.viewport = new Laya.Viewport(par.x * or, par.y * or, par.width * or, par.height * or);
- par.addChild(this._scene);
- this.CreatePlayer();
- }
- CreatePlayer(id) {
- if (!id)
- id = PlayerManager.Instance.equipId;
- if (!this.player) {
- let p = GamePool.Instance.SetActiveObject(GamePool.pooltype.player + id);
- if (p)
- this.player = p;
- this._scene.addChild(this.player);
- this.player.transform.localPosition = Mathf.VecZero;
- this.player.transform.localRotationEuler = Mathf.VecZero;
- }
- else {
- GamePool.Instance.SetDisableObject(this.player);
- let p = GamePool.Instance.SetActiveObject(GamePool.pooltype.player + id);
- if (p)
- this.player = p;
- this._scene.addChild(this.player);
- this.player.transform.localPosition = Mathf.VecZero;
- this.player.transform.localRotationEuler = Mathf.VecZero;
- }
- let anima = this.player.getChildAt(0).getComponent(Laya.Animator);
- anima.play(MusicType.Dance);
- anima.speed = 1;
- }
- Reset() {
- if (this._scene) {
- this._scene.removeSelf();
- }
- if (this.player) {
- GamePool.Instance.SetDisableObject(this.player);
- this.player = null;
- }
- }
- }
- class SKinShopView extends ui.SkinShopViewUI {
- static get Instance() {
- return SKinShopView.instance;
- }
- constructor() {
- super();
- SKinShopView.instance = this;
- this.resizeHander();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
- }
- resizeHander() {
- this.height = Laya.stage.height;
- }
- OnShow(data) {
- this.InitDate();
- this.InitHandler();
- this.InitUi();
- WXSdk.AldEvent("打开皮肤界面");
- }
- InitDate() {
- this.oignPlayerid = PlayerManager.Instance.equipId;
- this.operateIndex = this.oignPlayerid;
- }
- InitUi(data) {
- this.SetShowbtn(this.operateIndex);
- this.SetUseBtn(this.operateIndex);
- DisplayerCarController.Instance.InitDis(this.viewPort);
- }
- InitHandler() {
- this.backBtn.CZ = () => {
- this.BackHandler();
- };
- this.leftBtn.clickHandler = Laya.Handler.create(this, () => {
- if (this.operateIndex == 1)
- return;
- this.operateIndex--;
- this.SetShowbtn(this.operateIndex);
- this.SetUseBtn(this.operateIndex);
- DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
- }, null, false);
- this.rightBtn.clickHandler = Laya.Handler.create(this, () => {
- if (this.operateIndex == 7)
- return;
- this.operateIndex++;
- this.SetShowbtn(this.operateIndex);
- this.SetUseBtn(this.operateIndex);
- DisplayerCarController.Instance.CreatePlayer(this.operateIndex);
- }, null, false);
- this.use.CZ = () => {
- this.NetEquip();
- };
- this.coin.CZ = () => {
- if (UserModel.Instance.CurModel.GetUserAttr(UserAttr.money) < this.coinValue)
- ViewManager.Instance.ShowTips("金币不足!", 2);
- else
- this.NetBuy();
- };
- this.video.CZ = () => {
- this.VideoBtnHandler();
- };
- }
- SetShowbtn(index) {
- if (index == 1) {
- this.leftBtn.getChildByName("leftFalse").visible = true;
- this.leftBtn.getChildByName("leftTrue").visible = false;
- this.rightBtn.getChildByName("rightFalse").visible = false;
- this.rightBtn.getChildByName("rightTrue").visible = true;
- return;
- }
- if (index == 7) {
- this.leftBtn.getChildByName("leftFalse").visible = false;
- this.leftBtn.getChildByName("leftTrue").visible = true;
- this.rightBtn.getChildByName("rightFalse").visible = true;
- this.rightBtn.getChildByName("rightTrue").visible = false;
- return;
- }
- this.leftBtn.getChildByName("leftFalse").visible = false;
- this.leftBtn.getChildByName("leftTrue").visible = true;
- this.rightBtn.getChildByName("rightFalse").visible = false;
- this.rightBtn.getChildByName("rightTrue").visible = true;
- }
- SetUseBtn(index) {
- if (PlayerManager.Instance.equipId == index) {
- this.using.visible = true;
- this.use.visible = false;
- this.coin.visible = false;
- this.video.visible = false;
- return;
- }
- if (UserModel.Instance.CurModel.HasTheme(index)) {
- this.using.visible = false;
- this.use.visible = true;
- this.coin.visible = false;
- this.video.visible = false;
- return;
- }
- let data = CfgManager.Instance.GetTheme(index);
- if (data.require_type == 2) {
- this.using.visible = false;
- this.use.visible = false;
- this.coin.visible = true;
- this.video.visible = false;
- this.coinValue = Number(data.require_num);
- this.coin.getChildAt(0).getChildAt(0).text = this.coinValue.toString();
- return;
- }
- if (data.require_type == 3) {
- this.using.visible = false;
- this.use.visible = false;
- this.coin.visible = false;
- this.video.visible = true;
- this.video.getChildAt(0).getChildAt(0).text = UserModel.Instance.CurModel.GetThemeProgress(data.id) + "/" + data.require_num;
- return;
- }
- }
- VideoBtnHandler() {
- BannerAndVideo1.ShowVideo((done) => {
- if (done) {
- WXSdk.AldEvent("商店中看视屏获得皮肤");
- this.NetVideo();
- }
- });
- }
- ;
- NetVideo() {
- var param = [{ "t": UserModel.Instance.CurModel.ServerTime.toString() }, { "id": this.operateIndex }, { "channel": "video" }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.themefission, param, (data) => {
- var usermodel = UserModel.Instance.CurModel;
- PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
- this.SetUseBtn(this.operateIndex);
- }, (data) => {
- });
- }
- NetBuy() {
- var param = [{ "id": this.operateIndex }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Buy, param, (data) => {
- var usermodel = UserModel.Instance.CurModel;
- PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
- DispatcherManager.event(EventType.Event.SetMonery, UserModel.Instance.CurModel.GetUserAttr(UserAttr.money));
- this.SetUseBtn(this.operateIndex);
- }, (data) => {
- });
- }
- NetEquip() {
- var param = [{ "id": this.operateIndex }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Equip, param, (data) => {
- var usermodel = UserModel.Instance.CurModel;
- PlayerManager.Instance.equipId = Number(usermodel.GetUserAttr(UserAttr.equip_themes)["1"]);
- this.SetUseBtn(this.operateIndex);
- }, (data) => {
- });
- }
- BackHandler() {
- DisplayerCarController.Instance.Reset();
- if (this.oignPlayerid != PlayerManager.Instance.equipId) {
- MainRoleManager.Instance.ChangePlayer();
- }
- ViewManager.Instance.CloseView(ViewType.SKinShopView);
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
- SKinShopView.instance = null;
- WXSdk.AldEvent("关闭皮肤界面");
- }
- }
- class TrialView extends ui.TrialViewUI {
- constructor() {
- super();
- this.resizeHander();
- DispatcherManager.on(Laya.Event.RESIZE, this, this.resizeHander);
- }
- OnShow(data) {
- this.InitHandler();
- this.InitDate();
- this.InitHandler();
- this.InitUi();
- BannerAndVideo1.CheatBanner(this.btnBox);
- }
- InitUi() {
- DisplayerCarController.Instance.InitDis(this.viewPort);
- }
- InitDate() {
- }
- InitHandler() {
- this.videoBtn.CZ = () => {
- this.VideoHandler();
- };
- this.backBtn.CZ = () => {
- DisplayerCarController.Instance.Reset();
- this.BackUi();
- };
- }
- VideoHandler() {
- BannerAndVideo1.ShowVideo((isok) => {
- if (isok) {
- WXSdk.AldEvent("看视屏试用");
- this.VideoCom();
- }
- });
- }
- VideoCom() {
- DisplayerCarController.Instance.Reset();
- this.BackUi();
- MateManager.Instance.CreateTryOut();
- }
- BackUi() {
- ViewManager.Instance.CloseView(ViewType.TrialView);
- if (MainView.Instance)
- MainView.Instance.TryClick();
- }
- OnClose() {
- DispatcherManager.off(Laya.Event.RESIZE, this, this.resizeHander);
- BannerAndVideo1.Clear();
- }
- resizeHander() {
- this.height = Laya.stage.height;
- }
- }
- var ViewType;
- (function (ViewType) {
- ViewType[ViewType["InGameView"] = 0] = "InGameView";
- ViewType[ViewType["ShadeView"] = 1] = "ShadeView";
- ViewType[ViewType["CompleteView"] = 2] = "CompleteView";
- ViewType[ViewType["LoadView"] = 3] = "LoadView";
- ViewType[ViewType["MainView"] = 4] = "MainView";
- ViewType[ViewType["SettingUi"] = 5] = "SettingUi";
- ViewType[ViewType["SKinShopView"] = 6] = "SKinShopView";
- ViewType[ViewType["TrialView"] = 7] = "TrialView";
- ViewType[ViewType["IntensifyView"] = 8] = "IntensifyView";
- ViewType[ViewType["AttributeUpView"] = 9] = "AttributeUpView";
- })(ViewType || (ViewType = {}));
- class ViewManager {
- constructor() {
- this.viewDic = [];
- this.addViewDic = new Dictionary();
- this._maskCnt = 0;
- this.init();
- }
- static get Instance() {
- return this.instance || (this.instance = new ViewManager());
- }
- init() {
- this._maskCnt = 0;
- this.viewDic[ViewType.InGameView] = InGameView;
- this.viewDic[ViewType.LoadView] = LoadView;
- this.viewDic[ViewType.MainView] = MainView;
- this.viewDic[ViewType.ShadeView] = ShadeView;
- this.viewDic[ViewType.IntensifyView] = IntensifyView;
- this.viewDic[ViewType.CompleteView] = CompleteView;
- this.viewDic[ViewType.SKinShopView] = SKinShopView;
- this.viewDic[ViewType.TrialView] = TrialView;
- this.viewDic[ViewType.AttributeUpView] = AttributeUpView;
- this.uiNode = new Laya.Sprite();
- this.popNode = new Laya.Sprite();
- Laya.stage.addChild(this.uiNode);
- Laya.stage.addChild(this.popNode);
- this.uiNode.zOrder = 3;
- this.popNode.zOrder = 4;
- }
- OpenView(view, data) {
- if (this.curView != null) {
- this.curView.OnClose();
- this.uiNode.removeChild(this.curView);
- this.curView.destroy(true);
- this.curView = null;
- }
- this.curView = new this.viewDic[view];
- this.uiNode.addChild(this.curView);
- this.curView.OnShow(data);
- }
- get getCurView() {
- return this.curView;
- }
- AddView(view, data) {
- if (this.addViewDic.has(view))
- return;
- let t_view = new this.viewDic[view];
- this.addViewDic.set(view, t_view);
- this.uiNode.addChild(t_view);
- t_view.OnShow(data);
- MouseEvent.Instance.CloseInput();
- }
- RemoveView() {
- if (this.curView != null) {
- this.curView.OnClose();
- this.uiNode.removeChild(this.curView);
- this.curView.destroy(true);
- this.curView = null;
- }
- }
- HaveView(view) {
- return this.addViewDic.has(view);
- }
- CloseView(view) {
- if (!this.addViewDic.has(view))
- return;
- let t_view = this.addViewDic.get(view);
- t_view.OnClose();
- this.uiNode.removeChild(t_view);
- t_view.destroy(true);
- this.addViewDic.delete(view);
- MouseEvent.Instance.OpenInput();
- }
- OpenMask() {
- this._maskCnt++;
- if (this._maskCnt > 1)
- return;
- if (this.curMask != null) {
- this.curMask.OnClose();
- this.popNode.removeChild(this.curView);
- this.curMask.destroy();
- this.curMask = null;
- return;
- }
- this.curMask = new this.viewDic[ViewType.ShadeView];
- if (!this.curMask)
- return;
- console.log("打开遮罩");
- this.popNode.addChild(this.curMask);
- this.curMask.OnShow();
- }
- CloseMask() {
- this._maskCnt--;
- if (this._maskCnt > 0)
- return;
- if (this.curMask != null) {
- this.curMask.OnClose();
- this.popNode.removeChild(this.curMask);
- this.curMask.destroy(true);
- console.log("关闭遮罩");
- this.curMask = null;
- }
- }
- ShowTips(value, type = 1) {
- var warn = GamePool.Instance.SetActiveForUi(PoolType.WarnTips);
- if (!warn)
- return;
- if (type == 1) {
- warn.y = 0;
- warn.text = value;
- warn.x = Laya.stage.width >> 1;
- this.popNode.addChild(warn);
- let _end = (Laya.stage.height >> 1) - 300;
- var tw = Laya.Tween.to(warn, { y: _end }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
- tw.clear();
- GamePool.Instance.SetDisableForUi(PoolType.WarnTips, warn);
- }));
- }
- else if (type == 2) {
- warn.y = Laya.stage.height - 400;
- warn.text = value;
- warn.x = Laya.stage.width >> 1;
- this.popNode.addChild(warn);
- var tw = Laya.Tween.to(warn, { alpha: 0 }, 1000, Laya.Ease.bounceOut, new Laya.Handler(this, () => {
- tw.clear();
- GamePool.Instance.SetDisableForUi(PoolType.WarnTips, warn);
- warn.alpha = 1;
- }));
- }
- }
- ShowGuideView() {
- if (!this.GuideView) {
- this.GuideView = new GuideView();
- this.popNode.addChild(this.GuideView);
- }
- this.GuideView.OnShow();
- }
- CloseGuideView() {
- if (this.GuideView) {
- this.GuideView.OnClose();
- this.GuideView.removeSelf();
- this.GuideView.destroy();
- }
- }
- }
- class ShareModule {
- static GoShare(callBack) {
- ShareModule.ShareTime = new Date().getTime();
- console.log("分享点击时间=" + ShareModule.ShareTime);
- ShareModule.IsSharing = true;
- ShareModule.callback = callBack;
- }
- static OnShowHandle() {
- if (Laya.Browser.window.wx) {
- Laya.Browser.window.wx.onShow(function (option) {
- SettingController.Instance.SetSoundV(1);
- console.log("onshow share start");
- console.log("进入微信");
- if (ShareModule.IsSharing) {
- ShareModule.IsSharing = false;
- let time = new Date().getTime();
- console.log("分享回到游戏时间" + time);
- let wait = (time - ShareModule.ShareTime) / 1000;
- console.log("分享停留时间为:" + wait);
- if (wait >= 2) {
- if (Math.random() <= 1) {
- if (!ShareModule.callback)
- return;
- ShareModule.callback(true, 1);
- }
- else {
- if (!ShareModule.callback)
- return;
- if (Math.random() <= 0.5) {
- ViewManager.Instance.ShowTips("分享失败!");
- }
- else {
- ViewManager.Instance.ShowTips("请分享到不同的群!");
- }
- ShareModule.callback(false, 1);
- }
- }
- else {
- if (!ShareModule.callback)
- return;
- if (Math.random() <= 0.5) {
- ViewManager.Instance.ShowTips("分享失败!");
- }
- else {
- ViewManager.Instance.ShowTips("请分享到不同的群!");
- }
- ShareModule.callback(false, 1);
- }
- }
- });
- }
- }
- }
- ShareModule.IsSharing = false;
- class OnHideHandler {
- static Reg() {
- }
- }
- var ALDType;
- (function (ALDType) {
- ALDType[ALDType["\u767B\u5F55\u52A0\u8F7D"] = 0] = "\u767B\u5F55\u52A0\u8F7D";
- ALDType[ALDType["\u754C\u9762\u5F00\u542F"] = 1] = "\u754C\u9762\u5F00\u542F";
- })(ALDType || (ALDType = {}));
- class WXSdk {
- static get ShareId() {
- return this.shareId;
- }
- static get Chanel() {
- return this._chanel;
- }
- static init(cb) {
- this.EventStatistics();
- Laya.Browser.window.wx.showShareMenu({
- withShareTicket: true
- });
- Laya.Browser.window.wx.onShow(this.InitWx);
- }
- static InitWx(option) {
- var shareid = option.query.share_id;
- this.shareId = shareid ? shareid : "";
- GameSetting.wxValue = option.scene;
- var scene = Laya.LocalStorage.getItem("scene");
- if (scene) {
- GameSetting.wxValue = scene;
- console.log("读取配置场景值:" + scene);
- }
- else {
- console.log("第一次拉取场景值:" + GameSetting.wxValue);
- Laya.LocalStorage.setItem("scene", GameSetting.wxValue);
- }
- var channel = option.query.channel;
- this._chanel = channel ? channel : "";
- Laya.Browser.window.wx.offShow(WXSdk.InitWx);
- }
- static ShareMessage() {
- if (!GameSetting.isWx)
- return;
- var t = UserModel.Instance.CurModel.ServerTime;
- var _title;
- var _url;
- _title = AppSetting.sharetitle;
- _url = AppSetting.shareimage;
- if (_title == null) {
- _title = "枪王之王...";
- _url = "res/share.png";
- }
- else {
- let a = GameTool.SpliteString(_title);
- let b = GameTool.SpliteString(_url);
- _title = a[GameTool.randomInt(0, a.length - 1)];
- _url = b[GameTool.randomInt(0, b.length - 1)];
- }
- console.log("_title:", _title);
- console.log("_url:", _url);
- Laya.Browser.window.wx.onShareAppMessage(() => ({
- title: _title,
- imageUrl: _url,
- query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_other_" + t + "_" + Math.floor(9999 * Math.random()).toString()
- }));
- }
- static Login(cb) {
- if (WXSdk.Lodining) {
- return;
- }
- WXSdk.Lodining = true;
- Laya.Browser.window.wx.login({
- success: function (res) {
- console.log("wx.login: success! res.code=" + res.code);
- if (res.code) {
- WXSdk.Lodining = false;
- console.log("将要传递的参数:" + res);
- cb(res);
- }
- else {
- console.log('获取用户登录态失败!' + res.errMsg);
- cb("error");
- }
- },
- fail: function (res) { console.log("wx.login: failed, res=" + res); WXSdk.Lodining = false; cb("error"); }
- });
- }
- static ShowLoading(title = "加载中...", isShowWx = true) {
- console.log(title);
- if (Laya.Browser.window && Laya.Browser.window.wx) {
- if (isShowWx) {
- Laya.Browser.window.wx.showLoading({ title: title, mask: true });
- }
- ViewManager.Instance.OpenMask();
- }
- else {
- ViewManager.Instance.OpenMask();
- }
- }
- static HideLoading(isShowWx = true) {
- if (Laya.Browser.window && Laya.Browser.window.wx) {
- if (isShowWx) {
- Laya.Browser.window.wx.hideLoading();
- }
- ViewManager.Instance.CloseMask();
- }
- else {
- ViewManager.Instance.CloseMask();
- }
- }
- static SystemInfo() {
- if (Laya.Browser.window.wx) {
- if (!WXSdk.sysdata)
- WXSdk.sysdata = Laya.Browser.window.wx.getSystemInfoSync();
- return WXSdk.sysdata;
- }
- }
- static ShowToast(text, icon = true) {
- if (Laya.Browser.window.wx) {
- var t_icon = icon ? "success" : "none";
- text = text ? text : "暂未开放...";
- Laya.Browser.window.wx.showToast({ title: text, icon: t_icon });
- }
- else {
- console.log(text);
- }
- }
- static ShortVibrate() {
- if (Laya.Browser.window.wx && SettingController.Instance.vibrate) {
- if (WXSdk.vibrating)
- return;
- WXSdk.vibrating = true;
- Laya.Browser.window.wx.vibrateShort({
- complete: function (res) {
- WXSdk.vibrating = false;
- }
- });
- }
- }
- static LongVibrate() {
- if (Laya.Browser.window.wx && SettingController.Instance.vibrate) {
- if (WXSdk.vibrating)
- return;
- WXSdk.vibrating = true;
- Laya.Browser.window.wx.vibrateLong({
- complete: function (res) {
- WXSdk.vibrating = false;
- }
- });
- }
- }
- static Success(stageId) {
- if (!GameSetting.isWx)
- return;
- Laya.Browser.window.wx.aldStage.onEnd({
- stageId: stageId,
- stageName: "第" + stageId + "关",
- event: "complete",
- params: {
- desc: "关卡完成"
- }
- });
- }
- static AldEvent(eventName, a) {
- if (Laya.Browser.window && Laya.Browser.window.wx) {
- Laya.Browser.window.wx.aldSendEvent(eventName, { key: "" });
- }
- }
- static EventStatistics() {
- let uuid = Laya.LocalStorage.getItem("uuidTimes");
- if (uuid) {
- let lastSignTime = new Date(Number(uuid));
- let todayZero = new Date(Laya.timer.currTimer);
- todayZero.setHours(0, 0, 0, 0);
- if (lastSignTime.valueOf() < todayZero.valueOf()) {
- this.IsNew = 0;
- }
- else {
- this.IsNew = 1;
- }
- }
- else {
- this.IsNew = 1;
- Laya.LocalStorage.setItem("uuidTimes", Laya.timer.currTimer.toString());
- }
- }
- static Fail(stageId) {
- if (!GameSetting.isWx)
- return;
- Laya.Browser.window.wx.aldStage.onEnd({
- stageId: stageId,
- stageName: "第" + stageId + "关",
- event: "fail",
- params: {
- desc: "关卡失败",
- }
- });
- }
- static Start(stageId) {
- if (!GameSetting.isWx)
- return;
- Laya.Browser.window.wx.aldStage.onStart({
- stageId: stageId,
- stageName: "第" + stageId + "关",
- });
- }
- static Game_Share(callback = null, channel = "") {
- if (!GameSetting.isWx) {
- return;
- }
- var _title;
- var _url;
- _title = AppSetting.sharetitle;
- _url = AppSetting.shareimage;
- if (_title == null) {
- _title = "枪王之王...";
- _url = "res/share.png";
- }
- else {
- let a = GameTool.SpliteString(_title);
- let b = GameTool.SpliteString(_url);
- _title = a[GameTool.randomInt(0, a.length - 1)];
- _url = b[GameTool.randomInt(0, b.length - 1)];
- }
- console.log("_title:", _title);
- console.log("_url:", _url);
- var t = UserModel.Instance.CurModel.ServerTime;
- Laya.Browser.window.wx.shareAppMessage({
- title: _title,
- imageUrl: _url,
- query: "share_id=" + UserModel.Instance.CurModel.m_userid + "_" + "other" + "_" + t + "_" + Math.floor(9999 * Math.random()).toString(),
- });
- ShareModule.GoShare(callback);
- }
- static LoadSubPackage(name, callback) {
- if (GameSetting.isWx) {
- const loadTask = Laya.Browser.window.wx.loadSubpackage({
- name: name,
- success(res) {
- console.log("分包下载成功:", res);
- if (callback)
- callback(true);
- },
- fail(res) {
- console.log("分包下载失败:" + JSON.stringify(res));
- if (callback)
- callback(false);
- }
- });
- }
- else {
- if (callback)
- callback(true);
- }
- }
- static IsNeedUpdate() {
- if (!GameSetting.isWx)
- return false;
- const updateManager = Laya.Browser.window.wx.getUpdateManager();
- updateManager.onCheckForUpdate(function (res) {
- console.log("最新版本:" + res.hasUpdate);
- });
- updateManager.onUpdateReady(function () {
- Laya.Browser.window.wx.showModal({
- showCancel: false,
- title: '更新提示',
- content: '新版本已经准备好,是否重启应用?',
- success(res) {
- updateManager.applyUpdate();
- },
- fail(res) {
- updateManager.applyUpdate();
- }
- });
- });
- }
- static IsAuth() {
- if (Laya.Browser.window && Laya.Browser.window.wx) {
- Laya.Browser.window.wx.getSetting({
- success: (res) => {
- console.log("授权结果..");
- console.log(res);
- if (res.authSetting['scope.userInfo'] == true) {
- WXSdk.isAuth = true;
- Laya.Browser.window.wx.getUserInfo({
- lang: 'zh_CN',
- success: (res) => {
- UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName;
- UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl;
- console.log("已经受过权");
- },
- fail: () => {
- console.log('调用getUserInfo fail');
- }
- });
- }
- }
- });
- }
- }
- static RequestAuth(callback) {
- if (WXSdk.isAuth) {
- if (callback != null) {
- callback(true);
- }
- return;
- }
- if (GameSetting.isWx) {
- console.log("-----授权");
- let openAuthView = () => {
- let w = Laya.stage.width;
- let h = Laya.stage.height;
- console.log("准备授权");
- let button = Laya.Browser.window.wx.createUserInfoButton({
- type: 'text',
- text: '',
- style: {
- left: 0,
- top: 0,
- width: w,
- height: h,
- lineHeight: 40,
- backgroundColor: '#00000000',
- textAlign: 'center',
- fontSize: 16,
- borderRadius: 4
- }
- });
- let opTapHandler = (res) => {
- console.log("res:" + JSON.stringify(res));
- if (res.userInfo) {
- button.hide();
- button.offTap(opTapHandler);
- button.destroy();
- console.log("userinfo", res);
- UserModel.Instance.CurModel.m_nickname = res.userInfo.nickName;
- UserModel.Instance.CurModel.m_avatar = res.userInfo.avatarUrl;
- let param = [{ "nickname": res.userInfo.nickName }, { "avatar": res.userInfo.avatarUrl }, { "gender": res.userInfo.gender }, { "city": res.userInfo.city },
- { "country": res.userInfo.country }, { "province": res.userInfo.province }];
- NetManager.Instance.HttpPostRequest(PROTOCOLS.protocols.Userauth, param, () => {
- WXSdk.isAuth = true;
- if (callback != null) {
- callback(true);
- }
- }, null);
- }
- else {
- button.hide();
- button.offTap(opTapHandler);
- button.destroy();
- if (callback != null) {
- callback(false);
- }
- }
- };
- button.show();
- button.onTap(opTapHandler);
- };
- openAuthView();
- }
- else {
- WXSdk.isAuth = true;
- if (callback != null) {
- callback(true);
- }
- }
- }
- static showbjWxGameQuan(flag) {
- if (!GameSetting.isWx) {
- return;
- }
- if (flag) {
- if (this.button == null) {
- let info = Laya.Browser.window.wx.getSystemInfoSync();
- if (!info)
- return;
- var top = 0.5 * info.windowHeight;
- var height = 109 * info.windowHeight / Laya.stage.height;
- var width = height * 80 / 109;
- Laya.stage.width;
- this.button = Laya.Browser.window.wx.createGameClubButton({
- type: "image",
- image: 'res/talk.png',
- style: {
- left: info.windowWidth * 0.5 + 150 * info.windowWidth / Laya.stage.width,
- top: top - 240 * info.windowHeight / Laya.stage.height,
- width: width,
- height: height
- }
- });
- }
- this.button.show();
- }
- else {
- if (this.button) {
- this.button.hide();
- }
- }
- }
- }
- WXSdk.Lodining = false;
- WXSdk.shareId = "";
- WXSdk._chanel = "";
- WXSdk.isAuth = false;
- WXSdk.vibrating = false;
- WXSdk.IsNew = 0;
- class Main {
- constructor() {
- window['Config3D'] && (window['Config3D']["_config"]["_defaultPhysicsMemory"] = 128);
- window['Config3D'] && (window['Config3D']["_config"]["isAntialias"] = true);
- if (window["Laya3D"])
- Laya3D.init(GameConfig.width, GameConfig.height);
- else
- Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]);
- Laya["Physics"] && Laya["Physics"].enable();
- Laya["DebugPanel"] && Laya["DebugPanel"].enable();
- Laya.stage.scaleMode = GameConfig.scaleMode;
- Laya.stage.screenMode = GameConfig.screenMode;
- Laya.stage.alignV = GameConfig.alignV;
- Laya.stage.alignH = GameConfig.alignH;
- Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson;
- if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true")
- Laya.enableDebugPanel();
- if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"])
- Laya["PhysicsDebugDraw"].enable();
- if (GameConfig.stat)
- Laya.Stat.show();
- Laya.alertGlobalError = true;
- GameSetting.isWx = Laya.Browser.onWeiXin;
- if (GameSetting.isWx) {
- WXSdk.init();
- }
- Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
- WXSdk.IsNeedUpdate();
- }
- onVersionLoaded() {
- Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
- Laya.MouseManager.multiTouchEnabled = false;
- }
- onConfigLoaded() {
- ViewManager.Instance.OpenView(ViewType.LoadView);
- GameSetting.isX = Laya.Browser.clientHeight / Laya.Browser.clientWidth > 2;
- }
- }
- new Main();
- }());
- //# sourceMappingURL=bundle.js.map
|