bundle.js 179 KB

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