@zhongguo168a/yxeditor-common 0.0.80 → 0.0.82

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/index.d.ts CHANGED
@@ -1509,6 +1509,9 @@ declare class AssetLoader extends Dispatcher {
1509
1509
  onComplete?: (err: any, asset: any) => void;
1510
1510
  uuid?: string;
1511
1511
  }): this;
1512
+ loadTexture2D(uri: string, otherConfig?: {
1513
+ onComplete?: (err: any, asset: any) => void;
1514
+ }): this;
1512
1515
  loadImageAsset(uri: string, otherConfig?: {
1513
1516
  onComplete?: (err: any, asset: any) => void;
1514
1517
  }): this;
@@ -1813,7 +1816,7 @@ declare const enum GeometryDirection {
1813
1816
  NorthWest = 5,
1814
1817
  North = 6,
1815
1818
  NorthEast = 7,
1816
- Any = -1
1819
+ Any = 255
1817
1820
  }
1818
1821
  declare const enum DirectionMode {
1819
1822
  任意 = 0,
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { HorizontalTextAlignment, VerticalTextAlignment, director, macro, Scheduler, math, instantiate, _decorator, Component, SpriteAtlas, Size, Vec2, Rect, SpriteFrame, path, assetManager, ImageAsset, JsonAsset, TextAsset, Asset, Texture2D, find, Canvas, Node, Vec3, Vec4, resources, UITransform, Widget } from 'cc';
1
+ import { HorizontalTextAlignment, VerticalTextAlignment, director, macro, Scheduler, math, instantiate, _decorator, Component, SpriteAtlas, Size, Vec2, Rect, SpriteFrame, path, assetManager, Texture2D, ImageAsset, JsonAsset, TextAsset, Asset, find, Canvas, Node, Vec3, Vec4, resources, UITransform, Widget } from 'cc';
2
2
 
3
3
  class NetUtil {
4
4
  // 获取URL的参数对象
@@ -4766,6 +4766,16 @@ class AssetLoader extends Dispatcher {
4766
4766
  this._loaderList.push(item);
4767
4767
  return this;
4768
4768
  }
4769
+ loadTexture2D(uri, otherConfig) {
4770
+ let item = new LoaderItem();
4771
+ item.type = "Texture2D";
4772
+ item.uri = new AssetURI(uri);
4773
+ if (otherConfig) {
4774
+ item.onComplete = otherConfig.onComplete;
4775
+ }
4776
+ this._loaderList.push(item);
4777
+ return this;
4778
+ }
4769
4779
  loadImageAsset(uri, otherConfig) {
4770
4780
  let item = new LoaderItem();
4771
4781
  item.type = "ImageAsset";
@@ -4894,6 +4904,14 @@ class AssetLoader extends Dispatcher {
4894
4904
  });
4895
4905
  break;
4896
4906
  }
4907
+ case "Texture2D": {
4908
+ this._loadByItem(item, Texture2D, (err, asset) => {
4909
+ this._loaded++;
4910
+ item.callHandler(null, asset);
4911
+ this.validComplete();
4912
+ });
4913
+ break;
4914
+ }
4897
4915
  }
4898
4916
  });
4899
4917
  return this;
@@ -5045,7 +5063,24 @@ class AssetLoader extends Dispatcher {
5045
5063
  if (this._stop) {
5046
5064
  return;
5047
5065
  }
5048
- onComplate(err, asset);
5066
+ let lastAsset;
5067
+ switch (item.type) {
5068
+ case "Texture2D": {
5069
+ const texture = new Texture2D();
5070
+ texture.image = asset;
5071
+ lastAsset = texture;
5072
+ break;
5073
+ }
5074
+ case "SpriteFrame": {
5075
+ const texture = new Texture2D();
5076
+ texture.image = asset;
5077
+ const spriteFrame = new SpriteFrame();
5078
+ spriteFrame.texture = texture;
5079
+ lastAsset = spriteFrame;
5080
+ break;
5081
+ }
5082
+ }
5083
+ onComplate(err, lastAsset);
5049
5084
  });
5050
5085
  }
5051
5086
  }
@@ -5477,7 +5512,7 @@ var GeometryDirection;
5477
5512
  GeometryDirection[GeometryDirection["NorthWest"] = 5] = "NorthWest";
5478
5513
  GeometryDirection[GeometryDirection["North"] = 6] = "North";
5479
5514
  GeometryDirection[GeometryDirection["NorthEast"] = 7] = "NorthEast";
5480
- GeometryDirection[GeometryDirection["Any"] = -1] = "Any";
5515
+ GeometryDirection[GeometryDirection["Any"] = 255] = "Any";
5481
5516
  })(GeometryDirection || (GeometryDirection = {}));
5482
5517
  var DirectionMode;
5483
5518
  (function (DirectionMode) {