http 下载错误时,打印错误日志

CacheManager从http下载的数据获取图片时,如果下载错误,会使用默认的错误图片资源
This commit is contained in:
ALIENJACK\alien 2025-01-24 11:56:09 +08:00
parent dcdfdd343f
commit f670a0778c
5 changed files with 141 additions and 8 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: f7cefc6af245195478163bba38423795
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -71,6 +71,10 @@ public static class AxiHttpProxy
Debug.Log($"respInfo.fileName =>{resp.fileName}");
Debug.Log($"respInfo.NeedloadedLenght =>{resp.NeedloadedLenght}");
Debug.Log($"respInfo.loadedLenght =>{resp.loadedLenght}");
if (resp.bHadErr)
{
Debug.LogError($"code->{resp.code} err->{resp.ErrInfo} url->{resp.url}");
}
#else
Debug.Log($"==== request url => { resp.url}");
Debug.Log($"code =>{resp.code}");

View File

@ -33,16 +33,19 @@ namespace AxibugEmuOnline.Client
yield return null;
//Debug.Log($"下载进度:{respInfo.DownLoadPr} ->{respInfo.loadedLenght}/{respInfo.NeedloadedLenght}");
}
AxiHttpProxy.ShowAxiHttpDebugInfo(request.downloadHandler);
AxiHttpProxy.ShowAxiHttpDebugInfo(request.downloadHandler);
if (!request.downloadHandler.bHadErr)
{
Directory.CreateDirectory(path);
File.WriteAllBytes($"{path}/{url.GetHashCode()}", request.downloadHandler.data);
callback.Invoke(request.downloadHandler.data);
}
else
else
{
callback.Invoke(null);
}
/*
var request = UnityWebRequest.Get($"{App.httpAPI.WebHost}/{url}");
@ -105,10 +108,19 @@ namespace AxibugEmuOnline.Client
if (vt == t_texture2d || vt == t_sprite)
{
Texture2D texture = new Texture2D(2, 2);
texture.LoadImage(data);
if (vt == t_texture2d) return texture as T;
else return Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)) as T;
if (data == null)
{
var errorSpr = Resources.Load<Sprite>("UIImage/error");
if (vt == t_texture2d) return errorSpr.texture as T;
else return errorSpr as T;
}
else
{
texture.LoadImage(data);
if (vt == t_texture2d) return texture as T;
else return Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)) as T;
}
}
else if (vt == t_byteArray)
{

View File

@ -294,7 +294,7 @@ namespace AxibugEmuOnline.Client
}
throw new Exception("Not Valid Rom Data");
}
}
public void SetWebData(HttpAPI.Resp_RomInfo resp_RomInfo)
{