| 12345678910111213141516171819202122232425262728293031323334 |
- import { UIViewID } from '@scripts/define/UIDefine';
- import { UICloseReason } from '@scripts/framework/ui/UILayer';
- import { UIView } from '@scripts/framework/ui/UIView';
- import { _decorator, Component, Node, Tween, tween, UIOpacity } from 'cc';
- const { ccclass, property } = _decorator;
- @ccclass('LoadingView')
- export class LoadingView extends UIView {
- readonly viewId = UIViewID.LoadingView;
- @property(UIOpacity)
- uiOpacity: UIOpacity;
- @property(Node)
- circleNode: Node = null;
- protected onOpen({ delay }): void | Promise<void> {
- Tween.stopAllByTarget(this.circleNode);
- tween(this.circleNode).by(0.5, { angle: -200 }).repeatForever().start();
- Tween.stopAllByTarget(this.uiOpacity);
- this.uiOpacity.opacity = delay > 0 ? 0 : 255;
- if (delay > 0) {
- tween(this.uiOpacity).to(0.2, { opacity: 255 }).delay(delay).start();
- }
- }
- protected onClose(_reason: UICloseReason): void | Promise<void> {
- Tween.stopAllByTarget(this.circleNode);
- Tween.stopAllByTarget(this.uiOpacity);
- }
- }
|