diff --git a/assets/Game/prefabs/SlotScene.prefab b/assets/Game/prefabs/SlotScene.prefab index 11db68c..c6938ee 100644 --- a/assets/Game/prefabs/SlotScene.prefab +++ b/assets/Game/prefabs/SlotScene.prefab @@ -2297,7 +2297,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "474untOCpHWY6Qj2uP19E4" + "fileId": "b2TwwhnxJH76Y+/zSWtZSA" }, { "__type__": "cc.PrefabInfo", @@ -2307,7 +2307,7 @@ "asset": { "__id__": 0 }, - "fileId": "efzaF4hS1OAbEp9UxbQNhx", + "fileId": "52GkHtN/5AS7JAYzyjxbvh", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -2338,7 +2338,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "48ofa//m5Hf4E8JhtCsk6+" + "fileId": "f0saoipZVPOLhV1PCaWIGX" }, { "__type__": "cc.PrefabInfo", @@ -2348,7 +2348,7 @@ "asset": { "__id__": 0 }, - "fileId": "27o3j6IIJG24V0Xxad//zY", + "fileId": "a6QQ1UTPhNN4/aa8jgVZeu", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -2379,7 +2379,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "e3b34tMDpOZoJpCyhYo3RW" + "fileId": "d8Mt8viIVHw77SmyJfHbTR" }, { "__type__": "5fc10Zl7lVO97/rr2J1uxWH", @@ -2403,7 +2403,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "5fdQKnOjZAh4VEnOf1rEO5" + "fileId": "32hABGX/dEDoc6s+1MmJ59" }, { "__type__": "5fd13+Xa69CZogb3Q/F1lnC", @@ -2576,7 +2576,7 @@ "asset": { "__id__": 0 }, - "fileId": "3dG9T9DNxNB6z8vPiZ8WS5", + "fileId": "4aILCnwlBDB7hGZd2Ynl+M", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -2601,7 +2601,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "f9xc4vttJF+ZiFoGNX8W3t" + "fileId": "0bV0tfQhRMN6d7H0ibKbjU" }, { "__type__": "cc.UITransform", @@ -2629,7 +2629,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "9c05WFWAhONaMyr+/E7Shc" + "fileId": "87cTvkTYVGTqO1G0zeapjf" }, { "__type__": "cc.Sprite", @@ -2674,7 +2674,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "e8LlRd5StJW42FsulkvBfH" + "fileId": "44VLxjV9lNEKL7m6QiTsDE" }, { "__type__": "cc.PrefabInfo", @@ -2684,7 +2684,7 @@ "asset": { "__id__": 0 }, - "fileId": "bbBbOyMFZKXp7bHe6sD0It", + "fileId": "c4E9QiWNFDkqphtp7wZDOk", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -2939,7 +2939,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "7cgElNnmNLbrQo6qMPvX6X" + "fileId": "0fboYHWHZNWIUbXhqazPsq" }, { "__type__": "cc.PrefabInfo", @@ -2949,7 +2949,7 @@ "asset": { "__id__": 0 }, - "fileId": "e3+r0W1kJL+I68GTF4669l", + "fileId": "13+ILSCshI/5ip7LS5/6gd", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -2980,7 +2980,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "289bKoj6dKKoydIRLpWT8a" + "fileId": "643B7cb2NAR7lSwMKp1GZj" }, { "__type__": "cc.PrefabInfo", @@ -2990,7 +2990,7 @@ "asset": { "__id__": 0 }, - "fileId": "02JiBil/VJxLFib+gJ/Hn2", + "fileId": "f1CeTHGZFMWbdUk44tM+2T", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -3021,7 +3021,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "baLsYJmt1M/oVztDdO2+37" + "fileId": "0faSbheTdNAbTHKkVHN7R9" }, { "__type__": "45522uB1sdFu4FJAojtnha4", @@ -3045,7 +3045,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "60/LhqfK5BfqSpHK4P9aGn" + "fileId": "49BAFjRzlEg4a5w9VAFU5X" }, { "__type__": "cc.PrefabInfo", @@ -3055,7 +3055,7 @@ "asset": { "__id__": 0 }, - "fileId": "b7zQXb/W5BZYX1enrfDh9g", + "fileId": "56ysntvhREJaKGOpDwJobF", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -3238,7 +3238,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "efX7nb1KxBN6kTlecwmxyQ" + "fileId": "7e2ZjFsqBFP5cCRxgtmf+t" }, { "__type__": "cc.PrefabInfo", @@ -3248,7 +3248,7 @@ "asset": { "__id__": 0 }, - "fileId": "20ADiwKhFChbm2P2F0w9Il", + "fileId": "d5i0MG52hKvZuSU8d8vmXq", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -3279,7 +3279,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "897kQAzwdGuoFpmt9LgaS/" + "fileId": "05jh2EoupN2aPTiwaWTAjx" }, { "__type__": "cc.PrefabInfo", @@ -3289,7 +3289,7 @@ "asset": { "__id__": 0 }, - "fileId": "51JVTg3FlN5oHObig3RB8A", + "fileId": "a63qbKtfhIhpSE30CtElEi", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -3320,7 +3320,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "ebRabvFaFK3ZgnED8umlfE" + "fileId": "d8zY+1i6FEZ6El4yQMl12s" }, { "__type__": "45522uB1sdFu4FJAojtnha4", @@ -3344,7 +3344,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "25+Xa+ULpMMo9e4vyjjf8e" + "fileId": "a9L2Yr7FNKaLtD/OeYJdpl" }, { "__type__": "cc.PrefabInfo", @@ -3354,7 +3354,7 @@ "asset": { "__id__": 0 }, - "fileId": "9ftuR3BMlMJL4Mg5nRqDXc", + "fileId": "73VyHT/BRFkZ59ltUPthmo", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -3537,7 +3537,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "4atuG87wZMwrdJtBXBFg+m" + "fileId": "7bSXs34xBDiasIy27NQf9m" }, { "__type__": "cc.PrefabInfo", @@ -3547,7 +3547,7 @@ "asset": { "__id__": 0 }, - "fileId": "2ctdSV8FdIJbEpemj2MuxK", + "fileId": "dcW1sfkKZFx6jT6RDiJ27s", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -3578,7 +3578,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "c0nsk6VwdFv5Nwtf1XNEeL" + "fileId": "0cNAqyRLRKUpmCNuxqJwEb" }, { "__type__": "cc.PrefabInfo", @@ -3588,7 +3588,7 @@ "asset": { "__id__": 0 }, - "fileId": "74Uk3fo/1BXLTkUB5LA0ZL", + "fileId": "fbN+xzJFhCn5xAwb6MbqzN", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -3619,7 +3619,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "00Pb8xjclHJ4J5ruWvAJd0" + "fileId": "d7NfPm6CtPYYeTTMWVRPil" }, { "__type__": "45522uB1sdFu4FJAojtnha4", @@ -3643,7 +3643,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "c3mWpw8yBFOpOBYK/oJwlf" + "fileId": "12uERD9oNHXLN9QrvPgXI6" }, { "__type__": "cc.PrefabInfo", @@ -3653,7 +3653,7 @@ "asset": { "__id__": 0 }, - "fileId": "154TYNxAVOR7ivZexIoW8U", + "fileId": "43HdYUNGFN86ZboSc/0emO", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -3836,7 +3836,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "a9PsnIsy5NLZskGkfMRJs9" + "fileId": "4eCAoMvatGC5vK27lyKCm9" }, { "__type__": "cc.PrefabInfo", @@ -3846,7 +3846,7 @@ "asset": { "__id__": 0 }, - "fileId": "2eSknPaLxFFYWmAOdxXU8p", + "fileId": "20Mznl3ANNTbhTvg/jwte8", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -3877,7 +3877,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "94MCkleqpKOY12qL5k2+N8" + "fileId": "a22g2vYFpMMJ8r4Ihp9CXm" }, { "__type__": "cc.PrefabInfo", @@ -3887,7 +3887,7 @@ "asset": { "__id__": 0 }, - "fileId": "50PK2GHFBPjqhgxoWTU/2r", + "fileId": "36uPaDpHBEp5H4i69oODPH", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -3918,7 +3918,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "e9eDfNpyhCH5XstQIJ/OUz" + "fileId": "ecY/RLiy9KXrOob/Nm1LuB" }, { "__type__": "45522uB1sdFu4FJAojtnha4", @@ -3942,7 +3942,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "08HhZYarpCwoZ9SmvwHyOI" + "fileId": "2a35GyhtZAgZ9DjzSY8bgq" }, { "__type__": "cc.PrefabInfo", @@ -3952,7 +3952,7 @@ "asset": { "__id__": 0 }, - "fileId": "d7ES3kyGVE45RBIjyAxdo/", + "fileId": "5eF6boi/BMpLeWgJjsEg9V", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -4135,7 +4135,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "49KFheyEpFk7j4ya66hie6" + "fileId": "66/tk+89dDZa5IofR0CBit" }, { "__type__": "cc.PrefabInfo", @@ -4145,7 +4145,7 @@ "asset": { "__id__": 0 }, - "fileId": "2aMr/tAZ5CV6d4qvKHSwQI", + "fileId": "b1Kt8U6O1Llb5RFWfQkqpv", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -4176,7 +4176,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "929eWEal9M85LSGHGEywvv" + "fileId": "13g74ECRNNKKl4iJWvGR4L" }, { "__type__": "cc.PrefabInfo", @@ -4186,7 +4186,7 @@ "asset": { "__id__": 0 }, - "fileId": "f3tU5ZHclMkKnQ3/XZY4tU", + "fileId": "276uwfYadGr4oCfabcgeOZ", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -4217,7 +4217,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "2d8sr8UA5I1K3OiBNtBSXY" + "fileId": "fdhSoyjL1F3o1b4i8zFb70" }, { "__type__": "45522uB1sdFu4FJAojtnha4", @@ -4241,7 +4241,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "34H87vDfdN7Z5hiGu7bjqZ" + "fileId": "26W0VFH9xEQozypOHq0Ug5" }, { "__type__": "cc.PrefabInfo", @@ -4251,7 +4251,7 @@ "asset": { "__id__": 0 }, - "fileId": "ff+cG5ZfxAzaQAURuv01xe", + "fileId": "25KpT/kApLa6PlKB4IhT5H", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -4434,7 +4434,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "70cqz67q5A6bJsQryZ4Hx/" + "fileId": "e5KNNooddLGZiH55QvncHW" }, { "__type__": "cc.PrefabInfo", @@ -4444,7 +4444,7 @@ "asset": { "__id__": 0 }, - "fileId": "4akmLWGeBMaaibtkhRlmgv", + "fileId": "dakDWuNY1ADIHfiLJm8UJW", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -4475,7 +4475,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "9amAXvlCtDmpEeuhJmTneh" + "fileId": "24McWfMrJLcqxUKt9UGpHf" }, { "__type__": "cc.PrefabInfo", @@ -4485,7 +4485,7 @@ "asset": { "__id__": 0 }, - "fileId": "17XhDfV3hJnLs0XiJirgCs", + "fileId": "55AiyhpyFMM4/5T7WaMbkT", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -4516,7 +4516,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "c2ntGmdxJK1oi60EitYG/S" + "fileId": "30oNT/7VZO2Ld7qaYmCHuj" }, { "__type__": "45522uB1sdFu4FJAojtnha4", @@ -4540,7 +4540,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "d5TH2t/gVMAINUEpnOn8r5" + "fileId": "eesfDh+utHbrgPkQrRt/EV" }, { "__type__": "cc.PrefabInfo", @@ -4550,7 +4550,7 @@ "asset": { "__id__": 0 }, - "fileId": "9bj0pPQpNBMJxXrqKjLL84", + "fileId": "bdHyNoSK5Bp5cfTzLh9Zth", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -4575,7 +4575,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "24OGdcXuxEwo5lQTl47pAy" + "fileId": "d3Xjj6HBREYZO7V1V0hQqx" }, { "__type__": "cc.UITransform", @@ -4603,7 +4603,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "f019yzablDZLKsgsLi4UUu" + "fileId": "bb7+UzFSVNAarmXtxfafsl" }, { "__type__": "cc.Sprite", @@ -4648,7 +4648,7 @@ }, { "__type__": "cc.CompPrefabInfo", - "fileId": "60DBhD8shFl6Ld7QWyLMR+" + "fileId": "f6faqNpQ5J37X70yyvgg4k" }, { "__type__": "cc.PrefabInfo", @@ -4658,7 +4658,7 @@ "asset": { "__id__": 0 }, - "fileId": "1bXEry42BMFouw5k3TWaG+", + "fileId": "7dWyDbhk5Jc7rcq3h2kWJH", "instance": null, "targetOverrides": null, "nestedPrefabInstanceRoots": null @@ -23820,6 +23820,9 @@ "__uuid__": "257442c9-fc68-435b-8fef-6c448a2d8885", "__expectedType__": "cc.Prefab" }, + "slotGame": { + "__id__": 548 + }, "tipSmall_turbo": { "__id__": 1021 }, diff --git a/assets/Game/scripts/SlotBar.ts b/assets/Game/scripts/SlotBar.ts index dbc088b..56fd992 100644 --- a/assets/Game/scripts/SlotBar.ts +++ b/assets/Game/scripts/SlotBar.ts @@ -11,6 +11,7 @@ import { I18nManager } from '../../Loading/scripts/manager/I18nManager'; import { LocalizedSprite } from '../../Loading/scripts/i18n/LocalizedSprite'; import { AudioManager } from '../../Loading/scripts/manager/AudioManager'; import { SpinAni } from './game/SpinAni'; +import { SlotGame } from './SlotGame'; const { ccclass, property } = _decorator; @ccclass('SlotBar') @@ -22,6 +23,9 @@ export class SlotBar extends Component { @property({ type: Prefab }) private autoSpinPanel: Prefab = null; + @property(SlotGame) + private slotGame: SlotGame = null; + @property(Node) private tipSmall_turbo: Node = null; @property(Node) @@ -426,6 +430,19 @@ export class SlotBar extends Component { } } + async onConfirmErr2(): Promise { + try { + let balacneData = await callGameBalanceApi({ GameId: getGameId() }); + this.setBalance(balacneData.Balance) + return balacneData.Balance; + } catch (err) { + console.log('获取余额失败') + return null; + } finally { + this.isGetBalance = false; + } + } + private currentTipTween: Tween = null; private hideTimer: number = null; showTipSmall(str: string, openTurbo?: boolean) { @@ -592,6 +609,8 @@ export class SlotBar extends Component { this.setBtnEnable(this.menuBtn, false); this.setBtnEnable(this.spinBtn, false); + this.slotGame.showFeatureBuy(true) + this.setBtnVisible(this.spinBtn, false); this.setBtnVisible(this.stopAutoBtn, true); @@ -612,6 +631,7 @@ export class SlotBar extends Component { this.setBtnVisible(this.spinBtn, true); this.setBtnVisible(this.stopAutoBtn, false); this.setBtnEnable(this.spinBtn, false); + this.slotGame.showFeatureBuy(this.getBet() * this.gameInfo.BuyMul > this.gameInfo.MaxBuyBet) } reconnectState(hasDelete: boolean = false) { diff --git a/assets/Game/scripts/SlotScene.ts b/assets/Game/scripts/SlotScene.ts index b18ce7a..52f442d 100644 --- a/assets/Game/scripts/SlotScene.ts +++ b/assets/Game/scripts/SlotScene.ts @@ -4,7 +4,7 @@ import { SlotBar } from './SlotBar'; import { SlotGame } from './SlotGame'; import { BigWinUI } from './game/BigWinUI'; import { GameDataManager } from '../../Loading/scripts/manager/GameDataManager'; -import { callGameApi, getIsFrom } from '../../Loading/scripts/comm'; +import { callGameApi, callGameBalanceApi, getGameId, getIsFrom } from '../../Loading/scripts/comm'; import { TipPanel } from './game/TipPanel'; import { I18nManager } from '../../Loading/scripts/manager/I18nManager'; import { TotalWin } from './game/TotalWin'; @@ -78,6 +78,7 @@ export class SlotScene extends Component { private lastSpinInfo: any = null; private spinData: any = null; private isReceiveMsg: boolean = false; + private isErr2: boolean = false; private objectId: string[] = []; @@ -123,8 +124,6 @@ export class SlotScene extends Component { this.lastSpinInfo = this.gameInfo; this.spinData = this.gameInfo.Data; - this.slotGame.showFeatureBuy(this.gameInfo.CloseBuyGame); - // 注册事件监听 this.slotBar.node.on(SLOT_BAR_EVENT.ON_SPIN_CLICK, this.spinBtnClick, this); // this.slotBar.node.on(SLOT_BAR_EVENT.ON_TEST_SPIN_CLICK, this.spinBtnClick2, this); @@ -240,10 +239,16 @@ export class SlotScene extends Component { this.slotBar.setWin(0); } - if (this.slotBar.getBalance() < (isFeatureBuy ? this.slotBar.getBet() * this.gameInfo.BuyMul : this.slotBar.getBet()) && !isFreeSpin && !GameDataManager.instance.frb.Ongoing) { + let curBalanceData = await callGameBalanceApi({ GameId: getGameId() }) + let curBalance = curBalanceData.Balance + if (!curBalance) { + curBalance = this.slotBar.getBalance() + } + if (curBalance < (isFeatureBuy ? this.slotBar.getBet() * this.gameInfo.BuyMul : this.slotBar.getBet()) && !isFreeSpin && !GameDataManager.instance.frb.Ongoing) { //余额不足不经过服务器,在客户端拦截 - this.showErrorTip(2, () => { this.slotBar.onClickBalance() }); - this.handleErrSpin(); + this.showErrorTip(2, () => { this.slotBar.onConfirmErr2() }); + this.handleErrSpin(true); + this.isErr2 = true; return } try { @@ -378,7 +383,7 @@ export class SlotScene extends Component { this.slotGame.manualStop(); } - private handleErrSpin() { + private handleErrSpin(isErr2 = false) { this.spinInfo = this.lastSpinInfo; this.spinData = this.spinInfo.Data; this.slotGame.setRollerIconRule(this.spinData.Mode == 0 ? ROLLER_RULE : FREE_SPIN_ROLLER_RULE); @@ -388,8 +393,8 @@ export class SlotScene extends Component { this.spinData.RoundInfo.AllScore = 0; } this.slotGame.stopScroll(this.spinData, false, null); - this.slotGame.manualStop(); - this.slotBar.setBalance(this.spinInfo.Balance); + // this.slotGame.manualStop(); + this.slotBar.setBalance(isErr2 ? this.slotBar.getBalance() : this.spinInfo.Balance); this.slotBar.closeAutoSpin(); this.slotGame.setFeatureBuyInteractable(true) @@ -687,8 +692,13 @@ export class SlotScene extends Component { } private async normalStop(isReconnect: boolean = false) { - this.slotBar.setBalance(this.spinData.Balance); - let winType = this.slotGame.checkWinType(this.spinData.AllScore); + if (this.isErr2) { + this.isErr2 = false; + this.slotBar.setBalance(this.slotBar.getBalance()); + } else { + this.slotBar.setBalance(this.spinData.Balance); + + } let winType = this.slotGame.checkWinType(this.spinData.AllScore); await this.handleWinResult(winType, isReconnect, false, () => { this.checkAutoSpin(winType !== WIN_TYPE.NONE, isReconnect); diff --git a/assets/Loading/scripts/comm.ts b/assets/Loading/scripts/comm.ts index 235c057..3e01ca9 100644 --- a/assets/Loading/scripts/comm.ts +++ b/assets/Loading/scripts/comm.ts @@ -9,7 +9,7 @@ const qs = new URLSearchParams(location.search) // let apiaddr = "https://rpgames-api.rpfafafahkdev.com"; let apiaddr = ""; -let token = "eyJQIjoxMDAwMDEsIkUiOjE3ODExMTY1NjYsIlMiOjEwMDIsIkQiOiJycF8xMDAxMiJ9.I2959bskgMea99B9N_7_Lbb083gZcuov9nTDZX0hjRQ"; +let token = "eyJQIjoxMDA5NDksIkUiOjE3ODExODc3NjIsIlMiOjEwMDAsIkQiOiJycF8xMDAxMiJ9.5v087Lt--ozENIV6Rdvga9nZVc2bzxf11iJAbG5x8gM"; let language = "en" let currency = "THB" let isfrom = null