action-hit.vue 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586
  1. 11
  2. <!-- 新版本拳击区域部分文件 -->
  3. <template>
  4. <view style="width: 750rpx;">
  5. <view class="flex justify-center" style="margin-top: 68rpx;">
  6. <!-- 目前格子数量不代表数字,显示完成度而已 -460rpx;-->
  7. <view class="grid-progress-vertical-container" style="top:-376rpx;">
  8. <view class="grid-progress-vertical-bar">
  9. <view class="grid-progress-vertical-child" v-for="(item, index) in maxShowCount +1" :key="index"
  10. v-if="index!==0">
  11. <view
  12. :class="showCurCount>=index? 'grid-progress-vertical-active':'grid-progress-vertical-inactive'">
  13. </view>
  14. <view :class="(index%5 == 0||index == 1)?'':'grid-progress-text-hidden'"
  15. class="grid-progress-vertical-text" style="position: absolute;right: 0;top: -4px;">
  16. {{Math.floor(taskSignCount / 26 * index)}}
  17. </view>
  18. </view>
  19. </view>
  20. <view class="grid-progress-vertical-bar">
  21. <view class="grid-progress-vertical-child" v-for="(item, index) in maxShowCount +1" :key="index"
  22. v-if="index!==0">
  23. <view :class="(index%5 == 0||index == 1)?'':'grid-progress-text-hidden'"
  24. class="grid-progress-vertical-text" style="position: absolute;left: 0;top: -4px;">
  25. {{Math.floor(taskSignCount / 26 * index)+taskSignCount/2}}
  26. </view>
  27. <!-- 设置空位 -->
  28. <view></view>
  29. <view
  30. :class="showCurCount>=index+13? 'grid-progress-vertical-active':'grid-progress-vertical-inactive'">
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- class="position-relative" -->
  37. <view style="position: relative;">
  38. <view class="position-absolute-left-top flex justify-center align-center " style="width: 86.12px;height:55.96px;
  39. left: 146rpx;top:-90rpx; ">
  40. <view style="transform: scale(0.5);">
  41. <view class="sprite-yellow-arrow " :class="bRuning?'animation-play-state-play':''"></view>
  42. </view>
  43. </view>
  44. <view class="position-absolute-right-bottom flex justify-center align-center "
  45. style="width: 317rpx; height:138px; right: 46rpx; bottom: 15rpx;">
  46. <view class="flex flex-direction justify-between" style="transform: scale(0.5); height: 276px; ">
  47. <block v-if="bJumpPlay">
  48. <view class="sprite-rightToLeftArrow" :class="bJumpPlay?'sprite-rightToLeftArrow-play':''">
  49. </view>
  50. <view class="sprite-rightToLeftArrow" :class="bJumpPlay?'sprite-rightToLeftArrow-play':''">
  51. </view>
  52. </block>
  53. <block v-else>
  54. <image style="width: 317px; height: 42px;"
  55. src="../../../static/modal/action-jump/progress-tip.png"></image>
  56. <image style="width: 317px; height: 42px;"
  57. src="../../../static/modal/action-jump/progress-tip.png"></image>
  58. </block>
  59. </view>
  60. </view>
  61. <canvas canvas-id="actionHitCanvas" :style="{ width: canvasW + 'px', height: canvasH + 'px' }"></canvas>
  62. </view>
  63. <view style="position: absolute;
  64. top: 30px;
  65. bottom: 0;
  66. left: 0;
  67. right: 0;
  68. justify-content: center;
  69. align-items: center;">
  70. <!-- class="position-absolute-center" -->
  71. <canvas canvas-id="effectHitCanvas" :style="{ width: canvasW + 'px', height: '164px' }"></canvas>
  72. </view>
  73. <view class="flex align-center justify-center" style="font-size: 14px; width:750rpx;">
  74. <view style="position: relative;">
  75. <image style="width: 135px;height: 75px;" src="../../../static/modal/action-jump/Fill.png"></image>
  76. <view class="mid-absolute flex flex-direction align-center justify-center text-white">
  77. <view class="flex align-center">
  78. <image style="width: 22rpx;height: 28rpx;"
  79. src="../../../static/modal/action-jump/jumpSpeed.png"></image>
  80. <view style="margin-left: 6rpx;">平均速度</view>
  81. </view>
  82. <view style="margin-top: 12rpx;">{{averageSpeed}}</view>
  83. </view>
  84. </view>
  85. <view id="ActionJumpPlay" class="flex" style="position: relative;" @click="onControllerPlay">
  86. <image style="width: 110px;height: 110px;"
  87. src="../../../static/modal/action-jump/mid-button-orange@2x.png">
  88. </image>
  89. <image v-if="!bJumpPlay" class="mid-absolute" style="left:12rpx; width: 56rpx;height: 70rpx;"
  90. src="../../../static/play.png">
  91. </image>
  92. <image v-else class="mid-absolute" style="width: 100rpx;height: 100rpx;"
  93. src="../../../static/e-pause.png">
  94. </image>
  95. </view>
  96. <view style="position: relative;">
  97. <image style="width: 135px;height: 75px; transform: scaleX(-1);"
  98. src="../../../static/modal/action-jump/Fill.png"></image>
  99. <view class="mid-absolute flex flex-direction align-center justify-center text-white">
  100. <view class="flex align-center">
  101. <image style="width: 22rpx;height: 28rpx;"
  102. src="../../../static/modal/action-jump/jumpCalorie.png"></image>
  103. <view style="margin-left: 6rpx;">卡路里</view>
  104. </view>
  105. <view style="margin-top: 12rpx;">{{Math.floor(jumpCalorie)}}</view>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="flex align-center justify-center" style="width: 750rpx;margin-top: 16rpx;">
  110. <view class="flex justify-center align-center" style="height: 120rpx; width: 444rpx; ">
  111. <view class="text-12px text-white text-center">
  112. {{taskDescribe}}
  113. </view>
  114. </view>
  115. </view>
  116. <!-- #ifdef H5 -->
  117. <view style="display: flex;justify-content: space-between;" class="margin-top margin-bottom">
  118. <button @click="onJumpType(0)">middle</button>
  119. <button @click="onJumpType(1)">left</button>
  120. <button @click="onJumpType(2)">right</button>
  121. </view>
  122. <!-- #endif -->
  123. </view>
  124. </template>
  125. <script>
  126. import {
  127. CONDITIONPASSED
  128. } from "@/util/util-js/enum.js"
  129. import Firework from "@/util/util-js/effect/firework.js"
  130. import Animation from "@/util/util-js/Animation.js"
  131. import puchConfig from "@/util/util-js/puchConfig.js"
  132. import {
  133. mapState,
  134. mapMutations
  135. } from 'vuex';
  136. export default {
  137. computed: mapState(['systemInfo', 'bOldDeviceType']),
  138. components: {
  139. },
  140. props: {
  141. showTime: {
  142. type: Number,
  143. default: 0
  144. },
  145. levelData: {
  146. type: Object,
  147. default: null
  148. },
  149. currentMode: {
  150. type: String,
  151. default: ''
  152. }
  153. },
  154. data() {
  155. return {
  156. isY: true,
  157. canvasW: 0, // 画布宽
  158. canvasH: 0, // 画布高
  159. // SystemInfo: {}, // 设备信息
  160. directionJumpRight: null,
  161. directionJumpLeft: null,
  162. midJump: null,
  163. rotateJumpRight: null,
  164. rotateJumpLeft: null,
  165. directionJumpWhiteRight: null,
  166. directionJumpWhiteLeft: null,
  167. midJumpWhite: null,
  168. rotateJumpWhiteRight: null,
  169. rotateJumpWhiteLeft: null,
  170. //参考图片
  171. cankao: null,
  172. jumpTipImage: null,
  173. JumpTipOrange: null,
  174. jumpNormalLine: null,
  175. jumpNormalRect: null,
  176. jumpNormalWidth: 70,
  177. jumpNormalHeight: 164,
  178. jumpProgressTip: null,
  179. jumpTypeArray: [{
  180. jumpName: 'NORMAL',
  181. jumpCode: 0,
  182. icon: 'midJump',
  183. scaleX: 1,
  184. bTrigger: false,
  185. bShow: true,
  186. }, {
  187. jumpName: 'LEFT',
  188. jumpCode: 1,
  189. icon: 'directionJump',
  190. scaleX: 1,
  191. bTrigger: false,
  192. bShow: true,
  193. }, {
  194. jumpName: 'RIGHT',
  195. jumpCode: 2,
  196. icon: 'directionJump',
  197. scaleX: 1,
  198. bTrigger: false,
  199. bShow: true,
  200. }],
  201. spawnArray: [],
  202. deleteSpawn: null, //已删除的对象
  203. deleteImage: null,
  204. /**
  205. * 生成的背景位置
  206. */
  207. spawnPos: [],
  208. spawnAnimation: null,
  209. spawnProcess: 1,
  210. //下一个生成是相反的方向
  211. bNextSpawnRightDirection: false,
  212. bNextSpawnRightRotateDirection: false,
  213. //生成预制的模板,用count 来判断生成哪一种
  214. template: [{ //原地
  215. count: 1,
  216. spawnList: [
  217. [0]
  218. ]
  219. }, {
  220. count: 2,
  221. spawnList: [
  222. [2, 1],
  223. [1, 2],
  224. [3, 4],
  225. [4, 3]
  226. ]
  227. }, {
  228. count: 3,
  229. spawnList: [
  230. [2, 0, 1],
  231. [1, 0, 2],
  232. [3, 0, 4],
  233. [4, 0, 3]
  234. ]
  235. }, ],
  236. //模板对象池,管理生成对象
  237. templatePool: [],
  238. levelType: 0,
  239. countdown: 60,
  240. countdownInterval: null,
  241. faultCount: 0,
  242. eliminationCount: 0,
  243. bJumpPlay: false,
  244. jumpCalorie: 0,
  245. averageSpeedInterval: null,
  246. averageSpeed: 0,
  247. tempHitCount: 0,
  248. //硬件设备处理
  249. BLEAccIndex: 0,
  250. xA: 0,
  251. yA: 0,
  252. zA: 0,
  253. /**
  254. * 交互数据处理
  255. */
  256. //当前选择的关卡信息
  257. selfLevelData: null,
  258. // 双人模式下 数据
  259. //标记块数量
  260. taskSignCount: 0, //总数
  261. taskSignCurCount: 0, //当前计数
  262. //{"type":1,"explain":"规定时间内跳完所有标志块","limitType":1}
  263. taskConditionPassed: null,
  264. taskDescribe: '',
  265. //满格的数值是 25
  266. maxShowCount: 13,
  267. addShowCountUnit: 0,
  268. showCurCount: 0,
  269. roundingCount: 0,
  270. //游戏结束
  271. isGameOver: false,
  272. //pk模式下操作
  273. leftShowCurCount: 0,
  274. rightShowCurCount: 0,
  275. isleftPlayer: true,
  276. /**
  277. * 是否允许绘制
  278. */
  279. canOnDraw: false,
  280. /**
  281. * 是否去到下一个关卡
  282. */
  283. canGoNext: false,
  284. /**
  285. * 生成的特效
  286. */
  287. canSpawnTemp: null,
  288. onLogData: '',
  289. /**
  290. * 是否显示关卡提示
  291. */
  292. bTipLevel: false,
  293. /**
  294. * 烟花相关
  295. */
  296. // firework collection
  297. fireworks: [],
  298. fireworkImage: null,
  299. loop: null,
  300. count: 100,
  301. effectHitCanvas: null,
  302. effectCurrentSpawn: null,
  303. effectSpawnPosX: 0,
  304. /**
  305. * 烟花特效
  306. */
  307. bDrawBoomEffect: false,
  308. //绘制箭头效果
  309. bRuning: false,
  310. bRuningInfinite: false,
  311. yellowRuningTimeout: null,
  312. }
  313. },
  314. watch: {
  315. levelData(val) {
  316. //更新数据
  317. // console.log("levelData ============>"+JSON.stringify(val));
  318. if (val) {
  319. this.taskSignCount = val.signCount;
  320. this.taskConditionPassed = val.conditionPassed;
  321. this.taskDescribe = val.describe;
  322. this.addShowCountUnit = (this.maxShowCount * 2) / this.taskSignCount;
  323. // console.log("this.addShowCountUnit:", this.addShowCountUnit, this.maxShowCount * 2, this
  324. // .taskSignCount);
  325. this.showCount = 0;
  326. //用signType 做等级类型
  327. this.levelType = val.signType;
  328. // console.log(JSON.stringify(this.taskConditionPassed));
  329. }
  330. },
  331. currentMode(val) {
  332. // console.log('==========> action jump currentMode:', val);
  333. }
  334. },
  335. created() {
  336. let _self = this;
  337. this.actionHitCanvas = uni.createCanvasContext("actionHitCanvas", this);
  338. this.effectHitCanvas = uni.createCanvasContext("effectHitCanvas", this);
  339. // this.SystemInfo = this.systemInfo; // uni.getSystemInfoSync();
  340. this.canvasW = this.systemInfo.windowWidth; // 画布宽度
  341. this.canvasH = 147.68;
  342. this.onLoadImage();
  343. //更新一次状态
  344. const value = uni.getStorageSync('levelButtonPrompt');
  345. if (value) {
  346. _self.bTipLevel = !value.isSelected;
  347. } else {
  348. _self.bTipLevel = true;
  349. }
  350. if (this.averageSpeedInterval) {
  351. clearInterval(this.averageSpeedInterval);
  352. this.averageSpeedInterval = null;
  353. }
  354. //计算平均速度
  355. this.averageSpeedInterval = setInterval(() => {
  356. this.averageSpeed = this.tempHitCount;
  357. this.tempHitCount = 0;
  358. }, 3000)
  359. // console.log("组件创建")
  360. },
  361. // destroyed() { //Vue 实例销毁后调用
  362. // console.log("组件销毁")
  363. // },
  364. methods: {
  365. ...mapMutations(['onWriteBLEConnectionValue', 'onConvertDeviceData']),
  366. //更新新手状态提示
  367. onUpdateTipLevelValue(value) {
  368. this.bTipLevel = value;
  369. },
  370. //load 相关图片
  371. onLoadImage() {
  372. let _self = this;
  373. uni.getImageInfo({
  374. src: "../../../static/modal/boxing-post/left-hook-m@2x.png",
  375. success: function(image) {
  376. _self.directionJumpLeft = image;
  377. }
  378. });
  379. uni.getImageInfo({
  380. src: "../../../static/modal/boxing-post/right-hook-m@2x.png",
  381. success: function(image) {
  382. _self.directionJumpRight = image;
  383. }
  384. });
  385. uni.getImageInfo({
  386. src: "../../../static/modal/boxing-post/straight-m@2x.png",
  387. success: function(image) {
  388. _self.midJump = image;
  389. }
  390. });
  391. uni.getImageInfo({
  392. src: "../../../static/modal/boxing-post/right-hook-h@2x.png",
  393. success: function(image) {
  394. _self.directionJumpWhiteRight = image;
  395. }
  396. });
  397. uni.getImageInfo({
  398. src: "../../../static/modal/boxing-post/left-hook-h@2x.png",
  399. success: function(image) {
  400. _self.directionJumpWhiteLeft = image;
  401. }
  402. });
  403. uni.getImageInfo({
  404. src: "../../../static/modal/boxing-post/straight-h@2x.png",
  405. success: function(image) {
  406. _self.midJumpWhite = image;
  407. }
  408. });
  409. uni.getImageInfo({
  410. src: "../../../static/modal/action-jump/jumpTip.png",
  411. success: function(image) {
  412. _self.jumpTipImage = image;
  413. }
  414. });
  415. uni.getImageInfo({
  416. src: "../../../static/modal/action-jump/jump-tip-orange@2x.png",
  417. success: function(image) {
  418. _self.JumpTipOrange = image;
  419. }
  420. })
  421. uni.getImageInfo({
  422. src: "../../../static/modal/action-jump/progress-tip.png",
  423. success: function(image) {
  424. _self.jumpProgressTip = image;
  425. }
  426. })
  427. uni.getImageInfo({
  428. src: "../../../static/modal/action-jump/jumpNormal-line.png",
  429. success: function(image) {
  430. _self.jumpNormalLine = image;
  431. }
  432. });
  433. uni.getImageInfo({
  434. src: "../../../static/modal/action-jump/jumpNormal-rect.png",
  435. success: function(image) {
  436. _self.jumpNormalRect = image;
  437. _self.onDrawBg(true);
  438. }
  439. });
  440. uni.getImageInfo({
  441. src: "../../../static/modal/action-jump/cankao.png",
  442. success: function(image) {
  443. _self.cankao = image;
  444. }
  445. });
  446. /**
  447. * 烟花照片
  448. */
  449. uni.getImageInfo({
  450. src: "../../../static/modal/action-jump/boom.png",
  451. success: function(image) {
  452. _self.fireworkImage = image;
  453. }
  454. });
  455. },
  456. /**
  457. * 重置生成数组,重置倒计时
  458. */
  459. resetJumpGame() {
  460. this.spawnArray = [];
  461. this.templatePool = [];
  462. if (this.countdownInterval) {
  463. clearInterval(this.countdownInterval);
  464. this.countdownInterval = null;
  465. }
  466. // this.resetCountdown(60);
  467. },
  468. startJumpGame() {
  469. this.isGameOver = false;
  470. this.resetJumpGame();
  471. //开始游戏
  472. this.index = 0;
  473. // this.levelType = 5;
  474. let spawnCount = 7;
  475. let _ranType = Math.floor(Math.random() * 2);
  476. //生成二个占位
  477. this.addTemplatePoolFromType(false, this.template[0].spawnList[0][0]);
  478. this.addTemplatePoolFromType(false, this.template[0].spawnList[0][0]);
  479. if (this.levelType == 0) {
  480. //随便生成一组跳的数据
  481. let _spawnList = this.template[0].spawnList;
  482. for (let i = 0; i < 30; i++) {
  483. //再对象池里面生成一组对象
  484. this.addTemplatePoolFromType(true, _spawnList[0][0]);
  485. }
  486. //先生成spawnCount个
  487. for (let i = 0; i < spawnCount; i++) {
  488. this.spawnArray.push(this.templatePool[this.index]);
  489. this.index++;
  490. }
  491. } else if (this.levelType == 1) {
  492. //生成一组 左跳右跳
  493. let _spawnList = this.template[1].spawnList;
  494. for (let i = 0; i < 30; i++) {
  495. let ran = Math.floor(Math.random() * 2);
  496. for (let j = 0; j < _spawnList[ran].length; j++) {
  497. //再对象池里面生成一组对象
  498. this.addTemplatePoolFromType(true, _spawnList[ran][j]);
  499. }
  500. }
  501. //先生成spawnCount个
  502. for (let i = 0; i < spawnCount; i++) {
  503. this.spawnArray.push(this.templatePool[this.index]);
  504. this.index++;
  505. }
  506. console.log(this.spawnArray)
  507. } else if (this.levelType == 2) {
  508. //生成一组 左跳右跳原地
  509. let _spawnList = this.template[2].spawnList;
  510. for (let i = 0; i < 30; i++) {
  511. let ran = Math.floor(Math.random() * 2);
  512. for (let j = 0; j < _spawnList[ran].length; j++) {
  513. //再对象池里面生成一组对象
  514. this.addTemplatePoolFromType(true, _spawnList[ran][j]);
  515. }
  516. }
  517. //先生成spawnCount个
  518. for (let i = 0; i < spawnCount; i++) {
  519. this.spawnArray.push(this.templatePool[this.index]);
  520. this.index++;
  521. }
  522. } else if (this.levelType == 3) {
  523. //生成一组 左旋跳右旋跳
  524. let _spawnList = this.template[1].spawnList;
  525. for (let i = 0; i < 30; i++) {
  526. let ran = Math.floor(Math.random() * 2) + 2;
  527. for (let j = 0; j < _spawnList[ran].length; j++) {
  528. //再对象池里面生成一组对象
  529. this.addTemplatePoolFromType(true, _spawnList[ran][j]);
  530. }
  531. }
  532. //先生成spawnCount个
  533. for (let i = 0; i < spawnCount; i++) {
  534. this.spawnArray.push(this.templatePool[this.index]);
  535. this.index++;
  536. }
  537. } else if (this.levelType == 4) {
  538. //生成一组 左旋跳右旋跳
  539. let _spawnList = this.template[2].spawnList;
  540. for (let i = 0; i < 30; i++) {
  541. let ran = Math.floor(Math.random() * 2) + 2;
  542. for (let j = 0; j < _spawnList[ran].length; j++) {
  543. //再对象池里面生成一组对象
  544. this.addTemplatePoolFromType(true, _spawnList[ran][j]);
  545. }
  546. }
  547. //先生成spawnCount个
  548. for (let i = 0; i < spawnCount; i++) {
  549. this.spawnArray.push(this.templatePool[this.index]);
  550. this.index++;
  551. }
  552. } else if (this.levelType == 5) {
  553. for (let i = 0; i < 20; i++) {
  554. //随便生成三组数据
  555. let _newArray = [];
  556. let _spawnList2 = this.template[2].spawnList;
  557. let ran2 = Math.floor(Math.random() * 2);
  558. let ran3 = Math.floor(Math.random() * 2);
  559. if (_ranType >= 1) {
  560. ran2 += 2;
  561. ran3 += 2;
  562. }
  563. _newArray = _newArray.concat(_spawnList2[ran2]);
  564. _newArray = _newArray.concat(_spawnList2[ran3]);
  565. for (let j = 0; j < _newArray.length; j++) {
  566. this.addTemplatePoolFromType(true, _newArray[j]);
  567. }
  568. }
  569. //先生成spawnCount个
  570. for (let i = 0; i < spawnCount; i++) {
  571. this.spawnArray.push(this.templatePool[this.index]);
  572. this.index++;
  573. }
  574. }
  575. this.onDraw("tipHit", false);
  576. },
  577. /**
  578. * 生成对应预制对象
  579. * @param {Object} bShow
  580. * @param {Object} _jumpType
  581. */
  582. addTemplatePoolFromType(bShow, _jumpType) {
  583. for (let i = 0; i < this.jumpTypeArray.length; i++) {
  584. if (this.jumpTypeArray[i].jumpCode == _jumpType) {
  585. let _jumpPrefab = Object.assign({}, this.jumpTypeArray[i], {
  586. bShow: bShow,
  587. bInit: true,
  588. position: 0,
  589. animation: null, //动画
  590. });
  591. this.templatePool.push(_jumpPrefab);
  592. break;
  593. }
  594. }
  595. },
  596. //单纯的绘制八个背景
  597. onDrawBg(bDraw) {
  598. this.spawnPos = [];
  599. if (bDraw) {
  600. this.actionHitCanvas.clearRect(0, 0, this.canvasW, this.canvasH);
  601. }
  602. let _currentBgStartX = this.canvasW / 2;
  603. let count = 7;
  604. let _currentPos = -12,
  605. _addPos = 0;
  606. for (let i = 0; i < count; i++) {
  607. if (0 !== i) {
  608. _currentPos += this.jumpNormalWidth;
  609. } else {
  610. _currentPos -= this.jumpNormalWidth;
  611. }
  612. if (2 === i) {
  613. //结尾时候快消除完绘制一次大图背景。不然会为空白
  614. if (this.spawnArray.length < 3)
  615. this.actionHitCanvas.drawImage(this.jumpTipImage.path, _currentPos, 0, 120, this
  616. .canvasH);
  617. if (bDraw) {
  618. this.actionHitCanvas.drawImage(this.JumpTipOrange.path, _currentPos + 3, 7, 113, this
  619. .canvasH -
  620. 14);
  621. }
  622. //添加对应生成点
  623. this.spawnPos.push({
  624. center: _currentPos + 30
  625. })
  626. _currentPos += 50;
  627. } else {
  628. this.actionHitCanvas.drawImage(this.jumpNormalLine.path, _currentPos, 0, this
  629. .jumpNormalWidth,
  630. this.canvasH);
  631. if (bDraw) {
  632. this.actionHitCanvas.drawImage(this.jumpNormalRect.path, _currentPos, 0, this
  633. .jumpNormalWidth,
  634. this.canvasH);
  635. }
  636. //添加对应生成点
  637. this.spawnPos.push({
  638. center: _currentPos + 16
  639. })
  640. }
  641. }
  642. if (bDraw) {
  643. this.actionHitCanvas.draw();
  644. }
  645. },
  646. onDraw(type, bAnimation) {
  647. let _self = this;
  648. if (bAnimation && _self.spawnAnimation == null) {
  649. _self.spawnProcess = 0;
  650. _self.spawnAnimation = new Animation({
  651. timing: 'linear',
  652. duration: 200,
  653. onProcess: function onProcess(process) {
  654. _self.spawnProcess = process;
  655. _self.onDraw('normal', true);
  656. // console.log("process=" + process);
  657. },
  658. onAnimationFinish: function onAnimationFinish() {
  659. // console.log("finish animation");
  660. _self.spawnAnimation = null;
  661. }
  662. })
  663. }
  664. this.actionHitCanvas.clearRect(0, 0, this.canvasW, this.canvasH);
  665. //单纯绘制背景
  666. this.onDrawBg(false);
  667. //计算一个节点数组
  668. // let _oldRectMoveDis = 1;
  669. for (let i = 0; i < this.spawnArray.length; i++) {
  670. //默认 mid 图标
  671. let _temp = this.spawnArray[i].bTrigger ? this.midJump : this.midJumpWhite;
  672. if (this.spawnArray[i].icon == 'directionJump') {
  673. if (this.spawnArray[i].jumpName == "RIGHT") {
  674. _temp = this.spawnArray[i].bTrigger ? this.directionJumpRight : this
  675. .directionJumpWhiteRight;
  676. } else {
  677. _temp = this.spawnArray[i].bTrigger ? this.directionJumpLeft : this
  678. .directionJumpWhiteLeft;
  679. }
  680. }
  681. this.actionHitCanvas.save();
  682. let _currentPos = this.spawnPos[i].center;
  683. let _currentCenterPos = 0;
  684. if (2 === i) {
  685. //这里分两部分走,从小图走到大图
  686. let _spawnBiggerToLeft = this.spawnArray[i];
  687. //这里记录一个生成点,后面用于生成特效
  688. this.effectSpawnPosX = _currentPos;
  689. //大图
  690. let tempPosition = _currentPos;
  691. if (!bAnimation || _spawnBiggerToLeft.bInit) {
  692. _spawnBiggerToLeft.position = _currentPos;
  693. _spawnBiggerToLeft.bInit = false;
  694. } else {
  695. tempPosition = _spawnBiggerToLeft.position - Math.abs(_currentPos - _spawnBiggerToLeft
  696. .position) * _self.spawnProcess;
  697. }
  698. if (1 === this.spawnProcess) {
  699. _spawnBiggerToLeft.position = tempPosition;
  700. } else {
  701. //绘制一次前面方块背景前移
  702. this.actionHitCanvas.drawImage(this.jumpNormalRect.path, tempPosition - 16, 0, this
  703. .jumpNormalWidth,
  704. this.canvasH);
  705. this.actionHitCanvas.clearRect(this.spawnPos[i].center - 30, 0, 120, this.canvasH);
  706. }
  707. let _width = 40 + 20 * _self.spawnProcess;
  708. this.actionHitCanvas.drawImage(_temp.path, tempPosition, 55 - 9 * _self.spawnProcess,
  709. _width,
  710. _width);
  711. //绘制多一次背景
  712. this.actionHitCanvas.drawImage(this.jumpTipImage.path, this.spawnPos[i].center - 30, 0,
  713. 120, this
  714. .canvasH);
  715. this.actionHitCanvas.drawImage(this.JumpTipOrange.path, this.spawnPos[i].center - 27, 7,
  716. 113, this
  717. .canvasH -
  718. 14);
  719. } else {
  720. //小图
  721. let _otherObj = this.spawnArray[i];
  722. let tempPosition = _currentPos;
  723. if (!bAnimation || _otherObj.bInit) {
  724. _otherObj.position = _currentPos;
  725. _otherObj.bInit = false;
  726. } else {
  727. tempPosition = _otherObj.position - Math.abs(_currentPos - _otherObj.position) * _self
  728. .spawnProcess;
  729. }
  730. if (1 === this.spawnProcess) {
  731. _otherObj.position = tempPosition;
  732. }
  733. this.actionHitCanvas.drawImage(this.jumpNormalRect.path, tempPosition - 16, 0, this
  734. .jumpNormalWidth,
  735. this.canvasH);
  736. if (this.spawnArray[i].bShow) {
  737. this.actionHitCanvas.drawImage(_temp.path, tempPosition, 55, 40, 40);
  738. }
  739. }
  740. this.actionHitCanvas.restore();
  741. }
  742. this.actionHitCanvas.draw();
  743. },
  744. /**
  745. * 消除时候显示的特效
  746. * @param {Object} _temp
  747. */
  748. onDrawEffect(_temp) {
  749. if (!this.bRuning) {
  750. this.bRuning = true;
  751. if (this.yellowRuningTimeout) {
  752. clearTimeout(this.yellowRuningTimeout)
  753. this.yellowRuningTimeout = null;
  754. }
  755. this.yellowRuningTimeout = setTimeout(() => {
  756. this.bRuning = false;
  757. }, 1000)
  758. }
  759. //根据当前消除的生成一个
  760. let spawnTemp = this.midJump;
  761. let offest = 5;
  762. if (_temp.icon == 'directionJump') {
  763. spawnTemp = _temp.jumpName == "RIGHT" ? this.directionJumpRight : this.directionJumpLeft;
  764. }
  765. let tempFirework = new Firework(this.fireworkImage,
  766. spawnTemp, _temp.scaleX, this.effectSpawnPosX, 0, this.canvasW, 164, offest, true);
  767. this.fireworks.push(tempFirework);
  768. this.bDrawBoomEffect = true;
  769. this.onInitFirework();
  770. },
  771. onClear() {
  772. this.resetJumpGame();
  773. this.onDrawBg(true);
  774. this.xA = 0;
  775. this.yA = 0;
  776. this.zA = 0;
  777. },
  778. /**
  779. * 统一绘制 效果 背景,交互,烟花
  780. */
  781. onInitFirework() {
  782. if (this.loop != null) {
  783. return;
  784. }
  785. this.loop = setInterval(() => {
  786. if (!this.bDrawBoomEffect) {
  787. clearInterval(this.loop);
  788. this.loop = null;
  789. // console.log("结束绘制");
  790. this.effectHitCanvas.clearRect(0, 0, this.canvasW, 164);
  791. this.effectHitCanvas.draw();
  792. return;
  793. }
  794. this.effectHitCanvas.clearRect(0, 0, this.canvasW, 164);
  795. if (this.bDrawBoomEffect) {
  796. // loop over each firework, draw it, update it
  797. var i = this.fireworks.length;
  798. while (i--) {
  799. this.fireworks[i].draw(this.effectHitCanvas, () => {
  800. this.fireworks.splice(i, 1);
  801. if (this.fireworks.length == 0) {
  802. this.bDrawBoomEffect = false;
  803. }
  804. });
  805. }
  806. }
  807. this.effectHitCanvas.draw();
  808. }, 30)
  809. },
  810. onJumpType(event) {
  811. // console.log("onJumpType:", event);
  812. if (this.isGameOver || !this.bJumpPlay) return;
  813. this.eliminateJumpPrefab(event);
  814. },
  815. // update (dt) {}
  816. //模拟测试调用
  817. eliminateJumpPrefab(_jumpType) {
  818. //只触发第二个
  819. if (this.spawnArray.length < 3 || this.spawnAnimation != null) {
  820. return;
  821. }
  822. let _temp = this.spawnArray[2];
  823. //如果当前的跳类型和预制目标一样
  824. if (_jumpType == _temp.jumpCode) {
  825. _temp.bTrigger = true;
  826. this.deleteSpawn = this.spawnArray.splice(0, 1);
  827. if (this.index < this.templatePool.length) {
  828. this.spawnArray.push(this.templatePool[this.index]);
  829. this.index++;
  830. }
  831. //这里更新特效
  832. let _endTemp = Object.assign({}, _temp);
  833. this.onDrawEffect(_endTemp);
  834. //绘制新触发状态
  835. this.onDraw('tipHit', true);
  836. //成功
  837. this.setEliminationCount(1);
  838. //替换数组
  839. // console.log(this.index + " == " + this.spawnArray.length);
  840. if (this.spawnArray.length < 3 && this.index > 3) {
  841. clearInterval(this.countdownInterval);
  842. this.countdownInterval = null;
  843. //绘制新触发状态
  844. this.onDraw("normal", false);
  845. setTimeout(() => {
  846. this.startJumpGame();
  847. }, 2000)
  848. }
  849. } else {
  850. //失误
  851. this.setFaultCount(1);
  852. }
  853. },
  854. //设置倒计时
  855. setCountdown(value) {
  856. this.countdown -= value;
  857. // this.countdownLabel.string = '倒计时:' + this.countdown;
  858. this.$emit('actionJumpCountDownUpdate', {
  859. countDown: this.countdown
  860. });
  861. },
  862. resetCountdown(value) {
  863. this.countdown = value;
  864. // this.countdownLabel.string = '倒计时:' + this.countdown;
  865. this.$emit('actionJumpCountDownUpdate', {
  866. countDown: this.countdown
  867. });
  868. },
  869. //设置ui信息
  870. setEliminationCount(value) {
  871. this.tempHitCount++;
  872. this.taskSignCurCount++;
  873. this.roundingCount += this.addShowCountUnit;
  874. this.eliminationCount += value;
  875. // this.eliminationLabel.string = '消除数量:' + this.eliminationCount.toString();
  876. this.$emit('actionJumpDataUpdate', {
  877. eliminationCount: this.eliminationCount,
  878. faultCount: this.faultCount
  879. });
  880. this.jumpCalorie += puchConfig.getJumpCalorie(this.eliminationCount + this.faultCount);
  881. //如果是pk模式。不走下面判断
  882. if (this.currentMode == 'pkMode') return;
  883. if (CONDITIONPASSED.ENERGYBARFULL == this.taskConditionPassed.limitType) {
  884. //能量条的条件下才显示能量条动
  885. //取两位后计算Math floor,不然会有偏差值问题 Math.floor(39.9999999+ 0.1111111) = 39
  886. this.showCurCount = Math.floor(this.roundingCount.toFixed(2));
  887. //1.能量槽满的时候,说明踩中次数到达
  888. if (this.taskSignCurCount >= this.taskSignCount)
  889. this.onGameOver("energyBarFull");
  890. } else if (CONDITIONPASSED.SKIPALLFLAGWITHINTIME == this.taskConditionPassed.limitType) {
  891. //规定时间下也给显示能量条
  892. this.showCurCount = Math.floor(this.roundingCount.toFixed(2));
  893. //2.规定时间内跳完所有标志块
  894. if (this.taskSignCurCount >= this.taskSignCount)
  895. this.onGameOver("skipAllFlagWithinTime");
  896. } else if (this.taskConditionPassed.isScore) {
  897. //3.达到一定分数
  898. //如果是用分数判断
  899. //分数是 跳对的加1分,错的扣1分,0不扣分。
  900. let curScore = this.eliminationCount - this.faultCount;
  901. curScore = curScore < 0 ? 0 : curScore;
  902. //当前分数达到,胜利
  903. if (curScore >= this.taskConditionPassed.limitScore)
  904. this.onGameOver("score");
  905. }
  906. },
  907. onGameOver(type) {
  908. this.isGameOver = true;
  909. //处理参数
  910. this.onClear();
  911. this.onClearData();
  912. this.bJumpPlay = false;
  913. /**
  914. * 判断胜利和失败
  915. */
  916. let myWin = false; //默认失败
  917. //比如, 1.充满左右两边蓄能槽.2.规定时间内跳完所有标志块.
  918. if (type == "energyBarFull") {
  919. //1.能量槽满的时候,说明踩中次数到达
  920. if (this.taskSignCurCount >= this.taskSignCount) {
  921. myWin = true;
  922. }
  923. } else if (type == 'skipAllFlagWithinTime') {
  924. myWin = true;
  925. } else if (type == "timeUp") {
  926. //2.规定时间内跳完所有标志块
  927. //查看消除数量是否到达总数,未达成就是未完成
  928. if (this.taskSignCurCount >= this.taskSignCount) {
  929. myWin = true;
  930. }
  931. } else if (type == "score") {
  932. myWin = true;
  933. }
  934. console.log(type, {
  935. myWin: myWin
  936. });
  937. this.$emit('gameOver', {
  938. myWin: myWin,
  939. type: 'calorieMode',
  940. isOffEvent: true
  941. });
  942. },
  943. //pk模式下结束游戏关卡
  944. onPKModeGameOver(type) {
  945. this.isGameOver = true;
  946. //处理参数
  947. this.onClear();
  948. this.onClearData();
  949. this.bJumpPlay = false;
  950. this.$emit('gameOver', {
  951. type: 'pkMode',
  952. isOffEvent: true
  953. });
  954. },
  955. setFaultCount(value) {
  956. this.tempHitCount++;
  957. this.faultCount += value;
  958. // this.faultLabel.string = '失误:' + this.faultCount;
  959. this.$emit('actionJumpDataUpdate', {
  960. eliminationCount: this.eliminationCount,
  961. faultCount: this.faultCount
  962. });
  963. this.jumpCalorie += puchConfig.getJumpCalorie(this.eliminationCount + this.faultCount);
  964. },
  965. //控制播放
  966. onControllerPlay() {
  967. if (this.bJumpPlay) {
  968. //仅仅暂停,没有清空数据
  969. this._changePlay(false);
  970. this.$emit("actionJumpControllerPlay", false);
  971. } else {
  972. this.$emit("actionJumpCheck");
  973. }
  974. },
  975. onContinueGame() {
  976. this._changePlay(true);
  977. },
  978. onClearActionJumpData() {
  979. console.log("onClearActionJumpData");
  980. this.onClear();
  981. this.onClearData();
  982. },
  983. //修改状态
  984. _changePlay(bPlaying) {
  985. if (bPlaying) {
  986. this.bJumpPlay = bPlaying;
  987. } else {
  988. this.bJumpPlay = !this.bJumpPlay;
  989. }
  990. },
  991. onActionPlay() {
  992. this.onClear();
  993. this.onClearData();
  994. this.startJumpGame();
  995. this._changePlay(true);
  996. //reset 对应计算数据
  997. this.taskSignCurCount = 0;
  998. this.showCurCount = 0;
  999. this.roundingCount = 0;
  1000. this.faultCount = 0;
  1001. this.eliminationCount = 0;
  1002. },
  1003. getCurrentJumpType() {
  1004. let _temp = this.spawnArray[2];
  1005. return _temp.jumpCode;
  1006. },
  1007. //监听跳的状态数据
  1008. listenStateDataOfJump(data) {
  1009. if (this.spawnArray.length < 3) return;
  1010. let _jumpType = this.getCurrentJumpType();
  1011. //初始全部默认状态
  1012. let _tempState = [{
  1013. jumpName: 'NORMAL',
  1014. jumpCode: 0,
  1015. bTrigger: false,
  1016. describe: '正常跳'
  1017. },
  1018. {
  1019. jumpName: 'LEFT',
  1020. jumpCode: 1,
  1021. bTrigger: false,
  1022. describe: '左直跳'
  1023. },
  1024. {
  1025. jumpName: 'RIGHT',
  1026. jumpCode: 2,
  1027. bTrigger: false,
  1028. describe: '右直跳'
  1029. },
  1030. {
  1031. jumpName: 'LEFT_ROTATE',
  1032. jumpCode: 3,
  1033. bTrigger: false,
  1034. describe: '左旋转跳'
  1035. },
  1036. {
  1037. jumpName: 'RIGHT_ROTATE',
  1038. jumpCode: 4,
  1039. bTrigger: false,
  1040. describe: '右旋转跳'
  1041. }
  1042. ];
  1043. let {
  1044. currentMaxValue,
  1045. oGyroValue,
  1046. peakOfWaveMaxValue,
  1047. valleyOfWaveMinValue
  1048. } = data
  1049. // console.log('stateDataOfJump:');
  1050. // console.log(JSON.stringify(data));
  1051. this.onLogData = data;
  1052. let _rotateLimit = 4;
  1053. let _jumpLimit = 0;
  1054. switch (_jumpType) {
  1055. case 0:
  1056. //JumpType.NORMAL = 0
  1057. _tempState[0].bTrigger = true;
  1058. this.eliminateJumpPrefabFormTemp(_tempState);
  1059. break;
  1060. case 1:
  1061. if (currentMaxValue < -_jumpLimit) {
  1062. //left jump
  1063. _tempState[1].bTrigger = true;
  1064. }
  1065. this.eliminateJumpPrefabFormTemp(_tempState);
  1066. break;
  1067. case 2:
  1068. if (currentMaxValue > _jumpLimit) {
  1069. //right jump
  1070. _tempState[2].bTrigger = true;
  1071. }
  1072. this.eliminateJumpPrefabFormTemp(_tempState);
  1073. break;
  1074. case 4:
  1075. if (oGyroValue > _rotateLimit) {
  1076. _tempState[4].bTrigger = true;
  1077. }
  1078. this.eliminateJumpPrefabFormTemp(_tempState);
  1079. break;
  1080. case 3:
  1081. if (oGyroValue < -_rotateLimit) {
  1082. _tempState[3].bTrigger = true;
  1083. }
  1084. this.eliminateJumpPrefabFormTemp(_tempState);
  1085. break;
  1086. default:
  1087. console.log('没有对应的_jumpType', _jumpType);
  1088. break;
  1089. }
  1090. },
  1091. eliminateJumpPrefabFormTemp(_tempState) {
  1092. //只触发第三个
  1093. if (this.spawnArray.length < 3) {
  1094. return;
  1095. }
  1096. let _temp = this.spawnArray[2];
  1097. let bSuccess = false;
  1098. for (let i = 0; i < _tempState.length; i++) {
  1099. let _state = _tempState[i];
  1100. if (_state.bTrigger) {
  1101. console.log(this.eliminationCount + ',识别跳的类型:' + _state.describe + ',当前预制类型:' + _temp
  1102. .jumpName +
  1103. "\n直跳判断值:" + this.onLogData.currentMaxValue + ",旋转跳值:" + this.onLogData.oGyroValue);
  1104. }
  1105. //如果当前的跳类型和预制目标一样
  1106. if (_state.jumpCode == _temp.jumpCode && _state.bTrigger) {
  1107. //成功
  1108. bSuccess = true;
  1109. break;
  1110. }
  1111. }
  1112. //如果存在其中一个为true
  1113. if (bSuccess) {
  1114. _temp.bTrigger = true;
  1115. this.canSpawnTemp = _temp;
  1116. setTimeout(() => {
  1117. //这里更新特效
  1118. this.onDrawEffect(this.canSpawnTemp);
  1119. }, 150);
  1120. this.deleteSpawn = this.spawnArray.splice(0, 1);
  1121. if (this.index < this.templatePool.length) {
  1122. this.spawnArray.push(this.templatePool[this.index]);
  1123. this.index++;
  1124. }
  1125. //成功
  1126. this.setEliminationCount(1);
  1127. //替换数组
  1128. // console.log(this.index + " == " + this.spawnArray.length);
  1129. if (this.spawnArray.length < 3 && this.index > 3) {
  1130. clearInterval(this.countdownInterval);
  1131. this.countdownInterval = null;
  1132. //绘制新触发状态
  1133. this.canGoNext = true;
  1134. } else {
  1135. //绘制新触发状态
  1136. this.canOnDraw = true;
  1137. }
  1138. } else {
  1139. //失误
  1140. this.setFaultCount(1);
  1141. }
  1142. },
  1143. /**
  1144. * @param {Object} gameData
  1145. * 识别跳部分数据处理
  1146. */
  1147. onBLEHitUpdate(gameData) {
  1148. console.log("gameData:",gameData);
  1149. if (!this.bJumpPlay || this.isGameOver || this.spawnAnimation != null) return;
  1150. // if (curAngleCeil < 30) {
  1151. // directionPunch = "straightPunch";
  1152. // name = "正向的直拳";
  1153. // ename = "front-straight";
  1154. // } else if (direction.x < 0) {
  1155. // directionPunch = "rightPunch";
  1156. // name = "正向的右拳";
  1157. // ename = "front-right";
  1158. // } else if (direction.x > 0) {
  1159. // directionPunch = "leftPunch";
  1160. // name = "正向的左拳";
  1161. // ename = "front-left";
  1162. // }
  1163. if (gameData.direction == "straightPunch") {
  1164. this.eliminateJumpPrefab(0);
  1165. } else if (gameData.direction == "leftPunch") {
  1166. this.eliminateJumpPrefab(1);
  1167. } else if (gameData.direction == "rightPunch") {
  1168. this.eliminateJumpPrefab(2);
  1169. }
  1170. this.BLEAccIndex++;
  1171. },
  1172. onClearData() {
  1173. this.BLEAccIndex = 0;
  1174. },
  1175. onChangeY() {
  1176. this.isY = true;
  1177. },
  1178. onChangeX() {
  1179. this.isY = false;
  1180. },
  1181. onGetActionJumpPlayView(callback) {
  1182. let view = uni.createSelectorQuery().select('#ActionJumpPlay');
  1183. view.boundingClientRect(data => {
  1184. if (callback)
  1185. callback(data);
  1186. }).exec();
  1187. },
  1188. onTipLevel() {
  1189. this.$emit("tipLevel", {
  1190. hiddenType: 'normal'
  1191. });
  1192. console.log("**************22");
  1193. }
  1194. }
  1195. }
  1196. </script>
  1197. <style lang="scss">
  1198. .mid-absolute {
  1199. position: absolute;
  1200. top: 0;
  1201. bottom: 0;
  1202. right: 0;
  1203. left: 0;
  1204. margin: auto;
  1205. }
  1206. .action-jump-timer {
  1207. position: absolute;
  1208. top: -150rpx;
  1209. }
  1210. .grid-progress-vertical-container {
  1211. min-height: 376rpx;
  1212. }
  1213. .grid-progress-vertical-bar {
  1214. max-height: 376rpx;
  1215. }
  1216. .grid-progress-vertical-child {
  1217. width: 35px;
  1218. height: 7.36px;
  1219. margin: 7.36px 0 0 0;
  1220. position: relative;
  1221. }
  1222. .grid-progress-vertical-active {
  1223. width: 28rpx;
  1224. }
  1225. .grid-progress-vertical-inactive {
  1226. width: 28rpx;
  1227. }
  1228. .sprite-yellow-arrow {
  1229. display: inline-block;
  1230. overflow: hidden;
  1231. background-repeat: no-repeat;
  1232. width: 194px;
  1233. height: 232px;
  1234. background-image: url('@/static/modal/action-jump/yellow-arrow.png');
  1235. // border: 1rpx solid #00CE47;
  1236. }
  1237. .animation-play-state-play {
  1238. animation: yellowArrowRun 1s steps(1, end); // infinite
  1239. animation-play-state: running;
  1240. }
  1241. .animation-play-state-paused {
  1242. animation-play-state: paused;
  1243. }
  1244. /**
  1245. * 箭头动画
  1246. */
  1247. @keyframes yellowArrowRun {
  1248. 0% {
  1249. background-position: -0px -0px;
  1250. }
  1251. 5% {
  1252. background-position: -0px -0px;
  1253. }
  1254. 10% {
  1255. background-position: -194px -0px;
  1256. }
  1257. 15% {
  1258. background-position: -388px -0px;
  1259. }
  1260. 20% {
  1261. background-position: -582px -0px;
  1262. }
  1263. 25% {
  1264. background-position: -776px -0px;
  1265. }
  1266. 30% {
  1267. background-position: -0px -232px;
  1268. }
  1269. 35% {
  1270. background-position: -194px -232px;
  1271. }
  1272. 40% {
  1273. background-position: -388px -232px;
  1274. }
  1275. 45% {
  1276. background-position: -582px -232px;
  1277. }
  1278. 50% {
  1279. background-position: -776px -232px;
  1280. }
  1281. 55% {
  1282. background-position: -0px -464px;
  1283. }
  1284. 60% {
  1285. background-position: -194px -464px;
  1286. }
  1287. 65% {
  1288. background-position: -388px -464px;
  1289. }
  1290. 70% {
  1291. background-position: -582px -464px;
  1292. }
  1293. 75% {
  1294. background-position: -776px -464px;
  1295. }
  1296. 80% {
  1297. background-position: -0px -696px;
  1298. }
  1299. 85% {
  1300. background-position: -194px -696px;
  1301. }
  1302. 90% {
  1303. background-position: -388px -696px;
  1304. }
  1305. 95% {
  1306. background-position: -582px -696px;
  1307. }
  1308. 100% {
  1309. background-position: -776px -696px;
  1310. }
  1311. }
  1312. .sprite-rightToLeftArrow {
  1313. display: inline-block;
  1314. overflow: hidden;
  1315. background-repeat: no-repeat;
  1316. width: 317px;
  1317. height: 42px;
  1318. background-image: url('@/static/modal/action-jump/rightToLeftArrow.png');
  1319. // border: 1rpx solid #00CE47;
  1320. }
  1321. .sprite-rightToLeftArrow-play {
  1322. animation: rightToLeftArrowRun 1s steps(1, end) infinite;
  1323. }
  1324. @keyframes rightToLeftArrowRun {
  1325. 0% {
  1326. background-position: -0px -0px;
  1327. }
  1328. 3.33% {
  1329. background-position: -0px -0px;
  1330. }
  1331. 6.66% {
  1332. background-position: -317px -0px;
  1333. }
  1334. 9.99% {
  1335. background-position: -0px -42px;
  1336. }
  1337. 13.33% {
  1338. background-position: -317px -42px;
  1339. }
  1340. 16.66% {
  1341. background-position: -0px -84px;
  1342. }
  1343. 19.99% {
  1344. background-position: -317px -84px;
  1345. }
  1346. 23.33% {
  1347. background-position: -0px -126px;
  1348. }
  1349. 26.66% {
  1350. background-position: -317px -126px;
  1351. }
  1352. 29.99% {
  1353. background-position: -0px -168px;
  1354. }
  1355. 33.33% {
  1356. background-position: -317px -168px;
  1357. }
  1358. 36.66% {
  1359. background-position: -0px -210px;
  1360. }
  1361. 39.99% {
  1362. background-position: -317px -210px;
  1363. }
  1364. 43.33% {
  1365. background-position: -0px -252px;
  1366. }
  1367. 46.66% {
  1368. background-position: -317px -252px;
  1369. }
  1370. 49.99% {
  1371. background-position: -0px -294px;
  1372. }
  1373. 53.33% {
  1374. background-position: -317px -294px;
  1375. }
  1376. 56.66% {
  1377. background-position: -0px -336px;
  1378. }
  1379. 59.99% {
  1380. background-position: -317px -336px;
  1381. }
  1382. 63.33% {
  1383. background-position: -0px -378px;
  1384. }
  1385. 66.66% {
  1386. background-position: -317px -378px;
  1387. }
  1388. 69.99% {
  1389. background-position: -0px -420px;
  1390. }
  1391. 73.33% {
  1392. background-position: -317px -420px;
  1393. }
  1394. 76.66% {
  1395. background-position: -0px -462px;
  1396. }
  1397. 79.99% {
  1398. background-position: -317px -462px;
  1399. }
  1400. 83.33% {
  1401. background-position: -0px -504px;
  1402. }
  1403. 86.66% {
  1404. background-position: -317px -504px;
  1405. }
  1406. 89.99% {
  1407. background-position: -0px -546px;
  1408. }
  1409. 93.33% {
  1410. background-position: -317px -546px;
  1411. }
  1412. 96.66% {
  1413. background-position: -0px -588px;
  1414. }
  1415. 100% {
  1416. background-position: -317px -588px;
  1417. }
  1418. }
  1419. </style>