大侠
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.
 
 
 

51 lines
1.7 KiB

//#region 文件引入
import { _decorator, Button, Component, Label, Node, sp, Sprite,Animation, RichText, Prefab, instantiate, tween, UIOpacity, v3 } from "cc";
import UIParse from "../../Mgr_UI/UIParse";
//#endregion 文件引入
const {ccclass, property,menu} = _decorator;
@ccclass("EnemyCoin_Proxy")
export default class EnemyCoin_Proxy extends UIParse{
//#region 节点自动生成
@property(Label)
lab_num: Label = null;
//#endregion 节点自动生成
private static textPool: Node[] = [];
static CreateCoin(_prefab: Prefab) {
if (this.textPool.length) {
return this.textPool.pop();
} else {
return instantiate(_prefab);
}
}
static RecycleCoin(tNode: Node) {
tNode.removeFromParent();
this.textPool.push(tNode);
}
onButtonClick(button:Button){
/**点击事件触发*/
switch (button) {
default:
ConsoleEx.Log(button);
break;
}
}
onAnimationEvent(){
EnemyCoin_Proxy.RecycleCoin(this.node);
}
PlayText(text:string){
CNodeUtils.setOpacity(this.node, 255);
const tUIOpacity = this.node.getComponent(UIOpacity);
const bezier = tween(this.node).delay(0.3).to(0.7,{position:v3(0,100)});
const Opacity = tween(tUIOpacity).delay(0.3).to(0.7, { opacity: 0 });
tween(this.node).parallel(bezier, Opacity).call(() => {
this.onAnimationEvent();
}).start();
CNodeUtils.switchText(this.lab_num, text);
}
}