修改细节

This commit is contained in:
CaiYanPeng 2021-12-29 17:05:58 +08:00
parent be731c471b
commit 8dde7520ad
10 changed files with 193 additions and 13 deletions

View File

@ -27,6 +27,7 @@ GameObject:
- component: {fileID: 7793409217181307314}
- component: {fileID: 2752079573212952071}
- component: {fileID: 8699752019427605733}
- component: {fileID: 2781699126086311677}
m_Layer: 5
m_Name: MainNav-mobile
m_TagString: Untagged
@ -153,6 +154,18 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fca4162bdac783449b37ea751c075353, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!225 &2781699126086311677
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2638424933752433026}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!114 &7073224465767460078
MonoBehaviour:
m_ObjectHideFlags: 0

View File

@ -2569,6 +2569,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7f7db27f83919ce49a865d9187ff71aa, type: 3}
m_Name:
m_EditorClassIdentifier:
newNav: {fileID: 0}
--- !u!1001 &5638733952332257752
PrefabInstance:
m_ObjectHideFlags: 0
@ -2626,6 +2627,21 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1592441871873768741, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1592441871873768741, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1592441871873768741, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 20
objectReference: {fileID: 0}
- target: {fileID: 1617869899094122649, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_SizeDelta.x
@ -3011,6 +3027,11 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.x
value: 20
objectReference: {fileID: 0}
- target: {fileID: 6376947731341292573, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8197454007437855745, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchorMax.y
@ -3026,6 +3047,26 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.x
value: 20
objectReference: {fileID: 0}
- target: {fileID: 8382612560249065530, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8382612560249065530, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8382612560249065530, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8382612560249065530, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8526344065104504758, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchorMax.y

View File

@ -64,7 +64,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 2a5c5c544b798fb429007a737f082aa6, type: 3}
m_Sprite: {fileID: 21300000, guid: b665fce0f8cd8cd44a5762350c902f5a, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@ -520,7 +520,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 2a5c5c544b798fb429007a737f082aa6, type: 3}
m_Sprite: {fileID: 21300000, guid: f2c28367c40d22848bc4051e5195ce7f, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@ -1681,6 +1681,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 198d3ec3822927f44af9fb241ac00195, type: 3}
m_Name:
m_EditorClassIdentifier:
newNav: {fileID: 0}
--- !u!225 &1735218495705024833
CanvasGroup:
m_ObjectHideFlags: 0
@ -2217,7 +2218,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 2a5c5c544b798fb429007a737f082aa6, type: 3}
m_Sprite: {fileID: 21300000, guid: 1bd86fd45230aa24c98846ea6354c3a4, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
@ -2284,6 +2285,21 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1592441871873768741, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1592441871873768741, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1592441871873768741, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 20
objectReference: {fileID: 0}
- target: {fileID: 1617869899094122649, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_SizeDelta.x
@ -2669,6 +2685,11 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.x
value: 20
objectReference: {fileID: 0}
- target: {fileID: 6376947731341292573, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8197454007437855745, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchorMax.y
@ -2684,6 +2705,26 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.x
value: 20
objectReference: {fileID: 0}
- target: {fileID: 8382612560249065530, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8382612560249065530, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8382612560249065530, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8382612560249065530, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8526344065104504758, guid: 240a4465e4dc90848a0efc1a9520c658,
type: 3}
propertyPath: m_AnchorMax.y

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("小时");

View File

@ -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")}";

View File

@ -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;
}
}
}

View File

@ -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);

View File

@ -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
{

View File

@ -10,6 +10,7 @@ using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.UI;
@ -386,7 +387,7 @@ namespace Assets.Scripts
/// <param name="img"></param>
/// <param name="url"></param>
/// <param name="caches"></param>
public static void DisplayImageTempDict(MaskableGraphic img, string url, Dictionary<string, Texture> caches = null)
public static void DisplayImageTempDict(MaskableGraphic img, string url, Dictionary<string, Texture> caches = null,UnityAction<byte[]> callback = null)
{
if (string.IsNullOrEmpty(url))
return;
@ -411,7 +412,7 @@ namespace Assets.Scripts
{
caches.Add(url, texture);
}
}));
},callback));
}
@ -438,7 +439,7 @@ namespace Assets.Scripts
}
}
}
static IEnumerator DownloadImage(MaskableGraphic img,string MediaUrl, Action<Texture> action = null)
static IEnumerator DownloadImage(MaskableGraphic img,string MediaUrl, Action<Texture> action = null,UnityAction<byte[]> callback = null)
{
UnityWebRequest request = UnityWebRequest.Get(MediaUrl);
yield return request.SendWebRequest();
@ -461,6 +462,10 @@ namespace Assets.Scripts
{
action.Invoke(texture);
}
if (callback != null)
{
callback.Invoke(data);
}
}
}
public static Texture GetDownloadTexture(string MediaUrl, byte[] data)

View File

@ -38,6 +38,7 @@ GraphicsSettings:
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}