//********************* // create by 流云 // time: Thu Mar 26 2026 // desc: //********************* import { _decorator, Component, Node, find, instantiate } from 'cc'; import { Auto_Replica } from './Auto_Replica'; import { TableNames } from '../../game/ConfigTableData'; import { ReplicaItem } from './ReplicaItem'; import { GBundle, GPath } from '../../game/ConfigRes'; const { ccclass, property } = _decorator; @ccclass('UIReplica') export class UIReplica extends Auto_Replica { onLoad(): void { super.onLoad(); } onEnable(): void { super.onEnable(); } onDisable(): void { this.unscheduleAllCallbacks(); super.onDisable(); } onInit(): void { let list = gg.data.table.getTableList(TableNames.Replica); list = list.filter(x => x.isOpen == 1); list.sort((a, b) => a.sort - b.sort); this.ui_content.children.map(x => x.active = false); for (let i = 0; i < list.length; i++) { let data = list[i]; let n: Node = null; if (i < this.ui_content.children.length) { n = this.ui_content.children[i]; } else { n = instantiate(this.ui_content.children[0]); n.parent = this.ui_content; } this.scheduleOnce(() => { if (!this.isValid || !n?.isValid) return; n.active = true; n.getComponent(ReplicaItem)?.setData(data); }, i * 0.1); } } }