Commit 58a746b7 authored by Master Q's avatar Master Q

游戏流程

parent bfbf8b85
...@@ -7017,7 +7017,7 @@ export class InputText extends FloatDisplay { ...@@ -7017,7 +7017,7 @@ export class InputText extends FloatDisplay {
} }
export class BitmapText extends Container { export class BitmapText extends Container {
private textures; textures;
/** /**
* 水平对齐方式,默认居中 * 水平对齐方式,默认居中
* 改变x坐标原点 * 改变x坐标原点
......
{ {
"data": { "data": {
"id": 666666,
"isFirstJoin": true
}, },
"success": true, "success": true,
"code": "111", "code": "111",
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"success": true, "success": true,
"data": { "data": {
"id": "123456", "id": "123456",
"type": 5, "type": 3,
"name": "吕秀兰", "name": "吕秀兰",
"image": "https://yun.duiba.com.cn/aurora/assets/8c6cce25b4970d776a4ac89780ffe97b2c69c56c.png" "image": "https://yun.duiba.com.cn/aurora/assets/8c6cce25b4970d776a4ac89780ffe97b2c69c56c.png"
} }
......
{
"data": {
"id": 666666,
"score": 233,
"isNewRecord": false,
"productLink": "http://qnpic.top/yoona2",
"isWinPrize": false
},
"success": true,
"code": "111",
"message": "ok"
}
...@@ -5,17 +5,21 @@ ...@@ -5,17 +5,21 @@
"name": "CountDownComp" "name": "CountDownComp"
}, },
{ {
"keys": "back-home.png,more-btn.png,new-record-icon.png,share-btn.png", "keys": "back-home.png,jump-icon.png,more-btn.png,new-record-icon.png,product-link__icon.png,share-btn.png",
"name": "GameOver" "name": "GameOver"
}, },
{ {
"keys": "back_index.png,gg_back.png,one_more-btn.png", "keys": "over-back.png,over-tipsicon.png,prize-icon1.png",
"name": "GameOverPanel" "name": "GameOverPanel"
}, },
{ {
"keys": "balance_guidance.png,guidance-t1.png,num0.png,num1.png,num2.png,num3.png,num4.png,num5.png,num6.png,num7.png,num8.png,num9.png,numb0.png,numb1.png,numb2.png,numb3.png,numb4.png,numb5.png,numb6.png,numb7.png,numb8.png,numb9.png,numbp.png,nump.png,p1-b.png,p1.png,p10-b.png,p10.png,p11-b.png,p11.png,p12-b.png,p12.png,p13-b.png,p13.png,p14-b.png,p14.png,p15-b.png,p15.png,p16-b.png,p16.png,p17-b.png,p17.png,p18-b.png,p18.png,p19-b.png,p19.png,p2-b.png,p2.png,p20-b.png,p20.png,p3-b.png,p3.png,p4-b.png,p4.png,p5-b.png,p5.png,p6-b.png,p6.png,p7-b.png,p7.png,p8-b.png,p8.png,p9-b.png,p9.png", "keys": "balance_guidance.png,guidance-t1.png,num0.png,num1.png,num2.png,num3.png,num4.png,num5.png,num6.png,num7.png,num8.png,num9.png,numb0.png,numb1.png,numb2.png,numb3.png,numb4.png,numb5.png,numb6.png,numb7.png,numb8.png,numb9.png,numbp.png,nump.png,p1-b.png,p1.png,p10-b.png,p10.png,p11-b.png,p11.png,p12-b.png,p12.png,p13-b.png,p13.png,p14-b.png,p14.png,p15-b.png,p15.png,p16-b.png,p16.png,p17-b.png,p17.png,p18-b.png,p18.png,p19-b.png,p19.png,p2-b.png,p2.png,p20-b.png,p20.png,p3-b.png,p3.png,p4-b.png,p4.png,p5-b.png,p5.png,p6-b.png,p6.png,p7-b.png,p7.png,p8-b.png,p8.png,p9-b.png,p9.png",
"name": "GameScene" "name": "GameScene"
}, },
{
"keys": "confirm-btn.png,prize-back.png",
"name": "PrizeShowPanel"
},
{ {
"keys": "back.png,comCloseBtn.png,com_light.png,toastBg.png,waitingBg.png,waitingRot.png,跳过按钮.png", "keys": "back.png,comCloseBtn.png,com_light.png,toastBg.png,waitingBg.png,waitingRot.png,跳过按钮.png",
"name": "common" "name": "common"
......
import { GameOverPanel } from './panels/GameOverPanel';
import { GameScene } from './scenes/GameScene/GameScene'; 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, showToast } from "../module/ctrls"; import { changeScene, destroyAllCtrls, showPanel, showToast } from "../module/ctrls";
import MusicBtn from "./common/MusicBtn"; import MusicBtn from "./common/MusicBtn";
import { ResJson } from "./ResJson"; import { ResJson } from "./ResJson";
...@@ -11,6 +12,7 @@ import { SkinJson } from "./SkinJson"; ...@@ -11,6 +12,7 @@ import { SkinJson } from "./SkinJson";
import { G_EVENT } from "./common/G_EVENT"; import { G_EVENT } from "./common/G_EVENT";
import { Tools } from "./Tools"; import { Tools } from "./Tools";
import { GameOverScene } from "./scenes/GameOverScene/GameOverScene"; import { GameOverScene } from "./scenes/GameOverScene/GameOverScene";
import DeviceMotion from './scenes/GameScene/DeviceMotion';
/** /**
* 全局事件,为了和小程序交互 * 全局事件,为了和小程序交互
...@@ -145,6 +147,8 @@ export class Main { ...@@ -145,6 +147,8 @@ export class Main {
destroyTbNetData(); destroyTbNetData();
// web环境其实没必要 // web环境其实没必要
// destroyWebNetData() // destroyWebNetData()
DeviceMotion.instance && DeviceMotion.instance.destory()
} }
private async onAddToStage() { private async onAddToStage() {
...@@ -163,7 +167,7 @@ export class Main { ...@@ -163,7 +167,7 @@ export class Main {
// 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')
await Tools.getGlobalData() await Tools.getGlobalData()
// const baseSuccess = await Tools.getActivityBaseInfo(); // const baseSuccess = await Tools.getActivityBaseInfo();
...@@ -178,18 +182,17 @@ export class Main { ...@@ -178,18 +182,17 @@ export class Main {
// return; // return;
// } // }
// const scene = Tools.globalData.newUser ? StoryScene : IndexScene; const scene = Tools.globalData.completed ? GameScene : NewGuyScene;
// vtodo 是否是新手 // vtodo 是否是新手
changeScene(GameScene, { changeScene(scene);
score: 45,
isNewRecord: true,
productLink: 'http://qnpic.top/yoona2.jpg',
isWinPrize: false
});
// MusicBtn.changeMusicStatus(true); // TODO 进游戏打开音乐先 // MusicBtn.changeMusicStatus(true); // TODO 进游戏打开音乐先
// (function() {
// showPanel(GameOverPanel, {
// score: '1'
// })
// })()
} }
} }
......
This diff is collapsed.
...@@ -18,11 +18,11 @@ export enum TbNetName { ...@@ -18,11 +18,11 @@ export enum TbNetName {
receiveInvitePrize = "xunzai.receiveInvitePrize", receiveInvitePrize = "xunzai.receiveInvitePrize",
startGame = "okamoto.startGame", startGame = "yoga.startGame",
submitGame = "okamoto.submitGame", submitGame = "yoga.submitGame",
drawLotteryPrize = "xunzai.drawLotteryPrize", drawLotteryPrize = "yoga.drawLotteryPrize",
doHelp = "xunzai.doHelp", doHelp = "xunzai.doHelp",
...@@ -96,6 +96,8 @@ export enum TbNetName { ...@@ -96,6 +96,8 @@ export enum TbNetName {
* isOn * isOn
*/ */
openMusic = "mine.openMusic", openMusic = "mine.openMusic",
complteGuidance = 'yoga.complateGuide'
} }
//返回数据类型 //返回数据类型
......
...@@ -56,7 +56,8 @@ export class Tools { ...@@ -56,7 +56,8 @@ export class Tools {
newUser1: boolean newUser1: boolean
firstLoginToday: boolean firstLoginToday: boolean
shop: string, shop: string,
startId: string startId: string,
completed: boolean
} }
public static async getGlobalData() { public static async getGlobalData() {
......
...@@ -62,7 +62,13 @@ export default class UI { ...@@ -62,7 +62,13 @@ export default class UI {
imageName: string, imageName: string,
x: number = 0, y: number = 0 x: number = 0, y: number = 0
): Sprite { ): Sprite {
const sprite = new Sprite(RES.getRes(imageName)); var texture = RES.getRes(imageName)
var sprite
if (texture) {
sprite = new Sprite(texture);
} else {
sprite = Sprite.fromUrl(imageName)
}
sprite.position.set(x, y); sprite.position.set(x, y);
parent && parent.addChild(sprite); parent && parent.addChild(sprite);
return sprite; return sprite;
......
...@@ -74,6 +74,7 @@ export default class CountDownComp extends Module { ...@@ -74,6 +74,7 @@ export default class CountDownComp extends Module {
}) })
.to({t: 0}, time.t) .to({t: 0}, time.t)
.call(() => { .call(() => {
this.stop()
this.timeoutFn && this.timeoutFn.forEach(f => f()) this.timeoutFn && this.timeoutFn.forEach(f => f())
}) })
......
import { PrizeShowPanel } from './PrizeShowPanel';
import { changeScene, showPanel } from './../../module/ctrls/index';
import { layers } from './../../module/views/layers'; import { layers } from './../../module/views/layers';
import { Panel } from "../../module/views/Panel"; import { Panel } from "../../module/views/Panel";
import UI from "../UI"; import UI from "../UI";
import { Tools } from '../Tools'; import { Tools } from '../Tools';
import { sendTbNet, TbNetName } from '../TaoBaoNet';
import { GameOverScene } from '../scenes/GameOverScene/GameOverScene';
export class GameOverPanel extends Panel { export class GameOverPanel extends Panel {
get groupNames() { get groupNames() {
return ["GameOverPanel"] return ["GameOverPanel"]
} }
bitmapTextCount: FYGE.BitmapText
initUi() { initUi() {
var panelCtn = UI.Ctn(this, (layers.stageWidth - 666) / 2, (1624 - 579)/2) var panelCtn = UI.Ctn(this)
UI.Sp(panelCtn, 'gg_back.png') UI.Sp(panelCtn, 'over-back.png')
panelCtn.position.set(layers.stageCenterX - panelCtn.width / 2, layers.stageCenterY - panelCtn.height / 2)
UI.Btn(panelCtn, 'back_index.png', function() { var bitMapc = Tools.getNumTextures('num')
console.log('返回首页') var bitMapc2 = Tools.getNumTextures('numb')
this.hidePanel() this.bitmapTextCount = panelCtn.addChild(new FYGE.BitmapText(bitMapc))
// 京东淘宝改动点 if (this.data.score < 10) {
if (my) { this.bitmapTextCount.textures = bitMapc2
// @ts-ignore
my.navigateBack()
} else {
// @ts-ignore
window.jdk._navigateBack()
} }
}, this, 60, 440) this.bitmapTextCount.position.set(panelCtn.width / 2, 230)
this.bitmapTextCount.scaleX = 0.5
this.bitmapTextCount.scaleY = 0.5
this.bitmapTextCount.text = this.data.score + ''
UI.Txt(panelCtn, '本次得分', 30, '#e95d2a', FYGE.TEXT_ALIGN.CENTER, panelCtn.width, 0, 320)
UI.Sp(panelCtn, 'over-tipsicon.png', panelCtn.width / 2, 420).anchorTexture.set(0.5, 0.5)
UI.Btn(panelCtn, 'one_more-btn.png', function(e) { var icon = UI.Sp(panelCtn, 'prize-icon1.png', panelCtn.width / 2, 580)
Tools.btnDelay(e.target) icon.anchorTexture.set(0.5, 0.5)
console.log('再来一局') icon.addEventListener(FYGE.MouseEvent.CLICK, async function() {
// 京东淘宝改动点 const {data, success} = await sendTbNet(TbNetName.drawLotteryPrize)
if (my) { if (success) {
// @ts-ignore if (data.type != 5) {
// 中奖了
this.hidePanel() this.hidePanel()
this.data.restart() showPanel(PrizeShowPanel, Object.assign({}, data, this.data))
} else { } else {
// @ts-ignore
window.jdk._startGame && window.jdk._startGame(() => {
this.hidePanel() this.hidePanel()
this.data.restart() changeScene(GameOverScene, this.data)
})
} }
}
}, this, 355, 440) }, this)
UI.Txt(panelCtn, this.data.score.toString(), 70, '#e8524b', FYGE.TEXT_ALIGN.CENTER, 300, 180, 320, true)
} }
} }
\ No newline at end of file
import { changeScene } from './../../module/ctrls/index';
import { showToast } from '../../module/ctrls';
import { layers } from '../../module/views/layers';
import UI from '../UI';
import { Panel } from './../../module/views/Panel';
import { GameOverScene } from '../scenes/GameOverScene/GameOverScene';
export class PrizeShowPanel extends Panel {
get groupNames(): string[] {
return ['PrizeShowPanel']
}
initUi() {
var panelCtn = UI.Ctn(this)
UI.Sp(panelCtn, 'prize-back.png')
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)
var preview = UI.Sp(panelCtn, decodeURI(this.data.image))
preview.width = 300
preview.height = 300
preview.position.set(150, 230)
preview.mask = panelCtn.addChild(new FYGE.Graphics())
.beginFill()
.drawRoundedRect(150, 230, 300, 300, 20)
.endFill()
UI.Btn(panelCtn, 'confirm-btn.png', function() {
if (this.data.type == 3) {
this.hidePanel()
changeScene(GameOverScene, this.data)
//@ts-ignore
my && my.navigateTo({
url: `/pages/rewardinfofill/rewardinfofill?id=${this.data.id}&prizeId=${this.data.prizeId}`
})
} else {
// @ts-ignore
showToast('奖品已为您发放至淘宝卡券~')
this.hidePanel()
changeScene(GameOverScene, this.data)
}
}, this, 40, 580)
}
}
\ No newline at end of file
import { layers } from "../../../module/views/layers"; import { layers } from "../../../module/views/layers";
import { Scene } from "../../../module/views/Scene"; import { Scene } from "../../../module/views/Scene";
import { sendTbNet, TbNetName } from "../../TaoBaoNet";
import { Tools } from "../../Tools"; import { Tools } from "../../Tools";
import UI from "../../UI"; import UI from "../../UI";
...@@ -16,7 +17,11 @@ export class GameOverScene extends Scene { ...@@ -16,7 +17,11 @@ export class GameOverScene extends Scene {
initUi() { initUi() {
UI.Sp(this, 'back.png') UI.Sp(this, 'back.png')
var bitMapc = Tools.getNumTextures('num') var bitMapc = Tools.getNumTextures('num')
var bitMapc2 = Tools.getNumTextures('numb')
this.bitmapTextCount = this.addChild(new FYGE.BitmapText(bitMapc)) this.bitmapTextCount = this.addChild(new FYGE.BitmapText(bitMapc))
if (this.data.score < 10) {
this.bitmapTextCount.textures = bitMapc2
}
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 + ''
...@@ -26,15 +31,36 @@ export class GameOverScene extends Scene { ...@@ -26,15 +31,36 @@ export class GameOverScene extends Scene {
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(this, 'share-btn.png', function() { UI.Btn(this, 'share-btn.png', function() {
console.log('点击了分享') // @ts-ignore todo 分享
my && my.showSharePanel()
}, this, 45, 950) }, this, 45, 950)
UI.Btn(this, 'more-btn.png', function() { UI.Btn(this, 'more-btn.png', function() {
console.log('点击了再来一次') // @ts-ignore
my.redirectTo({
url: '/pages/mainscene/mainscene'
})
}, this, 45, 1110) }, this, 45, 1110)
var _s = UI.Sp(this, 'back-home.png', layers.stageCenterX, 1350) var _s = UI.Sp(this, 'back-home.png', layers.stageCenterX, 1350)
_s.addEventListener(FYGE.MouseEvent.CLICK, function() {
// todo
console.log('回到主场')
})
_s.anchorTexture.set(0.5, 0.5) _s.anchorTexture.set(0.5, 0.5)
var bottomCont = UI.Ctn(this)
bottomCont.position.set(0, layers.stageOffsetY + layers.stageHeight - 130)
UI.Rect(bottomCont, layers.stageWidth, 130, 0xffffff)
UI.Sp(bottomCont, 'product-link__icon.png', 50, 25)
UI.Txt(bottomCont, 'Nike 瑜伽商品', 28, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 35)
UI.Txt(bottomCont, '让你的体态更加健康', 26, '#111111', FYGE.TEXT_ALIGN.LEFT, 500, 160, 75)
UI.Sp(bottomCont, 'jump-icon.png', 600, 40)
.addEventListener(FYGE.MouseEvent.CLICK, function() {
// @ts-ignore
// my.
console.log(this.data.productLink)
})
} }
} }
\ No newline at end of file
...@@ -22,6 +22,11 @@ function getSystemInfo():Promise<SystemInfo> { ...@@ -22,6 +22,11 @@ function getSystemInfo():Promise<SystemInfo> {
class DeviceMotion { class DeviceMotion {
subs: Array<SubType> = [] // 订阅 方法 subs: Array<SubType> = [] // 订阅 方法
private static _instance: DeviceMotion;
static get instance() {
return DeviceMotion._instance || (DeviceMotion._instance = new DeviceMotion())
}
constructor() { constructor() {
this.initEvents() this.initEvents()
} }
...@@ -67,6 +72,12 @@ class DeviceMotion { ...@@ -67,6 +72,12 @@ class DeviceMotion {
} }
} }
destory() {
this._tmdremoveEvents()
this.subs = []
DeviceMotion._instance = null
}
orientationHandler = (event) => { orientationHandler = (event) => {
const res = event const res = event
...@@ -101,6 +112,4 @@ class DeviceMotion { ...@@ -101,6 +112,4 @@ class DeviceMotion {
} }
} }
const deviceMotionSubs = new DeviceMotion() export default DeviceMotion
export default deviceMotionSubs
import { Tools } from './../../Tools';
import { changeScene, showPanel } from './../../../module/ctrls/index';
import { layers } from './../../../module/views/layers'; import { layers } from './../../../module/views/layers';
import UI from "../../UI" import UI from "../../UI"
import { GameCfg } from './GameConfig'; import { GameCfg } from './GameConfig';
import deviceMotionSubs from './DeviceMotion'; import DeviceMotion from './DeviceMotion';
import { GDispatcher } from '../../Main'; import { GDispatcher } from '../../Main';
import { MotionInitFunc, MotionInitScene } from './MotionInit'; import { MotionInitFunc, MotionInitScene } from './MotionInit';
import CountDownComp from '../../components/CountDownComp'; import CountDownComp from '../../components/CountDownComp';
import { RES } from '../../../module/RES'; import { RES } from '../../../module/RES';
import { sendTbNet, TbNetName } from '../../TaoBaoNet';
import { GameOverScene } from '../GameOverScene/GameOverScene';
import { GameOverPanel } from '../../panels/GameOverPanel';
const Container = FYGE.Container const Container = FYGE.Container
const TEXT_ALIGN = FYGE.TEXT_ALIGN const TEXT_ALIGN = FYGE.TEXT_ALIGN
...@@ -95,10 +100,14 @@ export class GameScene extends MotionInitScene { ...@@ -95,10 +100,14 @@ export class GameScene extends MotionInitScene {
var cdp = this.cdp = this.addChild(new CountDownComp(GameCfg.iTime)) var cdp = this.cdp = this.addChild(new CountDownComp(GameCfg.iTime))
this.cdp.addTimeoutFunc(() => { this.cdp.addTimeoutFunc(() => {
// this.cdp.visible = false this.cdp.visible = false
// 销毁 instance
DeviceMotion.instance.destory()
//@ts-ignore //@ts-ignore
my && my.showToast({ this.onSubmit({
content: '游戏结束' id: Tools.globalData.startId,
score: this.score
}) })
}) })
cdp.position.set(layers.stageCenterX - 105, layers.stageOffsetY + 260) cdp.position.set(layers.stageCenterX - 105, layers.stageOffsetY + 260)
...@@ -118,6 +127,28 @@ export class GameScene extends MotionInitScene { ...@@ -118,6 +127,28 @@ export class GameScene extends MotionInitScene {
})) }))
} }
async onSubmit(params) {
const {data, success} = await sendTbNet(TbNetName.submitGame, params)
if (success) {
const {score, isNewRecord, productLink, isWinPrize} = data
if (isWinPrize) {
showPanel(GameOverPanel, {
score,
isNewRecord,
productLink,
isWinPrize
})
} else {
changeScene(GameOverScene, {
score,
isNewRecord,
productLink,
isWinPrize
})
}
}
}
shoot() { shoot() {
this.cdp.stop() this.cdp.stop()
} }
...@@ -216,11 +247,11 @@ export class GameEle extends Container { ...@@ -216,11 +247,11 @@ export class GameEle extends Container {
} }
initEvents() { initEvents() {
deviceMotionSubs.notify(this.orientationChange, this) DeviceMotion.instance.notify(this.orientationChange, this)
} }
removeEvents() { removeEvents() {
deviceMotionSubs.off(this.orientationChange) DeviceMotion.instance.off(this.orientationChange)
} }
destroy() { destroy() {
...@@ -281,7 +312,7 @@ export class GameEle extends Container { ...@@ -281,7 +312,7 @@ export class GameEle extends Container {
// this.vy =0 // this.vy =0
// } // }
var sw = this.sprite.width / 4 var sw = this.sprite.width / 2
if (this.x > layers.stageWidth + layers.stageOffsetX - sw) { if (this.x > layers.stageWidth + layers.stageOffsetX - sw) {
this.x = layers.stageWidth + layers.stageOffsetX - sw this.x = layers.stageWidth + layers.stageOffsetX - sw
this.vx = 0 this.vx = 0
...@@ -290,7 +321,7 @@ export class GameEle extends Container { ...@@ -290,7 +321,7 @@ export class GameEle extends Container {
this.vx = 0 this.vx = 0
} }
var sh = this.sprite.height / 4 var sh = this.sprite.height / 2
if (this.y > layers.stageHeight + layers.stageOffsetY - sh) { if (this.y > layers.stageHeight + layers.stageOffsetY - sh) {
this.y = layers.stageHeight + layers.stageOffsetY - sh this.y = layers.stageHeight + layers.stageOffsetY - sh
this.vy = 0 this.vy = 0
......
...@@ -7,7 +7,7 @@ import { GDispatcher } from "../../Main" ...@@ -7,7 +7,7 @@ import { GDispatcher } from "../../Main"
import { Tools } from "../../Tools" import { Tools } from "../../Tools"
import UI from "../../UI" import UI from "../../UI"
import { setCenterPos } from "../../utils/utils" import { setCenterPos } from "../../utils/utils"
import deviceMotionSubs from "./DeviceMotion" import DeviceMotion from "./DeviceMotion"
import { GameCfg } from "./GameConfig" import { GameCfg } from "./GameConfig"
const Container = FYGE.Container const Container = FYGE.Container
const TEXT_ALIGN = FYGE.TEXT_ALIGN const TEXT_ALIGN = FYGE.TEXT_ALIGN
...@@ -73,12 +73,12 @@ export class MotionInitFunc extends Container { ...@@ -73,12 +73,12 @@ export class MotionInitFunc extends Container {
showGuidance() { showGuidance() {
this.maskCont.visible = true this.maskCont.visible = true
deviceMotionSubs.notify(this.deviceOritationChange, this) DeviceMotion.instance.notify(this.deviceOritationChange, this)
} }
hideGuidance() { hideGuidance() {
this.maskCont.visible = false this.maskCont.visible = false
deviceMotionSubs.off(this.deviceOritationChange) DeviceMotion.instance.off(this.deviceOritationChange)
} }
timer timer
......
...@@ -4,6 +4,7 @@ import { GameEle, GameScene } from "../GameScene/GameScene" ...@@ -4,6 +4,7 @@ import { GameEle, GameScene } from "../GameScene/GameScene"
import { MotionInitScene } from '../GameScene/MotionInit'; import { MotionInitScene } from '../GameScene/MotionInit';
import UI from '../../UI'; import UI from '../../UI';
import { RES } from '../../../module/RES'; import { RES } from '../../../module/RES';
import { sendTbNet, TbNetName } from '../../TaoBaoNet';
export function setCenterPos(cont: FYGE.Sprite) { export function setCenterPos(cont: FYGE.Sprite) {
cont.anchorTexture.set(0.5, 0.5) cont.anchorTexture.set(0.5, 0.5)
...@@ -37,8 +38,9 @@ export class NewGuyScene extends MotionInitScene { ...@@ -37,8 +38,9 @@ export class NewGuyScene extends MotionInitScene {
this.g1 = UI.Sp(this, 'guidance-t1.png', layers.stageCenterX, layers.stageCenterY + 400) this.g1 = UI.Sp(this, 'guidance-t1.png', layers.stageCenterX, layers.stageCenterY + 400)
this.g1.anchorTexture.set(0.5, 0.5) this.g1.anchorTexture.set(0.5, 0.5)
var e = this.addChild(new GameEle('p1.png', this.centerp, () => { var e = this.addChild(new GameEle('p1.png', this.centerp, async () => {
changeScene(GameScene) const {success} = await sendTbNet(TbNetName.complteGuidance)
success && changeScene(GameScene)
})) }))
} }
......
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