Commit f7ae4da7 authored by Master Q's avatar Master Q

游戏页面loading 动效替换

parent d46f91bd
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<!-- <script src="libs/svgaParser.min1.js"></script> --> <!-- <script src="libs/svgaParser.min1.js"></script> -->
<script src="//yun.duiba.com.cn/js-libs/vConsole/3.3.4/vconsole.min.js"></script> <script src="//yun.duiba.com.cn/js-libs/vConsole/3.3.4/vconsole.min.js"></script>
<script> <script>
var vConsole = new VConsole(); // var vConsole = new VConsole();
</script> </script>
<style> <style>
html, html,
......
{
"success": true
}
\ No newline at end of file
{
"success": true
}
\ No newline at end of file
...@@ -3,6 +3,7 @@ import { RES } from "../RES"; ...@@ -3,6 +3,7 @@ import { RES } from "../RES";
import { layers } from "../views/layers"; import { layers } from "../views/layers";
import { showAlert } from "."; import { showAlert } from ".";
import { sendTbNet, TbNetName } from "../../src/TaoBaoNet";
let inited = false; let inited = false;
let _waiting: Waiting; let _waiting: Waiting;
...@@ -28,21 +29,29 @@ const initWaiting = () => { ...@@ -28,21 +29,29 @@ const initWaiting = () => {
_waiting.addChildAt(bg, 0); _waiting.addChildAt(bg, 0);
} }
} }
let customLoadingClose: Function // 小程序loading 关闭方法
/** /**
* 显示菊花圈 * 显示菊花圈
* @param msg 尽量三个字 * @param msg 尽量三个字
*/ */
export const showWaiting = (msg?: string) => { export const showWaiting = async (msg?: string) => {
initWaiting(); // initWaiting();
_waiting.show(msg) // _waiting.show(msg)
_parent.addChild(_waiting); // _parent.addChild(_waiting);
sendTbNet(TbNetName.showCustomLoading, {}, (s, d) => {
if (s) {
customLoadingClose = d.data
}
} , null, true)
} }
/** /**
* 隐藏菊花圈 * 隐藏菊花圈
*/ */
export const hideWaiting = () => { export const hideWaiting = () => {
_parent.removeChild(_waiting); // _parent.removeChild(_waiting);
typeof customLoadingClose == 'function' && customLoadingClose()
} }
export const destroyWaiting = () => { export const destroyWaiting = () => {
......
resource/GameOver/back-home.png

1.55 KB | W: | H:

resource/GameOver/back-home.png

1.4 KB | W: | H:

resource/GameOver/back-home.png
resource/GameOver/back-home.png
resource/GameOver/back-home.png
resource/GameOver/back-home.png
  • 2-up
  • Swipe
  • Onion skin
resource/common/count-start.png

3.44 KB | W: | H:

resource/common/count-start.png

4.22 KB | W: | H:

resource/common/count-start.png
resource/common/count-start.png
resource/common/count-start.png
resource/common/count-start.png
  • 2-up
  • Swipe
  • Onion skin
resource/common/count1.png

298 Bytes | W: | H:

resource/common/count1.png

658 Bytes | W: | H:

resource/common/count1.png
resource/common/count1.png
resource/common/count1.png
resource/common/count1.png
  • 2-up
  • Swipe
  • Onion skin
resource/common/count2.png

2.23 KB | W: | H:

resource/common/count2.png

1.67 KB | W: | H:

resource/common/count2.png
resource/common/count2.png
resource/common/count2.png
resource/common/count2.png
  • 2-up
  • Swipe
  • Onion skin
resource/common/count3.png

2.54 KB | W: | H:

resource/common/count3.png

2.13 KB | W: | H:

resource/common/count3.png
resource/common/count3.png
resource/common/count3.png
resource/common/count3.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
"name": "NewCompletePanel" "name": "NewCompletePanel"
}, },
{ {
"keys": "confirm-btn.png,prize-back.png", "keys": "confirm-btn.png,prize-back-title.png,prize-back.png",
"name": "PrizeShowPanel" "name": "PrizeShowPanel"
}, },
{ {
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
"name": "blank_shoe" "name": "blank_shoe"
}, },
{ {
"keys": "back.png,back_jordan.png,comCloseBtn.png,com_light.png,count-start.png,count1.png,count2.png,count3.png,music-off.png,music-on.png,toastBg.png,waitingBg.png,waitingRot.png,跳过按钮.png", "keys": "comCloseBtn.png,com_light.png,count-start.png,count1.png,count2.png,count3.png,jordan-icon.png,music-off.png,music-on.png,nike-icon.png,percennt0.png,percennt1.png,percennt2.png,percennt3.png,percennt4.png,percennt5.png,percennt6.png,percennt7.png,percennt8.png,percennt9.png,percenntp.png,ruready.png,toastBg.png,waitingBg.png,waitingRot.png,跳过按钮.png",
"name": "common" "name": "common"
}, },
{ {
......
...@@ -3,7 +3,7 @@ import { GameScene } from './scenes/GameScene/GameScene'; ...@@ -3,7 +3,7 @@ import { GameScene } from './scenes/GameScene/GameScene';
import { NewGuyScene } from './scenes/NewGuyScene/NewGuyScene'; import { NewGuyScene } from './scenes/NewGuyScene/NewGuyScene';
import { destroyLayers, layers } from "../module/views/layers"; import { destroyLayers, layers } from "../module/views/layers";
import { RES } from "../module/RES"; import { RES } from "../module/RES";
import { changeScene, destroyAllCtrls, showPanel, showToast } from "../module/ctrls"; import { changeScene, destroyAllCtrls, hideWaiting, showPanel, showToast, showWaiting } from "../module/ctrls";
import MusicBtn from "./common/MusicBtn"; import MusicBtn from "./common/MusicBtn";
import { ResJson } from "./ResJson"; import { ResJson } from "./ResJson";
...@@ -152,6 +152,7 @@ export class Main { ...@@ -152,6 +152,7 @@ export class Main {
} }
private async onAddToStage() { private async onAddToStage() {
showWaiting()
//初始化层级 //初始化层级
layers.init(this.stage); layers.init(this.stage);
console.log("初始化层级完成") console.log("初始化层级完成")
...@@ -161,18 +162,18 @@ export class Main { ...@@ -161,18 +162,18 @@ export class Main {
// 皮肤配置加载 // 皮肤配置加载
RES.loadSkinConfig(SkinJson); RES.loadSkinConfig(SkinJson);
console.log("初始化皮肤配置完成") console.log("初始化皮肤配置完成")
// 加载完美 icon 资源
await RES.loadGroup('excellent_icon')
// 加载通用资源 // 加载通用资源
await RES.loadGroup("common"); await RES.loadGroup("common");
console.log("通用资源加载完成") console.log("通用资源加载完成")
hideWaiting()
// h5环境时,隐藏加载中 // h5环境时,隐藏加载中
if (FYGE.getEnv() == "web" && document.getElementById("__loading__")) document.getElementById("__loading__").style.display = "none"; if (FYGE.getEnv() == "web" && document.getElementById("__loading__")) document.getElementById("__loading__").style.display = "none";
console.log('getGlobalData') console.log('getGlobalData')
await Tools.getGlobalData() await Tools.getGlobalData()
// 加载完美 icon 资源
await RES.loadGroup('excellent_icon')
// const baseSuccess = await Tools.getActivityBaseInfo(); // const baseSuccess = await Tools.getActivityBaseInfo();
// if (!baseSuccess) { // if (!baseSuccess) {
// showToast("获取活动信息失败"); // showToast("获取活动信息失败");
......
This diff is collapsed.
...@@ -97,7 +97,16 @@ export enum TbNetName { ...@@ -97,7 +97,16 @@ export enum TbNetName {
*/ */
openMusic = "mine.openMusic", openMusic = "mine.openMusic",
complteGuidance = 'yoga.complateGuide' complteGuidance = 'yoga.complateGuide',
/**
* 添加 生命周期 事件
*/
addLifiCycleEvent = 'mine.addLifiCycleEvent',
// 显示 小程序的loading 记得注视下 自带的 菊花图
showCustomLoading = 'mine.showCustomLoading',
closeCustomLoading = 'mine.closeCustomLoading'
} }
export enum TBBgm { export enum TBBgm {
......
...@@ -11,7 +11,7 @@ import { red_shoe } from '../lotties/red_shoe'; ...@@ -11,7 +11,7 @@ import { red_shoe } from '../lotties/red_shoe';
import { blank_shoe } from '../lotties/blank_shoe'; import { blank_shoe } from '../lotties/blank_shoe';
import { white_shoe } from '../lotties/white_shoe'; import { white_shoe } from '../lotties/white_shoe';
import { balance_guidance } from '../lotties/balance_guidance'; import { balance_guidance } from '../lotties/balance_guidance';
import { sleep } from '../utils/utils'; import { onceFnc, sleep } from '../utils/utils';
export class GameOverPanel extends Panel { export class GameOverPanel extends Panel {
get groupNames() { get groupNames() {
...@@ -48,7 +48,7 @@ export class GameOverPanel extends Panel { ...@@ -48,7 +48,7 @@ export class GameOverPanel extends Panel {
var bitMapc = Tools.getNumTextures('num') var bitMapc = Tools.getNumTextures('num')
var bitMapc2 = Tools.getNumTextures('numb') var bitMapc2 = Tools.getNumTextures('numb')
var bitmapTextCount = this.bitmapTextCount = panelCtn.addChild(new FYGE.BitmapText(bitMapc)) var bitmapTextCount = this.bitmapTextCount = panelCtn.addChild(new FYGE.BitmapText(bitMapc))
if (this.data.score < 3) { if (this.data.score <= 3) {
this.bitmapTextCount.textures = bitMapc2 this.bitmapTextCount.textures = bitMapc2
} }
this.bitmapTextCount.position.set(panelCtn.width / 2, 210) this.bitmapTextCount.position.set(panelCtn.width / 2, 210)
...@@ -69,14 +69,14 @@ export class GameOverPanel extends Panel { ...@@ -69,14 +69,14 @@ export class GameOverPanel extends Panel {
}) })
FYGE.Tween.get(o) FYGE.Tween.get(o)
.to({ score: +this.data.score }, 500) .to({ score: +this.data.score }, +this.data.score > 3 ? 500 : 300)
.call(() => { .call(() => {
this.showGiftIcon() this.showGiftIcon()
}) })
// this.bitmapTextCount.text = this.data.score + '' // this.bitmapTextCount.text = this.data.score + ''
UI.Txt(panelCtn, '本次得分', 30, '#e95d2a', FYGE.TEXT_ALIGN.CENTER, panelCtn.width, 0, 285) UI.Txt(panelCtn, '本次得分', 30, '#e95d2a', FYGE.TEXT_ALIGN.CENTER, panelCtn.width, 0, 285, true)
} }
...@@ -84,7 +84,7 @@ export class GameOverPanel extends Panel { ...@@ -84,7 +84,7 @@ export class GameOverPanel extends Panel {
drawBtn: FYGE.Lottie drawBtn: FYGE.Lottie
showGiftIcon() { showGiftIcon() {
var panelCtn = this.panelCtn var panelCtn = this.panelCtn
var tips = UI.Sp(panelCtn, 'over-tipsicon.png', panelCtn.width / 2 - 86, 415.5) var tips = UI.Sp(panelCtn, 'over-tipsicon.png', panelCtn.width / 2 - 86, 435.5)
tips.alpha = 0 tips.alpha = 0
tips.anchorTexture.set(0, 1) tips.anchorTexture.set(0, 1)
FYGE.Tween.get(tips) FYGE.Tween.get(tips)
...@@ -95,18 +95,18 @@ export class GameOverPanel extends Panel { ...@@ -95,18 +95,18 @@ export class GameOverPanel extends Panel {
switch(+this.data.level) { switch(+this.data.level) {
case 1: case 1:
this.drawBtn = UI.Lottie(panelCtn, red_shoe, 0, 185) this.drawBtn = UI.Lottie(panelCtn, red_shoe, 0, 205)
break break
case 2: case 2:
this.drawBtn = UI.Lottie(panelCtn, blank_shoe, 0, 185) this.drawBtn = UI.Lottie(panelCtn, blank_shoe, 0, 205)
break break
case 3: case 3:
this.drawBtn = UI.Lottie(panelCtn, white_shoe, 0, 185) this.drawBtn = UI.Lottie(panelCtn, white_shoe, 0, 205)
break break
} }
this.drawBtn.startAniRange(0, 80, 1) this.drawBtn.startAniRange(0, 80, 1)
this.drawBtn.addEventListener(FYGE.MouseEvent.CLICK, async function() { this.drawBtn.addEventListener(FYGE.MouseEvent.CLICK, onceFnc(async function() {
this.btnDelay(this) this.btnDelay(this)
await sendTbNet(TbNetName.openMusic, { await sendTbNet(TbNetName.openMusic, {
...@@ -139,6 +139,6 @@ export class GameOverPanel extends Panel { ...@@ -139,6 +139,6 @@ export class GameOverPanel extends Panel {
changeScene(GameOverScene, this.data) changeScene(GameOverScene, this.data)
} }
} }
}, this) }, 1), this)
} }
} }
\ No newline at end of file
...@@ -4,6 +4,8 @@ import { layers } from '../../module/views/layers'; ...@@ -4,6 +4,8 @@ import { layers } from '../../module/views/layers';
import UI from '../UI'; import UI from '../UI';
import { Panel } from './../../module/views/Panel'; import { Panel } from './../../module/views/Panel';
import { GameOverScene } from '../scenes/GameOverScene/GameOverScene'; import { GameOverScene } from '../scenes/GameOverScene/GameOverScene';
import { sendTbNet, TBBgm, TbNetName } from '../TaoBaoNet';
import { GDispatcher } from '../Main';
export class PrizeShowPanel extends Panel { export class PrizeShowPanel extends Panel {
get groupNames(): string[] { get groupNames(): string[] {
...@@ -13,24 +15,32 @@ export class PrizeShowPanel extends Panel { ...@@ -13,24 +15,32 @@ export class PrizeShowPanel extends Panel {
initUi() { initUi() {
var panelCtn = UI.Ctn(this) var panelCtn = UI.Ctn(this)
UI.Sp(panelCtn, 'prize-back.png') UI.Sp(panelCtn, 'prize-back.png')
UI.Sp(panelCtn, 'prize-back-title.png', this.width / 2, 115).anchorTexture.set(.5,.5)
panelCtn.position.set(layers.stageCenterX - panelCtn.width / 2, layers.stageCenterY - panelCtn.height / 2) panelCtn.position.set(layers.stageCenterX - panelCtn.width / 2, layers.stageCenterY - panelCtn.height / 2)
UI.Txt(panelCtn, this.data.name, 30, '#757575', FYGE.TEXT_ALIGN.CENTER, panelCtn.width - 60, 30, 170) UI.Txt(panelCtn, this.data.name, 30, '#757575', FYGE.TEXT_ALIGN.CENTER, panelCtn.width - 60, 30, 175, true)
var preview = UI.Sp(panelCtn, decodeURI(this.data.image)) var preview = UI.Sp(panelCtn, decodeURI(this.data.image))
preview.width = 300 preview.width = 300
preview.height = 300 preview.height = 300
preview.position.set(150, 230) preview.position.set(150, 236)
preview.mask = panelCtn.addChild(new FYGE.Graphics()) preview.mask = panelCtn.addChild(new FYGE.Graphics())
.beginFill() .beginFill()
.drawRoundedRect(150, 230, 300, 300, 20) .drawRoundedRect(150, 236, 300, 300, 20)
.endFill() .endFill()
UI.Btn(panelCtn, 'confirm-btn.png', function() { UI.Btn(panelCtn, 'confirm-btn.png', function() {
this.btnDelay(this) this.btnDelay(this)
if (this.data.type == 3) { if (this.data.type == 3) {
this.hidePanel() this.hidePanel()
changeScene(GameOverScene, this.data) sendTbNet(TbNetName.addLifiCycleEvent, {
type: 'show',
func: () => {
GDispatcher.dispatchEvent('init-score')
},
once: true
})
changeScene(GameOverScene, Object.assign({}, this.data, {hideMusic: true}))
//@ts-ignore //@ts-ignore
my && my.navigateTo({ my && my.navigateTo({
url: `/pages/rewardinfofill/rewardinfofill?id=${this.data.id}&prizeId=${this.data.prizeId}` url: `/pages/rewardinfofill/rewardinfofill?id=${this.data.id}&prizeId=${this.data.prizeId}`
...@@ -41,6 +51,6 @@ export class PrizeShowPanel extends Panel { ...@@ -41,6 +51,6 @@ export class PrizeShowPanel extends Panel {
this.hidePanel() this.hidePanel()
changeScene(GameOverScene, this.data) changeScene(GameOverScene, this.data)
} }
}, this, 40, 580) }, this, 40, 575)
} }
} }
\ No newline at end of file
...@@ -4,10 +4,10 @@ import { Scene } from "../../../module/views/Scene"; ...@@ -4,10 +4,10 @@ import { Scene } from "../../../module/views/Scene";
import { addData, sendTbNet, TbNetName } from "../../TaoBaoNet"; import { addData, sendTbNet, TbNetName } from "../../TaoBaoNet";
import { Tools } from "../../Tools"; import { Tools } from "../../Tools";
import UI from "../../UI"; import UI from "../../UI";
import { GDispatcher } from '../../Main';
export class GameOverScene extends Scene { export class GameOverScene extends Scene {
bitmapTextCount: FYGE.BitmapText bitmapTextCount: FYGE.BitmapText
scrollPage: FYGE.ScrollPage
get groupNames():string[] { get groupNames():string[] {
return ['GameOver', 'GameScene'] return ['GameOver', 'GameScene']
...@@ -18,62 +18,56 @@ export class GameOverScene extends Scene { ...@@ -18,62 +18,56 @@ export class GameOverScene extends Scene {
} }
async initUi() { async initUi() {
UI.Sp(this, 'back.png') UI.Rect(this, 750, 1624, 0xf1ebdd, 0, 0, 0)
var icon = UI.Sp(this, getApp().isNike ? 'nike-icon.png' : 'jordan-icon.png', 41, 220)
if (getApp().isLarge) {
icon.position.set(41, -layers.stageOffsetY + 90 + 1624 - layers.stage.viewRect.height + 68)
} else {
icon.position.set(41, -layers.stageOffsetY + 90 + 1624 - layers.stage.viewRect.height + 98)
}
this.y -= layers.stageOffsetY - 90
this.scrollPage = this.addChild(new FYGE.ScrollPage(layers.stageWidth,layers.stageHeight-130, 1500))
this.scrollPage.position.set(0, layers.stageOffsetY)
var scrollPageView = this.scrollPage.view
var bitMapc = Tools.getNumTextures('num') var bitMapc = Tools.getNumTextures('num')
var bitMapc2 = Tools.getNumTextures('numb') var bitMapc2 = Tools.getNumTextures('numb')
var bitmapTextCount = this.bitmapTextCount = scrollPageView.addChild(new FYGE.BitmapText(bitMapc)) var bitmapTextCount = this.bitmapTextCount = this.addChild(new FYGE.BitmapText(bitMapc))
if (this.data.score < 3) { if (this.data.score <= 3) {
this.bitmapTextCount.textures = bitMapc2 this.bitmapTextCount.textures = bitMapc2
} else {
if (!this.data.hideMusic) {
await sendTbNet(TbNetName.openMusic, {
isOn: true,
kurl: TBBgm.scoreBgm,
loop: false
}, null, null, true)
this.showNumberUp()
}
} }
this.bitmapTextCount.position.set(layers.stageCenterX, 500) this.bitmapTextCount.position.set(layers.stageCenterX, 500)
// this.bitmapTextCount.text = this.data.score + '' // this.bitmapTextCount.text = this.data.score + ''
bitmapTextCount.text = '0'
var o = { _score: 1} var desc = UI.Ctn(this, 0, 700)
Object.defineProperty(o, 'score', { UI.Txt(desc, '本局连续完成', 40, '#111111', FYGE.TEXT_ALIGN.CENTER, layers.stageWidth, 0, 10, true)
configurable: true, UI.Txt(desc, '游戏结束', 40, '#757575', FYGE.TEXT_ALIGN.CENTER, layers.stageWidth, 0, 62, true)
enumerable: true,
get() {
return o._score
},
set(n:number) {
o._score = n
bitmapTextCount.text = ~~n + ''
}
})
await sendTbNet(TbNetName.openMusic, {
isOn: true,
kurl: TBBgm.scoreBgm,
loop: false
}, null, null, true)
FYGE.Tween.get(o)
.to({ score: +this.data.score }, 500)
var desc = UI.Ctn(scrollPageView, 0, 700)
UI.Txt(desc, '本局连续完成', 36, '#111111', FYGE.TEXT_ALIGN.CENTER, layers.stageWidth, 0, 0)
UI.Txt(desc, '游戏结束', 30, '#757575', FYGE.TEXT_ALIGN.CENTER, layers.stageWidth, 0, 50)
this.data.isNewRecord && UI.Sp(desc, 'new-record-icon.png', 490, -30) this.data.isNewRecord && UI.Sp(desc, 'new-record-icon.png', 490, -30)
UI.Btn(scrollPageView, 'share-btn.png', function() { UI.Btn(this, 'share-btn.png', function() {
// @ts-ignore todo 分享 // @ts-ignore todo 分享
my && my.showSharePanel() my && my.showSharePanel()
addData(2) addData(2)
}, this, 45, 950) }, this, 45, 930)
UI.Btn(scrollPageView, 'more-btn.png', function() { UI.Btn(this, 'more-btn.png', function() {
this.btnDelay(this) this.btnDelay(this)
// @ts-ignore // @ts-ignore
my.reLaunch({ my.reLaunch({
url: '/pages/mainscene/mainscene' url: '/pages/mainscene/mainscene'
}) })
}, this, 45, 1110) }, this, 45, 1090)
var _s = UI.Sp(scrollPageView, 'back-home.png', layers.stageCenterX, 1350) var _s = UI.Sp(this, 'back-home.png', layers.stageCenterX, 1310)
_s.addEventListener(FYGE.MouseEvent.CLICK, function() { _s.addEventListener(FYGE.MouseEvent.CLICK, function() {
this.btnDelay(this) this.btnDelay(this)
addData(8) addData(8)
...@@ -83,12 +77,12 @@ export class GameOverScene extends Scene { ...@@ -83,12 +77,12 @@ export class GameOverScene extends Scene {
_s.anchorTexture.set(0.5, 0.5) _s.anchorTexture.set(0.5, 0.5)
var bottomCont = UI.Ctn(this) var bottomCont = UI.Ctn(this)
bottomCont.position.set(0, layers.stageOffsetY + layers.stageHeight - 130) bottomCont.position.set(0, layers.stageOffsetY + layers.stageHeight - 130 + layers.stageOffsetY - 90)
var isJordan = Tools.globalData.shopId == 10003 var isJordan = Tools.globalData.shopId == 10003
UI.Rect(bottomCont, layers.stageWidth, 130, 0xffffff) UI.Rect(bottomCont, layers.stageWidth, 130, 0xffffff)
UI.Sp(bottomCont, 'product-link__icon.png', 50, 25) UI.Sp(bottomCont, 'product-link__icon.png', 50, 25)
UI.Txt(bottomCont, `${isJordan ? 'Jordan': 'Nike'} 瑜伽商品`, 28, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 35) UI.Txt(bottomCont, `${isJordan ? 'Jordan': 'Nike'} 瑜伽商品`, 24, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 40, true)
UI.Txt(bottomCont, '让你的体态更加健康', 26, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 75) UI.Txt(bottomCont, '让你的体态更加健康', 22, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 70, true)
UI.Sp(bottomCont, 'jump-icon.png', 600, 40) UI.Sp(bottomCont, 'jump-icon.png', 600, 40)
.addEventListener(FYGE.MouseEvent.CLICK, function() { .addEventListener(FYGE.MouseEvent.CLICK, function() {
this.btnDelay(this) this.btnDelay(this)
...@@ -100,4 +94,38 @@ export class GameOverScene extends Scene { ...@@ -100,4 +94,38 @@ export class GameOverScene extends Scene {
}, this) }, this)
} }
showNumberUp() {
var o = { _score: 0}
var bitmapTextCount = this.bitmapTextCount
Object.defineProperty(o, 'score', {
configurable: true,
enumerable: true,
get() {
return o._score
},
set(n:number) {
o._score = n
bitmapTextCount.text = ~~n + ''
}
})
FYGE.Tween.get(o)
.set({ score: 0 })
.to({ score: +this.data.score }, +this.data.score > 3 ? 500 : 300)
}
initEvents() {
GDispatcher.once('init-score', async function() {
if (this.data.score > 3) {
await sendTbNet(TbNetName.openMusic, {
isOn: true,
kurl: TBBgm.scoreBgm,
loop: false
}, null, null, true)
}
this.showNumberUp()
}, this)
}
} }
\ No newline at end of file
...@@ -158,13 +158,15 @@ export class GameScene extends MotionInitScene { ...@@ -158,13 +158,15 @@ export class GameScene extends MotionInitScene {
} }
async initUi() { async initUi() {
UI.Sp(this, this.isJordan ? 'back_jordan.png' : 'back.png')
super.initUi()
this.score = 0 this.score = 0
// 开背景音乐 // 开背景音乐
// this.musicBoolean = true // this.musicBoolean = true
var cdp = this.cdp = this.addChild(new CountDownComp(GameCfg.iTime)) var cdp = this.cdp = this.addChild(new CountDownComp(GameCfg.iTime))
this.setChildIndex(this.cdp, 2)
this.cdp.addTimeoutFunc(() => { this.cdp.addTimeoutFunc(() => {
this.cdp.destory() this.cdp.destory()
// 销毁 instance // 销毁 instance
...@@ -186,7 +188,6 @@ export class GameScene extends MotionInitScene { ...@@ -186,7 +188,6 @@ export class GameScene extends MotionInitScene {
}) })
cdp.position.set(layers.stageCenterX - 65, layers.stageOffsetY + 340) cdp.position.set(layers.stageCenterX - 65, layers.stageOffsetY + 340)
super.initUi()
} }
onMusicClick() { onMusicClick() {
......
...@@ -91,13 +91,77 @@ export class MotionInitFunc extends Container { ...@@ -91,13 +91,77 @@ export class MotionInitFunc extends Container {
DeviceMotion.instance.off(this.deviceOritationChange) DeviceMotion.instance.off(this.deviceOritationChange)
} }
// startTips:FYGE.Sprite
// onStepDown1() {
// this.startTips = this.timerBox.addChild(Tools.getSprite("倒计时开始.png", 205, 730))
// this.startTips.alpha = 0
// this.timerBoxTxt = this.timerBox.addChild(Tools.getBitmapText(cdTextures, "3", 375, 800, FYGE.TEXT_ALIGN.CENTER, 1, 1))
// this.timerBoxTxt.text = "3"
// sendTbNet(TbNetName.vibrateShort)
// if (Tools.playMusic) {
// sendTbNet(TbNetName.openMusic, { isOn: true, name: "cd" })
// }
// FYGE.Tween.get(this.timerBoxTxt)
// .set({ alpha: 0, y: 800 })
// .to({ alpha: 1, y: 750 }, 300)
// .wait(700)
// .call(() => {
// sendTbNet(TbNetName.vibrateShort)
// this.timerBoxTxt.text = "2"
// if (Tools.playMusic) {
// sendTbNet(TbNetName.openMusic, { isOn: true, name: "cd" })
// }
// FYGE.Tween.get(this.timerBoxTxt)
// .set({ alpha: 0, y: 800 })
// .to({ alpha: 1, y: 750 }, 300)
// .wait(700)
// .call(() => {
// sendTbNet(TbNetName.vibrateShort)
// this.timerBoxTxt.text = "1"
// if (Tools.playMusic) {
// sendTbNet(TbNetName.openMusic, { isOn: true, name: "cd" })
// }
// FYGE.Tween.get(this.timerBoxTxt)
// .set({ alpha: 0, y: 800 })
// .to({ alpha: 1, y: 750 }, 300)
// .wait(700)
// .call(() => {
// sendTbNet(TbNetName.vibrateLong)
// if (Tools.playMusic) {
// sendTbNet(TbNetName.openMusic, { isOn: true, name: "cd" })
// }
// this.timerBoxTxt.alpha = 0
// FYGE.Tween.get(this.startTips)
// .set({ alpha: 0, y: 730 })
// .to({ alpha: 1, y: 680 }, 300)
// .wait(700)
// .call(() => {
// this.timerBox.visible = false
// this.startTimer()
// setTimeout(() => {
// if (Tools.playMusic) {
// sendTbNet(TbNetName.openMusic, { isOn: true, name: "bg", loop: true })
// }
// }, 1000)
// })
// })
// })
// })
// }
// 倒计时 // 倒计时
onStepDwon() { onStepDwon() {
var stepDownCtn = UI.Ctn(this) var stepDownCtn = UI.Ctn(this)
// UI.Rect(stepDownCtn, 750, 1624, 0x1b1a1a, 0).alpha=0.8 // UI.Rect(stepDownCtn, 750, 1624, 0x1b1a1a, 0).alpha=0.8
var box1 = UI.Ctn(stepDownCtn) var box1 = UI.Ctn(stepDownCtn)
var desc = UI.Txt(box1, '准备开始', 40, '#ffffff', FYGE.TEXT_ALIGN.CENTER, layers.stageWidth, 0, layers.stageCenterY - 100) var desc = UI.Sp(box1, 'ruready.png', layers.stageCenterX, layers.stageCenterY)
desc.anchorTexture.set(0.5, 0.5);
// UI.Txt(box1, '准备开始', 40, '#ffffff', FYGE.TEXT_ALIGN.CENTER, layers.stageWidth, 0, layers.stageCenterY - 100)
desc.alpha = 0 desc.alpha = 0
var timerBoxTxtSp = UI.Sp(box1, 'count3.png', layers.stageCenterX, layers.stageCenterY) var timerBoxTxtSp = UI.Sp(box1, 'count3.png', layers.stageCenterX, layers.stageCenterY)
...@@ -114,7 +178,7 @@ export class MotionInitFunc extends Container { ...@@ -114,7 +178,7 @@ export class MotionInitFunc extends Container {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
FYGE.Tween.get(desc) FYGE.Tween.get(desc)
.set({ alpha:0, y: layers.stageCenterY}) .set({ alpha:0, y: layers.stageCenterY})
.to({ alpha: 1, y: layers.stageCenterY - 280 }, 600 ,FYGE.Ease.quadInOut) .to({ alpha: 1, y: layers.stageCenterY - 150 }, 600 ,FYGE.Ease.quadInOut)
.wait(300) .wait(300)
.call(() => { .call(() => {
...@@ -234,6 +298,9 @@ export class MotionInitScene extends Scene { ...@@ -234,6 +298,9 @@ export class MotionInitScene extends Scene {
excellentIcon: FYGE.Lottie excellentIcon: FYGE.Lottie
initUi() { initUi() {
UI.Rect(this, 750, 1624, 0xf1ebdd, 0, 0, 0)
UI.Sp(this, getApp().isNike ? 'nike-icon.png' : 'jordan-icon.png', 41, 220)
// 中间的小圆 // 中间的小圆
var c = this.addChild(new FYGE.Shape()) var c = this.addChild(new FYGE.Shape())
.beginFill(0xf0e4ce) .beginFill(0xf0e4ce)
...@@ -252,11 +319,11 @@ export class MotionInitScene extends Scene { ...@@ -252,11 +319,11 @@ export class MotionInitScene extends Scene {
this.centerp = setCenterPos(UI.Sp(this, 'p1-b.png')) this.centerp = setCenterPos(UI.Sp(this, 'p1-b.png'))
var bitMapc = Tools.getNumTextures('num') var bitMapc = Tools.getNumTextures('percennt')
bitMapc['%'] = RES.getRes('nump.png') bitMapc['%'] = RES.getRes('percenntp.png')
this.bitmapTextCount = this.addChild(new FYGE.BitmapText(bitMapc)) this.bitmapTextCount = this.addChild(new FYGE.BitmapText(bitMapc))
this.bitmapTextCount.scaleY = 0.33 // this.bitmapTextCount.scaleY = 0.33
this.bitmapTextCount.scaleX = 0.33 // this.bitmapTextCount.scaleX = 0.33
this.bitmapTextCount.position.set(layers.stageCenterX, layers.stageCenterY + 380) this.bitmapTextCount.position.set(layers.stageCenterX, layers.stageCenterY + 380)
// @ts-ignore // @ts-ignore
...@@ -265,10 +332,9 @@ export class MotionInitScene extends Scene { ...@@ -265,10 +332,9 @@ export class MotionInitScene extends Scene {
this.holdOnTxt.anchorX = layers.stageWidth / 2 this.holdOnTxt.anchorX = layers.stageWidth / 2
this.holdOnTxt.anchorY = 30 this.holdOnTxt.anchorY = 30
this.setChildIndex(c, 1)
var cb = this.initGame.bind(this) var cb = this.initGame.bind(this)
this.motionInitFunc = this.addChild(new MotionInitFunc(this.data?.type, cb)) this.motionInitFunc = this.addChild(new MotionInitFunc(this.data?.type, cb))
this.setChildIndex(this.motionInitFunc, 1000)
super.initUi() super.initUi()
} }
...@@ -381,6 +447,7 @@ export class MotionInitScene extends Scene { ...@@ -381,6 +447,7 @@ export class MotionInitScene extends Scene {
} }
FYGE.Tween.removeTweens(this.holdOnTxt) FYGE.Tween.removeTweens(this.holdOnTxt)
this.holdOnTxt.position.set(30, layers.stageOffsetY + 340) // 重新设置一下
this.holdOnTxt.visible = false this.holdOnTxt.visible = false
// @ts-ignore // @ts-ignore
......
...@@ -33,7 +33,6 @@ export class NewGuyScene extends MotionInitScene { ...@@ -33,7 +33,6 @@ export class NewGuyScene extends MotionInitScene {
} }
async initUi() { async initUi() {
UI.Sp(this, this.isJordan ? 'back_jordan.png' : 'back.png')
super.initUi() super.initUi()
......
var a = 1
a = ''
export function test() {
console.log(233)
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment