| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import { _decorator, Component, Node } from 'cc';
- import { aa, UIController, UIElement } from 'db://assets/scripts/aa';
- import { UI_Dialog } from '../UI_Dialog';
- import { rootMgr } from '../../../scene/RootMgr';
- const { ccclass, property } = _decorator;
- @UIController({ bundleName: 'dialog', path: 'revive/revive' })
- //复活面板
- @ccclass('UI_Revive')
- export class UI_Revive extends UI_Dialog {
- @UIElement(Node)
- reviveBtn: Node;
- @UIElement(Node)
- closebtn: Node;
- @UIElement(Node)
- closeBtn001: Node;
- start() {
- this.reviveBtn.on(Node.EventType.TOUCH_END, this.handleRevive, this)
- this.closebtn.on(Node.EventType.TOUCH_END, this.closeFile, this)
- this.closeBtn001.on(Node.EventType.TOUCH_END, this.closeFile, this)
- }
- //复活按钮
- private handleRevive() {
- // 播放复活广告
- aa.sdk.playRewardAd("复活-解锁新桌子").then((ok) => {
- if (ok) {
- rootMgr.game.evt.emit('revive_request')// 广告成功,执行复活
- this.close(); // 关闭面板
- } else {
- rootMgr.game.evt.emit('revive_fail'); // 广告失败,游戏结束
- this.close(); // 关闭面板
-
-
- }
- });
- }
- closeFile() {
- rootMgr.game.evt.emit('revive_fail'); // 广告失败,游戏结束
- this.close(); // 关闭面板
- }
- }
|