mirror of
https://github.com/zhitaocai/CocosCreator-Multi-resolution-Adapter.git
synced 2026-05-19 19:37:58 +08:00
24 lines
751 B
TypeScript
24 lines
751 B
TypeScript
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class VerticalAdapterSceneControl extends cc.Component {
|
|
@property(cc.ProgressBar)
|
|
progressBar: cc.ProgressBar = null;
|
|
|
|
@property(cc.Label)
|
|
progressLabel: cc.Label = null;
|
|
|
|
start() {
|
|
this.progressBar.totalLength = this.progressBar.node.width;
|
|
this.progressBar.progress = 0;
|
|
this.schedule(() => {
|
|
// 无限重置
|
|
if (this.progressBar.progress > 1) {
|
|
this.progressBar.progress = 0;
|
|
}
|
|
this.progressBar.progress = this.progressBar.progress + 0.01;
|
|
this.progressLabel.string = `正在加载 ${Math.floor(this.progressBar.progress * 100)}%`;
|
|
}, 0.1);
|
|
}
|
|
}
|