12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- cc.Class({
- extends: cc.Component,
- editor: {
- menu: 'Launch/HotUpdateTipLabel'
- },
- properties: {
- deltaTime: cc.Float
- },
- onEnable () {
- this._count = 0;
- this._default = '更新中';
- let label = this.node.getComponent(cc.Label);
- this.schedule(() => {
- let index = this._count % 3;
- cc.log('index ' + index);
- label.string = this._getLabelStr(index);
- this._count += 1;
- if (this._count > 3) {
- this._count = 0;
- }
- }, this.deltaTime);
- },
- onDisable () {
- this.unscheduleAllCallbacks();
- },
- _getLabelStr (index) {
- switch (index) {
- case 0:
- return this._default + '.';
- case 1:
- return this._default + '..';
- case 2:
- return this._default + '...';
- }
- }
- });
|