From f113618abe438520f9c1698d07f29b79d043578e Mon Sep 17 00:00:00 2001 From: TJH Date: Mon, 6 Jul 2026 17:14:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B8=AE=E5=8A=A9=E8=B5=94=E7=8E=87=E7=95=8C?= =?UTF-8?q?=E9=9D=A2=E4=BD=BF=E7=94=A8=E8=8A=82=E7=82=B9=E6=B1=A0=EF=BC=8C?= =?UTF-8?q?=E5=87=8F=E5=B0=91=E6=B6=88=E8=80=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/Game/scripts/SlotBar.ts | 51 ++++++++++++++-------------- assets/Game/scripts/game/Paytable.ts | 3 +- assets/Game/scripts/game/Rules.ts | 3 +- assets/Game/scripts/game/Tools.ts | 2 +- assets/Loading/scripts/comm.ts | 2 +- 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/assets/Game/scripts/SlotBar.ts b/assets/Game/scripts/SlotBar.ts index 16c71fd..7425981 100644 --- a/assets/Game/scripts/SlotBar.ts +++ b/assets/Game/scripts/SlotBar.ts @@ -342,45 +342,46 @@ export class SlotBar extends Component { this.setBtnEnable(this.spinBtn, false); } + async showPopup( + name: string, + pre: Prefab, + callBack: (prefab: Node) => void + ) { + let prefab = await NodePoolManager.instance.getNodeFromPoolStatic(name, pre); + if (!prefab) { + console.error(`UIManager 加载${name} prefab失败: ${path}`); + return; + } + + this.MaskNode.addChild(prefab); + showFromBottom(prefab) + + let main = prefab.getChildByName('main'); + if (!main) { + // console.error(`UIManager ${name}prefab 没有main节点,命名不规范: ${path}`); + return; + } + if (callBack) callBack(prefab); + } + + // 打开规则界面 openRules() { if (!this.tweenIsEnd) return; - // AudioManager.instance.playSFX('Common_Button_Click'); - // let param = "rule"; - // let view = NodePoolManager.instance.getNodeFromPoolStatic(param, this.webViewPre); - // this.MaskNode.addChild(view); - // view.getComponent(webView).open(param, this.curBet); - - let rules = instantiate(this.pfb_rules); - this.MaskNode.addChild(rules); - showFromBottom(rules); + this.showPopup('rules', this.pfb_rules) } // 打开赔率界面 openPaytable() { if (!this.tweenIsEnd) return; - // let url = getOddsUrl(); - // window.open(url, '_blank'); - // return; - // AudioManager.instance.playSFX('Common_Button_Click'); - // let param = "paytable"; - // let view = NodePoolManager.instance.getNodeFromPoolStatic(param, this.webViewPre); - // this.MaskNode.addChild(view); - // view.getComponent(webView).open(param, this.curBet); - - let paytable = instantiate(this.pfb_paytable); - this.MaskNode.addChild(paytable); - showFromBottom(paytable); + this.showPopup('paytable', this.pfb_paytable) } openHistory() { if (!this.tweenIsEnd) return; - - let history = instantiate(this.pfb_history); - this.MaskNode.addChild(history); - showFromBottom(history); + this.showPopup('history', this.pfb_history) } isON = true; diff --git a/assets/Game/scripts/game/Paytable.ts b/assets/Game/scripts/game/Paytable.ts index d650ce1..b16f99f 100644 --- a/assets/Game/scripts/game/Paytable.ts +++ b/assets/Game/scripts/game/Paytable.ts @@ -1,6 +1,7 @@ import { _decorator, Component, EventMouse, JsonAsset, Layout, math, Node, ScrollView, UITransform, Widget } from 'cc'; import { hideToBottom, isBrahmic, updateLang, wrapTextBySpace } from './Tools'; import { getLanguage } from 'db://assets/Loading/scripts/comm'; +import { NodePoolManager } from 'db://assets/Loading/scripts/manager/NodePoolManager'; const { ccclass, property } = _decorator; @ccclass('Paytable') @@ -44,7 +45,7 @@ export class Paytable extends Component { } clickClosePaytable() { - const destroyFunc = () => { this.node.destroy() } + const destroyFunc = () => { NodePoolManager.instance.putNodeToPool('paytable', this.node) } hideToBottom(this.node, destroyFunc) } diff --git a/assets/Game/scripts/game/Rules.ts b/assets/Game/scripts/game/Rules.ts index cdf04f3..82e9e37 100644 --- a/assets/Game/scripts/game/Rules.ts +++ b/assets/Game/scripts/game/Rules.ts @@ -1,6 +1,7 @@ import { _decorator, Component, EventMouse, JsonAsset, Label, Layout, math, Node, ScrollView, UITransform, Widget } from 'cc'; import { getAllRichTexts, hideToBottom, isBrahmic, updateLang, wrapTextBySpace } from './Tools'; import { getCsymbol, getLanguage } from 'db://assets/Loading/scripts/comm'; +import { NodePoolManager } from 'db://assets/Loading/scripts/manager/NodePoolManager'; const { ccclass, property } = _decorator; @ccclass('Rules') @@ -51,7 +52,7 @@ export class Rules extends Component { clickCloseRules() { - const destroyFunc = () => { this.node.destroy() } + const destroyFunc = () => { NodePoolManager.instance.putNodeToPool('rules', this.node) } hideToBottom(this.node, destroyFunc) } diff --git a/assets/Game/scripts/game/Tools.ts b/assets/Game/scripts/game/Tools.ts index 6e658d9..3b1d34e 100644 --- a/assets/Game/scripts/game/Tools.ts +++ b/assets/Game/scripts/game/Tools.ts @@ -379,7 +379,7 @@ export function showFromBottom(node: Node) { height = 1920; } - node.position = new Vec3(0, -height / 2) + node.position = new Vec3(0, -height) tween(node).to(0.15, { position: new Vec3() }).start() } diff --git a/assets/Loading/scripts/comm.ts b/assets/Loading/scripts/comm.ts index d333498..e88a006 100644 --- a/assets/Loading/scripts/comm.ts +++ b/assets/Loading/scripts/comm.ts @@ -7,7 +7,7 @@ import { PREVIEW } from "cc/env" const gameId = "rp_11001"; // let apiaddr = "https://rpgames-api.rpfafafahkdev.com"; let apiaddr = ""; -let token = "eyJQIjoxMDA5NDksIkUiOjE3ODI5MzA5ODEsIlMiOjEwMDAsIkQiOiJycF8xMTAwMSJ9.432SLYXxigvcnlARfSesXWhDOJ06QHzN3OvU791lMiw"; +let token = "eyJQIjoxMDA5NDksIkUiOjE3ODMzNzIyNzQsIlMiOjEwMDMsIkQiOiJycF8xMTAwMSJ9.HRjXjxkWf6cNrzx-oWsubYxygyF0EofkiLBsUTz9vgk"; let language = "en" let currency = "THB"