mirror of
https://github.com/smallmain/cocos-enhance-kit.git
synced 2025-09-25 08:45:25 +00:00
完善 docs
This commit is contained in:
File diff suppressed because it is too large
Load Diff
54
demo/assets/text-render/char-mode/char-mode.ts
Normal file
54
demo/assets/text-render/char-mode/char-mode.ts
Normal file
@@ -0,0 +1,54 @@
|
||||
import { chars } from "../chars";
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class CharMode extends cc.Component {
|
||||
|
||||
@property(cc.Label)
|
||||
bitmapFont1: cc.Label = null;
|
||||
|
||||
@property(cc.Label)
|
||||
bitmapFont2: cc.Label = null;
|
||||
|
||||
@property(cc.Label)
|
||||
bitmapFont3: cc.Label = null;
|
||||
|
||||
@property(cc.Label)
|
||||
charFont1: cc.Label = null;
|
||||
|
||||
@property(cc.Label)
|
||||
charFont2: cc.Label = null;
|
||||
|
||||
@property(cc.Label)
|
||||
charFont3: cc.Label = null;
|
||||
|
||||
|
||||
protected onLoad(): void {
|
||||
this.bitmapFont1.string = this.getRandomText(15);
|
||||
this.bitmapFont2.string = this.getRandomText(15);
|
||||
this.bitmapFont3.string = this.getRandomText(15);
|
||||
this.charFont1.string = this.getRandomText(15);
|
||||
this.charFont2.string = this.getRandomText(15);
|
||||
this.charFont3.string = this.getRandomText(15);
|
||||
|
||||
this.schedule(() => {
|
||||
this.bitmapFont1.string = this.getRandomText(15);
|
||||
this.bitmapFont2.string = this.getRandomText(15);
|
||||
this.bitmapFont3.string = this.getRandomText(15);
|
||||
this.charFont1.string = this.getRandomText(15);
|
||||
this.charFont2.string = this.getRandomText(15);
|
||||
this.charFont3.string = this.getRandomText(15);
|
||||
}, 0.1);
|
||||
}
|
||||
|
||||
|
||||
getRandomText(length: number) {
|
||||
let str = '';
|
||||
while (str.length < length) {
|
||||
str += chars[Math.floor(Math.random() * chars.length)];
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
9
demo/assets/text-render/char-mode/char-mode.ts.meta
Normal file
9
demo/assets/text-render/char-mode/char-mode.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.8",
|
||||
"uuid": "59d30214-6082-40ab-96d5-2704f05b10b5",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
Reference in New Issue
Block a user