按设计稿修改登录页登录样式;修改主页动画顺序;增加我的收藏列表可切换
This commit is contained in:
1 parent
f23fc4b4c0
commit
3ca297ee96
40 files changed
+5474
-1548
No files matched your search
@@ -6,40 +6,51 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class NewMainNav : MonoBehaviour
|
||||
{
|
||||
public class CustomButton
|
||||
{
|
||||
public Sprite image;
|
||||
public UnityAction action;
|
||||
public CustomButton(Sprite image, UnityAction action)
|
||||
{
|
||||
this.image = image;
|
||||
this.action = action;
|
||||
}
|
||||
}
|
||||
private GameObject exit;
|
||||
private GameObject home;
|
||||
private GameObject back;
|
||||
float delayTime = 0;
|
||||
private List<string> typeArray = new List<string>()
|
||||
{
|
||||
"Back","Exit","Home","Device","Delay","Setting","Support","Avatar"
|
||||
"Back","Exit","Home","Device","Delay","Setting","Support","Avatar","Custom"
|
||||
};
|
||||
private List<int> indexs = new List<int>();
|
||||
private int? shrinkIndex = null;
|
||||
private CustomButton custom = null;
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <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)
|
||||
/// <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>
|
||||
/// <param name="custom">自定义按钮</param>
|
||||
public void SetButtonActive(List<int> indexs,int? shrinkIndex = null, CustomButton custom = null)
|
||||
{
|
||||
this.indexs = indexs;
|
||||
this.shrinkIndex = shrinkIndex;
|
||||
this.custom = custom;
|
||||
if (custom != null)
|
||||
{
|
||||
transform.Find("Custom").GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
transform.Find("Custom").GetComponent<Button>().onClick.AddListener(custom.action);
|
||||
transform.Find("Custom").GetComponent<Image>().sprite = custom.image;
|
||||
}
|
||||
SetExpand(false);
|
||||
//List<string> types = new List<string>();
|
||||
//if (indexs != null)
|
||||
//{
|
||||
// types = typeArray.Where((x, i) => indexs.Contains(i)).ToList();
|
||||
//}
|
||||
//foreach (Transform item in transform)
|
||||
//{
|
||||
// item.gameObject.SetActive(types.Contains(item.name));
|
||||
//}
|
||||
}
|
||||
/// <summary>
|
||||
/// true:展开 false:关闭
|
||||
@@ -69,6 +80,10 @@ public class NewMainNav : MonoBehaviour
|
||||
{
|
||||
item.gameObject.SetActive(false);
|
||||
}
|
||||
else if (item.name == "Custom")
|
||||
{
|
||||
item.gameObject.SetActive(custom != null);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.gameObject.SetActive(types.Contains(item.name));
|
||||
|
||||
@@ -369,7 +369,7 @@ public class MapListController : PFUIPanel
|
||||
}
|
||||
|
||||
}
|
||||
Dictionary<string, Texture> caches = null;
|
||||
public Dictionary<string, Texture> caches = null;
|
||||
void DisplayMaps(List<MapRoute> list)
|
||||
{
|
||||
if (map != null)
|
||||
@@ -398,7 +398,7 @@ public class MapListController : PFUIPanel
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
var routeTypeName = transform.Find("Panel/Top/RouteTypeName");
|
||||
#else
|
||||
var routeTypeName = transform.Find("Panel/RouteTypeName");
|
||||
var routeTypeName = transform.Find("RouteTypeName");
|
||||
#endif
|
||||
routeTypeName.GetComponent<Text>().text = App.GetLocalString(App.CurrentRouteType);
|
||||
if (searchInput != null)
|
||||
@@ -510,6 +510,7 @@ public class MapListController : PFUIPanel
|
||||
{
|
||||
transform.Find("RawImage").GetComponent<RawImage>().texture = App.DefaultRotateTexture;
|
||||
}
|
||||
GetComponent<MapListExtraController>().HandleCollection();
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
ResetPage();
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using Assets.Scripts.UI.Prefab.MapList;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
/// 处理一些额外需求
|
||||
/// </summary>
|
||||
public class MapListExtraController : PFUIPanel
|
||||
{
|
||||
private Transform typeSelector, p1, p2;
|
||||
private float p1originx = 0, p2originx = 0;
|
||||
private Transform tmpCollectItem;
|
||||
protected override void Awake()
|
||||
{
|
||||
typeSelector = transform.Find("TypeSelector");
|
||||
p1 = transform.Find("Panel/Panel");
|
||||
p2 = transform.Find("Panel/Panel备用");
|
||||
p1originx = p1.GetComponent<RectTransform>().localPosition.x;
|
||||
p2originx = p2.GetComponent<RectTransform>().localPosition.x;
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
tmpCollectItem = Resources.Load<Transform>("UI/Prefab/NewRoute/Mobile/RouteItem");
|
||||
#else
|
||||
tmpCollectItem = Resources.Load<Transform>("UI/Prefab/NewRoute/RouteItem");
|
||||
#endif
|
||||
UIManager.AddEvent(typeSelector.Find("Route").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
typeSelector.Find("Route").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
typeSelector.Find("Collection").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
|
||||
p1.DOLocalMoveX(p1originx, 0.5f);
|
||||
p2.DOLocalMoveX(p2originx, 0.5f);
|
||||
});
|
||||
UIManager.AddEvent(typeSelector.Find("Collection").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
typeSelector.Find("Route").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
|
||||
typeSelector.Find("Collection").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
p1.DOLocalMoveX(p1originx - 764f, 0.5f);
|
||||
p2.DOLocalMoveX(p2originx - 764f, 0.5f);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
|
||||
}
|
||||
private int pageIndex = 0;
|
||||
public void HandleCollection()
|
||||
{
|
||||
if (App.CurrentRouteType == "My Collection")
|
||||
{
|
||||
typeSelector.gameObject.SetActive(true);
|
||||
RefreshCollectList();
|
||||
}
|
||||
else
|
||||
{
|
||||
typeSelector.gameObject.SetActive(false);
|
||||
}
|
||||
p1.localPosition = new Vector3(p1originx, p1.localPosition.y, p1.localPosition.z);
|
||||
p2.localPosition = new Vector3(p2originx, p2.localPosition.y, p2.localPosition.z);
|
||||
typeSelector.Find("Route").GetComponent<Text>().color = Utils.HexToColorHtml("#ffffff");
|
||||
typeSelector.Find("Collection").GetComponent<Text>().color = Utils.HexToColorHtml("#5c5c6e");
|
||||
}
|
||||
private async void GetList()
|
||||
{
|
||||
var res = await ConfigHelper.mapApi.GetMemberMapRouteAreaList(pageIndex, 10);
|
||||
if (res.result)
|
||||
{
|
||||
foreach (var area in res.data)
|
||||
{
|
||||
var item = Instantiate<Transform>(tmpCollectItem);
|
||||
item.GetComponent<NewRouteItemController>().Initial(area, GetComponent<MapListController>().caches);
|
||||
item.SetParent(p2.Find("Scroll View/Viewport/Content"));
|
||||
}
|
||||
}
|
||||
}
|
||||
private void RefreshCollectList()
|
||||
{
|
||||
p2.Find("Scroll View/Viewport/Content").DestroyChildren();
|
||||
pageIndex = 0;
|
||||
GetList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a011dd1cd8044a418d1b92b2474ee7c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -15,15 +15,16 @@ 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") },
|
||||
};
|
||||
Dictionary<bool, Sprite> FavDict;
|
||||
List<int> routeIds { get; set; }
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
FavDict = new Dictionary<bool, Sprite>()
|
||||
{
|
||||
{false,Resources.Load<Sprite>("Images/NewDesign/icon_heji_unlike") },
|
||||
{true,Resources.Load<Sprite>("Images/NewDesign/icon_heji_like") },
|
||||
};
|
||||
caches = new Dictionary<string, Texture>();
|
||||
scroll = transform.Find("Container/Right/Scroll View").GetComponent<ScrollRect>();
|
||||
UIManager.AddEvent(scroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
|
||||
@@ -58,9 +59,11 @@ public class NewRouteDetailController : PFUIPanel
|
||||
#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 p = ((PointerEventData)b).pointerEnter;
|
||||
var act = ((PointerEventData)b).pointerEnter.GetComponent<Image>().sprite.name == "icon_heji_like";
|
||||
if (act)
|
||||
{
|
||||
@@ -73,7 +76,7 @@ public class NewRouteDetailController : PFUIPanel
|
||||
|
||||
if (res.result)
|
||||
{
|
||||
b.selectedObject.GetComponent<Image>().sprite = FavDict[!act];
|
||||
p.GetComponent<Image>().sprite = FavDict[!act];
|
||||
Utils.showToast(null, App.GetLocalString("Success"), type: 1);
|
||||
}
|
||||
else
|
||||
@@ -147,7 +150,8 @@ public class NewRouteDetailController : PFUIPanel
|
||||
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;
|
||||
Debug.Log(153 + area.IsFav.ToString());
|
||||
|
||||
left.Find("Name").GetComponent<Text>().text = area.Name;
|
||||
GetData();
|
||||
GetList();
|
||||
@@ -178,6 +182,7 @@ public class NewRouteDetailController : PFUIPanel
|
||||
.text = $"{res.data.AverageGrade.ToString("#0.00")}%";
|
||||
transform.Find("Container/Left/Desc").GetComponent<Text>()
|
||||
.text = res.data.Description;
|
||||
transform.Find("Container/Left/Fav").GetComponent<Image>().sprite = FavDict[res.data.IsFav];
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(transform.Find("Container/Left/RideContainer").GetComponent<RectTransform>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ public class NewRouteOverviewController: PFUIPanel
|
||||
scroll.onValueChanged.AddListener(p=>
|
||||
{
|
||||
var rect = transform.Find("Container").GetComponent<RectTransform>();
|
||||
Debug.Log($"{rect.offsetMin} {rect.offsetMax}");
|
||||
//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);
|
||||
@@ -65,7 +65,13 @@ public class NewRouteOverviewController: PFUIPanel
|
||||
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);
|
||||
nav.SetButtonActive(new List<int> { 2, 3, 4, 6, 7 }, 2,
|
||||
new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/map_mode"),()=>
|
||||
{
|
||||
UIManager.PopStack();
|
||||
//UIManager.ShowBigMapPanel();
|
||||
UIManager.ShowEarthPanel(App.latitude, App.longitude);
|
||||
}));
|
||||
var rect = transform.GetComponent<RectTransform>();
|
||||
rect.offsetMax = new Vector2(rect.offsetMax.x, 0);
|
||||
rect.offsetMin = new Vector2(rect.offsetMin.x, 0);
|
||||
|
||||
Reference in new issue
Block a user