mirror of
https://gitee.com/ccc_28/level-render
synced 2024-12-26 03:38:41 +00:00
36 lines
814 B
TypeScript
36 lines
814 B
TypeScript
import { _decorator, Component, Node } from 'cc';
|
|
import CCCExtension from './CCCExtension';
|
|
import RecycleScroll from './RecycleScroll';
|
|
import { Item } from './Item';
|
|
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('Launc')
|
|
export class Launc extends Component {
|
|
@property(RecycleScroll)
|
|
itemScroll: RecycleScroll = null;
|
|
|
|
onLoad(): void {
|
|
CCCExtension.init()
|
|
this.itemScroll.onItemRender = this.onItemRender.bind(this);
|
|
}
|
|
|
|
start() {
|
|
this.itemScroll.numItems = 15;
|
|
}
|
|
|
|
onItemRender(index: number, node: Node) {
|
|
node.getComponent(Item).setData({ id: index })
|
|
}
|
|
|
|
click() {
|
|
if (this.itemScroll.numItems == 15) {
|
|
this.itemScroll.numItems = 1000
|
|
} else {
|
|
this.itemScroll.numItems = 15
|
|
}
|
|
}
|
|
}
|
|
|
|
|