action-hit.vue 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602
  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. /**
  1004. * 停止并清空数据
  1005. */
  1006. onStopAndClearAction() {
  1007. this.onClear();
  1008. this.onClearData();
  1009. this.bJumpPlay = false;
  1010. //reset 对应计算数据
  1011. this.taskSignCurCount = 0;
  1012. this.showCurCount = 0;
  1013. this.roundingCount = 0;
  1014. this.faultCount = 0;
  1015. this.eliminationCount = 0;
  1016. this.jumpCalorie = 0;
  1017. },
  1018. getCurrentJumpType() {
  1019. let _temp = this.spawnArray[2];
  1020. return _temp.jumpCode;
  1021. },
  1022. //监听跳的状态数据
  1023. listenStateDataOfJump(data) {
  1024. if (this.spawnArray.length < 3) return;
  1025. let _jumpType = this.getCurrentJumpType();
  1026. //初始全部默认状态
  1027. let _tempState = [{
  1028. jumpName: 'NORMAL',
  1029. jumpCode: 0,
  1030. bTrigger: false,
  1031. describe: '正常跳'
  1032. },
  1033. {
  1034. jumpName: 'LEFT',
  1035. jumpCode: 1,
  1036. bTrigger: false,
  1037. describe: '左直跳'
  1038. },
  1039. {
  1040. jumpName: 'RIGHT',
  1041. jumpCode: 2,
  1042. bTrigger: false,
  1043. describe: '右直跳'
  1044. },
  1045. {
  1046. jumpName: 'LEFT_ROTATE',
  1047. jumpCode: 3,
  1048. bTrigger: false,
  1049. describe: '左旋转跳'
  1050. },
  1051. {
  1052. jumpName: 'RIGHT_ROTATE',
  1053. jumpCode: 4,
  1054. bTrigger: false,
  1055. describe: '右旋转跳'
  1056. }
  1057. ];
  1058. let {
  1059. currentMaxValue,
  1060. oGyroValue,
  1061. peakOfWaveMaxValue,
  1062. valleyOfWaveMinValue
  1063. } = data
  1064. // console.log('stateDataOfJump:');
  1065. // console.log(JSON.stringify(data));
  1066. this.onLogData = data;
  1067. let _rotateLimit = 4;
  1068. let _jumpLimit = 0;
  1069. switch (_jumpType) {
  1070. case 0:
  1071. //JumpType.NORMAL = 0
  1072. _tempState[0].bTrigger = true;
  1073. this.eliminateJumpPrefabFormTemp(_tempState);
  1074. break;
  1075. case 1:
  1076. if (currentMaxValue < -_jumpLimit) {
  1077. //left jump
  1078. _tempState[1].bTrigger = true;
  1079. }
  1080. this.eliminateJumpPrefabFormTemp(_tempState);
  1081. break;
  1082. case 2:
  1083. if (currentMaxValue > _jumpLimit) {
  1084. //right jump
  1085. _tempState[2].bTrigger = true;
  1086. }
  1087. this.eliminateJumpPrefabFormTemp(_tempState);
  1088. break;
  1089. case 4:
  1090. if (oGyroValue > _rotateLimit) {
  1091. _tempState[4].bTrigger = true;
  1092. }
  1093. this.eliminateJumpPrefabFormTemp(_tempState);
  1094. break;
  1095. case 3:
  1096. if (oGyroValue < -_rotateLimit) {
  1097. _tempState[3].bTrigger = true;
  1098. }
  1099. this.eliminateJumpPrefabFormTemp(_tempState);
  1100. break;
  1101. default:
  1102. console.log('没有对应的_jumpType', _jumpType);
  1103. break;
  1104. }
  1105. },
  1106. eliminateJumpPrefabFormTemp(_tempState) {
  1107. //只触发第三个
  1108. if (this.spawnArray.length < 3) {
  1109. return;
  1110. }
  1111. let _temp = this.spawnArray[2];
  1112. let bSuccess = false;
  1113. for (let i = 0; i < _tempState.length; i++) {
  1114. let _state = _tempState[i];
  1115. if (_state.bTrigger) {
  1116. console.log(this.eliminationCount + ',识别跳的类型:' + _state.describe + ',当前预制类型:' + _temp
  1117. .jumpName +
  1118. "\n直跳判断值:" + this.onLogData.currentMaxValue + ",旋转跳值:" + this.onLogData.oGyroValue);
  1119. }
  1120. //如果当前的跳类型和预制目标一样
  1121. if (_state.jumpCode == _temp.jumpCode && _state.bTrigger) {
  1122. //成功
  1123. bSuccess = true;
  1124. break;
  1125. }
  1126. }
  1127. //如果存在其中一个为true
  1128. if (bSuccess) {
  1129. _temp.bTrigger = true;
  1130. this.canSpawnTemp = _temp;
  1131. setTimeout(() => {
  1132. //这里更新特效
  1133. this.onDrawEffect(this.canSpawnTemp);
  1134. }, 150);
  1135. this.deleteSpawn = this.spawnArray.splice(0, 1);
  1136. if (this.index < this.templatePool.length) {
  1137. this.spawnArray.push(this.templatePool[this.index]);
  1138. this.index++;
  1139. }
  1140. //成功
  1141. this.setEliminationCount(1);
  1142. //替换数组
  1143. // console.log(this.index + " == " + this.spawnArray.length);
  1144. if (this.spawnArray.length < 3 && this.index > 3) {
  1145. clearInterval(this.countdownInterval);
  1146. this.countdownInterval = null;
  1147. //绘制新触发状态
  1148. this.canGoNext = true;
  1149. } else {
  1150. //绘制新触发状态
  1151. this.canOnDraw = true;
  1152. }
  1153. } else {
  1154. //失误
  1155. this.setFaultCount(1);
  1156. }
  1157. },
  1158. /**
  1159. * @param {Object} gameData
  1160. * 识别跳部分数据处理
  1161. */
  1162. onBLEHitUpdate(gameData) {
  1163. console.log("gameData:", gameData);
  1164. if (!this.bJumpPlay || this.isGameOver || this.spawnAnimation != null) return;
  1165. // if (curAngleCeil < 30) {
  1166. // directionPunch = "straightPunch";
  1167. // name = "正向的直拳";
  1168. // ename = "front-straight";
  1169. // } else if (direction.x < 0) {
  1170. // directionPunch = "rightPunch";
  1171. // name = "正向的右拳";
  1172. // ename = "front-right";
  1173. // } else if (direction.x > 0) {
  1174. // directionPunch = "leftPunch";
  1175. // name = "正向的左拳";
  1176. // ename = "front-left";
  1177. // }
  1178. if (gameData.direction == "straightPunch") {
  1179. this.eliminateJumpPrefab(0);
  1180. } else if (gameData.direction == "leftPunch") {
  1181. this.eliminateJumpPrefab(1);
  1182. } else if (gameData.direction == "rightPunch") {
  1183. this.eliminateJumpPrefab(2);
  1184. }
  1185. this.BLEAccIndex++;
  1186. },
  1187. onClearData() {
  1188. this.BLEAccIndex = 0;
  1189. },
  1190. onChangeY() {
  1191. this.isY = true;
  1192. },
  1193. onChangeX() {
  1194. this.isY = false;
  1195. },
  1196. onGetActionJumpPlayView(callback) {
  1197. let view = uni.createSelectorQuery().select('#ActionJumpPlay');
  1198. view.boundingClientRect(data => {
  1199. if (callback)
  1200. callback(data);
  1201. }).exec();
  1202. },
  1203. onTipLevel() {
  1204. this.$emit("tipLevel", {
  1205. hiddenType: 'normal'
  1206. });
  1207. console.log("**************22");
  1208. }
  1209. }
  1210. }
  1211. </script>
  1212. <style lang="scss">
  1213. .mid-absolute {
  1214. position: absolute;
  1215. top: 0;
  1216. bottom: 0;
  1217. right: 0;
  1218. left: 0;
  1219. margin: auto;
  1220. }
  1221. .action-jump-timer {
  1222. position: absolute;
  1223. top: -150rpx;
  1224. }
  1225. .grid-progress-vertical-container {
  1226. min-height: 376rpx;
  1227. }
  1228. .grid-progress-vertical-bar {
  1229. max-height: 376rpx;
  1230. }
  1231. .grid-progress-vertical-child {
  1232. width: 35px;
  1233. height: 7.36px;
  1234. margin: 7.36px 0 0 0;
  1235. position: relative;
  1236. }
  1237. .grid-progress-vertical-active {
  1238. width: 28rpx;
  1239. }
  1240. .grid-progress-vertical-inactive {
  1241. width: 28rpx;
  1242. }
  1243. .sprite-yellow-arrow {
  1244. display: inline-block;
  1245. overflow: hidden;
  1246. background-repeat: no-repeat;
  1247. width: 194px;
  1248. height: 232px;
  1249. background-image: url('@/static/modal/action-jump/yellow-arrow.png');
  1250. // border: 1rpx solid #00CE47;
  1251. }
  1252. .animation-play-state-play {
  1253. animation: yellowArrowRun 1s steps(1, end); // infinite
  1254. animation-play-state: running;
  1255. }
  1256. .animation-play-state-paused {
  1257. animation-play-state: paused;
  1258. }
  1259. /**
  1260. * 箭头动画
  1261. */
  1262. @keyframes yellowArrowRun {
  1263. 0% {
  1264. background-position: -0px -0px;
  1265. }
  1266. 5% {
  1267. background-position: -0px -0px;
  1268. }
  1269. 10% {
  1270. background-position: -194px -0px;
  1271. }
  1272. 15% {
  1273. background-position: -388px -0px;
  1274. }
  1275. 20% {
  1276. background-position: -582px -0px;
  1277. }
  1278. 25% {
  1279. background-position: -776px -0px;
  1280. }
  1281. 30% {
  1282. background-position: -0px -232px;
  1283. }
  1284. 35% {
  1285. background-position: -194px -232px;
  1286. }
  1287. 40% {
  1288. background-position: -388px -232px;
  1289. }
  1290. 45% {
  1291. background-position: -582px -232px;
  1292. }
  1293. 50% {
  1294. background-position: -776px -232px;
  1295. }
  1296. 55% {
  1297. background-position: -0px -464px;
  1298. }
  1299. 60% {
  1300. background-position: -194px -464px;
  1301. }
  1302. 65% {
  1303. background-position: -388px -464px;
  1304. }
  1305. 70% {
  1306. background-position: -582px -464px;
  1307. }
  1308. 75% {
  1309. background-position: -776px -464px;
  1310. }
  1311. 80% {
  1312. background-position: -0px -696px;
  1313. }
  1314. 85% {
  1315. background-position: -194px -696px;
  1316. }
  1317. 90% {
  1318. background-position: -388px -696px;
  1319. }
  1320. 95% {
  1321. background-position: -582px -696px;
  1322. }
  1323. 100% {
  1324. background-position: -776px -696px;
  1325. }
  1326. }
  1327. .sprite-rightToLeftArrow {
  1328. display: inline-block;
  1329. overflow: hidden;
  1330. background-repeat: no-repeat;
  1331. width: 317px;
  1332. height: 42px;
  1333. background-image: url('@/static/modal/action-jump/rightToLeftArrow.png');
  1334. // border: 1rpx solid #00CE47;
  1335. }
  1336. .sprite-rightToLeftArrow-play {
  1337. animation: rightToLeftArrowRun 1s steps(1, end) infinite;
  1338. }
  1339. @keyframes rightToLeftArrowRun {
  1340. 0% {
  1341. background-position: -0px -0px;
  1342. }
  1343. 3.33% {
  1344. background-position: -0px -0px;
  1345. }
  1346. 6.66% {
  1347. background-position: -317px -0px;
  1348. }
  1349. 9.99% {
  1350. background-position: -0px -42px;
  1351. }
  1352. 13.33% {
  1353. background-position: -317px -42px;
  1354. }
  1355. 16.66% {
  1356. background-position: -0px -84px;
  1357. }
  1358. 19.99% {
  1359. background-position: -317px -84px;
  1360. }
  1361. 23.33% {
  1362. background-position: -0px -126px;
  1363. }
  1364. 26.66% {
  1365. background-position: -317px -126px;
  1366. }
  1367. 29.99% {
  1368. background-position: -0px -168px;
  1369. }
  1370. 33.33% {
  1371. background-position: -317px -168px;
  1372. }
  1373. 36.66% {
  1374. background-position: -0px -210px;
  1375. }
  1376. 39.99% {
  1377. background-position: -317px -210px;
  1378. }
  1379. 43.33% {
  1380. background-position: -0px -252px;
  1381. }
  1382. 46.66% {
  1383. background-position: -317px -252px;
  1384. }
  1385. 49.99% {
  1386. background-position: -0px -294px;
  1387. }
  1388. 53.33% {
  1389. background-position: -317px -294px;
  1390. }
  1391. 56.66% {
  1392. background-position: -0px -336px;
  1393. }
  1394. 59.99% {
  1395. background-position: -317px -336px;
  1396. }
  1397. 63.33% {
  1398. background-position: -0px -378px;
  1399. }
  1400. 66.66% {
  1401. background-position: -317px -378px;
  1402. }
  1403. 69.99% {
  1404. background-position: -0px -420px;
  1405. }
  1406. 73.33% {
  1407. background-position: -317px -420px;
  1408. }
  1409. 76.66% {
  1410. background-position: -0px -462px;
  1411. }
  1412. 79.99% {
  1413. background-position: -317px -462px;
  1414. }
  1415. 83.33% {
  1416. background-position: -0px -504px;
  1417. }
  1418. 86.66% {
  1419. background-position: -317px -504px;
  1420. }
  1421. 89.99% {
  1422. background-position: -0px -546px;
  1423. }
  1424. 93.33% {
  1425. background-position: -317px -546px;
  1426. }
  1427. 96.66% {
  1428. background-position: -0px -588px;
  1429. }
  1430. 100% {
  1431. background-position: -317px -588px;
  1432. }
  1433. }
  1434. </style>