@cc-component/cc-core 1.5.1 → 1.5.3

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.
@@ -191,6 +191,10 @@ export class ResourceManager {
191
191
  path = path.replace("/spriteFrame", "")
192
192
  return `${bundleName}:${path}`;
193
193
  }
194
+ public getAssetPath(node: Asset) {
195
+ if (node && node.isValid) return node.asset_path.split(':').pop()
196
+ return ''
197
+ }
194
198
 
195
199
  LogAssets(bundleName: string) {
196
200
  if (!DEBUG) {
@@ -45,6 +45,8 @@ export class App {
45
45
  static get tools(): Tools { return this.instance._tools };
46
46
  /**对象池 */
47
47
  static get pool(): EffectSingleCase { return this.instance._pool }
48
+ /**资源管理 */
49
+ static get res(): ResourceManager { return this.instance._res }
48
50
 
49
51
  _gui: LayerUI;
50
52
  _http: HttpManager;
@@ -56,6 +58,8 @@ export class App {
56
58
  _sound: AudioUtil;
57
59
  _tools: Tools;
58
60
  _pool: EffectSingleCase;
61
+ _res: ResourceManager;
62
+
59
63
  private static instance: App | null = null;
60
64
  public static get Ins(): App {
61
65
  if (!App.instance) { App.instance = new App(); }
@@ -88,6 +92,7 @@ export class App {
88
92
  self._sound = new AudioUtil();
89
93
  self._tools = new Tools();
90
94
  self._pool = EffectSingleCase.instance;
95
+ self._res = ResourceManager.instance;
91
96
 
92
97
  if (EDITOR) { return }//编辑器环境,不执行下面逻辑
93
98
  Logger.setLevel(ELoggerLevel.Error);
@@ -2,7 +2,7 @@ import { Asset, Sprite, sp, Vec3 } from "cc";
2
2
  import { IHttpConfig, IBundleConfig, IInitConfig, IWindowParam } from "../config/CommonEnum";
3
3
  import { LayerType } from "../config/LayerType";
4
4
  import { LayerUI } from "../config/LayerUI";
5
- import { AssetsType } from "../home/ResourceManager";
5
+ import { AssetsType, ResourceManager } from "../home/ResourceManager";
6
6
  import { TimeManager } from "../home/TimeManager";
7
7
  import { LanguageManager } from "../lib/language/Language";
8
8
  import { HttpManager, HttpReturn } from "../lib/net/net/HttpManager";
@@ -40,7 +40,9 @@ declare global {
40
40
  /**工具类 */
41
41
  const tools: Tools;
42
42
  /**对象池 */
43
- const pool: EffectSingleCase
43
+ const pool: EffectSingleCase;
44
+ /**资源管理 */
45
+ const res: ResourceManager
44
46
 
45
47
  /**当前所在bundle名称 */
46
48
  const bundleName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-core",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",