mirror of
https://gitee.com/ccc_28/level-render
synced 2025-11-15 18:48:17 +00:00
demo
This commit is contained in:
35
assets/demo/demo.ts
Normal file
35
assets/demo/demo.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user