bundle.js 257 KB

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