main.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. // Learn cc.Class:
  2. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/class.html
  3. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/class.html
  4. // Learn Attribute:
  5. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
  6. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/reference/attributes.html
  7. // Learn life-cycle callbacks:
  8. // - [Chinese] http://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
  9. // - [English] http://www.cocos2d-x.org/docs/creator/en/scripting/life-cycle-callbacks.html
  10. cc.Class({
  11. extends: cc.Component,
  12. properties: {
  13. // foo: {
  14. // // ATTRIBUTES:
  15. // default: null, // The default value will be used only when the component attaching
  16. // // to a node for the first time
  17. // type: cc.SpriteFrame, // optional, default is typeof default
  18. // serializable: true, // optional, default is true
  19. // },
  20. // bar: {
  21. // get () {
  22. // return this._bar;
  23. // },
  24. // set (value) {
  25. // this._bar = value;
  26. // }
  27. // },
  28. },
  29. // LIFE-CYCLE CALLBACKS:
  30. // onLoad () {},
  31. start() {
  32. cc.log("数据是啥",RootNode);
  33. this.NewsSprite = UtilsPrefabs.getNode("NewsSprite", this.node);
  34. this.NewsSprite.active = false;
  35. // this.captureScreenshot();
  36. let bgmove = UtilsPrefabs.getNode("bgmove", this.node);
  37. let nodeMove = this.nodeMove = UtilsPrefabs.getNode("move", bgmove);
  38. let slider = this.sliderNode = UtilsPrefabs.getNode("slider", this.node);
  39. let Skeleton = this.spine = UtilsPrefabs.getNode("spine", this.node);
  40. let strikeNode = this.strikeNode = UtilsPrefabs.getNode("strikeNode", this.node);
  41. let dragon = this.dragon = UtilsPrefabs.getNode("dragon", this.node);
  42. let FallingStar = this.FallingStar = UtilsPrefabs.getNode("FallingStar", dragon);
  43. let earth = this.earth = UtilsPrefabs.getNode("earth", this.node);
  44. let fast = this.fast = UtilsPrefabs.getNode("fast", earth);
  45. let esurient = this.esurient = UtilsPrefabs.getNode("esurient", this.node);
  46. //游戏界面 打击次数 路程 等
  47. let gamelayout = this.gamelayout = UtilsPrefabs.getNode("gamelayout", this.node);
  48. this.star = UtilsPrefabs.getNode("star", this.node);
  49. let starlist = this.starlist = this.node.getChildByName("starlist");
  50. let FlyPastStarNameTip = this.FlyPastStarNameTip = starlist.getChildByName("FlyPastStarNameTip");
  51. let FlyTipName = this.FlyTipName = FlyPastStarNameTip.getChildByName("FlyTipName");
  52. this.FlyPastStarName = FlyTipName.getChildByName("FlyPastStarName");
  53. this.FlyTipName.active = false;
  54. this.LastTag = -1;
  55. this.StarNames = [
  56. "月球",
  57. "火星",
  58. "木星",
  59. "土星",
  60. "天王星",
  61. "海王星",
  62. "黑洞"]
  63. this.speedP = [
  64. 12,
  65. 6,
  66. 3
  67. ]
  68. this._init();
  69. utils.isMobile(function () {
  70. Manager.main = this;
  71. esurient.active = true;
  72. Manager.sceneType = 1;
  73. }.bind(this));
  74. GameData.gameStartTime = new Date().getTime()
  75. this.strikeNode.getComponent("strike").setOnRestClick(function () {
  76. this.myinit();
  77. }.bind(this));
  78. Global.gameover = false;
  79. let earthdragon = this.earthdragon = UtilsPrefabs.getNode("earthdragon", earth);
  80. let Animations = this.Animations= utils.dragonBonesGet(earthdragon);
  81. this.myAnimationsstart = [];
  82. //地球启动
  83. this.myAnimationsstart.push(Animations[0]);
  84. this.myAnimationsstart.push(Animations[3]);
  85. this.myAnimationsstart.push(Animations[6]);
  86. this.myAnimations = [];
  87. //飞行
  88. this.myAnimations.push(Animations[1]);
  89. this.myAnimations.push(Animations[4]);
  90. this.myAnimations.push(Animations[7]);
  91. this.myAnimationsend = [];
  92. //地球停止
  93. this.myAnimationsend.push(Animations[2]);
  94. this.myAnimationsend.push(Animations[5]);
  95. this.myAnimationsend.push(Animations[8]);
  96. //地球 默认播放
  97. // utils.dragonBonesPlay(earthdragon, Animations[1], 0);
  98. utils.dragonBonesPlay(earthdragon, "01", 0);
  99. //默认 龙骨背景 停止
  100. this.myinit();
  101. // console.log("都是啥", this.myAnimations);
  102. //初始化 停下来 路过的 星球
  103. this.initStar();
  104. },
  105. initStar: function () {
  106. // 星星 当前索引
  107. this.currtag = 0;
  108. this.stars = [];
  109. let starlist = UtilsPrefabs.getNode("starlist", this.node);
  110. this.stars.push(UtilsPrefabs.getNode("s1", starlist));//月亮
  111. this.stars.push(UtilsPrefabs.getNode("s2", starlist));//火星
  112. this.stars.push(UtilsPrefabs.getNode("s3", starlist));//木星
  113. this.stars.push(UtilsPrefabs.getNode("s4", starlist));//土星
  114. this.stars.push(UtilsPrefabs.getNode("s5", starlist));//天王星
  115. this.stars.push(UtilsPrefabs.getNode("s6", starlist));//海王星
  116. this.stars.push(UtilsPrefabs.getNode("s7", starlist));//黑洞
  117. this.stars.push(UtilsPrefabs.getNode("s8", starlist));//多余的
  118. this.starsaname = [];
  119. this.starsaname.push("smove1");
  120. this.starsaname.push("smove2");
  121. this.starsaname.push("smove3");
  122. this.starsaname.push("smove4");
  123. this.starsaname.push("smove5");
  124. this.starsaname.push("smove6");
  125. this.starsaname.push("smove7");
  126. this.starsaname.push("smove8");
  127. },
  128. checkKmForStar : function(km){
  129. if (km > 0.1&& km<=0.2) {
  130. this.currtag = 0;
  131. }
  132. else if (km > 0.2&& km<=0.3) {
  133. this.currtag = 1;
  134. }
  135. else if (km > 0.3&& km<=0.4) {
  136. this.currtag = 2;
  137. }
  138. else if (km > 0.4&& km<=0.5) {
  139. this.currtag = 3;
  140. }
  141. else if (km > 0.5&& km<=0.6) {
  142. this.currtag = 4;
  143. }
  144. else if (km > 0.6&& km<=0.7) {
  145. this.currtag = 5;
  146. }
  147. else if (km > 0.7&& km<=0.8) {
  148. this.currtag = 6;
  149. }
  150. else if (km > 0.8&& km<=0.9) {
  151. this.currtag = 7;
  152. }
  153. else if (km > 0.9&& km<1) {
  154. // 穿越 太阳系
  155. this.currtag = 99;
  156. }else if (km>=1){
  157. //银河系
  158. this.currtag = 100;
  159. }
  160. },
  161. checkScoreForStar : function(Score){
  162. if (Score >= 0 && Score <= 210000) {
  163. //月球
  164. this.currtag = 0;
  165. }
  166. else if (Score > 210000 && Score <= 420222) {
  167. //火星
  168. this.currtag = 1;
  169. }
  170. else if (Score > 420222 && Score <= 630333) {
  171. //木星
  172. this.currtag = 2;
  173. }
  174. else if (Score > 630333 && Score <= 672355) {
  175. //土星
  176. this.currtag = 3;
  177. }
  178. else if (Score > 672355 && Score <= 714377) {
  179. //天王星
  180. this.currtag = 4;
  181. }
  182. else if (Score > 714377 && Score <= 756400) {
  183. //海王星
  184. this.currtag = 5;
  185. }
  186. else if (Score > 756400 && Score <= 798422) {
  187. //黑洞
  188. this.currtag = 6;
  189. }
  190. else if (Score > 798422 && Score <= 1199999) {
  191. //太阳系
  192. this.currtag = 99;
  193. }
  194. else if (Score > 1199999) {
  195. //银河系
  196. this.currtag = 100;
  197. }
  198. },
  199. myinit: function () {
  200. this.dragon.getComponent("dragonManager").setTimeScale(0.05);
  201. this.FallingStar.active = false;
  202. // this.setFastAnim(0);
  203. // this.sliderNode.getComponent(cc.Slider).progress = 0;
  204. },
  205. _init: function () {
  206. // this.myinit();
  207. // console.log("进度条", this.sliderNode.getComponent(cc.Slider));
  208. this.nodeMoveAnimation = this.nodeMove.getComponent(cc.Animation);
  209. this.Skeleton = this.spine.getComponent(sp.Skeleton);
  210. // console.log("当前的动画组件",this.nodeMoveAnimation);
  211. this.slider = this.sliderNode.getComponent(cc.Slider);
  212. this.moveState = this.nodeMoveAnimation.getAnimationState('move');
  213. this.moveState.speed = this.slider.progress;
  214. this.setStartTimeScale(0);
  215. // console.log("滑动条组件",this.slider);
  216. this.slider.node.on('slide', this.callbackslide, this);
  217. //每次打击 的回调
  218. this.strikeNode.getComponent("strike").setOnPowerCallBackforMain(function (speed, p) {
  219. // this.moveState.speed =1+speed*1.5;
  220. // this.Skeleton.timeScale =1+speed*1.5;
  221. // console.log("每次打得", speed, p);
  222. //设置地球 的动画
  223. this.setFastAnim(p);
  224. this.p = p;
  225. // this.fast
  226. this.gamelayout.getComponent("gamelayoutManager").setPowcount(function () {
  227. console.log("打完了");
  228. utils.getShareData(function (data) {
  229. UserInfo.args = data;
  230. // console.log("游戏产生数据" + UserInfo.args);
  231. console.log("游戏成绩" + JSON.stringify(UserInfo.args.setResult));
  232. //
  233. // console.log("游戏数据是" + UserInfo.PlayerGameData);
  234. // console.log("游戏数据是 json" + JSON.stringify(UserInfo));
  235. // console.log("游戏数据是 args" + JSON.stringify(UserInfo.args));
  236. // console.log("假装 获得到的排行榜数据 json" + JSON.stringify(RankingListData));
  237. utils.isMobile(function () {
  238. Manager.chengji();
  239. //真的数据来了 就注释此行
  240. // this.showRankingList();
  241. }.bind(this));
  242. }.bind(this));
  243. }.bind(this));
  244. this.ChangeCallBack(speed);
  245. // console.log("回调的 速度",speed);
  246. }.bind(this));
  247. },
  248. setStartTimeScale: function (speed) {
  249. this.star.getComponent(cc.Animation).getAnimationState("starta").speed = speed;
  250. },
  251. getStartTimeScale: function () {
  252. return this.star.getComponent(cc.Animation).getAnimationState("starta").speed;
  253. },
  254. ChangeCallBack: function (CurrentMoney) {
  255. // cc.log("********CurrentMoney*****"+CurrentMoney);
  256. //money:进度条的百分比
  257. this.CurrentMoney = CurrentMoney;
  258. let LastMoney = this.LastMoney = this.gamelayout.getComponent("gamelayoutManager").getFlyKM();
  259. let Diff = this.Diff = CurrentMoney - LastMoney;
  260. let InitMoneyNum = this.InitMoneyNum = LastMoney;
  261. let AnimTimes = this.AnimTimes = 0;
  262. let Times = this.Times = 200;
  263. let GrowUp = this.GrowUp = 1;
  264. //b初始值,c变化量,d持续时间 t 正数 增 负数 减
  265. this.b = this.LastMoney,
  266. this.c = this.Diff,
  267. this.d = this.Times,
  268. this.dt = this.Times / 2,
  269. this.t = 0;
  270. console.log("相差", CurrentMoney, LastMoney);
  271. this.unschedule(this.timeschedule);
  272. if (this.time1 != null) {
  273. clearTimeout(this.time1)
  274. }
  275. if (this.time2 != null) {
  276. clearTimeout(this.time2)
  277. }
  278. this.schedule(this.timeschedule, 0.01, Times);
  279. cc.log(Times);
  280. // this.schedule(function () {
  281. // var ss = Tween.Expo.easeOut(this.t, b, c, d);
  282. // console.log("我们那个", ss);
  283. // this.t++;
  284. // }.bind(this), 0.01, d);
  285. },
  286. timeschedule: function () {
  287. // cc.log("*********cstest1111111111**********");
  288. // if (this.AnimTimes>=0 && this.AnimTimes<30) {
  289. // this.GrowUp = 0.5;
  290. // }else if (this.AnimTimes>=30 && this.AnimTimes<50) {
  291. // this.GrowUp = 2;
  292. // }else{
  293. // this.GrowUp = 0.6;
  294. // }
  295. // console.log("我们那个", this.t, this.b, this.c, this.d);
  296. var ss = Tween.Expo.easeOut(this.t, this.b, this.c, this.d);
  297. var speed = Tween.Expo.easeOut(this.t, 0, this.c, this.dt);
  298. // if (this.Diff > 0) {
  299. // this.InitMoneyNum += parseFloat((this.CurrentMoney - this.LastMoney) / this.Times * this.GrowUp);
  300. // } else {
  301. // this.InitMoneyNum -= parseFloat((this.CurrentMoney - this.LastMoney) / this.Times * this.GrowUp);
  302. // }
  303. // let result = this.InitMoneyNum;
  304. // console.log("我们那个 ss", ss);
  305. let speedt = speed * this.speedP[this.p];
  306. if (this.t == this.Times) {
  307. // cc.log("*********cstest222222222**********");
  308. // console.log("停下来了CurrentMoney"+ this.CurrentMoney);
  309. // this.setStarTimeScale(0);
  310. // Global.gameover
  311. // this.checkKmForStar(ss);
  312. //测试数据 月亮 210000 火星 420222 木星 630333 土星 672355 天王星 714377 海王星 756400 黑洞 798422 太阳系 1199999 银河系 1200000
  313. // this.checkScoreForStar(210000);
  314. this.checkScoreForStar(UserInfo.PlayerGameData.power);
  315. // console.log("流浪地球 checkScoreForStar ,,,power is "+UserInfo.PlayerGameData.power);
  316. // console.log("停下来了currtag"+ this.currtag);
  317. if (this.currtag == 99 || this.currtag == 100) {
  318. // cc.log("*********cstest44444444444444**********");
  319. if (!Global.gameover) {
  320. this.endSpeed99_100();
  321. return;
  322. }
  323. this.time1 = setTimeout(function () {
  324. // cc.log("*********cstest5555555555555**********");
  325. if (Global.gameover) {
  326. // cc.log("*********cstest666666666666666**********");
  327. this.maingameover();
  328. // if (this.CurrentMoney == 1) {
  329. // // 穿越 银河系
  330. // this.perfectEnding();
  331. // } else {
  332. // //穿越 太阳系
  333. // this.perfecttaiyang();
  334. // }
  335. if (this.currtag == 100) {
  336. // 穿越 银河系
  337. this.perfectEnding();
  338. } else {
  339. //穿越 太阳系
  340. this.perfecttaiyang();
  341. }
  342. }
  343. }.bind(this),2000);
  344. }else{
  345. this.endSpeed();
  346. }
  347. // console.log("快结束 停了", ss,"多少呢",this.currtag);
  348. return;
  349. } else if (this.t < 150) {
  350. speedt*=4;
  351. }else if (this.t >= 150) {
  352. speedt*=2;
  353. }
  354. // console.log("现在是设置多少呢", speedt);
  355. this.dragon.getComponent("dragonManager").setTimeScale(1+speedt);
  356. //地球飞行的时候才播放流星asd
  357. if(this.FallingStar.active == false){
  358. this.FallingStar.active = true;
  359. }
  360. if (this.stars[this.currtag]!=null) {
  361. if (this.stars[this.currtag].active) {
  362. // this.setStarTimeScale(speedt);
  363. this.setStarTimeScale(1);
  364. // console.log("******什么情况2222222*****");
  365. if(this.LastTag != this.currtag){
  366. this.LastTag = this.currtag;
  367. let anim = this.FlyTipName.getComponent(cc.Animation);
  368. anim.play('FlyPastStarNameTip2');
  369. }
  370. }
  371. }
  372. this.gamelayout.getComponent("gamelayoutManager").setFlyKM(ss);
  373. // console.log("速度",speed);
  374. // this.setStartTimeScale(speedt);
  375. // this.AnimTimes++;
  376. // console.log("变化",ss);
  377. this.t++;
  378. },
  379. endSpeed : function () {
  380. // cc.log("*********cstest777777777777777**********");
  381. this.gamelayout.getComponent("gamelayoutManager").setFlyKM(this.CurrentMoney);
  382. utils.dragonBonesPlay(this.earthdragon, this.checkAnimationsend(this.p), 0);
  383. // this.inching(CurrentMoney);
  384. this.dragon.getComponent("dragonManager").setTimeScale(1);
  385. // this.setStartTimeScale(0);
  386. utils.dragonBonesPlay(this.earthdragon, this.myAnimationsend[this.p], 1);
  387. setTimeout(function () {
  388. // cc.log("*********cstest33333333333**********");
  389. // utils.dragonBonesPlay(this.earthdragon, this.Animations[1], 0);
  390. utils.dragonBonesPlay(this.earthdragon, "01", 0);
  391. }.bind(this),200);
  392. this.stars[this.currtag].active = true;
  393. if (this.stars[this.currtag].active) {
  394. // cc.log("*********cstest8888888888888**********");
  395. // this.setStarTimeScale(speedt);
  396. this.time1 = setTimeout(function () {
  397. // cc.log("*********cstest9999999999999**********");
  398. // console.log("进来吗",this.currtag);
  399. this.setStarTimeScale(0);
  400. // console.log("******什么情况*****");
  401. this.dragon.getComponent("dragonManager").setTimeScale(0.05);
  402. this.FallingStar.active=false;
  403. this.time2 = setTimeout(function () {
  404. // cc.log("*********cstestaaaaaaaaaaaaaa**********");
  405. if (Global.gameover) {
  406. // cc.log("*********cstestbbbbbbbbbbbbb**********");
  407. this.maingameover();
  408. Global.layoutManager.setGameOver();
  409. }
  410. }.bind(this),2000);
  411. // console.log("******星球停下来了*****");
  412. if(this.currtag>=0 && this.currtag<=6 && this.currtag!=this.LastTag){
  413. // cc.log("*********cstestcccccccccccccccc**********");
  414. // console.log("流浪地球 飞过什么星球"+this.StarNames[this.currtag]);
  415. this.FlyPastStarName.getComponent(cc.Label).string = this.StarNames[this.currtag];
  416. this.FlyTipName.active = true;
  417. this.FlyTipName.opacity = 255;
  418. let anim = this.FlyTipName.getComponent(cc.Animation);
  419. anim.play('FlyPastStarNameTip');
  420. }
  421. }.bind(this),860);//这个数值越大,球越往后
  422. }
  423. },
  424. endSpeed99_100 : function () {
  425. // cc.log("*********cstest777777777777777**********");
  426. this.gamelayout.getComponent("gamelayoutManager").setFlyKM(this.CurrentMoney);
  427. utils.dragonBonesPlay(this.earthdragon, this.checkAnimationsend(this.p), 0);
  428. // this.inching(CurrentMoney);
  429. this.dragon.getComponent("dragonManager").setTimeScale(1);
  430. // this.setStartTimeScale(0);
  431. utils.dragonBonesPlay(this.earthdragon, this.myAnimationsend[this.p], 1);
  432. setTimeout(function () {
  433. // cc.log("*********cstest33333333333**********");
  434. // utils.dragonBonesPlay(this.earthdragon, this.Animations[1], 0);
  435. utils.dragonBonesPlay(this.earthdragon, "01", 0);
  436. }.bind(this),200);
  437. },
  438. maingameover : function(){
  439. this.p = 0;
  440. Global.gameover = false;
  441. // for (var i = 0; i < this.stars.length; i++) {
  442. // this.stars[i].active = false;
  443. // }
  444. UtilsPrefabs.getNode("liuxing", this.node).active = false;
  445. // console.log("飞过什么星球了",this.currtag);
  446. UserInfo.PlayerGameData.currtag = this.currtag;
  447. utils.getShareData(function (data) {
  448. }.bind(this));
  449. },
  450. setStarTimeScale : function(speedt){
  451. // console.log("判断1",this.stars[this.currtag]);
  452. if (this.stars[this.currtag] != null) {
  453. if (this.stars[this.currtag].getComponent(cc.Animation).getAnimationState(this.starsaname[0]) != null) {
  454. this.stars[this.currtag].getComponent(cc.Animation).getAnimationState(this.starsaname[0]).speed = speedt;
  455. }
  456. }
  457. },
  458. inching: function (CurrentMoney) {
  459. let LastMoney = this.gamelayout.getComponent("gamelayoutManager").getFlyKM();
  460. let Diff = CurrentMoney - LastMoney;
  461. let InitMoneyNum = LastMoney;
  462. let AnimTimes = 0;
  463. let Times = 100;
  464. this.schedule(function () {
  465. if (Diff > 0) {
  466. InitMoneyNum += parseFloat((CurrentMoney - LastMoney) / Times);
  467. } else {
  468. InitMoneyNum -= parseFloat((CurrentMoney - LastMoney) / Times);
  469. }
  470. let result = InitMoneyNum;
  471. if (AnimTimes == Times - 1) {
  472. this.gamelayout.getComponent("gamelayoutManager").setFlyKM(CurrentMoney);
  473. this.inching();
  474. return;
  475. }
  476. this.gamelayout.getComponent("gamelayoutManager").setFlyKM(result);
  477. AnimTimes++;
  478. }, 0.01, Times);
  479. },
  480. setFastAnim: function (type) {
  481. // console.log("改变动画名字", this.fast);
  482. let Animation = this.fast.getComponent(cc.Animation);
  483. Animation.play(Animation.getClips()[type].name);
  484. // console.log("改变动画名字fast", this.myAnimations);
  485. utils.dragonBonesPlay(this.earthdragon, this.myAnimations[type], 0);
  486. utils.dragonBonesPlay(this.earthdragon, this.myAnimationsstart[type], 1);
  487. setTimeout(function () {
  488. utils.dragonBonesPlay(this.earthdragon, this.myAnimations[type], 0);
  489. }.bind(this),200);
  490. },
  491. callbackslide: function (slider) {
  492. // console.log("滑动条组件回调",slider);
  493. // this.moveState.speed =slider.progress;
  494. // this.Skeleton.timeScale =slider.progress;
  495. this.dragon.getComponent("dragonManager").setTimeScale(1 + slider.progress * 1.5);
  496. },
  497. //完美结局
  498. perfectEnding: function () {
  499. // UtilsPrefabs.getNode("score", this.node).active = false;
  500. let gamelayout = UtilsPrefabs.getNode("gamelayout", this.node);
  501. let progressBar = UtilsPrefabs.getNode("progressBar", gamelayout);
  502. let powcountlayout = UtilsPrefabs.getNode("powcountlayout", gamelayout);
  503. progressBar.active = false;
  504. powcountlayout.active = false;
  505. let perfectEnding = UtilsPrefabs.getNode("perfectEnding", this.node);
  506. perfectEnding.active = true;
  507. let performermove = UtilsPrefabs.getNode("performermove", this.node);
  508. performermove.active = true;
  509. let performer = UtilsPrefabs.getNode("performer", performermove);
  510. // performer.active = true;
  511. this.fast.active = false;
  512. this.earthdragon.active = false;
  513. let bg = UtilsPrefabs.getNode("bg", this.node);
  514. bg.active = false;
  515. let bgb = UtilsPrefabs.getNode("bgb", this.node);
  516. bgb.active = true;
  517. this.dragon.active = false;
  518. setTimeout(function () {
  519. perfectEnding.active = false;
  520. performermove.active = false;
  521. let yinhexi = UtilsPrefabs.getNode("yinhexi", this.node);
  522. yinhexi.active = true;
  523. let performeryinhexi = UtilsPrefabs.getNode("performeryinhexi", this.node);
  524. performeryinhexi.active = true;
  525. bg.active = true;
  526. bgb.active = false;
  527. setTimeout(function () {
  528. Global.layoutManager.setGameOver();
  529. }.bind(this), 4000);//这个数字是银河系动画的时间
  530. }.bind(this), 2000);//这个数字是黑洞动画的时间
  531. },
  532. //穿越太阳系
  533. perfecttaiyang: function () {
  534. // UtilsPrefabs.getNode("score", this.node).active = false;
  535. let gamelayout = UtilsPrefabs.getNode("gamelayout", this.node);
  536. let progressBar = UtilsPrefabs.getNode("progressBar", gamelayout);
  537. let powcountlayout = UtilsPrefabs.getNode("powcountlayout", gamelayout);
  538. progressBar.active = false;
  539. powcountlayout.active = false;
  540. let perfectEnding = UtilsPrefabs.getNode("perfectEnding", this.node);
  541. perfectEnding.active = true;
  542. let performermove = UtilsPrefabs.getNode("performermove", this.node);
  543. performermove.active = true;
  544. let performer = UtilsPrefabs.getNode("performer", performermove);
  545. // performer.active = true;
  546. this.fast.active = false;
  547. this.earthdragon.active = false;
  548. let bg = UtilsPrefabs.getNode("bg", this.node);
  549. bg.active = false;
  550. let bgb = UtilsPrefabs.getNode("bgb", this.node);
  551. bgb.active = true;
  552. this.dragon.active = false;
  553. setTimeout(function () {
  554. perfectEnding.active = false;
  555. performermove.active = false;
  556. let taiyangxi = UtilsPrefabs.getNode("taiyangxi", this.node);
  557. taiyangxi.active = true;
  558. let performer1 = UtilsPrefabs.getNode("performer1", this.node);
  559. performer1.active = true;
  560. bg.active = true;
  561. bgb.active = false;
  562. setTimeout(function () {
  563. Global.layoutManager.setGameOver();
  564. }.bind(this), 4000);//这个数字是太阳系动画的时间
  565. }.bind(this), 2000);//这个数字是黑洞动画的时间
  566. },
  567. checkAnimationsend: function (type) {
  568. return this.myAnimationsend[type];
  569. }
  570. // update (dt) {},
  571. });