This commit is contained in:
Caiyanpeng committed 2021-12-28 11:25:09 +08:00
1 parent a2b44262f7
commit 2b390717c2
130 files changed
+21774 -2581

No files matched your search

+20 -6
View File
@@ -1,4 +1,5 @@
using Assets.Scripts.UI.Control;
using Assets.Scripts;
using Assets.Scripts.UI.Control;
using DG.Tweening;
using System;
using System.Collections;
@@ -16,16 +17,19 @@ public class NewMainNav : MonoBehaviour
float delayTime = 0;
private List<string> typeArray = new List<string>()
{
"Back","Exit","Home","Device","Delay","Setting","Support"
"Back","Exit","Home","Device","Delay","Setting","Support","Avatar"
};
private List<int> indexs = new List<int>();
private int? shrinkIndex = null;
/// <summary>
/// 0,1,2,3,4,5,6
/// "Back","Exit","Home","Device","Delay","Setting","Support"
///
/// </summary>
public void SetButtonActive(List<int> indexs)
/// <param name="indexs">1:"Exit",3:"Device",4:"Delay",5:"Setting",6:"Support",7:"Avatar"</param>
/// <param name="shrinkIndex">0:"Back",2:"Home",null:仅PF</param>
public void SetButtonActive(List<int> indexs,int? shrinkIndex = null)
{
this.indexs = indexs;
this.shrinkIndex = shrinkIndex;
SetExpand(false);
//List<string> types = new List<string>();
//if (indexs != null)
@@ -48,6 +52,11 @@ public class NewMainNav : MonoBehaviour
{
types = typeArray.Where((x, i) => indexs.Contains(i)).ToList();
}
string shrinkName = null;
if (shrinkIndex.HasValue && (shrinkIndex == 0 || shrinkIndex == 2))
{
shrinkName = typeArray[shrinkIndex.Value];
}
foreach (Transform item in transform)
{
if (flag)
@@ -67,13 +76,18 @@ public class NewMainNav : MonoBehaviour
}
else
{
item.gameObject.SetActive(item.name == "PF");
item.gameObject.SetActive(item.name == "PF"|| item.name == shrinkName);
}
}
}
private void Awake()
{
Utils.DisplayHead(transform.Find("Avatar").GetComponent<Image>(), App.CurrentUser.WxHeadImg);
UIManager.AddEvent(transform.Find("Avatar").gameObject, EventTriggerType.PointerClick, b =>
{
UIManager.ShowUserInfoPanel();
});
UIManager.AddEvent(transform.Find("PF").gameObject, EventTriggerType.PointerClick, b =>
{
SetExpand(true);
@@ -19,9 +19,10 @@ public class NewRouteItemController : MonoBehaviour
{
}
public MapRouteAreaItem Area { get; private set; }
public void Initial(MapRouteAreaItem area, Dictionary<string, Texture> caches = null)
{
this.Area = area;
transform.Find("Panel/Text").GetComponent<Text>().text = area.Name;
GetComponent<Button>().onClick.RemoveAllListeners();
GetComponent<Button>().onClick.AddListener(() =>
@@ -38,6 +38,10 @@ public class HomeController : PFUIPanel
#if UNITY_ANDROID || UNITY_IOS
var nav = transform.Find("MainNav-mobile").GetComponent<NewMainNav>();
nav.SetButtonActive(new List<int> { 1, 3, 4, 6 });
UIManager.AddEvent(transform.Find("TodayData/Avatar").gameObject, EventTriggerType.PointerClick, b =>
{
UIManager.ShowUserInfoPanel();
});
#else
mainNav = this.transform.Find("MainNav").GetComponent<MainNav>();
mainNav.ShowExit();
@@ -231,6 +235,15 @@ public class HomeController : PFUIPanel
DateTime.Compare(App.CurrentUser.LastUpdateFtpTime, App.CurrentUser.LastUpdateWeightTime)>0
? App.CurrentUser.LastUpdateFtpTime.ToString("dd.MM.yyyy")
: App.CurrentUser.LastUpdateWeightTime.ToString("dd.MM.yyyy");
//新版设计稿
var todayData = transform.Find("TodayData");
Utils.DisplayHead(todayData.Find("Avatar").GetComponent<RawImage>(), App.CurrentUser.WxHeadImg);
todayData.Find("Datas/Distance/Value").GetComponent<Text>().text = $"{summary.TotalDistance.ToString("#0")}KM";
todayData.Find("Datas/Climb/Value").GetComponent<Text>().text = $"{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/Distance/Rank").GetComponent<Text>().text = summary.CurrentTotalDistance==0? "——" : $"+{summary.CurrentTotalDistance.ToString("#0")}";
todayData.Find("Datas/Climb/Rank").GetComponent<Text>().text = summary.CurrentTotalClimb == 0 ? "——" : $"+{summary.CurrentTotalClimb.ToString("#0")}";
todayData.Find("Datas/Carlories/Rank").GetComponent<Text>().text = summary.CurrentTotalKcal == 0 ? "——" : $"+{summary.CurrentTotalKcal.ToString("#0")}";
}
async void GetSummary()
{
@@ -13,7 +13,11 @@ public class NewRouteDetailController : PFUIPanel
Dictionary<string, Texture> caches;
GameObject map;
ScrollRect scroll;
Dictionary<bool, Sprite> FavDict = new Dictionary<bool, Sprite>()
{
{false,Resources.Load<Sprite>("Images/NewDesign/icon_heji_unlike") },
{true,Resources.Load<Sprite>("Images/NewDesign/icon_heji_like") },
};
protected override void Awake()
{
caches = new Dictionary<string, Texture>();
@@ -47,7 +51,35 @@ public class NewRouteDetailController : PFUIPanel
}
void Start()
{
#if UNITY_ANDROID || UNITY_IOS
var nav = transform.Find("Tmp/MainNav-mobile").GetComponent<NewMainNav>();
nav.SetButtonActive(new List<int> { 0, 3, 4, 6, 7 }, 0);
UIManager.AddEvent(transform.Find("Container/Left/Fav").gameObject, EventTriggerType.PointerClick, async b =>
{
Assets.Scripts.Apis.JsonResult<object> res = null;
var act = ((PointerEventData)b).pointerEnter.GetComponent<Image>().sprite.name == "icon_heji_like";
if (act)
{
res = await ConfigHelper.mapApi.CancelAreaFav(area.Id);
}
else
{
res = await ConfigHelper.mapApi.AddAreaFav(area.Id);
}
if (res.result)
{
b.selectedObject.GetComponent<Image>().sprite = FavDict[!act];
Utils.showToast(null, App.GetLocalString("Success"), type: 1);
}
else
{
Utils.showToast(null, res.errMsg);
}
});
#else
transform.Find("MainNav").GetComponent<MainNav>().ShowBack();
#endif
var rect = transform.GetComponent<RectTransform>();
rect.offsetMax = new Vector2(rect.offsetMax.x, 0);
rect.offsetMin = new Vector2(rect.offsetMin.x, 0);
@@ -96,8 +128,10 @@ public class NewRouteDetailController : PFUIPanel
.text = string.Empty;
if (area.BannerImage != null)
{
Utils.DisplayImageTempDict(left.Find("Icon").GetComponent<RawImage>(), area.BannerImage, caches);
Utils.DisplayImageTempDict(left.Find("Icon").GetComponent<RawImage>(), area.CoverImage, caches);
Utils.DisplayImageTempDict(left.Find("Thumbnail").GetComponent<RawImage>(), area.CoverImage, caches);
}
//transform.Find("Container/Left/Fav").GetComponent<Image>().sprite;
left.Find("Name").GetComponent<Text>().text = area.Name;
GetData();
GetList();
@@ -21,6 +21,20 @@ public class NewRouteOverviewController: PFUIPanel
{
caches = new Dictionary<string, Texture>();
scroll = transform.Find("Container/Right/Scroll View").GetComponent<ScrollRect>();
scroll.onValueChanged.RemoveAllListeners();
scroll.onValueChanged.AddListener(p=>
{
var rect = transform.Find("Container").GetComponent<RectTransform>();
Debug.Log($"{rect.offsetMin} {rect.offsetMax}");
if (p.y < 0.9)
{
DOTween.To(() => rect.offsetMax, x => rect.offsetMax = x, new Vector2(rect.offsetMax.x, -10), 0.5f);
}
else
{
DOTween.To(() => rect.offsetMax, x => rect.offsetMax = x, new Vector2(rect.offsetMax.x, -68), 0.5f);
}
});
UIManager.AddEvent(scroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
}
@@ -50,6 +64,8 @@ public class NewRouteOverviewController: PFUIPanel
tmpGroup = Resources.Load<Transform>("UI/Prefab/NewRoute/RouteGroup");
tmpItem = Resources.Load<Transform>("UI/Prefab/NewRoute/RouteItem");
#else
var nav = transform.Find("Tmp/MainNav-mobile").GetComponent<NewMainNav>();
nav.SetButtonActive(new List<int> { 2, 3, 4, 6, 7 }, 2);
var rect = transform.GetComponent<RectTransform>();
rect.offsetMax = new Vector2(rect.offsetMax.x, 0);
rect.offsetMin = new Vector2(rect.offsetMin.x, 0);
@@ -182,8 +198,6 @@ public class NewRouteOverviewController: PFUIPanel
/// <summary>
/// 绑定头像
/// </summary>
void ToList(string type)
{
App.CurrentRouteType = type;// "";