我智商爆棚
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.
 
 
 
 
 

37 lines
979 B

/*
* @Author: YeeChan
* @Date: 2020-12-21 14:57:35
* @Description:
*/
import SoundMgr from "../Mgr/SoundMgr";
const { ccclass, property, menu, disallowMultiple, executionOrder, requireComponent } = cc._decorator;
/**
* 添加一个按钮,并绑定按钮声音
* 如果按钮 transition == cc.Button.Transition.NONE
* 按钮过渡类型为缩放
* 缩放值为0.9
*/
@ccclass
@requireComponent(cc.Button)
@disallowMultiple() //防止多个相同类型(或子类型)的组件被添加到同一个节点
@menu('FM组件/FMButton')
export class FMButton extends cc.Component {
protected onLoad() {
let but = this.node.getComponent(cc.Button);
if (but.transition == cc.Button.Transition.NONE) {
but.transition = cc.Button.Transition.SCALE;
but.duration = 0.1;
but.zoomScale = 0.9;
}
this.node.on("click", () => {
// SoundMgr.playSound_custom("anniu");
}, this);
}
}