bundle插件支持

This commit is contained in:
登科
2022-10-27 09:51:49 +08:00
committed by dgflash
parent fba4e1bec9
commit 8fe3248e89
47 changed files with 16259 additions and 61 deletions

12
assets/bundle.meta Normal file
View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "2541ef24-edf2-4d70-829f-f339d5773702",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

13
assets/bundle/game.meta Normal file
View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "d33e5083-5a17-4520-98f5-f008a9a8633c",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {},
"isBundle": true
}
}

View File

@@ -0,0 +1 @@
{"ver":"1.1.0","importer":"directory","imported":true,"uuid":"5fdb9156-3cb0-44b3-ad2b-1f81d5df171e","files":[],"subMetas":{},"userData":{"compressionType":{},"isRemoteBundle":{}}}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.40",
"importer": "prefab",
"imported": true,
"uuid": "2e4ee0e4-5b5e-4381-950f-67a4a7f35b54",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "game1"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.40",
"importer": "prefab",
"imported": true,
"uuid": "d1d81cd7-c37e-4d2f-a760-bdb0fd7a724c",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "game2"
}
}

View File

@@ -0,0 +1 @@
{"ver":"1.1.0","importer":"directory","imported":true,"uuid":"28325f36-5fca-4849-90b0-6803714693ca","files":[],"subMetas":{},"userData":{"compressionType":{},"isRemoteBundle":{}}}

Binary file not shown.

View File

@@ -0,0 +1 @@
{"ver":"1.0.0","importer":"audio-clip","imported":true,"uuid":"16ad13d8-5994-440f-b623-0c5a7e50dcf3","files":[".json",".mp3"],"subMetas":{},"userData":{"downloadMode":0}}

Binary file not shown.

View File

@@ -0,0 +1 @@
{"ver":"1.0.0","importer":"audio-clip","imported":true,"uuid":"0da0559d-7b2e-4a4c-b761-bed7d2d6d52e","files":[".json",".mp3"],"subMetas":{},"userData":{"downloadMode":0}}

View File

@@ -0,0 +1 @@
{"ver":"1.1.0","importer":"directory","imported":true,"uuid":"c460c78c-bc5a-4f0e-bab6-08602f99a53c","files":[],"subMetas":{},"userData":{"compressionType":{},"isRemoteBundle":{}}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.25",
"importer": "image",
"imported": true,
"uuid": "d0090d90-91f8-4463-ad5b-5c1a4db921fc",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "d0090d90-91f8-4463-ad5b-5c1a4db921fc@6c48a",
"displayName": "game1",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "repeat",
"wrapModeT": "repeat",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "d0090d90-91f8-4463-ad5b-5c1a4db921fc",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "d0090d90-91f8-4463-ad5b-5c1a4db921fc@f9941",
"displayName": "game1",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 100,
"height": 100,
"rawWidth": 100,
"rawHeight": 100,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-50,
-50,
0,
50,
-50,
0,
-50,
50,
0,
50,
50,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
100,
100,
100,
0,
0,
100,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-50,
-50,
0
],
"maxPos": [
50,
50,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "d0090d90-91f8-4463-ad5b-5c1a4db921fc@6c48a",
"atlasUuid": ""
},
"ver": "1.0.11",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": true,
"hasAlpha": false,
"redirect": "d0090d90-91f8-4463-ad5b-5c1a4db921fc@f9941"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.25",
"importer": "image",
"imported": true,
"uuid": "c2c2c397-0af4-4428-b678-644ee0f00b36",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "c2c2c397-0af4-4428-b678-644ee0f00b36@6c48a",
"displayName": "game2",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "repeat",
"wrapModeT": "repeat",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "c2c2c397-0af4-4428-b678-644ee0f00b36",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "c2c2c397-0af4-4428-b678-644ee0f00b36@f9941",
"displayName": "game2",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 100,
"height": 100,
"rawWidth": 100,
"rawHeight": 100,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-50,
-50,
0,
50,
-50,
0,
-50,
50,
0,
50,
50,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
100,
100,
100,
0,
0,
100,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-50,
-50,
0
],
"maxPos": [
50,
50,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "c2c2c397-0af4-4428-b678-644ee0f00b36@6c48a",
"atlasUuid": ""
},
"ver": "1.0.11",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": true,
"hasAlpha": false,
"redirect": "c2c2c397-0af4-4428-b678-644ee0f00b36@f9941"
}
}

