12345678910111213141516171819202122232425262728293031323334353637383940 |
- // import playSoundManager from "./Utiles/playSoundManager";
- // import Utiles from "./Utiles/Utiles";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class Loading extends cc.Component {
- start() {
- const str: string = 'Loading...';
- const node: cc.Node = cc.find('label', this.node);
- const node2: cc.Node = cc.find('label/label', this.node);
- const t: number = 0.08;
- this.playLoadingTextEffect(node, t, str);
- this.playLoadingTextEffect(node2, t, str);
- this.scheduleOnce((): void => {
- const sceneName: string = "Main";
- cc.director.loadScene(sceneName);
- }, t * str.length + 0.3);
- // 加载配置数据
- // 加载音乐
- }
- private playLoadingTextEffect(node: cc.Node, t: number, str: string): void {
- let strTemp: string = '';
- for (let i: number = 0; i < str.length; i++) {
- cc.tween(node)
- .delay(t * i)
- .call((): void => {
- strTemp += str[i];
- node.getComponent(cc.Label).string = strTemp;
- })
- .start();
- }
- }
- }
|