This commit is contained in:
2025-07-17 17:18:21 +08:00
commit 1ffc1b5cf0
5309 changed files with 1150310 additions and 0 deletions
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "e72f819e-8232-46e4-b3bd-b1fc2ecee1c9",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "e72f819e-8232-46e4-b3bd-b1fc2ecee1c9@6c48a",
"displayName": "gisela_portrait",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "e72f819e-8232-46e4-b3bd-b1fc2ecee1c9",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "e72f819e-8232-46e4-b3bd-b1fc2ecee1c9@f9941",
"displayName": "gisela_portrait",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": -7,
"trimX": 0,
"trimY": 14,
"width": 276,
"height": 350,
"rawWidth": 276,
"rawHeight": 364,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-138,
-175,
0,
138,
-175,
0,
-138,
175,
0,
138,
175,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
350,
276,
350,
0,
0,
276,
0
],
"nuv": [
0,
0,
1,
0,
0,
0.9615384615384616,
1,
0.9615384615384616
],
"minPos": [
-138,
-175,
0
],
"maxPos": [
138,
175,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "e72f819e-8232-46e4-b3bd-b1fc2ecee1c9@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "e72f819e-8232-46e4-b3bd-b1fc2ecee1c9@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "f10d47ab-f17a-4350-82b0-3ed27203a709",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "f10d47ab-f17a-4350-82b0-3ed27203a709@6c48a",
"displayName": "yeshchina_disgust",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "f10d47ab-f17a-4350-82b0-3ed27203a709",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "f10d47ab-f17a-4350-82b0-3ed27203a709@f9941",
"displayName": "yeshchina_disgust",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -23,
"offsetY": -3.5,
"trimX": 96,
"trimY": 7,
"width": 687,
"height": 1182,
"rawWidth": 925,
"rawHeight": 1189,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-343.5,
-591,
0,
343.5,
-591,
0,
-343.5,
591,
0,
343.5,
591,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
96,
1182,
783,
1182,
96,
0,
783,
0
],
"nuv": [
0.10378378378378378,
0,
0.8464864864864865,
0,
0.10378378378378378,
0.9941126997476871,
0.8464864864864865,
0.9941126997476871
],
"minPos": [
-343.5,
-591,
0
],
"maxPos": [
343.5,
591,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "f10d47ab-f17a-4350-82b0-3ed27203a709@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "f10d47ab-f17a-4350-82b0-3ed27203a709@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "679f06fb-2d50-4f8b-a614-f5ba18016fe5",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "679f06fb-2d50-4f8b-a614-f5ba18016fe5@6c48a",
"displayName": "lingyun_1_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "679f06fb-2d50-4f8b-a614-f5ba18016fe5",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "679f06fb-2d50-4f8b-a614-f5ba18016fe5@f9941",
"displayName": "lingyun_1_cg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 996,
"height": 1280,
"rawWidth": 996,
"rawHeight": 1280,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-498,
-640,
0,
498,
-640,
0,
-498,
640,
0,
498,
640,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1280,
996,
1280,
0,
0,
996,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-498,
-640,
0
],
"maxPos": [
498,
640,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "679f06fb-2d50-4f8b-a614-f5ba18016fe5@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "679f06fb-2d50-4f8b-a614-f5ba18016fe5@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "456f56ec-461a-4fe8-879a-5a50ea0f8322",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "456f56ec-461a-4fe8-879a-5a50ea0f8322@6c48a",
"displayName": "krischya_stage_icon",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "456f56ec-461a-4fe8-879a-5a50ea0f8322",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "456f56ec-461a-4fe8-879a-5a50ea0f8322@f9941",
"displayName": "krischya_stage_icon",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 174,
"height": 174,
"rawWidth": 174,
"rawHeight": 174,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-87,
-87,
0,
87,
-87,
0,
-87,
87,
0,
87,
87,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
174,
174,
174,
0,
0,
174,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-87,
-87,
0
],
"maxPos": [
87,
87,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "456f56ec-461a-4fe8-879a-5a50ea0f8322@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "456f56ec-461a-4fe8-879a-5a50ea0f8322@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "ed5e609e-3329-49e9-86d6-3296f9e28570",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "ed5e609e-3329-49e9-86d6-3296f9e28570@6c48a",
"displayName": "jialin_laugh",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "ed5e609e-3329-49e9-86d6-3296f9e28570",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "ed5e609e-3329-49e9-86d6-3296f9e28570@f9941",
"displayName": "jialin_laugh",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -13.5,
"offsetY": -10,
"trimX": 141,
"trimY": 20,
"width": 616,
"height": 1169,
"rawWidth": 925,
"rawHeight": 1189,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-308,
-584.5,
0,
308,
-584.5,
0,
-308,
584.5,
0,
308,
584.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
141,
1169,
757,
1169,
141,
0,
757,
0
],
"nuv": [
0.15243243243243243,
0,
0.8183783783783783,
0,
0.15243243243243243,
0.9831791421362489,
0.8183783783783783,
0.9831791421362489
],
"minPos": [
-308,
-584.5,
0
],
"maxPos": [
308,
584.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "ed5e609e-3329-49e9-86d6-3296f9e28570@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "ed5e609e-3329-49e9-86d6-3296f9e28570@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

@@ -0,0 +1 @@
{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"a506c6be-dca1-41f6-8c78-c238a9da1575","files":[],"subMetas":{},"userData":{}}
Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 436 KiB

@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "767626bc-511f-42c2-9aa5-8eeafac23a59",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "767626bc-511f-42c2-9aa5-8eeafac23a59@6c48a",
"displayName": "celestine_shy",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "767626bc-511f-42c2-9aa5-8eeafac23a59",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "767626bc-511f-42c2-9aa5-8eeafac23a59@f9941",
"displayName": "celestine_shy",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "none",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 925,
"height": 1189,
"rawWidth": 925,
"rawHeight": 1189,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-462.5,
-594.5,
0,
462.5,
-594.5,
0,
-462.5,
594.5,
0,
462.5,
594.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1189,
925,
1189,
0,
0,
925,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-462.5,
-594.5,
0
],
"maxPos": [
462.5,
594.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "767626bc-511f-42c2-9aa5-8eeafac23a59@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "767626bc-511f-42c2-9aa5-8eeafac23a59@6c48a"
}
}
@@ -0,0 +1,457 @@
import { _decorator, AssetManager, assetManager, Component, Node, director, Prefab, resources, Sprite, SpriteFrame, Texture2D, v2, SpriteAtlas, ImageAsset, instantiate, AudioClip, Asset, JsonAsset, Material } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('ResManager')
export default class ResManager {
private static _I: ResManager = null;
public static get I(): ResManager {
if (!ResManager._I) {
ResManager._I = new ResManager();
}
return ResManager._I;
}
/**切换场景 */
enterScene(i_sceneName: string) {
director.loadScene(i_sceneName, () => { });
}
/** 场景-跳转到主界面场景*/
goMainScene() {
this.enterScene('MainScene');
}
/** 场景-跳转到游戏场景*/
goGameScene() {
this.enterScene('GameScene');
}
/** 场景-跳转到自定义场景*/
goCustomScene(sceneName:string) {
this.enterScene(sceneName);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// /**加载bundle */
// loadBundle(bundleName, cb?) {
// let bundle = assetManager.getBundle(bundleName)
// if (bundle) { cb && cb(bundle); return; }
// assetManager.loadBundle(bundleName, (err: Error, _bundle: AssetManager.Bundle) => {
// if (!err) {
// cb && cb(_bundle);
// }
// });
// }
/**移除bundle */
removeBundle(bundleName) {
let bundle = assetManager.getBundle(bundleName);
if (bundle) {
bundle.releaseAll();
assetManager.removeBundle(bundle);
}
}
/**预加载bundle中的PB*/
preLoadSubpackagePrefab(url: string, cb) {
let bundle = assetManager.getBundle("PB");
if (bundle){
bundle.preload(url, Prefab, (err, res) => {
if (err) {
console.log(err);
return
}
cb && cb();
});
} else {
assetManager.loadBundle("PB", (err: Error, _bundle: AssetManager.Bundle) => {
if (err) {
console.log(err);
return
}
this.preLoadSubpackagePrefab(url, cb);
});
}
}
/**预加载bundle中的文件*/
preLoadSubpackageFile(url: string, pkgName: string, ftype, succCB, failCB) {
let bundle = assetManager.getBundle(pkgName);
if (bundle){
bundle.preload(url, ftype, (err, res) => {
if (err) {
console.log(err);
failCB && failCB(err);
return
}
succCB && succCB();
});
} else {
assetManager.loadBundle(pkgName, (err: Error, _bundle: AssetManager.Bundle) => {
if (err) {
console.log(err);
failCB && failCB(err);
return
}
this.preLoadSubpackageFile(url, pkgName, ftype, succCB, failCB);
});
}
}
/** 加载bundle中的PB*/
loadSubpackagePrefab(url: string, cb) {
let bundle = assetManager.getBundle("PB");
if (bundle){
bundle.load(url, Prefab, (err, res: Prefab) => {
if (err) {
console.log(err);
return
}
let cc_N = instantiate(res);
cb && cb(cc_N);
});
}else{
assetManager.loadBundle("PB", (err: Error, _bundle: AssetManager.Bundle) => {
if (err) {
console.log(err);
return
}
this.loadSubpackagePrefab(url, cb);
});
}
}
/**获取pb节点 */
getPrefab(path: string, cb: Function, target: Node) {
this.loadSubpackagePrefab(path, (pb: Prefab) => {
if (target && !target.isValid) {
pb.destroy()
return;
}
pb['path'] = path;
cb && cb(pb);
});
}
/** 加载bundle中的PB*/
loadSubpackage3DModel(url: string, cb) {
let bundle = assetManager.getBundle("Model3D");
if (bundle){
bundle.load(url, Prefab, (err, res: Prefab) => {
if (err) {
console.log(err);
return
}
let cc_N = instantiate(res);
cb && cb(cc_N);
});
}else{
assetManager.loadBundle("Model3D", (err: Error, _bundle: AssetManager.Bundle) => {
if (err) {
console.log(err);
return
}
this.loadSubpackage3DModel(url, cb);
});
}
}
/** 改变图片--bundle资源 sprite-frame类型的图片*/
changeBundleSpriteFrame(spt: Sprite, url: string, packageName: string, cb: Function = null) {
if (!spt || !url) return;
let bundle = assetManager.getBundle(packageName);
if (bundle){
bundle.load(url + "/spriteFrame", SpriteFrame, (err, res: SpriteFrame) => {
if (err) {
console.log(err);
return
}
if (!spt.isValid) {
return;
}
spt.spriteFrame = res;
cb && cb(res);
});
}else{
assetManager.loadBundle(packageName, (err: Error, _bundle: AssetManager.Bundle) => {
if (err) {
console.log(err);
return
}
this.changeBundleSpriteFrame(spt, url, packageName, cb);
});
}
}
/** 改变图片--bundle资源 texture类型的图片*/
changeBundleTexture(spt: Sprite, url: string, packageName: string, cb: Function = null) {
if (!spt || !url) return;
let bundle = assetManager.getBundle(packageName);
if (bundle){
bundle.load(url + "/texture", Texture2D, (err, res: Texture2D) => {
if (err) {
console.log(err);
return
}
if (!spt.isValid) {
return;
}
let spriteFrame = new SpriteFrame()
spriteFrame.texture = res
spt.spriteFrame = spriteFrame;
cb && cb(res);
});
}else{
assetManager.loadBundle(packageName, (err: Error, _bundle: AssetManager.Bundle) => {
if (err) {
console.log(err);
return
}
this.changeBundleTexture(spt, url, packageName, cb);
});
}
}
/** 加载bundle中的音频文件*/
getBundleAudio(url: string, cb) {
let bundle = assetManager.getBundle("Audio");
if (bundle){
bundle.load(url, AudioClip, (err, res: AudioClip) => {
if (err) {
console.log(err);
return
}
cb && cb(res);
});
}else{
assetManager.loadBundle("Audio", (err: Error, _bundle: AssetManager.Bundle) => {
if (err) {
console.log(err);
return
}
this.getBundleAudio(url, cb);
});
}
}
/** 加载bundle中的配置表*/
loadSubpackageDataTable(url: string, cb) {
let bundle = assetManager.getBundle("DataTable");
if (bundle){
bundle.load(url, JsonAsset, (err, res: JsonAsset) => {
if (err) {
console.log(err);
return
}
cb && cb(res);
});
}else{
assetManager.loadBundle("DataTable", (err: Error, _bundle: AssetManager.Bundle) => {
if (err) {
console.log(err);
return
}
this.loadSubpackagePrefab(url, cb);
});
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//region 加载远程音频
/** 加载远程资源*/
loadRemoteAudio(url: string, cb: Function = null) {
assetManager.loadRemote<AudioClip>(url, (err, res: AudioClip) => {
if (err) {
console.error(err);
return
}
cb && cb(res);
})
}
/** 加载远程资源*/
// private loadRemoteRes1(url1: string, suffix: string = 'png', cb) {
// let tempStrArr: Array<string> = url1.split(".");
// let aimStr = url1;
// if (tempStrArr.length > 1) {
// aimStr = tempStrArr[0];
// }
// let url: string = `http://tk3h5.hgwl710.com/Fish/DEV/TS/Res/`;
// url += aimStr + '.' + suffix;
// if (url1.includes("://")) { url = url1 }
// assetManager.loadRemote<ImageAsset>(url, { cacheEnabled: true }, (err, res: ImageAsset) => {
// if (!err) {
// const spriteFrame = new SpriteFrame();
// const texture = new Texture2D();
// texture.image = res;
// spriteFrame.texture = texture;
// cb && cb(spriteFrame);
// }
// })
// }
//region 加载远程图片
/**
* 获取远程图片资源并设置
* @param spt 要设置的节点
* @param url url地址
* @param suffix 图片后缀名
* @param cb 回调函数
*/
changeRemoteSpriteFrame(spt: Sprite, url: string, suffix: string = 'png', cb: Function = null) {
if (!spt || !url) return;
assetManager.loadRemote<ImageAsset>(url, {ext: '.'+suffix}, (err, res: ImageAsset) => {
if (err) {
console.log(err);
return
}
if (!spt.isValid) {
return;
}
const spriteFrame = new SpriteFrame();
const texture = new Texture2D();
texture.image = res;
spriteFrame.texture = texture;
spt.spriteFrame = spriteFrame;
cb && cb(res);
})
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/** 加载resources里的PB path:不带后缀*/
private loadResourcePrefab(path: string, cb) {
resources.load(path, Prefab, (err, res: Prefab) => {
if (!err) {
cb && cb(res);
} else {
// loader.rlease(path);
}
})
}
/** 加载resources里的图片*/
private loadResourceRes(path: string, cb) {
resources.load(path, ImageAsset, (err, res: ImageAsset) => {
if (err) {
console.log(err);
return
}
cb && cb(res);
})
}
/** 加载resources里图集里的图片*/
// 加载 SpriteAtlas(图集),并且获取其中的一个 SpriteFrame
// 注意 atlas 资源文件(plist)通常会和一个同名的图片文件(png)放在一个目录下, 所以需要在第二个参数指定资源类型
private loadResourceAtlas(sptName: string, path: string, cb) {
resources.load(path, SpriteAtlas, (err, res: SpriteAtlas) => {
const frame = res.getSpriteFrame(sptName);
if (!err) {
cb && cb(frame);
} else {
// loader.release(path);
}
});
}
/** 改变图片--resources里sprite-frame类型的图片*/
changeResourceSpriteFrame(spt: Sprite, path: string, cb: Function = null) {
if (!spt || !path) return;
resources.load(path + "/spriteFrame", SpriteFrame, (err, res: SpriteFrame) => {
if (err) {
console.log(err);
return
}
if (!spt.isValid) {
return;
}
spt.spriteFrame = res;
cb && cb(res);
})
}
/** 改变图片--resources里texture类型的图片*/
changeResourceTexture(spt: Sprite, path: string, cb: Function = null) {
if (!spt || !path) return;
resources.load(path + "/texture", Texture2D, (err, res: Texture2D) => {
if (err) {
console.log(err);
return
}
if (!spt.isValid) {
return;
}
let spriteFrame = new SpriteFrame()
spriteFrame.texture = res
spt.spriteFrame = spriteFrame;
cb && cb(res);
})
}
//设置图片置灰
SetGray(spt: Sprite, isGray: boolean) {
//cc.assetManager.builtins.getBuiltin("material", "builtin-" + name)
if (isGray) {
let bundle = assetManager.getBundle("Materials");
if (bundle){
bundle.load("ui_sprite_gray", Material, (err, res: Material) => {
if (err) {
console.log(err);
return
}
// spt.setSharedMaterial(res, 0)
spt.customMaterial = res
});
}else{
assetManager.loadBundle("Materials", (err: Error, _bundle: AssetManager.Bundle) => {
if (err) {
console.log(err);
return
}
this.SetGray(spt, isGray);
});
}
} else {
// spt.setSharedMaterial(null, 0)
spt.customMaterial = null
}
}
/**设置图片模糊*/
SetBlur(spt: Sprite, isBule: boolean) {
if (isBule) {
let bundle = assetManager.getBundle("Materials");
if (bundle){
bundle.load("mohu", Material, (err, res: Material) => {
if (err) {
console.log(err);
return
}
// spt.setSharedMaterial(res, 0)
spt.customMaterial = res
});
}else{
assetManager.loadBundle("Materials", (err: Error, _bundle: AssetManager.Bundle) => {
if (err) {
console.log(err);
return
}
this.SetBlur(spt, isBule);
});
}
} else {
// spt.setSharedMaterial(null, 0)
spt.customMaterial = null
}
}
}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "a101917f-1a18-4119-83c3-4319ac3412cc",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "a101917f-1a18-4119-83c3-4319ac3412cc@6c48a",
"displayName": "metis_default",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "a101917f-1a18-4119-83c3-4319ac3412cc",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "a101917f-1a18-4119-83c3-4319ac3412cc@f9941",
"displayName": "metis_default",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "none",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 925,
"height": 1189,
"rawWidth": 925,
"rawHeight": 1189,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-462.5,
-594.5,
0,
462.5,
-594.5,
0,
-462.5,
594.5,
0,
462.5,
594.5,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1189,
925,
1189,
0,
0,
925,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-462.5,
-594.5,
0
],
"maxPos": [
462.5,
594.5,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "a101917f-1a18-4119-83c3-4319ac3412cc@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "a101917f-1a18-4119-83c3-4319ac3412cc@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "23d54029-9595-46f3-9240-71057ddd37f4",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "23d54029-9595-46f3-9240-71057ddd37f4@6c48a",
"displayName": "tarenaya_1_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "23d54029-9595-46f3-9240-71057ddd37f4",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "23d54029-9595-46f3-9240-71057ddd37f4@f9941",
"displayName": "tarenaya_1_cg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 996,
"height": 1280,
"rawWidth": 996,
"rawHeight": 1280,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-498,
-640,
0,
498,
-640,
0,
-498,
640,
0,
498,
640,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1280,
996,
1280,
0,
0,
996,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-498,
-640,
0
],
"maxPos": [
498,
640,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "23d54029-9595-46f3-9240-71057ddd37f4@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "23d54029-9595-46f3-9240-71057ddd37f4@6c48a"
}
}
@@ -0,0 +1,134 @@
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "77ef5666-d950-4704-a463-c4b55a53dc8b",
"files": [
".jpg",
".json"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "77ef5666-d950-4704-a463-c4b55a53dc8b@6c48a",
"displayName": "allie_1_cg",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "77ef5666-d950-4704-a463-c4b55a53dc8b",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "77ef5666-d950-4704-a463-c4b55a53dc8b@f9941",
"displayName": "allie_1_cg",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 996,
"height": 1280,
"rawWidth": 996,
"rawHeight": 1280,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-498,
-640,
0,
498,
-640,
0,
-498,
640,
0,
498,
640,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
1280,
996,
1280,
0,
0,
996,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-498,
-640,
0
],
"maxPos": [
498,
640,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "77ef5666-d950-4704-a463-c4b55a53dc8b@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"fixAlphaTransparencyArtifacts": false,
"redirect": "77ef5666-d950-4704-a463-c4b55a53dc8b@6c48a"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

@@ -0,0 +1,135 @@
import { _decorator, instantiate, Label, Layout, Node, Prefab, ScrollView, Sprite, tween, UIOpacity, UITransform } from 'cc';
import { GButton } from '../../Main/Common/GButton';
import Utils from '../../Main/Common/Utils';
import { InnerMsgCode } from '../../Main/Config/InnerMsgCode';
import li_BaseView from '../../Main/Common/li_BaseView';
import GameManager from '../../Main/Manager/GameManager';
import ResManager from '../../Main/Manager/ResManager';
import { SDKManager } from '../../Main/Channel/SDKManager';
const { ccclass, property } = _decorator;
//聊天记录界面
@ccclass('Record_UI')
export class Record_UI extends li_BaseView {
@property(Prefab)
private talkNpcItem: Prefab = null;
@property(Prefab)
private talkUserItem: Prefab = null;
private _nodeTab: any = {};
private talkSV: ScrollView = null;
private _data;
private itemNodeList: any[] = [];
//----重写父类接口---------------------------------------
onLoadCT() {
this.registerListenner();
Utils.parseNode(this.node, this._nodeTab)
this.talkSV = this._nodeTab.talkSV.getComponent(ScrollView);
}
openUIDataCT(data: any): void {
this._data = data
}
registerListenner() {
// Utils.addInnerEL(InnerMsgCode.GM_UI_Close, this, this.resiveGMClose)
}
start() {
GButton.BandClick(this._nodeTab.btnBack, ()=>{
this.onClose();
}, this);
let lvCfg = GameManager.getLevelCfg(GameManager.CurLevelId)
//npc名字
Utils.setString(this._nodeTab.npcName, lvCfg.name)
let talkLay: Layout = this.talkSV.content.getComponent(Layout)
let talkCellLen = GameManager.TalkRecordList.length
talkLay.enabled = false;
for (let i=0; i<talkCellLen; i++) {
// for (let i=talkCellLen-1; i>=0; i--) {
let info = GameManager.TalkRecordList[i];
let titem = info.isMe ? this.talkUserItem : this.talkNpcItem;
let itemClone:any = instantiate(titem);
this._nodeTab.talkLay.addChild(itemClone);
Utils.parseNode(itemClone);
//头像
let spt = itemClone.headIcon.getComponent(Sprite)
if (info.isMe) {
let avatarUrl = SDKManager.avatarUrl;
if (avatarUrl == "" || avatarUrl == null) {
SDKManager.getUserInfo((data) => {
ResManager.I.changeRemoteSpriteFrame(spt, data.avatarUrl)
})
} else {
ResManager.I.changeRemoteSpriteFrame(spt, avatarUrl)
}
} else {
let headPath = `head/${lvCfg.characterAvatar}`
ResManager.I.changeBundleSpriteFrame(spt.getComponent(Sprite), headPath, "Raw")
}
//对话文本
Utils.setString(itemClone.labTalk, info.talk)
this.itemNodeList.push(itemClone);
//得分
if (info.isMe || info.score < 0) {
itemClone.labScore.active = false;
} else {
itemClone.labScore.active = true;
Utils.setString(itemClone.labScore, `得分:${info.score}`)
}
//动作
let kuangOpa:UIOpacity = itemClone.kuang.getComponent(UIOpacity)
kuangOpa.opacity = 1;
// let didx = talkCellLen-1-i;
let didx = i;
let tdelay = didx * 0.03;
let self = this;
tween(kuangOpa)
.delay(0.2 + tdelay)
.to(0.2, { opacity: 255 })
.call(()=>{
//滚动到当前节点处
self.talkSV.scrollToPercentVertical((talkCellLen-1-i) / talkCellLen, 0.1);
//调整框宽度
let labTf:UITransform = itemClone.labTalk.getComponent(UITransform);
let kuangTf:UITransform = itemClone.kuang.getComponent(UITransform);
kuangTf.width = labTf.width + 30;
})
.start();
}
//延迟一下,设置文本换行模式
this.scheduleOnce(()=>{
for (let i=0; i<this.itemNodeList.length; i++) {
let item = this.itemNodeList[i];
let labTf:UITransform = item.labTalk.getComponent(UITransform);
let lab:Label = item.labTalk.getComponent(Label);
if (labTf.height < 50) { //小于50,说明没换行,改为自动宽度
lab.overflow = Label.Overflow.NONE;
} else {
lab.overflow = Label.Overflow.RESIZE_HEIGHT;
}
}
}, 0.1)
//延迟一下,调整文本框的宽度。高度由layout自动调整
this.scheduleOnce(()=>{
talkLay.enabled = true;
}, 0.15)
}
update(deltaTime: number) {
}
}