import { _decorator , Component , Node , Label , Widget , tween , Vec2 , Vec3 } from 'cc' ; const { ccclass , property } = _decorator ; @ ccclass ( 'AchievementHint' ) export class AchievementHint extends Component { @ property ( { type : Label } ) public contentLbl : Label ; @ property ( { type : Widget } ) public widget : Widget ; private _isShowing = false ; private _timer = null ; start ( ) { } public show ( content , time = 1 ) { if ( ! this . _isShowing ) { this . _isShowing ; this . node . active = true ; this . contentLbl . string = content ; this . widget . top = - 100 ; tween ( this . widget ) . to ( 0.5 , { top : 0 } ) . start ( ) ; this . _timer = setTimeout ( ( ) => { this . node . active = false ; this . _isShowing = false ; } , time * 1000 ) ; } else { this . contentLbl . string = content ; clearTimeout ( this . _timer ) ; this . _timer = setTimeout ( ( ) => { this . node . active = false ; this . _isShowing = false ; } , time * 1000 ) ; } } }