123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278 |
- System.register(["__unresolved_0", "cc", "__unresolved_1", "__unresolved_2", "__unresolved_3", "__unresolved_4", "__unresolved_5", "__unresolved_6"], function (_export, _context) {
- "use strict";
- var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Button, Component, Label, Node, Sprite, tween, v3, ch, gui, UI_Main, Toast, Hall, GameCtl, _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2, _descriptor3, _crd, ccclass, property, UI_Item;
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
- function _initializerDefineProperty(target, property, descriptor, context) { if (!descriptor) return; Object.defineProperty(target, property, { enumerable: descriptor.enumerable, configurable: descriptor.configurable, writable: descriptor.writable, value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 }); }
- function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) { var desc = {}; Object.keys(descriptor).forEach(function (key) { desc[key] = descriptor[key]; }); desc.enumerable = !!desc.enumerable; desc.configurable = !!desc.configurable; if ('value' in desc || desc.initializer) { desc.writable = true; } desc = decorators.slice().reverse().reduce(function (desc, decorator) { return decorator(target, property, desc) || desc; }, desc); if (context && desc.initializer !== void 0) { desc.value = desc.initializer ? desc.initializer.call(context) : void 0; desc.initializer = undefined; } if (desc.initializer === void 0) { Object.defineProperty(target, property, desc); desc = null; } return desc; }
- function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
- function _reportPossibleCrUseOfch(extras) {
- _reporterNs.report("ch", "../../../ch/ch", _context.meta, extras);
- }
- function _reportPossibleCrUseOfgui(extras) {
- _reporterNs.report("gui", "../../../core/ui/ui", _context.meta, extras);
- }
- function _reportPossibleCrUseOfUI_Main(extras) {
- _reporterNs.report("UI_Main", "../UI_Main/UI_Main", _context.meta, extras);
- }
- function _reportPossibleCrUseOfLayout_Main(extras) {
- _reporterNs.report("Layout_Main", "../UI_Main/Layout_Main", _context.meta, extras);
- }
- function _reportPossibleCrUseOfToast(extras) {
- _reporterNs.report("Toast", "../../../core/util_class/Toast", _context.meta, extras);
- }
- function _reportPossibleCrUseOfHall(extras) {
- _reporterNs.report("Hall", "../../hall/Hall", _context.meta, extras);
- }
- function _reportPossibleCrUseOfGameCtl(extras) {
- _reporterNs.report("GameCtl", "../../game/GameCtl", _context.meta, extras);
- }
- return {
- setters: [function (_unresolved_) {
- _reporterNs = _unresolved_;
- }, function (_cc) {
- _cclegacy = _cc.cclegacy;
- __checkObsolete__ = _cc.__checkObsolete__;
- __checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
- _decorator = _cc._decorator;
- Button = _cc.Button;
- Component = _cc.Component;
- Label = _cc.Label;
- Node = _cc.Node;
- Sprite = _cc.Sprite;
- tween = _cc.tween;
- v3 = _cc.v3;
- }, function (_unresolved_2) {
- ch = _unresolved_2.ch;
- }, function (_unresolved_3) {
- gui = _unresolved_3.gui;
- }, function (_unresolved_4) {
- UI_Main = _unresolved_4.UI_Main;
- }, function (_unresolved_5) {
- Toast = _unresolved_5.Toast;
- }, function (_unresolved_6) {
- Hall = _unresolved_6.Hall;
- }, function (_unresolved_7) {
- GameCtl = _unresolved_7.GameCtl;
- }],
- execute: function () {
- _crd = true;
- _cclegacy._RF.push({}, "12c662bVNFDxoVeaMUS/AvG", "UI_Item", undefined);
- __checkObsolete__(['_decorator', 'Button', 'Component', 'instantiate', 'Label', 'Node', 'Sprite', 'SpriteFrame', 'tween', 'v3']);
- ({
- ccclass,
- property
- } = _decorator);
- _export("UI_Item", UI_Item = (_dec = ccclass('UI_Item'), _dec2 = property(Sprite), _dec3 = property(Label), _dec(_class = (_class2 = class UI_Item extends Component {
- constructor() {
- super(...arguments);
- _initializerDefineProperty(this, "type", _descriptor, this);
- _initializerDefineProperty(this, "Ad", _descriptor2, this);
- _initializerDefineProperty(this, "count", _descriptor3, this);
- this._c = 0;
- }
- start() {
- if (this.type == 0) return;
- this.show(this.type, (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
- error: Error()
- }), Hall) : Hall).getInstance().player.get_item(this.type));
- if (this.node.getComponent(Button)) {
- this.node.on(Node.EventType.TOUCH_END, this.onClick, this);
- }
- (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
- error: Error()
- }), Hall) : Hall).getInstance().player.event.on((_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
- error: Error()
- }), Hall) : Hall).getInstance().player.event.key.item_count, this.show, this);
- }
- onDestroy() {
- (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
- error: Error()
- }), Hall) : Hall).getInstance().player.event.off((_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
- error: Error()
- }), Hall) : Hall).getInstance().player.event.key.item_count, this.show, this);
- }
- show(type, count) {
- if (type != this.type) return;
- if (this._c != count) {
- tween(this.node).to(0.05, {
- scale: v3(1.2, 1.2, 1)
- }).to(0.1, {
- scale: v3(1, 1, 1)
- }).start();
- if (count < this._c) {// if (type == 1) {
- // ch.audio.playOneShot('sounds/sfx_item1');
- // } else if (type == 2) {
- // ch.audio.playOneShot('sounds/sfx_item2');
- // } else {
- // ch.audio.playOneShot('sounds/sfx_item3');
- // }
- }
- }
- this._c = count;
- if (count != 0) {
- this.Ad.node.active = false;
- this.count.node.parent.active = true;
- this.count.string = count.toString();
- } else {
- this.Ad.node.active = true;
- this.count.node.parent.active = false;
- }
- if (type == 1) {// if (GameLink.getInst().lv.dir == LvDir.none) {
- // this.node.active = false;
- // } else {
- // this.node.active = true;
- // }
- } //this.ad.active = count <= 0;
- } //
- onClick(evt) {
- var _this = this;
- return _asyncToGenerator(function* () {
- if ((_crd && GameCtl === void 0 ? (_reportPossibleCrUseOfGameCtl({
- error: Error()
- }), GameCtl) : GameCtl).instance.Container.canTouch) {
- if (_this._c <= 0) {
- if (_this.type == 3) {
- var flag = false;
- for (var element of (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
- error: Error()
- }), gui) : gui).get(_crd && UI_Main === void 0 ? (_reportPossibleCrUseOfUI_Main({
- error: Error()
- }), UI_Main) : UI_Main).getLayout().Container.node_isIdiom) {
- console.log(element);
- if (element == true) {
- flag = true;
- break;
- }
- }
- if (!flag) {
- (_crd && Toast === void 0 ? (_reportPossibleCrUseOfToast({
- error: Error()
- }), Toast) : Toast).makeText((_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
- error: Error()
- }), gui) : gui).getLayerNode(5), "槽中无可清除的方块").show();
- return;
- }
- }
- var ret = yield chsdk.playRewardAd('获得道具' + _this.type);
- if (ret) {
- (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
- error: Error()
- }), Hall) : Hall).getInstance().player.add_item(_this.type, 1);
- (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
- error: Error()
- }), Hall) : Hall).getInstance().player.set_watch_ad_num(1);
- (_crd && ch === void 0 ? (_reportPossibleCrUseOfch({
- error: Error()
- }), ch) : ch).audio.resume();
- }
- } else {
- if (_this.type == 3) {
- var _flag = false;
- for (var _element of (_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
- error: Error()
- }), gui) : gui).get(_crd && UI_Main === void 0 ? (_reportPossibleCrUseOfUI_Main({
- error: Error()
- }), UI_Main) : UI_Main).getLayout().Container.node_isIdiom) {
- console.log(_element);
- if (_element == true) {
- (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
- error: Error()
- }), Hall) : Hall).getInstance().player.use_item(_this.type);
- _flag = true;
- break;
- }
- }
- if (!_flag) {
- (_crd && Toast === void 0 ? (_reportPossibleCrUseOfToast({
- error: Error()
- }), Toast) : Toast).makeText((_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
- error: Error()
- }), gui) : gui).getLayerNode(5), "槽中无可清除的方块").show();
- }
- } else {
- (_crd && Hall === void 0 ? (_reportPossibleCrUseOfHall({
- error: Error()
- }), Hall) : Hall).getInstance().player.use_item(_this.type);
- }
- }
- } else {
- (_crd && Toast === void 0 ? (_reportPossibleCrUseOfToast({
- error: Error()
- }), Toast) : Toast).makeText((_crd && gui === void 0 ? (_reportPossibleCrUseOfgui({
- error: Error()
- }), gui) : gui).getLayerNode(5), "请等待发牌结束").show();
- }
- })();
- }
- }, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "type", [property], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: function initializer() {
- return 0;
- }
- }), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "Ad", [_dec2], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- }), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "count", [_dec3], {
- configurable: true,
- enumerable: true,
- writable: true,
- initializer: null
- })), _class2)) || _class));
- _cclegacy._RF.pop();
- _crd = false;
- }
- };
- });
- //# sourceMappingURL=5cc3ce28e30e8e416eb47ff816c05a8fc1f78292.js.map
|