fix: p4p api

feature/ads-smart-display
tiendat3699 2024-06-24 18:00:27 +07:00
parent 52ef9b1666
commit 8d0df6cddd
6 changed files with 92 additions and 91 deletions

View File

@ -1,11 +1,11 @@
{ {
"skeleton": { "skeleton": {
"hash": "AOVlLtvOeA6zy0FZG7YW58NaHUE", "hash": "mSMe35aM/dGkp1ffP7za+lwHqJc",
"spine": "3.8.99", "spine": "3.8.99",
"x": -445.81, "x": -432.5,
"y": -445.81, "y": -433,
"width": 891.61, "width": 865,
"height": 1034.81, "height": 1022,
"images": "", "images": "",
"audio": "D:/Huy 2D Animation/works/2024/Product/Galaxy Seeker/Reward Animation/lucky-spin" "audio": "D:/Huy 2D Animation/works/2024/Product/Galaxy Seeker/Reward Animation/lucky-spin"
}, },
@ -14,14 +14,14 @@
{ "name": "pivot", "parent": "root" }, { "name": "pivot", "parent": "root" },
{ "name": "wheel", "parent": "pivot", "length": 415.93 }, { "name": "wheel", "parent": "pivot", "length": 415.93 },
{ "name": "spin-button", "parent": "pivot" }, { "name": "spin-button", "parent": "pivot" },
{ "name": "slot01", "parent": "wheel", "length": 80, "rotation": -75, "x": 225.73, "y": 98.61 }, { "name": "slot01", "parent": "wheel", "length": 80, "rotation": -90, "x": 252.39, "y": -5.3 },
{ "name": "slot02", "parent": "wheel", "length": 80, "rotation": -30, "x": 89.89, "y": 229.34 }, { "name": "slot02", "parent": "wheel", "length": 80, "rotation": -45, "x": 182.21, "y": 174.72 },
{ "name": "slot03", "parent": "wheel", "length": 80, "rotation": 15, "x": -98.61, "y": 225.73 }, { "name": "slot03", "parent": "wheel", "length": 80, "x": 5.3, "y": 252.39 },
{ "name": "slot04", "parent": "wheel", "length": 80, "rotation": 60, "x": -229.34, "y": 89.89 }, { "name": "slot04", "parent": "wheel", "length": 80, "rotation": 45, "x": -174.72, "y": 182.21 },
{ "name": "slot05", "parent": "wheel", "length": 80, "rotation": 105, "x": -225.73, "y": -98.61 }, { "name": "slot05", "parent": "wheel", "length": 80, "rotation": 90, "x": -252.39, "y": 5.3 },
{ "name": "slot06", "parent": "wheel", "length": 80, "rotation": 150, "x": -89.89, "y": -229.34 }, { "name": "slot06", "parent": "wheel", "length": 80, "rotation": 135, "x": -182.21, "y": -174.72 },
{ "name": "slot07", "parent": "wheel", "length": 80, "rotation": -165, "x": 98.61, "y": -225.73 }, { "name": "slot07", "parent": "wheel", "length": 80, "rotation": 180, "x": -5.3, "y": -252.39 },
{ "name": "slot08", "parent": "wheel", "length": 80, "rotation": -120, "x": 229.34, "y": -89.89 } { "name": "slot08", "parent": "wheel", "length": 80, "rotation": -135, "x": 174.72, "y": -182.21 }
], ],
"slots": [ "slots": [
{ "name": "lucky-spin", "bone": "pivot", "attachment": "lucky-spin" }, { "name": "lucky-spin", "bone": "pivot", "attachment": "lucky-spin" },
@ -43,7 +43,7 @@
"lucky-spin": { "y": 450, "width": 639, "height": 278 } "lucky-spin": { "y": 450, "width": 639, "height": 278 }
}, },
"wheel": { "wheel": {
"wheel": { "rotation": 15, "width": 728, "height": 728 } "wheel": { "width": 728, "height": 728 }
} }
} }
} }

View File

