3c95264d-4690-4645-8a3f-b6019256b2c0.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. "use strict";
  2. cc._RF.push(module, '3c952ZNRpBGRYo/tgGSVrLA', 'hallScene');
  3. // Script/hallScene.ts
  4. "use strict";
  5. var __extends = (this && this.__extends) || (function () {
  6. var extendStatics = function (d, b) {
  7. extendStatics = Object.setPrototypeOf ||
  8. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  9. function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
  10. return extendStatics(d, b);
  11. };
  12. return function (d, b) {
  13. extendStatics(d, b);
  14. function __() { this.constructor = d; }
  15. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16. };
  17. })();
  18. var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
  19. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  20. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  21. 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;
  22. return c > 3 && r && Object.defineProperty(target, key, r), r;
  23. };
  24. Object.defineProperty(exports, "__esModule", { value: true });
  25. var BaseView_1 = require("../lightMVC/core/base/BaseView");
  26. var SDK_1 = require("./sdk/SDK");
  27. var hallSceneMediator_1 = require("./hallSceneMediator");
  28. var App_1 = require("./Manager/App");
  29. var SoundManager_1 = require("./Manager/SoundManager");
  30. var TimeControl_1 = require("./TimeControl");
  31. var ChooseLevelPanel_1 = require("./view/chooseLevel/ChooseLevelPanel");
  32. var ChooseLevelPanelMediator_1 = require("./view/chooseLevel/ChooseLevelPanelMediator");
  33. var ChooseSkinPanel_1 = require("./view/chooseSkin/ChooseSkinPanel");
  34. var ChooseSkinPanelMediator_1 = require("./view/chooseSkin/ChooseSkinPanelMediator");
  35. var InsufficientPanel_1 = require("./view/insufficientPanel/InsufficientPanel");
  36. var InsufficientPanelMediator_1 = require("./view/insufficientPanel/InsufficientPanelMediator");
  37. var MissionPanel_1 = require("./view/missionPanel/MissionPanel");
  38. var MissionPanelMediator_1 = require("./view/missionPanel/MissionPanelMediator");
  39. var SetNormalPanel_1 = require("./view/setNormal/SetNormalPanel");
  40. var SetNormalPanelMediator_1 = require("./view/setNormal/SetNormalPanelMediator");
  41. var ShopPanel_1 = require("./view/shopView/ShopPanel");
  42. var ShopPanelMediator_1 = require("./view/shopView/ShopPanelMediator");
  43. var TipPanel_1 = require("./view/tipPanel/TipPanel");
  44. var TipPanelMediator_1 = require("./view/tipPanel/TipPanelMediator");
  45. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  46. var hallScene = /** @class */ (function (_super) {
  47. __extends(hallScene, _super);
  48. function hallScene() {
  49. var _this = _super !== null && _super.apply(this, arguments) || this;
  50. _this.startGameBtn = null;
  51. _this.setNormalBtn = null;
  52. // @property(cc.Button)
  53. // public chooseSkinBtn: cc.Button = null;
  54. _this.missionBtn = null;
  55. // @property(cc.Button)
  56. // public btnVideo: cc.Button = null;
  57. // @property(cc.Button)
  58. // public btnShop: cc.Button = null;
  59. _this.btnLeft = null;
  60. _this.btnRight = null;
  61. _this.pageView = null;
  62. _this.labelTili = null;
  63. _this.physicalTime = null;
  64. _this.labelCoin = null;
  65. _this.labelDiamond = null;
  66. _this.loadSceneName = "gameScene";
  67. _this.currientView = 0;
  68. return _this;
  69. // update (dt) {}
  70. }
  71. hallScene_1 = hallScene;
  72. Object.defineProperty(hallScene, "instance", {
  73. get: function () {
  74. return hallScene_1._instance;
  75. },
  76. set: function (value) {
  77. hallScene_1._instance = value;
  78. },
  79. enumerable: false,
  80. configurable: true
  81. });
  82. hallScene.prototype.onLoad = function () {
  83. // cc.sys.localStorage.clear();
  84. hallScene_1.instance = this;
  85. this.registerMediator(hallSceneMediator_1.default, this, "主界面");
  86. SDK_1.default.Instance.showBanner();
  87. };
  88. hallScene.prototype.start = function () {
  89. this.startGameBtn.node.on(cc.Node.EventType.TOUCH_END, this.ClickStartGame, this);
  90. this.setNormalBtn.node.on(cc.Node.EventType.TOUCH_END, this.ClickSetNormal, this);
  91. this.btnLeft.node.on(cc.Node.EventType.TOUCH_END, this.ClickLeft, this);
  92. this.btnRight.node.on(cc.Node.EventType.TOUCH_END, this.ClickRight, this);
  93. // this.btnVideo.node.on(cc.Node.EventType.TOUCH_END, this.ClickAddTili, this);
  94. this.missionBtn.node.on(cc.Node.EventType.TOUCH_END, this.ClickOpenMission, this);
  95. // this.chooseSkinBtn.node.on(cc.Node.EventType.TOUCH_END, this.ClickChooseSkin, this);
  96. // this.btnShop.node.on(cc.Node.EventType.TOUCH_END, this.ClickShop, this);
  97. // console.log('----------', TimeControl.instance.currentTili);
  98. // App.DataManager.TimeCountJudge();//全局倒计时判断
  99. // if (App.DataManager.TimeFlag) {
  100. // let data = { "isShow": true, 'timeStr': App.DataManager.TimeChange(TimeControl.instance.currentTimeCount) };
  101. // this.TiliCountShow(data);
  102. // }
  103. this.ShowPhysicalValue();
  104. this.ShowUserCoinValue();
  105. this.ShowUserDiamondValue();
  106. App_1.App.SoundManager.playBGM(SoundManager_1.SoundManager.hallBgm[0]);
  107. };
  108. hallScene.prototype.ClickOpenMission = function () {
  109. App_1.App.Facade.popView(MissionPanelMediator_1.default, MissionPanel_1.default, "打开任务界面", false);
  110. };
  111. /**
  112. * 体力显示设置
  113. */
  114. hallScene.prototype.ShowPhysicalValue = function () {
  115. console.log('############', TimeControl_1.default.instance.currentTili);
  116. if (hallScene_1.instance.labelTili) {
  117. hallScene_1.instance.labelTili.string = TimeControl_1.default.instance.currentTili + "/" + TimeControl_1.default.instance.tiliMax;
  118. }
  119. };
  120. // 显示玩家金币
  121. hallScene.prototype.ShowUserCoinValue = function () {
  122. if (hallScene_1.instance.labelCoin) {
  123. hallScene_1.instance.labelCoin.string = App_1.App.DataManager.UserCoin.toString();
  124. }
  125. };
  126. // 钻石
  127. hallScene.prototype.ShowUserDiamondValue = function () {
  128. if (hallScene_1.instance.labelDiamond) {
  129. hallScene_1.instance.labelDiamond.string = App_1.App.DataManager.UserDiamond.toString();
  130. }
  131. };
  132. /**
  133. * 体力倒计时显示设置
  134. */
  135. hallScene.prototype.TiliCountShow = function (data) {
  136. if (!this.physicalTime)
  137. return;
  138. this.physicalTime.node.active = data.isShow;
  139. if (data.timeStr)
  140. this.physicalTime.string = data.timeStr;
  141. };
  142. /**
  143. * 开始游戏
  144. */
  145. hallScene.prototype.StartGame = function (intoLevel) {
  146. var _this = this;
  147. console.log("aaa--------intoLevel----------", intoLevel);
  148. App_1.App.DataManager.UpdateTili(TimeControl_1.default.instance.consumeTili, function (success) {
  149. App_1.App.DataManager.CurrentIntoLevel = intoLevel;
  150. App_1.App.DataManager.PlayLevel = App_1.App.DataManager.CurrentIntoLevel;
  151. App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_playLevel, App_1.App.DataManager.PlayLevel);
  152. if (success)
  153. App_1.App.Facade.runBundleScene("gameScene", _this.loadSceneName);
  154. else
  155. App_1.App.Facade.popView(InsufficientPanelMediator_1.default, InsufficientPanel_1.default, "体力不足", false);
  156. });
  157. };
  158. /**
  159. * 点击开始游戏按钮直接开始
  160. */
  161. hallScene.prototype.ClickStartGame = function () {
  162. if (this.pageView.getCurrentPageIndex() == 1) {
  163. App_1.App.Facade.popView(TipPanelMediator_1.default, TipPanel_1.default, "敬请期待!", false);
  164. }
  165. else {
  166. App_1.App.Facade.popView(ChooseLevelPanelMediator_1.default, ChooseLevelPanel_1.default, "关卡选择", false);
  167. }
  168. };
  169. /**
  170. * 点击观看视频加体力
  171. */
  172. hallScene.prototype.ClickAddTili = function () {
  173. var _this = this;
  174. console.log('点击观看视频加体力~');
  175. SoundManager_1.SoundManager.getInstance().VideoStartStop();
  176. SDK_1.default.Instance.showRewardVideo(function () {
  177. TimeControl_1.default.instance.currentTili = TimeControl_1.default.instance.tiliMax;
  178. _this.ShowPhysicalValue();
  179. App_1.App.LocalStorageUtil.setNumber(App_1.App.LocalStorageUtil.lst_Tili, TimeControl_1.default.instance.currentTili);
  180. SoundManager_1.SoundManager.getInstance().VideoEndOpen();
  181. }, function () {
  182. SoundManager_1.SoundManager.getInstance().VideoEndOpen();
  183. }, function () {
  184. SoundManager_1.SoundManager.getInstance().VideoEndOpen();
  185. });
  186. };
  187. // 商城
  188. hallScene.prototype.ClickShop = function () {
  189. App_1.App.Facade.popView(ShopPanelMediator_1.default, ShopPanel_1.default, "商城", false);
  190. };
  191. /**
  192. * 打开关卡选择界面
  193. */
  194. hallScene.prototype.ClickChooseLevel = function () {
  195. App_1.App.Facade.popView(ChooseLevelPanelMediator_1.default, ChooseLevelPanel_1.default, "关卡选择", true);
  196. };
  197. /**
  198. * 打开选择皮肤界面
  199. */
  200. hallScene.prototype.ClickChooseSkin = function () {
  201. App_1.App.Facade.popView(ChooseSkinPanelMediator_1.default, ChooseSkinPanel_1.default, "皮肤选择", false);
  202. };
  203. /**
  204. * 打开设置界面
  205. */
  206. hallScene.prototype.ClickSetNormal = function () {
  207. App_1.App.Facade.popView(SetNormalPanelMediator_1.default, SetNormalPanel_1.default, "设置", false);
  208. };
  209. hallScene.prototype.ClickLeft = function () {
  210. this.currientView = this.pageView.getCurrentPageIndex() == 0 ? 1 : 0;
  211. this.pageView.scrollToPage(this.currientView, 0.5);
  212. };
  213. hallScene.prototype.ClickRight = function () {
  214. this.currientView = this.pageView.getCurrentPageIndex() == 0 ? 1 : 0;
  215. this.pageView.scrollToPage(this.currientView, 0.5);
  216. };
  217. hallScene.prototype.onDisable = function () {
  218. this.startGameBtn.node.off(cc.Node.EventType.TOUCH_END, this.ClickStartGame, this);
  219. this.setNormalBtn.node.off(cc.Node.EventType.TOUCH_END, this.ClickSetNormal, this);
  220. this.btnLeft.node.off(cc.Node.EventType.TOUCH_END, this.ClickLeft, this);
  221. this.btnRight.node.off(cc.Node.EventType.TOUCH_END, this.ClickRight, this);
  222. this.missionBtn.node.off(cc.Node.EventType.TOUCH_END, this.ClickOpenMission, this);
  223. // this.btnVideo.node.off(cc.Node.EventType.TOUCH_END, this.ClickAddTili, this);
  224. // this.btnShop.node.off(cc.Node.EventType.TOUCH_END, this.ClickShop, this);
  225. // this.chooseSkinBtn.node.off(cc.Node.EventType.TOUCH_END, this.ClickChooseSkin, this);
  226. };
  227. var hallScene_1;
  228. __decorate([
  229. property(cc.Button)
  230. ], hallScene.prototype, "startGameBtn", void 0);
  231. __decorate([
  232. property(cc.Button)
  233. ], hallScene.prototype, "setNormalBtn", void 0);
  234. __decorate([
  235. property(cc.Button)
  236. ], hallScene.prototype, "missionBtn", void 0);
  237. __decorate([
  238. property(cc.Button)
  239. ], hallScene.prototype, "btnLeft", void 0);
  240. __decorate([
  241. property(cc.Button)
  242. ], hallScene.prototype, "btnRight", void 0);
  243. __decorate([
  244. property(cc.PageView)
  245. ], hallScene.prototype, "pageView", void 0);
  246. __decorate([
  247. property(cc.Label)
  248. ], hallScene.prototype, "labelTili", void 0);
  249. __decorate([
  250. property(cc.Label)
  251. ], hallScene.prototype, "physicalTime", void 0);
  252. __decorate([
  253. property(cc.Label)
  254. ], hallScene.prototype, "labelCoin", void 0);
  255. __decorate([
  256. property(cc.Label)
  257. ], hallScene.prototype, "labelDiamond", void 0);
  258. hallScene = hallScene_1 = __decorate([
  259. ccclass
  260. ], hallScene);
  261. return hallScene;
  262. }(BaseView_1.BaseView));
  263. exports.default = hallScene;
  264. cc._RF.pop();