实现2.4.11版本

This commit is contained in:
lujun
2023-02-09 17:25:08 +08:00
parent 70c4e8da16
commit 451f431777
210 changed files with 46766 additions and 7089 deletions

View File

@@ -0,0 +1,43 @@
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
const {ccclass, property} = cc._decorator;
@ccclass
export default class ListTestItem extends cc.Component {
@property({type: cc.Label})
rankText:cc.Label = null;
@property({type: cc.Label})
goldText:cc.Label = null;
@property({type: cc.Sprite})
flagImage:cc.Sprite = null;
@property({type: cc.Label})
levelText:cc.Label = null;
@property({type: cc.ProgressBar})
levelBar:cc.ProgressBar = null;
@property({type: cc.Label})
descText:cc.Label = null;
@property({type: cc.Node})
uiOpacity:cc.Node = null;
randomData(index:number, flagSpriteFrame:cc.SpriteFrame){
this.rankText.string = String(index);
this.goldText.string = String(Math.floor(1000 + Math.random()* 1000));
this.flagImage.spriteFrame = flagSpriteFrame;
this.levelText.string = `lv.${Math.floor(Math.random()* 100)}`;
this.levelBar.progress = Math.random();
this.descText.string = `什么也没留下 - ${index}`;
this.uiOpacity.opacity = 100 + Math.floor(Math.random() * 155);
}
}

View File

@@ -0,0 +1,10 @@
{
"ver": "1.1.0",
"uuid": "9f5387d6-696a-4491-82ea-1a443403ed3c",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View 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)])
}
}
}

View File

@@ -0,0 +1,10 @@
{
"ver": "1.1.0",
"uuid": "66495605-543c-44a7-b208-dfc48bdce8b8",
"importer": "typescript",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}