| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import { _decorator, Button, Component, director, Node } from 'cc';
- import { BasePanel } from './BasePanel';
- import { PlayerCtl } from '../Game/PlayerCtl';
- import { LoadRes } from '../Config/LoadRes';
- import { StateManager, FailState } from '../Game/StateManager';
- import { UIManager } from './UIManager';
- const { ccclass, property } = _decorator;
- @ccclass('AdPanel')
- export class AdPanel extends BasePanel {
- private Get_Btn:Button;
- private Cancel_Btn:Button;
- start() {
- this.Get_Btn = this.node.getChildByName("Get_Btn").getComponent(Button);
- this.Cancel_Btn = this.node.getChildByName("Cancel_Btn").getComponent(Button);
- this.Get_Btn.node.on(Button.EventType.CLICK, this.onGet, this);
- this.Cancel_Btn.node.on(Button.EventType.CLICK, this.onCancel, this);
- }
- //看广告
- onGet() {
- super.onClose(null);
- PlayerCtl.instance.onAdFinish();
- }
- //不看广告
- onCancel() {
- StateManager.getInstance().setState(new FailState());
- super.onClose(()=>{
- //游戏结束,调用结算界面
- UIManager.Instance.ShowUI('resultPanel', LoadRes.getInstance().resultPanel);
- });
-
- }
- update(deltaTime: number) {
-
- }
- onClose() {
- super.onClose(null);
- }
- }
|