ant+和http组件bug修复

This commit is contained in:
lishuo committed 2021-04-30 17:25:28 +08:00
1 parent f7b33bf491
commit 48c5b161b1
29 files changed
+3526 -2755

No files matched your search

+22 -9
View File
@@ -1,4 +1,5 @@
using System;
using Assets.Scripts;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -51,7 +52,15 @@ namespace Assets.Scenes.Ride.Scripts
{
if (!_headUrl.Equals(url))
{
Head.texture = App.CurrentUserHeadTexture;
if (App.TextureCache.ContainsKey(url))
{
Head.texture = App.TextureCache[url];
}
else
{
Utils.DisplayImageAysnc(StartCoroutine, Head, url, ImageCallBack);
}
//Utils.DisplayImage(StartCoroutine, Head, url);
//StartCoroutine(DownloadImage(Head, url));
var rect = ((RectTransform)Head.transform).rect;
@@ -60,6 +69,11 @@ namespace Assets.Scenes.Ride.Scripts
Head.material = material;
}
}
private void ImageCallBack(string url)
{
if (!App.TextureCache.ContainsKey(url))
App.TextureCache.Add(url, Head.texture);
}
IEnumerator DownloadImage(RawImage img, string MediaUrl)
{
@@ -80,17 +94,16 @@ namespace Assets.Scenes.Ride.Scripts
}
}
public void setCountry(string url)
public void setCountry(Texture texture)
{
if (!_countryUrl.Equals(url))
{
Country.texture = countryTexture;
Country.texture = texture;
//Utils.DisplayImage(StartCoroutine, Country, url);
//StartCoroutine(DownloadImage(Country, url));
var rect = ((RectTransform)Country.transform).rect;
Material material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
Country.material = material;
//var rect = ((RectTransform)Country.transform).rect;
//Material material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
//material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height, 0));
//Country.material = material;
}
}
public void setName(string name)