@galacean/engine-loader 2.0.0-alpha.14 → 2.0.0-alpha.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Utils, AssetPromise, AnimationClip, AnimationEvent, Loader, AnimationStringCurve, Keyframe, AnimationBoolCurve, AnimationRefCurve, AnimationQuaternionCurve, AnimationColorCurve, AnimationVector4Curve, AnimationVector3Curve, AnimationVector2Curve, AnimationFloatArrayCurve, AnimationArrayCurve, AnimationFloatCurve, ModelMesh, BlendShape, Entity, Transform, Texture2D, ReferResource, DiffuseMode, BackgroundMode, resourceLoader, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateTransition, BufferAsset, GLCapabilityType, TextureCube, TextureCubeFace, Logger, TextureFormat, ContentRestorer, AmbientLight, TextureFilterMode, Font, SystemInfo, Animator, IndexFormat, VertexElementFormat, request, InterpolationType, SkinnedMeshRenderer, PBRMaterial, TextureCoordinate, RenderFace, VertexElement, Buffer, BufferBindFlag, BufferUsage, Camera, MeshRenderer, Skin, TextureWrapMode as TextureWrapMode$1, TextureUtils, AnimatorStateMachine, JSONAsset, Shader, Material, PrimitiveMesh, SpriteAtlas, Sprite, TextAsset, AudioClip, AudioManager, ShaderFactory, ShaderLib, PhysicsMaterial, RenderTarget, Scene, DirectLight, PointLight, SpotLight, UnlitMaterial } from '@galacean/engine-core';
1
+ import { Utils, AssetPromise, AnimationClip, AnimationEvent, Loader, AnimationStringCurve, Keyframe, AnimationBoolCurve, AnimationRefCurve, AnimationQuaternionCurve, AnimationColorCurve, AnimationVector4Curve, AnimationVector3Curve, AnimationVector2Curve, AnimationFloatArrayCurve, AnimationArrayCurve, AnimationFloatCurve, ModelMesh, BlendShape, Signal, Entity, Transform, Texture2D, ReferResource, DiffuseMode, BackgroundMode, resourceLoader, AssetType, AnimatorController, AnimatorControllerLayer, AnimatorStateTransition, BufferAsset, GLCapabilityType, TextureCube, TextureCubeFace, Logger, TextureFormat, ContentRestorer, AmbientLight, TextureFilterMode, Font, SystemInfo, Animator, IndexFormat, VertexElementFormat, request, InterpolationType, SkinnedMeshRenderer, PBRMaterial, TextureCoordinate, RenderFace, VertexElement, Buffer, BufferBindFlag, BufferUsage, Camera, MeshRenderer, Skin, TextureWrapMode as TextureWrapMode$1, TextureUtils, AnimatorStateMachine, JSONAsset, Shader, Material, PrimitiveMesh, SpriteAtlas, Sprite, TextAsset, AudioClip, AudioManager, ShaderFactory, ShaderLib, PhysicsMaterial, RenderTarget, Scene, DirectLight, PointLight, SpotLight, UnlitMaterial } from '@galacean/engine-core';
2
2
  import { Quaternion, Vector4, Color, Vector3, Vector2, MathUtil, SphericalHarmonics3, BoundingBox, Matrix, Rect } from '@galacean/engine-math';
3
3
  import { GLCompressedTextureInternalFormat } from '@galacean/engine-rhi-webgl';
4
4
 
@@ -799,6 +799,29 @@ var ReflectionParser = /*#__PURE__*/ function() {
799
799
  }
800
800
  });
801
801
  };
802
+ _proto.parseSignal = function parseSignal(signalRef) {
803
+ var _this = this;
804
+ var signal = new Signal();
805
+ return Promise.all(signalRef.listeners.map(function(listener) {
806
+ return Promise.all([
807
+ _this.parseBasicType(listener.target),
808
+ listener.arguments ? Promise.all(listener.arguments.map(function(a) {
809
+ return _this.parseBasicType(a);
810
+ })) : Promise.resolve([])
811
+ ]).then(function(param) {
812
+ var target = param[0], resolvedArgs = param[1];
813
+ if (target) {
814
+ var _signal;
815
+ (_signal = signal).on.apply(_signal, [].concat([
816
+ target,
817
+ listener.methodName
818
+ ], resolvedArgs));
819
+ }
820
+ });
821
+ })).then(function() {
822
+ return signal;
823
+ });
824
+ };
802
825
  _proto.parseBasicType = function parseBasicType(value, originValue) {
803
826
  var _this = this;
804
827
  if (Array.isArray(value)) {
@@ -828,6 +851,8 @@ var ReflectionParser = /*#__PURE__*/ function() {
828
851
  } else if (ReflectionParser._isEntityRef(value)) {
829
852
  // entity reference
830
853
  return Promise.resolve(this._context.entityMap.get(value.entityId));
854
+ } else if (ReflectionParser._isSignalRef(value)) {
855
+ return this.parseSignal(value);
831
856
  } else if (originValue) {
832
857
  var _this2, _loop = function(key) {
833
858
  if (key === "methods") {
@@ -898,6 +923,9 @@ var ReflectionParser = /*#__PURE__*/ function() {
898
923
  ReflectionParser._isComponentRef = function _isComponentRef(value) {
899
924
  return value["ownerId"] !== undefined && value["componentId"] !== undefined;
900
925
  };
926
+ ReflectionParser._isSignalRef = function _isSignalRef(value) {
927
+ return value["listeners"] !== undefined;
928
+ };
901
929
  ReflectionParser._isMethodObject = function _isMethodObject(value) {
902
930
  return Array.isArray(value == null ? void 0 : value.params);
903
931
  };