6b4eb702-4f49-4486-8659-589195734612.js 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533
  1. "use strict";
  2. cc._RF.push(module, '6b4ebcCT0lEhoZZWJGVc0YS', 'UIUpgradePanel');
  3. // scripts/UI/UIUpgradePanel.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 (b.hasOwnProperty(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. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  25. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  26. return new (P || (P = Promise))(function (resolve, reject) {
  27. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  28. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  29. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  30. step((generator = generator.apply(thisArg, _arguments || [])).next());
  31. });
  32. };
  33. var __generator = (this && this.__generator) || function (thisArg, body) {
  34. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  35. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  36. function verb(n) { return function (v) { return step([n, v]); }; }
  37. function step(op) {
  38. if (f) throw new TypeError("Generator is already executing.");
  39. while (_) try {
  40. if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
  41. if (y = 0, t) op = [op[0] & 2, t.value];
  42. switch (op[0]) {
  43. case 0: case 1: t = op; break;
  44. case 4: _.label++; return { value: op[1], done: false };
  45. case 5: _.label++; y = op[1]; op = [0]; continue;
  46. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  47. default:
  48. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  49. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  50. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  51. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  52. if (t[2]) _.ops.pop();
  53. _.trys.pop(); continue;
  54. }
  55. op = body.call(thisArg, _);
  56. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  57. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  58. }
  59. };
  60. Object.defineProperty(exports, "__esModule", { value: true });
  61. var UIPage_1 = require("../Framework/UIPage");
  62. var Constant_1 = require("../Framework/Constant");
  63. var CocosZ_1 = require("../Framework/CocosZ");
  64. var Utils_1 = require("../../common-plugin/Scripts/Utils");
  65. var TweenEffect_1 = require("../Framework/TweenEffect");
  66. var UpgradeMgr_1 = require("../Game/UpgradeMgr");
  67. var PlatUtils_1 = require("../../common-plugin/Scripts/PlatUtils");
  68. var gameMgr_1 = require("../Game/gameMgr");
  69. var ATRewardedVideoJSSDK_1 = require("../AnyThinkAds/ATRewardedVideoJSSDK");
  70. var ATAndroidJS2_1 = require("../ATAndroidJS2");
  71. var GlobalManager_1 = require("../GlobalManager");
  72. var _a = cc._decorator, ccclass = _a.ccclass, property = _a.property;
  73. /**
  74. * 皮肤试用面板
  75. */
  76. var UIUpgradePanel = /** @class */ (function (_super) {
  77. __extends(UIUpgradePanel, _super);
  78. function UIUpgradePanel() {
  79. var _this = _super.call(this, Constant_1.PanelName.UIUpgradePanel) || this;
  80. _this._mask = null;
  81. _this._panel = null;
  82. _this._skill0 = null;
  83. _this._skill1 = null;
  84. _this._skill2 = null;
  85. _this._skill3 = null;
  86. _this._skill4 = null;
  87. _this._btnRefresh = null;
  88. _this._betterArr = [];
  89. _this._otherArr = []; // 可以获取的技能数组
  90. _this._uiSkillIdArr = []; // 随机4个技能
  91. _this._curIndex = -1; // 当前选中下标
  92. _this._canClick = true; // 能否点击
  93. _this._lockArr = [false, false, false, false, false];
  94. _this.isValid() && _this.onLoad();
  95. return _this;
  96. }
  97. UIUpgradePanel.prototype.onLoad = function () {
  98. this._mask = this._page.getChildByName("Mask");
  99. this._panel = this._page.getChildByName("Panel");
  100. var btnNames = ["skill0", "skill1", "skill2", "skill3", "skill4", "btnRefresh"];
  101. for (var i = 0; i < btnNames.length; i++) {
  102. var btn = cc.find(btnNames[i], this._panel);
  103. if (btn) {
  104. btn.on(cc.Node.EventType.TOUCH_END, this._onBtnClickedHandler, this);
  105. if (btn.name == "skill0") {
  106. this._skill0 = btn;
  107. }
  108. else if (btn.name == "skill1") {
  109. this._skill1 = btn;
  110. }
  111. else if (btn.name == "skill2") {
  112. this._skill2 = btn;
  113. }
  114. else if (btn.name == "skill3") {
  115. this._skill3 = btn;
  116. }
  117. else if (btn.name == "skill4") {
  118. this._skill4 = btn;
  119. }
  120. else if (btn.name == "btnRefresh") {
  121. this._btnRefresh = btn;
  122. btn.active = CocosZ_1.cocosz.isADON;
  123. }
  124. }
  125. }
  126. // 服务器锁的数量
  127. var serverValue = CocosZ_1.cocosz.getConfigByKey("skillLockNum");
  128. if (Number.isInteger(serverValue)) {
  129. for (var i = 0; i < 5; i++) {
  130. if (i + serverValue >= 5) {
  131. this._lockArr[i] = true;
  132. }
  133. else {
  134. this._lockArr[i] = false;
  135. }
  136. }
  137. }
  138. this.initAdForPage();
  139. };
  140. UIUpgradePanel.prototype.initAdForPage = function () {
  141. if (cc.sys.os === cc.sys.OS_ANDROID) {
  142. var deviceId = ATAndroidJS2_1.default.getDeviceUserId();
  143. console.log("zh:checkstatus:", ATRewardedVideoJSSDK_1.default.checkAdStatus(ATAndroidJS2_1.default.getPlacementId()));
  144. var setting = {};
  145. setting[ATRewardedVideoJSSDK_1.default.userIdKey] = deviceId;
  146. ATRewardedVideoJSSDK_1.default.loadRewardedVideo(ATAndroidJS2_1.default.getPlacementId(), setting);
  147. }
  148. };
  149. UIUpgradePanel.prototype.onOpen = function () {
  150. Utils_1.utils.SendEvent("页面-技能");
  151. // 优先技能数组
  152. var better = [
  153. UpgradeMgr_1.SkillType.双发, UpgradeMgr_1.SkillType.子弹碎片, UpgradeMgr_1.SkillType.枪林弹雨, UpgradeMgr_1.SkillType.谢幕,
  154. UpgradeMgr_1.SkillType.瞬斩, UpgradeMgr_1.SkillType.冰霜精通, UpgradeMgr_1.SkillType.火焰精通, UpgradeMgr_1.SkillType.萃取,
  155. UpgradeMgr_1.SkillType.再生, UpgradeMgr_1.SkillType.护甲靴子, UpgradeMgr_1.SkillType.疾走, UpgradeMgr_1.SkillType.神圣守护,
  156. UpgradeMgr_1.SkillType.通灵匕首, UpgradeMgr_1.SkillType.飞轮, UpgradeMgr_1.SkillType.闪电, UpgradeMgr_1.SkillType.燃烧瓶
  157. ];
  158. // 可以获取的技能数组
  159. for (var i = 0; i <= 34; i++) {
  160. if ([UpgradeMgr_1.SkillType.雷电精通, UpgradeMgr_1.SkillType.龙卵, UpgradeMgr_1.SkillType.通灵镰刀].includes(i)) {
  161. // 剔除的技能
  162. }
  163. else if (UpgradeMgr_1.upgradeMgr && UpgradeMgr_1.upgradeMgr.isValid && UpgradeMgr_1.upgradeMgr.upgradeSkillArr[i] >= UpgradeMgr_1.upgradeMgr.upgradeSkillMaxLevelArr[i]) {
  164. // 达到最大级
  165. }
  166. else if (better.includes(i)) {
  167. // 优先数组
  168. this._betterArr.push(i);
  169. }
  170. else {
  171. // 其它数组
  172. this._otherArr.push(i);
  173. }
  174. }
  175. this._initPanel();
  176. if (PlatUtils_1.default.IsWechat) {
  177. Utils_1.utils.adManager.hideCustomAd({ location: 3 });
  178. Utils_1.utils.adManager.hideCustomAd({ location: 4 });
  179. }
  180. };
  181. UIUpgradePanel.prototype.onClose = function () {
  182. CocosZ_1.cocosz.pauseCount--;
  183. if (PlatUtils_1.default.IsWechat) {
  184. Utils_1.utils.adManager.showCustomAd({ location: 3 });
  185. Utils_1.utils.adManager.showCustomAd({ location: 4 });
  186. }
  187. };
  188. UIUpgradePanel.prototype._initPanel = function () {
  189. TweenEffect_1.default.panel_mask_opacity(this._mask);
  190. TweenEffect_1.default.panel_open_moveY(this._panel);
  191. this._curIndex = -1;
  192. // 刷新技能
  193. this._skill_refresh();
  194. };
  195. /**
  196. * 所有按钮点击事件
  197. * @param event
  198. * @param data
  199. */
  200. UIUpgradePanel.prototype._onBtnClickedHandler = function (event, data) {
  201. return __awaiter(this, void 0, void 0, function () {
  202. var adKey, adKey, callback_1, lockNode;
  203. var _this = this;
  204. return __generator(this, function (_a) {
  205. switch (_a.label) {
  206. case 0:
  207. //播放按钮点击音效
  208. return [4 /*yield*/, CocosZ_1.cocosz.audioMgr.playBtnEffect().catch()];
  209. case 1:
  210. //播放按钮点击音效
  211. _a.sent();
  212. if (!this._canClick)
  213. return [2 /*return*/];
  214. switch (event.target.name) {
  215. case "btnRefresh": {
  216. this._canClick = false;
  217. // 分享
  218. if (event.target.getChildByName("share") && event.target.getChildByName("share").active) {
  219. Utils_1.utils.SendEvent("分享-刷新技能");
  220. adKey = "zh_ad_type";
  221. // 注册方法 , this.ClickClose.bind(this));
  222. GlobalManager_1.default.getInstance().registerMethod('event_shuaXinJiNeng', this.event_shuaXinJiNeng.bind(this));
  223. cc.sys.localStorage.setItem(adKey, 'event_shuaXinJiNeng'); //
  224. if (ATRewardedVideoJSSDK_1.default.hasAdReady(ATAndroidJS2_1.default.getPlacementId())) {
  225. console.log('zh:AD ready for event_shuaXinJiNeng');
  226. ATRewardedVideoJSSDK_1.default.showAd(ATAndroidJS2_1.default.getPlacementId());
  227. }
  228. else {
  229. console.log('zh:AD not ready for event_shuaXinJiNeng');
  230. this.event_shuaXinJiNeng();
  231. }
  232. if (2 > 1) {
  233. return [2 /*return*/]; //下面是原始的代码
  234. }
  235. CocosZ_1.cocosz.share(function () {
  236. Utils_1.utils.SendEvent("分享-刷新技能-成功");
  237. _this._skill_refresh();
  238. _this._canClick = true;
  239. }, function () {
  240. Utils_1.utils.SendEvent("分享-刷新技能-失败");
  241. _this._canClick = true;
  242. });
  243. }
  244. // 视频
  245. else if (event.target.getChildByName("video") && event.target.getChildByName("video").active) {
  246. Utils_1.utils.SendEvent("视频-技能刷新(地下城僵尸)-播放");
  247. adKey = "zh_ad_type";
  248. // 注册方法 , this.ClickClose.bind(this));
  249. GlobalManager_1.default.getInstance().registerMethod('event_shuaXinJiNeng', this.event_shuaXinJiNeng.bind(this));
  250. cc.sys.localStorage.setItem(adKey, 'event_shuaXinJiNeng'); //
  251. if (ATRewardedVideoJSSDK_1.default.hasAdReady(ATAndroidJS2_1.default.getPlacementId())) {
  252. console.log('zh:AD ready for event_shuaXinJiNeng');
  253. ATRewardedVideoJSSDK_1.default.showAd(ATAndroidJS2_1.default.getPlacementId());
  254. }
  255. else {
  256. console.log('zh:AD not ready for event_shuaXinJiNeng');
  257. this.event_shuaXinJiNeng();
  258. }
  259. if (2 > 1) {
  260. return [2 /*return*/]; //下面是原始的代码
  261. }
  262. CocosZ_1.cocosz.watchAD(function () {
  263. Utils_1.utils.SendEvent("视频-技能刷新(地下城僵尸)-成功");
  264. _this._skill_refresh();
  265. _this._canClick = true;
  266. }, function () {
  267. Utils_1.utils.SendEvent("视频-技能刷新(地下城僵尸)-失败");
  268. _this._canClick = true;
  269. });
  270. }
  271. break;
  272. }
  273. case "skill0":
  274. case "skill1":
  275. case "skill2":
  276. case "skill3":
  277. case "skill4": {
  278. this._canClick = false;
  279. callback_1 = function () {
  280. if ("skill0" == event.target.name)
  281. _this._curIndex = 0;
  282. else if ("skill1" == event.target.name)
  283. _this._curIndex = 1;
  284. else if ("skill2" == event.target.name)
  285. _this._curIndex = 2;
  286. else if ("skill3" == event.target.name)
  287. _this._curIndex = 3;
  288. else if ("skill4" == event.target.name)
  289. _this._curIndex = 4;
  290. // 刷新
  291. _this.updateFrame();
  292. // 选中技能
  293. _this._selectSkill();
  294. };
  295. lockNode = event.target.getChildByName("lock");
  296. if (lockNode && lockNode.active) {
  297. // 分享
  298. if (lockNode.getChildByName("share") && lockNode.getChildByName("share").active) {
  299. Utils_1.utils.SendEvent("分享-技能解锁");
  300. CocosZ_1.cocosz.share(function () {
  301. Utils_1.utils.SendEvent("分享-技能解锁-成功");
  302. callback_1 && callback_1();
  303. }, function () {
  304. Utils_1.utils.SendEvent("分享-技能解锁-失败");
  305. _this._canClick = true;
  306. });
  307. }
  308. // 视频
  309. else if (lockNode.getChildByName("video") && lockNode.getChildByName("video").active) {
  310. Utils_1.utils.SendEvent("视频-技能解锁-播放");
  311. CocosZ_1.cocosz.watchAD(function () {
  312. Utils_1.utils.SendEvent("视频-技能解锁-成功");
  313. callback_1 && callback_1();
  314. }, function () {
  315. Utils_1.utils.SendEvent("视频-技能解锁-失败");
  316. _this._canClick = true;
  317. });
  318. }
  319. else {
  320. callback_1 && callback_1();
  321. }
  322. }
  323. else {
  324. callback_1 && callback_1();
  325. }
  326. break;
  327. }
  328. }
  329. return [2 /*return*/];
  330. }
  331. });
  332. });
  333. };
  334. UIUpgradePanel.prototype.event_shuaXinJiNeng = function () {
  335. console.log('zh: event_shuaXinJiNeng 刷新技能 被触发');
  336. Utils_1.utils.SendEvent("zh:-刷新技能 被触发");
  337. this._skill_refresh();
  338. this._canClick = true;
  339. };
  340. UIUpgradePanel.prototype._selectSkill = function () {
  341. var _this = this;
  342. this._canClick = false;
  343. // 获取技能
  344. if (this._uiSkillIdArr[this._curIndex]) {
  345. UpgradeMgr_1.upgradeMgr && UpgradeMgr_1.upgradeMgr.isValid && UpgradeMgr_1.upgradeMgr.getSkill(this._uiSkillIdArr[this._curIndex]);
  346. }
  347. // 卡片效果
  348. var arr = [this._skill0, this._skill1, this._skill2, this._skill3, this._skill4];
  349. arr.forEach(function (v, i) {
  350. if (i == _this._curIndex) {
  351. _this.card_click(v);
  352. }
  353. else {
  354. _this.card_recycle(v);
  355. }
  356. });
  357. // 关闭弹窗
  358. CocosZ_1.cocosz.scheduleOnce(function () {
  359. CocosZ_1.cocosz.uiMgr.closePanel(Constant_1.PanelName.UIUpgradePanel);
  360. if (gameMgr_1.gameMgr && gameMgr_1.gameMgr.playerTs && gameMgr_1.gameMgr.playerTs.isValid) {
  361. gameMgr_1.gameMgr.playerTs.avoidInjury(2);
  362. }
  363. }, 1.5);
  364. };
  365. UIUpgradePanel.prototype._getSkillIDName = function (id) {
  366. return id + (UpgradeMgr_1.upgradeMgr.upgradeSkillMaxLevelArr[id] > 1 ? "_" + (UpgradeMgr_1.upgradeMgr.upgradeSkillArr[id] + 1) : "");
  367. };
  368. UIUpgradePanel.prototype._skill_load = function (card, id) {
  369. // 名字
  370. var node_name = card.getChildByName("name");
  371. if (node_name) {
  372. var spr_name_1 = node_name.getComponent(cc.Sprite);
  373. if (spr_name_1) {
  374. CocosZ_1.cocosz.resMgr.loadAndCacheRes("i18n/tex_zombie/" + CocosZ_1.cocosz.curLanguage + "/zombieSkill_name_" + this._getSkillIDName(id), cc.SpriteFrame, null, function (err, res) {
  375. if (spr_name_1 && spr_name_1.isValid) {
  376. spr_name_1.spriteFrame = res;
  377. }
  378. });
  379. }
  380. }
  381. // 图标
  382. var node_icon = card.getChildByName("icon");
  383. if (node_icon) {
  384. var spr_icon_1 = node_icon.getComponent(cc.Sprite);
  385. if (spr_icon_1) {
  386. CocosZ_1.cocosz.resMgr.loadAndCacheRes("tex_zombie/zombieSkill_icon_" + this._getSkillIDName(id), cc.SpriteFrame, null, function (err, res) {
  387. if (spr_icon_1 && spr_icon_1.isValid) {
  388. spr_icon_1.spriteFrame = res;
  389. }
  390. });
  391. }
  392. }
  393. // 介绍
  394. var node_introduce = card.getChildByName("introduce");
  395. if (node_introduce) {
  396. var spr_introduce_1 = node_introduce.getComponent(cc.Sprite);
  397. if (spr_introduce_1) {
  398. CocosZ_1.cocosz.resMgr.loadAndCacheRes("i18n/tex_zombie/" + CocosZ_1.cocosz.curLanguage + "/zombieSkill_introduce_" + this._getSkillIDName(id), cc.SpriteFrame, null, function (err, res) {
  399. if (spr_introduce_1 && spr_introduce_1.isValid) {
  400. spr_introduce_1.spriteFrame = res;
  401. }
  402. });
  403. }
  404. }
  405. };
  406. /** 技能刷新 */
  407. UIUpgradePanel.prototype._skill_refresh = function () {
  408. var _a;
  409. this._uiSkillIdArr.length = 0;
  410. // 从技能数组中获取5个技能
  411. if (this._betterArr.length) {
  412. for (var i = Math.min(5 - this._uiSkillIdArr.length, this._betterArr.length); i > 0; i--) {
  413. var index = Math.floor(Math.random() * this._betterArr.length);
  414. if (this._betterArr[index] >= 0) {
  415. this._uiSkillIdArr.push(this._betterArr[index]);
  416. this._betterArr.splice(index, 1);
  417. }
  418. }
  419. }
  420. if (this._otherArr.length) {
  421. for (var i = Math.min(5 - this._uiSkillIdArr.length, this._otherArr.length); i > 0; i--) {
  422. var index = Math.floor(Math.random() * this._otherArr.length);
  423. if (this._otherArr[index] >= 0) {
  424. this._uiSkillIdArr.push(this._otherArr[index]);
  425. this._otherArr.splice(index, 1);
  426. }
  427. }
  428. }
  429. // 排序
  430. for (var i = 0; i < this._uiSkillIdArr.length; i++) {
  431. // 3级技能(非视频位置)
  432. if (UpgradeMgr_1.upgradeMgr.upgradeSkillArr[this._uiSkillIdArr[i]] == 2 && !this._lockArr[i]) {
  433. // 与视频位置交换
  434. for (var j = this._uiSkillIdArr.length - 1; j > i; j--) {
  435. if (this._lockArr[j] && UpgradeMgr_1.upgradeMgr.upgradeSkillArr[this._uiSkillIdArr[j]] != 2) {
  436. // 交换
  437. _a = [this._uiSkillIdArr[j], this._uiSkillIdArr[i]], this._uiSkillIdArr[i] = _a[0], this._uiSkillIdArr[j] = _a[1];
  438. }
  439. }
  440. }
  441. }
  442. // 技能0 ///////////////////////////////////////////////////////////////////////////////////////////////
  443. if (this._uiSkillIdArr[0] >= 0) {
  444. this._skill0.active = true;
  445. var id = this._uiSkillIdArr[0];
  446. this._skill_load(this._skill0, id);
  447. }
  448. else {
  449. this._skill0.active = false;
  450. }
  451. // 技能1 ///////////////////////////////////////////////////////////////////////////////////////////////
  452. if (this._uiSkillIdArr[1] >= 0) {
  453. this._skill1.active = true;
  454. var id = this._uiSkillIdArr[1];
  455. this._skill_load(this._skill1, id);
  456. }
  457. else {
  458. this._skill1.active = false;
  459. }
  460. // 技能2 ///////////////////////////////////////////////////////////////////////////////////////////////
  461. if (this._uiSkillIdArr[2] >= 0) {
  462. this._skill2.active = true;
  463. var id = this._uiSkillIdArr[2];
  464. this._skill_load(this._skill2, id);
  465. }
  466. else {
  467. this._skill2.active = false;
  468. }
  469. // 技能3 ///////////////////////////////////////////////////////////////////////////////////////////////
  470. if (this._uiSkillIdArr[3] >= 0) {
  471. this._skill3.active = true;
  472. var id = this._uiSkillIdArr[3];
  473. this._skill_load(this._skill3, id);
  474. }
  475. else {
  476. this._skill3.active = false;
  477. }
  478. // 技能4 ///////////////////////////////////////////////////////////////////////////////////////////////
  479. if (this._uiSkillIdArr[4] >= 0) {
  480. this._skill4.active = true;
  481. var id = this._uiSkillIdArr[4];
  482. this._skill_load(this._skill4, id);
  483. }
  484. else {
  485. this._skill4.active = false;
  486. }
  487. // 视频按钮隐藏
  488. if (this._otherArr.length == 0 && this._btnRefresh && this._btnRefresh.active) {
  489. this._btnRefresh.active = false;
  490. }
  491. this.updateFrame();
  492. };
  493. // 更新外发光
  494. UIUpgradePanel.prototype.updateFrame = function () {
  495. // 选中框
  496. this._skill0.children[0].active = (this._curIndex == 0);
  497. this._skill1.children[0].active = (this._curIndex == 1);
  498. this._skill2.children[0].active = (this._curIndex == 2);
  499. this._skill3.children[0].active = (this._curIndex == 3);
  500. this._skill4.children[0].active = (this._curIndex == 4);
  501. // 解锁框
  502. this._skill0.children[5].active = this._lockArr[0] && this._curIndex != 0;
  503. this._skill1.children[5].active = this._lockArr[1] && this._curIndex != 1;
  504. this._skill2.children[5].active = this._lockArr[2] && this._curIndex != 2;
  505. this._skill3.children[5].active = this._lockArr[3] && this._curIndex != 3;
  506. this._skill4.children[5].active = this._lockArr[4] && this._curIndex != 4;
  507. };
  508. /** 卡牌选中特效 */
  509. UIUpgradePanel.prototype.card_click = function (card) {
  510. card.zIndex = cc.macro.MAX_ZINDEX;
  511. cc.tween(card)
  512. .to(0.5, { x: 0, y: 200 }, { easing: "sineIn" })
  513. .to(1, { scale: 2, opacity: 0 }, { easing: "fade" })
  514. .start();
  515. };
  516. /** 卡牌回收 */
  517. UIUpgradePanel.prototype.card_recycle = function (card) {
  518. var btnUnLock = card.getChildByName("btnUnLock");
  519. if (btnUnLock)
  520. btnUnLock.active = false;
  521. cc.tween(card)
  522. .to(0.5, { opacity: 0 }, { easing: "sineIn" })
  523. .start();
  524. };
  525. UIUpgradePanel = __decorate([
  526. ccclass
  527. ], UIUpgradePanel);
  528. return UIUpgradePanel;
  529. }(UIPage_1.default));
  530. exports.default = UIUpgradePanel;
  531. cc._RF.pop();