init
This commit is contained in:
+130
@@ -0,0 +1,130 @@
|
||||
System.register(["cc"], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
var _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, AudioClip, Component, resources, SpriteFrame, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _class, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _class3, _crd, ccclass, property, AssetController;
|
||||
|
||||
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.'); }
|
||||
|
||||
return {
|
||||
setters: [function (_cc) {
|
||||
_cclegacy = _cc.cclegacy;
|
||||
__checkObsolete__ = _cc.__checkObsolete__;
|
||||
__checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
|
||||
_decorator = _cc._decorator;
|
||||
AudioClip = _cc.AudioClip;
|
||||
Component = _cc.Component;
|
||||
resources = _cc.resources;
|
||||
SpriteFrame = _cc.SpriteFrame;
|
||||
}],
|
||||
execute: function () {
|
||||
_crd = true;
|
||||
|
||||
_cclegacy._RF.push({}, "aca74mlcVVB+5PrgXYzOr3M", "AssetController", undefined);
|
||||
|
||||
__checkObsolete__(['_decorator', 'AudioClip', 'Component', 'Node', 'Prefab', 'resources', 'Sprite', 'SpriteFrame']);
|
||||
|
||||
({
|
||||
ccclass,
|
||||
property
|
||||
} = _decorator);
|
||||
|
||||
_export("AssetController", AssetController = (_dec = ccclass('AssetController'), _dec2 = property({
|
||||
type: AudioClip
|
||||
}), _dec3 = property({
|
||||
type: AudioClip
|
||||
}), _dec4 = property({
|
||||
type: AudioClip
|
||||
}), _dec5 = property({
|
||||
type: AudioClip
|
||||
}), _dec6 = property({
|
||||
type: AudioClip
|
||||
}), _dec7 = property({
|
||||
type: AudioClip
|
||||
}), _dec(_class = (_class2 = (_class3 = class AssetController extends Component {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
|
||||
_initializerDefineProperty(this, "fire", _descriptor, this);
|
||||
|
||||
_initializerDefineProperty(this, "click", _descriptor2, this);
|
||||
|
||||
_initializerDefineProperty(this, "win", _descriptor3, this);
|
||||
|
||||
_initializerDefineProperty(this, "die", _descriptor4, this);
|
||||
|
||||
_initializerDefineProperty(this, "xiao", _descriptor5, this);
|
||||
|
||||
_initializerDefineProperty(this, "getCoin", _descriptor6, this);
|
||||
}
|
||||
|
||||
onLoad() {
|
||||
AssetController.instance = this;
|
||||
}
|
||||
|
||||
loadSetSprite(path, sprite) {
|
||||
path = path + "/spriteFrame";
|
||||
resources.load(path, SpriteFrame, (err, spriteFrame) => {
|
||||
if (err) {
|
||||
console.log(err.message || err);
|
||||
return;
|
||||
}
|
||||
|
||||
sprite.spriteFrame = spriteFrame;
|
||||
});
|
||||
}
|
||||
|
||||
}, _class3.instance = void 0, _class3), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "fire", [_dec2], {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
initializer: function () {
|
||||
return null;
|
||||
}
|
||||
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "click", [_dec3], {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
initializer: function () {
|
||||
return null;
|
||||
}
|
||||
}), _descriptor3 = _applyDecoratedDescriptor(_class2.prototype, "win", [_dec4], {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
initializer: function () {
|
||||
return null;
|
||||
}
|
||||
}), _descriptor4 = _applyDecoratedDescriptor(_class2.prototype, "die", [_dec5], {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
initializer: function () {
|
||||
return null;
|
||||
}
|
||||
}), _descriptor5 = _applyDecoratedDescriptor(_class2.prototype, "xiao", [_dec6], {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
initializer: function () {
|
||||
return null;
|
||||
}
|
||||
}), _descriptor6 = _applyDecoratedDescriptor(_class2.prototype, "getCoin", [_dec7], {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
initializer: function () {
|
||||
return null;
|
||||
}
|
||||
})), _class2)) || _class));
|
||||
|
||||
_cclegacy._RF.pop();
|
||||
|
||||
_crd = false;
|
||||
}
|
||||
};
|
||||
});
|
||||
//# sourceMappingURL=140dc6bd476739f3eb222d0c65eda1306239d6c5.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["file:///D:/Users/admin/Alien_Sniper/assets/scripts/AssetController.ts"],"names":["_decorator","AudioClip","Component","resources","SpriteFrame","ccclass","property","AssetController","type","onLoad","instance","loadSetSprite","path","sprite","load","err","spriteFrame","console","log","message"],"mappings":";;;;;;;;;;;;;;;;AAASA,MAAAA,U,OAAAA,U;AAAYC,MAAAA,S,OAAAA,S;AAAWC,MAAAA,S,OAAAA,S;AAAyBC,MAAAA,S,OAAAA,S;AAAmBC,MAAAA,W,OAAAA,W;;;;;;;;;OACtE;AAAEC,QAAAA,OAAF;AAAWC,QAAAA;AAAX,O,GAAwBN,U;;iCAGjBO,e,WADZF,OAAO,CAAC,iBAAD,C,UAIHC,QAAQ,CAAC;AAAEE,QAAAA,IAAI,EAAEP;AAAR,OAAD,C,UAERK,QAAQ,CAAC;AAAEE,QAAAA,IAAI,EAAEP;AAAR,OAAD,C,UAERK,QAAQ,CAAC;AAAEE,QAAAA,IAAI,EAAEP;AAAR,OAAD,C,UAERK,QAAQ,CAAC;AAAEE,QAAAA,IAAI,EAAEP;AAAR,OAAD,C,UAERK,QAAQ,CAAC;AAAEE,QAAAA,IAAI,EAAEP;AAAR,OAAD,C,UAGRK,QAAQ,CAAC;AAAEE,QAAAA,IAAI,EAAEP;AAAR,OAAD,C,sCAfb,MACaM,eADb,SACqCL,SADrC,CAC+C;AAAA;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;;AAAA;AAAA;;AAiB3CO,QAAAA,MAAM,GAAG;AACLF,UAAAA,eAAe,CAACG,QAAhB,GAA2B,IAA3B;AACH;;AAEDC,QAAAA,aAAa,CAACC,IAAD,EAAeC,MAAf,EAA+B;AACxCD,UAAAA,IAAI,GAAGA,IAAI,GAAG,cAAd;AACAT,UAAAA,SAAS,CAACW,IAAV,CAAeF,IAAf,EAAqBR,WAArB,EAAkC,CAACW,GAAD,EAAMC,WAAN,KAAmC;AACjE,gBAAID,GAAJ,EAAS;AACLE,cAAAA,OAAO,CAACC,GAAR,CAAYH,GAAG,CAACI,OAAJ,IAAeJ,GAA3B;AACA;AACH;;AACDF,YAAAA,MAAM,CAACG,WAAP,GAAqBA,WAArB;AACH,WAND;AAOH;;AA9B0C,O,UACpCN,Q;;;;;iBAGW,I;;;;;;;iBAEC,I;;;;;;;iBAEF,I;;;;;;;iBAEA,I;;;;;;;iBAEC,I;;;;;;;iBAGG,I","sourcesContent":["import { _decorator, AudioClip, Component, Node, Prefab, resources, Sprite, SpriteFrame } from 'cc';\r\nconst { ccclass, property } = _decorator;\r\n\r\n@ccclass('AssetController')\r\nexport class AssetController extends Component {\r\n static instance: AssetController;\r\n\r\n @property({ type: AudioClip })\r\n fire: AudioClip = null;\r\n @property({ type: AudioClip })\r\n click: AudioClip = null;\r\n @property({ type: AudioClip })\r\n win: AudioClip = null;\r\n @property({ type: AudioClip })\r\n die: AudioClip = null;\r\n @property({ type: AudioClip })\r\n xiao: AudioClip = null;\r\n\r\n @property({ type: AudioClip })\r\n getCoin: AudioClip = null;\r\n\r\n onLoad() {\r\n AssetController.instance = this;\r\n }\r\n\r\n loadSetSprite(path: string, sprite: Sprite) {\r\n path = path + \"/spriteFrame\"\r\n resources.load(path, SpriteFrame, (err, spriteFrame: SpriteFrame) => {\r\n if (err) {\r\n console.log(err.message || err);\r\n return;\r\n }\r\n sprite.spriteFrame = spriteFrame;\r\n });\r\n }\r\n}\r\n\r\n\r\n"]}
|
||||
Reference in New Issue
Block a user