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'
// })
// })()
} }
} }
......
...@@ -2,903 +2,28 @@ export const ResJson = { ...@@ -2,903 +2,28 @@ export const ResJson = {
"groups": [ "groups": [
{ {
"keys": "countdown-back.png", "keys": "countdown-back.png",
"name": "CountDownComp", "name": "CountDownComp"
"atlas": {
"countdown-back.png": {
"x": 2,
"y": 2,
"w": 207,
"h": 57,
"ox": 0,
"oy": 0,
"sw": 207,
"sh": 57,
"ro": false
}
}
}, },
{ {
"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"
"atlas": {
"more-btn.png": {
"x": 2,
"y": 2,
"w": 655,
"h": 120,
"ox": 0,
"oy": 0,
"sw": 655,
"sh": 120,
"ro": false
},
"share-btn.png": {
"x": 2,
"y": 124,
"w": 655,
"h": 120,
"ox": 0,
"oy": 0,
"sw": 655,
"sh": 120,
"ro": false
},
"back-home.png": {
"x": 2,
"y": 246,
"w": 130,
"h": 43,
"ox": 0,
"oy": 0,
"sw": 130,
"sh": 43,
"ro": false
},
"new-record-icon.png": {
"x": 134,
"y": 246,
"w": 102,
"h": 37,
"ox": 0,
"oy": 0,
"sw": 102,
"sh": 37,
"ro": false
}
}
}, },
{ {
"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"
"atlas": {
"gg_back.png": {
"x": 2,
"y": 2,
"w": 667,
"h": 578,
"ox": 0,
"oy": 1,
"sw": 666,
"sh": 579,
"ro": false
},
"back_index.png": {
"x": 2,
"y": 582,
"w": 254,
"h": 74,
"ox": 0,
"oy": 0,
"sw": 254,
"sh": 74,
"ro": false
},
"one_more-btn.png": {
"x": 2,
"y": 658,
"w": 254,
"h": 75,
"ox": 0,
"oy": 0,
"sw": 254,
"sh": 75,
"ro": false
}
}
}, },
{ {
"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"
"atlas": {
"guidance-t1.png": {
"x": 2,
"y": 2,
"w": 574,
"h": 183,
"ox": 0,
"oy": 0,
"sw": 574,
"sh": 183,
"ro": false
},
"p12-b.png": {
"x": 2,
"y": 187,
"w": 335,
"h": 535,
"ox": 0,
"oy": 0,
"sw": 335,
"sh": 535,
"ro": true
},
"p12.png": {
"x": 2,
"y": 524,
"w": 335,
"h": 535,
"ox": 0,
"oy": 0,
"sw": 335,
"sh": 535,
"ro": true
},
"p20-b.png": {
"x": 578,
"y": 2,
"w": 287,
"h": 535,
"ox": 0,
"oy": 0,
"sw": 287,
"sh": 535,
"ro": false
},
"p20.png": {
"x": 2,
"y": 861,
"w": 287,
"h": 535,
"ox": 0,
"oy": 0,
"sw": 287,
"sh": 535,
"ro": true
},
"p11-b.png": {
"x": 867,
"y": 2,
"w": 496,
"h": 533,
"ox": 0,
"oy": 0,
"sw": 496,
"sh": 533,
"ro": false
},
"p11.png": {
"x": 867,
"y": 537,
"w": 496,
"h": 533,
"ox": 0,
"oy": 0,
"sw": 496,
"sh": 533,
"ro": false
},
"p13-b.png": {
"x": 2,
"y": 1150,
"w": 421,
"h": 533,
"ox": 0,
"oy": 0,
"sw": 421,
"sh": 533,
"ro": true
},
"p13.png": {
"x": 537,
"y": 1150,
"w": 421,
"h": 533,
"ox": 0,
"oy": 0,
"sw": 421,
"sh": 533,
"ro": true
},
"balance_guidance.png": {
"x": 539,
"y": 539,
"w": 258,
"h": 532,
"ox": 0,
"oy": 0,
"sw": 258,
"sh": 532,
"ro": false
},
"p3-b.png": {
"x": 1365,
"y": 2,
"w": 532,
"h": 520,
"ox": 0,
"oy": 0,
"sw": 532,
"sh": 520,
"ro": true
},
"p3.png": {
"x": 1365,
"y": 536,
"w": 532,
"h": 520,
"ox": 0,
"oy": 0,
"sw": 532,
"sh": 520,
"ro": true
},
"p9-b.png": {
"x": 1072,
"y": 1072,
"w": 487,
"h": 532,
"ox": 0,
"oy": 0,
"sw": 487,
"sh": 532,
"ro": true
},
"p9.png": {
"x": 2,
"y": 1573,
"w": 487,
"h": 532,
"ox": 0,
"oy": 0,
"sw": 487,
"sh": 532,
"ro": true
},
"p4-b.png": {
"x": 1072,
"y": 1561,
"w": 499,
"h": 531,
"ox": 0,
"oy": 0,
"sw": 499,
"sh": 531,
"ro": true
},
"p4.png": {
"x": 1605,
"y": 1561,
"w": 499,
"h": 531,
"ox": 0,
"oy": 0,
"sw": 499,
"sh": 531,
"ro": true
},
"p6-b.png": {
"x": 536,
"y": 1573,
"w": 526,
"h": 368,
"ox": 0,
"oy": 0,
"sw": 526,
"sh": 368,
"ro": false
},
"p6.png": {
"x": 1606,
"y": 1070,
"w": 526,
"h": 368,
"ox": 0,
"oy": 0,
"sw": 526,
"sh": 368,
"ro": false
},
"p2-b.png": {
"x": 2,
"y": 2062,
"w": 524,
"h": 518,
"ox": 0,
"oy": 0,
"sw": 524,
"sh": 518,
"ro": false
},
"p2.png": {
"x": 528,
"y": 2062,
"w": 524,
"h": 518,
"ox": 0,
"oy": 0,
"sw": 524,
"sh": 518,
"ro": false
},
"p18-b.png": {
"x": 1887,
"y": 2,
"w": 270,
"h": 521,
"ox": 0,
"oy": 0,
"sw": 270,
"sh": 521,
"ro": false
},
"p18.png": {
"x": 1887,
"y": 525,
"w": 270,
"h": 521,
"ox": 0,
"oy": 0,
"sw": 270,
"sh": 521,
"ro": false
},
"p10-b.png": {
"x": 1054,
"y": 2062,
"w": 502,
"h": 513,
"ox": 0,
"oy": 0,
"sw": 502,
"sh": 513,
"ro": false
},
"p10.png": {
"x": 1558,
"y": 2062,
"w": 502,
"h": 513,
"ox": 0,
"oy": 0,
"sw": 502,
"sh": 513,
"ro": false
},
"p5-b.png": {
"x": 2062,
"y": 2062,
"w": 460,
"h": 513,
"ox": 0,
"oy": 0,
"sw": 460,
"sh": 513,
"ro": false
},
"p5.png": {
"x": 2134,
"y": 1048,
"w": 460,
"h": 513,
"ox": 0,
"oy": 0,
"sw": 460,
"sh": 513,
"ro": true
},
"p15-b.png": {
"x": 2138,
"y": 1510,
"w": 499,
"h": 463,
"ox": 0,
"oy": 0,
"sw": 499,
"sh": 463,
"ro": true
},
"p15.png": {
"x": 2159,
"y": 2,
"w": 499,
"h": 463,
"ox": 0,
"oy": 0,
"sw": 499,
"sh": 463,
"ro": false
},
"p14-b.png": {
"x": 2159,
"y": 467,
"w": 438,
"h": 460,
"ox": 0,
"oy": 0,
"sw": 438,
"sh": 460,
"ro": false
},
"p14.png": {
"x": 2,
"y": 2582,
"w": 438,
"h": 460,
"ox": 0,
"oy": 0,
"sw": 438,
"sh": 460,
"ro": true
},
"p8-b.png": {
"x": 2524,
"y": 2011,
"w": 308,
"h": 460,
"ox": 0,
"oy": 0,
"sw": 308,
"sh": 460,
"ro": false
},
"p8.png": {
"x": 2524,
"y": 2473,
"w": 308,
"h": 460,
"ox": 0,
"oy": 0,
"sw": 308,
"sh": 460,
"ro": false
}, },
"p7-b.png": { {
"x": 1054, "keys": "confirm-btn.png,prize-back.png",
"y": 2577, "name": "PrizeShowPanel"
"w": 426,
"h": 443,
"ox": 0,
"oy": 0,
"sw": 426,
"sh": 443,
"ro": false
},
"p7.png": {
"x": 1482,
"y": 2577,
"w": 426,
"h": 443,
"ox": 0,
"oy": 0,
"sw": 426,
"sh": 443,
"ro": false
},
"p17-b.png": {
"x": 464,
"y": 2582,
"w": 434,
"h": 398,
"ox": 0,
"oy": 0,
"sw": 434,
"sh": 398,
"ro": true
},
"p17.png": {
"x": 1910,
"y": 2577,
"w": 434,
"h": 398,
"ox": 0,
"oy": 0,
"sw": 434,
"sh": 398,
"ro": true
},
"p19-b.png": {
"x": 2834,
"y": 2,
"w": 416,
"h": 364,
"ox": 0,
"oy": 0,
"sw": 416,
"sh": 364,
"ro": true
},
"p19.png": {
"x": 2834,
"y": 420,
"w": 416,
"h": 364,
"ox": 0,
"oy": 0,
"sw": 416,
"sh": 364,
"ro": true
},
"p16-b.png": {
"x": 2834,
"y": 838,
"w": 406,
"h": 360,
"ox": 0,
"oy": 0,
"sw": 406,
"sh": 360,
"ro": true
},
"p16.png": {
"x": 2834,
"y": 1246,
"w": 406,
"h": 360,
"ox": 0,
"oy": 0,
"sw": 406,
"sh": 360,
"ro": true
},
"p1-b.png": {
"x": 2834,
"y": 1654,
"w": 321,
"h": 368,
"ox": 0,
"oy": 0,
"sw": 321,
"sh": 368,
"ro": true
},
"p1.png": {
"x": 2834,
"y": 1977,
"w": 321,
"h": 368,
"ox": 0,
"oy": 0,
"sw": 321,
"sh": 368,
"ro": true
},
"num0.png": {
"x": 2603,
"y": 1510,
"w": 160,
"h": 226,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 226,
"ro": true
},
"num3.png": {
"x": 2603,
"y": 1672,
"w": 151,
"h": 226,
"ox": 0,
"oy": 0,
"sw": 151,
"sh": 226,
"ro": true
},
"num8.png": {
"x": 2603,
"y": 1825,
"w": 154,
"h": 226,
"ox": 0,
"oy": 0,
"sw": 154,
"sh": 226,
"ro": true
},
"numb0.png": {
"x": 2599,
"y": 467,
"w": 160,
"h": 226,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 226,
"ro": true
},
"numb3.png": {
"x": 2599,
"y": 629,
"w": 151,
"h": 226,
"ox": 0,
"oy": 0,
"sw": 151,
"sh": 226,
"ro": true
},
"numb8.png": {
"x": 2599,
"y": 782,
"w": 154,
"h": 226,
"ox": 0,
"oy": 0,
"sw": 154,
"sh": 226,
"ro": true
},
"num2.png": {
"x": 2660,
"y": 2,
"w": 155,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 155,
"sh": 222,
"ro": false
},
"num5.png": {
"x": 2660,
"y": 226,
"w": 148,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 148,
"sh": 222,
"ro": false
},
"num6.png": {
"x": 2649,
"y": 938,
"w": 153,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 153,
"sh": 222,
"ro": false
},
"num9.png": {
"x": 2649,
"y": 1162,
"w": 153,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 153,
"sh": 222,
"ro": false
},
"numb2.png": {
"x": 864,
"y": 2582,
"w": 155,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 155,
"sh": 222,
"ro": false
},
"numb5.png": {
"x": 2310,
"y": 2577,
"w": 148,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 148,
"sh": 222,
"ro": false
},
"numb6.png": {
"x": 2834,
"y": 2300,
"w": 153,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 153,
"sh": 222,
"ro": true
},
"numb9.png": {
"x": 3058,
"y": 2300,
"w": 153,
"h": 222,
"ox": 0,
"oy": 0,
"sw": 153,
"sh": 222,
"ro": false
},
"num1.png": {
"x": 2310,
"y": 2801,
"w": 94,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 94,
"sh": 218,
"ro": false
},
"num4.png": {
"x": 2834,
"y": 2455,
"w": 162,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 162,
"sh": 218,
"ro": true
},
"num7.png": {
"x": 2834,
"y": 2619,
"w": 163,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 163,
"sh": 218,
"ro": true
},
"numb1.png": {
"x": 2406,
"y": 2801,
"w": 94,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 94,
"sh": 218,
"ro": false
},
"numb4.png": {
"x": 2834,
"y": 2784,
"w": 162,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 162,
"sh": 218,
"ro": false
},
"numb7.png": {
"x": 2998,
"y": 2784,
"w": 163,
"h": 218,
"ox": 0,
"oy": 0,
"sw": 163,
"sh": 218,
"ro": false
},
"numbp.png": {
"x": 1606,
"y": 1440,
"w": 118,
"h": 128,
"ox": 0,
"oy": 0,
"sw": 118,
"sh": 128,
"ro": true
},
"nump.png": {
"x": 1736,
"y": 1440,
"w": 118,
"h": 128,
"ox": 0,
"oy": 0,
"sw": 118,
"sh": 128,
"ro": true
}
}
}, },
{ {
"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"
"atlas": {
"back.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 1624,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 1624,
"ro": false
},
"com_light.png": {
"x": 754,
"y": 2,
"w": 746,
"h": 756,
"ox": 0,
"oy": 0,
"sw": 746,
"sh": 756,
"ro": false
},
"toastBg.png": {
"x": 754,
"y": 760,
"w": 460,
"h": 130,
"ox": 0,
"oy": 0,
"sw": 460,
"sh": 130,
"ro": false
},
"waitingBg.png": {
"x": 1216,
"y": 760,
"w": 160,
"h": 180,
"ox": 0,
"oy": 0,
"sw": 160,
"sh": 180,
"ro": true
},
"跳过按钮.png": {
"x": 1398,
"y": 760,
"w": 123,
"h": 57,
"ox": 0,
"oy": 0,
"sw": 123,
"sh": 57,
"ro": true
},
"comCloseBtn.png": {
"x": 1398,
"y": 885,
"w": 72,
"h": 72,
"ox": 0,
"oy": 0,
"sw": 72,
"sh": 72,
"ro": false
},
"waitingRot.png": {
"x": 754,
"y": 892,
"w": 56,
"h": 56,
"ox": 0,
"oy": 0,
"sw": 56,
"sh": 56,
"ro": false
}
}
} }
], ],
"path": "https://yun.duiba.com.cn/db_games/activity/template/1628512488/resource/" "path": "./resource/"
} }
\ No newline at end of file
...@@ -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