From 8d0df6cdddcb9eb9f5af8cca5eef48edb3e50208 Mon Sep 17 00:00:00 2001 From: tiendat3699 <96950844+tiendat3699@users.noreply.github.com> Date: Mon, 24 Jun 2024 18:00:27 +0700 Subject: [PATCH] fix: p4p api --- .../Spine/General/lucky-spin/lucky-spin.json | 28 ++-- assets/_Game/Prefabs/Gacha/Lucky_Wheel.prefab | 125 +++++++++--------- assets/_Game/Scripts/Manager/GameManager.ts | 19 +-- assets/_Game/Scripts/UI/GameOverPanel.ts | 2 - settings/v2/packages/builder.json | 4 +- settings/v2/packages/engine.json | 5 +- 6 files changed, 92 insertions(+), 91 deletions(-) diff --git a/assets/_Game/Animations/Spine/General/lucky-spin/lucky-spin.json b/assets/_Game/Animations/Spine/General/lucky-spin/lucky-spin.json index 6f1f189..308057b 100644 --- a/assets/_Game/Animations/Spine/General/lucky-spin/lucky-spin.json +++ b/assets/_Game/Animations/Spine/General/lucky-spin/lucky-spin.json @@ -1,11 +1,11 @@ { "skeleton": { - "hash": "AOVlLtvOeA6zy0FZG7YW58NaHUE", + "hash": "mSMe35aM/dGkp1ffP7za+lwHqJc", "spine": "3.8.99", - "x": -445.81, - "y": -445.81, - "width": 891.61, - "height": 1034.81, + "x": -432.5, + "y": -433, + "width": 865, + "height": 1022, "images": "", "audio": "D:/Huy 2D Animation/works/2024/Product/Galaxy Seeker/Reward Animation/lucky-spin" }, @@ -14,14 +14,14 @@ { "name": "pivot", "parent": "root" }, { "name": "wheel", "parent": "pivot", "length": 415.93 }, { "name": "spin-button", "parent": "pivot" }, - { "name": "slot01", "parent": "wheel", "length": 80, "rotation": -75, "x": 225.73, "y": 98.61 }, - { "name": "slot02", "parent": "wheel", "length": 80, "rotation": -30, "x": 89.89, "y": 229.34 }, - { "name": "slot03", "parent": "wheel", "length": 80, "rotation": 15, "x": -98.61, "y": 225.73 }, - { "name": "slot04", "parent": "wheel", "length": 80, "rotation": 60, "x": -229.34, "y": 89.89 }, - { "name": "slot05", "parent": "wheel", "length": 80, "rotation": 105, "x": -225.73, "y": -98.61 }, - { "name": "slot06", "parent": "wheel", "length": 80, "rotation": 150, "x": -89.89, "y": -229.34 }, - { "name": "slot07", "parent": "wheel", "length": 80, "rotation": -165, "x": 98.61, "y": -225.73 }, - { "name": "slot08", "parent": "wheel", "length": 80, "rotation": -120, "x": 229.34, "y": -89.89 } + { "name": "slot01", "parent": "wheel", "length": 80, "rotation": -90, "x": 252.39, "y": -5.3 }, + { "name": "slot02", "parent": "wheel", "length": 80, "rotation": -45, "x": 182.21, "y": 174.72 }, + { "name": "slot03", "parent": "wheel", "length": 80, "x": 5.3, "y": 252.39 }, + { "name": "slot04", "parent": "wheel", "length": 80, "rotation": 45, "x": -174.72, "y": 182.21 }, + { "name": "slot05", "parent": "wheel", "length": 80, "rotation": 90, "x": -252.39, "y": 5.3 }, + { "name": "slot06", "parent": "wheel", "length": 80, "rotation": 135, "x": -182.21, "y": -174.72 }, + { "name": "slot07", "parent": "wheel", "length": 80, "rotation": 180, "x": -5.3, "y": -252.39 }, + { "name": "slot08", "parent": "wheel", "length": 80, "rotation": -135, "x": 174.72, "y": -182.21 } ], "slots": [ { "name": "lucky-spin", "bone": "pivot", "attachment": "lucky-spin" }, @@ -43,7 +43,7 @@ "lucky-spin": { "y": 450, "width": 639, "height": 278 } }, "wheel": { - "wheel": { "rotation": 15, "width": 728, "height": 728 } + "wheel": { "width": 728, "height": 728 } } } } diff --git a/assets/_Game/Prefabs/Gacha/Lucky_Wheel.prefab b/assets/_Game/Prefabs/Gacha/Lucky_Wheel.prefab index 225fc78..819e2b6 100644 --- a/assets/_Game/Prefabs/Gacha/Lucky_Wheel.prefab +++ b/assets/_Game/Prefabs/Gacha/Lucky_Wheel.prefab @@ -338,21 +338,21 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 225.72998046875, - "y": 98.61000061035156, + "x": 248.30999755859375, + "y": 36.529998779296875, "z": 0 }, "_lrot": { "__type__": "cc.Quat", "x": 0, "y": 0, - "z": -0.6087613965701434, - "w": 0.7933533651822289 + "z": -0.7071067657322384, + "w": 0.7071067966408556 }, "_lscale": { "__type__": "cc.Vec3", - "x": 1.00000002508207, - "y": 0.9999999289413505, + "x": 1.0000000000000038, + "y": 1, "z": 1 }, "_mobility": 0, @@ -361,7 +361,7 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": -74.99999531458795 + "z": -90 }, "_id": "" }, @@ -661,21 +661,21 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 89.88996887207031, - "y": 229.33999633789062, + "x": 149.74996948242188, + "y": 201.41000366210938, "z": 0 }, "_lrot": { "__type__": "cc.Quat", "x": 0, "y": 0, - "z": -0.2588190032999389, - "w": 0.9659258374900348 + "z": -0.38268339342647806, + "w": 0.9238795486401868 }, "_lscale": { "__type__": "cc.Vec3", - "x": 1.0000000381579632, - "y": 0.9999999636521684, + "x": 1.0000000671794296, + "y": 0.9999998985920355, "z": 1 }, "_mobility": 0, @@ -684,7 +684,7 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": -29.999995040796215 + "z": -44.999995170326834 }, "_id": "" }, @@ -984,21 +984,21 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -98.61003112792969, - "y": 225.72999572753906, + "x": -36.530033111572266, + "y": 248.30999755859375, "z": 0 }, "_lrot": { "__type__": "cc.Quat", "x": 0, "y": 0, - "z": 0.13052622562304028, - "w": 0.9914448569762226 + "z": 4.3711388286737347e-8, + "w": 0.9999999999999981 }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.9999999289413505, - "y": 1.0000000173686574, + "x": 1, + "y": 1.0000000000000153, "z": 1 }, "_mobility": 0, @@ -1007,7 +1007,7 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": 15.000003860729631 + "z": 0.000005008956130975262 }, "_id": "" }, @@ -1307,21 +1307,21 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -229.3400115966797, - "y": 89.88999938964844, + "x": -201.41001892089844, + "y": 149.75, "z": 0 }, "_lrot": { "__type__": "cc.Quat", "x": 0, "y": 0, - "z": 0.5000000263032969, - "w": 0.8660253885982211 + "z": 0.38268347130370084, + "w": 0.923879516382385 }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.9999999636521684, - "y": 1.0000000679602858, + "x": 0.9999998985920355, + "y": 1.0000000671794296, "z": 1 }, "_mobility": 0, @@ -1330,7 +1330,7 @@ "__type__": "cc.Vec3", "x": 0, "y": 0, - "z": 60.00000348042408 + "z": 45.00000482967317 }, "_id": "" }, @@ -1630,30 +1630,30 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -225.72998046875, - "y": -98.61000061035156, + "x": -248.30999755859375, + "y": -36.529998779296875, "z": 0 }, "_lrot": { "__type__": "cc.Quat", "x": 0, "y": 0, - "z": 0.7933533651822295, - "w": 0.6087613965701435 + "z": 0.7071068275494746, + "w": 0.7071067348236167 }, "_lscale": { "__type__": "cc.Vec3", - "x": 1.0000000173686574, - "y": 0.9999999366547601, + "x": 1.0000000000000153, + "y": 1.0000000000000038, "z": 1 }, "_mobility": 0, "_layer": 33554432, "_euler": { "__type__": "cc.Vec3", - "x": 180, - "y": 180, - "z": 74.99999531458818 + "x": 0, + "y": 0, + "z": 90 }, "_id": "" }, @@ -1953,21 +1953,21 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": -89.88996887207031, - "y": -229.33999633789062, + "x": -149.74996948242188, + "y": -201.41000366210938, "z": 0 }, "_lrot": { "__type__": "cc.Quat", "x": 0, "y": 0, - "z": 0.9659258374900345, - "w": 0.2588190032999354 + "z": 0.9238795405757362, + "w": 0.3826834128957854 }, "_lscale": { "__type__": "cc.Vec3", - "x": 1.0000000679602858, - "y": 0.9999999338498551, + "x": 1.0000000671794296, + "y": 0.999999898592032, "z": 1 }, "_mobility": 0, @@ -1976,7 +1976,7 @@ "__type__": "cc.Vec3", "x": 180, "y": 180, - "z": 29.99999504079575 + "z": 44.99999758516358 }, "_id": "" }, @@ -2276,21 +2276,21 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 98.61003112792969, - "y": -225.72999572753906, + "x": 36.530033111572266, + "y": -248.30999755859375, "z": 0 }, "_lrot": { "__type__": "cc.Quat", "x": 0, "y": 0, - "z": 0.9914448532187857, - "w": -0.13052625416359825 + "z": 0.9999999999999982, + "w": -5.7620454185780195e-8 }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.9999999520815817, - "y": 1.00000002508207, + "x": 1.0000000000000038, + "y": 1.0000000000000102, "z": 1 }, "_mobility": 0, @@ -2299,7 +2299,7 @@ "__type__": "cc.Vec3", "x": -180, "y": -180, - "z": -15.000007159457764 + "z": -0.00000660281767694425 }, "_id": "" }, @@ -2599,21 +2599,21 @@ }, "_lpos": { "__type__": "cc.Vec3", - "x": 229.3400115966797, - "y": -89.88999938964844, + "x": 201.41001892089844, + "y": -149.75, "z": 0 }, "_lrot": { "__type__": "cc.Quat", "x": 0, "y": 0, - "z": 0.866025395549709, - "w": -0.5000000142629697 + "z": 0.923879516382385, + "w": -0.38268347130370084 }, "_lscale": { "__type__": "cc.Vec3", - "x": 0.999999956736505, - "y": 1.0000000381579632, + "x": 0.9999998985920355, + "y": 1.0000000671794296, "z": 1 }, "_mobility": 0, @@ -2622,7 +2622,7 @@ "__type__": "cc.Vec3", "x": -180, "y": -180, - "z": -60.00000188726096 + "z": -45.00000482967317 }, "_id": "" }, @@ -2906,13 +2906,13 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 891.6099853515625, - "height": 1034.81005859375 + "width": 865, + "height": 1022 }, "_anchorPoint": { "__type__": "cc.Vec2", - "x": 0.5000056133095129, - "y": 0.4308133592791174 + "x": 0.5, + "y": 0.42367906066536204 }, "_id": "" }, @@ -3340,6 +3340,7 @@ "__id__": 0 }, "fileId": "b0CgrEZDdPP6qjRGc5LHCx", + "instance": null, "targetOverrides": [] } ] \ No newline at end of file diff --git a/assets/_Game/Scripts/Manager/GameManager.ts b/assets/_Game/Scripts/Manager/GameManager.ts index 6b56084..03ff43e 100644 --- a/assets/_Game/Scripts/Manager/GameManager.ts +++ b/assets/_Game/Scripts/Manager/GameManager.ts @@ -128,8 +128,6 @@ export class GameManager extends Singleton() { break; case GameState.Playing: this.countTime(); - await P4PSDK.minusTicket('auth'); - EventManger.instance.emit(GameEvent.TicketUpdate, P4PSDK.getUserTicket()); break; case GameState.GameOver: this.replayTimes--; @@ -137,8 +135,6 @@ export class GameManager extends Singleton() { case GameState.End: break; case GameState.Relive: - await P4PSDK.minusTicket('revive'); - EventManger.instance.emit(GameEvent.TicketUpdate, P4PSDK.getUserTicket()); break; default: throw new Error(`Argument Out Of Range Exception: ${GameState[state]}`); @@ -298,22 +294,27 @@ export class GameManager extends Singleton() { this.changeGameState(GameState.Ready); } + private _minusTicketLoading = false; + public async replay(): Promise { + if (this._minusTicketLoading) return; + this._minusTicketLoading = true; if (!PREVIEW && !EDITOR) { - if (P4PSDK.canRelive()) { + const checkGameScoreTicket = await P4PSDK.checkGameScoreTicket(); + if (checkGameScoreTicket) { const success = await P4PSDK.minusTicket('revive'); if (success) { this.gameRelive(); } else { - this.gameOver(); - return; + P4PSDK.callPayPalModal(); } } else { - P4PSDK.callPayPalModal(); + this.gameOver(); } } else { this.gameRelive(); } + this._minusTicketLoading = false; } public async play() { @@ -325,6 +326,8 @@ export class GameManager extends Singleton() { await Utils.delay(TimeConfig.DelayPLay); this._timer.startCount(); this.spawnBall(true); + await P4PSDK.minusTicket('auth'); + EventManger.instance.emit(GameEvent.TicketUpdate, P4PSDK.getUserTicket()); } public async gameRelive() { diff --git a/assets/_Game/Scripts/UI/GameOverPanel.ts b/assets/_Game/Scripts/UI/GameOverPanel.ts index 7eceefe..2fdeeb1 100644 --- a/assets/_Game/Scripts/UI/GameOverPanel.ts +++ b/assets/_Game/Scripts/UI/GameOverPanel.ts @@ -88,8 +88,6 @@ export class GameOverPanel extends Component { } onClickYesButton() { - if (this._clicked) return; - this._clicked = true; GameManager.instance.replay(); } diff --git a/settings/v2/packages/builder.json b/settings/v2/packages/builder.json index 3372020..c06ee06 100644 --- a/settings/v2/packages/builder.json +++ b/settings/v2/packages/builder.json @@ -3,9 +3,9 @@ "splash-setting": { "logo": { "image": "project://settings/Asset 3@4x.png", - "type": "custom" + "type": "default" }, - "displayRatio": 2, + "displayRatio": 1, "background": { "type": "default" } diff --git a/settings/v2/packages/engine.json b/settings/v2/packages/engine.json index 5ed2127..b022397 100644 --- a/settings/v2/packages/engine.json +++ b/settings/v2/packages/engine.json @@ -95,7 +95,7 @@ "_value": true }, "websocket": { - "_value": true + "_value": false }, "websocket-server": { "_value": false @@ -140,8 +140,7 @@ "profiler", "spine", "tween", - "ui", - "websocket" + "ui" ], "noDeprecatedFeatures": { "value": false,