action-hit.vue 40 KB

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