Commit eb09ec18 authored by Master Q's avatar Master Q

813 游戏确认

parent 1c5772e1
This diff is collapsed.
resource/GameOverPanel/prize-icon1.png

7.64 KB | W: | H:

resource/GameOverPanel/prize-icon1.png

49.5 KB | W: | H:

resource/GameOverPanel/prize-icon1.png
resource/GameOverPanel/prize-icon1.png
resource/GameOverPanel/prize-icon1.png
resource/GameOverPanel/prize-icon1.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -9,7 +9,7 @@
"name": "GameOver"
},
{
"keys": "over-back.png,over-tipsicon.png,prize-icon1.png",
"keys": "over-back.png,over-tipsicon.png,prize-icon1.png,prize-icon2.png,prize-icon3.png",
"name": "GameOverPanel"
},
{
......@@ -20,6 +20,10 @@
"keys": "confirm-btn.png,prize-back.png",
"name": "PrizeShowPanel"
},
{
"keys": "12b9628f-0c5a-49be-9f00-c7f62387cec7.png,261235a9-61cf-40fb-af98-cdf1ced9778b.png,28cede68-743e-4d46-a055-d6e8736aab5a.png,333eac73-d4e6-4da1-a213-8c81ca234caa.png,40386850-f496-4fe2-bb14-aec96c1a8b61.png,43460abf-48cd-43dd-9e72-e465954608b7.png,446f4c57-072a-438f-bbf2-b3e399e2eba3.png,458845e6-748b-4a52-89ff-79c3bd59ca91.png,4c550308-e250-4bef-925c-e985bb61c4ff.png,5a9a15c8-17bf-44d7-8ffa-fd9633bb1ce3.png,5c80f674-ba5f-40c2-9c90-2efefd60417d.png,5eebb359-b49b-4451-afd6-e07b434c4c03.png,67c83ee1-83eb-4642-9f74-0eee9888fd91.png,8cd45674-a8f4-41a5-8917-6913e1321deb.png,af0c1ed5-6e1c-4969-98fd-f78f1b4264a2.png,b7cfbac8-199e-4f7c-bfb5-4d60bd213b32.png,c0880282-4472-4478-8237-938cf998e4b6.png,c8f20379-7b70-4b48-9900-4b0063446622.png,e344aae7-0859-4e1f-b814-289825f71a8d.png,f43c377b-156e-435f-a830-95e668901412.png,fef72c71-217c-47c2-9428-576069f1e6b1.png",
"name": "balance_guidance"
},
{
"keys": "back.png,comCloseBtn.png,com_light.png,toastBg.png,waitingBg.png,waitingRot.png,跳过按钮.png",
"name": "common"
......
......@@ -189,7 +189,7 @@ export class Main {
// MusicBtn.changeMusicStatus(true); // TODO 进游戏打开音乐先
// (function() {
// showPanel(GameOverPanel, {
// changeScene(GameOverScene, {
// score: '1'
// })
// })()
......
......@@ -90,7 +90,7 @@ export const ResJson = {
}
},
{
"keys": "over-back.png,over-tipsicon.png,prize-icon1.png",
"keys": "over-back.png,over-tipsicon.png,prize-icon1.png,prize-icon2.png,prize-icon3.png",
"name": "GameOverPanel",
"atlas": {
"over-back.png": {
......@@ -104,7 +104,7 @@ export const ResJson = {
"sh": 804,
"ro": false
},
"prize-icon1.png": {
"prize-icon3.png": {
"x": 594,
"y": 2,
"w": 464,
......@@ -115,9 +115,31 @@ export const ResJson = {
"sh": 220,
"ro": true
},
"over-tipsicon.png": {
"prize-icon2.png": {
"x": 594,
"y": 468,
"w": 463,
"h": 220,
"ox": 0,
"oy": 0,
"sw": 463,
"sh": 220,
"ro": true
},
"prize-icon1.png": {
"x": 2,
"y": 808,
"w": 412,
"h": 195,
"ox": 0,
"oy": 0,
"sw": 412,
"sh": 195,
"ro": false
},
"over-tipsicon.png": {
"x": 416,
"y": 808,
"w": 172,
"h": 37,
"ox": 0,
......@@ -866,6 +888,243 @@ export const ResJson = {
}
}
},
{
"keys": "12b9628f-0c5a-49be-9f00-c7f62387cec7.png,261235a9-61cf-40fb-af98-cdf1ced9778b.png,28cede68-743e-4d46-a055-d6e8736aab5a.png,333eac73-d4e6-4da1-a213-8c81ca234caa.png,40386850-f496-4fe2-bb14-aec96c1a8b61.png,43460abf-48cd-43dd-9e72-e465954608b7.png,446f4c57-072a-438f-bbf2-b3e399e2eba3.png,458845e6-748b-4a52-89ff-79c3bd59ca91.png,4c550308-e250-4bef-925c-e985bb61c4ff.png,5a9a15c8-17bf-44d7-8ffa-fd9633bb1ce3.png,5c80f674-ba5f-40c2-9c90-2efefd60417d.png,5eebb359-b49b-4451-afd6-e07b434c4c03.png,67c83ee1-83eb-4642-9f74-0eee9888fd91.png,8cd45674-a8f4-41a5-8917-6913e1321deb.png,af0c1ed5-6e1c-4969-98fd-f78f1b4264a2.png,b7cfbac8-199e-4f7c-bfb5-4d60bd213b32.png,c0880282-4472-4478-8237-938cf998e4b6.png,c8f20379-7b70-4b48-9900-4b0063446622.png,e344aae7-0859-4e1f-b814-289825f71a8d.png,f43c377b-156e-435f-a830-95e668901412.png,fef72c71-217c-47c2-9428-576069f1e6b1.png",
"name": "balance_guidance",
"atlas": {
"5a9a15c8-17bf-44d7-8ffa-fd9633bb1ce3.png": {
"x": 2,
"y": 2,
"w": 186,
"h": 124,
"ox": 0,
"oy": 0,
"sw": 186,
"sh": 124,
"ro": false
},
"c0880282-4472-4478-8237-938cf998e4b6.png": {
"x": 2,
"y": 128,
"w": 186,
"h": 127,
"ox": 0,
"oy": 0,
"sw": 186,
"sh": 127,
"ro": false
},
"f43c377b-156e-435f-a830-95e668901412.png": {
"x": 190,
"y": 2,
"w": 185,
"h": 122,
"ox": 0,
"oy": 0,
"sw": 185,
"sh": 122,
"ro": true
},
"fef72c71-217c-47c2-9428-576069f1e6b1.png": {
"x": 2,
"y": 257,
"w": 185,
"h": 129,
"ox": 0,
"oy": 1,
"sw": 185,
"sh": 130,
"ro": false
},
"333eac73-d4e6-4da1-a213-8c81ca234caa.png": {
"x": 314,
"y": 2,
"w": 182,
"h": 134,
"ox": 0,
"oy": 0,
"sw": 182,
"sh": 134,
"ro": true
},
"446f4c57-072a-438f-bbf2-b3e399e2eba3.png": {
"x": 189,
"y": 257,
"w": 182,
"h": 125,
"ox": 0,
"oy": 0,
"sw": 182,
"sh": 125,
"ro": false
},
"4c550308-e250-4bef-925c-e985bb61c4ff.png": {
"x": 2,
"y": 388,
"w": 92,
"h": 182,
"ox": 0,
"oy": 0,
"sw": 92,
"sh": 182,
"ro": true
},
"e344aae7-0859-4e1f-b814-289825f71a8d.png": {
"x": 189,
"y": 384,
"w": 94,
"h": 182,
"ox": 0,
"oy": 0,
"sw": 94,
"sh": 182,
"ro": true
},
"b7cfbac8-199e-4f7c-bfb5-4d60bd213b32.png": {
"x": 450,
"y": 2,
"w": 94,
"h": 181,
"ox": 0,
"oy": 0,
"sw": 94,
"sh": 181,
"ro": false
},
"12b9628f-0c5a-49be-9f00-c7f62387cec7.png": {
"x": 373,
"y": 186,
"w": 179,
"h": 126,
"ox": 0,
"oy": 0,
"sw": 179,
"sh": 126,
"ro": true
},
"28cede68-743e-4d46-a055-d6e8736aab5a.png": {
"x": 2,
"y": 482,
"w": 177,
"h": 129,
"ox": 0,
"oy": 0,
"sw": 177,
"sh": 129,
"ro": false
},
"40386850-f496-4fe2-bb14-aec96c1a8b61.png": {
"x": 373,
"y": 367,
"w": 177,
"h": 137,
"ox": 0,
"oy": 0,
"sw": 177,
"sh": 137,
"ro": true
},
"458845e6-748b-4a52-89ff-79c3bd59ca91.png": {
"x": 546,
"y": 2,
"w": 177,
"h": 142,
"ox": 0,
"oy": 0,
"sw": 177,
"sh": 142,
"ro": true
},
"5c80f674-ba5f-40c2-9c90-2efefd60417d.png": {
"x": 181,
"y": 482,
"w": 177,
"h": 129,
"ox": 0,
"oy": 0,
"sw": 177,
"sh": 129,
"ro": false
},
"8cd45674-a8f4-41a5-8917-6913e1321deb.png": {
"x": 546,
"y": 181,
"w": 177,
"h": 141,
"ox": 0,
"oy": 0,
"sw": 177,
"sh": 141,
"ro": true
},
"af0c1ed5-6e1c-4969-98fd-f78f1b4264a2.png": {
"x": 512,
"y": 360,
"w": 98,
"h": 174,
"ox": 0,
"oy": 0,
"sw": 98,
"sh": 174,
"ro": true
},
"c8f20379-7b70-4b48-9900-4b0063446622.png": {
"x": 512,
"y": 460,
"w": 170,
"h": 151,
"ox": 0,
"oy": 0,
"sw": 170,
"sh": 151,
"ro": false
},
"261235a9-61cf-40fb-af98-cdf1ced9778b.png": {
"x": 2,
"y": 613,
"w": 100,
"h": 163,
"ox": 0,
"oy": 0,
"sw": 100,
"sh": 163,
"ro": true
},
"43460abf-48cd-43dd-9e72-e465954608b7.png": {
"x": 167,
"y": 613,
"w": 106,
"h": 94,
"ox": 0,
"oy": 0,
"sw": 106,
"sh": 94,
"ro": false
},
"5eebb359-b49b-4451-afd6-e07b434c4c03.png": {
"x": 275,
"y": 613,
"w": 106,
"h": 94,
"ox": 0,
"oy": 0,
"sw": 106,
"sh": 94,
"ro": false
},
"67c83ee1-83eb-4642-9f74-0eee9888fd91.png": {
"x": 383,
"y": 613,
"w": 106,
"h": 95,
"ox": 0,
"oy": 0,
"sw": 106,
"sh": 95,
"ro": false
}
}
},
{
"keys": "back.png,comCloseBtn.png,com_light.png,toastBg.png,waitingBg.png,waitingRot.png,跳过按钮.png",
"name": "common",
......@@ -950,5 +1209,5 @@ export const ResJson = {
}
}
],
"path": "https://yun.duiba.com.cn/db_games/activity/template/1628665628/resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/template/1628824025/resource/"
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ export enum TbNetName {
* 埋点统计
* activityId type
*/
addData = "xunzai.addStat",
addData = "yoga.addStat",
/**
* 活动基本信息
* activityId
......
export const balance_guidance = {
"fr": 15,
"ip": 0,
"op": 21,
"w": 420,
"h": 330,
"nm": "引导",
"layers": [
{
"ind": 1,
"ty": 2,
"nm": "引导_00.png",
"refId": "4c550308-e250-4bef-925c-e985bb61c4ff",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
210,
166,
0
]
},
"a": {
"k": [
46,
91,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 0,
"op": 1
},
{
"ind": 2,
"ty": 2,
"nm": "引导_01.png",
"refId": "e344aae7-0859-4e1f-b814-289825f71a8d",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
210,
166,
0
]
},
"a": {
"k": [
47,
91,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 1,
"op": 2
},
{
"ind": 3,
"ty": 2,
"nm": "引导_02.png",
"refId": "b7cfbac8-199e-4f7c-bfb5-4d60bd213b32",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
210,
167.5,
0
]
},
"a": {
"k": [
47,
90.5,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 2,
"op": 3
},
{
"ind": 4,
"ty": 2,
"nm": "引导_03.png",
"refId": "af0c1ed5-6e1c-4969-98fd-f78f1b4264a2",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
210,
170,
0
]
},
"a": {
"k": [
49,
87,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 3,
"op": 4
},
{
"ind": 5,
"ty": 2,
"nm": "引导_04.png",
"refId": "261235a9-61cf-40fb-af98-cdf1ced9778b",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
210,
171.5,
0
]
},
"a": {
"k": [
50,
81.5,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 4,
"op": 5
},
{
"ind": 6,
"ty": 2,
"nm": "引导_05.png",
"refId": "c8f20379-7b70-4b48-9900-4b0063446622",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
244,
172.5,
0
]
},
"a": {
"k": [
85,
75.5,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 5,
"op": 6
},
{
"ind": 7,
"ty": 2,
"nm": "引导_06.png",
"refId": "458845e6-748b-4a52-89ff-79c3bd59ca91",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
247.5,
173,
0
]
},
"a": {
"k": [
88.5,
71,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 6,
"op": 7
},
{
"ind": 8,
"ty": 2,
"nm": "引导_07.png",
"refId": "333eac73-d4e6-4da1-a213-8c81ca234caa",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
249,
173,
0
]
},
"a": {
"k": [
91,
67,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 7,
"op": 8
},
{
"ind": 9,
"ty": 2,
"nm": "引导_08.png",
"refId": "fef72c71-217c-47c2-9428-576069f1e6b1",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
250.5,
174,
0
]
},
"a": {
"k": [
92.5,
65,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 8,
"op": 9
},
{
"ind": 10,
"ty": 2,
"nm": "引导_09.png",
"refId": "c0880282-4472-4478-8237-938cf998e4b6",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
251,
175.5,
0
]
},
"a": {
"k": [
93,
63.5,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 9,
"op": 10
},
{
"ind": 11,
"ty": 2,
"nm": "引导_10.png",
"refId": "5a9a15c8-17bf-44d7-8ffa-fd9633bb1ce3",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
250,
177,
0
]
},
"a": {
"k": [
93,
62,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 10,
"op": 11
},
{
"ind": 12,
"ty": 2,
"nm": "引导_11.png",
"refId": "f43c377b-156e-435f-a830-95e668901412",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
249.5,
178,
0
]
},
"a": {
"k": [
92.5,
61,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 11,
"op": 12
},
{
"ind": 13,
"ty": 2,
"nm": "引导_12.png",
"refId": "446f4c57-072a-438f-bbf2-b3e399e2eba3",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
248,
172.5,
0
]
},
"a": {
"k": [
91,
62.5,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 12,
"op": 13
},
{
"ind": 14,
"ty": 2,
"nm": "引导_13.png",
"refId": "12b9628f-0c5a-49be-9f00-c7f62387cec7",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
246.5,
161,
0
]
},
"a": {
"k": [
89.5,
63,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 13,
"op": 14
},
{
"ind": 15,
"ty": 2,
"nm": "引导_14.png",
"refId": "40386850-f496-4fe2-bb14-aec96c1a8b61",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
245.5,
154.5,
0
]
},
"a": {
"k": [
88.5,
68.5,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 14,
"op": 15
},
{
"ind": 16,
"ty": 2,
"nm": "引导_15.png",
"refId": "8cd45674-a8f4-41a5-8917-6913e1321deb",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
245.5,
150.5,
0
]
},
"a": {
"k": [
88.5,
70.5,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 15,
"op": 16
},
{
"ind": 17,
"ty": 2,
"nm": "引导_16.png",
"refId": "28cede68-743e-4d46-a055-d6e8736aab5a",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
245.5,
155.5,
0
]
},
"a": {
"k": [
88.5,
64.5,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 16,
"op": 17
},
{
"ind": 18,
"ty": 2,
"nm": "引导_17.png",
"refId": "5c80f674-ba5f-40c2-9c90-2efefd60417d",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
245.5,
155.5,
0
]
},
"a": {
"k": [
88.5,
64.5,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 17,
"op": 18
},
{
"ind": 19,
"ty": 2,
"nm": "引导_18.png",
"refId": "67c83ee1-83eb-4642-9f74-0eee9888fd91",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
210,
171.5,
0
]
},
"a": {
"k": [
53,
47.5,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 18,
"op": 19
},
{
"ind": 20,
"ty": 2,
"nm": "引导_19.png",
"refId": "5eebb359-b49b-4451-afd6-e07b434c4c03",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
210,
172,
0
]
},
"a": {
"k": [
53,
47,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 19,
"op": 20
},
{
"ind": 21,
"ty": 2,
"nm": "引导_20.png",
"refId": "43460abf-48cd-43dd-9e72-e465954608b7",
"ks": {
"o": {
"k": 100
},
"r": {
"k": 0
},
"p": {
"k": [
210,
172,
0
]
},
"a": {
"k": [
53,
47,
0
]
},
"s": {
"k": [
100,
100,
100
]
}
},
"ip": 20,
"op": 21
}
],
"markers": [],
"tiny": 0.55
}
\ No newline at end of file
......@@ -9,7 +9,7 @@ import { GameOverScene } from '../scenes/GameOverScene/GameOverScene';
export class GameOverPanel extends Panel {
get groupNames() {
return ["GameOverPanel"]
return ["GameOverPanel", "GameScene"]
}
bitmapTextCount: FYGE.BitmapText
......@@ -33,7 +33,7 @@ export class GameOverPanel extends Panel {
UI.Sp(panelCtn, 'over-tipsicon.png', panelCtn.width / 2, 420).anchorTexture.set(0.5, 0.5)
var icon = UI.Sp(panelCtn, 'prize-icon1.png', panelCtn.width / 2, 580)
var icon = UI.Sp(panelCtn, `prize-icon${this.data.level || 1}.png`, panelCtn.width / 2, 580)
icon.anchorTexture.set(0.5, 0.5)
icon.addEventListener(FYGE.MouseEvent.CLICK, async function() {
this.btnDelay(this)
......@@ -45,6 +45,10 @@ export class GameOverPanel extends Panel {
showPanel(PrizeShowPanel, Object.assign({}, data, this.data))
} else {
this.hidePanel()
// @ts-ignore
my && my.showToast({
content: '很遗憾,谢谢参与'
})
changeScene(GameOverScene, this.data)
}
}
......
import { layers } from "../../../module/views/layers";
import { Scene } from "../../../module/views/Scene";
import { sendTbNet, TbNetName } from "../../TaoBaoNet";
import { addData, sendTbNet, TbNetName } from "../../TaoBaoNet";
import { Tools } from "../../Tools";
import UI from "../../UI";
export class GameOverScene extends Scene {
bitmapTextCount: FYGE.BitmapText
scrollPage: FYGE.ScrollPage
get groupNames():string[] {
return ['GameOver', 'GameScene']
}
......@@ -16,26 +18,31 @@ export class GameOverScene extends Scene {
initUi() {
UI.Sp(this, 'back.png')
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 bitMapc2 = Tools.getNumTextures('numb')
this.bitmapTextCount = this.addChild(new FYGE.BitmapText(bitMapc))
this.bitmapTextCount = scrollPageView.addChild(new FYGE.BitmapText(bitMapc))
if (this.data.score < 10) {
this.bitmapTextCount.textures = bitMapc2
}
this.bitmapTextCount.position.set(layers.stageCenterX, 500)
this.bitmapTextCount.text = this.data.score + ''
var desc = UI.Ctn(this, 0, 700)
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)
UI.Btn(this, 'share-btn.png', function() {
UI.Btn(scrollPageView, 'share-btn.png', function() {
// @ts-ignore todo 分享
my && my.showSharePanel()
addData(2)
}, this, 45, 950)
UI.Btn(this, 'more-btn.png', function() {
UI.Btn(scrollPageView, 'more-btn.png', function() {
this.btnDelay(this)
// @ts-ignore
my.reLaunch({
......@@ -43,9 +50,10 @@ export class GameOverScene extends Scene {
})
}, this, 45, 1110)
var _s = UI.Sp(this, 'back-home.png', layers.stageCenterX, 1350)
var _s = UI.Sp(scrollPageView, 'back-home.png', layers.stageCenterX, 1350)
_s.addEventListener(FYGE.MouseEvent.CLICK, function() {
this.btnDelay(this)
addData(8)
// todo
console.log('回到主场')
}, this)
......@@ -60,9 +68,11 @@ export class GameOverScene extends Scene {
UI.Sp(bottomCont, 'jump-icon.png', 600, 40)
.addEventListener(FYGE.MouseEvent.CLICK, function() {
this.btnDelay(this)
addData(7)
// @ts-ignore
// my.
console.log(this.data.productLink)
sendTbNet(TbNetName.navigateToOutside, {
url: this.data.productLink
})
}, this)
}
......
......@@ -3,9 +3,9 @@ export const GameCfg = {
ispeed: 0, // 初速度
fpsScale: 1000 / 60, // 帧变数
resisteAcc: 0.04, // 摩擦力反加速度
rc: 40, // 误差值,距离中心点的误差值
rc: 400, // 误差值,距离中心点的误差值
duanpingValue: 8 / 180 * Math.PI, // 默认小于 8 度就算端平
iTime: 12000, // 初始化游戏时间
iTime: 6000, // 初始化游戏时间
rt: 1000 //每次递减
}
\ No newline at end of file
......@@ -16,6 +16,31 @@ import { GameOverPanel } from '../../panels/GameOverPanel';
const Container = FYGE.Container
const TEXT_ALIGN = FYGE.TEXT_ALIGN
//二维向量定义
const Vector2 = function(x, y) { this.x = x; this.y = y; };
Vector2.prototype = {
// 辅助一个向量
copy: function() { return new Vector2(this.x, this.y); },
// 向量的模()长度
length: function() { return Math.sqrt(this.x * this.x + this.y * this.y); },
sqrLength: function() { return this.x * this.x + this.y * this.y; },
// 向量的单位向量
normalize: function() { var inv = 1 / this.length(); return new Vector2(this.x * inv, this.y * inv); },
// 相反向量
negate: function() { return new Vector2(-this.x, -this.y); },
// 向量相加
add: function(v) { return new Vector2(this.x + v.x, this.y + v.y); },
// 向量相减
subtract: function(v) { return new Vector2(this.x - v.x, this.y - v.y); },
// 向量数量乘法
multiply: function(f) { return new Vector2(this.x * f, this.y * f); },
// 向量数量除法
divide: function(f) { var invf = 1 / f; return new Vector2(this.x * invf, this.y * invf); },
// 向量的点乘(内机)dot
dot: function(v) { return this.x * v.x + this.y * v.y; }
};
/**
* 简单的一个函数防抖
* @param func
......@@ -103,6 +128,8 @@ export class GameScene extends MotionInitScene {
this.cdp.destory()
// 销毁 instance
DeviceMotion.instance.destory()
this.gameEle && this.gameEle.freeze()
FYGE.Tween.removeAllTweens()
//@ts-ignore
this.onSubmit({
id: Tools.globalData.startId,
......@@ -186,6 +213,7 @@ export class GameEle extends Container {
fixedCenter: pos // 判断点坐标
finishFunc: Function // success callback
sprite: FYGE.Sprite | FYGE.Shape
freezed: boolean = false // 冻结
/**
* 是否固定在页面上
......@@ -230,6 +258,7 @@ export class GameEle extends Container {
}
resetInit(tName: string) {
this.isIn = false
this.sprite.texture = RES.getRes(tName)
var posList = [
{
......@@ -277,7 +306,51 @@ export class GameEle extends Container {
return this.sprite.rotation
}
freeze() {
this.freezed = true
}
updateFrameFunc() {
var len = pos2Len(this, this.fixedCenter)
this.setRotation(this.k * (len))
var v2 = new Vector2(this.vx, this.vy)
var a2 = new Vector2(this.accx, this.accy)
if (this.isIn && a2.length() < GameCfg.acc * 0.5) return
// 数量积运算 lenA*lanB*cos = A * B = A.x*B.x + A.
if (len <= GameCfg.rc) {
if (a2.length() < GameCfg.acc * 0.5) {
if (v2.length() < 3 && !this.isIn) {
console.log('吸附')
this.isIn = true
this.vx = 0
this.vy = 0
FYGE.Tween.get(this)
.to({
x: this.fixedCenter.x,
y: this.fixedCenter.y
}, GameCfg.rc)
.call(() => {
GDispatcher.dispatchEvent('focus-in', () => {
this.finishFunc()
})
})
}
} else {
if (this.isIn) {
console.log('取消吸附')
this.isIn = false
FYGE.Tween.removeTweens(this)
GDispatcher.dispatchEvent('focus-out')
}
}
}
var nt = Date.now()
if (!this.lt) {
this.lt = nt
......@@ -309,13 +382,13 @@ export class GameEle extends Container {
this.x += this.vx * pt
this.y += this.vy * pt
// if(Math.abs(this.accx)<.01 && Math.abs(this.vx)<0.2){
// this.vx =0
// }
if(Math.abs(this.accx)<.01 && Math.abs(this.vx)<0.2){
this.vx =0
}
// if(Math.abs(this.accy)<.01 && Math.abs(this.vy)<0.2){
// this.vy =0
// }
if(Math.abs(this.accy)<.01 && Math.abs(this.vy)<0.2){
this.vy =0
}
var sw = this.sprite.width / 2
if (this.x > layers.stageWidth + layers.stageOffsetX - sw) {
......@@ -334,64 +407,10 @@ export class GameEle extends Container {
this.y = layers.stageOffsetY + sh
this.vy = 0
}
// var len = pos2Len(this, this.fixedCenter)
// if (len >= GameCfg.rc) {
// this.setRotation(this.k * (len - GameCfg.rc))
// if (this.isIn) {
// this.isIn = false
// FYGE.Tween.removeTweens(this)
// GDispatcher.dispatchEvent('focus-out')
// }
// } else {
// if (!this.isIn) {
// this.isIn = true
// this.vx = 0
// this.vy = 0
// this.setRotation(0)
// FYGE.Tween.get(this)
// .to({
// x: this.fixedCenter.x,
// y: this.fixedCenter.y
// }, 400)
// GDispatcher.dispatchEvent('focus-in', () => {
// this.finishFunc()
// })
// }
// }
var len = pos2Len(this, this.fixedCenter)
if (!this.lastLen) this.lastLen = len
if (len <= GameCfg.rc) {
if (len < this.lastLen) {
if (!this.isIn) {
this.isIn = true
this.vx = 0
this.vy = 0
this.setRotation(0)
FYGE.Tween.get(this)
.to({
x: this.fixedCenter.x,
y: this.fixedCenter.y
}, 400)
GDispatcher.dispatchEvent('focus-in', () => {
this.finishFunc()
})
}
} else if (len > this.lastLen && this.isIn) {
this.isIn = false
FYGE.Tween.removeTweens(this)
GDispatcher.dispatchEvent('focus-out')
}
}
this.setRotation(this.k * (len))
this.lastLen = len
}
update() {
this.updateFrameFunc()
!this.freezed && this.updateFrameFunc()
super.update()
}
......
......@@ -3,6 +3,7 @@ import { layers } from "../../../module/views/layers"
import { Scene } from "../../../module/views/Scene"
import CircleProgressBar from "../../common/CircleProgressBar"
import { ProgressBar } from "../../common/ProgressBar"
import { balance_guidance } from "../../lotties/balance_guidance"
import { GDispatcher } from "../../Main"
import { Tools } from "../../Tools"
import UI from "../../UI"
......@@ -56,7 +57,9 @@ export class MotionInitFunc extends Container {
this.maskCont = UI.Ctn(this, layers.stageOffsetX, layers.stageOffsetY)
UI.Rect(this.maskCont , layers.stageWidth, layers.stageHeight, 0x1b1a1a, 0).alpha=0.8
UI.Sp(this.maskCont, 'balance_guidance.png', 310, layers.stageHeight / 2 - 266)
// UI.Sp(this.maskCont, 'balance_guidance.png', 310, layers.stageHeight / 2 - 266)
UI.Lottie(this.maskCont, balance_guidance, 130, layers.stageHeight / 2 - 166).play(0)
UI.Txt(this.maskCont, '端平手机开始游戏', 36, '#ffffff', TEXT_ALIGN.CENTER, layers.stageWidth, 0, layers.stageHeight / 2 + 326, true)
......@@ -86,7 +89,7 @@ export class MotionInitFunc extends Container {
if (abs(e.beta) < GameCfg.duanpingValue && abs(e.gamma) < GameCfg.duanpingValue) {
if (this.timer == null) {
this.timer = FYGE.Tween.get(this.progress)
.to({value: 1}, 3000)
.to({value: 1}, 2000)
.call(() => {
this.timer = null
this.hideGuidance()
......@@ -178,7 +181,7 @@ export class MotionInitScene extends Scene {
}
focusProgress: CircleProgressBar
addTimeCountDown = debounce((e) => {
addTimeCountDown = (e) => {
this.shoot()
// this.focusProgress = this.addChild(new ProgressBar(0xff200d, {
// valueDesc: '保存进度',
......@@ -206,7 +209,7 @@ export class MotionInitScene extends Scene {
this.removeTimeCountDown()
})
}, 400)
}
removeTimeCountDown() {
if (this.focusProgress.visible) {
......@@ -220,7 +223,7 @@ export class MotionInitScene extends Scene {
this.holdOnTxt.visible = false
// @ts-ignore
clearTimeout(this.addTimeCountDown.timer.curr)
// clearTimeout(this.addTimeCountDown.timer.curr)
}
/**
......
......@@ -19,7 +19,7 @@ export function setCenterPos(cont: FYGE.Sprite) {
export class NewGuyScene extends MotionInitScene {
get groupNames(): string[] {
return ['GameScene']
return ['GameScene', 'balance_guidance']
}
constructor() {
......
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