UIStageTip.ts 994 B

12345678910111213141516171819202122232425262728293031323334
  1. import { Widget, _decorator, Node, Label, tween, v3, Tween, UIOpacity } from 'cc';
  2. import { UIBase } from '../scriptBase/UIBase';
  3. const { ccclass, property, requireComponent } = _decorator;
  4. @ccclass('UI/UIStageTip')
  5. @requireComponent(Widget)
  6. export class UIStageTip extends UIBase {
  7. private lbTip: Label = null
  8. private arrow: Node = null
  9. private uiOpacity: UIOpacity = null
  10. protected onLoad(): void {
  11. this.lbTip = this.findComp('LbTip', Label)
  12. this.arrow = this.findNode('Arrow')
  13. this.uiOpacity = this.getComponent(UIOpacity)
  14. }
  15. public onOpen(data?: any): void {
  16. this.lbTip.string = data
  17. tween(this.lbTip.node).to(0.5, { position: v3(0, 0, 0) }, { easing: 'sineOut' }).start()
  18. tween(this.arrow).to(10, { position: v3(850, 0) }).start()
  19. tween(this.uiOpacity).delay(2).to(1, { opacity: 0 }).call(() => {
  20. this.node.destroy()
  21. }).start()
  22. }
  23. public onClose(data?: any): void {
  24. }
  25. }