init
This commit is contained in:
+86
@@ -0,0 +1,86 @@
|
||||
System.register(["__unresolved_0", "cc", "__unresolved_1"], function (_export, _context) {
|
||||
"use strict";
|
||||
|
||||
var _reporterNs, _cclegacy, __checkObsolete__, __checkObsoleteInNamespace__, _decorator, Component, Node, SkeletalAnimation, Ragdoll, _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2, _crd, ccclass, property, Test;
|
||||
|
||||
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 _reportPossibleCrUseOfRagdoll(extras) {
|
||||
_reporterNs.report("Ragdoll", "../Ragdoll/Ragdoll", _context.meta, extras);
|
||||
}
|
||||
|
||||
return {
|
||||
setters: [function (_unresolved_) {
|
||||
_reporterNs = _unresolved_;
|
||||
}, function (_cc) {
|
||||
_cclegacy = _cc.cclegacy;
|
||||
__checkObsolete__ = _cc.__checkObsolete__;
|
||||
__checkObsoleteInNamespace__ = _cc.__checkObsoleteInNamespace__;
|
||||
_decorator = _cc._decorator;
|
||||
Component = _cc.Component;
|
||||
Node = _cc.Node;
|
||||
SkeletalAnimation = _cc.SkeletalAnimation;
|
||||
}, function (_unresolved_2) {
|
||||
Ragdoll = _unresolved_2.Ragdoll;
|
||||
}],
|
||||
execute: function () {
|
||||
_crd = true;
|
||||
|
||||
_cclegacy._RF.push({}, "8582bpjPWlGc5U3T8QchvDs", "Test", undefined);
|
||||
|
||||
__checkObsolete__(['_decorator', 'Component', 'Node', 'SkeletalAnimation']);
|
||||
|
||||
({
|
||||
ccclass,
|
||||
property
|
||||
} = _decorator);
|
||||
|
||||
_export("Test", Test = (_dec = ccclass('Test'), _dec2 = property(Node), _dec3 = property(SkeletalAnimation), _dec(_class = (_class2 = class Test extends Component {
|
||||
constructor() {
|
||||
super(...arguments);
|
||||
|
||||
_initializerDefineProperty(this, "target", _descriptor, this);
|
||||
|
||||
_initializerDefineProperty(this, "skeletalAnimation", _descriptor2, this);
|
||||
}
|
||||
|
||||
onTouchEnd() {
|
||||
var _this$skeletalAnimati, _this$skeletalAnimati2, _this$skeletalAnimati3;
|
||||
|
||||
var ragdoll = this.target.getComponent(_crd && Ragdoll === void 0 ? (_reportPossibleCrUseOfRagdoll({
|
||||
error: Error()
|
||||
}), Ragdoll) : Ragdoll);
|
||||
var isEnabled = ragdoll.getEnabled(); // 开启布娃娃之后动作会被覆盖,强烈建议停止动画
|
||||
|
||||
var name = (_this$skeletalAnimati = this.skeletalAnimation) == null ? void 0 : _this$skeletalAnimati.defaultClip.name;
|
||||
isEnabled ? (_this$skeletalAnimati2 = this.skeletalAnimation) == null ? void 0 : _this$skeletalAnimati2.crossFade(name, 0) : (_this$skeletalAnimati3 = this.skeletalAnimation) == null ? void 0 : _this$skeletalAnimati3.stop();
|
||||
ragdoll.setEnabled(!isEnabled);
|
||||
}
|
||||
|
||||
}, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, "target", [_dec2], {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
initializer: function initializer() {
|
||||
return null;
|
||||
}
|
||||
}), _descriptor2 = _applyDecoratedDescriptor(_class2.prototype, "skeletalAnimation", [_dec3], {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
initializer: function initializer() {
|
||||
return null;
|
||||
}
|
||||
})), _class2)) || _class));
|
||||
|
||||
_cclegacy._RF.pop();
|
||||
|
||||
_crd = false;
|
||||
}
|
||||
};
|
||||
});
|
||||
//# sourceMappingURL=8c83a9a335d163c4fc71e71f4bf9f903909f5f1d.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["file:///D:/Users/admin/Alien_Sniper/assets/scripts/Test.ts"],"names":["_decorator","Component","Node","SkeletalAnimation","Ragdoll","ccclass","property","Test","onTouchEnd","ragdoll","target","getComponent","isEnabled","getEnabled","name","skeletalAnimation","defaultClip","crossFade","stop","setEnabled"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAASA,MAAAA,U,OAAAA,U;AAAYC,MAAAA,S,OAAAA,S;AAAWC,MAAAA,I,OAAAA,I;AAAMC,MAAAA,iB,OAAAA,iB;;AAC7BC,MAAAA,O,iBAAAA,O;;;;;;;;;OACH;AAAEC,QAAAA,OAAF;AAAWC,QAAAA;AAAX,O,GAAwBN,U;;sBAGjBO,I,WADZF,OAAO,CAAC,MAAD,C,UAEHC,QAAQ,CAACJ,IAAD,C,UAGRI,QAAQ,CAACH,iBAAD,C,2BALb,MACaI,IADb,SAC0BN,SAD1B,CACoC;AAAA;AAAA;;AAAA;;AAAA;AAAA;;AAOhCO,QAAAA,UAAU,GAAG;AAAA;;AACT,cAAIC,OAAO,GAAG,KAAKC,MAAL,CAAYC,YAAZ;AAAA;AAAA,iCAAd;AACA,cAAIC,SAAS,GAAGH,OAAO,CAACI,UAAR,EAAhB,CAFS,CAIT;;AACA,cAAIC,IAAI,4BAAG,KAAKC,iBAAR,qBAAG,sBAAwBC,WAAxB,CAAoCF,IAA/C;AACAF,UAAAA,SAAS,6BAAG,KAAKG,iBAAR,qBAAG,uBAAwBE,SAAxB,CAAkCH,IAAlC,EAAwC,CAAxC,CAAH,6BAAgD,KAAKC,iBAArD,qBAAgD,uBAAwBG,IAAxB,EAAzD;AACAT,UAAAA,OAAO,CAACU,UAAR,CAAmB,CAACP,SAApB;AACH;;AAf+B,O;;;;;iBAEjB,I;;;;;;;iBAGwB,I","sourcesContent":["import { _decorator, Component, Node, SkeletalAnimation } from 'cc';\r\nimport { Ragdoll } from '../Ragdoll/Ragdoll';\r\nconst { ccclass, property } = _decorator;\r\n\r\n@ccclass('Test')\r\nexport class Test extends Component {\r\n @property(Node)\r\n target: Node = null;\r\n\r\n @property(SkeletalAnimation)\r\n skeletalAnimation: SkeletalAnimation = null;\r\n\r\n onTouchEnd() {\r\n let ragdoll = this.target.getComponent(Ragdoll)\r\n let isEnabled = ragdoll.getEnabled();\r\n\r\n // 开启布娃娃之后动作会被覆盖,强烈建议停止动画\r\n let name = this.skeletalAnimation?.defaultClip.name;\r\n isEnabled ? this.skeletalAnimation?.crossFade(name, 0) : this.skeletalAnimation?.stop();\r\n ragdoll.setEnabled(!isEnabled);\r\n }\r\n}\r\n\r\n\r\n"]}
|
||||
Reference in New Issue
Block a user