修改细节

This commit is contained in:
Caiyanpeng committed 2021-12-29 17:05:58 +08:00
1 parent be731c471b
commit 8dde7520ad
10 files changed
+193 -13

No files matched your search

+19 -1
View File
@@ -225,10 +225,28 @@ public class NewMainNav : MonoBehaviour
{
}
bool isTouch = false;
float hideTime = 5;
// Update is called once per frame
void Update()
{
if (Input.touchCount > 0)
{
Debug.Log(235);
isTouch = true;
GetComponent<CanvasGroup>().DOFade(1, 0.5f);
}
hideTime -= Time.deltaTime;
if (hideTime < 0)
{
if (!isTouch)
{
GetComponent<CanvasGroup>().DOFade(0.4f, 0.5f);
}
isTouch = false;
hideTime += 5;
}
Debug.Log(Input.touchCount);
if (delayTime < 0)
{
Debug.Log("小时");
@@ -246,8 +246,8 @@ public class HomeController : PFUIPanel
{
Utils.DisplayHead(todayData.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
todayData.Find("Datas/Distance/Value").GetComponent<Text>().text = $"{summary.ContinuesDay}"+ (summary.ContinuesDay > 1 ? App.GetLocalString("DAYS") : App.GetLocalString("DAY"));
todayData.Find("Datas/Climb/Value").GetComponent<Text>().text = $"{summary.TotalDistance.ToString("#0")}KM";//$"{double.Parse(summary.TotalClimb, CultureInfo.InvariantCulture).ToString("0")}M";
todayData.Find("Datas/Carlories/Value").GetComponent<Text>().text = $"{summary.TotalKj.ToString("#0")}KCAL";
todayData.Find("Datas/Climb/Value").GetComponent<Text>().text = $"{summary.ContinuesKm.ToString("#0")}KM";//$"{double.Parse(summary.TotalClimb, CultureInfo.InvariantCulture).ToString("0")}M";
todayData.Find("Datas/Carlories/Value").GetComponent<Text>().text = $"{summary.ContinuesKcal.ToString("#0")}KCAL";
//todayData.Find("Datas/Distance/Rank").GetComponent<Text>().text = summary.CurrentTotalDistance == 0 ? "——" : $"+{summary.CurrentTotalDistance.ToString("#0")}";
todayData.Find("Datas/Climb/Rank").GetComponent<Text>().text = summary.CurrentTotalDistance == 0 ? "——" : $"+{summary.CurrentTotalDistance.ToString("#0")}";
todayData.Find("Datas/Carlories/Rank").GetComponent<Text>().text = summary.CurrentTotalKcal == 0 ? "——" : $"+{summary.CurrentTotalKcal.ToString("#0")}";
@@ -96,6 +96,7 @@ public class MapListExtraController : PFUIPanel
var item = Instantiate<Transform>(tmpCollectItem);
item.GetComponent<NewRouteItemController>().Initial(area, GetComponent<MapListController>().caches);
item.SetParent(p2.Find("Scroll View/Viewport/Content"));
item.localScale = Vector3.one;
}
}
}
@@ -145,10 +145,31 @@ public class NewRouteDetailController : PFUIPanel
.text = string.Empty;
transform.Find("Container/Left/Desc").GetComponent<Text>()
.text = string.Empty;
if (area.BannerImage != null)
if (area.CoverImage != null)
{
Utils.DisplayImageTempDict(left.Find("Icon").GetComponent<RawImage>(), area.CoverImage, caches);
Utils.DisplayImageTempDict(left.Find("Thumbnail").GetComponent<RawImage>(), area.CoverImage, caches);
Utils.DisplayImageTempDict(left.Find("Icon").GetComponent<RawImage>(), area.CoverImage, caches
, b =>
{
#if UNITY_EDITOR
var _t = new Texture2D(4, 4, TextureFormat.DXT5, false);
#else
#if UNITY_IOS
var _t = new Texture2D(4, 4, TextureFormat.ASTC_RGB_4x4,false);
Debug.Log("使用了壓縮");
#elif UNITY_ANDROID
var _t = new Texture2D(4, 4, TextureFormat.ASTC_RGB_4x4,false);
Debug.Log("使用了壓縮");
#else //pc
var _t = new Texture2D(4, 4, TextureFormat.DXT5,false);
#endif
#endif
_t.LoadImage(b);
//Graphics.CopyTexture(t, _t);
//Debug.Log($"{t.width},{t.height}");
left.Find("Thumbnail").GetComponent<RawImage>().texture =
ScaleTextureCutOut(_t, 0, _t.height / 2, _t.width / 3, _t.height / 3);
});
//Utils.DisplayImageTempDict(left.Find("Thumbnail").GetComponent<RawImage>(), area.CoverImage, caches);
}
Debug.Log(153 + area.IsFav.ToString());
@@ -157,7 +178,46 @@ public class NewRouteDetailController : PFUIPanel
GetList();
}
Texture2D ScaleTextureCutOut(Texture2D originalTexture, float startX, float startY, float originalWidth, float originalHeight)
{
originalWidth = Mathf.Clamp(originalWidth, 0, Mathf.Max(originalTexture.width - startX, 0));
originalHeight = Mathf.Clamp(originalHeight, 0, Mathf.Max(originalTexture.height - startY, 0));
Texture2D newTexture = new Texture2D(Mathf.CeilToInt(originalWidth), Mathf.CeilToInt(originalHeight));
int maxX = originalTexture.width - 1;
int maxY = originalTexture.height - 1;
for (int y = 0; y < newTexture.height; y++)
{
for (int x = 0; x < newTexture.width; x++)
{
float targetX = x + startX;
float targetY = y + startY;
int x1 = Mathf.Min(maxX, Mathf.FloorToInt(targetX));
int y1 = Mathf.Min(maxY, Mathf.FloorToInt(targetY));
int x2 = Mathf.Min(maxX, x1 + 1);
int y2 = Mathf.Min(maxY, y1 + 1);
float u = targetX - x1;
float v = targetY - y1;
float w1 = (1 - u) * (1 - v);
float w2 = u * (1 - v);
float w3 = (1 - u) * v;
float w4 = u * v;
Color color1 = originalTexture.GetPixel(x1, y1);
Color color2 = originalTexture.GetPixel(x2, y1);
Color color3 = originalTexture.GetPixel(x1, y2);
Color color4 = originalTexture.GetPixel(x2, y2);
Color color = new Color(Mathf.Clamp01(color1.r * w1 + color2.r * w2 + color3.r * w3 + color4.r * w4),
Mathf.Clamp01(color1.g * w1 + color2.g * w2 + color3.g * w3 + color4.g * w4),
Mathf.Clamp01(color1.b * w1 + color2.b * w2 + color3.b * w3 + color4.b * w4),
Mathf.Clamp01(color1.a * w1 + color2.a * w2 + color3.a * w3 + color4.a * w4)
);
newTexture.SetPixel(x, y, color);
}
}
newTexture.anisoLevel = 2;
newTexture.Apply();
return newTexture;
}
private void OnEndDrag(BaseEventData arg0)
{
Debug.Log(scroll.verticalNormalizedPosition);
@@ -183,7 +183,7 @@ public class RouteItem : MonoBehaviour
Debug.Log(App.CurrentUser.WebHost);
if (App.weChatController.IsWeChatAppInstalled())
{
App.weChatController.ShareWebpageToWX(0, "http://192.168.0.101:3081/RoutesRecords/" + result.RankingId, result.RouteName, "By " + App.CurrentUser.Nickname, null);
App.weChatController.ShareWebpageToWX(0, $"http://{App.CurrentUser.WebHost}/RoutesRecords/" + result.RankingId, result.RouteName, "By " + App.CurrentUser.Nickname, null);
}
else
{