13
assets/bundle/home.meta Normal file
View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "75e9e5f5-80c9-4ed4-afe4-c6d0a58fdeea",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {},
"isBundle": true
}
}

View File

@@ -0,0 +1 @@
{"ver":"1.1.0","importer":"directory","imported":true,"uuid":"26ad9b68-cef0-4a59-bdfe-6ab1b25a18a4","files":[],"subMetas":{},"userData":{"compressionType":{},"isRemoteBundle":{}}}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.40",
"importer": "prefab",
"imported": true,
"uuid": "81ea9f29-d9bc-49c3-aff1-3d82251ffe6b",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "home1"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.40",
"importer": "prefab",
"imported": true,
"uuid": "65ef8d70-a15d-4a07-965d-a7d7c83d3776",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "home2"
}
}

View File

@@ -0,0 +1 @@
{"ver":"1.1.0","importer":"directory","imported":true,"uuid":"d9378dfe-e989-499f-943f-5798bdec7040","files":[],"subMetas":{},"userData":{"compressionType":{},"isRemoteBundle":{}}}

Binary file not shown.

View File

@@ -0,0 +1 @@
{"ver":"1.0.0","importer":"audio-clip","imported":true,"uuid":"74c79e69-5ec5-4966-8119-0a4b96ef3d00","files":[".json",".mp3"],"subMetas":{},"userData":{"downloadMode":0}}

Binary file not shown.

View File

@@ -0,0 +1 @@
{"ver":"1.0.0","importer":"audio-clip","imported":true,"uuid":"8bd3117e-2b8e-43d7-93fd-eedc4a55fe91","files":[".json",".mp3"],"subMetas":{},"userData":{"downloadMode":0}}

View File

@@ -0,0 +1 @@
{"ver":"1.1.0","importer":"directory","imported":true,"uuid":"57cd0d4b-2aeb-4b5d-b81c-3039bd3c6cf1","files":[],"subMetas":{},"userData":{"compressionType":{},"isRemoteBundle":{}}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.25",
"importer": "image",
"imported": true,
"uuid": "ca5ccccb-d1dc-438a-9bba-e0bd62d73070",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "ca5ccccb-d1dc-438a-9bba-e0bd62d73070@6c48a",
"displayName": "home1",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "repeat",
"wrapModeT": "repeat",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "ca5ccccb-d1dc-438a-9bba-e0bd62d73070",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "ca5ccccb-d1dc-438a-9bba-e0bd62d73070@f9941",
"displayName": "home1",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 100,
"height": 100,
"rawWidth": 100,
"rawHeight": 100,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-50,
-50,
0,
50,
-50,
0,
-50,
50,
0,
50,
50,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
100,
100,
100,
0,
0,
100,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-50,
-50,
0
],
"maxPos": [
50,
50,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "ca5ccccb-d1dc-438a-9bba-e0bd62d73070@6c48a",
"atlasUuid": ""
},
"ver": "1.0.11",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": true,
"hasAlpha": false,
"redirect": "ca5ccccb-d1dc-438a-9bba-e0bd62d73070@f9941"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -0,0 +1,134 @@
{
"ver": "1.0.25",
"importer": "image",
"imported": true,
"uuid": "70fc8740-e492-4e31-92fe-5a6d02440fe5",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "70fc8740-e492-4e31-92fe-5a6d02440fe5@6c48a",
"displayName": "home2",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "repeat",
"wrapModeT": "repeat",
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0,
"isUuid": true,
"imageUuidOrDatabaseUri": "70fc8740-e492-4e31-92fe-5a6d02440fe5",
"visible": false
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "70fc8740-e492-4e31-92fe-5a6d02440fe5@f9941",
"displayName": "home2",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 100,
"height": 100,
"rawWidth": 100,
"rawHeight": 100,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-50,
-50,
0,
50,
-50,
0,
-50,
50,
0,
50,
50,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
100,
100,
100,
0,
0,
100,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-50,
-50,
0
],
"maxPos": [
50,
50,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "70fc8740-e492-4e31-92fe-5a6d02440fe5@6c48a",
"atlasUuid": ""
},
"ver": "1.0.11",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"fixAlphaTransparencyArtifacts": true,
"hasAlpha": false,
"redirect": "70fc8740-e492-4e31-92fe-5a6d02440fe5@f9941"
}
}

