修复demo/loader演示程序中远程资源丢失的问题

This commit is contained in:
dgflash
2022-10-27 10:19:10 +08:00
parent 5aac1f92f8
commit fba4e1bec9
2 changed files with 12 additions and 7 deletions

View File

@@ -2,10 +2,10 @@
* @Author: dgflash
* @Date: 2022-07-14 10:57:43
* @LastEditors: dgflash
* @LastEditTime: 2022-07-18 13:47:16
* @LastEditTime: 2022-10-27 10:16:45
*/
import { ImageAsset, Node, Sprite, SpriteFrame, Texture2D, _decorator } from 'cc';
import { IRemoteOptions, resLoader } from '../../../extensions/oops-plugin-framework/assets/core/common/loader/ResLoader';
import { oops } from '../../../extensions/oops-plugin-framework/assets/core/Oops';
import { Root } from '../../../extensions/oops-plugin-framework/assets/core/Root';
const { ccclass, property } = _decorator;
@@ -20,11 +20,11 @@ export class Main extends Root {
@property({ type: Node })
sprite: Node = null!;
private url = "https://oops-1255342636.cos-website.ap-shanghai.myqcloud.com/oops-plugin-framework/assets/resources/native/00/0021cb5a-e4f0-4709-b0b6-5e21875720b7.3d6ea.png";
private url = "https://oops-1255342636.cos-website.ap-shanghai.myqcloud.com/img/bg.png";
// private cache: any = {};
btnLoader() {
var opt: IRemoteOptions = { ext: ".png" };
var opt = { ext: ".png" };
var onComplete = (err: Error | null, data: ImageAsset) => {
const spriteFrame = new SpriteFrame();
const texture = new Texture2D();
@@ -35,7 +35,7 @@ export class Main extends Root {
data.addRef();
// this.cache[data.nativeUrl] = spriteFrame;
}
resLoader.loadRemote<ImageAsset>(this.url, opt, onComplete);
oops.res.loadRemote<ImageAsset>(this.url, opt, onComplete);
}
btnUnLoader() {

View File

@@ -236,7 +236,7 @@
"_priority": 1073741824,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 416.61670235546035,
"_orthoHeight": 375,
"_near": 1,
"_far": 2000,
"_color": {
@@ -262,6 +262,8 @@
"_screenScale": 1,
"_visibility": 33554432,
"_targetTexture": null,
"_cameraType": -1,
"_trackingType": 0,
"_id": "58hTt8B3tKnZaTs3OzCwkE"
},
{
@@ -1174,7 +1176,10 @@
"_diffuseMapLDR": null,
"_enabled": true,
"_useHDR": true,
"_editableMaterial": null
"_editableMaterial": null,
"_reflectionHDR": null,
"_reflectionLDR": null,
"_rotationAngle": 0
},
{
"__type__": "cc.FogInfo",