mirror of
https://gitee.com/nomat/lcc-ui-sorting-group-demo.git
synced 2025-12-11 08:18:48 +00:00
实现2.4.11版本
This commit is contained in:
28
2.4.11/assets/test/scripts/test-scene.ts
Normal file
28
2.4.11/assets/test/scripts/test-scene.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import ListTestItem from "./list-test-item";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export class TestScene extends cc.Component {
|
||||
|
||||
@property({type:cc.Prefab})
|
||||
listTestItemPrefab:cc.Prefab = null;
|
||||
|
||||
@property({type:cc.Node})
|
||||
listContent:cc.Node = null;
|
||||
|
||||
@property({type:[cc.SpriteFrame]})
|
||||
flagSpriteFrames:cc.SpriteFrame[] = [];
|
||||
|
||||
@property
|
||||
listItemMax:number = 200;
|
||||
|
||||
start() {
|
||||
for(let i = 0; i < this.listItemMax; i++){
|
||||
let node = cc.instantiate(this.listTestItemPrefab);
|
||||
node.parent = this.listContent;
|
||||
let item = node.getComponent(ListTestItem);
|
||||
item?.randomData(i + 1, this.flagSpriteFrames[Math.floor(Math.random() * this.flagSpriteFrames.length)])
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user