帮助赔率界面使用节点池,减少消耗
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m16s

This commit is contained in:
TJH 2026-07-06 17:14:18 +08:00
parent a3872e1a18
commit f113618abe
5 changed files with 32 additions and 29 deletions

View File

@ -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;

View File

@ -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)
}

View File

@ -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)
}

View File

@ -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()
}

View File

@ -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"