"use strict"; cc._RF.push(module, '3c952ZNRpBGRYo/tgGSVrLA', 'hallScene'); // Script/hallScene.ts "use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); var BaseView_1 = require("../lightMVC/core/base/BaseView"); var SDK_1 = require("./sdk/SDK"); var hallSceneMediator_1 = require("./hallSceneMediator"); var App_1 = require("./Manager/App"); var SoundManager_1 = require("./Manager/SoundManager"); var TimeControl_1 = require("./TimeControl"); var ChooseLevelPanel_1 = require("./view/chooseLevel/ChooseLevelPanel"); var ChooseLevelPanelMediator_1 = require("./view/chooseLevel/ChooseLevelPanelMediator"); var ChooseSkinPanel_1 = require("./view/chooseSkin/ChooseSkinPanel"); var ChooseSkinPanelMediator_1 = require("./view/chooseSkin/ChooseSkinPanelMediator"); var InsufficientPanel_1 = require("./view/insufficientPanel/InsufficientPanel"); var InsufficientPanelMediator_1 = require("./view/insufficientPanel/InsufficientPanelMediator"); var MissionPanel_1 = require("./view/missionPanel/MissionPanel"); var MissionPanelMediator_1 = require("./view/missionPanel/MissionPanelMediator"); var SetNormalPanel_1 = require("./view/setNormal/SetNormalPanel"); var SetNormalPanelMediator_1 = require("./view/setNormal/SetNormalPanelMediator"); var ShopPanel_1 = require("./view/shopView/ShopPanel"); var ShopPanelMediator_1 = require("./view/shopView/ShopPanelMediator"); var TipPanel_1 = require("./view/tipPanel/TipPanel"); var TipPanelMediator_1 = require("./view/tipPanel/TipPanelMediator"); var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property; var hallScene = /** @class */ (function (_super) { __extends(hallScene, _super); function hallScene() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.startGameBtn = null; _this.setNormalBtn = null; // @property(cc.Button) // public chooseSkinBtn: cc.Button = null; _this.missionBtn = null; // @property(cc.Button) // public btnVideo: cc.Button = null; // @property(cc.Button) // public btnShop: cc.Button = null; _this.btnLeft = null; _this.btnRight = null; _this.pageView = null; _this.labelTili = null; _this.physicalTime = null; _this.labelCoin = null; _this.labelDiamond = null; _this.loadSceneName = "gameScene"; _this.currientView = 0; return _this; // update (dt) {} } hallScene_1 = hallScene; Object.defineProperty(hallScene, "instance", { get: function () { return hallScene_1._instance; }, set: function (value) { hallScene_1._instance = value; }, enumerable: false, configurable: true }); hallScene.prototype.onLoad = function () { // cc.sys.localStorage.clear(); hallScene_1.instance = this; this.registerMediator(hallSceneMediator_1.default, this, "主界面"); SDK_1.default.Instance.showBanner(); }; hallScene.prototype.start = function () { this.startGameBtn.node.on(cc.Node.EventType.TOUCH_END, this.ClickStartGame, this); this.setNormalBtn.node.on(cc.Node.EventType.TOUCH_END, this.ClickSetNormal, this); this.btnLeft.node.on(cc.Node.EventType.TOUCH_END, this.ClickLeft, this); this.btnRight.node.on(cc.Node.EventType.TOUCH_END, this.ClickRight, this); // this.btnVideo.node.on(cc.Node.EventType.TOUCH_END, this.ClickAddTili, this); this.missionBtn.node.on(cc.Node.EventType.TOUCH_END, this.ClickOpenMission, this); // this.chooseSkinBtn.node.on(cc.Node.EventType.TOUCH_END, this.ClickChooseSkin, this); // this.btnShop.node.on(cc.Node.EventType.TOUCH_END, this.ClickShop, this); // console.log('----------', TimeControl.instance.currentTili); // App.DataManager.TimeCountJudge();//全局倒计时判断 // if (App.DataManager.TimeFlag) { // let data = { "isShow": true, 'timeStr': App.DataManager.TimeChange(TimeControl.instance.currentTimeCount) }; // this.TiliCountShow(data); // } this.ShowPhysicalValue(); this.ShowUserCoinValue(); this.ShowUserDiamondValue(); App_1.App.SoundManager.playBGM(SoundManager_1.SoundManager.hallBgm[0]); }; hallScene.prototype.ClickOpenMission = function () { App_1.App.Facade.popView(MissionPanelMediator_1.default, MissionPanel_1.default, "打开任务界面", false); }; /** * 体力显示设置 */ hallScene.prototype.ShowPhysicalValue = function () { console.log('############', TimeControl_1.default.instance.currentTili); if (hallScene_1.instance.labelTili) { hallScene_1.instance.labelTili.string = TimeControl_1.default.instance.currentTili + "/" + TimeControl_1.default.instance.tiliMax; } }; // 显示玩家金币 hallScene.prototype.ShowUserCoinValue = function () { if (hallScene_1.instance.labelCoin) { hallScene_1.instance.labelCoin.string = App_1.App.DataManager.UserCoin.toString(); } }; // 钻石 hallScene.prototype.ShowUserDiamondValue = function () { if (hallScene_1.instance.labelDiamond) { hallScene_1.instance.labelDiamond.string = App_1.App.DataManager.UserDiamond.toString(); } }; /** * 体力倒计时显示设置 */ hallScene.prototype.TiliCountShow = function (data) { if (!this.physicalTime) return; this.physicalTime.node.active = data.isShow; if (data.timeStr) this.physicalTime.string = data.timeStr; }; /** * 开始游戏 */ hallScene.prototype.StartGame = function (intoLevel) { var _this = this; console.log("aaa--------intoLevel----------", intoLevel); App_1.App.DataManager.UpdateTili(TimeControl_1.default.instance.consumeTili, function (success) { App_1.App.DataManager.CurrentIntoLevel = intoLevel; App_1.App.DataManager.PlayLevel = App_1.App.DataManager.CurrentIntoLevel; App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_playLevel, App_1.App.DataManager.PlayLevel); if (success) App_1.App.Facade.runBundleScene("gameScene", _this.loadSceneName); else App_1.App.Facade.popView(InsufficientPanelMediator_1.default, InsufficientPanel_1.default, "体力不足", false); }); }; /** * 点击开始游戏按钮直接开始 */ hallScene.prototype.ClickStartGame = function () { if (this.pageView.getCurrentPageIndex() == 1) { App_1.App.Facade.popView(TipPanelMediator_1.default, TipPanel_1.default, "敬请期待!", false); } else { App_1.App.Facade.popView(ChooseLevelPanelMediator_1.default, ChooseLevelPanel_1.default, "关卡选择", false); } }; /** * 点击观看视频加体力 */ hallScene.prototype.ClickAddTili = function () { var _this = this; console.log('点击观看视频加体力~'); SoundManager_1.SoundManager.getInstance().VideoStartStop(); SDK_1.default.Instance.showRewardVideo(function () { TimeControl_1.default.instance.currentTili = TimeControl_1.default.instance.tiliMax; _this.ShowPhysicalValue(); App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_Tili, TimeControl_1.default.instance.currentTili); SoundManager_1.SoundManager.getInstance().VideoEndOpen(); }, function () { SoundManager_1.SoundManager.getInstance().VideoEndOpen(); }, function () { SoundManager_1.SoundManager.getInstance().VideoEndOpen(); }); }; // 商城 hallScene.prototype.ClickShop = function () { App_1.App.Facade.popView(ShopPanelMediator_1.default, ShopPanel_1.default, "商城", false); }; /** * 打开关卡选择界面 */ hallScene.prototype.ClickChooseLevel = function () { App_1.App.Facade.popView(ChooseLevelPanelMediator_1.default, ChooseLevelPanel_1.default, "关卡选择", true); }; /** * 打开选择皮肤界面 */ hallScene.prototype.ClickChooseSkin = function () { App_1.App.Facade.popView(ChooseSkinPanelMediator_1.default, ChooseSkinPanel_1.default, "皮肤选择", false); }; /** * 打开设置界面 */ hallScene.prototype.ClickSetNormal = function () { App_1.App.Facade.popView(SetNormalPanelMediator_1.default, SetNormalPanel_1.default, "设置", false); }; hallScene.prototype.ClickLeft = function () { this.currientView = this.pageView.getCurrentPageIndex() == 0 ? 1 : 0; this.pageView.scrollToPage(this.currientView, 0.5); }; hallScene.prototype.ClickRight = function () { this.currientView = this.pageView.getCurrentPageIndex() == 0 ? 1 : 0; this.pageView.scrollToPage(this.currientView, 0.5); }; hallScene.prototype.onDisable = function () { this.startGameBtn.node.off(cc.Node.EventType.TOUCH_END, this.ClickStartGame, this); this.setNormalBtn.node.off(cc.Node.EventType.TOUCH_END, this.ClickSetNormal, this); this.btnLeft.node.off(cc.Node.EventType.TOUCH_END, this.ClickLeft, this); this.btnRight.node.off(cc.Node.EventType.TOUCH_END, this.ClickRight, this); this.missionBtn.node.off(cc.Node.EventType.TOUCH_END, this.ClickOpenMission, this); // this.btnVideo.node.off(cc.Node.EventType.TOUCH_END, this.ClickAddTili, this); // this.btnShop.node.off(cc.Node.EventType.TOUCH_END, this.ClickShop, this); // this.chooseSkinBtn.node.off(cc.Node.EventType.TOUCH_END, this.ClickChooseSkin, this); }; var hallScene_1; __decorate([ property(cc.Button) ], hallScene.prototype, "startGameBtn", void 0); __decorate([ property(cc.Button) ], hallScene.prototype, "setNormalBtn", void 0); __decorate([ property(cc.Button) ], hallScene.prototype, "missionBtn", void 0); __decorate([ property(cc.Button) ], hallScene.prototype, "btnLeft", void 0); __decorate([ property(cc.Button) ], hallScene.prototype, "btnRight", void 0); __decorate([ property(cc.PageView) ], hallScene.prototype, "pageView", void 0); __decorate([ property(cc.Label) ], hallScene.prototype, "labelTili", void 0); __decorate([ property(cc.Label) ], hallScene.prototype, "physicalTime", void 0); __decorate([ property(cc.Label) ], hallScene.prototype, "labelCoin", void 0); __decorate([ property(cc.Label) ], hallScene.prototype, "labelDiamond", void 0); hallScene = hallScene_1 = __decorate([ ccclass ], hallScene); return hallScene; }(BaseView_1.BaseView)); exports.default = hallScene; cc._RF.pop();