bundle.js 187 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890
  1. (function () {
  2. 'use strict';
  3. class GameConfig {
  4. constructor() { }
  5. static init() {
  6. var reg = Laya.ClassUtils.regClass;
  7. }
  8. }
  9. GameConfig.width = 720;
  10. GameConfig.height = 1280;
  11. GameConfig.scaleMode = "fixedwidth";
  12. GameConfig.screenMode = "none";
  13. GameConfig.alignV = "top";
  14. GameConfig.alignH = "left";
  15. GameConfig.startScene = "LoadView.scene";
  16. GameConfig.sceneRoot = "";
  17. GameConfig.debug = false;
  18. GameConfig.stat = false;
  19. GameConfig.physicsDebug = false;
  20. GameConfig.exportSceneToJson = false;
  21. GameConfig.init();
  22. var Vector3 = Laya.Vector3;
  23. class faafssfafsa {
  24. constructor(_message, _pos, _size, _fontSize, _color = null) {
  25. this.fontSize = 30;
  26. this.message = "";
  27. this.size = new Laya.Vector2(_size.x, _size.y);
  28. this.fontSize = _fontSize;
  29. this.color = _color;
  30. this.message = _message;
  31. this.pos = _pos;
  32. }
  33. }
  34. class Transform3DHelper {
  35. static getForward(transform) {
  36. let forward = new Vector3();
  37. transform.getForward(forward);
  38. Laya.Vector3.scale(forward, -1, forward);
  39. Laya.Vector3.normalize(forward, forward);
  40. return forward;
  41. }
  42. }
  43. class GameTools {
  44. constructor() {
  45. GameTools.ins = this;
  46. }
  47. static get Instance() {
  48. if (GameTools.ins) {
  49. return GameTools.ins;
  50. }
  51. else {
  52. return new GameTools();
  53. }
  54. }
  55. lerp(form, to, t) {
  56. if (t <= 0) {
  57. return form;
  58. }
  59. else if (t >= 1) {
  60. return to;
  61. }
  62. var a = t * to + (1 - t) * form;
  63. return a;
  64. }
  65. SetCollider(setNode, CollisionGroup) {
  66. var numchild = setNode.numChildren;
  67. for (var i = 0; i < setNode.numChildren; i++) {
  68. var numchild2 = setNode.getChildAt(i).numChildren;
  69. if (numchild2 > 1) {
  70. this.SetCollider(setNode.getChildAt(i), CollisionGroup);
  71. }
  72. var physicsCollider = setNode.getChildAt(i).getComponent(Laya.PhysicsCollider);
  73. if (physicsCollider) {
  74. physicsCollider.collisionGroup = CollisionGroup;
  75. }
  76. }
  77. }
  78. EnemySetCollider(setNode, collisionGroup) {
  79. var collider = setNode.getChildByName("npcfrontcollider");
  80. var collider2 = setNode.getChildByName("npcrearcollider");
  81. var physicsCollider = collider.getComponent(Laya.PhysicsCollider);
  82. var physicsCollider2 = collider2.getComponent(Laya.PhysicsCollider);
  83. if (physicsCollider) {
  84. physicsCollider.collisionGroup = collisionGroup;
  85. }
  86. if (physicsCollider2) {
  87. physicsCollider2.collisionGroup = collisionGroup;
  88. }
  89. }
  90. PlayerSetCollider(setNode, collisionGroup) {
  91. var collider = setNode.getChildByName("playercollider");
  92. var physicsCollider = collider.getComponent(Laya.PhysicsCollider);
  93. if (physicsCollider) {
  94. physicsCollider.collisionGroup = collisionGroup;
  95. }
  96. }
  97. HostageSetCollider(setNode, collisionGroup) {
  98. var collider = setNode.getChildByName("hostagecollider");
  99. var physicsCollider = collider.getComponent(Laya.PhysicsCollider);
  100. if (physicsCollider) {
  101. physicsCollider.collisionGroup = collisionGroup;
  102. }
  103. }
  104. static RandomNumber(from, to) {
  105. if (from >= to) {
  106. return 0;
  107. }
  108. var size = to - from;
  109. var curNumber = Math.random() * size + from;
  110. return curNumber;
  111. }
  112. static RandomANumber(from, to) {
  113. if (from >= to) {
  114. return 0;
  115. }
  116. var size = to - from;
  117. var curNumber = Math.random() * size + from;
  118. return Math.floor(curNumber);
  119. }
  120. static GetMoney(_num, _pos = null, _completeHandle = null) {
  121. if (_num == 0)
  122. return;
  123. var fafaafsfa = new Laya.Box;
  124. fafaafsfa.width = 400;
  125. fafaafsfa.height = 100;
  126. fafaafsfa.pivotX = fafaafsfa.width / 2;
  127. fafaafsfa.pivotY = fafaafsfa.height / 2;
  128. if (_pos == null) {
  129. _pos = new Laya.Vector2(Laya.stage.width / 2, Laya.stage.height / 2);
  130. }
  131. fafaafsfa.pos(_pos.x, _pos.y);
  132. var aafafaffa = new Laya.Image;
  133. aafafaffa.skin = "game/qiandao_1_7.png";
  134. aafafaffa.width = 60;
  135. aafafaffa.height = 60;
  136. aafafaffa.left = 50;
  137. aafafaffa.y = 10;
  138. fafaafsfa.addChild(aafafaffa);
  139. var faasfafsafs = new Laya.Text;
  140. faasfafsafs.width = 300;
  141. faasfafsafs.height = 50;
  142. faasfafsafs.align = "center";
  143. faasfafsafs.valign = "middle";
  144. faasfafsafs.font = "Microsoft YaHei";
  145. faasfafsafs.fontSize = 40;
  146. faasfafsafs.color = "#FFFFFF";
  147. faasfafsafs.bold = true;
  148. faasfafsafs.font = "Microsoft YaHei";
  149. faasfafsafs.text = "金币 +" + _num;
  150. faasfafsafs.x = 60;
  151. faasfafsafs.y = 10;
  152. fafaafsfa.addChild(faasfafsafs);
  153. Laya.stage.addChild(fafaafsfa);
  154. var faasfsaf = Laya.Tween.to(fafaafsfa, { y: fafaafsfa.y - 200 }, 1500, Laya.Ease.expoInOut, Laya.Handler.create(this, () => {
  155. faasfsaf.clear();
  156. fafaafsfa.destroy();
  157. if (_completeHandle) {
  158. _completeHandle.run();
  159. }
  160. }), 100);
  161. }
  162. static TweenText(faafssfafsa, _hight, _completeHandle = null, hide = true, _duration = 500) {
  163. var afasafsafsfa = new Laya.Text();
  164. afasafsafsfa.width = faafssfafsa.size.x;
  165. afasafsafsfa.height = faafssfafsa.size.y;
  166. afasafsafsfa.align = "center";
  167. afasafsafsfa.valign = "middle";
  168. afasafsafsfa.font = "Microsoft YaHei";
  169. afasafsafsfa.fontSize = faafssfafsa.fontSize;
  170. afasafsafsfa.pivotX = afasafsafsfa.width / 2;
  171. afasafsafsfa.pivotY = afasafsafsfa.height / 2;
  172. afasafsafsfa.color = "#5ad122";
  173. afasafsafsfa.bold = true;
  174. afasafsafsfa.stroke = 5;
  175. afasafsafsfa.strokeColor = "#ffffff";
  176. if (faafssfafsa.color) {
  177. faafssfafsa.color = faafssfafsa.color;
  178. }
  179. afasafsafsfa.text = faafssfafsa.message;
  180. afasafsafsfa.zOrder = 1;
  181. Laya.stage.addChildAt(afasafsafsfa, Laya.stage.numChildren - 1);
  182. afasafsafsfa.pos(faafssfafsa.pos.x, faafssfafsa.pos.y);
  183. var tween = Laya.Tween.to(afasafsafsfa, { y: afasafsafsfa.y - _hight, update: new Laya.Handler(this, function () {
  184. }) }, _duration, Laya.Ease.expoInOut, Laya.Handler.create(this, function () {
  185. tween.clear();
  186. if (hide) {
  187. afasafsafsfa.destroy();
  188. }
  189. if (_completeHandle) {
  190. _completeHandle.run();
  191. }
  192. }));
  193. if (hide) {
  194. Laya.Tween.to(afasafsafsfa, { alpha: 0.4 }, 500);
  195. }
  196. return afasafsafsfa;
  197. }
  198. static StationTweenText(faafssfafsa, _hight, _completeHandle = null, hide = true, _duration = 500) {
  199. var afasafsafsfa = new Laya.Text();
  200. afasafsafsfa.width = faafssfafsa.size.x;
  201. afasafsafsfa.height = faafssfafsa.size.y;
  202. afasafsafsfa.align = "center";
  203. afasafsafsfa.valign = "middle";
  204. afasafsafsfa.font = "Microsoft YaHei";
  205. afasafsafsfa.fontSize = 50;
  206. afasafsafsfa.pivotX = afasafsafsfa.width / 2;
  207. afasafsafsfa.pivotY = afasafsafsfa.height / 2;
  208. afasafsafsfa.color = "#5ad122";
  209. afasafsafsfa.bold = true;
  210. afasafsafsfa.stroke = 5;
  211. afasafsafsfa.strokeColor = "#ffffff";
  212. if (faafssfafsa.color) {
  213. faafssfafsa.color = faafssfafsa.color;
  214. }
  215. afasafsafsfa.text = faafssfafsa.message;
  216. afasafsafsfa.zOrder = 1;
  217. Laya.stage.addChildAt(afasafsafsfa, Laya.stage.numChildren - 1);
  218. afasafsafsfa.pos(faafssfafsa.pos.x, faafssfafsa.pos.y);
  219. var tween = Laya.Tween.to(afasafsafsfa, { y: afasafsafsfa.y - _hight, update: new Laya.Handler(this, function () {
  220. }) }, _duration, Laya.Ease.expoInOut, Laya.Handler.create(this, function () {
  221. tween.clear();
  222. if (hide) {
  223. afasafsafsfa.destroy();
  224. }
  225. if (_completeHandle) {
  226. _completeHandle.run();
  227. }
  228. }));
  229. if (hide) {
  230. Laya.Tween.to(afasafsafsfa, { alpha: 0.4 }, 10000);
  231. }
  232. return afasafsafsfa;
  233. }
  234. static tweenMove(transform, targPos, delay, ease, complete) {
  235. let curPos = transform.position.clone();
  236. return Laya.Tween.to(curPos, {
  237. x: targPos.x,
  238. y: targPos.y,
  239. z: targPos.z,
  240. update: new Laya.Handler(this, () => {
  241. transform.position = curPos.clone();
  242. })
  243. }, delay, ease, complete);
  244. }
  245. static tweenRotate(transform, targEuler, delay, ease, complete) {
  246. let curEuler = transform.rotationEuler.clone();
  247. return Laya.Tween.to(curEuler, {
  248. x: targEuler.x,
  249. y: targEuler.y,
  250. z: targEuler.z,
  251. update: new Laya.Handler(this, () => {
  252. transform.rotationEuler = curEuler.clone();
  253. })
  254. }, delay, ease, complete);
  255. }
  256. }
  257. var EventState;
  258. (function (EventState) {
  259. EventState[EventState["LoadComplete"] = 0] = "LoadComplete";
  260. EventState[EventState["SceneInit"] = 1] = "SceneInit";
  261. EventState[EventState["StageInit"] = 2] = "StageInit";
  262. EventState[EventState["ShowModel"] = 3] = "ShowModel";
  263. })(EventState || (EventState = {}));
  264. ;
  265. var StageState;
  266. (function (StageState) {
  267. StageState[StageState["Win"] = 0] = "Win";
  268. StageState[StageState["Lose"] = 1] = "Lose";
  269. StageState[StageState["Start"] = 2] = "Start";
  270. StageState[StageState["BackMain"] = 3] = "BackMain";
  271. StageState[StageState["StageCreateComPlete"] = 4] = "StageCreateComPlete";
  272. StageState[StageState["Over"] = 5] = "Over";
  273. StageState[StageState["Pause"] = 6] = "Pause";
  274. StageState[StageState["Resume"] = 7] = "Resume";
  275. StageState[StageState["RefreshPro"] = 8] = "RefreshPro";
  276. StageState[StageState["ShowGuide1"] = 9] = "ShowGuide1";
  277. StageState[StageState["HideGuide1"] = 10] = "HideGuide1";
  278. StageState[StageState["ShowGuide2"] = 11] = "ShowGuide2";
  279. StageState[StageState["HideGuide2"] = 12] = "HideGuide2";
  280. StageState[StageState["ArriverAttack"] = 13] = "ArriverAttack";
  281. })(StageState || (StageState = {}));
  282. ;
  283. var RoleState;
  284. (function (RoleState) {
  285. RoleState[RoleState["Die"] = 0] = "Die";
  286. RoleState[RoleState["Sky"] = 1] = "Sky";
  287. RoleState[RoleState["OnLand"] = 2] = "OnLand";
  288. RoleState[RoleState["Land"] = 3] = "Land";
  289. RoleState[RoleState["Arriver"] = 4] = "Arriver";
  290. })(RoleState || (RoleState = {}));
  291. ;
  292. class DispatcherManager {
  293. static EventOn(_mode, caller, fun, args = []) {
  294. DispatcherManager.instance.on(EventState[_mode], caller, fun, args);
  295. }
  296. static EventOff(_mode, caller, fun, args = []) {
  297. DispatcherManager.instance.off(EventState[_mode], caller, fun);
  298. }
  299. static EventTrigger(_mode, args = []) {
  300. DispatcherManager.instance.event(EventState[_mode], args);
  301. }
  302. static StageOn(_mode, caller, fun, args = []) {
  303. DispatcherManager.instance.on(StageState[_mode], caller, fun, args);
  304. }
  305. static StageOff(_mode, caller, fun, args = []) {
  306. DispatcherManager.instance.off(StageState[_mode], caller, fun);
  307. }
  308. static StageTrigger(_mode, args = []) {
  309. DispatcherManager.instance.event(StageState[_mode], args);
  310. }
  311. }
  312. DispatcherManager.instance = new Laya.EventDispatcher();
  313. class Dictionary {
  314. constructor() {
  315. this._items = {};
  316. this.length = 0;
  317. }
  318. get container() {
  319. return this._items;
  320. }
  321. has(key) {
  322. return this._items.hasOwnProperty(key);
  323. }
  324. set(key, val) {
  325. if (!this.has(key)) {
  326. this.length++;
  327. }
  328. this._items[key] = val;
  329. }
  330. delete(key) {
  331. let val = null;
  332. if (this.has(key)) {
  333. val = this._items[key];
  334. delete this._items[key];
  335. this.length--;
  336. }
  337. return val;
  338. }
  339. get(key) {
  340. return this.has(key) ? this._items[key] : null;
  341. }
  342. values() {
  343. let values = [];
  344. for (let k in this._items) {
  345. if (this.has(k)) {
  346. values.push(this._items[k]);
  347. }
  348. }
  349. return values;
  350. }
  351. keys() {
  352. let keys = [];
  353. for (let k in this._items) {
  354. if (this.has(k)) {
  355. keys.push(k);
  356. }
  357. }
  358. return keys;
  359. }
  360. clear() {
  361. this._items = {};
  362. this.length = 0;
  363. }
  364. }
  365. class NodeUtil {
  366. static GetChild(node, cond) {
  367. let queue = [];
  368. for (let i = 0; i < node.numChildren; i++) {
  369. queue.push(node.getChildAt(i));
  370. }
  371. while (queue.length > 0) {
  372. let first = queue.shift();
  373. if (cond(first)) {
  374. return first;
  375. }
  376. else {
  377. for (let i = 0; i < first.numChildren; i++) {
  378. queue.push(first.getChildAt(i));
  379. }
  380. }
  381. }
  382. return null;
  383. }
  384. static GetChildByName(node, name) {
  385. return NodeUtil.GetChild(node, s => s.name == name);
  386. }
  387. static getChildren(node, cond) {
  388. let finded = [];
  389. let queue = [];
  390. for (let i = 0; i < node.numChildren; i++) {
  391. queue.push(node.getChildAt(i));
  392. }
  393. while (queue.length > 0) {
  394. let first = queue.shift();
  395. if (cond(first)) {
  396. finded.push(first);
  397. }
  398. for (let i = 0; i < first.numChildren; i++) {
  399. queue.push(first.getChildAt(i));
  400. }
  401. }
  402. return finded;
  403. }
  404. static SetColliderInactive(sp) {
  405. let colliders = NodeUtil.getChildren(sp, s => s.getComponent(Laya.PhysicsCollider));
  406. colliders.forEach(s => {
  407. let collider = s.getComponent(Laya.PhysicsCollider);
  408. if (collider) {
  409. collider.enabled = false;
  410. }
  411. }, this);
  412. }
  413. static SetColliderGroup(sp, _group) {
  414. let colliders = NodeUtil.getChildren(sp, s => s.getComponent(Laya.PhysicsCollider));
  415. colliders.forEach(s => {
  416. let collisionGroup = _group;
  417. let collider = s.getComponent(Laya.PhysicsCollider);
  418. collider.collisionGroup = collisionGroup;
  419. }, this);
  420. }
  421. }
  422. NodeUtil.All = Laya.Physics3DUtils.COLLISIONFILTERGROUP_ALLFILTER;
  423. NodeUtil.Body = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER1;
  424. NodeUtil.Head = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER2;
  425. NodeUtil.Citizen = Laya.Physics3DUtils.COLLISIONFILTERGROUP_CUSTOMFILTER3;
  426. class Transform3DHelper$1 {
  427. static getForward(transform) {
  428. let forward = new Laya.Vector3();
  429. transform.getForward(forward);
  430. Laya.Vector3.scale(forward, -1, forward);
  431. Laya.Vector3.normalize(forward, forward);
  432. return forward;
  433. }
  434. }
  435. class ResourcesPath {
  436. }
  437. ResourcesPath.Yan = "yan";
  438. ResourcesPath.YanHua = "yanhua";
  439. ResourcesPath.Nail1 = "Nail1";
  440. ResourcesPath.Nail2 = "Nail2";
  441. ResourcesPath.Nail3 = "Nail3";
  442. ResourcesPath.Nail4 = "Nail4";
  443. ResourcesPath.Nail5 = "Nail5";
  444. ResourcesPath.Nail6 = "Nail6";
  445. ResourcesPath.Nail7 = "Nail7";
  446. ResourcesPath.Coin = "Coin";
  447. ResourcesPath.FinishCircle = "FinishCircle";
  448. ResourcesPath.Speed = "speed";
  449. ResourcesPath.Ramp = "Ramp";
  450. ResourcesPath.Boss = "Boss";
  451. ResourcesPath.EndGround = "endground2";
  452. ResourcesPath.mainscene = "subpackage/res/mainscene/LayaScene_mainscene2/Conventional/mainscene2.ls";
  453. ResourcesPath.Character = [
  454. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character1.lh",
  455. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character2.lh",
  456. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character3.lh",
  457. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character4.lh",
  458. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character5.lh",
  459. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Character6.lh"
  460. ];
  461. ResourcesPath.Prop = [
  462. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/FinishCircle.lh",
  463. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/FinishCircle2.lh",
  464. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail1.lh",
  465. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail2.lh",
  466. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail3.lh",
  467. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail4.lh",
  468. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail5.lh",
  469. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail6.lh",
  470. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Nail7.lh",
  471. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/yan.lh",
  472. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/yanhua.lh",
  473. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/flag.lh",
  474. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Coin.lh",
  475. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Ramp.lh",
  476. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/speed.lh",
  477. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/Boss.lh",
  478. "subpackage2/res/gameresources/LayaScene_gameresources/Conventional/endground2.lh"
  479. ];
  480. var Vector3$1 = Laya.Vector3;
  481. class WallBehav extends Laya.Script3D {
  482. constructor() {
  483. super();
  484. this._hitres = new Laya.HitResult();
  485. this.crash = false;
  486. this._hitres2 = new Laya.HitResult();
  487. }
  488. onAwake() {
  489. this._gameobject = this.owner;
  490. }
  491. onStart() {
  492. var isFowardHit = false;
  493. var startPos = new Vector3$1(this._gameobject.transform.position.x, this._gameobject.transform.position.y, this._gameobject.transform.position.z);
  494. let _up = new Laya.Vector3(0, 1, 0);
  495. var FowardRay = new Laya.Ray(startPos, _up);
  496. if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this._hitres, 1)) {
  497. if (this._hitres.collider.collisionGroup == 2) {
  498. let _wall = this._hitres.collider.owner.parent;
  499. if (this.crash) {
  500. NodeUtil.SetColliderInactive(this._gameobject);
  501. let _pre = AssetManager.Instance.getPref(ResourcesPath.Yan);
  502. let yan = Laya.Sprite3D.instantiate(_pre);
  503. LevelManager.Instance.spritepool.addChild(yan);
  504. yan.transform.position = this._gameobject.transform.position.clone();
  505. yan.transform.scale = new Laya.Vector3(0.5, 0.5, 0.5);
  506. this.destroy();
  507. this._gameobject.destroy();
  508. }
  509. else {
  510. this.FallDown();
  511. }
  512. let _behav = _wall.addComponent(WallBehav);
  513. }
  514. }
  515. else {
  516. if (this.crash) {
  517. NodeUtil.SetColliderInactive(this._gameobject);
  518. let _pre = AssetManager.Instance.getPref(ResourcesPath.Yan);
  519. let yan = Laya.Sprite3D.instantiate(_pre);
  520. LevelManager.Instance.spritepool.addChild(yan);
  521. yan.transform.position = this._gameobject.transform.position.clone();
  522. yan.transform.scale = new Laya.Vector3(0.5, 0.5, 0.5);
  523. this.destroy();
  524. this._gameobject.destroy();
  525. }
  526. }
  527. }
  528. onUpdate() {
  529. if (this.crash) {
  530. NodeUtil.SetColliderInactive(this._gameobject);
  531. let _pre = AssetManager.Instance.getPref(ResourcesPath.Yan);
  532. let yan = Laya.Sprite3D.instantiate(_pre);
  533. LevelManager.Instance.spritepool.addChild(yan);
  534. yan.transform.position = this._gameobject.transform.position.clone();
  535. yan.transform.scale = new Laya.Vector3(0.5, 0.5, 0.5);
  536. this.destroy();
  537. this._gameobject.destroy();
  538. return;
  539. }
  540. this.Down();
  541. }
  542. Crash() {
  543. NodeUtil.SetColliderInactive(this._gameobject);
  544. let _pre = AssetManager.Instance.getPref(ResourcesPath.Yan);
  545. let yan = Laya.Sprite3D.instantiate(_pre);
  546. LevelManager.Instance.spritepool.addChild(yan);
  547. yan.transform.position = this._gameobject.transform.position.clone();
  548. yan.transform.scale = new Laya.Vector3(0.5, 0.5, 0.5);
  549. this.destroy();
  550. this._gameobject.destroy();
  551. }
  552. FallDown() {
  553. Laya.timer.loop(1, this, this.Down);
  554. }
  555. Down() {
  556. var isFowardHit = false;
  557. var startPos = new Vector3$1(this._gameobject.transform.position.x, this._gameobject.transform.position.y + 0.1, this._gameobject.transform.position.z);
  558. let _down = new Laya.Vector3(0, -0.1, 0);
  559. var FowardRay = new Laya.Ray(startPos, _down);
  560. if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this._hitres2, 0.2)) {
  561. if (this._hitres2 != null && (this._hitres2.collider.collisionGroup == 1 || this._hitres2.collider.collisionGroup == 2)) {
  562. Laya.timer.clear(this, this.Down);
  563. }
  564. else {
  565. let _posy = this._gameobject.transform.position.y -= 0.03;
  566. this._gameobject.transform.position = new Laya.Vector3(this._gameobject.transform.position.x, _posy, this._gameobject.transform.position.z);
  567. }
  568. }
  569. else {
  570. let _posy = this._gameobject.transform.position.y -= 0.03;
  571. this._gameobject.transform.position = new Laya.Vector3(this._gameobject.transform.position.x, _posy, this._gameobject.transform.position.z);
  572. }
  573. }
  574. }
  575. var VoiceType;
  576. (function (VoiceType) {
  577. VoiceType[VoiceType["crashrole"] = 0] = "crashrole";
  578. VoiceType[VoiceType["crashwall"] = 1] = "crashwall";
  579. VoiceType[VoiceType["win"] = 2] = "win";
  580. VoiceType[VoiceType["lose"] = 3] = "lose";
  581. VoiceType[VoiceType["fly"] = 4] = "fly";
  582. VoiceType[VoiceType["speedup"] = 5] = "speedup";
  583. VoiceType[VoiceType["coin"] = 6] = "coin";
  584. })(VoiceType || (VoiceType = {}));
  585. var BGMType;
  586. (function (BGMType) {
  587. BGMType[BGMType["bgm"] = 0] = "bgm";
  588. })(BGMType || (BGMType = {}));
  589. ;
  590. class AudioManager {
  591. static voiceres(_type) {
  592. return "subpackage2/res/music/" + VoiceType[_type] + ".mp3";
  593. }
  594. static bgmres(_type) {
  595. return "subpackage2/res/music/" + BGMType[_type] + ".mp3";
  596. }
  597. static ClearAudio() {
  598. Laya.SoundManager.stopAllSound();
  599. }
  600. static StopMusic() {
  601. Laya.SoundManager.stopMusic();
  602. }
  603. static PlayBGM(_type) {
  604. }
  605. static PlayVoice(_type, _loop = false) {
  606. if (!this.play)
  607. return;
  608. var loop = _loop ? 0 : 1;
  609. Laya.SoundManager.soundVolume = 1;
  610. if (_type == VoiceType.coin) {
  611. Laya.SoundManager.soundVolume = 0.3;
  612. }
  613. Laya.SoundManager.playSound(this.voiceres(_type), loop);
  614. }
  615. }
  616. AudioManager.play = true;
  617. class CoinBehav extends Laya.Script3D {
  618. constructor() {
  619. super();
  620. }
  621. onAwake() {
  622. this._gameobject = this.owner;
  623. Laya.timer.loop(1, this, this.Rotate);
  624. }
  625. OnTouch() {
  626. GameManager.GoldNum++;
  627. AudioManager.PlayVoice(VoiceType.coin);
  628. Laya.timer.clear(this, this.Rotate);
  629. this.destroy();
  630. }
  631. Rotate() {
  632. this._gameobject.transform.rotate(new Laya.Vector3(0, 0.05, 0));
  633. }
  634. }
  635. class MathHelper {
  636. static Clamp(n, min, max) {
  637. return n > max ? max : (n < min ? min : n);
  638. }
  639. static ClampRange(n, a, b, min, max) {
  640. return (MathHelper.Clamp(n, a, b) - a) / (b - a) * (max - min) + min;
  641. }
  642. static ToPercentage(n, min, max) {
  643. return (n - min) / (max - min);
  644. }
  645. static ToRad() {
  646. return Math.PI / 180;
  647. }
  648. static ToDeg() {
  649. return 180 / Math.PI;
  650. }
  651. static Rand(min, max) {
  652. return Math.random() * (max - min) + min;
  653. }
  654. static RandInt(min, max) {
  655. return Math.floor(Math.random() * (max - min + 1) + min);
  656. }
  657. static Lerp(a, b, t) {
  658. return a * (1 - t) + b * t;
  659. }
  660. static PrefixNum(num, len, prefix = "0") {
  661. return (Array(len).join(prefix) + num).slice(-len);
  662. }
  663. static ClampEuler(angle) {
  664. while (angle > 180) {
  665. angle -= 360;
  666. }
  667. while (angle < -180) {
  668. angle += 360;
  669. }
  670. return angle;
  671. }
  672. }
  673. class Vector3Helper {
  674. static get Zero() {
  675. return new Laya.Vector3(0, 0, 0);
  676. }
  677. static get Up() {
  678. return new Laya.Vector3(0, 1, 0);
  679. }
  680. static Add(a, b) {
  681. return new Laya.Vector3(a.x + b.x, a.y + b.y, a.z + b.z);
  682. }
  683. static Substract(a, b) {
  684. return new Laya.Vector3(a.x - b.x, a.y - b.y, a.z - b.z);
  685. }
  686. static Scale(a, b) {
  687. let res = Vector3Helper.Zero;
  688. Laya.Vector3.scale(a, b, res);
  689. return res;
  690. }
  691. static Lerp(a, b, t) {
  692. let res = Vector3Helper.Zero;
  693. Laya.Vector3.lerp(a, b, t, res);
  694. return res;
  695. }
  696. static ClampEuler(euler) {
  697. return new Laya.Vector3(MathHelper.ClampEuler(euler.x), MathHelper.ClampEuler(euler.y), MathHelper.ClampEuler(euler.z));
  698. }
  699. static RotateY(a, deg) {
  700. let matrix = new Laya.Matrix4x4();
  701. Laya.Matrix4x4.createRotationY(deg * MathHelper.ToRad(), matrix);
  702. let res = Vector3Helper.Zero;
  703. Laya.Vector3.transformCoordinate(a, matrix, res);
  704. return res;
  705. }
  706. static CancelBrackets(str) {
  707. let a = str.split("(");
  708. let b = a[1];
  709. let c = b.split(")");
  710. let d = c[0];
  711. let e = d.split(",");
  712. return e;
  713. }
  714. }
  715. class Transform3DHelper$2 {
  716. static getForward(transform) {
  717. let forward = new Laya.Vector3();
  718. transform.getForward(forward);
  719. Laya.Vector3.scale(forward, -1, forward);
  720. Laya.Vector3.normalize(forward, forward);
  721. return forward;
  722. }
  723. }
  724. class HpBarBehav extends Laya.Script3D {
  725. constructor() {
  726. super();
  727. }
  728. onAwake() {
  729. this._gameobject = this.owner;
  730. this._headPos = NodeUtil.GetChildByName(this._gameobject, "UiPos");
  731. this._bossbehav = this._gameobject.getComponent(BossBehav);
  732. this._hpBar = new Laya.ProgressBar("Main/youxi-1-5.png");
  733. this._hpBar.anchorX = this._hpBar.anchorY = 0.5;
  734. Laya.stage.addChild(this._hpBar);
  735. }
  736. onUpdate() {
  737. let sp = new Laya.Sprite3D();
  738. sp.transform.position = this._headPos.transform.position.clone();
  739. sp.transform.rotationEuler = this._headPos.transform.rotationEuler.clone();
  740. sp.transform.translate(new Laya.Vector3(0, 0.4, 0), false);
  741. let pt = Vector3Helper.Zero;
  742. AssetManager.Instance.maincamera.worldToViewportPoint(sp.transform.position, pt);
  743. this._hpBar.pos(pt.x, pt.y);
  744. this._hpBar.value = this._bossbehav.health / this._bossbehav.maxhealth;
  745. }
  746. onDestroy() {
  747. this._hpBar.destroy();
  748. this._hpBar = null;
  749. }
  750. }
  751. class AnimatorManager {
  752. static Play(isboss = false, animator, anim, islooping = null, complete = null, speed = null) {
  753. if (animator == null || animator.getControllerLayer() == null) {
  754. complete && complete.run();
  755. return;
  756. }
  757. let animatorState = animator.getControllerLayer().getAnimatorState(anim);
  758. if (animatorState == null) {
  759. complete && complete.run();
  760. return;
  761. }
  762. if (islooping != null)
  763. animatorState.clip.islooping = islooping;
  764. if (speed != null)
  765. animatorState.speed = speed;
  766. animator.play(anim);
  767. if (complete) {
  768. let cb = () => {
  769. if (animator.getCurrentAnimatorPlayState().normalizedTime >= 1) {
  770. if (isboss) {
  771. animator.play("idle");
  772. }
  773. Laya.timer.clear(this, cb);
  774. complete.run();
  775. }
  776. };
  777. Laya.timer.frameLoop(1, this, cb);
  778. }
  779. }
  780. }
  781. class BossBehav extends Laya.Script3D {
  782. constructor() {
  783. super();
  784. this.dead = false;
  785. this.canmove = true;
  786. this.start = false;
  787. this.play = false;
  788. this._up = new Laya.Vector3(0, 1, 0);
  789. this.quaternion1 = new Laya.Quaternion();
  790. }
  791. onAwake() {
  792. this._gameobject = this.owner;
  793. this._animator = this._gameobject.getComponent(Laya.Animator);
  794. this.health = 100;
  795. this.maxhealth = 100;
  796. this.atk = 10;
  797. DispatcherManager.StageOn(StageState.ArriverAttack, this, this.Start);
  798. DispatcherManager.StageOn(StageState.Win, this, this.Destroy);
  799. DispatcherManager.StageOn(StageState.Lose, this, this.Destroy);
  800. }
  801. onUpdate() {
  802. if (!this.start)
  803. return;
  804. if (this.dead) {
  805. this.BossDie();
  806. return;
  807. }
  808. if (this.canmove) {
  809. this.Attack();
  810. }
  811. }
  812. Attack() {
  813. if (!this.play) {
  814. this.play = true;
  815. AnimatorManager.Play(true, this._animator, "atk", false, Laya.Handler.create(this, () => {
  816. this.play = false;
  817. this._Attack();
  818. }));
  819. }
  820. }
  821. _Attack() {
  822. if (this.target) {
  823. let _matemove = this.target.getComponent(MateMove);
  824. if (_matemove) {
  825. _matemove.Injured(this.atk);
  826. }
  827. }
  828. }
  829. Injured(_damega) {
  830. if (this.health == 0)
  831. return;
  832. this.health -= _damega;
  833. if (this.health <= 0) {
  834. this.health = 0;
  835. this.dead = true;
  836. }
  837. }
  838. BossDie() {
  839. this._animator.play("die2");
  840. this.canmove = false;
  841. Laya.timer.clearAll(this);
  842. GameManager.Instance.GameWin();
  843. this.destroy();
  844. }
  845. Start() {
  846. this.start = true;
  847. let _hp = this._gameobject.addComponent(HpBarBehav);
  848. }
  849. HideHpBar() {
  850. let _hp = this._gameobject.getComponent(HpBarBehav);
  851. if (_hp) {
  852. _hp.destroy();
  853. }
  854. }
  855. SetTarRotate(_trans) {
  856. this.target = _trans;
  857. this.targetpos = _trans.transform.position;
  858. Laya.Quaternion.lookAt(this.targetpos, this._gameobject.transform.position, this._up, this.quaternion1);
  859. this.quaternion1.invert(this.quaternion1);
  860. this._gameobject.transform.rotation = this.quaternion1.clone();
  861. }
  862. Destroy() {
  863. let _hp = this._gameobject.getComponent(HpBarBehav);
  864. if (_hp) {
  865. _hp.destroy();
  866. }
  867. }
  868. }
  869. class MateHpBarBehav extends Laya.Script3D {
  870. constructor() {
  871. super();
  872. }
  873. onAwake() {
  874. this._gameobject = this.owner;
  875. this._headPos = NodeUtil.GetChildByName(this._gameobject, "UiPos");
  876. this._matebehav = this._gameobject.getComponent(MateMove);
  877. this._hpBar = new Laya.ProgressBar("Main/youxi-1-5.png");
  878. this._hpBar.anchorX = this._hpBar.anchorY = 0.5;
  879. Laya.stage.addChild(this._hpBar);
  880. }
  881. onUpdate() {
  882. let sp = new Laya.Sprite3D();
  883. sp.transform.position = this._headPos.transform.position.clone();
  884. sp.transform.rotationEuler = this._headPos.transform.rotationEuler.clone();
  885. sp.transform.translate(new Laya.Vector3(0, 0.4, 0), false);
  886. let pt = Vector3Helper.Zero;
  887. AssetManager.Instance.maincamera.worldToViewportPoint(sp.transform.position, pt);
  888. this._hpBar.pos(pt.x, pt.y);
  889. this._hpBar.value = this._matebehav.health / this._matebehav.maxhealth;
  890. }
  891. onDestroy() {
  892. this._hpBar.destroy();
  893. this._hpBar = null;
  894. }
  895. }
  896. var Vector3$2 = Laya.Vector3;
  897. var Quaternion = Laya.Quaternion;
  898. class MateMove extends Laya.Script3D {
  899. constructor() {
  900. super();
  901. this._speed = 0.2;
  902. this.testspeed = 0.5;
  903. this.Tag_Head = false;
  904. this.start = false;
  905. this.isdead = false;
  906. this.geted = false;
  907. this._arriver = false;
  908. this._destination = false;
  909. this.GravityTime = 0;
  910. this.ChargeSpeed = 0;
  911. this.ChargeTime = 0;
  912. this.Downhit = new Laya.HitResult();
  913. this.FowardHit = new Laya.HitResult();
  914. this._forward = new Vector3$2(0, 0, 0);
  915. this._up = new Vector3$2(0, 1, 0);
  916. this._up2 = new Vector3$2(0, -1, 0);
  917. this.CanJump = false;
  918. this.JumpTime = 0;
  919. this.JumpSpeed = 0.3;
  920. this.JumpSpeedUp = 1;
  921. this.targetPos = new Vector3$2(0, 0, 0);
  922. this.forW = new Vector3$2(0, 0, 0);
  923. this.RoleList = [];
  924. this.MovePointList = [];
  925. this.MoveRotateList = [];
  926. this._foward = new Laya.Vector3(0, 0, 0);
  927. this._MovetarPos = new Laya.Vector3(0, 0, 0);
  928. this.curpos2 = new Vector3$2();
  929. this.offest2 = new Vector3$2();
  930. this.curspeed2 = 0;
  931. this.curpos = new Vector3$2();
  932. this.offest = new Vector3$2();
  933. this.curspeed = 0;
  934. this.isarrive = false;
  935. this.showguide1 = false;
  936. this.showguide2 = false;
  937. this.pause = false;
  938. this.play = false;
  939. this.v3 = new Vector3$2(0, 0, 0);
  940. this.ts = new Vector3$2(0, 0, 0.01);
  941. this.quaternion1 = new Laya.Quaternion();
  942. this.quaternion2 = new Laya.Quaternion();
  943. this.quaternion3 = new Laya.Quaternion();
  944. this.showpro = false;
  945. DispatcherManager.StageOn(StageState.Start, this, this.GameStart);
  946. }
  947. onAwake() {
  948. this._gameobject = this.owner;
  949. this._transform = this._gameobject.transform;
  950. this._quaternion = new Quaternion();
  951. this._animator = this._gameobject.getComponent(Laya.Animator);
  952. this.health = 50;
  953. this.maxhealth = 50;
  954. }
  955. onUpdate() {
  956. if (!this.start)
  957. return;
  958. if (this.isdead) {
  959. this.RoleDie();
  960. this.ChangeState(RoleState.Die);
  961. return;
  962. }
  963. if (this._destination)
  964. return;
  965. if (this.isarrive)
  966. return;
  967. if (this.Tag_Head) {
  968. this.RefreshUI();
  969. if (this.DownRayCheck) {
  970. if (this.curstate == RoleState.OnLand) {
  971. this._gameobject.transform.position = new Vector3$2(this._gameobject.transform.position.x, this.Downhit.point.y, this._gameobject.transform.position.z);
  972. if (this.Downhit.collider.owner.parent.name == "speed") {
  973. AudioManager.PlayVoice(VoiceType.speedup);
  974. this.SpeedUp(0.6, 0.1);
  975. }
  976. else if (this.Downhit.collider.owner.parent.name == "Ramp") {
  977. AudioManager.PlayVoice(VoiceType.fly);
  978. this.SpeedUp(0.3, 0.2);
  979. this.Jump();
  980. }
  981. }
  982. else if (this.curstate == RoleState.Sky) {
  983. var distance = this._gameobject.transform.position.y - this.Downhit.point.y;
  984. if (distance < 0.5) {
  985. var leropos = new Vector3$2(this._gameobject.transform.position.x, this.Downhit.point.y, this._gameobject.transform.position.z);
  986. Vector3$2.lerp(this._gameobject.transform.position, leropos, 0.3, leropos);
  987. this._gameobject.transform.position = leropos;
  988. this.ChangeState(RoleState.OnLand);
  989. }
  990. }
  991. }
  992. else {
  993. this.ChangeState(RoleState.Sky);
  994. }
  995. if (this.FowardRayCheck) {
  996. }
  997. let foward = Transform3DHelper$1.getForward(this._gameobject.transform);
  998. this.Move(foward);
  999. this.Gravity();
  1000. }
  1001. else {
  1002. if (!this.geted)
  1003. return;
  1004. if (this._arriver) {
  1005. if (this.DownRayCheck) {
  1006. if (this.curstate == RoleState.OnLand) {
  1007. this._gameobject.transform.position = new Vector3$2(this._gameobject.transform.position.x, this.Downhit.point.y, this._gameobject.transform.position.z);
  1008. }
  1009. else if (this.curstate == RoleState.Sky) {
  1010. var distance = this._gameobject.transform.position.y - this.Downhit.point.y;
  1011. if (distance < 0.5) {
  1012. var leropos = new Vector3$2(this._gameobject.transform.position.x, this.Downhit.point.y, this._gameobject.transform.position.z);
  1013. Vector3$2.lerp(this._gameobject.transform.position, leropos, 0.3, leropos);
  1014. this._gameobject.transform.position = leropos;
  1015. this.ChangeState(RoleState.OnLand);
  1016. }
  1017. }
  1018. }
  1019. else {
  1020. this.ChangeState(RoleState.Sky);
  1021. }
  1022. this.RoleMoveFun();
  1023. this.Gravity();
  1024. }
  1025. else {
  1026. this.MoveToGroup();
  1027. }
  1028. }
  1029. if (this._gameobject.transform.position.y < -15) {
  1030. this.FallDown();
  1031. }
  1032. }
  1033. RefreshUI() {
  1034. let pre = PlayerManager.Instance.RefreshPro();
  1035. let count = this.RoleList.length;
  1036. let data = {};
  1037. data["pre"] = pre;
  1038. data["count"] = count;
  1039. DispatcherManager.StageTrigger(StageState.RefreshPro, [data]);
  1040. }
  1041. GameStart() {
  1042. this.start = true;
  1043. if (this.Tag_Head)
  1044. this.ChangeState(RoleState.OnLand);
  1045. Laya.timer.loop(2, this, this.SetNewMovePoint, [this._transform]);
  1046. }
  1047. Start(model) {
  1048. if (this.geted)
  1049. return;
  1050. this.targetmodel = model.getChildByName("followpos");
  1051. this.geted = true;
  1052. this.ChangeState(RoleState.OnLand);
  1053. }
  1054. ChangeState(state) {
  1055. if (this.curstate == state)
  1056. return;
  1057. this.curstate = state;
  1058. switch (this.curstate) {
  1059. case RoleState.Die:
  1060. this.DIE();
  1061. break;
  1062. case RoleState.Sky:
  1063. this.SKY();
  1064. break;
  1065. case RoleState.OnLand:
  1066. this.ONLAND();
  1067. break;
  1068. case RoleState.Arriver:
  1069. this.ARRIVER();
  1070. break;
  1071. }
  1072. }
  1073. ONLAND() {
  1074. if (this.Tag_Head) {
  1075. this._animator.play("run");
  1076. this._animator.speed = 2;
  1077. }
  1078. else {
  1079. if (this.geted) {
  1080. this._animator.play("run");
  1081. this._animator.speed = 2;
  1082. }
  1083. else {
  1084. this._animator.play("idle");
  1085. }
  1086. }
  1087. }
  1088. SKY() {
  1089. WXSDK.Shake();
  1090. this._animator.play("sky");
  1091. }
  1092. ARRIVER() {
  1093. this._destination = true;
  1094. Laya.timer.clear(this, this.SetNewMovePoint);
  1095. this._animator.play("win");
  1096. if (this.Tag_Head) {
  1097. GameManager.Instance.GameWin();
  1098. for (let i = 0; i < this.RoleList.length; i++) {
  1099. let item = this.RoleList[i].getComponent(MateMove);
  1100. if (item) {
  1101. item.ARRIVER();
  1102. }
  1103. }
  1104. }
  1105. }
  1106. DIE() {
  1107. Laya.timer.clearAll(this);
  1108. this._gameobject.active = false;
  1109. if (this.Tag_Head && this.RoleList.length == 0) {
  1110. GameManager.Instance.GameLose();
  1111. }
  1112. this.destroy();
  1113. }
  1114. FallDown() {
  1115. if (this.Tag_Head) {
  1116. Laya.timer.clearAll(this);
  1117. GameManager.Instance.GameLose();
  1118. AudioManager.PlayVoice(VoiceType.lose);
  1119. WXSDK.Shake(false);
  1120. this.DestroyProBar();
  1121. this.destroy();
  1122. }
  1123. }
  1124. SetMoveTarger(_point, _rotate) {
  1125. if (this.pause)
  1126. return;
  1127. if (_point) {
  1128. this._MovetarPos = _point;
  1129. this._gameobject.transform.position = this._MovetarPos.clone();
  1130. this._gameobject.transform.rotationEuler = _rotate.clone();
  1131. this.MovePointList.push(_point);
  1132. if (this.MovePointList.length > 100) {
  1133. this.MovePointList.shift();
  1134. }
  1135. this.MoveRotateList.push(_rotate);
  1136. if (this.MoveRotateList.length > 100) {
  1137. this.MoveRotateList.shift();
  1138. }
  1139. }
  1140. }
  1141. RoleMoveFun() {
  1142. if (this.pause)
  1143. return;
  1144. Quaternion.lookAt(this._MovetarPos, this._transform.position, this._up, this._quaternion);
  1145. this._quaternion.invert(this._quaternion);
  1146. Quaternion.slerp(this._transform.rotation, this._quaternion, 0.1, this._quaternion);
  1147. this._transform.rotation = this._quaternion.clone();
  1148. let _rotationEuler = this._transform.rotationEuler.clone();
  1149. _rotationEuler.x = 0;
  1150. _rotationEuler.z = 0;
  1151. this._transform.rotationEuler = _rotationEuler;
  1152. }
  1153. SetNewMovePoint(_transform) {
  1154. if (this.Tag_Head) {
  1155. var _movePos = _transform.position.clone();
  1156. var _point = new Laya.Vector3(_movePos.x, _movePos.y, _movePos.z);
  1157. var _rotate = _transform.rotationEuler.clone();
  1158. this.MovePointList.push(_point);
  1159. if (this.MovePointList.length > 200) {
  1160. this.MovePointList.shift();
  1161. }
  1162. this.MoveRotateList.push(_rotate);
  1163. if (this.MoveRotateList.length > 200) {
  1164. this.MoveRotateList.shift();
  1165. }
  1166. for (let i = 0; i < this.RoleList.length; i++) {
  1167. var _script = this.RoleList[i].getComponent(MateMove);
  1168. if (_script) {
  1169. var _id = this.MovePointList.length - 1 - (i + 1) * 10;
  1170. _script.SetMoveTarger(this.MovePointList[_id], this.MoveRotateList[_id]);
  1171. }
  1172. }
  1173. }
  1174. }
  1175. RoleDie() {
  1176. if (this.RoleList.length == 0) {
  1177. return;
  1178. }
  1179. var _newHand = this.RoleList[0];
  1180. var _script = _newHand.getComponent(MateMove);
  1181. if (_script) {
  1182. _script._gameobject.transform.rotationEuler = this._gameobject.transform.rotationEuler.clone();
  1183. _script.Tag_Head = true;
  1184. PlayerManager.Instance.player = _script._gameobject;
  1185. _script.RoleList = [];
  1186. for (let i = 1; i < this.RoleList.length; i++) {
  1187. _script.RoleList.push(this.RoleList[i]);
  1188. }
  1189. }
  1190. }
  1191. MoveToGroup() {
  1192. this.targetPos = this.targetmodel.transform.position;
  1193. let tarPos = this.targetPos;
  1194. let speed = 0.05;
  1195. Vector3$2.subtract(tarPos, this._transform.position, this._forward);
  1196. Vector3$2.normalize(this._forward, this._forward);
  1197. this._forward = new Vector3$2(this._forward.x * speed, this._forward.y * speed, this._forward.z * speed);
  1198. this._transform.translate(this._forward, false);
  1199. if (Vector3$2.distance(this._transform.position, tarPos) < 0.1) {
  1200. this.ArriverTargetPos();
  1201. return;
  1202. }
  1203. Quaternion.lookAt(tarPos, this._transform.position, this._up, this._quaternion);
  1204. this._quaternion.invert(this._quaternion);
  1205. Quaternion.slerp(this._transform.rotation, this._quaternion, 0.1, this._quaternion);
  1206. this._transform.rotation = this._quaternion.clone();
  1207. }
  1208. Move(_dir) {
  1209. if (this.pause)
  1210. return;
  1211. let speed = this.testspeed;
  1212. if (this.ChargeTime > 0) {
  1213. this.ChargeTime -= 0.01;
  1214. speed = speed + this.ChargeSpeed;
  1215. }
  1216. else {
  1217. this.ChargeSpeed = GameTools.Instance.lerp(this.ChargeSpeed, 0, 0.1);
  1218. speed = speed + this.ChargeSpeed;
  1219. this.ChargeTime = 0;
  1220. }
  1221. this.curspeed = GameTools.Instance.lerp(this.curspeed, speed, 0.1);
  1222. Vector3$2.scale(_dir, this.curspeed, this.offest);
  1223. Vector3$2.add(this._gameobject.transform.position, this.offest, this.curpos);
  1224. Vector3$2.lerp(this._gameobject.transform.position, this.curpos, 0.15, this.curpos);
  1225. if (this.CanJump) {
  1226. this.JumpTime += 0.8;
  1227. var Height = this.JumpSpeed * this.JumpTime * 1.9 - (this.JumpTime * this.JumpTime * this.JumpSpeedUp);
  1228. if (Height > 0) {
  1229. this.curpos = new Vector3$2(this.curpos.x, this.curpos.y + Height, this.curpos.z);
  1230. }
  1231. else {
  1232. this.CanJump = false;
  1233. }
  1234. this.curpos = new Vector3$2(this.curpos.x, this.curpos.y + 0.8, this.curpos.z);
  1235. this._gameobject.transform.position = this.curpos;
  1236. }
  1237. else {
  1238. this.curpos = new Vector3$2(this.curpos.x, this.curpos.y, this.curpos.z);
  1239. this._gameobject.transform.position = this.curpos;
  1240. }
  1241. }
  1242. ArriverTargetPos() {
  1243. this._gameobject.transform.position = this.targetmodel.transform.position.clone();
  1244. this._gameobject.transform.rotationEuler = this.targetmodel.transform.rotationEuler.clone();
  1245. this._arriver = true;
  1246. }
  1247. get DownRayCheck() {
  1248. var startPos = new Vector3$2(this._gameobject.transform.position.x, this._gameobject.transform.position.y + 0.1, this._gameobject.transform.position.z);
  1249. let foward = new Laya.Vector3(0, -1, 0);
  1250. var FowardRay = new Laya.Ray(startPos, foward);
  1251. var isDownHit = false;
  1252. if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this.Downhit, 1)) {
  1253. if (this.Downhit != null) {
  1254. if (this.Downhit.collider.collisionGroup == 1) {
  1255. isDownHit = true;
  1256. }
  1257. }
  1258. }
  1259. return isDownHit;
  1260. }
  1261. get FowardRayCheck() {
  1262. var isFowardHit = false;
  1263. var startPos = new Vector3$2(this._gameobject.transform.position.x, this._gameobject.transform.position.y + 0.1, this._gameobject.transform.position.z);
  1264. let foward = Transform3DHelper$1.getForward(this._gameobject.transform);
  1265. var FowardRay = new Laya.Ray(startPos, foward);
  1266. if (AssetManager.Instance.mainscene.physicsSimulation.rayCast(FowardRay, this.FowardHit, 0.1)) {
  1267. if (this.FowardHit) {
  1268. }
  1269. if (this.FowardHit.collider.collisionGroup == 100) {
  1270. this.ForwardTarget = this.FowardHit.collider;
  1271. isFowardHit = true;
  1272. let _mate = this.FowardHit.collider.owner.parent.getComponent(MateMove);
  1273. if (_mate) {
  1274. let _model;
  1275. if (this.RoleList.length > 0) {
  1276. _model = this.RoleList[this.RoleList.length - 1];
  1277. }
  1278. else {
  1279. _model = this._gameobject;
  1280. }
  1281. _mate.Start(_model);
  1282. let target = this.FowardHit.collider.owner.parent;
  1283. if (!this.JudgeEqual(target)) {
  1284. this.RoleList.push(target);
  1285. }
  1286. }
  1287. AudioManager.PlayVoice(VoiceType.crashrole);
  1288. WXSDK.Shake();
  1289. }
  1290. else if (this.FowardHit.collider.collisionGroup == 2) {
  1291. this.isdead = true;
  1292. let _wall = this.FowardHit.collider.owner.parent;
  1293. let _behav = _wall.getComponent(WallBehav);
  1294. if (_behav) {
  1295. _behav.Crash();
  1296. }
  1297. else {
  1298. _behav = _wall.addComponent(WallBehav);
  1299. _behav.crash = true;
  1300. }
  1301. AudioManager.PlayVoice(VoiceType.crashwall);
  1302. WXSDK.Shake();
  1303. }
  1304. else if (this.FowardHit.collider.collisionGroup == 3) {
  1305. this.Crash();
  1306. }
  1307. else if (this.FowardHit.collider.collisionGroup == 4) {
  1308. let stage = Number(AccountManager.Instance.curplayerData.GainAccount("stage")) + 1;
  1309. if (stage == 1) {
  1310. if (this.FowardHit.collider.owner.parent.name == "roleguide") {
  1311. if (!this.showguide1) {
  1312. this.showguide1 = true;
  1313. DispatcherManager.StageTrigger(StageState.ShowGuide1);
  1314. }
  1315. }
  1316. else if (this.FowardHit.collider.owner.parent.name == "rotateguide") {
  1317. if (!this.showguide2) {
  1318. this.showguide2 = true;
  1319. DispatcherManager.StageTrigger(StageState.ShowGuide2);
  1320. }
  1321. }
  1322. }
  1323. }
  1324. else if (this.FowardHit.collider.collisionGroup == 200) {
  1325. }
  1326. else if (this.FowardHit.collider.collisionGroup == 400) {
  1327. let atkpos_z = this.FowardHit.collider.owner.parent.transform.position.clone();
  1328. if (!this.isarrive) {
  1329. this.isarrive = true;
  1330. this.NearAtkPos(this.RoleList.length + 1, atkpos_z.z);
  1331. }
  1332. }
  1333. }
  1334. return isFowardHit;
  1335. }
  1336. Crash() {
  1337. let target = this.FowardHit.collider.owner.parent;
  1338. switch (target.name) {
  1339. case "Ramp":
  1340. AudioManager.PlayVoice(VoiceType.fly);
  1341. this.SpeedUp(0.8, 0.3);
  1342. this.Jump();
  1343. break;
  1344. case "Coin":
  1345. let _behav = target.getComponent(CoinBehav);
  1346. if (_behav) {
  1347. _behav.OnTouch();
  1348. }
  1349. target.destroy();
  1350. break;
  1351. }
  1352. }
  1353. Gravity() {
  1354. if (this.curstate == RoleState.Sky) {
  1355. if (this.ChargeSpeed > 0.001) {
  1356. this.GravityTime += 0.008;
  1357. }
  1358. else {
  1359. this.GravityTime += 0.010;
  1360. }
  1361. var hight = this.GravityTime * this.GravityTime;
  1362. this._gameobject.transform.position = new Vector3$2(this._gameobject.transform.position.x, this._gameobject.transform.position.y - hight, this._gameobject.transform.position.z + hight / 2);
  1363. }
  1364. }
  1365. Jump() {
  1366. this.CanJump = true;
  1367. this.JumpTime = 0;
  1368. }
  1369. SpeedUp(_speed, _time) {
  1370. if (this.ChargeTime < _time) {
  1371. this.ChargeTime += 0.1;
  1372. }
  1373. if (this.ChargeSpeed < _speed) {
  1374. this.ChargeSpeed += 0.2;
  1375. }
  1376. }
  1377. Pause() {
  1378. this._animator.play("idle");
  1379. this.testspeed = 0;
  1380. this.pause = true;
  1381. for (let i = 0; i < this.RoleList.length; i++) {
  1382. let _role = this.RoleList[i].getComponent(MateMove);
  1383. if (_role) {
  1384. _role.Pause();
  1385. }
  1386. }
  1387. }
  1388. Resume() {
  1389. this.pause = false;
  1390. this._animator.play("run");
  1391. this.testspeed = 0.5;
  1392. for (let i = 0; i < this.RoleList.length; i++) {
  1393. let _role = this.RoleList[i].getComponent(MateMove);
  1394. if (_role) {
  1395. _role.Resume();
  1396. }
  1397. }
  1398. }
  1399. JudgeEqual(_model) {
  1400. for (let i = 0; i < this.RoleList.length; i++) {
  1401. let item = this.RoleList[i];
  1402. if (item == _model) {
  1403. return true;
  1404. }
  1405. }
  1406. return false;
  1407. }
  1408. SetRoleAtk() {
  1409. for (let i = 0; i < this.RoleList.length; i++) {
  1410. let item = this.RoleList[i].getComponent(MateMove);
  1411. item.isarrive = true;
  1412. item.pause = true;
  1413. }
  1414. }
  1415. MoveToAttackPoint() {
  1416. Vector3$2.subtract(this.tp, this._gameobject.transform.position, this.forW);
  1417. Vector3$2.normalize(this.forW, this.forW);
  1418. this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  1419. this._gameobject.transform.translate(this.forW, false);
  1420. let _dis = Vector3$2.distance(this._gameobject.transform.position, this.tp);
  1421. if (Vector3$2.distance(this._gameobject.transform.position, this.tp) < 1) {
  1422. Laya.timer.clear(this, this.MoveToAttackPoint);
  1423. this._animator.play("atk");
  1424. return;
  1425. }
  1426. Quaternion.lookAt(this.tp, this._gameobject.transform.position, this._up, this.quaternion1);
  1427. this.quaternion1.invert(this.quaternion1);
  1428. this._gameobject.transform.rotation = this.quaternion1.clone();
  1429. let _rotationEuler = this._transform.rotationEuler.clone();
  1430. _rotationEuler.x = 0;
  1431. _rotationEuler.z = 0;
  1432. this._transform.rotationEuler = _rotationEuler;
  1433. }
  1434. SetBossRotate() {
  1435. Laya.timer.frameLoop(1, this, this._SetBossRotate);
  1436. }
  1437. _SetBossRotate() {
  1438. if (this.Tag_Head) {
  1439. let _boss = AssetManager.Instance.Boss.getComponent(BossBehav);
  1440. if (_boss) {
  1441. _boss.SetTarRotate(this._gameobject);
  1442. }
  1443. }
  1444. }
  1445. NearAtkPos(_count, _zpos) {
  1446. this.tp = AssetManager.Instance.Boss.transform.position.clone();
  1447. Laya.timer.clear(this, this.SetNewMovePoint);
  1448. Laya.timer.frameLoop(1, this, this.MoveToAttackPoint);
  1449. this.SetRoleAtk();
  1450. this.SetBossRotate();
  1451. this.pause = true;
  1452. if (_count == 1)
  1453. return;
  1454. this.v3.z = _zpos;
  1455. var _dis = Math.abs(Number(AssetManager.Instance.leftpos.x) - Number(AssetManager.Instance.rightpos.x));
  1456. var _interval = Math.floor(_dis / (_count - 1));
  1457. var mubiaodian = AssetManager.Instance.endground.transform.position.clone();
  1458. var jiange = false;
  1459. var index = 1;
  1460. var num = 0;
  1461. this.v3.x = mubiaodian.x;
  1462. this.Defense(this.v3.clone());
  1463. for (let i = 0; i < this.RoleList.length; i++) {
  1464. num++;
  1465. const element = this.RoleList[i].getComponent(MateMove);
  1466. const element2 = this.RoleList[i].getComponent(MateMove);
  1467. if (num > 2) {
  1468. index++;
  1469. num = 1;
  1470. }
  1471. jiange = !jiange;
  1472. if (jiange) {
  1473. this.v3.x = mubiaodian.x - 1 * index;
  1474. }
  1475. else {
  1476. this.v3.x = mubiaodian.x + 1 * index;
  1477. }
  1478. element.Defense(this.v3.clone());
  1479. element.SetBossRotate();
  1480. }
  1481. DispatcherManager.StageTrigger(StageState.ArriverAttack);
  1482. }
  1483. ArriverAtkPos() {
  1484. Laya.timer.clear(this, this._Attack);
  1485. let BossTran = AssetManager.Instance.curstage.getChildByName("Boss");
  1486. let BossPos = BossTran.transform.position.clone();
  1487. Quaternion.lookAt(BossPos, this._gameobject.transform.position, this._up, this.quaternion2);
  1488. this.quaternion2.invert(this.quaternion2);
  1489. this._gameobject.transform.rotation = this.quaternion2.clone();
  1490. let _rotationEuler = this._transform.rotationEuler.clone();
  1491. _rotationEuler.x = 0;
  1492. _rotationEuler.z = 0;
  1493. this._transform.rotationEuler = _rotationEuler;
  1494. Laya.timer.loop(1, this, this.PlayAtkAni);
  1495. let tween = Laya.Tween.to(this._gameobject.transform, { RotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
  1496. tween.clear();
  1497. }, null, false));
  1498. return;
  1499. }
  1500. PlayAtkAni() {
  1501. if (!this.play) {
  1502. this.play = true;
  1503. AnimatorManager.Play(true, this._animator, "atk", false, Laya.Handler.create(this, () => {
  1504. let BossTran = AssetManager.Instance.curstage.getChildByName("Boss");
  1505. let _behav = BossTran.getComponent(BossBehav);
  1506. if (_behav) {
  1507. _behav.Injured(10);
  1508. }
  1509. this.play = false;
  1510. }));
  1511. }
  1512. }
  1513. _Defense() {
  1514. Vector3$2.subtract(this.tp, this._gameobject.transform.position, this.forW);
  1515. Vector3$2.normalize(this.forW, this.forW);
  1516. this.forW = new Vector3$2(this.forW.x * 0.15, this.forW.y * 0.15, this.forW.z * 0.15);
  1517. this._gameobject.transform.translate(this.forW, false);
  1518. let _dis = Vector3$2.distance(this._gameobject.transform.position, this.tp);
  1519. if (Vector3$2.distance(this._gameobject.transform.position, this.tp) < 0.5) {
  1520. Laya.timer.clear(this, this._Defense);
  1521. this.Attack(AssetManager.Instance.Boss.transform.position.clone());
  1522. return;
  1523. }
  1524. Quaternion.lookAt(this.tp, this._gameobject.transform.position, this._up, this.quaternion1);
  1525. this.quaternion1.invert(this.quaternion1);
  1526. this._gameobject.transform.rotation = this.quaternion1.clone();
  1527. let _rotationEuler = this._transform.rotationEuler.clone();
  1528. _rotationEuler.x = 0;
  1529. _rotationEuler.z = 0;
  1530. this._transform.rotationEuler = _rotationEuler;
  1531. }
  1532. Defense(pos) {
  1533. this.tp = pos;
  1534. Quaternion.lookAt(pos, this._gameobject.transform.position, this._up, this.quaternion1);
  1535. this.quaternion1.invert(this.quaternion1);
  1536. this._gameobject.transform.rotation = this.quaternion1.clone();
  1537. Laya.timer.frameLoop(1, this, this._Defense);
  1538. }
  1539. Attack(pos) {
  1540. this.tp = pos;
  1541. Quaternion.lookAt(pos, this._gameobject.transform.position, this._up2, this.quaternion3);
  1542. this.quaternion3.invert(this.quaternion3);
  1543. this._gameobject.transform.rotation = this.quaternion3.clone();
  1544. Laya.timer.frameLoop(1, this, this._Attack);
  1545. }
  1546. _Attack() {
  1547. Vector3$2.subtract(this.tp, this._gameobject.transform.position, this.forW);
  1548. Vector3$2.normalize(this.forW, this.forW);
  1549. this.forW = new Vector3$2(this.forW.x * 0.05, this.forW.y * 0.05, this.forW.z * 0.05);
  1550. this._gameobject.transform.translate(this.forW, false);
  1551. let _dis = Vector3$2.distance(this._gameobject.transform.position, this.tp);
  1552. if (Vector3$2.distance(this._gameobject.transform.position, this.tp) < 0.5) {
  1553. this.ArriverAtkPos();
  1554. return;
  1555. }
  1556. Quaternion.lookAt(this.tp, this._gameobject.transform.position, this._up2, this.quaternion3);
  1557. this.quaternion3.invert(this.quaternion3);
  1558. this._gameobject.transform.rotation = this.quaternion3.clone();
  1559. let _rotationEuler = this._transform.rotationEuler.clone();
  1560. _rotationEuler.x = 0;
  1561. _rotationEuler.z = 0;
  1562. this._transform.rotationEuler = _rotationEuler;
  1563. }
  1564. Killed() {
  1565. if (this.isdead)
  1566. return;
  1567. AnimatorManager.Play(false, this._animator, "die2", false, Laya.Handler.create(this, () => {
  1568. this.isdead = true;
  1569. }));
  1570. }
  1571. Injured(_demage) {
  1572. if (this.health == 0)
  1573. return;
  1574. if (!this.showpro) {
  1575. this.showpro = true;
  1576. this.AddProBar();
  1577. }
  1578. this.health -= _demage;
  1579. if (this.health <= 0) {
  1580. this.health = 0;
  1581. this.Killed();
  1582. }
  1583. }
  1584. AddProBar() {
  1585. let probar = this._gameobject.addComponent(MateHpBarBehav);
  1586. }
  1587. DestroyProBar() {
  1588. let probar = this._gameobject.getComponent(MateHpBarBehav);
  1589. if (probar) {
  1590. probar.destroy();
  1591. }
  1592. }
  1593. }
  1594. class PlayerManager {
  1595. constructor() {
  1596. this.canmove = false;
  1597. this.guide2stop = false;
  1598. this.trun = true;
  1599. PlayerManager.ins = this;
  1600. }
  1601. static get Instance() {
  1602. if (PlayerManager.ins == null) {
  1603. return new PlayerManager();
  1604. }
  1605. return PlayerManager.ins;
  1606. }
  1607. Init() {
  1608. this.Direction = AccountManager.Instance.curplayerData.LevelDirection;
  1609. let playerpref = AssetManager.Instance.Character.get(1);
  1610. this.player = Laya.Sprite3D.instantiate(playerpref);
  1611. LevelManager.Instance.spritepool.addChild(this.player);
  1612. this.player.transform.position = AssetManager.Instance.playerpos.transform.position.clone();
  1613. this.player.transform.rotation = AssetManager.Instance.playerpos.transform.rotation.clone();
  1614. this.trun = true;
  1615. DispatcherManager.StageOn(StageState.ShowGuide1, this, this.Guide1);
  1616. DispatcherManager.StageOn(StageState.ShowGuide2, this, this.Guide2);
  1617. }
  1618. RefreshPro() {
  1619. let startpoint = AssetManager.Instance.playerpos.transform.position.clone();
  1620. let Z = startpoint.z;
  1621. let finishpoint = AssetManager.Instance.finishpoint.z;
  1622. let distance = finishpoint - Z;
  1623. let pro = this.player.transform.position.z / distance;
  1624. return pro;
  1625. }
  1626. EnablePlayer() {
  1627. let _move = this.player.addComponent(MateMove);
  1628. _move.Tag_Head = true;
  1629. this.ListenOn();
  1630. }
  1631. ListenOn() {
  1632. Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.OnMouseDown);
  1633. }
  1634. ListenOff() {
  1635. Laya.stage.off(Laya.Event.MOUSE_DOWN, this, this.OnMouseDown);
  1636. }
  1637. DisablePlayer() {
  1638. let _move = this.player.getComponent(MateMove);
  1639. if (_move) {
  1640. _move.destroy();
  1641. }
  1642. }
  1643. Guide1() {
  1644. this.ListenOff();
  1645. let _matemove = this.player.getComponent(MateMove);
  1646. if (_matemove) {
  1647. _matemove.Pause();
  1648. }
  1649. }
  1650. Guide2() {
  1651. let _matemove = this.player.getComponent(MateMove);
  1652. if (_matemove) {
  1653. _matemove.Pause();
  1654. }
  1655. this.guide2stop = true;
  1656. }
  1657. Resume() {
  1658. let _matemove = this.player.getComponent(MateMove);
  1659. if (_matemove) {
  1660. _matemove.Resume();
  1661. }
  1662. }
  1663. OnMouseDown() {
  1664. if (this.Direction == 1) {
  1665. if (this.trun) {
  1666. this.player.transform.rotationEuler = new Laya.Vector3(0, -90, 0);
  1667. this.trun = !this.trun;
  1668. }
  1669. else {
  1670. this.player.transform.rotationEuler = new Laya.Vector3(0, 0, 0);
  1671. this.trun = !this.trun;
  1672. }
  1673. }
  1674. else if (this.Direction == 2) {
  1675. if (this.trun) {
  1676. this.player.transform.rotationEuler = new Laya.Vector3(0, 90, 0);
  1677. this.trun = !this.trun;
  1678. }
  1679. else {
  1680. this.player.transform.rotationEuler = new Laya.Vector3(0, 0, 0);
  1681. this.trun = !this.trun;
  1682. }
  1683. }
  1684. if (this.guide2stop) {
  1685. this.guide2stop = false;
  1686. this.Resume();
  1687. DispatcherManager.StageTrigger(StageState.HideGuide2);
  1688. }
  1689. }
  1690. }
  1691. var REG = Laya.ClassUtils.regClass;
  1692. var ui;
  1693. (function (ui) {
  1694. class GameResultViewUI extends Laya.Scene {
  1695. constructor() { super(); }
  1696. createChildren() {
  1697. super.createChildren();
  1698. this.createView(GameResultViewUI.uiView);
  1699. }
  1700. }
  1701. GameResultViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "12,13,14,10", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 29 }, { "type": "Image", "props": { "y": 210, "x": 90.5, "var": "WinBox", "skin": "Main/lanshandi.png", "alpha": 1 }, "compId": 4, "child": [{ "type": "Image", "props": { "y": -140, "x": 24, "skin": "Main/shenglilo.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 151, "x": 52.5, "skin": "Main/shangkuan.png" }, "compId": 6, "child": [{ "type": "Image", "props": { "y": 150, "x": 90.5, "skin": "Main/jinbidi.png" }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 27, "x": 86, "skin": "Main/jinbihud.png" }, "compId": 8 }, { "type": "Image", "props": { "y": 20, "x": 30, "skin": "Main/jinbi.png" }, "compId": 9 }, { "type": "Text", "props": { "y": -101, "x": 6, "width": 241, "var": "Win_GoldNum", "valign": "middle", "text": "888", "height": 69, "fontSize": 92, "font": "Microsoft YaHei", "color": "#92501d", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 10 }] }] }, { "type": "Button", "props": { "y": 470, "x": 82, "var": "Win_VideoBtn", "stateNum": 1, "skin": "Main/dihong.png" }, "compId": 12, "child": [{ "type": "Image", "props": { "y": 39, "x": 45, "skin": "Main/shipin.png" }, "compId": 13 }, { "type": "Image", "props": { "y": 40.5, "x": 158, "skin": "Main/sanbeilingqu.png" }, "compId": 14 }] }, { "type": "Button", "props": { "y": 627, "x": 204.5, "var": "Win_BackBtn", "stateNum": 1, "skin": "Main/shenglibtn-1.png" }, "compId": 15 }, { "type": "Button", "props": { "y": 434, "x": 125, "visible": false, "var": "Win_kuangbtn", "stateNum": 1, "skin": "Main/shenglibtn-4.png" }, "compId": 30, "child": [{ "type": "Image", "props": { "y": 5, "x": 6, "var": "win_dian", "skin": "Main/shenglibtn-3.png" }, "compId": 31 }, { "type": "Image", "props": { "y": -1, "x": 36, "skin": "Main/shenglibtn-2.png" }, "compId": 32 }] }] }, { "type": "Image", "props": { "y": 210, "x": 90.5, "var": "FailBox", "skin": "Main/beijing.png", "alpha": 1 }, "compId": 17, "child": [{ "type": "Image", "props": { "y": -140, "x": 24, "skin": "Main/tongguanshi-lo.png" }, "compId": 18 }, { "type": "Image", "props": { "y": 151, "x": 52.5, "skin": "Main/shangshudi.png" }, "compId": 19, "child": [{ "type": "Image", "props": { "y": 150, "x": 90.5, "skin": "Main/qinandi.png" }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 27, "x": 86, "skin": "Main/jinbihud.png" }, "compId": 21 }, { "type": "Image", "props": { "y": 20, "x": 30, "skin": "Main/jinbi.png" }, "compId": 22 }, { "type": "Text", "props": { "y": -101, "x": 6, "width": 241, "var": "Fail_GoldNum", "valign": "middle", "text": "888", "height": 69, "fontSize": 92, "font": "Microsoft YaHei", "color": "#3660ab", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 23 }] }] }, { "type": "Button", "props": { "y": 470, "x": 82, "var": "Fail_VideoBtn", "stateNum": 1, "skin": "Main/ludi.png" }, "compId": 24, "child": [{ "type": "Image", "props": { "y": 39, "x": 45, "skin": "Main/shipin.png" }, "compId": 25 }, { "type": "Image", "props": { "y": 39, "x": 157, "skin": "Main/sanbeilingqu.png" }, "compId": 26 }] }, { "type": "Button", "props": { "y": 627, "x": 204.5, "var": "Fail_BackBtn", "stateNum": 1, "skin": "Main/shibaibtn-1.png" }, "compId": 27 }, { "type": "Button", "props": { "y": 434, "x": 125, "visible": false, "var": "Fail_kuangbtn", "stateNum": 1, "skin": "Main/shibaibtn-3.png" }, "compId": 33, "child": [{ "type": "Image", "props": { "y": 5, "x": 6, "var": "fail_dian", "skin": "Main/shibaibtn-4.png" }, "compId": 34 }, { "type": "Image", "props": { "y": -1, "x": 36, "skin": "Main/shibaibtn-2.png" }, "compId": 35 }] }] }], "loadList": ["Main/chunhei.png", "Main/lanshandi.png", "Main/shenglilo.png", "Main/shangkuan.png", "Main/jinbidi.png", "Main/jinbihud.png", "Main/jinbi.png", "Main/dihong.png", "Main/shipin.png", "Main/sanbeilingqu.png", "Main/shenglibtn-1.png", "Main/shenglibtn-4.png", "Main/shenglibtn-3.png", "Main/shenglibtn-2.png", "Main/beijing.png", "Main/tongguanshi-lo.png", "Main/shangshudi.png", "Main/qinandi.png", "Main/ludi.png", "Main/shibaibtn-1.png", "Main/shibaibtn-3.png", "Main/shibaibtn-4.png", "Main/shibaibtn-2.png"], "loadList3D": [] };
  1702. ui.GameResultViewUI = GameResultViewUI;
  1703. REG("ui.GameResultViewUI", GameResultViewUI);
  1704. class HomeViewUI extends Laya.Scene {
  1705. constructor() { super(); }
  1706. createChildren() {
  1707. super.createChildren();
  1708. this.createView(HomeViewUI.uiView);
  1709. }
  1710. }
  1711. HomeViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Button", "props": { "y": 718, "x": 204, "var": "StartBtn", "stateNum": 1, "skin": "Main/dianjikaishi.png" }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 72, "x": 209, "width": 86, "var": "shou", "skin": "Main/shou.png", "scaleY": 1, "scaleX": 1, "pivotY": 46, "pivotX": 43, "height": 92 }, "compId": 19 }] }, { "type": "Button", "props": { "y": 630, "x": 0, "stateNum": 1, "skin": "Main/gengduo.png", "name": "MoreFunBtn" }, "compId": 9 }, { "type": "Button", "props": { "y": 754, "x": 606, "var": "SkinBtn", "stateNum": 1, "skin": "Main/shangdain.png" }, "compId": 10 }, { "type": "Button", "props": { "y": 630, "x": 605, "var": "SignBtn", "stateNum": 1, "skin": "Main/qiandao.png" }, "compId": 11 }, { "type": "Image", "props": { "y": 95, "x": 557, "width": 164, "skin": "Main/qiandi.png", "height": 55 }, "compId": 13, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/qian.png" }, "compId": 15 }, { "type": "Text", "props": { "y": 0, "x": 54, "width": 110, "var": "GoldNum", "valign": "middle", "text": "99999", "height": 55, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 18 }] }, { "type": "Box", "props": { "y": 160.5, "x": 127.5, "width": 487, "var": "ProBox", "height": 81 }, "compId": 21, "child": [{ "type": "ProgressBar", "props": { "y": 30, "x": 68, "width": 352, "value": 0, "skin": "Main/guandi-3.png", "height": 22 }, "compId": 20 }, { "type": "Image", "props": { "y": 11.5, "x": 20, "skin": "Main/guandi.png" }, "compId": 22, "child": [{ "type": "Text", "props": { "y": 9, "x": 1, "width": 56, "var": "NowLevelNum", "valign": "middle", "text": "10", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 23 }] }, { "type": "Image", "props": { "y": 12, "x": 414, "skin": "Main/zhongdian.png" }, "compId": 24 }] }, { "type": "Button", "props": { "y": 36, "x": 32, "var": "SetBtn", "stateNum": 1, "skin": "Main/shezhi.png" }, "compId": 26 }, { "type": "Image", "props": { "visible": false, "var": "SetPanel", "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "13,15,15,15", "right": 0, "left": 0, "bottom": 0 }, "compId": 48, "child": [{ "type": "Image", "props": { "y": 466, "x": 118.5, "skin": "Main/Background Pop up ads.png" }, "compId": 29, "child": [{ "type": "Image", "props": { "y": 40, "x": 73, "skin": "Main/Bouton policy privacy.png", "name": "shake" }, "compId": 30, "child": [{ "type": "Image", "props": { "y": 15, "x": 43, "skin": "Main/zhenfu.png" }, "compId": 33 }, { "type": "Image", "props": { "y": 25, "x": 121, "skin": "Main/kaigdi.png" }, "compId": 35, "child": [{ "type": "Image", "props": { "y": 9, "x": 94, "skin": "Main/OFF.png" }, "compId": 38 }, { "type": "Image", "props": { "y": 9, "x": 23, "skin": "Main/ON.png" }, "compId": 39 }] }, { "type": "Image", "props": { "y": 25, "x": 206, "skin": "Main/bodong.png", "name": "on" }, "compId": 41 }, { "type": "Image", "props": { "y": 25, "x": 121, "skin": "Main/boodong-2.png", "name": "off" }, "compId": 40 }, { "type": "Button", "props": { "y": 26, "x": 121, "width": 171, "var": "shakebtn", "height": 41 }, "compId": 49 }] }, { "type": "Image", "props": { "y": 151.5, "x": 73, "skin": "Main/Bouton policy privacy.png", "name": "sound" }, "compId": 31, "child": [{ "type": "Image", "props": { "y": 20, "x": 47, "skin": "Main/yinfu.png" }, "compId": 34 }, { "type": "Image", "props": { "y": 25, "x": 121, "skin": "Main/kaigdi.png" }, "compId": 42, "child": [{ "type": "Image", "props": { "y": 9, "x": 94, "skin": "Main/OFF.png" }, "compId": 43 }, { "type": "Image", "props": { "y": 9, "x": 23, "skin": "Main/ON.png" }, "compId": 44 }] }, { "type": "Image", "props": { "y": 25, "x": 206, "skin": "Main/bodong.png", "name": "on" }, "compId": 45 }, { "type": "Image", "props": { "y": 25, "x": 121, "skin": "Main/boodong-2.png", "name": "off" }, "compId": 46 }, { "type": "Button", "props": { "y": 26, "x": 121, "width": 171, "var": "soundbtn", "height": 41 }, "compId": 50 }] }, { "type": "Button", "props": { "y": -46, "x": -35, "var": "CloseSetBtn", "stateNum": 1, "skin": "Main/guanbi.png" }, "compId": 47 }] }] }, { "type": "Button", "props": { "y": 504, "x": 606, "var": "LotteryBtn", "stateNum": 1, "skin": "Main/qiandao-2.png" }, "compId": 52 }, { "type": "Button", "props": { "y": 754, "x": 0, "visible": false, "var": "RewardBtn", "stateNum": 1, "skin": "Main/gengduo -2.png" }, "compId": 53 }, { "type": "Box", "props": { "y": 890, "x": 23.5, "width": 673, "visible": false, "var": "UpgradeBox", "height": 227 }, "compId": 54, "child": [{ "type": "Image", "props": { "y": 2.5, "x": 5, "skin": "Main/wuazhudi.png" }, "compId": 55, "child": [{ "type": "Image", "props": { "y": -27.5, "x": 0, "skin": "Main/xiaodi.png", "name": "Info" }, "compId": 56, "child": [{ "type": "Image", "props": { "y": 42, "x": 16, "skin": "Main/wenzid.png" }, "compId": 74 }, { "type": "Image", "props": { "y": 85, "x": 47.5, "name": "icon" }, "compId": 77 }, { "type": "Text", "props": { "y": 45, "x": 23, "width": 185, "valign": "middle", "text": "刀兵", "name": "name", "height": 40, "fontSize": 24, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 75 }, { "type": "Text", "props": { "y": 204, "x": 149, "width": 66, "valign": "middle", "text": "lv2", "name": "lv", "height": 32, "fontSize": 30, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 76 }] }, { "type": "Image", "props": { "y": 21, "x": 243, "skin": "Main/cahgdi.png", "name": "Atk" }, "compId": 58, "child": [{ "type": "Image", "props": { "skin": "Main/gaoncb.png" }, "compId": 59 }, { "type": "Text", "props": { "y": 1, "x": 54, "width": 66, "valign": "middle", "text": "攻击", "height": 47, "fontSize": 22, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 60 }, { "type": "Text", "props": { "y": 6, "x": 135, "width": 66, "valign": "middle", "text": "400", "name": "nowatk", "height": 42, "fontSize": 22, "font": "Microsoft YaHei", "color": "#fee934", "align": "center", "runtime": "laya.display.Text" }, "compId": 61 }, { "type": "Text", "props": { "y": 6, "x": 299, "width": 66, "valign": "middle", "text": "+20", "name": "addatk", "height": 42, "fontSize": 22, "font": "Microsoft YaHei", "color": "#87fd37", "align": "center", "runtime": "laya.display.Text" }, "compId": 62 }] }, { "type": "Image", "props": { "y": 78, "x": 243, "skin": "Main/cahgdi.png", "name": "AtkSpeed" }, "compId": 63, "child": [{ "type": "Image", "props": { "skin": "Main/sudi-b.png" }, "compId": 64 }, { "type": "Text", "props": { "y": 1, "x": 54, "width": 66, "valign": "middle", "text": "攻速", "height": 47, "fontSize": 22, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 65 }, { "type": "Text", "props": { "y": 6, "x": 135, "width": 66, "valign": "middle", "text": "400", "name": "nowatkspeed", "height": 42, "fontSize": 22, "font": "Microsoft YaHei", "color": "#fee934", "align": "center", "runtime": "laya.display.Text" }, "compId": 66 }, { "type": "Text", "props": { "y": 6, "x": 299, "width": 66, "valign": "middle", "text": "+20", "name": "addatkspeed", "height": 42, "fontSize": 22, "font": "Microsoft YaHei", "color": "#87fd37", "align": "center", "runtime": "laya.display.Text" }, "compId": 67 }] }] }, { "type": "Button", "props": { "y": 136, "x": 312, "stateNum": 1, "skin": "Main/dalan.png" }, "compId": 68, "child": [{ "type": "Text", "props": { "y": 0, "x": 0, "width": 284, "valign": "middle", "text": "升级", "height": 75, "fontSize": 30, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 70 }] }] }], "animations": [{ "nodes": [{ "target": 19, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleY", "index": 20 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 19, "key": "scaleX", "index": 20 }] } }], "name": "handclick", "id": 1, "frameRate": 24, "action": 0 }], "loadList": ["Main/dianjikaishi.png", "Main/shou.png", "Main/gengduo.png", "Main/shangdain.png", "Main/qiandao.png", "Main/qiandi.png", "Main/qian.png", "Main/guandi-3.png", "Main/guandi.png", "Main/zhongdian.png", "Main/shezhi.png", "Main/chunhei.png", "Main/Background Pop up ads.png", "Main/Bouton policy privacy.png", "Main/zhenfu.png", "Main/kaigdi.png", "Main/OFF.png", "Main/ON.png", "Main/bodong.png", "Main/boodong-2.png", "Main/yinfu.png", "Main/guanbi.png", "Main/qiandao-2.png", "Main/gengduo -2.png", "Main/wuazhudi.png", "Main/xiaodi.png", "Main/wenzid.png", "Main/cahgdi.png", "Main/gaoncb.png", "Main/sudi-b.png", "Main/dalan.png"], "loadList3D": [] };
  1712. ui.HomeViewUI = HomeViewUI;
  1713. REG("ui.HomeViewUI", HomeViewUI);
  1714. class InGameViewUI extends Laya.Scene {
  1715. constructor() { super(); }
  1716. createChildren() {
  1717. super.createChildren();
  1718. this.createView(InGameViewUI.uiView);
  1719. }
  1720. }
  1721. InGameViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Box", "props": { "y": 123, "x": 116.5, "width": 487, "visible": true, "var": "ProBox", "height": 81 }, "compId": 8, "child": [{ "type": "ProgressBar", "props": { "y": 30, "x": 68, "width": 352, "var": "jindupro", "value": 0, "skin": "Main/guandi-3.png", "height": 22 }, "compId": 9 }, { "type": "Image", "props": { "y": 11.5, "x": 20, "skin": "Main/guandi.png" }, "compId": 10, "child": [{ "type": "Text", "props": { "y": 9, "x": 1, "width": 56, "var": "NowLevelNum", "valign": "middle", "text": "10", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 11 }] }, { "type": "Image", "props": { "y": 12, "x": 414, "skin": "Main/zhongdian.png" }, "compId": 12 }] }, { "type": "Image", "props": { "y": 181.5, "x": 251.5, "visible": true, "skin": "Main/shuliandi.png" }, "compId": 13, "child": [{ "type": "Text", "props": { "y": 0, "x": 28, "width": 161, "var": "CountTxt", "valign": "middle", "text": "小人数量:22", "height": 45, "fontSize": 24, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 14 }] }, { "type": "Box", "props": { "y": 998, "x": 166, "width": 388, "visible": false, "var": "GuideBox1", "height": 80 }, "compId": 16, "child": [{ "type": "Text", "props": { "y": 0, "x": 132, "wordWrap": true, "width": 148, "var": "Txt2", "valign": "top", "text": "收集同伴一起行动", "leading": 15, "height": 88, "fontSize": 35, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "laya.display.Text" }, "compId": 20 }] }, { "type": "Box", "props": { "y": 883, "x": 166, "width": 388, "visible": false, "var": "GuideBox2", "height": 186 }, "compId": 15, "child": [{ "type": "Image", "props": { "y": 69, "x": 194, "width": 87, "var": "shou1", "skin": "Main/shou-yindao3.png", "scaleY": 1, "scaleX": 1, "pivotY": 59, "pivotX": 44, "height": 117 }, "compId": 17 }, { "type": "Text", "props": { "y": 136, "x": 123.5, "width": 141, "var": "Txt1", "valign": "middle", "text": "点击转向", "height": 48, "fontSize": 35, "font": "Microsoft YaHei", "color": "#ffffff", "align": "left", "runtime": "laya.display.Text" }, "compId": 18 }] }], "animations": [{ "nodes": [{ "target": 17, "keyframes": { "scaleY": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleY", "index": 20 }], "scaleX": [{ "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 0 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 5 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 10 }, { "value": 0.8, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 15 }, { "value": 1, "tweenMethod": "linearNone", "tween": true, "target": 17, "key": "scaleX", "index": 20 }] } }], "name": "guideclick1", "id": 1, "frameRate": 24, "action": 0 }], "loadList": ["Main/guandi-3.png", "Main/guandi.png", "Main/zhongdian.png", "Main/shuliandi.png", "Main/shou-yindao3.png"], "loadList3D": [] };
  1722. ui.InGameViewUI = InGameViewUI;
  1723. REG("ui.InGameViewUI", InGameViewUI);
  1724. class LoadViewUI extends Laya.Scene {
  1725. constructor() { super(); }
  1726. createChildren() {
  1727. super.createChildren();
  1728. this.createView(LoadViewUI.uiView);
  1729. }
  1730. }
  1731. LoadViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "top": 0, "skin": "Load/beijing.png", "sizeGrid": "10,14,12,10", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 4 }, { "type": "ProgressBar", "props": { "y": 1018, "x": 165, "var": "jindupro", "skin": "Load/ss.png" }, "compId": 3 }, { "type": "Image", "props": { "y": 160, "x": 105, "skin": "Load/title.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 1062, "x": 292.5, "skin": "Load/jiazaizhon.png" }, "compId": 7 }], "loadList": ["Load/beijing.png", "Load/ss.png", "Load/title.png", "Load/jiazaizhon.png"], "loadList3D": [] };
  1732. ui.LoadViewUI = LoadViewUI;
  1733. REG("ui.LoadViewUI", LoadViewUI);
  1734. class LotteryViewUI extends Laya.Scene {
  1735. constructor() { super(); }
  1736. createChildren() {
  1737. super.createChildren();
  1738. this.createView(LotteryViewUI.uiView);
  1739. }
  1740. }
  1741. LotteryViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "11,13,15,12", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 36 }, { "type": "Box", "props": { "y": 253, "x": 10, "width": 700, "height": 581 }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 7.5, "x": 71.5, "skin": "Main/zhuanpandi.png" }, "compId": 6 }, { "type": "Image", "props": { "y": 288, "x": 350, "var": "dial", "skin": "Main/p__zhuan-wu1.png", "anchorY": 0.5, "anchorX": 0.5, "alpha": 1 }, "compId": 3, "child": [{ "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "pivotY": 225, "pivotX": 50, "name": "reward1", "height": 100 }, "compId": 10, "child": [{ "type": "Image", "props": { "y": 0, "x": 23, "name": "skin" }, "compId": 12 }, { "type": "Text", "props": { "y": 72, "x": 1.5, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 13 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 45, "pivotY": 225, "pivotX": 50, "name": "reward2", "height": 100 }, "compId": 14, "child": [{ "type": "Image", "props": { "y": 2, "x": 27, "name": "skin" }, "compId": 15 }, { "type": "Text", "props": { "y": 72, "x": 3, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 16 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 90, "pivotY": 225, "pivotX": 50, "name": "reward3", "height": 100 }, "compId": 17, "child": [{ "type": "Image", "props": { "y": 2, "x": 25.5, "name": "skin" }, "compId": 18 }, { "type": "Text", "props": { "y": 72, "x": 0, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 19 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 135, "pivotY": 225, "pivotX": 50, "name": "reward4", "height": 100 }, "compId": 20, "child": [{ "type": "Image", "props": { "y": 0, "x": -16.5, "name": "skin" }, "compId": 21 }, { "type": "Text", "props": { "y": 72, "x": 3, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 22 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 180, "pivotY": 225, "pivotX": 50, "name": "reward5", "height": 100 }, "compId": 23, "child": [{ "type": "Image", "props": { "y": 0, "x": 27, "name": "skin" }, "compId": 24 }, { "type": "Text", "props": { "y": 72, "x": 3, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 25 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 225, "pivotY": 225, "pivotX": 50, "name": "reward6", "height": 100 }, "compId": 26, "child": [{ "type": "Image", "props": { "y": 2, "x": 27, "name": "skin" }, "compId": 27 }, { "type": "Text", "props": { "y": 72, "x": 0, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 28 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 270, "pivotY": 225, "pivotX": 50, "name": "reward7", "height": 100 }, "compId": 29, "child": [{ "type": "Image", "props": { "y": 0, "x": 25.5, "name": "skin" }, "compId": 30 }, { "type": "Text", "props": { "y": 72, "x": 0, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 31 }] }, { "type": "Box", "props": { "y": 239, "x": 243, "width": 100, "rotation": 315, "pivotY": 225, "pivotX": 50, "name": "reward8", "height": 100 }, "compId": 32, "child": [{ "type": "Image", "props": { "y": 0, "x": 25.5, "name": "skin" }, "compId": 33 }, { "type": "Text", "props": { "y": 72, "x": 0, "wordWrap": true, "width": 97, "valign": "top", "text": "X500", "name": "name", "height": 28, "fontSize": 30, "color": "#043457", "align": "center", "runtime": "laya.display.Text" }, "compId": 34 }] }] }, { "type": "Image", "props": { "y": -159, "x": 111, "skin": "Main/choujian.png" }, "compId": 8 }, { "type": "Image", "props": { "y": 196, "x": 277, "skin": "Main/p__zhizhen.png", "name": "pont" }, "compId": 37 }] }, { "type": "Button", "props": { "y": 218, "x": 29, "var": "CloseBtn", "stateNum": 1, "skin": "Main/guabi.png" }, "compId": 9 }, { "type": "Button", "props": { "y": 903, "x": 160, "var": "VideoGetBtn", "stateNum": 1, "skin": "Main/anniu.png" }, "compId": 35 }], "loadList": ["Main/chunhei.png", "Main/zhuanpandi.png", "Main/p__zhuan-wu1.png", "Main/choujian.png", "Main/p__zhizhen.png", "Main/guabi.png", "Main/anniu.png"], "loadList3D": [] };
  1742. ui.LotteryViewUI = LotteryViewUI;
  1743. REG("ui.LotteryViewUI", LotteryViewUI);
  1744. class ReviveViewUI extends Laya.Scene {
  1745. constructor() { super(); }
  1746. createChildren() {
  1747. super.createChildren();
  1748. this.createView(ReviveViewUI.uiView);
  1749. }
  1750. }
  1751. ReviveViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "12,13,14,10", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 15 }, { "type": "Button", "props": { "y": 711, "x": 172.5, "var": "ReviveBtn", "stateNum": 1, "skin": "Main/dihong.png" }, "compId": 4, "child": [{ "type": "Image", "props": { "y": 39, "x": 41, "skin": "Main/shipin.png" }, "compId": 5 }, { "type": "Image", "props": { "y": 39, "x": 162, "skin": "Main/fuhuowenzi.png" }, "compId": 6 }] }, { "type": "Button", "props": { "y": 888, "x": 294, "var": "BackBtn", "stateNum": 1, "skin": "Main/fanhuiwenzi.png" }, "compId": 7 }, { "type": "Box", "props": { "y": 315, "x": 116.5, "width": 487, "var": "ProBox", "height": 81 }, "compId": 8, "child": [{ "type": "ProgressBar", "props": { "y": 30, "x": 68, "width": 352, "skin": "Main/guandi-3.png", "height": 22 }, "compId": 9 }, { "type": "Image", "props": { "y": 11.5, "x": 20, "skin": "Main/guandi.png" }, "compId": 10, "child": [{ "type": "Text", "props": { "y": 9, "x": 1, "width": 56, "var": "NowLevelNum", "valign": "middle", "text": "10", "height": 40, "fontSize": 30, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 11 }] }, { "type": "Image", "props": { "y": 12, "x": 414, "skin": "Main/zhongdian.png" }, "compId": 12 }] }, { "type": "Image", "props": { "y": 192, "x": 80.5, "skin": "Main/wenzi.png" }, "compId": 13 }], "loadList": ["Main/chunhei.png", "Main/dihong.png", "Main/shipin.png", "Main/fuhuowenzi.png", "Main/fanhuiwenzi.png", "Main/guandi-3.png", "Main/guandi.png", "Main/zhongdian.png", "Main/wenzi.png"], "loadList3D": [] };
  1752. ui.ReviveViewUI = ReviveViewUI;
  1753. REG("ui.ReviveViewUI", ReviveViewUI);
  1754. class SignViewUI extends Laya.Scene {
  1755. constructor() { super(); }
  1756. createChildren() {
  1757. super.createChildren();
  1758. this.createView(SignViewUI.uiView);
  1759. }
  1760. }
  1761. SignViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "compId": 2, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "top": 0, "skin": "Main/chunhei.png", "sizeGrid": "13,14,14,12", "right": 0, "name": "bg", "left": 0, "bottom": 0 }, "compId": 72 }, { "type": "Image", "props": { "y": 170, "x": 60.5, "skin": "Main/qinad-d.png" }, "compId": 5, "child": [{ "type": "Image", "props": { "y": 12, "x": 188, "skin": "Main/qiriqiandao.png" }, "compId": 6 }, { "type": "Box", "props": { "y": 101, "x": 0, "width": 600, "var": "signList", "height": 632 }, "compId": 73, "child": [{ "type": "Box", "props": { "y": 2, "x": 24, "width": 180, "name": "day1", "height": 200 }, "compId": 74, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 75, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 76 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第1天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 77 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 78 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 79, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 80 }] }] }] }, { "type": "Box", "props": { "y": 2, "x": 210, "width": 180, "name": "day2", "height": 200 }, "compId": 7, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 8, "child": [{ "type": "Image", "props": { "y": 118, "x": 85.5, "name": "item", "anchorY": 0.5, "anchorX": 0.5 }, "compId": 12 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第2天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 9 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 14 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 11, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 10 }] }] }] }, { "type": "Box", "props": { "y": 2, "x": 396, "width": 180, "name": "day3", "height": 200 }, "compId": 81, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 82, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 83 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第3天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 84 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 85 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 86, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 87 }] }] }] }, { "type": "Box", "props": { "y": 216, "x": 24, "width": 180, "name": "day4", "height": 200 }, "compId": 88, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 91, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 92 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第4天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 93 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 94 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 95, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 96 }] }] }] }, { "type": "Box", "props": { "y": 216, "x": 210, "width": 180, "name": "day5", "height": 200 }, "compId": 89, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 97, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 98 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第5天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 99 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 100 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 101, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 102 }] }] }] }, { "type": "Box", "props": { "y": 216, "x": 396, "width": 180, "name": "day6", "height": 200 }, "compId": 90, "child": [{ "type": "Image", "props": { "y": 0, "x": 4.5, "skin": "Main/pitongkuan.png" }, "compId": 103, "child": [{ "type": "Image", "props": { "y": 76, "x": 63, "skin": "Main/jinbi.png", "name": "item" }, "compId": 104 }, { "type": "Text", "props": { "y": 10, "x": 9, "width": 153, "valign": "middle", "text": "第6天", "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 105 }, { "type": "Text", "props": { "y": 145, "x": 52, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 106 }, { "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/heizha.png", "name": "isGet" }, "compId": 107, "child": [{ "type": "Image", "props": { "y": 63, "x": 29, "skin": "Main/yihuode.png" }, "compId": 108 }] }] }] }, { "type": "Box", "props": { "y": 436, "x": 12, "width": 553, "name": "day7", "height": 196 }, "compId": 57, "child": [{ "type": "Image", "props": { "y": -2, "x": 71, "skin": "Main/qitiankuang.png" }, "compId": 58, "child": [{ "type": "Text", "props": { "y": 42, "x": 42, "width": 78, "valign": "middle", "text": "第7天", "rotation": -45, "pivotY": 17, "pivotX": 39, "height": 33, "fontSize": 28, "font": "Microsoft YaHei", "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 59 }, { "type": "Image", "props": { "y": 58.5, "x": 180, "scaleY": 0.5, "scaleX": 0.5, "name": "item" }, "compId": 60 }, { "type": "Text", "props": { "y": 136, "x": 182, "width": 68, "valign": "middle", "text": "x100", "name": "itemnum", "height": 32, "fontSize": 28, "color": "#ffffff", "align": "center", "runtime": "laya.display.Text" }, "compId": 61 }, { "type": "Image", "props": { "y": 0, "x": -1, "width": 433, "skin": "Main/heizha.png", "sizeGrid": "63,54,82,55", "name": "isGet", "height": 198 }, "compId": 62, "child": [{ "type": "Image", "props": { "y": 42.5, "x": 160, "skin": "Main/yihuode.png" }, "compId": 63 }] }] }] }] }] }, { "type": "Image", "props": { "y": 70, "x": 556, "width": 164, "skin": "Main/qiandi.png", "height": 55 }, "compId": 65, "child": [{ "type": "Image", "props": { "y": 0, "x": 0, "skin": "Main/qian.png" }, "compId": 66 }, { "type": "Text", "props": { "y": 0, "x": 54, "width": 110, "var": "GoldNum", "valign": "middle", "text": "99999", "height": 55, "fontSize": 40, "color": "#ffffff", "bold": true, "align": "center", "runtime": "laya.display.Text" }, "compId": 67 }] }, { "type": "Button", "props": { "y": 948, "x": 172, "var": "receiveBtn", "stateNum": 1, "skin": "Main/bd-d.png" }, "compId": 68, "child": [{ "type": "Image", "props": { "y": 39, "x": 42, "skin": "Main/ship.png" }, "compId": 69 }, { "type": "Image", "props": { "y": 39, "x": 156, "skin": "Main/minf.png" }, "compId": 70 }] }, { "type": "Button", "props": { "y": 1101, "x": 274, "var": "closeBtn", "stateNum": 1, "skin": "Main/buyong.png" }, "compId": 71 }], "loadList": ["Main/chunhei.png", "Main/qinad-d.png", "Main/qiriqiandao.png", "Main/pitongkuan.png", "Main/jinbi.png", "Main/heizha.png", "Main/yihuode.png", "Main/qitiankuang.png", "Main/qiandi.png", "Main/qian.png", "Main/bd-d.png", "Main/ship.png", "Main/minf.png", "Main/buyong.png"], "loadList3D": [] };
  1762. ui.SignViewUI = SignViewUI;
  1763. REG("ui.SignViewUI", SignViewUI);
  1764. class SkinViewUI extends Laya.Scene {
  1765. constructor() { super(); }
  1766. createChildren() {
  1767. super.createChildren();
  1768. this.createView(SkinViewUI.uiView);
  1769. }
  1770. }
  1771. SkinViewUI.uiView = { "type": "Scene", "props": { "width": 720, "height": 1280 }, "loadList": [], "loadList3D": [] };
  1772. ui.SkinViewUI = SkinViewUI;
  1773. REG("ui.SkinViewUI", SkinViewUI);
  1774. })(ui || (ui = {}));
  1775. class InGameView extends ui.InGameViewUI {
  1776. constructor() {
  1777. super();
  1778. InGameView.ins = this;
  1779. }
  1780. static get Instance() {
  1781. if (InGameView.ins == null) {
  1782. return new InGameView();
  1783. }
  1784. return InGameView.ins;
  1785. }
  1786. OnShow() {
  1787. console.log("游戏界面");
  1788. this.on(Laya.Event.MOUSE_DOWN, this, this.ClickStart);
  1789. this.RefreshUI();
  1790. this.height = Laya.stage.height;
  1791. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  1792. this.height = Laya.stage.height;
  1793. });
  1794. DispatcherManager.StageOn(StageState.RefreshPro, this, this.SetProValue);
  1795. DispatcherManager.StageOn(StageState.ShowGuide1, this, this.ShowGuide1);
  1796. DispatcherManager.StageOn(StageState.HideGuide1, this, this.HideGuide1);
  1797. DispatcherManager.StageOn(StageState.ShowGuide2, this, this.ShowGuide2);
  1798. DispatcherManager.StageOn(StageState.HideGuide2, this, this.HideGuide2);
  1799. }
  1800. ClickStart() {
  1801. this.off(Laya.Event.MOUSE_DOWN, this, this.ClickStart);
  1802. }
  1803. RefreshUI() {
  1804. let stage = Number(AccountManager.Instance.curplayerData.GainAccount("stage")) + 1;
  1805. this.NowLevelNum.text = stage + "";
  1806. }
  1807. SetProValue(data) {
  1808. this.jindupro.value = data["pre"];
  1809. this.CountTxt.text = "小人数量:" + (Number(data["count"]) + 1);
  1810. }
  1811. ShowGuide1() {
  1812. this.GuideBox1.visible = true;
  1813. Laya.stage.on(Laya.Event.MOUSE_DOWN, this, this.HideGuide1);
  1814. }
  1815. HideGuide1() {
  1816. this.GuideBox1.visible = false;
  1817. Laya.stage.off(Laya.Event.MOUSE_DOWN, this, this.HideGuide1);
  1818. PlayerManager.Instance.Resume();
  1819. PlayerManager.Instance.ListenOn();
  1820. }
  1821. ShowGuide2() {
  1822. this.GuideBox2.visible = true;
  1823. this.guideclick1.play(null, true);
  1824. }
  1825. HideGuide2() {
  1826. this.GuideBox2.visible = false;
  1827. this.guideclick1.stop();
  1828. }
  1829. OnHide() {
  1830. DispatcherManager.StageOff(StageState.RefreshPro, this, this.SetProValue);
  1831. DispatcherManager.StageOff(StageState.ShowGuide1, this, this.ShowGuide1);
  1832. DispatcherManager.StageOff(StageState.HideGuide1, this, this.HideGuide1);
  1833. DispatcherManager.StageOff(StageState.ShowGuide2, this, this.ShowGuide2);
  1834. DispatcherManager.StageOff(StageState.HideGuide2, this, this.HideGuide2);
  1835. }
  1836. }
  1837. class Global {
  1838. }
  1839. Global.VERSION = "1.0.3";
  1840. Global.CFG = "123";
  1841. var HttpRequest = Laya.HttpRequest;
  1842. var Event = Laya.Event;
  1843. const JtSniperApiUrl = "https://waveapi.xwxgame.com/";
  1844. class TeamWave {
  1845. }
  1846. TeamWave.DengLu = "user/login";
  1847. TeamWave.KaiShi = "game/start";
  1848. TeamWave.JieShu = "game/play";
  1849. TeamWave.QianDao = "sign/sign";
  1850. TeamWave.Chengjiu = "achievement/getRewards";
  1851. TeamWave.Config = "config/table";
  1852. TeamWave.FenXiang = "fission/share";
  1853. TeamWave.LiXian = "fission/offline";
  1854. TeamWave.vd = "fission/vd";
  1855. TeamWave.FuHuo = "game/revival";
  1856. TeamWave.gadagdag = "treasure/click";
  1857. TeamWave.Invite = "invite/getRewards";
  1858. TeamWave.Lottery = "lottery/lottery";
  1859. TeamWave.ShareGetSkin = "theme/fission";
  1860. TeamWave.WearEquip = "theme/equip";
  1861. TeamWave.BuyEquip = "theme/buy";
  1862. TeamWave.ShouQuan = "user/auth";
  1863. TeamWave.JinBi = "user/sync";
  1864. ;
  1865. class ServerManager {
  1866. constructor() { }
  1867. static get Instance() {
  1868. if (ServerManager.ins) {
  1869. return ServerManager.ins;
  1870. }
  1871. else {
  1872. return new ServerManager();
  1873. }
  1874. }
  1875. Login(progresscb, completecb, errorcb) {
  1876. var Account = AccountManager.Instance;
  1877. var ver = Global.VERSION;
  1878. let Data = `code=${Account.code}&nickname=${Account.nickName}&avatar=${Account.avatarUrl}&gender=${Account.gender}&country=${Account.country}&province=${Account.province}&city=${Account.city}& device=${Account.device}$&share_id=${Account.share_id}&scene=${Account.scene}&v=${ver}`;
  1879. let httpRequest = new HttpRequest();
  1880. httpRequest.once(Event.PROGRESS, this, this.Progress, [progresscb, httpRequest]);
  1881. httpRequest.once(Event.COMPLETE, this, this.Complete, [completecb, httpRequest]);
  1882. httpRequest.once(Event.ERROR, this, this.Errorcb, [errorcb, httpRequest]);
  1883. httpRequest.send(JtSniperApiUrl + TeamWave.DengLu, Data, "post", "text");
  1884. }
  1885. Progress(_progresscb, _httpreq) {
  1886. if (_progresscb) {
  1887. _progresscb.run();
  1888. }
  1889. }
  1890. Complete(_completecb, _httpreq) {
  1891. let data = JSON.parse(_httpreq.data);
  1892. console.log(data);
  1893. if (data["code"] != "0") {
  1894. console.log("登录异常错误!错误信息sssssssss:", _httpreq.data["code"]);
  1895. return;
  1896. }
  1897. console.log("-----------sss", data["t"]);
  1898. AccountManager.Instance.SFSFSF = data["t"];
  1899. this.RessetConfig(data, _completecb);
  1900. }
  1901. RessetConfig(data, completecb) {
  1902. AccountManager.Instance.ReSetting(data, (flag) => {
  1903. if (flag) {
  1904. completecb.runWith(data);
  1905. }
  1906. else {
  1907. this.RessetConfig(data, completecb);
  1908. }
  1909. });
  1910. }
  1911. Errorcb(_errorcb, _httpreq) {
  1912. if (_errorcb != null) {
  1913. _errorcb.runWith(_httpreq);
  1914. }
  1915. }
  1916. SendHttp(protocol, param, completecb, errorcb, hasToken = true) {
  1917. let sfaasfsfa = "";
  1918. let daadsads = JtSniperApiUrl + protocol;
  1919. if (hasToken == true) {
  1920. sfaasfsfa = `token=${AccountManager.Instance.curplayerData.zhengshu}&`;
  1921. }
  1922. if (protocol == TeamWave.KaiShi || protocol == TeamWave.JieShu || protocol == TeamWave.vd || protocol == TeamWave.Lottery || protocol == TeamWave.ShareGetSkin) {
  1923. let asddsa = "abcdefghijkimnopqrstuvwxyz0123456789";
  1924. let adsassda = "{";
  1925. let saafsafs = "";
  1926. for (let i = 0; i < 4; i++) {
  1927. saafsafs += asddsa[Math.floor(Math.random() * 100) % asddsa.length];
  1928. }
  1929. for (let i = 0; i < param.length; i++) {
  1930. for (let key in param[i]) {
  1931. adsassda += `\"${key}\":\"${param[i][key]}\"`;
  1932. }
  1933. if (i < param.length - 1) {
  1934. adsassda += ",";
  1935. }
  1936. else {
  1937. adsassda += "}";
  1938. }
  1939. }
  1940. sfaasfsfa += "_r=" + saafsafs + this.SFGSGSG(adsassda);
  1941. }
  1942. else {
  1943. if (param != null) {
  1944. for (let i = 0; i < param.length; i++) {
  1945. for (let key in param[i]) {
  1946. let val = param[i][key];
  1947. sfaasfsfa += `${key}=${val}`;
  1948. if (i < param.length - 1) {
  1949. sfaasfsfa += "&";
  1950. }
  1951. }
  1952. }
  1953. }
  1954. }
  1955. let httpRequest = new HttpRequest();
  1956. httpRequest.once(Event.COMPLETE, this, this.onHttpRequestComplete, [completecb, errorcb, httpRequest]);
  1957. httpRequest.once(Event.ERROR, this, this.Errorcb, [errorcb, httpRequest]);
  1958. httpRequest.send(daadsads, sfaasfsfa, "post", "text");
  1959. }
  1960. onHttpRequestComplete(succeedcb, failurecb, httpRequest) {
  1961. let data = JSON.parse(httpRequest.data);
  1962. if (data["code"] == 0) {
  1963. AccountManager.Instance.ReSetting(data);
  1964. if (succeedcb != null) {
  1965. succeedcb.runWith(data);
  1966. }
  1967. }
  1968. else {
  1969. if (failurecb != null) {
  1970. failurecb.runWith(data);
  1971. }
  1972. console.log("Error! Http request complete error, code: " + data["code"] + " message: " + data["message"]);
  1973. }
  1974. }
  1975. SFGSGSG(str) {
  1976. var c1, c2, c3;
  1977. var SFSFFSFSFSFS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  1978. var i = 0, len = str.length, SFFSSFFS = '';
  1979. while (i < len) {
  1980. c1 = str.charCodeAt(i++) & 0xff;
  1981. if (i == len) {
  1982. SFFSSFFS += SFSFFSFSFSFS.charAt(c1 >> 2);
  1983. SFFSSFFS += SFSFFSFSFSFS.charAt((c1 & 0x3) << 4);
  1984. SFFSSFFS += "==";
  1985. break;
  1986. }
  1987. c2 = str.charCodeAt(i++);
  1988. if (i == len) {
  1989. SFFSSFFS += SFSFFSFSFSFS.charAt(c1 >> 2);
  1990. SFFSSFFS += SFSFFSFSFSFS.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
  1991. SFFSSFFS += SFSFFSFSFSFS.charAt((c2 & 0xF) << 2);
  1992. SFFSSFFS += "=";
  1993. break;
  1994. }
  1995. c3 = str.charCodeAt(i++);
  1996. SFFSSFFS += SFSFFSFSFSFS.charAt(c1 >> 2);
  1997. SFFSSFFS += SFSFFSFSFSFS.charAt(((c1 & 0x3) << 4) | ((c2 & 0xF0) >> 4));
  1998. SFFSSFFS += SFSFFSFSFSFS.charAt(((c2 & 0xF) << 2) | ((c3 & 0xC0) >> 6));
  1999. SFFSSFFS += SFSFFSFSFSFS.charAt(c3 & 0x3F);
  2000. }
  2001. return SFFSSFFS;
  2002. }
  2003. }
  2004. class HomeView extends ui.HomeViewUI {
  2005. constructor() {
  2006. super();
  2007. HomeView.ins = this;
  2008. }
  2009. static get Instance() {
  2010. if (HomeView.ins == null) {
  2011. return new HomeView();
  2012. }
  2013. return HomeView.ins;
  2014. }
  2015. OnShow() {
  2016. console.log("主界面");
  2017. this.RefreshUI();
  2018. this.RegButton();
  2019. this.handclick.play(null, true);
  2020. }
  2021. RegButton() {
  2022. this.StartBtn.clickHandler = new Laya.Handler(this, this.Start);
  2023. this.SignBtn.clickHandler = new Laya.Handler(this, this.ClickSign);
  2024. this.LotteryBtn.clickHandler = new Laya.Handler(this, this.ClickLottery);
  2025. this.SkinBtn.clickHandler = new Laya.Handler(this, this.ClickSKin);
  2026. this.SetBtn.clickHandler = new Laya.Handler(this, this.ShowSetPanel);
  2027. this.CloseSetBtn.clickHandler = new Laya.Handler(this, this.HideSetPanel);
  2028. this.shakebtn.clickHandler = new Laya.Handler(this, this.ClickShake);
  2029. this.soundbtn.clickHandler = new Laya.Handler(this, this.ClickSound);
  2030. this.height = Laya.stage.height;
  2031. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  2032. this.height = Laya.stage.height;
  2033. });
  2034. }
  2035. RefreshUI() {
  2036. let stage = Number(AccountManager.Instance.curplayerData.GainAccount("stage")) + 1;
  2037. this.NowLevelNum.text = stage + "";
  2038. this.GoldNum.text = AccountManager.Instance.curplayerData.GainAccount("money");
  2039. }
  2040. Start() {
  2041. var agrs = [{ "t": AccountManager.Instance.ServerTime.toString() }];
  2042. ServerManager.Instance.SendHttp(TeamWave.KaiShi, agrs, Laya.Handler.create(this, (data) => {
  2043. GameManager.play_id = data.play_id;
  2044. PlayerManager.Instance.EnablePlayer();
  2045. this.handclick.stop();
  2046. this.shou.visible = false;
  2047. ViewManager.Instance.ShowView(ViewType.InGameView);
  2048. DispatcherManager.StageTrigger(StageState.Start);
  2049. }), null);
  2050. }
  2051. ShowSetPanel() {
  2052. this.SetPanel.visible = true;
  2053. let shakeon = this.SetPanel.getChildAt(0).getChildByName("shake").getChildByName("on");
  2054. let shakeoff = this.SetPanel.getChildAt(0).getChildByName("shake").getChildByName("off");
  2055. let soundon = this.SetPanel.getChildAt(0).getChildByName("sound").getChildByName("on");
  2056. let soundoff = this.SetPanel.getChildAt(0).getChildByName("sound").getChildByName("off");
  2057. soundon.visible = AudioManager.play;
  2058. soundoff.visible = !soundon.visible;
  2059. shakeon.visible = WXSDK.shake;
  2060. shakeoff.visible = !shakeon.visible;
  2061. }
  2062. HideSetPanel() {
  2063. this.SetPanel.visible = false;
  2064. }
  2065. ClickSound() {
  2066. let soundon = this.SetPanel.getChildAt(0).getChildByName("sound").getChildByName("on");
  2067. let soundoff = this.SetPanel.getChildAt(0).getChildByName("sound").getChildByName("off");
  2068. AudioManager.play = !AudioManager.play;
  2069. soundon.visible = AudioManager.play;
  2070. soundoff.visible = !soundon.visible;
  2071. if (AudioManager.play) {
  2072. AudioManager.PlayBGM(BGMType.bgm);
  2073. }
  2074. else {
  2075. AudioManager.StopMusic();
  2076. }
  2077. }
  2078. ClickShake() {
  2079. let shakeon = this.SetPanel.getChildAt(0).getChildByName("shake").getChildByName("on");
  2080. let shakeoff = this.SetPanel.getChildAt(0).getChildByName("shake").getChildByName("off");
  2081. WXSDK.shake = !WXSDK.shake;
  2082. shakeon.visible = WXSDK.shake;
  2083. shakeoff.visible = !shakeon.visible;
  2084. }
  2085. ClickSign() {
  2086. WXSDK.ShowTxt("暂未开放");
  2087. }
  2088. ClickLottery() {
  2089. WXSDK.ShowTxt("暂未开放");
  2090. }
  2091. ClickSKin() {
  2092. WXSDK.ShowTxt("暂未开放");
  2093. }
  2094. OnHide() {
  2095. }
  2096. }
  2097. class ReviveView extends ui.ReviveViewUI {
  2098. constructor() {
  2099. super();
  2100. ReviveView.ins = this;
  2101. }
  2102. static get Instance() {
  2103. if (ReviveView.ins == null) {
  2104. return new ReviveView();
  2105. }
  2106. return ReviveView.ins;
  2107. }
  2108. OnShow() {
  2109. this.height = Laya.stage.height;
  2110. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  2111. this.height = Laya.stage.height;
  2112. });
  2113. }
  2114. OnHide() {
  2115. }
  2116. }
  2117. class WxGameItem {
  2118. constructor() {
  2119. this.appNameHidden = false;
  2120. this.color = "C93B3BFF";
  2121. this.size = 100;
  2122. this.borderWidth = 50;
  2123. this.borderColor = "A1A0A0FF";
  2124. }
  2125. }
  2126. class GuangGao {
  2127. constructor() {
  2128. GuangGao.ins = this;
  2129. }
  2130. static get Instance() {
  2131. if (GuangGao.ins) {
  2132. return GuangGao.ins;
  2133. }
  2134. else {
  2135. return new GuangGao();
  2136. }
  2137. }
  2138. static InitVideo() {
  2139. if (!Laya.Browser.onWeiXin)
  2140. return;
  2141. console.log(this.bannerAdUnitId);
  2142. this.fsaasfafssfa = Laya.Browser.window.wx.createRewardedVideoAd({ adUnitId: this.videlAdUnitId });
  2143. this.fsaasfafssfa.onLoad(() => {
  2144. console.log('激励视频 广告加载成功');
  2145. this.asfasfsaffsa = true;
  2146. });
  2147. this.fsaasfafssfa.onError(err => {
  2148. console.log("激励视屏加载失败:" + err);
  2149. this.asfasfsaffsa = false;
  2150. });
  2151. this.afsfsaafsfsa = true;
  2152. }
  2153. static ShowVideo(callback) {
  2154. if (this.asfasfsaffsa) {
  2155. console.log("showVideoAd:" + this.asfasfsaffsa);
  2156. this.SetVideoCallBack(callback);
  2157. this.fsaasfafssfa.show().catch(err => {
  2158. this.fsaasfafssfa.load().then(() => {
  2159. this.SetVideoCallBack(callback);
  2160. this.fsaasfafssfa.show();
  2161. });
  2162. });
  2163. }
  2164. }
  2165. static SetVideoCallBack(callback) {
  2166. this.fsaasfafssfa.offClose();
  2167. this.fsaasfafssfa.onClose(res => {
  2168. console.log("激励视频关闭:" + res.isEnded);
  2169. if (res && res.isEnded || res === undefined) {
  2170. callback && callback(true);
  2171. }
  2172. else {
  2173. callback && callback(false);
  2174. }
  2175. this.fsaasfafssfa.offClose();
  2176. });
  2177. }
  2178. static OpenBanner(gap = 0, callVack = null, iswait = false) {
  2179. if (!Laya.Browser.onWeiXin) {
  2180. if (callVack) {
  2181. callVack(null);
  2182. }
  2183. return;
  2184. }
  2185. this.canshowbanner = true;
  2186. var idd = this.bannerAdUnitId;
  2187. console.log("adUnitId:" + idd);
  2188. let newBanner = Laya.Browser.window.wx.createBannerAd({
  2189. adUnitId: idd,
  2190. style: {
  2191. left: 0,
  2192. top: 0,
  2193. width: 460
  2194. }
  2195. });
  2196. newBanner.onError(err => {
  2197. console.log("广告错误onerror--");
  2198. console.log(err);
  2199. callVack(null);
  2200. });
  2201. newBanner.onLoad(() => {
  2202. if (this.curbanner)
  2203. this.curbanner.destroy();
  2204. this.curbanner = newBanner;
  2205. var hight = this.GetRealHight(gap);
  2206. if (callVack != null) {
  2207. callVack(hight);
  2208. }
  2209. if (this.canshowbanner && !iswait) {
  2210. this.curbanner.show();
  2211. }
  2212. else {
  2213. this.curbanner.hide();
  2214. }
  2215. });
  2216. }
  2217. static GetRealHight(gap) {
  2218. if (this.curbanner) {
  2219. let info = Laya.Browser.window.wx.getSystemInfoSync();
  2220. this.curbanner.style.width = info.windowWidth;
  2221. this.curbanner.style.top = info.windowHeight - this.curbanner.style.realHeight - gap;
  2222. return Laya.stage.height / info.windowHeight * this.curbanner.style.realHeight;
  2223. }
  2224. }
  2225. static Clear() {
  2226. Laya.timer.clearAll(this);
  2227. Laya.Tween.clearAll(this);
  2228. this.canshowbanner = false;
  2229. if (this.curbanner)
  2230. this.curbanner.hide();
  2231. }
  2232. static hidebanner() {
  2233. if (!Laya.Browser.onWeiXin)
  2234. return;
  2235. if (this.curbanner)
  2236. this.curbanner.hide();
  2237. }
  2238. static showbanner() {
  2239. if (!Laya.Browser.onWeiXin)
  2240. return;
  2241. if (this.curbanner)
  2242. this.curbanner.show();
  2243. }
  2244. static get cancheat() {
  2245. return false;
  2246. }
  2247. static SetPosBanner(btn, complete) {
  2248. if (Laya.Browser.onPC) {
  2249. complete(false);
  2250. return;
  2251. }
  2252. let info = Laya.Browser.window.wx.getSystemInfoSync();
  2253. var reshight = btn.y * info.windowHeight / Laya.stage.height;
  2254. var idd = this.bannerAdUnitId;
  2255. console.log("adUnitId:" + idd);
  2256. if (this.curbanner)
  2257. this.curbanner.destroy();
  2258. let newBanner = Laya.Browser.window.wx.createBannerAd({
  2259. adUnitId: idd,
  2260. style: {
  2261. left: 0,
  2262. top: 0,
  2263. width: 720
  2264. }
  2265. });
  2266. newBanner.onError(err => {
  2267. console.log(err);
  2268. complete(false);
  2269. });
  2270. newBanner.onLoad(() => {
  2271. this.curbanner = newBanner;
  2272. this.curbanner.style.top = reshight;
  2273. if (this.curbanner) {
  2274. console.log("banner show");
  2275. this.curbanner.show();
  2276. Laya.timer.once(2300, this, () => {
  2277. this.curbanner.style.top = info.windowHeight - GuangGao.bannerhigt;
  2278. complete(true);
  2279. });
  2280. }
  2281. });
  2282. newBanner.onResize((res) => {
  2283. GuangGao.bannerhigt = res.height;
  2284. this.curbanner.style.width = info.windowWidth;
  2285. this.curbanner.style.top = reshight;
  2286. });
  2287. }
  2288. static CheatBanner(btn, complete = null, gap = 0) {
  2289. if (!AccountManager.Instance.curplayerData.Cheat) {
  2290. console.log("ignorecheat");
  2291. GuangGao.OpenBanner(0, (height) => {
  2292. if (height == null) {
  2293. console.log("banner高度为null---");
  2294. }
  2295. });
  2296. }
  2297. else {
  2298. btn.y = Laya.stage.height - btn.height - 100;
  2299. GuangGao.OpenBanner(gap, (height) => {
  2300. if (height == null) {
  2301. }
  2302. else {
  2303. console.log("cheatstart", "bottom:100");
  2304. btn.mouseEnabled = false;
  2305. var end = Laya.stage.height - height - btn.height - 20;
  2306. console.log("y:" + end);
  2307. Laya.timer.once(1000, this, () => {
  2308. btn.mouseEnabled = true;
  2309. this.showbanner();
  2310. Laya.Tween.to(btn, { y: end }, 500, null, Laya.Handler.create(this, () => {
  2311. if (complete != null) {
  2312. complete();
  2313. }
  2314. }));
  2315. });
  2316. }
  2317. }, true);
  2318. }
  2319. }
  2320. showBanner(success = null, fail = null) {
  2321. if (!Laya.Browser.onWeiXin)
  2322. return;
  2323. var ran = GameTools.RandomANumber(0, 3);
  2324. let ad = GuangGao.bannerAdUnitId;
  2325. let bannerAd = Laya.Browser.window.wx.createBannerAd({
  2326. adUnitId: ad,
  2327. style: {
  2328. left: 0,
  2329. top: 0,
  2330. width: 460
  2331. }
  2332. });
  2333. bannerAd.onLoad(() => {
  2334. console.log("[LOG] Banner广告加载成功");
  2335. this.hideBanner();
  2336. this._bannerAd = bannerAd;
  2337. let info = Laya.Browser.window.wx.getSystemInfoSync();
  2338. this._bannerAd.style.width = info.windowWidth;
  2339. this._bannerAd.style.top = info.windowHeight - this._bannerAd.style.realHeight - 20;
  2340. this._bannerAd.show();
  2341. success && success(this._bannerAd);
  2342. });
  2343. bannerAd.onError(err => {
  2344. console.log("[LOG] Banner广告加载失败");
  2345. console.log(err);
  2346. fail && fail();
  2347. });
  2348. }
  2349. hideBanner() {
  2350. if (!Laya.Browser.onWeiXin)
  2351. return;
  2352. if (this._bannerAd) {
  2353. this._bannerAd.hide();
  2354. this._bannerAd.destroy();
  2355. this._bannerAd = null;
  2356. }
  2357. }
  2358. }
  2359. GuangGao.videlAdUnitId = "adunit-8feb4e40536601ff";
  2360. GuangGao.bannerAdUnitId = "adunit-426c9d6299d18f7e";
  2361. GuangGao.afsfsaafsfsa = false;
  2362. GuangGao.asfasfsaffsa = false;
  2363. GuangGao.canshowbanner = true;
  2364. GuangGao.bannerhigt = 0;
  2365. class GameResultView extends ui.GameResultViewUI {
  2366. constructor() {
  2367. super();
  2368. GameResultView.ins = this;
  2369. }
  2370. static get Instance() {
  2371. if (GameResultView.ins == null) {
  2372. return new GameResultView();
  2373. }
  2374. return GameResultView.ins;
  2375. }
  2376. OnShow(data) {
  2377. this._result = data;
  2378. if (data) {
  2379. this.WinBox.visible = true;
  2380. this.FailBox.visible = false;
  2381. }
  2382. else {
  2383. this.WinBox.visible = false;
  2384. this.FailBox.visible = true;
  2385. }
  2386. LevelManager.Instance.BackMain();
  2387. this.RefreshUI();
  2388. this.RegButton();
  2389. this.height = Laya.stage.height;
  2390. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  2391. this.height = Laya.stage.height;
  2392. });
  2393. }
  2394. RegButton() {
  2395. this.Win_BackBtn.clickHandler = new Laya.Handler(this, this.BackHome);
  2396. this.Win_VideoBtn.clickHandler = new Laya.Handler(this, this.WinVideoGet);
  2397. this.Win_kuangbtn.clickHandler = new Laya.Handler(this, this.ClickWinKuang);
  2398. this.Fail_BackBtn.clickHandler = new Laya.Handler(this, this.BackHome);
  2399. this.Fail_VideoBtn.clickHandler = new Laya.Handler(this, this.LoseVideoGet);
  2400. this.Fail_kuangbtn.clickHandler = new Laya.Handler(this, this.ClickLoseKuang);
  2401. }
  2402. RefreshUI() {
  2403. this.Win_GoldNum.text = (AccountManager.Instance.curplayerData.LevelReward(this._result) + GameManager.GoldNum) + "";
  2404. this.Fail_GoldNum.text = (AccountManager.Instance.curplayerData.LevelReward(this._result) + GameManager.GoldNum) + "";
  2405. }
  2406. ClickWinKuang() {
  2407. this.win_dian.visible = !this.win_dian.visible;
  2408. }
  2409. ClickLoseKuang() {
  2410. this.fail_dian.visible = !this.fail_dian.visible;
  2411. }
  2412. WinVideoGet() {
  2413. GuangGao.ShowVideo((isLoad) => {
  2414. if (isLoad) {
  2415. }
  2416. });
  2417. }
  2418. LoseVideoGet() {
  2419. GuangGao.ShowVideo((isLoad) => {
  2420. if (isLoad) {
  2421. }
  2422. });
  2423. }
  2424. BackHome() {
  2425. let stage = AccountManager.Instance.curplayerData.STAGE;
  2426. var iswin = this._result ? "1" : "0";
  2427. var coinnum = (AccountManager.Instance.curplayerData.LevelReward(this._result) + GameManager.GoldNum) + "";
  2428. var args = [{ "t": AccountManager.Instance.ServerTime.toString() }, { "play_id": GameManager.play_id }, { "win": iswin }, { "money": coinnum }];
  2429. ServerManager.Instance.SendHttp(TeamWave.JieShu, args, Laya.Handler.create(this, this.Success), null);
  2430. }
  2431. Success() {
  2432. GameManager.GoldNum = 0;
  2433. GameManager.Instance.GameOver();
  2434. }
  2435. OnHide() {
  2436. }
  2437. }
  2438. class SignView extends ui.SignViewUI {
  2439. constructor() {
  2440. super();
  2441. SignView.ins = this;
  2442. }
  2443. static get Instance() {
  2444. if (SignView.ins == null) {
  2445. return new SignView();
  2446. }
  2447. return SignView.ins;
  2448. }
  2449. OnShow() {
  2450. this.signReward = AccountManager.Instance.curplayerData.GainCollocation("sign");
  2451. this.RegButton();
  2452. this.RefreshUI();
  2453. this.InitData();
  2454. if (!SignView.canSgin) {
  2455. this.receiveBtn.visible = false;
  2456. }
  2457. else {
  2458. this.receiveBtn.visible = true;
  2459. }
  2460. this.height = Laya.stage.height;
  2461. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  2462. this.height = Laya.stage.height;
  2463. });
  2464. }
  2465. RefreshUI() {
  2466. this.GoldNum.text = AccountManager.Instance.curplayerData.GainAccount("money");
  2467. }
  2468. RegButton() {
  2469. this.receiveBtn.clickHandler = new Laya.Handler(this, this.ClickReceive);
  2470. this.closeBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
  2471. }
  2472. ClickReceive() {
  2473. if (Laya.Browser.onWeiXin) {
  2474. GuangGao.ShowVideo((isLoad) => {
  2475. if (isLoad) {
  2476. var agrs = [{ "video": "0" }];
  2477. ServerManager.Instance.SendHttp(TeamWave.QianDao, agrs, Laya.Handler.create(this, (e) => {
  2478. this.InitData();
  2479. this.RefreshUI();
  2480. this.showReward(e.rewards, () => {
  2481. this.ClickClose();
  2482. });
  2483. }), Laya.Handler.create(this, this.OnSignError), true);
  2484. }
  2485. });
  2486. }
  2487. else {
  2488. this.ClickClose();
  2489. }
  2490. }
  2491. OnSignError(e) {
  2492. console.log(e);
  2493. }
  2494. ClickClose() {
  2495. ViewManager.Instance.ShowView(ViewType.HomeView);
  2496. }
  2497. InitData() {
  2498. let day = Number(AccountManager.Instance.curplayerData.GetSign(signdata.sign_days));
  2499. let signtime = Number(AccountManager.Instance.curplayerData.GetSign(signdata.sign_time));
  2500. let curIndex = day % 7 + 1;
  2501. let first = day < 7;
  2502. let index = first ? 0 : 7;
  2503. let rewards = [];
  2504. for (var i = index; i < index + 7; i++) {
  2505. rewards[this.signReward[i].id] = this.signReward[i].rewards;
  2506. }
  2507. for (let i = 1 + index; i <= 7 + index; i++) {
  2508. let t = i % 8;
  2509. var rewardid = rewards[i];
  2510. var reward = AccountManager.Instance.curplayerData.GetRewardConfig(rewardid);
  2511. let dayBox = this.signList.getChildByName('day' + t).getChildAt(0);
  2512. let item = dayBox.getChildByName('item');
  2513. let itemnum = dayBox.getChildByName('itemnum');
  2514. let isGet = dayBox.getChildByName('isGet');
  2515. isGet.visible = false;
  2516. let type = reward.reward_item;
  2517. if (type == 1000) {
  2518. itemnum.text = reward.reward_num;
  2519. }
  2520. else {
  2521. item.skin = 'subpackage2/res/skin/' + reward.icon + '.png';
  2522. itemnum.visible = false;
  2523. }
  2524. if (t < curIndex) {
  2525. isGet.visible = true;
  2526. }
  2527. }
  2528. }
  2529. static get canSgin() {
  2530. let todayZero = new Date(AccountManager.Instance.ServerTime * 1000);
  2531. todayZero.setHours(0, 0, 0, 0);
  2532. var zeroTime = todayZero.valueOf();
  2533. var signtime = Number(AccountManager.Instance.curplayerData.GetSign(signdata.sign_time));
  2534. var signTime = signtime * 1000;
  2535. var can = signTime < zeroTime ? true : false;
  2536. return can;
  2537. }
  2538. static get CanVideoSign() {
  2539. let todayZero = new Date(AccountManager.Instance.ServerTime * 1000);
  2540. todayZero.setHours(0, 0, 0, 0);
  2541. let lasttime = new Date(AccountManager.Instance.ServerTime * 1000);
  2542. lasttime.setHours(24, 0, 0, 0);
  2543. var mtime = lasttime.valueOf();
  2544. var zeroTime = todayZero.valueOf();
  2545. var signtime = Number(AccountManager.Instance.curplayerData.GetSign(signdata.sign_time));
  2546. var signTime = signtime * 1000;
  2547. var can = (signTime > zeroTime && signTime < mtime) ? true : false;
  2548. return can;
  2549. }
  2550. showReward(rewards, callback) {
  2551. for (let key in rewards) {
  2552. let itemId = Number(key);
  2553. let itemnum = Number(rewards[key]);
  2554. if (itemId == 1000) {
  2555. GameTools.GetMoney(itemnum, null, Laya.Handler.create(this, () => {
  2556. callback && callback();
  2557. }));
  2558. }
  2559. else {
  2560. Laya.timer.once(1000, this, () => {
  2561. callback && callback();
  2562. });
  2563. }
  2564. }
  2565. }
  2566. OnHide() {
  2567. }
  2568. }
  2569. const REWARDNAME = "reward";
  2570. const MAINPATH = "Main/";
  2571. const SKINPATH = "subpackage2/res/skin/";
  2572. const CIRCLES = 5;
  2573. const ROTATIME = 5000;
  2574. class LotteryView extends ui.LotteryViewUI {
  2575. constructor() {
  2576. super();
  2577. LotteryView.ins = this;
  2578. }
  2579. static get Instance() {
  2580. if (LotteryView.ins == null) {
  2581. return new LotteryView();
  2582. }
  2583. return LotteryView.ins;
  2584. }
  2585. OnShow() {
  2586. this.RegButton();
  2587. this.RefreshUI();
  2588. this.height = Laya.stage.height;
  2589. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  2590. this.height = Laya.stage.height;
  2591. });
  2592. }
  2593. RefreshUI() {
  2594. let lottery = AccountManager.Instance.curplayerData.GainCollocation("lottery");
  2595. let idx = 1;
  2596. this._itemDic = new Dictionary();
  2597. lottery && lottery.forEach(item => {
  2598. this._itemDic.set(idx, item);
  2599. let type = Math.floor(Number(item.reward_item) * 0.001);
  2600. let reward = this.dial.getChildByName(`${REWARDNAME}${idx++}`);
  2601. if (!reward)
  2602. return;
  2603. let skin = reward.getChildByName("skin");
  2604. let name = reward.getChildByName("name");
  2605. if (type == 1) {
  2606. skin.skin = MAINPATH + item.icon + ".png";
  2607. name.text = "X" + item.reward_num.toString();
  2608. }
  2609. else if (type == 6) {
  2610. skin.skin = SKINPATH + item.icon + ".png";
  2611. name.text = item.name.toString();
  2612. name.visible = false;
  2613. }
  2614. }, this);
  2615. }
  2616. _rotateDial(data) {
  2617. let targRota = 360 * CIRCLES - 45 * (data.lottery_id - 1);
  2618. let tween = Laya.Tween.to(this.dial, { rotation: targRota }, ROTATIME, Laya.Ease.quadInOut, Laya.Handler.create(this, () => {
  2619. let item = this._itemDic.get(data.lottery_id);
  2620. let type = Math.floor(Number(item.reward_item) * 0.001);
  2621. var reward = data["rewards"];
  2622. if (reward["1000"]) {
  2623. var gg = Number(reward["1000"]);
  2624. GameTools.GetMoney(gg, null, Laya.Handler.create(this, () => {
  2625. ViewManager.Instance.ShowView(ViewType.LotteryView);
  2626. }));
  2627. }
  2628. else {
  2629. GameTools.TweenText(new faafssfafsa("皮肤 + 1", new Laya.Vector2(Laya.stage.width / 2, Laya.stage.height * 0.35), new Laya.Vector2(250, 80), 30), 150, Laya.Handler.create(this, () => {
  2630. ViewManager.Instance.ShowView(ViewType.LotteryView);
  2631. }));
  2632. }
  2633. }));
  2634. }
  2635. RegButton() {
  2636. this.VideoGetBtn.clickHandler = new Laya.Handler(this, this.ClickVideoGet);
  2637. this.CloseBtn.clickHandler = new Laya.Handler(this, this.ClickClose);
  2638. }
  2639. ClickClose() {
  2640. ViewManager.Instance.ShowView(ViewType.HomeView);
  2641. }
  2642. ClickVideoGet() {
  2643. this.VideoGetBtn.visible = false;
  2644. let param = [{ "channel": "video" }, { "t": AccountManager.Instance.ServerTime.toString() }];
  2645. ServerManager.Instance.SendHttp(TeamWave.Lottery, param, Laya.Handler.create(this, function (e) {
  2646. this._rotateDial(e);
  2647. }), Laya.Handler.create(this, () => {
  2648. WXSDK.ShowTxt("抽奖次数已经用完!");
  2649. }), true);
  2650. }
  2651. OnHide() {
  2652. }
  2653. }
  2654. class SkinView extends ui.SkinViewUI {
  2655. constructor() {
  2656. super();
  2657. SkinView.ins = this;
  2658. }
  2659. static get Instance() {
  2660. if (SkinView.ins == null) {
  2661. return new SkinView();
  2662. }
  2663. return SkinView.ins;
  2664. }
  2665. OnShow() {
  2666. this.height = Laya.stage.height;
  2667. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  2668. this.height = Laya.stage.height;
  2669. });
  2670. }
  2671. OnHide() {
  2672. }
  2673. }
  2674. var ViewType;
  2675. (function (ViewType) {
  2676. ViewType[ViewType["InGameView"] = 0] = "InGameView";
  2677. ViewType[ViewType["HomeView"] = 1] = "HomeView";
  2678. ViewType[ViewType["GameResultView"] = 2] = "GameResultView";
  2679. ViewType[ViewType["SkinView"] = 3] = "SkinView";
  2680. ViewType[ViewType["TrialView"] = 4] = "TrialView";
  2681. ViewType[ViewType["ReviveView"] = 5] = "ReviveView";
  2682. ViewType[ViewType["SignView"] = 6] = "SignView";
  2683. ViewType[ViewType["LotteryView"] = 7] = "LotteryView";
  2684. })(ViewType || (ViewType = {}));
  2685. ;
  2686. class ViewManager {
  2687. constructor() {
  2688. this.showexportview = 0;
  2689. this.popViewDic = [];
  2690. this.ViewSprite = new Laya.Sprite();
  2691. this.OtherViewSprite = new Laya.Sprite();
  2692. ViewManager.ins = this;
  2693. Laya.stage.addChild(this.ViewSprite);
  2694. Laya.stage.addChild(this.OtherViewSprite);
  2695. }
  2696. static get Instance() {
  2697. if (ViewManager.ins) {
  2698. return ViewManager.ins;
  2699. }
  2700. else {
  2701. return new ViewManager();
  2702. }
  2703. }
  2704. ShowView(_viewtype, data = null) {
  2705. if (this.curView != null) {
  2706. this.curView.OnHide();
  2707. this.curView.destroy();
  2708. this.curView.removeSelf();
  2709. }
  2710. this.curView = this.CreateView(_viewtype);
  2711. this.curView.name = ViewType[_viewtype];
  2712. this.ViewSprite.addChild(this.curView);
  2713. this.curView.OnShow(data);
  2714. }
  2715. CloseView() {
  2716. if (this.curView != null) {
  2717. this.curView.OnHide();
  2718. this.curView.destroy();
  2719. this.curView.removeSelf();
  2720. }
  2721. }
  2722. OpenPopView(viewType, data = null) {
  2723. var popView;
  2724. if (this.popViewDic[viewType]) {
  2725. popView = this.popViewDic[viewType];
  2726. this.OtherViewSprite.setChildIndex(popView, this.OtherViewSprite.numChildren - 1);
  2727. popView.visible = true;
  2728. }
  2729. else {
  2730. popView = this.CreateView(viewType);
  2731. this.OtherViewSprite.addChild(popView);
  2732. this.popViewDic[viewType] = popView;
  2733. }
  2734. popView.OnOpen(data);
  2735. }
  2736. ClosePopView(viewType) {
  2737. var popView = this.popViewDic[viewType];
  2738. if (popView == null) {
  2739. return;
  2740. }
  2741. popView.OnHide();
  2742. popView.visible = false;
  2743. }
  2744. ClearPopViews() {
  2745. }
  2746. CreateView(_viewtype) {
  2747. switch (_viewtype) {
  2748. case ViewType.InGameView:
  2749. return new InGameView();
  2750. case ViewType.HomeView:
  2751. return new HomeView();
  2752. case ViewType.ReviveView:
  2753. return new ReviveView();
  2754. case ViewType.GameResultView:
  2755. return new GameResultView();
  2756. case ViewType.SignView:
  2757. return new SignView();
  2758. case ViewType.LotteryView:
  2759. return new LotteryView();
  2760. case ViewType.SkinView:
  2761. return new SkinView();
  2762. }
  2763. return null;
  2764. }
  2765. }
  2766. class CameraManager {
  2767. constructor() {
  2768. this.LeftPosition = new Laya.Vector3(3.65, 5.72, -4.52);
  2769. this.LeftRotate = new Laya.Vector3(-24, 145, 0);
  2770. this.RightPosition = new Laya.Vector3(-3.78, 4.87, -4.46);
  2771. this.RightRotate = new Laya.Vector3(-24, -145, 0);
  2772. this.poschazhi = new Laya.Vector3();
  2773. this.gengsuipos = new Laya.Vector3();
  2774. this.lllpos = new Laya.Vector3();
  2775. this.hights = 0;
  2776. this.wights = 0;
  2777. CameraManager.ins = this;
  2778. DispatcherManager.StageOn(StageState.Start, this, this.CameraFollow);
  2779. DispatcherManager.StageOn(StageState.Win, this, this.CameraCancelFollow);
  2780. DispatcherManager.StageOn(StageState.Lose, this, this.CameraCancelFollow);
  2781. }
  2782. static get Instance() {
  2783. if (CameraManager.ins == null) {
  2784. return new CameraManager();
  2785. }
  2786. return CameraManager.ins;
  2787. }
  2788. Init() {
  2789. let Direction = AccountManager.Instance.curplayerData.LevelDirection;
  2790. if (Direction == 1) {
  2791. this.camera.transform.position = this.LeftPosition;
  2792. this.camera.transform.rotationEuler = this.LeftRotate;
  2793. }
  2794. else {
  2795. this.camera.transform.position = this.RightPosition;
  2796. this.camera.transform.rotationEuler = this.RightRotate;
  2797. }
  2798. this.CameraFollow();
  2799. }
  2800. CameraFollow() {
  2801. this.hights = 0;
  2802. this.wights = 0;
  2803. Laya.Vector3.subtract(PlayerManager.Instance.player.transform.position, this.camera.transform.position, this.poschazhi);
  2804. Laya.timer.frameLoop(1, this, this.GenSui);
  2805. }
  2806. GenSui() {
  2807. Laya.Vector3.subtract(PlayerManager.Instance.player.transform.position, this.poschazhi, this.gengsuipos);
  2808. this.hights = GameTools.Instance.lerp(this.hights, 1, 0.03);
  2809. this.wights = GameTools.Instance.lerp(this.wights, 1, 0.05);
  2810. this.gengsuipos = new Laya.Vector3(this.gengsuipos.x, this.gengsuipos.y, this.gengsuipos.z);
  2811. Laya.Vector3.lerp(this.camera.transform.position, this.gengsuipos, 0.25, this.lllpos);
  2812. this.lllpos = new Laya.Vector3(this.gengsuipos.x, this.lllpos.y, this.lllpos.z);
  2813. this.camera.transform.position = this.lllpos;
  2814. }
  2815. CameraCancelFollow() {
  2816. Laya.timer.clear(this, this.GenSui);
  2817. }
  2818. CameraRotate() {
  2819. let tween = Laya.Tween.to(this.camera.transform, { RotationEulerY: 0 }, 100, Laya.Ease.quintIn, Laya.Handler.create(this, () => {
  2820. tween.clear();
  2821. }, null, false));
  2822. }
  2823. }
  2824. class LevelManager {
  2825. constructor() {
  2826. LevelManager.ins = this;
  2827. }
  2828. static get Instance() {
  2829. if (LevelManager.ins == null) {
  2830. return new LevelManager();
  2831. }
  2832. return LevelManager.ins;
  2833. }
  2834. RegEvent() {
  2835. DispatcherManager.StageOn(StageState.Lose, this, this.GameLose);
  2836. DispatcherManager.StageOn(StageState.Win, this, this.GameWin);
  2837. DispatcherManager.StageOn(StageState.Pause, this, this.GamePause);
  2838. DispatcherManager.StageOn(StageState.Resume, this, this.GameResume);
  2839. DispatcherManager.StageOn(StageState.Over, this, this.GameStart);
  2840. }
  2841. GameStart() {
  2842. PlayerManager.Instance.Init();
  2843. CameraManager.Instance.Init();
  2844. ViewManager.Instance.ShowView(ViewType.HomeView);
  2845. AudioManager.PlayBGM(BGMType.bgm);
  2846. }
  2847. GameLose() {
  2848. PlayerManager.Instance.ListenOff();
  2849. Laya.timer.once(1000, this, () => {
  2850. ViewManager.Instance.ShowView(ViewType.GameResultView, false);
  2851. });
  2852. AudioManager.StopMusic();
  2853. }
  2854. GameWin() {
  2855. PlayerManager.Instance.ListenOff();
  2856. Laya.timer.once(1000, this, () => {
  2857. ViewManager.Instance.ShowView(ViewType.GameResultView, true);
  2858. });
  2859. AudioManager.StopMusic();
  2860. }
  2861. GamePause() {
  2862. }
  2863. GameResume() {
  2864. }
  2865. BackMain() {
  2866. for (let i = this.spritepool.numChildren - 1; i >= 0; i--) {
  2867. let child = this.spritepool.getChildAt(i);
  2868. let _well = child.getComponent(WallBehav);
  2869. if (_well) {
  2870. _well.destroy();
  2871. }
  2872. let _matemove = child.getComponent(MateMove);
  2873. if (_matemove) {
  2874. _matemove.destroy();
  2875. }
  2876. let _hppro = child.getComponent(HpBarBehav);
  2877. if (_hppro) {
  2878. _hppro.destroy();
  2879. }
  2880. child.removeSelf();
  2881. child.destroy();
  2882. child = null;
  2883. }
  2884. }
  2885. }
  2886. class AssetManager {
  2887. constructor() {
  2888. this.Prop = new Dictionary();
  2889. this.Character = new Dictionary();
  2890. AssetManager.ins = this;
  2891. DispatcherManager.EventOn(EventState.LoadComplete, this, this.Init);
  2892. }
  2893. static get Instance() {
  2894. if (AssetManager.ins == null) {
  2895. return new AssetManager();
  2896. }
  2897. return AssetManager.ins;
  2898. }
  2899. Init() {
  2900. this.mainscene.enableFog = true;
  2901. this.mainscene.fogStart = 25;
  2902. this.mainscene.fogRange = 40;
  2903. this.mainscene.fogColor = new Laya.Vector3(138 / 255, 78 / 255, 188 / 255);
  2904. Laya.stage.addChild(this.mainscene);
  2905. this.maincamera = this.mainscene.getChildByName("Main Camera");
  2906. this.maincamera.clearColor = new Laya.Vector4(138 / 255, 78 / 255, 188 / 255, 1);
  2907. this.maincamera.enableHDR = false;
  2908. CameraManager.Instance.camera = this.maincamera;
  2909. this.camerapos = this.maincamera.transform.position.clone();
  2910. this.camerarotate = this.maincamera.transform.rotationEuler.clone();
  2911. let _sprite = new Laya.Sprite3D();
  2912. this.mainscene.addChild(_sprite);
  2913. LevelManager.Instance.spritepool = _sprite;
  2914. this.SetCharacterPos();
  2915. LevelManager.Instance.RegEvent();
  2916. LevelManager.Instance.GameStart();
  2917. }
  2918. getPref(name) {
  2919. return this.Prop.get(name);
  2920. }
  2921. getRolePref(index) {
  2922. return this.Character.get(index);
  2923. }
  2924. SetCharacterPos() {
  2925. GameManager.STAGE = -1;
  2926. let _level = this.mainscene.getChildByName("level456");
  2927. let stage = AccountManager.Instance.curplayerData.STAGE;
  2928. let levelname = "level" + stage;
  2929. let decorate = this.mainscene.getChildByName("decorate");
  2930. let decorate2 = this.mainscene.getChildByName("decorate2");
  2931. let decorateid = AccountManager.Instance.curplayerData.SceneDecorate;
  2932. if (decorateid == 3) {
  2933. decorate.active = true;
  2934. decorate2.active = false;
  2935. }
  2936. else {
  2937. decorate.active = false;
  2938. decorate2.active = true;
  2939. }
  2940. for (let i = 0; i < _level.numChildren; i++) {
  2941. let item = _level.getChildAt(i);
  2942. if (item.name != levelname) {
  2943. item.active = false;
  2944. }
  2945. else {
  2946. item.active = true;
  2947. this.curstage = item;
  2948. }
  2949. }
  2950. for (let i = 0; i < this.curstage.numChildren; i++) {
  2951. let item = this.curstage.getChildAt(i);
  2952. if (item.name == "player") {
  2953. this.playerpos = Laya.Sprite3D.instantiate(item);
  2954. }
  2955. else if (item.name == "barrier") {
  2956. let _pref = this.getPref(ResourcesPath.Nail2);
  2957. let _cube = Laya.Sprite3D.instantiate(_pref);
  2958. LevelManager.Instance.spritepool.addChild(_cube);
  2959. _cube.transform.position = item.transform.position.clone();
  2960. _cube.transform.rotation = item.transform.rotation.clone();
  2961. _cube.transform.scale = item.transform.scale.clone();
  2962. _cube.name = ResourcesPath.Nail2;
  2963. NodeUtil.SetColliderGroup(_cube, 2);
  2964. }
  2965. else if (item.name == "role") {
  2966. let _pref = this.getRolePref(1);
  2967. let _player = Laya.Sprite3D.instantiate(_pref);
  2968. LevelManager.Instance.spritepool.addChild(_player);
  2969. _player.transform.position = item.transform.position.clone();
  2970. _player.transform.rotation = item.transform.rotation.clone();
  2971. let _mate = _player.addComponent(MateMove);
  2972. NodeUtil.SetColliderGroup(_player, 100);
  2973. }
  2974. else if (item.name == "speed") {
  2975. let _pref = this.getPref(ResourcesPath.Speed);
  2976. let _cube = Laya.Sprite3D.instantiate(_pref);
  2977. LevelManager.Instance.spritepool.addChild(_cube);
  2978. _cube.transform.position = item.transform.position.clone();
  2979. _cube.transform.rotation = item.transform.rotation.clone();
  2980. _cube.transform.scale = item.transform.scale.clone();
  2981. _cube.name = ResourcesPath.Speed;
  2982. NodeUtil.SetColliderGroup(item, 1);
  2983. }
  2984. else if (item.name == "Ramp") {
  2985. let _pref = this.getPref(ResourcesPath.Ramp);
  2986. let _cube = Laya.Sprite3D.instantiate(_pref);
  2987. LevelManager.Instance.spritepool.addChild(_cube);
  2988. _cube.transform.position = item.transform.position.clone();
  2989. _cube.transform.rotation = item.transform.rotation.clone();
  2990. _cube.transform.scale = item.transform.scale.clone();
  2991. _cube.name = ResourcesPath.Ramp;
  2992. NodeUtil.SetColliderGroup(item, 1);
  2993. }
  2994. else if (item.name == "bridge") {
  2995. NodeUtil.SetColliderGroup(item, 1);
  2996. }
  2997. else if (item.name == "Coin") {
  2998. let _pref = this.getPref(ResourcesPath.Coin);
  2999. let _cube = Laya.Sprite3D.instantiate(_pref);
  3000. LevelManager.Instance.spritepool.addChild(_cube);
  3001. _cube.transform.position = item.transform.position.clone();
  3002. _cube.transform.rotation = item.transform.rotation.clone();
  3003. _cube.transform.scale = item.transform.scale.clone();
  3004. _cube.name = ResourcesPath.Coin;
  3005. let coinbehav = _cube.addComponent(CoinBehav);
  3006. NodeUtil.SetColliderGroup(_cube, 3);
  3007. }
  3008. else if (item.name == "FinishCircle") {
  3009. let _pref = this.getPref(ResourcesPath.FinishCircle);
  3010. let _cube = Laya.Sprite3D.instantiate(_pref);
  3011. LevelManager.Instance.spritepool.addChild(_cube);
  3012. _cube.transform.position = item.transform.position.clone();
  3013. _cube.transform.rotation = item.transform.rotation.clone();
  3014. _cube.transform.scale = item.transform.scale.clone();
  3015. _cube.name = ResourcesPath.FinishCircle;
  3016. this.finishpoint = item.transform.position.clone();
  3017. NodeUtil.SetColliderGroup(_cube, 200);
  3018. }
  3019. else if (item.name == "Boss") {
  3020. let _behav = item.addComponent(BossBehav);
  3021. this.Boss = item;
  3022. }
  3023. else if (item.name == "roleguide" || item.name == "rotateguide" || item.name == "roleguideend" || item.name == "rotateguideend") {
  3024. NodeUtil.SetColliderGroup(item, 4);
  3025. }
  3026. else if (item.name == "AttackPoint") {
  3027. let left = item.getChildByName("leftpos");
  3028. let right = item.getChildByName("rightpos");
  3029. this.leftpos = left.transform.position.clone();
  3030. this.rightpos = right.transform.position.clone();
  3031. NodeUtil.SetColliderGroup(item, 400);
  3032. }
  3033. else if (item.name == "endground2") {
  3034. let _pref = this.getPref(ResourcesPath.EndGround);
  3035. let _cube = Laya.Sprite3D.instantiate(_pref);
  3036. LevelManager.Instance.spritepool.addChild(_cube);
  3037. _cube.transform.position = item.transform.position.clone();
  3038. _cube.transform.rotationEuler = item.transform.rotationEuler.clone();
  3039. _cube.transform.scale = item.transform.scale.clone();
  3040. _cube.name = ResourcesPath.EndGround;
  3041. let attackpoint = _cube.getChildByName("AttackPoint");
  3042. let left = attackpoint.getChildByName("leftpos");
  3043. let right = attackpoint.getChildByName("rightpos");
  3044. this.leftpos = left.transform.position.clone();
  3045. this.rightpos = right.transform.position.clone();
  3046. let bosspoint = _cube.getChildByName("BossPoint");
  3047. let _bosspref = this.getPref(ResourcesPath.Boss);
  3048. let _boss = Laya.Sprite3D.instantiate(_pref);
  3049. LevelManager.Instance.spritepool.addChild(_boss);
  3050. _boss.transform.position = bosspoint.transform.position.clone();
  3051. _boss.transform.rotationEuler = bosspoint.transform.rotationEuler.clone();
  3052. _boss.transform.scale = item.transform.scale.clone();
  3053. _boss.name = ResourcesPath.Boss;
  3054. console.log(_cube.transform.rotationEuler);
  3055. console.log(_cube.transform.position);
  3056. console.log(_cube.transform.scale);
  3057. this.endground = item;
  3058. }
  3059. }
  3060. }
  3061. }
  3062. class GameManager {
  3063. constructor() {
  3064. GameManager.ins = this;
  3065. }
  3066. static get Instance() {
  3067. if (GameManager.ins == null) {
  3068. return new GameManager();
  3069. }
  3070. return GameManager.ins;
  3071. }
  3072. GameLose() {
  3073. DispatcherManager.StageTrigger(StageState.Lose);
  3074. }
  3075. GameWin() {
  3076. DispatcherManager.StageTrigger(StageState.Win);
  3077. }
  3078. GameOver() {
  3079. AssetManager.Instance.SetCharacterPos();
  3080. DispatcherManager.StageTrigger(StageState.Over);
  3081. }
  3082. }
  3083. GameManager.STAGE = -1;
  3084. GameManager.GoldNum = 0;
  3085. var signdata;
  3086. (function (signdata) {
  3087. signdata[signdata["sign_days"] = 0] = "sign_days";
  3088. signdata[signdata["sign_time"] = 1] = "sign_time";
  3089. })(signdata || (signdata = {}));
  3090. var AccountUser;
  3091. (function (AccountUser) {
  3092. AccountUser[AccountUser["buyed_kun"] = 0] = "buyed_kun";
  3093. AccountUser[AccountUser["diamond"] = 1] = "diamond";
  3094. AccountUser[AccountUser["equip_themes"] = 2] = "equip_themes";
  3095. AccountUser[AccountUser["favorite_times"] = 3] = "favorite_times";
  3096. AccountUser[AccountUser["game_times"] = 4] = "game_times";
  3097. AccountUser[AccountUser["get_themes"] = 5] = "get_themes";
  3098. AccountUser[AccountUser["list_kun"] = 6] = "list_kun";
  3099. AccountUser[AccountUser["moeny"] = 7] = "moeny";
  3100. AccountUser[AccountUser["progress_themes"] = 8] = "progress_themes";
  3101. AccountUser[AccountUser["revival"] = 9] = "revival";
  3102. AccountUser[AccountUser["stage"] = 10] = "stage";
  3103. })(AccountUser || (AccountUser = {}));
  3104. class PlayerData {
  3105. constructor(_token, _config, _appSetting, _user, _userbase, _useInvite, _user_stage = null, _user_sign, _user_achievement, lottery) {
  3106. this.openid = "";
  3107. this.userId = "";
  3108. this.m_RewardDic = {};
  3109. this.zhengshu = _token;
  3110. this.netzheshe = _appSetting;
  3111. this.account = _user;
  3112. this.accountssss = _userbase;
  3113. this.qiandao = _user_sign;
  3114. this.renwu = _user_achievement;
  3115. this.userId = this.account["user_id"];
  3116. this.openid = this.accountssss["openid"];
  3117. this.m_invite = _useInvite;
  3118. this.lottery = lottery;
  3119. console.log("user_id:" + this.userId);
  3120. }
  3121. GetSign(_datatype) {
  3122. var type = signdata[_datatype];
  3123. return this.qiandao[type];
  3124. }
  3125. GainCollocation(_type) {
  3126. return this.peizhis[_type];
  3127. }
  3128. GainAccount(_type) {
  3129. return this.account[_type];
  3130. }
  3131. GetRewardDic() {
  3132. var config = this.GainCollocation("rewards");
  3133. for (var key in config) {
  3134. this.m_RewardDic[config[key].id] = config[key];
  3135. }
  3136. }
  3137. GetRewardConfig(_rewardid) {
  3138. var reward = this.m_RewardDic[_rewardid];
  3139. return reward;
  3140. }
  3141. get fenxiang() {
  3142. return this.netzheshe["share"] == "1";
  3143. }
  3144. get CheckScene() {
  3145. return this.netzheshe["checkscene"] == "1";
  3146. }
  3147. get Cheat() {
  3148. return this.netzheshe["cheat"] == "1";
  3149. }
  3150. get Banner() {
  3151. return this.netzheshe["Banner"] == "1";
  3152. }
  3153. get wudaoshijian() {
  3154. return Number(this.netzheshe["wudaoshijian"]);
  3155. }
  3156. get SceneDecorate() {
  3157. let stage = this.STAGE;
  3158. let _mission = this.GainCollocation("mission");
  3159. for (var key in _mission) {
  3160. let item = _mission[key];
  3161. if (item.ID == stage) {
  3162. return Number(item.scene);
  3163. }
  3164. }
  3165. return null;
  3166. }
  3167. LevelReward(win) {
  3168. let stage = this.STAGE;
  3169. let levelinfo = this.GainCollocation("mission");
  3170. for (var key in levelinfo) {
  3171. let item = levelinfo[key];
  3172. if (item.ID == stage) {
  3173. if (win) {
  3174. return Number(item.win);
  3175. }
  3176. else {
  3177. return Number(item.lose);
  3178. }
  3179. }
  3180. }
  3181. return null;
  3182. }
  3183. get LevelDirection() {
  3184. let stage = this.STAGE;
  3185. let levelinfo = this.GainCollocation("mission");
  3186. for (var key in levelinfo) {
  3187. let item = levelinfo[key];
  3188. if (item.ID == stage) {
  3189. return Number(item.direction);
  3190. }
  3191. }
  3192. return null;
  3193. }
  3194. get STAGE() {
  3195. if (GameManager.STAGE == -1) {
  3196. GameManager.STAGE = Number(this.GainAccount("stage")) + 1;
  3197. if (GameManager.STAGE > 30) {
  3198. GameManager.STAGE = GameTools.RandomANumber(1, 30);
  3199. }
  3200. }
  3201. return GameManager.STAGE;
  3202. }
  3203. GetUser(_type) {
  3204. var type = AccountUser[_type];
  3205. return this.account[type];
  3206. }
  3207. HasGun(_id) {
  3208. var data = this.GainAccount("get_themes");
  3209. for (var i = 0; i < data.length; i++) {
  3210. var hd = data[i];
  3211. if (_id == hd) {
  3212. return true;
  3213. }
  3214. }
  3215. return false;
  3216. }
  3217. GetProgress(_id) {
  3218. var config = this.account["progress_themes"];
  3219. var progress = config[_id] ? config[_id] : 0;
  3220. return progress;
  3221. }
  3222. get ShareTxt() {
  3223. return this.netzheshe["sharecontent"];
  3224. }
  3225. }
  3226. class AccountManager {
  3227. constructor(_code, _userinfo, _nickname, _avatarurl, _gender, _province, _city, _country, _device, _shareid, _scene, _v) {
  3228. this.createTime = Laya.timer.currTimer;
  3229. AccountManager.ins = this;
  3230. this.code = _code;
  3231. this.userInfo = _userinfo;
  3232. this.nickName = _nickname;
  3233. this.avatarUrl = _avatarurl;
  3234. this.gender = _gender;
  3235. this.province = _province;
  3236. this.city = _city;
  3237. this.country = _country;
  3238. this.device = _device;
  3239. this.share_id = _shareid;
  3240. this.scene = _scene;
  3241. this.v = _v;
  3242. }
  3243. static get Instance() {
  3244. if (AccountManager.ins == null) {
  3245. new AccountManager("222222", "你找谁?", "1233", "123", 1, "中国", "上海", "上海", "iphone6s", "123", "123", "123");
  3246. }
  3247. return AccountManager.ins;
  3248. }
  3249. ReSetting(data, cb = null) {
  3250. var zhengshu = data["token"];
  3251. var netset = data["app_setting"];
  3252. var user = data["user"];
  3253. var jichu = data["user_base"];
  3254. var qiandao = data["user_sign"];
  3255. var chengjiu = data["user_achievement"];
  3256. var invite = data["user_invite"];
  3257. var lottery = data["user_lottery"];
  3258. if (this.curplayerData == null) {
  3259. this.curplayerData = new PlayerData(zhengshu, null, netset, user, jichu, invite, null, qiandao, chengjiu, lottery);
  3260. this.JundgCfg(data.table_version, cb);
  3261. }
  3262. else {
  3263. if (netset) {
  3264. this.curplayerData.netzheshe = netset;
  3265. }
  3266. if (user) {
  3267. this.curplayerData.account = user;
  3268. }
  3269. if (jichu) {
  3270. this.curplayerData.accountssss = jichu;
  3271. }
  3272. if (qiandao) {
  3273. this.curplayerData.qiandao = qiandao;
  3274. }
  3275. if (chengjiu) {
  3276. this.curplayerData.renwu = chengjiu;
  3277. }
  3278. }
  3279. }
  3280. JundgCfg(ver, callball) {
  3281. var cfg = Laya.LocalStorage.getJSON(Global.CFG);
  3282. if (cfg) {
  3283. if (cfg.VER == ver) {
  3284. console.log("已经拥有,不用更新");
  3285. this.SetCfg(cfg);
  3286. if (callball)
  3287. callball(true);
  3288. }
  3289. else {
  3290. console.log("cfg存在但是过期了");
  3291. Laya.LocalStorage.removeItem(Global.CFG);
  3292. ServerManager.Instance.SendHttp(TeamWave.Config, null, Laya.Handler.create(this, (data) => {
  3293. data.configs.VER = ver;
  3294. Laya.LocalStorage.setJSON(Global.CFG, data.configs);
  3295. this.SetCfg(data.configs);
  3296. if (callball)
  3297. callball(true);
  3298. }), Laya.Handler.create(this, (data) => {
  3299. console.log("配置获取失败" + data);
  3300. if (callball)
  3301. callball(false);
  3302. return;
  3303. }));
  3304. }
  3305. }
  3306. else {
  3307. console.log("本地没有cfg");
  3308. ServerManager.Instance.SendHttp(TeamWave.Config, null, Laya.Handler.create(this, (data) => {
  3309. data.configs.VER = ver;
  3310. Laya.LocalStorage.setJSON(Global.CFG, data.configs);
  3311. this.SetCfg(data.configs);
  3312. if (callball)
  3313. callball(true);
  3314. }), Laya.Handler.create(this, (data) => {
  3315. console.log("配置获取失败" + data);
  3316. }));
  3317. }
  3318. }
  3319. SetCfg(data) {
  3320. this.curplayerData.peizhis = data;
  3321. this.curplayerData.GetRewardDic();
  3322. }
  3323. RessetConfig() {
  3324. ServerManager.Instance.SendHttp(TeamWave.Config, null, Laya.Handler.create(this, (data) => {
  3325. this.curplayerData.peizhis = data["configs"];
  3326. }), null);
  3327. }
  3328. get ServerTime() {
  3329. let time = Laya.timer.currTimer;
  3330. let stime = this.SFSFSF + Math.ceil((time - this.createTime) / 1000);
  3331. return stime;
  3332. }
  3333. }
  3334. class ShareUtil {
  3335. beginShare(callBack) {
  3336. ShareUtil.beginShareTime = new Date().getTime();
  3337. console.log("分享点击时间=" + ShareUtil.beginShareTime);
  3338. ShareUtil.isSharing = true;
  3339. ShareUtil.callback = callBack;
  3340. }
  3341. onRegister() {
  3342. if (Laya.Browser.window.wx == null) {
  3343. return;
  3344. }
  3345. Laya.Browser.window.wx.onShow(function (option) {
  3346. console.log("onshow share start");
  3347. if (ShareUtil.isSharing) {
  3348. ShareUtil.isSharing = false;
  3349. let time = new Date().getTime();
  3350. console.log("分享回到游戏时间" + time);
  3351. let wait = (time - ShareUtil.beginShareTime) / 1000;
  3352. console.log("分享停留时间为:" + wait);
  3353. let shareSuccess = false;
  3354. let realSuccess = false;
  3355. if (wait < 3) {
  3356. Laya.Browser.window.wx.showToast({ title: "请重试一次" });
  3357. ShareUtil.callback(false);
  3358. }
  3359. else {
  3360. var random = Math.random();
  3361. if (random <= 0.3) {
  3362. var message = ["你已分享过该群", "请重新换个群分享!", "请分享到30人大群中!"];
  3363. var curmes = message[GameTools.RandomANumber(0, 2)];
  3364. Laya.Browser.window.wx.showToast({ title: curmes });
  3365. ShareUtil.callback(false);
  3366. }
  3367. else {
  3368. Laya.Browser.window.wx.showToast({ title: "分享成功!" });
  3369. ShareUtil.callback(true);
  3370. }
  3371. }
  3372. }
  3373. });
  3374. }
  3375. static ShareMessage() {
  3376. if (!Laya.Browser.onWeiXin)
  3377. return;
  3378. var t = AccountManager.Instance.ServerTime;
  3379. var _title = AccountManager.Instance.curplayerData.ShareTxt;
  3380. _title = (_title == "" || !_title) ? "组团一起浪" : _title;
  3381. var _image = "subpackage2/res/share/shareimage.png";
  3382. Laya.Browser.window.wx.onShareAppMessage(() => ({
  3383. title: _title,
  3384. imageUrl: _image,
  3385. query: "shareid=" + AccountManager.Instance.curplayerData.userId + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
  3386. }));
  3387. }
  3388. static shareImage(channel, callback = null, shareType) {
  3389. if (Laya.Browser.window.wx == null) {
  3390. return;
  3391. }
  3392. var t = AccountManager.Instance.ServerTime;
  3393. var _title = AccountManager.Instance.curplayerData.ShareTxt;
  3394. _title = (_title == "" || !_title) ? "组团一起浪" : _title;
  3395. var _image = "subpackage2/res/share/shareimage.png";
  3396. Laya.Browser.window.wx.aldShareAppMessage({
  3397. title: _title,
  3398. imageUrl: _image,
  3399. query: "userId=" + AccountManager.Instance.curplayerData.userId + "_" + shareType + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
  3400. });
  3401. if (callback) {
  3402. ShareUtil.Instance.beginShare(callback);
  3403. }
  3404. }
  3405. }
  3406. ShareUtil.Instance = new ShareUtil();
  3407. ShareUtil.shareSuccessTime = 0;
  3408. ShareUtil.isSharing = false;
  3409. class WXSDK {
  3410. constructor() {
  3411. WXSDK.ins = this;
  3412. }
  3413. static get Instance() {
  3414. if (WXSDK.ins) {
  3415. return WXSDK.ins;
  3416. }
  3417. else {
  3418. return new WXSDK();
  3419. }
  3420. }
  3421. static Init() {
  3422. }
  3423. static DengLu(_complete) {
  3424. var that = this;
  3425. Laya.Browser.window.wx.login({
  3426. success: function (res) {
  3427. if (res.code) {
  3428. ShareUtil.Instance.onRegister();
  3429. console.log("微信登陆成功----");
  3430. that.codeValue = res.code;
  3431. console.log("shareid:" + WXSDK.shareOpenId);
  3432. new AccountManager(res.code, "", "", "", 0, "", "", "", "", WXSDK.shareOpenId, WXSDK.shareOpenId, Global.VERSION);
  3433. _complete(res);
  3434. }
  3435. else {
  3436. WXSDK.DengLu(WXSDK.DengLu);
  3437. console.log('wx no code' + res.errMsg);
  3438. }
  3439. },
  3440. fail: function (res) { console.log("wx.login: failed, res=" + res); }
  3441. });
  3442. }
  3443. static ShowTxt(text) {
  3444. if (Laya.Browser.onWeiXin) {
  3445. Laya.Browser.window.wx.showToast({ title: text });
  3446. }
  3447. else {
  3448. console.log(text);
  3449. }
  3450. }
  3451. static OnShow(cb) {
  3452. if (!Laya.Browser.onWeiXin)
  3453. return;
  3454. Laya.Browser.window.wx.onShow(cb);
  3455. }
  3456. static OffShow(cb) {
  3457. if (!Laya.Browser.onWeiXin)
  3458. return;
  3459. Laya.Browser.window.wx.offShow(cb);
  3460. }
  3461. static OnHide(cb) {
  3462. if (!Laya.Browser.onWeiXin)
  3463. return;
  3464. Laya.Browser.window.wx.onHide(cb);
  3465. }
  3466. static OffHide(cb) {
  3467. if (!Laya.Browser.onWeiXin)
  3468. return;
  3469. Laya.Browser.window.wx.offHide(cb);
  3470. }
  3471. static ShortShake() {
  3472. Laya.Browser.window.wx.vibrateShort({});
  3473. }
  3474. static LongShake() {
  3475. Laya.Browser.window.wx.vibrateLong({});
  3476. }
  3477. static Shake(_short = true) {
  3478. if (Laya.Browser.onWeiXin && WXSDK.shake) {
  3479. if (_short) {
  3480. this.ShortShake();
  3481. }
  3482. else {
  3483. this.LongShake();
  3484. }
  3485. }
  3486. }
  3487. static LoadSubPackage(name, _complete) {
  3488. if (Laya.Browser.onWeiXin) {
  3489. const loadTask = Laya.Browser.window.wx.loadSubpackage({
  3490. name: 'subpackage',
  3491. success: function (res) {
  3492. _complete && _complete(true);
  3493. console.log("分包加载成功");
  3494. },
  3495. fail: function (res) {
  3496. _complete && _complete(false);
  3497. console.log("分包加载失败");
  3498. }
  3499. });
  3500. }
  3501. else {
  3502. console.log("未进行分包加载");
  3503. _complete && _complete(true);
  3504. }
  3505. }
  3506. static stageShake(callBack = null, speed = 32) {
  3507. if (this.isShake || !this.canshakestage)
  3508. return;
  3509. this.isShake = true;
  3510. var point = new Laya.Vector2(Laya.stage.x, Laya.stage.y);
  3511. Laya.stage.timerLoop(speed, this, this.shakeObject, [point, callBack]);
  3512. }
  3513. static shakeObject(_point, _callBack) {
  3514. var count = (this.num++) % 4;
  3515. this.offsetArr[this.num % 2] = count < 2 ? 0 : this.offset;
  3516. Laya.stage.x = this.offsetArr[0] + _point.x;
  3517. Laya.stage.y = this.offsetArr[1] + _point.y;
  3518. if (this.num > (this.times * 4 + 1)) {
  3519. Laya.stage.clearTimer(this, this.shakeObject);
  3520. Laya.stage.pos(0, 0);
  3521. this.num = 0;
  3522. this.isShake = false;
  3523. if (_callBack != null) {
  3524. _callBack();
  3525. }
  3526. }
  3527. }
  3528. static UpdateGuide(ShowGuide = 0) {
  3529. var kvDataList = new Array();
  3530. let date = new Date().getTime();
  3531. var myValue = JSON.stringify({
  3532. "guide": {
  3533. "ShowGuide": ShowGuide,
  3534. "update_time": date.toString()
  3535. }
  3536. });
  3537. kvDataList.push({ key: "ShowGuide", value: myValue });
  3538. if (Laya.Browser.window.wx) {
  3539. Laya.Browser.window.wx.setUserCloudStorage({
  3540. KVDataList: kvDataList,
  3541. success: r => {
  3542. console.log("KVDATALIST---", kvDataList);
  3543. console.log("上传新手指引成功:" + ShowGuide);
  3544. }
  3545. });
  3546. }
  3547. }
  3548. static UpdateScore(max_score) {
  3549. var kvDataList = new Array();
  3550. let date = new Date().getTime();
  3551. var myValue = JSON.stringify({
  3552. "wxgame": {
  3553. "max_score": max_score,
  3554. "update_time": date.toString(),
  3555. }
  3556. });
  3557. kvDataList.push({ key: "max_score", value: myValue });
  3558. if (Laya.Browser.window.wx) {
  3559. Laya.Browser.window.wx.setUserCloudStorage({
  3560. KVDataList: kvDataList,
  3561. success: r => {
  3562. console.log("KVDATALIST---", kvDataList);
  3563. console.log("上传分数成功:" + max_score);
  3564. }
  3565. });
  3566. }
  3567. }
  3568. static fengxiangtupian(callback) {
  3569. if (Laya.Browser.window.wx == null) {
  3570. return;
  3571. }
  3572. var _title = "组团一起浪";
  3573. var t = AccountManager.Instance.ServerTime;
  3574. Laya.Browser.window.wx.aldShareAppMessage({
  3575. title: _title,
  3576. imageUrl: "subpackage2/res/share/shareimage.png",
  3577. query: "userId=" + AccountManager.Instance.curplayerData.userId + "_" + t + "_" + Math.floor(9999 * Math.random()).toString()
  3578. });
  3579. if (callback) {
  3580. }
  3581. }
  3582. static AldEvent(eventName, key = "用户id", value = "") {
  3583. }
  3584. static AldStart(stageId) {
  3585. }
  3586. static AldEnd(stageId, isComplete) {
  3587. }
  3588. }
  3589. WXSDK.codeValue = "";
  3590. WXSDK.shareOpenId = "";
  3591. WXSDK.openId = 0;
  3592. WXSDK.shareScene = "";
  3593. WXSDK.uid = "123";
  3594. WXSDK.querychannel = "";
  3595. WXSDK.referrerInfoappId = "";
  3596. WXSDK.shake = true;
  3597. WXSDK.times = 1.3;
  3598. WXSDK.num = 0;
  3599. WXSDK.offsetArr = [0, 0];
  3600. WXSDK.offset = 14;
  3601. WXSDK.canshakestage = false;
  3602. class LoadView extends ui.LoadViewUI {
  3603. constructor() {
  3604. super();
  3605. this.progressnum = 0;
  3606. this.fast = 0.07;
  3607. this.slow = 0.005;
  3608. this.End = false;
  3609. this.EndProgress = false;
  3610. LoadView.ins = this;
  3611. Laya.stage.addChild(this);
  3612. this.Init();
  3613. }
  3614. static get Instance() {
  3615. if (LoadView.ins == null) {
  3616. return new LoadView();
  3617. }
  3618. return LoadView.ins;
  3619. }
  3620. Init() {
  3621. this.Login();
  3622. Laya.timer.loop(1, this, this.UpdateProgress);
  3623. this.height = Laya.stage.height;
  3624. Laya.stage.on(Laya.Event.RESIZE, this, () => {
  3625. this.height = Laya.stage.height;
  3626. });
  3627. }
  3628. UpdateProgress() {
  3629. if (this.progressnum <= 0.7) {
  3630. this.progressnum += this.fast;
  3631. }
  3632. else if (this.progressnum > 0.7 && this.progressnum < 0.99) {
  3633. this.progressnum += this.slow;
  3634. }
  3635. else {
  3636. if (this.End) {
  3637. this.progressnum += this.slow;
  3638. }
  3639. }
  3640. if (!this.EndProgress && this.progressnum >= 1) {
  3641. this.EndProgress = true;
  3642. this.progressnum = 1;
  3643. Laya.timer.clear(this, this.UpdateProgress);
  3644. this.LoadComplete();
  3645. }
  3646. this.jindupro.value = this.progressnum;
  3647. }
  3648. Login() {
  3649. WXSDK.AldEvent("开始登陆");
  3650. if (Laya.Browser.onWeiXin) {
  3651. this.LoginWx();
  3652. }
  3653. else {
  3654. this.LoginLocal();
  3655. }
  3656. }
  3657. LoginWx() {
  3658. if (Laya.Browser.onWeiXin) {
  3659. WXSDK.DengLu((res) => {
  3660. if (res != "error") {
  3661. WXSDK.AldEvent("微信登陆成功");
  3662. console.log("1微信登录成功:" + res);
  3663. this.LoginLocal();
  3664. }
  3665. else {
  3666. this.LoginWx();
  3667. }
  3668. });
  3669. }
  3670. else {
  3671. this.LoginLocal();
  3672. }
  3673. }
  3674. LoginLocal() {
  3675. ServerManager.Instance.Login(null, Laya.Handler.create(this, this.LoginComplete), Laya.Handler.create(this, this.LoginFail));
  3676. }
  3677. LoginComplete() {
  3678. WXSDK.AldEvent("本地服务器登陆成功");
  3679. console.log("本地服务器登陆成功");
  3680. GuangGao.InitVideo();
  3681. if (Laya.Browser.onWeiXin) {
  3682. this.LoadSubPackage();
  3683. }
  3684. else {
  3685. this.LoadScene();
  3686. }
  3687. }
  3688. LoginFail() {
  3689. console.log("本地服务器登陆失败");
  3690. }
  3691. LoadSubPackage() {
  3692. Laya.Browser.window.wx.loadSubpackage({
  3693. name: 'subpackage',
  3694. success: (res) => {
  3695. WXSDK.AldEvent("分包1加载成功");
  3696. this.LoadSubPackage2();
  3697. },
  3698. fail: (res) => {
  3699. this.LoadSubPackage();
  3700. }
  3701. });
  3702. }
  3703. LoadSubPackage2() {
  3704. Laya.Browser.window.wx.loadSubpackage({
  3705. name: 'subpackage2',
  3706. success: (res) => {
  3707. WXSDK.AldEvent("分包2加载成功");
  3708. this.LoadScene();
  3709. },
  3710. fail: (res) => {
  3711. this.LoadSubPackage2();
  3712. }
  3713. });
  3714. }
  3715. LoadScene() {
  3716. Laya.Scene3D.load(ResourcesPath.mainscene, Laya.Handler.create(this, (sprite) => {
  3717. this.mainscene = sprite;
  3718. AssetManager.Instance.mainscene = this.mainscene;
  3719. WXSDK.AldEvent("场景资源加载完毕");
  3720. this.LoadRole();
  3721. }));
  3722. console.log("场景资源加载成功");
  3723. }
  3724. LoadRole() {
  3725. var arr = [];
  3726. for (let i = 0; i < ResourcesPath.Character.length; i++) {
  3727. let item = ResourcesPath.Character[i];
  3728. arr.push(item);
  3729. }
  3730. Laya.loader.create(arr, Laya.Handler.create(this, () => {
  3731. for (let i = 0; i < ResourcesPath.Character.length; i++) {
  3732. let model = Laya.loader.getRes(ResourcesPath.Character[i]);
  3733. AssetManager.Instance.Character.set(i + 1, model);
  3734. Laya.loader.clearRes(ResourcesPath.Character[i]);
  3735. }
  3736. console.log("玩家模型加载成功");
  3737. WXSDK.AldEvent("玩家模型加载完毕");
  3738. this.LoadResources();
  3739. }));
  3740. }
  3741. LoadResources() {
  3742. var arr = [];
  3743. for (let i = 0; i < ResourcesPath.Prop.length; i++) {
  3744. let item = ResourcesPath.Prop[i];
  3745. arr.push(item);
  3746. }
  3747. Laya.loader.create(arr, Laya.Handler.create(this, () => {
  3748. arr.forEach(s => {
  3749. if (s.progress == 1) {
  3750. let sp = Laya.loader.getRes(s.url);
  3751. AssetManager.Instance.Prop.set(sp.name, sp);
  3752. }
  3753. else {
  3754. console.log(`[LOG]${s.url}加载失败`);
  3755. }
  3756. }, this);
  3757. console.log("道具模型加载成功");
  3758. WXSDK.AldEvent("道具模型加载完毕");
  3759. this.complete();
  3760. }));
  3761. }
  3762. complete() {
  3763. this.End = true;
  3764. this.slow = this.fast;
  3765. DispatcherManager.EventTrigger(EventState.LoadComplete);
  3766. }
  3767. LoadComplete() {
  3768. this.destroy();
  3769. }
  3770. }
  3771. class Main {
  3772. constructor() {
  3773. if (window["Laya3D"])
  3774. Laya3D.init(GameConfig.width, GameConfig.height);
  3775. else
  3776. Laya.init(GameConfig.width, GameConfig.height, Laya["WebGL"]);
  3777. Laya["Physics"] && Laya["Physics"].enable();
  3778. Laya["DebugPanel"] && Laya["DebugPanel"].enable();
  3779. Laya.stage.scaleMode = GameConfig.scaleMode;
  3780. Laya.stage.screenMode = GameConfig.screenMode;
  3781. Laya.stage.alignV = GameConfig.alignV;
  3782. Laya.stage.alignH = GameConfig.alignH;
  3783. Laya.URL.exportSceneToJson = GameConfig.exportSceneToJson;
  3784. if (GameConfig.debug || Laya.Utils.getQueryString("debug") == "true")
  3785. Laya.enableDebugPanel();
  3786. if (GameConfig.physicsDebug && Laya["PhysicsDebugDraw"])
  3787. Laya["PhysicsDebugDraw"].enable();
  3788. if (GameConfig.stat)
  3789. Laya.Stat.show();
  3790. Laya.alertGlobalError = true;
  3791. if (Laya.Browser.onWeiXin) {
  3792. Laya.Browser.window.wx.showShareMenu({
  3793. withShareTicket: true
  3794. });
  3795. Laya.Browser.window.wx.onShareAppMessage(function () {
  3796. return {
  3797. title: "组团一起浪",
  3798. imageUrl: "subpackage2/res/share/shareimage.png",
  3799. };
  3800. });
  3801. Laya.Browser.window.wx.onShow((option) => {
  3802. var shareTicket = option.shareTicket;
  3803. var userId = option.query.userId;
  3804. var shareTitle = option.query.shareTitle;
  3805. Main.SceneNum = option.scene;
  3806. WXSDK.querychannel = option.query.channel;
  3807. WXSDK.shareOpenId = option.query.userId;
  3808. console.log("scene:", option.scene);
  3809. if (WXSDK.querychannel != null) {
  3810. console.log("onShow channel is:", WXSDK.querychannel);
  3811. }
  3812. if (option.referrerInfo) {
  3813. WXSDK.referrerInfoappId = option.referrerInfo.appId;
  3814. console.log("onShow appId is:", option.referrerInfo.appId);
  3815. }
  3816. });
  3817. if (!Laya.Browser.onWeiXin)
  3818. return;
  3819. const updateManager = Laya.Browser.window.wx.getUpdateManager();
  3820. updateManager.onCheckForUpdate(function (res) {
  3821. console.log("最新版本:" + res.hasUpdate);
  3822. });
  3823. updateManager.onUpdateReady(function () {
  3824. Laya.Browser.window.wx.showModal({
  3825. showCancel: false,
  3826. title: '更新提示',
  3827. content: '新版本已经准备好,是否重启应用?',
  3828. success(res) {
  3829. updateManager.applyUpdate();
  3830. },
  3831. fail(res) {
  3832. updateManager.applyUpdate();
  3833. }
  3834. });
  3835. });
  3836. }
  3837. Laya.ResourceVersion.enable("version.json", Laya.Handler.create(this, this.onVersionLoaded), Laya.ResourceVersion.FILENAME_VERSION);
  3838. }
  3839. onVersionLoaded() {
  3840. Laya.AtlasInfoManager.enable("fileconfig.json", Laya.Handler.create(this, this.onConfigLoaded));
  3841. }
  3842. onConfigLoaded() {
  3843. new LoadView();
  3844. }
  3845. }
  3846. Main.SceneNum = "123";
  3847. new Main();
  3848. }());
  3849. //# sourceMappingURL=bundle.js.map