@ -338,21 +338,21 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 225.72998046875, "x": 248.30999755859375,
"y": 98.61000061035156, "y": 36.529998779296875,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": -0.6087613965701434, "z": -0.7071067657322384,
"w": 0.7933533651822289 "w": 0.7071067966408556
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1.00000002508207, "x": 1.0000000000000038,
"y": 0.9999999289413505, "y": 1,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@ -361,7 +361,7 @@
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": -74.99999531458795 "z": -90
}, },
"_id": "" "_id": ""
}, },
@ -661,21 +661,21 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 89.88996887207031, "x": 149.74996948242188,
"y": 229.33999633789062, "y": 201.41000366210938,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": -0.2588190032999389, "z": -0.38268339342647806,
"w": 0.9659258374900348 "w": 0.9238795486401868
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1.0000000381579632, "x": 1.0000000671794296,
"y": 0.9999999636521684, "y": 0.9999998985920355,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@ -684,7 +684,7 @@
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": -29.999995040796215 "z": -44.999995170326834
}, },
"_id": "" "_id": ""
}, },
@ -984,21 +984,21 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -98.61003112792969, "x": -36.530033111572266,
"y": 225.72999572753906, "y": 248.30999755859375,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0.13052622562304028, "z": 4.3711388286737347e-8,
"w": 0.9914448569762226 "w": 0.9999999999999981
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0.9999999289413505, "x": 1,
"y": 1.0000000173686574, "y": 1.0000000000000153,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@ -1007,7 +1007,7 @@
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 15.000003860729631 "z": 0.000005008956130975262
}, },
"_id": "" "_id": ""
}, },
@ -1307,21 +1307,21 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -229.3400115966797, "x": -201.41001892089844,
"y": 89.88999938964844, "y": 149.75,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0.5000000263032969, "z": 0.38268347130370084,
"w": 0.8660253885982211 "w": 0.923879516382385
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0.9999999636521684, "x": 0.9999998985920355,
"y": 1.0000000679602858, "y": 1.0000000671794296,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@ -1330,7 +1330,7 @@
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 60.00000348042408 "z": 45.00000482967317
}, },
"_id": "" "_id": ""
}, },
@ -1630,30 +1630,30 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -225.72998046875, "x": -248.30999755859375,
"y": -98.61000061035156, "y": -36.529998779296875,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0.7933533651822295, "z": 0.7071068275494746,
"w": 0.6087613965701435 "w": 0.7071067348236167
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1.0000000173686574, "x": 1.0000000000000153,
"y": 0.9999999366547601, "y": 1.0000000000000038,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
"_layer": 33554432, "_layer": 33554432,
"_euler": { "_euler": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 180, "x": 0,
"y": 180, "y": 0,
"z": 74.99999531458818 "z": 90
}, },
"_id": "" "_id": ""
}, },
@ -1953,21 +1953,21 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -89.88996887207031, "x": -149.74996948242188,
"y": -229.33999633789062, "y": -201.41000366210938,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0.9659258374900345, "z": 0.9238795405757362,
"w": 0.2588190032999354 "w": 0.3826834128957854
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 1.0000000679602858, "x": 1.0000000671794296,
"y": 0.9999999338498551, "y": 0.999999898592032,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@ -1976,7 +1976,7 @@
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 180, "x": 180,
"y": 180, "y": 180,
"z": 29.99999504079575 "z": 44.99999758516358
}, },
"_id": "" "_id": ""
}, },
@ -2276,21 +2276,21 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 98.61003112792969, "x": 36.530033111572266,
"y": -225.72999572753906, "y": -248.30999755859375,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0.9914448532187857, "z": 0.9999999999999982,
"w": -0.13052625416359825 "w": -5.7620454185780195e-8
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0.9999999520815817, "x": 1.0000000000000038,
"y": 1.00000002508207, "y": 1.0000000000000102,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@ -2299,7 +2299,7 @@
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -180, "x": -180,
"y": -180, "y": -180,
"z": -15.000007159457764 "z": -0.00000660281767694425
}, },
"_id": "" "_id": ""
}, },
@ -2599,21 +2599,21 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 229.3400115966797, "x": 201.41001892089844,
"y": -89.88999938964844, "y": -149.75,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
"__type__": "cc.Quat", "__type__": "cc.Quat",
"x": 0, "x": 0,
"y": 0, "y": 0,
"z": 0.866025395549709, "z": 0.923879516382385,
"w": -0.5000000142629697 "w": -0.38268347130370084
}, },
"_lscale": { "_lscale": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0.999999956736505, "x": 0.9999998985920355,
"y": 1.0000000381579632, "y": 1.0000000671794296,
"z": 1 "z": 1
}, },
"_mobility": 0, "_mobility": 0,
@ -2622,7 +2622,7 @@
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -180, "x": -180,
"y": -180, "y": -180,
"z": -60.00000188726096 "z": -45.00000482967317
}, },
"_id": "" "_id": ""
}, },
@ -2906,13 +2906,13 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 891.6099853515625, "width": 865,
"height": 1034.81005859375 "height": 1022
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0.5000056133095129, "x": 0.5,
"y": 0.4308133592791174 "y": 0.42367906066536204
}, },
"_id": "" "_id": ""
}, },
@ -3340,6 +3340,7 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "b0CgrEZDdPP6qjRGc5LHCx", "fileId": "b0CgrEZDdPP6qjRGc5LHCx",
"instance": null,
"targetOverrides": [] "targetOverrides": []
} }
] ]

