咸鱼的反击
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
xianyudefanji/assets/Scripts/SCommon/CommonTextTips.ts

42 lines
1.0 KiB

const {ccclass, property} = cc._decorator;
@ccclass
export default class CommonTextTips extends cc.Component {
@property(cc.Node)
contentNode: cc.Node = null;
@property(cc.Node)
contentStr: cc.Node = null;
onLoad () {
}
start () {
}
initView(contentStr, time, isRich){
if(isRich){
this.contentStr.active = false
this.contentNode.getChildByName('contentStr2').active = true
let str2Node = this.contentNode.getChildByName('contentStr2')
str2Node.getComponent(cc.RichText).string = contentStr
cc.tween(this.contentNode).delay(time).to(0.5, { y: 555, opacity: 0 }).call(() => {
this.node.removeFromParent()
}).start();
}else{
this.contentStr.getComponent(cc.Label).string = contentStr
cc.tween(this.contentNode).delay(time).to(0.5, { y: 555, opacity: 0 }).call(() => {
this.node.removeFromParent()
}).start();
}
}
}