Commit 3eae6e8e authored by 范雪寒's avatar 范雪寒

feat: buttonOnClick

parent 88812c6d
...@@ -423,15 +423,15 @@ export function onHomeworkFinish() { ...@@ -423,15 +423,15 @@ export function onHomeworkFinish() {
} }
} }
export function buttonOnClick(button: cc.Node, callback: Function, scale = 1.1) { export function buttonOnClick(button: cc.Node, callback: Function, scale = 1.0) {
button.on('click', () => { button.on('click', () => {
if (button['cantClick']) { if (button['cantClick']) {
return; return;
} }
button['cantClick'] = true; button['cantClick'] = true;
cc.tween(button) cc.tween(button)
.to(0.1, { scale: scale * 1.1 })
.to(0.1, { scale: scale }) .to(0.1, { scale: scale })
.to(0.1, { scale: 1.0 })
.call(() => { .call(() => {
button['cantClick'] = false; button['cantClick'] = false;
callback && callback(); callback && callback();
...@@ -440,6 +440,7 @@ export function buttonOnClick(button: cc.Node, callback: Function, scale = 1.1) ...@@ -440,6 +440,7 @@ export function buttonOnClick(button: cc.Node, callback: Function, scale = 1.1)
}); });
} }
export function jumpToBundle(bundleName: string) { export function jumpToBundle(bundleName: string) {
const middleLayer = cc.find('middleLayer'); const middleLayer = cc.find('middleLayer');
if (middleLayer) { if (middleLayer) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment