帮助赔率界面使用节点池,减少消耗
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m16s
All checks were successful
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 1m16s
This commit is contained in:
parent
a3872e1a18
commit
f113618abe
@ -342,45 +342,46 @@ export class SlotBar extends Component {
|
|||||||
this.setBtnEnable(this.spinBtn, false);
|
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() {
|
openRules() {
|
||||||
if (!this.tweenIsEnd) return;
|
if (!this.tweenIsEnd) return;
|
||||||
|
|
||||||
// AudioManager.instance.playSFX('Common_Button_Click');
|
this.showPopup('rules', this.pfb_rules)
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 打开赔率界面
|
// 打开赔率界面
|
||||||
openPaytable() {
|
openPaytable() {
|
||||||
if (!this.tweenIsEnd) return;
|
if (!this.tweenIsEnd) return;
|
||||||
// let url = getOddsUrl();
|
|
||||||
// window.open(url, '_blank');
|
|
||||||
// return;
|
|
||||||
|
|
||||||
// AudioManager.instance.playSFX('Common_Button_Click');
|
this.showPopup('paytable', this.pfb_paytable)
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
openHistory() {
|
openHistory() {
|
||||||
if (!this.tweenIsEnd) return;
|
if (!this.tweenIsEnd) return;
|
||||||
|
this.showPopup('history', this.pfb_history)
|
||||||
let history = instantiate(this.pfb_history);
|
|
||||||
this.MaskNode.addChild(history);
|
|
||||||
showFromBottom(history);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
isON = true;
|
isON = true;
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { _decorator, Component, EventMouse, JsonAsset, Layout, math, Node, ScrollView, UITransform, Widget } from 'cc';
|
import { _decorator, Component, EventMouse, JsonAsset, Layout, math, Node, ScrollView, UITransform, Widget } from 'cc';
|
||||||
import { hideToBottom, isBrahmic, updateLang, wrapTextBySpace } from './Tools';
|
import { hideToBottom, isBrahmic, updateLang, wrapTextBySpace } from './Tools';
|
||||||
import { getLanguage } from 'db://assets/Loading/scripts/comm';
|
import { getLanguage } from 'db://assets/Loading/scripts/comm';
|
||||||
|
import { NodePoolManager } from 'db://assets/Loading/scripts/manager/NodePoolManager';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('Paytable')
|
@ccclass('Paytable')
|
||||||
@ -44,7 +45,7 @@ export class Paytable extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
clickClosePaytable() {
|
clickClosePaytable() {
|
||||||
const destroyFunc = () => { this.node.destroy() }
|
const destroyFunc = () => { NodePoolManager.instance.putNodeToPool('paytable', this.node) }
|
||||||
hideToBottom(this.node, destroyFunc)
|
hideToBottom(this.node, destroyFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
import { _decorator, Component, EventMouse, JsonAsset, Label, Layout, math, Node, ScrollView, UITransform, Widget } from 'cc';
|
import { _decorator, Component, EventMouse, JsonAsset, Label, Layout, math, Node, ScrollView, UITransform, Widget } from 'cc';
|
||||||
import { getAllRichTexts, hideToBottom, isBrahmic, updateLang, wrapTextBySpace } from './Tools';
|
import { getAllRichTexts, hideToBottom, isBrahmic, updateLang, wrapTextBySpace } from './Tools';
|
||||||
import { getCsymbol, getLanguage } from 'db://assets/Loading/scripts/comm';
|
import { getCsymbol, getLanguage } from 'db://assets/Loading/scripts/comm';
|
||||||
|
import { NodePoolManager } from 'db://assets/Loading/scripts/manager/NodePoolManager';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('Rules')
|
@ccclass('Rules')
|
||||||
@ -51,7 +52,7 @@ export class Rules extends Component {
|
|||||||
|
|
||||||
|
|
||||||
clickCloseRules() {
|
clickCloseRules() {
|
||||||
const destroyFunc = () => { this.node.destroy() }
|
const destroyFunc = () => { NodePoolManager.instance.putNodeToPool('rules', this.node) }
|
||||||
hideToBottom(this.node, destroyFunc)
|
hideToBottom(this.node, destroyFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -379,7 +379,7 @@ export function showFromBottom(node: Node) {
|
|||||||
height = 1920;
|
height = 1920;
|
||||||
}
|
}
|
||||||
|
|
||||||
node.position = new Vec3(0, -height / 2)
|
node.position = new Vec3(0, -height)
|
||||||
tween(node).to(0.15, { position: new Vec3() }).start()
|
tween(node).to(0.15, { position: new Vec3() }).start()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import { PREVIEW } from "cc/env"
|
|||||||
const gameId = "rp_11001";
|
const gameId = "rp_11001";
|
||||||
// let apiaddr = "https://rpgames-api.rpfafafahkdev.com";
|
// let apiaddr = "https://rpgames-api.rpfafafahkdev.com";
|
||||||
let apiaddr = "";
|
let apiaddr = "";
|
||||||
let token = "eyJQIjoxMDA5NDksIkUiOjE3ODI5MzA5ODEsIlMiOjEwMDAsIkQiOiJycF8xMTAwMSJ9.432SLYXxigvcnlARfSesXWhDOJ06QHzN3OvU791lMiw";
|
let token = "eyJQIjoxMDA5NDksIkUiOjE3ODMzNzIyNzQsIlMiOjEwMDMsIkQiOiJycF8xMTAwMSJ9.HRjXjxkWf6cNrzx-oWsubYxygyF0EofkiLBsUTz9vgk";
|
||||||
|
|
||||||
let language = "en"
|
let language = "en"
|
||||||
let currency = "THB"
|
let currency = "THB"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user