|
@@ -12,11 +12,16 @@ export default class BtnOpenPanel extends cc.Component {
|
|
|
private panel_name = '';
|
|
private panel_name = '';
|
|
|
@property({ displayName: '打开类型', tooltip: 'normal不操作,closeOther关闭其他,closeLast关闭上一个', type: cc.Enum(OpenActionType) })
|
|
@property({ displayName: '打开类型', tooltip: 'normal不操作,closeOther关闭其他,closeLast关闭上一个', type: cc.Enum(OpenActionType) })
|
|
|
private open_type = OpenActionType.normal;
|
|
private open_type = OpenActionType.normal;
|
|
|
|
|
+ @property({ displayName: '点击效果', tooltip: "仅支持 NONE 和 SCALE", type: cc.Enum(cc.Button.Transition) })
|
|
|
|
|
+ public transition_type: cc.Button.Transition = cc.Button.Transition.NONE;
|
|
|
@property({ displayName: '完成回调', tooltip: "面板打开完成后触发", type: cc.Component.EventHandler })
|
|
@property({ displayName: '完成回调', tooltip: "面板打开完成后触发", type: cc.Component.EventHandler })
|
|
|
public onComplete: cc.Component.EventHandler[] = [];
|
|
public onComplete: cc.Component.EventHandler[] = [];
|
|
|
|
|
|
|
|
onLoad() {
|
|
onLoad() {
|
|
|
- if (!this.node.getComponent(cc.Button)) this.node.addComponent(cc.Button);
|
|
|
|
|
|
|
+ if (!this.node.getComponent(cc.Button)) {
|
|
|
|
|
+ let btn_comp = this.node.addComponent(cc.Button);
|
|
|
|
|
+ btn_comp.transition = this.transition_type;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
start() {
|
|
start() {
|
|
@@ -24,6 +29,7 @@ export default class BtnOpenPanel extends cc.Component {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private async openPanel() {
|
|
private async openPanel() {
|
|
|
|
|
+ if (!this.panel_name) return;
|
|
|
await mk.ui.openPanel(this.panel_name, this.open_type);
|
|
await mk.ui.openPanel(this.panel_name, this.open_type);
|
|
|
const c_count = this.onComplete.length;
|
|
const c_count = this.onComplete.length;
|
|
|
for (let i = 0; i < c_count; i++) {
|
|
for (let i = 0; i < c_count; i++) {
|