action-jump.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315
  1. <template>
  2. <view style="width: 750rpx;">
  3. <view class="flex justify-center" style="margin-top: 32rpx;">
  4. <!-- 目前格子数量不代表数字,显示完成度而已 -460rpx;-->
  5. <view class="grid-progress-vertical-container" style="top:-520rpx; ">
  6. <view class="grid-progress-vertical-bar">
  7. <view class="grid-progress-vertical-child" v-for="(item, index) in maxShowCount +1" :key="index"
  8. v-if="index!==0">
  9. <view
  10. :class="showCurCount>=index? 'grid-progress-vertical-active':'grid-progress-vertical-inactive'">
  11. </view>
  12. <view :class="(index%5 == 0||index == 1)?'':'grid-progress-text-hidden'"
  13. class="grid-progress-vertical-text">
  14. {{Math.floor(taskSignCount / 40 * index)}}
  15. </view>
  16. </view>
  17. </view>
  18. <view class="grid-progress-vertical-bar">
  19. <view class="grid-progress-vertical-child" v-for="(item, index) in maxShowCount +1" :key="index"
  20. v-if="index!==0">
  21. <view :class="(index%5 == 0||index == 1)?'':'grid-progress-text-hidden'"
  22. class="grid-progress-vertical-text">
  23. {{Math.floor(taskSignCount / 40 * index)+taskSignCount/2}}
  24. </view>
  25. <view
  26. :class="showCurCount>=index+20? 'grid-progress-vertical-active':'grid-progress-vertical-inactive'">
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="flex align-center justify-center" style="font-size: 14px;">
  32. <view style="position: relative;">
  33. <image style="width: 135px;height: 75px;" src="../../../static/modal/action-jump/Fill.png"></image>
  34. <view class="mid-absolute flex flex-direction align-center justify-center text-white">
  35. <view class="flex align-center">
  36. <image style="width: 22rpx;height: 28rpx;"
  37. src="../../../static/modal/action-jump/jumpSpeed.png"></image>
  38. <view style="margin-left: 6rpx;">平均速度</view>
  39. </view>
  40. <view style="margin-top: 12rpx;">{{jumpSpeed}}</view>
  41. </view>
  42. </view>
  43. <view id="ActionJumpPlay" class="flex" style="position: relative;" @click="onControllerPlay">
  44. <image style="width: 110px;height: 110px;" src="../../../static/modal/action-jump/midButton.png">
  45. </image>
  46. <image v-if="!bJumpPlay" class="mid-absolute" style=" width: 28rpx;height: 28rpx;"
  47. src="../../../static/modal/action-jump/midPlay.png">
  48. </image>
  49. <image v-else class="mid-absolute" style="width: 28rpx;height: 28rpx;"
  50. src="../../../static/modal/action-jump/midPause.png">
  51. </image>
  52. </view>
  53. <view style="position: relative;">
  54. <image style="width: 135px;height: 75px; transform: scaleX(-1);"
  55. src="../../../static/modal/action-jump/Fill.png"></image>
  56. <view class="mid-absolute flex flex-direction align-center justify-center text-white">
  57. <view class="flex align-center">
  58. <image style="width: 22rpx;height: 28rpx;"
  59. src="../../../static/modal/action-jump/jumpCalorie.png"></image>
  60. <view style="margin-left: 6rpx;">卡路里</view>
  61. </view>
  62. <view style="margin-top: 12rpx;">{{jumpCalorie}}</view>
  63. </view>
  64. </view>
  65. </view>
  66. <!-- <view class="flex justify-center align-center" style="height: 100rpx; width: 444rpx; ">
  67. <view v-if="bTipLevel" class="cu-btn make-text-bPurple text-16px text-bold"
  68. style="width: 272rpx;height:80rpx;border-radius: 10px;" @click="onTipLevel">选择关卡</view>
  69. <view v-else class="text-12px text-white text-center">
  70. {{taskDescribe}}
  71. </view>
  72. </view> -->
  73. </view>
  74. <view class="position-relative">
  75. <canvas canvas-id="actionJumpCanvas" :style="{ width: canvasW + 'px', height: canvasH + 'px' }"></canvas>
  76. <canvas class="position-absolute-center" canvas-id="effectCanvas"
  77. :style="{ width: canvasW + 'px', height: '164px' }"></canvas>
  78. </view>
  79. <view class="flex align-center justify-center" style="width: 750rpx;">
  80. <view class="flex justify-center align-center" style="height: 120rpx; width: 444rpx; ">
  81. <view class="text-12px text-white text-center">
  82. {{taskDescribe}}
  83. </view>
  84. </view>
  85. </view>
  86. <!-- <view style="height: 41px;"></view> -->
  87. <!-- 测试按钮 -->
  88. <!-- <view style="display: flex;justify-content: space-between;">
  89. <view>{{isY?'Y':'X'}}</view>
  90. <button @click="onChangeY">Y为旋转轴</button>
  91. <button @click="onChangeX">X为旋转轴</button>
  92. </view> -->
  93. <!-- <view style="display: flex;justify-content: space-between;" class="margin-top margin-bottom">
  94. <button @click="onJumpType(0)">jump</button>
  95. <button @click="onJumpType(1)">left</button>
  96. <button @click="onJumpType(2)">right</button>
  97. <button @click="onJumpType(3)">rLeft</button>
  98. <button @click="onJumpType(4)">rRight</button>
  99. </view> -->
  100. <!-- <view style="display: flex;justify-content: space-around; padding-bottom: 100rpx;">
  101. <view style="font-size: 14px;">t:{{countdown}}</view>
  102. <view style="font-size: 14px;">e:{{eliminationCount}}</view>
  103. <view style="font-size: 14px;">f:{{faultCount}}</view>
  104. </view> -->
  105. </view>
  106. </template>
  107. <script>
  108. import ActionJump from "@/util/util-js/action/jump-0.1.js"
  109. import {
  110. CONDITIONPASSED
  111. } from "@/util/util-js/enum.js"
  112. import Firework from "@/util/util-js/effect/firework.js"
  113. import {
  114. mapState,
  115. mapMutations
  116. } from 'vuex';
  117. export default {
  118. computed: mapState(['systemInfo']),
  119. components: {
  120. },
  121. props: {
  122. showTime: {
  123. type: Number,
  124. default: 0
  125. },
  126. levelData: {
  127. type: Object,
  128. default: null
  129. },
  130. currentMode: {
  131. type: String,
  132. default: ''
  133. }
  134. },
  135. data() {
  136. return {
  137. isY: true,
  138. canvasW: 0, // 画布宽
  139. canvasH: 0, // 画布高
  140. // SystemInfo: {}, // 设备信息
  141. directionJump: null,
  142. midJump: null,
  143. rotateJump: null,
  144. directionJumpWhite: null,
  145. midJumpWhite: null,
  146. rotateJumpWhite: null,
  147. //参考图片
  148. cankao: null,
  149. jumpTipImage: null,
  150. jumpNormalImage: null,
  151. jumpTypeArray: [{
  152. jumpName: 'NORMAL',
  153. jumpCode: 0,
  154. icon: 'midJump',
  155. scaleX: 1,
  156. bTrigger: false,
  157. }, {
  158. jumpName: 'LEFT',
  159. jumpCode: 1,
  160. icon: 'directionJump',
  161. scaleX: -1,
  162. bTrigger: false,
  163. }, {
  164. jumpName: 'RIGHT',
  165. jumpCode: 2,
  166. icon: 'directionJump',
  167. scaleX: 1,
  168. bTrigger: false,
  169. }, {
  170. jumpName: 'LEFT_ROTATE',
  171. jumpCode: 3,
  172. icon: 'rotateJump',
  173. scaleX: -1,
  174. bTrigger: false,
  175. }, {
  176. jumpName: 'RIGHT_ROTATE',
  177. jumpCode: 4,
  178. icon: 'rotateJump',
  179. scaleX: 1,
  180. bTrigger: false,
  181. }],
  182. spawnArray: [],
  183. //下一个生成是相反的方向
  184. bNextSpawnRightDirection: false,
  185. bNextSpawnRightRotateDirection: false,
  186. //生成预制的模板,用count 来判断生成哪一种
  187. template: [{ //原地
  188. count: 1,
  189. spawnList: [
  190. [0]
  191. ]
  192. }, {
  193. count: 2,
  194. spawnList: [
  195. [2, 1],
  196. [1, 2],
  197. [3, 4],
  198. [4, 3]
  199. ]
  200. }, {
  201. count: 3,
  202. spawnList: [
  203. [2, 0, 1],
  204. [1, 0, 2],
  205. [3, 0, 4],
  206. [4, 0, 3]
  207. ]
  208. }, ],
  209. level: 3,
  210. levelType: 0,
  211. countdown: 60,
  212. countdownInterval: null,
  213. faultCount: 0,
  214. eliminationCount: 0,
  215. bJumpPlay: false,
  216. jumpCalorie: 1000,
  217. jumpSpeed: 1000,
  218. //硬件设备处理
  219. BLEAccIndex: 0,
  220. bJump: false,
  221. xA: 0,
  222. yA: 0,
  223. zA: 0,
  224. actionJumpObj: null,
  225. /**
  226. * 交互数据处理
  227. */
  228. //当前选择的关卡信息
  229. selfLevelData: null,
  230. // 双人模式下 数据
  231. //标记块数量
  232. taskSignCount: 0, //总数
  233. taskSignCurCount: 0, //当前计数
  234. //{"type":1,"explain":"规定时间内跳完所有标志块","limitType":1}
  235. taskConditionPassed: null,
  236. taskDescribe: '',
  237. //满格的数值是 25
  238. maxShowCount: 20,
  239. addShowCountUnit: 0,
  240. showCurCount: 0,
  241. roundingCount: 0,
  242. //游戏结束
  243. isGameOver: false,
  244. //pk模式下操作
  245. leftShowCurCount: 0,
  246. rightShowCurCount: 0,
  247. isleftPlayer: true,
  248. /**
  249. * 是否允许绘制
  250. */
  251. canOnDraw: false,
  252. /**
  253. * 是否去到下一个关卡
  254. */
  255. canGoNext: false,
  256. onLogData: '',
  257. /**
  258. * 是否显示关卡提示
  259. */
  260. bTipLevel: false,
  261. /**
  262. * 烟花相关
  263. */
  264. // firework collection
  265. fireworks: [],
  266. fireworkImage: null,
  267. loop: null,
  268. count: 100,
  269. effectCanvas: null,
  270. effectCurrentSpawn: null,
  271. effectSpawnPosX: 0,
  272. /**
  273. * 管理三个绘制
  274. */
  275. bDrawBg: false,
  276. bDrawJump: false,
  277. bKeepBg: false,
  278. bKeepType: '',
  279. bDrawBoomEffect: false
  280. }
  281. },
  282. watch: {
  283. levelData(val) {
  284. //更新数据
  285. // console.log("levelData ============>", JSON.stringify(val));
  286. if (val) {
  287. this.taskSignCount = val.signCount;
  288. this.taskConditionPassed = val.conditionPassed;
  289. this.taskDescribe = val.describe;
  290. this.addShowCountUnit = (this.maxShowCount * 2) / this.taskSignCount;
  291. // console.log("this.addShowCountUnit:", this.addShowCountUnit, this.maxShowCount * 2, this
  292. // .taskSignCount);
  293. this.showCount = 0;
  294. //用signType 做等级类型
  295. this.levelType = val.signType;
  296. console.log(JSON.stringify(this.taskConditionPassed));
  297. }
  298. },
  299. currentMode(val) {
  300. console.log('==========> action jump currentMode:', val);
  301. }
  302. },
  303. created() {
  304. let _self = this;
  305. this.actionJumpCanvas = uni.createCanvasContext("actionJumpCanvas", this);
  306. this.effectCanvas = uni.createCanvasContext("effectCanvas", this);
  307. // this.SystemInfo = this.systemInfo; // uni.getSystemInfoSync();
  308. this.canvasW = this.systemInfo.windowWidth; // 画布宽度
  309. this.canvasH = 114;
  310. this.onLoadImage();
  311. setTimeout(() => {
  312. this.onListenActionJump();
  313. }, 2000)
  314. //更新一次状态
  315. const value = uni.getStorageSync('levelButtonPrompt');
  316. if (value) {
  317. _self.bTipLevel = !value.isSelected;
  318. } else {
  319. _self.bTipLevel = true;
  320. }
  321. // console.log('==========>levelButtonPrompt:', _self.bTipLevel);
  322. },
  323. methods: {
  324. ...mapMutations(['onWriteBLEConnectionValue', 'onConvertDeviceData']),
  325. //更新新手状态提示
  326. onUpdateTipLevelValue(value) {
  327. this.bTipLevel = value;
  328. },
  329. onListenActionJump() {
  330. let _self = this;
  331. console.log("*****************onListenActionJump*****************************");
  332. _self.actionJumpObj = new ActionJump();
  333. _self.actionJumpObj.addEventListener('resultant', (e) => {
  334. if (e.type == 'jump') {
  335. // this.jumpCount++;
  336. this.bJump = true;
  337. } else if (e.type == 'stateDataOfJump') {
  338. //发送给game,在game里面处理判断
  339. this.listenStateDataOfJump(e);
  340. } else if (e.type == 'stop') {
  341. this.onClearData();
  342. this.actionJumpObj.resetAll();
  343. if (this.canOnDraw) {
  344. this.canOnDraw = false;
  345. this.onDraw("tipHit");
  346. }
  347. if (this.canGoNext) {
  348. this.canGoNext = false;
  349. this.startJumpGame();
  350. }
  351. // console.log('stop');
  352. //这里处理生成下一个
  353. }
  354. })
  355. },
  356. //load 相关图片
  357. onLoadImage() {
  358. let _self = this;
  359. uni.getImageInfo({
  360. src: "../../../static/modal/action-jump/directionJump.png",
  361. success: function(image) {
  362. _self.directionJump = image;
  363. }
  364. });
  365. uni.getImageInfo({
  366. src: "../../../static/modal/action-jump/midJump.png",
  367. success: function(image) {
  368. _self.midJump = image;
  369. }
  370. });
  371. uni.getImageInfo({
  372. src: "../../../static/modal/action-jump/rotateJump.png",
  373. success: function(image) {
  374. _self.rotateJump = image;
  375. }
  376. });
  377. uni.getImageInfo({
  378. src: "../../../static/modal/action-jump/directionJumpWhite.png",
  379. success: function(image) {
  380. _self.directionJumpWhite = image;
  381. }
  382. });
  383. uni.getImageInfo({
  384. src: "../../../static/modal/action-jump/midJumpWhite.png",
  385. success: function(image) {
  386. _self.midJumpWhite = image;
  387. }
  388. });
  389. uni.getImageInfo({
  390. src: "../../../static/modal/action-jump/rotateJumpWhite.png",
  391. success: function(image) {
  392. _self.rotateJumpWhite = image;
  393. }
  394. });
  395. uni.getImageInfo({
  396. src: "../../../static/modal/action-jump/jumpTip.png",
  397. success: function(image) {
  398. _self.jumpTipImage = image;
  399. }
  400. });
  401. uni.getImageInfo({
  402. src: "../../../static/modal/action-jump/jumpNormal.png",
  403. success: function(image) {
  404. _self.jumpNormalImage = image;
  405. _self.onDrawBg();
  406. }
  407. });
  408. uni.getImageInfo({
  409. src: "../../../static/modal/action-jump/cankao.png",
  410. success: function(image) {
  411. _self.cankao = image;
  412. }
  413. });
  414. /**
  415. * 烟花照片
  416. */
  417. uni.getImageInfo({
  418. src: "../../../static/modal/action-jump/boom.png",
  419. success: function(image) {
  420. _self.fireworkImage = image;
  421. }
  422. });
  423. },
  424. /**
  425. * 重置生成数组,重置倒计时
  426. */
  427. resetJumpGame() {
  428. this.spawnArray = [];
  429. if (this.countdownInterval) {
  430. clearInterval(this.countdownInterval);
  431. this.countdownInterval = null;
  432. }
  433. // this.resetCountdown(60);
  434. },
  435. startJumpGame() {
  436. this.isGameOver = false;
  437. this.resetJumpGame();
  438. //开始游戏
  439. this.index = 0;
  440. // this.levelLabel.string = '关卡' + this.level;
  441. let _ranType = Math.floor(Math.random() * 2);
  442. if (this.levelType == 0) {
  443. //随便生成一组跳的数据
  444. let _spawnList = this.template[0].spawnList;
  445. for (let i = 0; i < 4; i++) {
  446. this.spawnJumpPrefabsFromType(i, _spawnList[0][0]);
  447. }
  448. } else if (this.levelType == 1) {
  449. //生成一组 左跳右跳
  450. let _spawnList = this.template[1].spawnList;
  451. let ran = Math.floor(Math.random() * 2);
  452. // if (_ranType >= 1) ran += 2;
  453. for (let i = 0; i < _spawnList[ran].length; i++) {
  454. this.spawnJumpPrefabsFromType(i, _spawnList[ran][i]);
  455. }
  456. } else if (this.levelType == 2) {
  457. //生成一组 左跳右跳原地
  458. let _spawnList = this.template[2].spawnList;
  459. let ran = Math.floor(Math.random() * 2);
  460. // if (_ranType >= 1) ran += 2;
  461. for (let i = 0; i < _spawnList[ran].length; i++) {
  462. this.spawnJumpPrefabsFromType(i, _spawnList[ran][i]);
  463. }
  464. } else if (this.levelType == 3) {
  465. //生成一组 左旋跳右旋跳
  466. let _spawnList = this.template[1].spawnList;
  467. let ran = Math.floor(Math.random() * 2) + 2;
  468. for (let i = 0; i < _spawnList[ran].length; i++) {
  469. this.spawnJumpPrefabsFromType(i, _spawnList[ran][i]);
  470. }
  471. } else if (this.levelType == 4) {
  472. //生成一组 左旋跳右旋跳
  473. let _spawnList = this.template[2].spawnList;
  474. let ran = Math.floor(Math.random() * 2) + 2;
  475. for (let i = 0; i < _spawnList[ran].length; i++) {
  476. this.spawnJumpPrefabsFromType(i, _spawnList[ran][i]);
  477. }
  478. } else if (this.levelType == 5) {
  479. //随便生成三组数据
  480. let _newArray = [];
  481. // let _spawnList1 = this.template[1].spawnList;
  482. // let ran1 = Math.floor(Math.random() * 2);
  483. // _newArray = _newArray.concat(_spawnList1[ran1]);
  484. let _spawnList2 = this.template[2].spawnList;
  485. let ran2 = Math.floor(Math.random() * 2);
  486. let ran3 = Math.floor(Math.random() * 2);
  487. if (_ranType >= 1) {
  488. ran2 += 2;
  489. ran3 += 2;
  490. }
  491. _newArray = _newArray.concat(_spawnList2[ran2]);
  492. _newArray = _newArray.concat(_spawnList2[ran3]);
  493. for (let i = 0; i < _newArray.length; i++) {
  494. this.spawnJumpPrefabsFromType(i, _newArray[i]);
  495. }
  496. //todo 暂时给循环
  497. this.level = 0;
  498. }
  499. // if (this.level == 2) {
  500. // //随便生成二组数据
  501. // let _newArray = [];
  502. // let _spawnList1 = this.template[1].spawnList;
  503. // let ran1 = Math.floor(Math.random() * 2);
  504. // _newArray = _newArray.concat(_spawnList1[ran1]);
  505. // let _spawnList2 = this.template[2].spawnList;
  506. // let ran2 = Math.floor(Math.random() * 2);
  507. // if (_ranType >= 1) ran2 += 2;
  508. // _newArray = _newArray.concat(_spawnList2[ran2]);
  509. // // console.log(_newArray);
  510. // for (let i = 0; i < _newArray.length; i++) {
  511. // this.spawnJumpPrefabsFromType(i, _newArray[i]);
  512. // }
  513. // }
  514. this.level++;
  515. //倒计时
  516. // this.countdownInterval = setInterval(() => {
  517. // if (this.countdown <= 0) {
  518. // clearInterval(this.countdownInterval);
  519. // this.countdownInterval = null;
  520. // //处理下一个关卡
  521. // // console.warn('时间到,处理下一个关卡');
  522. // this.startJumpGame();
  523. // return;
  524. // }
  525. // this.setCountdown(1);
  526. // }, 1000);
  527. this.onDraw("tipHit");
  528. },
  529. spawnJumpPrefabsFromType(index, _jumpType) {
  530. //todo 生成的节点,后面再处理节奏问题。比如生成顺序
  531. for (let i = 0; i < this.jumpTypeArray.length; i++) {
  532. if (this.jumpTypeArray[i].jumpCode == _jumpType) {
  533. let _jumpPrefab = Object.assign({}, this.jumpTypeArray[i]);
  534. this.spawnArray.push(_jumpPrefab);
  535. break;
  536. }
  537. }
  538. },
  539. spawnJumpPrefabs(index) {
  540. let ran = Math.floor(Math.random() * 5);
  541. //todo 生成的节点,后面再处理节奏问题。比如生成顺序
  542. let _jumpPrefab = Object.assign({}, this.jumpTypeArray[ran]);
  543. //这里处理相反方向,比如生成了一个左旋转,下一个右旋转
  544. if (_jumpPrefab.jumpName == 'LEFT') {
  545. if (this.bNextSpawnRightDirection) {
  546. //如果是对应的需要记录一个对应的准确值
  547. this.bNextSpawnRightDirection = false;
  548. } else {
  549. ran = 2; //RIGHT;
  550. this.bNextSpawnRightDirection = true;
  551. }
  552. } else if (_jumpPrefab.jumpName == 'RIGHT') {
  553. if (this.bNextSpawnRightDirection) {
  554. ran = 1; //LEFT;
  555. this.bNextSpawnRightDirection = false;
  556. } else {
  557. this.bNextSpawnRightDirection = true;
  558. }
  559. }
  560. if (_jumpPrefab.jumpName == 'LEFT_ROTATE') {
  561. if (this.bNextSpawnRightRotateDirection) {
  562. //如果是对应的需要记录一个对应的准确值
  563. this.bNextSpawnRightRotateDirection = false;
  564. } else {
  565. ran = 4; //RIGHT_ROTATE;
  566. this.bNextSpawnRightRotateDirection = true;
  567. }
  568. // console.log('l==rotate', ran);
  569. } else if (_jumpPrefab.jumpName == 'RIGHT_ROTATE') {
  570. if (this.bNextSpawnRightRotateDirection) {
  571. ran = 3; //LEFT_ROTATE;
  572. this.bNextSpawnRightRotateDirection = false;
  573. } else {
  574. //如果是对应的需要记录一个对应的准确值
  575. this.bNextSpawnRightRotateDirection = true;
  576. }
  577. }
  578. this.spawnArray.push(_jumpPrefab);
  579. },
  580. //单纯的绘制八个背景
  581. onDrawBg() {
  582. this.bDrawBg = true;
  583. this.bKeepBg = true;
  584. this.actionJumpCanvas.clearRect(0, 0, this.canvasW, this.canvasH);
  585. let _currentBgStartX = this.canvasW / 2;
  586. let count = 4;
  587. for (let i = 0; i < count; i++) {
  588. let _currentStartPos = _currentBgStartX - i * 50 - 50;
  589. this.actionJumpCanvas.drawImage(this.jumpNormalImage.path, _currentStartPos, 0, 50,
  590. 114);
  591. let _currentEndPos = _currentBgStartX + i * 50;
  592. this.actionJumpCanvas.drawImage(this.jumpNormalImage.path, _currentEndPos, 0, 50, 114);
  593. }
  594. this.actionJumpCanvas.draw();
  595. },
  596. onDraw(type) {
  597. this.bDrawJump = true;
  598. this.bKeepBg = false;
  599. this.bKeepType = type;
  600. this.actionJumpCanvas.clearRect(0, 0, this.canvasW, 114);
  601. //计算一个对象
  602. let _drawObj = {
  603. path: null,
  604. startX: 0,
  605. width: 0,
  606. bgWidth: 0,
  607. bgStartXAllNormal: 0,
  608. bgStartXHasTip: 0,
  609. }
  610. //计算居中的点
  611. _drawObj.width = this.spawnArray.length * (50 + 10);
  612. _drawObj.startX = this.canvasW / 2 - _drawObj.width / 2;
  613. //全部是普通背景
  614. _drawObj.bgStartXAllNormal = this.canvasW / 2 - (this.spawnArray.length * 50) / 2;
  615. _drawObj.bgStartXHasTip = this.canvasW / 2 - (this.spawnArray.length * 50 + 40) / 2;
  616. let _currentBgStartX = this.index == this.spawnArray.length || type == "normal" ? _drawObj
  617. .bgStartXAllNormal : _drawObj
  618. .bgStartXHasTip;
  619. // console.log("_drawObj.startX:", _drawObj.startX, _drawObj.width / 2);
  620. //绘制八个位置。如果生成数量不够的话。补上对应的数量
  621. let count = 8 - this.spawnArray.length;
  622. count = Math.ceil(count / 2);
  623. //计算一个节点数组
  624. for (let i = 0; i < this.spawnArray.length; i++) {
  625. //默认 mid 图标
  626. let _temp = this.spawnArray[i].bTrigger ? this.midJump : this.midJumpWhite;
  627. if (this.spawnArray[i].icon == 'directionJump') {
  628. _temp = this.spawnArray[i].bTrigger ? this.directionJump : this.directionJumpWhite;
  629. } else if (this.spawnArray[i].icon == 'rotateJump') {
  630. _temp = this.spawnArray[i].bTrigger ? this.rotateJump : this.rotateJumpWhite;
  631. }
  632. //如果是相反绘制,需要加多一个自身位置偏移
  633. let _pos = this.spawnArray[i].scaleX < 0 ? i + 1 : i;
  634. let _spacing = i == 0 ? 0 : 1;
  635. let _addData = 0;
  636. //大图提示后面要加上大图占的位置,为大图宽度减小图( 90 - 50 )
  637. if (i >= this.index && type !== "normal") {
  638. _addData = 40;
  639. }
  640. if (i == 0) {
  641. //_frontBgData 为减去大图位置,10 为偏移位置
  642. let _frontBgData = 40;
  643. //绘制前背景
  644. for (let i = 0; i < count; i++) {
  645. let _currentStartPos = _currentBgStartX - _frontBgData - i * 50 - 10;
  646. this.actionJumpCanvas.drawImage(this.jumpNormalImage.path, _currentStartPos, 0,
  647. 50, 114)
  648. }
  649. }
  650. this.actionJumpCanvas.save();
  651. this.actionJumpCanvas.globalAlpha = this.spawnArray[i].bTrigger ? 0.7 : 1;
  652. this.actionJumpCanvas.scale(this.spawnArray[i].scaleX, 1);
  653. let _currentPos = 0;
  654. let _currentCenterPos = 0;
  655. if (i == this.index && type !== "normal") {
  656. _currentPos = (_currentBgStartX + _pos * 90 - i * 40) *
  657. this
  658. .spawnArray[i]
  659. .scaleX;
  660. this.actionJumpCanvas.drawImage(this.jumpTipImage.path, _currentPos, 0, 90, 114);
  661. //计算对应中心点的值
  662. _currentCenterPos = _currentPos + 90 / 2 - 25 / 2;
  663. //57 - 40/2 是取画布中心y点,减去图标本身高的一半的值
  664. this.actionJumpCanvas.drawImage(_temp.path, _currentCenterPos - 7.5, 37, 40, 40);
  665. //这里记录一个生成点,后面用于生成特效
  666. this.effectSpawnPosX = _currentCenterPos - 8;
  667. } else {
  668. _currentPos = (_currentBgStartX + _addData + _pos *
  669. 50) * this
  670. .spawnArray[i]
  671. .scaleX;
  672. this.actionJumpCanvas.drawImage(this.jumpNormalImage.path, _currentPos, 0, 50, 114)
  673. //计算对应中心点的值
  674. _currentCenterPos = _currentPos + 50 / 2 - 25 / 2;
  675. //44.5 是取画布中心y点,减去图标本身高的一半的值
  676. this.actionJumpCanvas.drawImage(_temp.path, _currentCenterPos, 44.5, 25, 25);
  677. }
  678. this.actionJumpCanvas.restore();
  679. if (i == this.spawnArray.length - 1) {
  680. //绘制结束位置
  681. // console.log("count:", count);
  682. for (let i = 0; i < count; i++) {
  683. let _currentEndPos = _currentBgStartX + _addData + (this.spawnArray.length +
  684. i) * 50;
  685. // console.log("end _currentEndPos:", _currentEndPos);
  686. this.actionJumpCanvas.drawImage(this.jumpNormalImage.path, _currentEndPos, 0,
  687. 50, 114)
  688. }
  689. }
  690. }
  691. this.actionJumpCanvas.draw();
  692. },
  693. onDrawEffect(_temp) {
  694. //根据当前消除的生成一个
  695. // console.log("生成的_temp:" + JSON.stringify(_temp));
  696. let spawnTemp = this.midJump;
  697. if (_temp.icon == 'directionJump') {
  698. spawnTemp = this.directionJump;
  699. } else if (_temp.icon == 'rotateJump') {
  700. spawnTemp = this.rotateJump;
  701. }
  702. let tempFirework = new Firework(this.fireworkImage,
  703. spawnTemp, _temp.scaleX, this.effectSpawnPosX, 0, this.canvasW, 164);
  704. this.fireworks.push(tempFirework);
  705. this.bDrawBoomEffect = true;
  706. this.onInitFirework();
  707. },
  708. onClear() {
  709. this.resetJumpGame();
  710. this.onDrawBg();
  711. this.xA = 0;
  712. this.yA = 0;
  713. this.zA = 0;
  714. this.bJump = false;
  715. this.actionJumpObj.resetAll();
  716. },
  717. /**
  718. * 统一绘制 效果 背景,交互,烟花
  719. */
  720. onInitFirework() {
  721. if (this.loop != null) {
  722. return;
  723. }
  724. this.loop = setInterval(() => {
  725. if (!this.bDrawBoomEffect) {
  726. clearInterval(this.loop);
  727. this.loop = null;
  728. // console.log("结束绘制");
  729. this.effectCanvas.clearRect(0, 0, this.canvasW, 164);
  730. this.effectCanvas.draw();
  731. return;
  732. }
  733. this.effectCanvas.clearRect(0, 0, this.canvasW, 164);
  734. if (this.bDrawBoomEffect) {
  735. // loop over each firework, draw it, update it
  736. var i = this.fireworks.length;
  737. while (i--) {
  738. this.fireworks[i].draw(this.effectCanvas, () => {
  739. this.fireworks.splice(i, 1);
  740. if (this.fireworks.length == 0) {
  741. this.bDrawBoomEffect = false;
  742. }
  743. });
  744. }
  745. }
  746. this.effectCanvas.draw();
  747. }, 30)
  748. },
  749. onJumpType(event) {
  750. // console.log("onJumpType:", event);
  751. if (this.isGameOver || !this.bJumpPlay) return;
  752. this.eliminateJumpPrefab(event);
  753. },
  754. // update (dt) {}
  755. //模拟测试调用
  756. eliminateJumpPrefab(_jumpType) {
  757. let _temp = this.spawnArray[this.index];
  758. // let _temp = this.jumpTypeArray[Math.floor(Math.random()*4) ];
  759. //这里更新特效
  760. // this.onDrawEffect(_temp);
  761. // return;
  762. //如果当前的跳类型和预制目标一样
  763. if (_jumpType == _temp.jumpCode) {
  764. _temp.bTrigger = true;
  765. this.index++;
  766. //这里更新特效
  767. let _endTemp = Object.assign({}, _temp);
  768. this.onDrawEffect(_endTemp);
  769. if (this.index >= this.spawnArray.length) {
  770. clearInterval(this.countdownInterval);
  771. this.countdownInterval = null;
  772. this.startJumpGame();
  773. } else {
  774. //绘制新触发状态
  775. this.onDraw('tipHit');
  776. }
  777. //成功
  778. this.setEliminationCount(1);
  779. } else {
  780. //失误
  781. this.setFaultCount(1);
  782. }
  783. },
  784. //设置倒计时
  785. setCountdown(value) {
  786. this.countdown -= value;
  787. // this.countdownLabel.string = '倒计时:' + this.countdown;
  788. this.$emit('actionJumpCountDownUpdate', {
  789. countDown: this.countdown
  790. });
  791. },
  792. resetCountdown(value) {
  793. this.countdown = value;
  794. // this.countdownLabel.string = '倒计时:' + this.countdown;
  795. this.$emit('actionJumpCountDownUpdate', {
  796. countDown: this.countdown
  797. });
  798. },
  799. //设置ui信息
  800. setEliminationCount(value) {
  801. this.taskSignCurCount++;
  802. this.roundingCount += this.addShowCountUnit;
  803. this.eliminationCount += value;
  804. // this.eliminationLabel.string = '消除数量:' + this.eliminationCount.toString();
  805. this.$emit('actionJumpDataUpdate', {
  806. eliminationCount: this.eliminationCount,
  807. faultCount: this.faultCount
  808. });
  809. //如果是pk模式。不走下面判断
  810. if (this.currentMode == 'pkMode') return;
  811. if (CONDITIONPASSED.ENERGYBARFULL == this.taskConditionPassed.limitType) {
  812. //能量条的条件下才显示能量条动
  813. //取两位后计算Math floor,不然会有偏差值问题 Math.floor(39.9999999+ 0.1111111) = 39
  814. this.showCurCount = Math.floor(this.roundingCount.toFixed(2));
  815. //1.能量槽满的时候,说明踩中次数到达
  816. if (this.taskSignCurCount >= this.taskSignCount)
  817. this.onGameOver("energyBarFull");
  818. } else if (CONDITIONPASSED.SKIPALLFLAGWITHINTIME == this.taskConditionPassed.limitType) {
  819. //规定时间下也给显示能量条
  820. this.showCurCount = Math.floor(this.roundingCount.toFixed(2));
  821. //2.规定时间内跳完所有标志块
  822. if (this.taskSignCurCount >= this.taskSignCount)
  823. this.onGameOver("skipAllFlagWithinTime");
  824. } else if (this.taskConditionPassed.isScore) {
  825. //3.达到一定分数
  826. //如果是用分数判断
  827. //分数是 跳对的加1分,错的扣1分,0不扣分。
  828. let curScore = this.eliminationCount - this.faultCount;
  829. curScore = curScore < 0 ? 0 : curScore;
  830. //当前分数达到,胜利
  831. if (curScore >= this.taskConditionPassed.limitScore)
  832. this.onGameOver("score");
  833. }
  834. },
  835. onGameOver(type) {
  836. this.isGameOver = true;
  837. //处理参数
  838. this.onClear();
  839. this.onClearData();
  840. this.bJumpPlay = false;
  841. /**
  842. * 判断胜利和失败
  843. */
  844. let myWin = false; //默认失败
  845. //比如, 1.充满左右两边蓄能槽.2.规定时间内跳完所有标志块.
  846. if (type == "energyBarFull") {
  847. //1.能量槽满的时候,说明踩中次数到达
  848. if (this.taskSignCurCount >= this.taskSignCount) {
  849. myWin = true;
  850. }
  851. } else if (type == 'skipAllFlagWithinTime') {
  852. myWin = true;
  853. } else if (type == "timeUp") {
  854. //2.规定时间内跳完所有标志块
  855. //查看消除数量是否到达总数,未达成就是未完成
  856. if (this.taskSignCurCount >= this.taskSignCount) {
  857. myWin = true;
  858. }
  859. } else if (type == "score") {
  860. myWin = true;
  861. }
  862. console.log(type, {
  863. myWin: myWin
  864. });
  865. this.$emit('gameOver', {
  866. myWin: myWin,
  867. type: 'calorieMode',
  868. isOffEvent: true
  869. });
  870. },
  871. //pk模式下结束游戏关卡
  872. onPKModeGameOver(type) {
  873. this.isGameOver = true;
  874. //处理参数
  875. this.onClear();
  876. this.onClearData();
  877. this.bJumpPlay = false;
  878. this.$emit('gameOver', {
  879. type: 'pkMode',
  880. isOffEvent: true
  881. });
  882. },
  883. setFaultCount(value) {
  884. this.faultCount += value;
  885. // this.faultLabel.string = '失误:' + this.faultCount;
  886. this.$emit('actionJumpDataUpdate', {
  887. eliminationCount: this.eliminationCount,
  888. faultCount: this.faultCount
  889. });
  890. },
  891. //控制播放
  892. onControllerPlay() {
  893. if (this.bJumpPlay) {
  894. //仅仅暂停,没有清空数据
  895. this._changePlay(false);
  896. this.$emit("actionJumpControllerPlay", false);
  897. } else {
  898. this.$emit("actionJumpCheck");
  899. }
  900. },
  901. onContinueGame() {
  902. this._changePlay(true);
  903. },
  904. onClearActionJumpData() {
  905. console.log("onClearActionJumpData");
  906. this.onClear();
  907. this.onClearData();
  908. },
  909. //修改状态
  910. _changePlay(bPlaying) {
  911. if (bPlaying) {
  912. this.bJumpPlay = bPlaying;
  913. } else {
  914. this.bJumpPlay = !this.bJumpPlay;
  915. }
  916. },
  917. onActionJumpPlay() {
  918. this.onClear();
  919. this.onClearData();
  920. this.startJumpGame();
  921. this._changePlay(true);
  922. //reset 对应计算数据
  923. this.taskSignCurCount = 0;
  924. this.showCurCount = 0;
  925. this.roundingCount = 0;
  926. this.faultCount = 0;
  927. this.eliminationCount = 0;
  928. },
  929. getCurrentJumpType() {
  930. let _temp = this.spawnArray[this.index];
  931. return _temp.jumpCode;
  932. },
  933. //监听跳的状态数据
  934. listenStateDataOfJump(data) {
  935. if (this.isGameOver || !this.bJumpPlay) return;
  936. let _jumpType = this.getCurrentJumpType();
  937. //初始全部默认状态
  938. let _tempState = [{
  939. jumpName: 'NORMAL',
  940. jumpCode: 0,
  941. bTrigger: true,
  942. describe: '正常跳'
  943. },
  944. {
  945. jumpName: 'LEFT',
  946. jumpCode: 1,
  947. bTrigger: false,
  948. describe: '左直跳'
  949. },
  950. {
  951. jumpName: 'RIGHT',
  952. jumpCode: 2,
  953. bTrigger: false,
  954. describe: '右直跳'
  955. },
  956. {
  957. jumpName: 'LEFT_ROTATE',
  958. jumpCode: 3,
  959. bTrigger: false,
  960. describe: '左旋转跳'
  961. },
  962. {
  963. jumpName: 'RIGHT_ROTATE',
  964. jumpCode: 4,
  965. bTrigger: false,
  966. describe: '右旋转跳'
  967. }
  968. ];
  969. let {
  970. currentMaxValue,
  971. oGyroValue,
  972. peakOfWaveMaxValue,
  973. valleyOfWaveMinValue
  974. } = data
  975. // console.log('stateDataOfJump:');
  976. // console.log(JSON.stringify(data));
  977. this.onLogData = data;
  978. let _rotateLimit = 4;
  979. let _jumpLimit = 8;
  980. switch (_jumpType) {
  981. case 0:
  982. //JumpType.NORMAL = 0
  983. _tempState[0].bTrigger = true;
  984. this.eliminateJumpPrefabFormTemp(_tempState);
  985. break;
  986. case 1:
  987. if (currentMaxValue < -_jumpLimit || valleyOfWaveMinValue < -20) {
  988. //left jump
  989. _tempState[1].bTrigger = true;
  990. }
  991. this.eliminateJumpPrefabFormTemp(_tempState);
  992. break;
  993. case 2:
  994. if (currentMaxValue > _jumpLimit || peakOfWaveMaxValue > 20) {
  995. //right jump
  996. _tempState[2].bTrigger = true;
  997. }
  998. this.eliminateJumpPrefabFormTemp(_tempState);
  999. break;
  1000. case 4:
  1001. if (oGyroValue > _rotateLimit) {
  1002. _tempState[4].bTrigger = true;
  1003. }
  1004. this.eliminateJumpPrefabFormTemp(_tempState);
  1005. break;
  1006. case 3:
  1007. if (oGyroValue < -_rotateLimit) {
  1008. _tempState[3].bTrigger = true;
  1009. }
  1010. this.eliminateJumpPrefabFormTemp(_tempState);
  1011. break;
  1012. default:
  1013. console.log('没有对应的_jumpType', _jumpType);
  1014. break;
  1015. }
  1016. // if (currentMaxValue == 0) {
  1017. // } else {
  1018. // // console.log('2====', data);
  1019. // if (this.isY) {
  1020. // //如果是检测到旋转跳
  1021. // if (oGyroValue > _rotateLimit) {
  1022. // // console.log('y right:', oGyroValue);
  1023. // _tempState[4].bTrigger = true;
  1024. // } else if (oGyroValue < -_rotateLimit) {
  1025. // // console.log('y left:', oGyroValue);
  1026. // _tempState[3].bTrigger = true;
  1027. // }
  1028. // if (valleyOfWaveMinValue < -_jumpLimit) {
  1029. // //left jump
  1030. // _tempState[1].bTrigger = true;
  1031. // } else if (peakOfWaveMaxValue > _jumpLimit) {
  1032. // //right jump
  1033. // _tempState[2].bTrigger = true;
  1034. // }
  1035. // } else {
  1036. // //如果是检测到旋转跳
  1037. // if (oGyroValue < -5) {
  1038. // // console.log('x right:', oGyroValue);
  1039. // _tempState[4].bTrigger = true;
  1040. // } else if (oGyroValue > 5) {
  1041. // // console.log('x left:', oGyroValue);
  1042. // _tempState[3].bTrigger = true;
  1043. // }
  1044. // if (valleyOfWaveMinValue < -_jumpLimit) {
  1045. // //left jump
  1046. // _tempState[1].bTrigger = true;
  1047. // } else if (peakOfWaveMaxValue > _jumpLimit) {
  1048. // //right jump
  1049. // _tempState[2].bTrigger = true;
  1050. // }
  1051. // }
  1052. // this.eliminateJumpPrefabFormTemp(_tempState);
  1053. // }
  1054. },
  1055. eliminateJumpPrefabFormTemp(_tempState) {
  1056. //如果消除完,需要重新生成
  1057. let _temp = this.spawnArray[this.index];
  1058. let bSuccess = false;
  1059. for (let i = 0; i < _tempState.length; i++) {
  1060. let _state = _tempState[i];
  1061. if (_state.bTrigger)
  1062. console.log(JSON.stringify(_state) + JSON.stringify(this.onLogData));
  1063. //如果当前的跳类型和预制目标一样
  1064. if (_state.jumpCode == _temp.jumpCode && _state.bTrigger) {
  1065. //成功
  1066. bSuccess = true;
  1067. break;
  1068. }
  1069. }
  1070. //如果存在其中一个为true
  1071. if (bSuccess) {
  1072. // console.log("bSuccess:", bSuccess);
  1073. _temp.bTrigger = true;
  1074. this.index++;
  1075. //这里更新特效
  1076. this.onDrawEffect(_temp);
  1077. if (this.index >= this.spawnArray.length) {
  1078. clearInterval(this.countdownInterval);
  1079. this.countdownInterval = null;
  1080. this.canGoNext = true;
  1081. this.onDraw("normal");
  1082. } else {
  1083. //绘制新触发状态
  1084. this.canOnDraw = true;
  1085. this.onDraw("normal");
  1086. }
  1087. //成功
  1088. this.setEliminationCount(1);
  1089. } else {
  1090. //失误
  1091. this.setFaultCount(1);
  1092. }
  1093. },
  1094. /**
  1095. * @param {Object} gameData
  1096. * 识别跳部分数据处理
  1097. */
  1098. onBLERopeUpdate(gameData) {
  1099. if (!this.bJumpPlay || this.isGameOver) return;
  1100. //********陀螺仪角速度********
  1101. let {
  1102. gx,
  1103. gy,
  1104. gz
  1105. } = gameData.gyro;
  1106. let {
  1107. min,
  1108. s,
  1109. ms
  1110. } = gameData;
  1111. //-gameData.acc.ax * 10;
  1112. let _ax = gameData.acc.ax * 10;
  1113. let _ay = gameData.acc.ay * 10;
  1114. let _az = gameData.acc.az * 10;
  1115. //低通滤波分离重力
  1116. let alpha = 0.8;
  1117. this.xA = alpha * this.xA + (1 - alpha) * _ax;
  1118. this.yA = alpha * this.yA + (1 - alpha) * _ay;
  1119. this.zA = alpha * this.zA + (1 - alpha) * _az;
  1120. //高通滤波获取线性速度
  1121. let linear_acceleration_x = _ax - this.xA;
  1122. let linear_acceleration_y = _az - this.zA;
  1123. let linear_acceleration_z = _ay - this.yA;
  1124. let _temp = {
  1125. linearAcc: {
  1126. lAccX: linear_acceleration_x,
  1127. lAccY: linear_acceleration_y,
  1128. lAccZ: linear_acceleration_z
  1129. }, //gameData.acc,
  1130. oriAcc: {
  1131. oAccX: _ax,
  1132. oAccY: _ay,
  1133. oAccZ: _az
  1134. },
  1135. gravityAcc: {
  1136. gravityX: this.xA,
  1137. gravityY: this.yA,
  1138. gravityZ: this.zA
  1139. },
  1140. bLimitRebound: false,
  1141. resultant: Math.sqrt(_ax * _ax +
  1142. _ay * _ay + _az * _az),
  1143. runIndex: this.BLEAccIndex,
  1144. //陀螺仪
  1145. oriGyro: {
  1146. oGyroX: gx,
  1147. oGyroY: gy,
  1148. oGyroZ: gz
  1149. },
  1150. //输入当前轴
  1151. bYAxis: true,
  1152. };
  1153. this.actionJumpObj.updateJump(_temp);
  1154. // if (this.BLEAccIndex > 150) {
  1155. // this.onClearData();
  1156. // this.bJump = false;
  1157. // return;
  1158. // }
  1159. this.BLEAccIndex++;
  1160. },
  1161. onClearData() {
  1162. this.BLEAccIndex = 0;
  1163. },
  1164. onChangeY() {
  1165. this.isY = true;
  1166. },
  1167. onChangeX() {
  1168. this.isY = false;
  1169. },
  1170. onGetActionJumpPlayView(callback) {
  1171. let view = uni.createSelectorQuery().select('#ActionJumpPlay');
  1172. view.boundingClientRect(data => {
  1173. if (callback)
  1174. callback(data);
  1175. }).exec();
  1176. },
  1177. onTipLevel() {
  1178. this.$emit("tipLevel");
  1179. }
  1180. }
  1181. }
  1182. </script>
  1183. <style lang="scss">
  1184. .mid-absolute {
  1185. position: absolute;
  1186. top: 0;
  1187. bottom: 0;
  1188. right: 0;
  1189. left: 0;
  1190. margin: auto;
  1191. }
  1192. .action-jump-timer {
  1193. position: absolute;
  1194. top: -150rpx;
  1195. }
  1196. </style>