View File

@ -128,8 +128,6 @@ export class GameManager extends Singleton<GameManager>() {
break; break;
case GameState.Playing: case GameState.Playing:
this.countTime(); this.countTime();
await P4PSDK.minusTicket('auth');
EventManger.instance.emit(GameEvent.TicketUpdate, P4PSDK.getUserTicket());
break; break;
case GameState.GameOver: case GameState.GameOver:
this.replayTimes--; this.replayTimes--;
@ -137,8 +135,6 @@ export class GameManager extends Singleton<GameManager>() {
case GameState.End: case GameState.End:
break; break;
case GameState.Relive: case GameState.Relive:
await P4PSDK.minusTicket('revive');
EventManger.instance.emit(GameEvent.TicketUpdate, P4PSDK.getUserTicket());
break; break;
default: default:
throw new Error(`Argument Out Of Range Exception: ${GameState[state]}`); throw new Error(`Argument Out Of Range Exception: ${GameState[state]}`);
@ -298,22 +294,27 @@ export class GameManager extends Singleton<GameManager>() {
this.changeGameState(GameState.Ready); this.changeGameState(GameState.Ready);
} }
private _minusTicketLoading = false;
public async replay(): Promise<void> { public async replay(): Promise<void> {
if (this._minusTicketLoading) return;
this._minusTicketLoading = true;
if (!PREVIEW && !EDITOR) { if (!PREVIEW && !EDITOR) {
if (P4PSDK.canRelive()) { const checkGameScoreTicket = await P4PSDK.checkGameScoreTicket();
if (checkGameScoreTicket) {
const success = await P4PSDK.minusTicket('revive'); const success = await P4PSDK.minusTicket('revive');
if (success) { if (success) {
this.gameRelive(); this.gameRelive();
} else { } else {
this.gameOver(); P4PSDK.callPayPalModal();
return;
} }
} else { } else {
P4PSDK.callPayPalModal(); this.gameOver();
} }
} else { } else {
this.gameRelive(); this.gameRelive();
} }
this._minusTicketLoading = false;
} }
public async play() { public async play() {
@ -325,6 +326,8 @@ export class GameManager extends Singleton<GameManager>() {
await Utils.delay(TimeConfig.DelayPLay); await Utils.delay(TimeConfig.DelayPLay);
this._timer.startCount(); this._timer.startCount();
this.spawnBall(true); this.spawnBall(true);
await P4PSDK.minusTicket('auth');
EventManger.instance.emit(GameEvent.TicketUpdate, P4PSDK.getUserTicket());
} }
public async gameRelive() { public async gameRelive() {

View File

@ -88,8 +88,6 @@ export class GameOverPanel extends Component {
} }
onClickYesButton() { onClickYesButton() {
if (this._clicked) return;
this._clicked = true;
GameManager.instance.replay(); GameManager.instance.replay();
} }

View File

@ -3,9 +3,9 @@
"splash-setting": { "splash-setting": {
"logo": { "logo": {
"image": "project://settings/Asset 3@4x.png", "image": "project://settings/Asset 3@4x.png",
"type": "custom" "type": "default"
}, },
"displayRatio": 2, "displayRatio": 1,
"background": { "background": {
"type": "default" "type": "default"
} }

View File

@ -95,7 +95,7 @@
"_value": true "_value": true
}, },
"websocket": { "websocket": {
"_value": true "_value": false
}, },
"websocket-server": { "websocket-server": {
"_value": false "_value": false
@ -140,8 +140,7 @@
"profiler", "profiler",
"spine", "spine",
"tween", "tween",
"ui", "ui"
"websocket"
], ],
"noDeprecatedFeatures": { "noDeprecatedFeatures": {
"value": false, "value": false,