1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- /**
- * 代码描述
- */
- import { Audio } from "../../common/src/Audio";
- import { UIManager } from "../../common/src/UIManager";
- import { Utils } from "../../common/src/Utils";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export class FailPanel extends cc.Component {
- @property({ type: cc.Node, tooltip: '按钮节点' })
- button: cc.Node = null;
- @property({ type: cc.AudioClip, tooltip: '音效节点' })
- click: cc.AudioClip = null;
- onEnable() {
- this.button.getChildByName('restart').on('click', this.onRestart, this);
- this.button.getChildByName('resurgence').on('click', this.onResurgence, this);
- Utils.openPanel(this.node.getChildByName('panel'));
- Utils.btnTween(this.button.getChildByName('resurgence'));
- Audio.playSoundByPath('fail:res/snd/fail');
- }
- /**再来一次 */
- private onRestart(): void {
- Audio.playSoundByPath('fail:res/snd/click');
- UIManager.close('fail:FailPanel', true);
- cc.systemEvent.emit('restart');
- }
- /**复活 */
- private onResurgence(): void {
- Audio.playSoundByPath('fail:res/snd/click');
- UIManager.close('fail:FailPanel', true);
- cc.systemEvent.emit('updateBubble', 5);
- }
- }
|