12
assets/demo/bundle.meta Normal file
View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "4b2a3792-bd96-4687-a0fe-9f55f6cdfdd6",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,34 @@
/*
* @Author: dgflash
* @Date: 2022-10-25 17:43:11
* @LastEditors: dgflash
* @LastEditTime: 2022-10-26 09:50:36
*/
import { Component, Prefab, Sprite, _decorator } from 'cc';
import { BundleManager } from '../../script/game/common/bundle/BundleManager';
const { ccclass, property } = _decorator;
@ccclass('Main')
export class Main extends Component {
@property(Sprite)
icon: Sprite = null!;
start() {
this.loadAsset();
}
async loadAsset() {
//自己重新传参,享受下代码提示的快感吧
let res = await BundleManager.loadPrefab("home", "home1");
console.log("预制体", res);
let res1 = await BundleManager.loadAudio("home", "music2");
console.log("音效", res1);
let res2 = await BundleManager.loadTextre("game", "game1");
console.log("图片", res2);
let res3 = await BundleManager.loadAsset("game", "game1", Prefab);
console.log("loadAsset预制体", res3);
this.icon.spriteFrame = res2;
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "bd9e1072-716a-4217-880d-1b569b8d8683",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,728 @@
[
{
"__type__": "cc.SceneAsset",
"_name": "",
"_objFlags": 0,
"_native": "",
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_name": "main",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [],
"_prefab": {
"__id__": 20
},
"autoReleaseAssets": false,
"_globals": {
"__id__": 21
},
"_id": "79df73a8-8755-4e20-bd86-9e39bd9e78b5"
},
{
"__type__": "cc.Node",
"_name": "root",
"_objFlags": 512,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
},
{
"__id__": 4
}
],
"_active": true,
"_components": [
{
"__id__": 19
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "51KEOywK1E4akKtZVxf+Lk"
},
{
"__type__": "cc.Node",
"_name": "game",
"_objFlags": 512,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 1073741824,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "72HkSn751F86VoFGmJXpeo"
},
{
"__type__": "cc.Node",
"_name": "gui",
"_objFlags": 512,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 5
},
{
"__id__": 7
},
{
"__id__": 10
}
],
"_active": true,
"_components": [
{
"__id__": 13
},
{
"__id__": 15
},
{
"__id__": 17
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 640,
"y": 375,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "04HVz/X+dO/KoC2LOzh7O1"
},
{
"__type__": "cc.Node",
"_name": "UICamera",
"_objFlags": 512,
"_parent": {
"__id__": 4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 1000
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "e73tUR45BNpa1z9e8ecKdC"
},
{
"__type__": "cc.Camera",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"__prefab": null,
"_projection": 0,
"_priority": 1073741824,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 438.92913385826773,
"_near": 1,
"_far": 2000,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 0
},
"_depth": 1,
"_stencil": 0,
"_clearFlags": 7,
"_rect": {
"__type__": "cc.Rect",
"x": 0,
"y": 0,
"width": 1,
"height": 1
},
"_aperture": 19,
"_shutter": 7,
"_iso": 0,
"_screenScale": 1,
"_visibility": 33554432,
"_targetTexture": null,
"_cameraType": -1,
"_trackingType": 0,
"_id": "58hTt8B3tKnZaTs3OzCwkE"
},
{
"__type__": "cc.Node",
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 8
},
{
"__id__": 9
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "f7aK3po7dAJodFiexicj3X"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 40,
"height": 36
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "f1MiZKuU9F/pNDMgikmj/v"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"__prefab": null,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "57520716-48c8-4a19-8acf-41c9f8777fb0@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": "74rZ0RxSZKfYrhkRbf2Zch"
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 0,
"_parent": {
"__id__": 4
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 11
},
{
"__id__": 12
}
],
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": -306.294,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": "edm9Hmqh5GjZ34JnB8MyAJ"
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 520,
"height": 90.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "7fO4c92pxPd6OkgdEzOveb"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": null,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_string": "请在代码中尝试重新传参试试\n享受代码提示的快感",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 40,
"_fontSize": 40,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 0,
"_enableWrapText": true,
"_font": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_id": "fbrwdRU+FBU70/vcx6+nrh"
},
{
"__type__": "cc.UITransform",
"_name": "Canvas<UITransform>",
"_objFlags": 0,
"node": {
"__id__": 4
},
"_enabled": true,
"__prefab": {
"__id__": 14
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1280,
"height": 750
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": "9b8MclXbNFz593SPtnWKrD"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "03ZMhNEpRK75Hmdzr8ZGhG"
},
{
"__type__": "cc.Canvas",
"_name": "Canvas<Canvas>",
"_objFlags": 0,
"node": {
"__id__": 4
},
"_enabled": true,
"__prefab": {
"__id__": 16
},
"_cameraComponent": {
"__id__": 6
},
"_alignCanvasWithScreen": true,
"_id": "1dz15JMmpAgKNYspEOuXh6"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "7acBC/yU9N05fc6HGd8fZS"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 4
},
"_enabled": true,
"__prefab": {
"__id__": 18
},
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 0,
"_originalHeight": 1280,
"_alignMode": 2,
"_lockFlags": 45,
"_id": "94hxkzOX9ClLtqc63q0wsQ"
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "1chkRDp1xCFqsnwJh1NVq1"
},
{
"__type__": "bd9e1BycWpCF4gNG1abjYaD",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": null,
"icon": {
"__id__": 9
},
"_id": "d64bObqElCf6gPDZ8OO8Kg"
},
{
"__type__": "cc.PrefabInfo",
"fileId": "984e383b-d959-4558-aeb1-4ceb5fabbd10"
},
{
"__type__": "cc.SceneGlobals",
"ambient": {
"__id__": 22
},
"shadows": {
"__id__": 23
},
"_skybox": {
"__id__": 24
},
"fog": {
"__id__": 25
},
"octree": {
"__id__": 26
}
},
{
"__type__": "cc.AmbientInfo",
"_skyColorHDR": {
"__type__": "cc.Vec4",
"x": 0.242613,
"y": 0.362617,
"z": 0.798746,
"w": 0.520833125
},
"_skyColor": {
"__type__": "cc.Vec4",
"x": 0.242613,
"y": 0.362617,
"z": 0.798746,
"w": 0.520833125
},
"_skyIllumHDR": 20000,
"_skyIllum": 20000,
"_groundAlbedoHDR": {
"__type__": "cc.Vec4",
"x": 0.241814,
"y": 0.361945,
"z": 0.798799,
"w": 0
},
"_groundAlbedo": {
"__type__": "cc.Vec4",
"x": 0.241814,
"y": 0.361945,
"z": 0.798799,
"w": 0
},
"_skyColorLDR": {
"__type__": "cc.Vec4",
"x": 0.519964,
"y": 0.630786,
"z": 0.905039,
"w": 0.5208
},
"_skyIllumLDR": 0.5208,
"_groundAlbedoLDR": {
"__type__": "cc.Vec4",
"x": 0.519544,
"y": 0.630484,
"z": 0.905069,
"w": 0
}
},
{
"__type__": "cc.ShadowsInfo",
"_enabled": false,
"_type": 0,
"_normal": {
"__type__": "cc.Vec3",
"x": 0,
"y": 1,
"z": 0
},
"_distance": 0,
"_shadowColor": {
"__type__": "cc.Color",
"r": 76,
"g": 76,
"b": 76,
"a": 255
},
"_maxReceived": 4,
"_size": {
"__type__": "cc.Vec2",
"x": 1024,
"y": 1024
}
},
{
"__type__": "cc.SkyboxInfo",
"_envLightingType": 0,
"_envmapHDR": {
"__uuid__": "d032ac98-05e1-4090-88bb-eb640dcb5fc1@b47c0",
"__expectedType__": "cc.TextureCube"
},
"_envmap": {
"__uuid__": "d032ac98-05e1-4090-88bb-eb640dcb5fc1@b47c0",
"__expectedType__": "cc.TextureCube"
},
"_envmapLDR": {
"__uuid__": "6f01cf7f-81bf-4a7e-bd5d-0afc19696480@b47c0",
"__expectedType__": "cc.TextureCube"
},
"_diffuseMapHDR": null,
"_diffuseMapLDR": null,
"_enabled": true,
"_useHDR": true,
"_editableMaterial": null,
"_reflectionHDR": null,
"_reflectionLDR": null,
"_rotationAngle": 0
},
{
"__type__": "cc.FogInfo",
"_type": 0,
"_fogColor": {
"__type__": "cc.Color",
"r": 200,
"g": 200,
"b": 200,
"a": 255
},
"_enabled": false,
"_fogDensity": 0.3,
"_fogStart": 0.5,
"_fogEnd": 300,
"_fogAtten": 5,
"_fogTop": 1.5,
"_fogRange": 1.2,
"_accurate": false
},
{
"__type__": "cc.OctreeInfo",
"_enabled": false,
"_minPos": {
"__type__": "cc.Vec3",
"x": -1024,
"y": -1024,
"z": -1024
},
"_maxPos": {
"__type__": "cc.Vec3",
"x": 1024,
"y": 1024,
"z": 1024
},
"_depth": 8
}
]

View File

@@ -0,0 +1 @@
{"ver":"1.1.40","importer":"scene","imported":true,"uuid":"79df73a8-8755-4e20-bd86-9e39bd9e78b5","files":[".json"],"subMetas":{},"userData":{}}

View File

@@ -227,7 +227,7 @@
"_priority": 1073741824,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 417.5365344467641,
"_orthoHeight": 375,
"_near": 1,
"_far": 2000,
"_color": {

View File

@@ -175,7 +175,6 @@
"__prefab": {
"__id__": 6
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -211,7 +210,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -361,7 +362,6 @@
"__prefab": {
"__id__": 13
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -416,7 +416,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -513,7 +515,6 @@
"__prefab": {
"__id__": 21
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -559,8 +560,8 @@
"__id__": 23
},
"templateMode": false,
"labelType": "cc.Label",
"watchPath": "Role.name",
"labelType": "cc.Label",
"watchPathArr": [],
"_id": ""
},
@@ -570,7 +571,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -642,7 +645,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -792,7 +797,6 @@
"__prefab": {
"__id__": 35
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -847,7 +851,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -944,7 +950,6 @@
"__prefab": {
"__id__": 43
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -990,8 +995,8 @@
"__id__": 45
},
"templateMode": false,
"labelType": "cc.Label",
"watchPath": "RoleLevel.lv",
"labelType": "cc.Label",
"watchPathArr": [],
"_id": ""
},
@@ -1001,7 +1006,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -1073,7 +1080,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -1223,7 +1232,6 @@
"__prefab": {
"__id__": 57
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -1278,7 +1286,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -1373,7 +1383,6 @@
"__prefab": {
"__id__": 65
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -1419,8 +1428,8 @@
"__id__": 67
},
"templateMode": false,
"labelType": "cc.Label",
"watchPath": "Role.hp",
"labelType": "cc.Label",
"watchPathArr": [
""
],
@@ -1432,7 +1441,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -1504,7 +1515,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -1656,7 +1669,6 @@
"__prefab": {
"__id__": 79
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -1712,7 +1724,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -1807,7 +1821,6 @@
"__prefab": {
"__id__": 87
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -1853,8 +1866,8 @@
"__id__": 89
},
"templateMode": false,
"labelType": "cc.Label",
"watchPath": "Role.power",
"labelType": "cc.Label",
"watchPathArr": [
""
],
@@ -1866,7 +1879,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -1938,7 +1953,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -2088,7 +2105,6 @@
"__prefab": {
"__id__": 101
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -2143,7 +2159,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -2238,7 +2256,6 @@
"__prefab": {
"__id__": 109
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -2284,8 +2301,8 @@
"__id__": 111
},
"templateMode": false,
"labelType": "cc.Label",
"watchPath": "Role.agile",
"labelType": "cc.Label",
"watchPathArr": [
""
],
@@ -2297,7 +2314,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -2369,7 +2388,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -2519,7 +2540,6 @@
"__prefab": {
"__id__": 123
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -2574,7 +2594,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -2669,7 +2691,6 @@
"__prefab": {
"__id__": 131
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -2715,8 +2736,8 @@
"__id__": 133
},
"templateMode": false,
"labelType": "cc.Label",
"watchPath": "RoleBase.physical",
"labelType": "cc.Label",
"watchPathArr": [
""
],
@@ -2728,7 +2749,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -2800,7 +2823,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -3002,7 +3027,6 @@
"__prefab": {
"__id__": 146
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -3038,7 +3062,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -3082,7 +3108,6 @@
"__prefab": {
"__id__": 151
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -3138,7 +3163,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -3285,7 +3312,6 @@
"__prefab": {
"__id__": 160
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -3321,7 +3347,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -3365,7 +3393,6 @@
"__prefab": {
"__id__": 165
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -3421,7 +3448,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -3493,7 +3522,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
@@ -3574,7 +3605,6 @@
"__prefab": {
"__id__": 179
},
"_visFlags": 0,
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
@@ -3627,7 +3657,9 @@
},
{
"__type__": "cc.PrefabInfo",
"root": null,
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},

View File

@@ -2,10 +2,11 @@
* @Author: dgflash
* @Date: 2021-07-03 16:13:17
* @LastEditors: dgflash
* @LastEditTime: 2022-10-21 09:52:06
* @LastEditTime: 2022-10-14 15:25:22
*/
import { dynamicAtlasManager, macro, profiler, _decorator } from 'cc';
import { dynamicAtlasManager, macro, profiler, _decorator, Prefab } from 'cc';
import { DEBUG, JSB } from 'cc/env';
import { RandomManager } from '../../extensions/oops-plugin-framework/assets/core/common/manager/RandomManager';
import { oops } from '../../extensions/oops-plugin-framework/assets/core/Oops';
import { Root } from '../../extensions/oops-plugin-framework/assets/core/Root';
import { ecs } from '../../extensions/oops-plugin-framework/assets/libs/ecs/ECS';
@@ -15,6 +16,7 @@ import { EcsPositionSystem } from './game/common/ecs/position/EcsPositionSystem'
import { smc } from './game/common/ecs/SingletonModuleComp';
import { EcsInitializeSystem, Initialize } from './game/initialize/Initialize';
import { EcsRoleSystem } from './game/role/Role';
import { CCBundleManager } from '../../extensions/oops-plugin-framework/assets/module/common/CCBundleManager';
const { ccclass, property } = _decorator;
@@ -26,6 +28,10 @@ dynamicAtlasManager.maxFrameSize = 512;
export class Main extends Root {
start() {
if (DEBUG) profiler.showStats();
RandomManager.instance.setSeed(1);
for (let index = 0; index < 10; index++) {
console.log(RandomManager.instance.getRandomInt(1, 1000));
}
}
protected run() {
@@ -39,7 +45,7 @@ export class Main extends Root {
oops.gui.init(UIConfigData);
}
protected initEcsSystem() {
protected async initEcsSystem() {
oops.ecs.add(new EcsPositionSystem())
oops.ecs.add(new EcsAccountSystem());
oops.ecs.add(new EcsRoleSystem());

View File

@@ -0,0 +1,12 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "1811a053-d019-4c61-849b-6159eebb591f",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@@ -0,0 +1,40 @@
export default class BundleConfig {
private static _instance: BundleConfig = null!;
static get instance(): BundleConfig {
return (BundleConfig._instance ? BundleConfig._instance : (BundleConfig._instance = new BundleConfig()));
}
// start >>>>>>
BundleName = {
game: {
prefab: {
"game1": 'prefab/game1',
"game2": 'prefab/game2',
},
sound: {
"music1": 'sound/music1',
"music2": 'sound/music2',
},
texture: {
"game1": 'texture/game1',
"game2": 'texture/game2',
},
},
home: {
prefab: {
"home1": 'prefab/home1',
"home2": 'prefab/home2',
},
sound: {
"music1": 'sound/music1',
"music2": 'sound/music2',
},
texture: {
"home1": 'texture/home1',
"home2": 'texture/home2',
},
},
}
// end >>>>>>
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "a9ca4276-d7a3-44c1-9da5-95bf8f9de35c",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,131 @@
import { Asset, AudioClip, Font, ImageAsset, JsonAsset, Material, Prefab, Sprite, SpriteFrame, Texture2D } from "cc";
import { oops } from "../../../../../extensions/oops-plugin-framework/assets/core/Oops";
import BundleConfig from "./BundleConfig";
export type NoInfer<A extends any> = [A][A extends any ? 0 : never];
export type BundleName = keyof BundleConfig["BundleName"];
/** 资源模块化工具 */
export class BundleManager {
/**
* 根据资源类型获得对应文件
* @param assetType 资源类型
*/
private static getAssetUrl<T extends typeof Asset>(assetType: T) {
let typeUrl = "";
switch (assetType as any) {
case Prefab:
typeUrl = "prefab";
break;
case Material:
typeUrl = "shader";
break;
case AudioClip:
typeUrl = "sound";
break;
case ImageAsset:
case Texture2D:
case Sprite:
case SpriteFrame:
typeUrl = "texture";
break;
case JsonAsset:
typeUrl = "data";
break;
case Font:
typeUrl = "font";
break;
default:
console.error("没有该资源类型", assetType);
break;
}
return typeUrl;
}
/**
* 加载指定类型资源
* @param bundleName 外部资源包名
* @param assetName 目标加载资源名
*/
public static loadAsset<T extends typeof Asset,
TBundleName extends BundleName,
TAssetName = keyof BundleConfig['BundleName'][TBundleName]['prefab'] | keyof BundleConfig['BundleName'][TBundleName]['sound'] | keyof BundleConfig['BundleName'][TBundleName]['texture']>
(bundleName: TBundleName, assetName: NoInfer<TAssetName>, assetType: T): Promise<InstanceType<T>> {
let str = this.getAssetUrl(assetType);
// @ts-ignore
let url: string = BundleConfig.instance.BundleName[bundleName][str][assetName];
// 兼容3.x ,加载 SpriteFrame 路径需要添加后缀
if (assetType as any === SpriteFrame) {
url += "/spriteFrame";
}
else if (assetType as any === Texture2D) {
url += "/texture";
}
return new Promise(async (resolve, reject) => {
// @ts-ignore
oops.res.load(bundleName, url, (err: Error, res: any) => {
if (!err) {
// 加载成功
resolve(res);
}
else {
//加载失败
reject(err);
console.error(`外部资源包${bundleName},路径${url},加载失败`, err);
}
});
});
}
/**
* 加载预制体
* @param bundleName ab包名模块名
* @param assetName 资源名
*/
public static loadPrefab<TBundleName extends BundleName, TAssetName = keyof BundleConfig['BundleName'][TBundleName]['prefab']>
(bundleName: TBundleName, assetName: NoInfer<TAssetName>): Promise<Prefab> {
return this.loadAsset(bundleName, assetName, Prefab);
}
/**
* 加载音频
* @param bundleName ab包名模块名
* @param assetName 资源名
*/
public static loadAudio<TBundleName extends BundleName, TAssetName = keyof BundleConfig['BundleName'][TBundleName]['sound']>
(bundleName: TBundleName, assetName: NoInfer<TAssetName>): Promise<AudioClip> {
return this.loadAsset(bundleName, assetName, AudioClip);
}
/**
* 加载图片
* @param bundleName ab包名模块名
* @param assetName 资源名
*/
public static loadTextre<TBundleName extends BundleName, TAssetName = keyof BundleConfig['BundleName'][TBundleName]['texture']>
(bundleName: TBundleName, assetName: NoInfer<TAssetName>): Promise<SpriteFrame> {
return this.loadAsset(bundleName, assetName, SpriteFrame);
}
/**
* 通过资源相对路径释放资源
* @param bundleName ab包名模块名
* @param assetName 资源名
*/
public static release<T extends typeof Asset, TBundleName extends BundleName, TAssetName = keyof BundleConfig['BundleName'][TBundleName]['prefab'] | keyof BundleConfig['BundleName'][TBundleName]['sound'] | keyof BundleConfig['BundleName'][TBundleName]['texture']>
(bundleName: TBundleName, assetName: TAssetName, assetType: T) {
let str = this.getAssetUrl(assetType);
// @ts-ignore
let url: string = BundleConfig.BundleName[bundleName][str][assetName];
// 兼容3.x ,加载 SpriteFrame 路径需要添加后缀
if (assetType as any === SpriteFrame) {
url += "/spriteFrame";
}
else if (assetType as any === Texture2D) {
url += "/texture";
}
oops.res.release(url, bundleName);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "d4690e73-4043-47bc-9a21-199e4dd61cd6",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,9 +1,3 @@
/*
* @Author: dgflash
* @Date: 2022-08-09 11:51:38
* @LastEditors: dgflash
* @LastEditTime: 2022-09-05 13:58:42
*/
import { JsonUtil } from "../../../../../extensions/oops-plugin-framework/assets/core/utils/JsonUtil";
@@ -22,11 +16,12 @@ export class TableRoleLevelUp {
id: number = 0;
/** 升级所需经验 */
get needexp(): number {
get needexp(): string {
return this.data.needexp;
}
/** 升级增加生命 */
get hp(): number {
get hp(): string {
return this.data.hp;
}
}