加入合集后的跳转问题
This commit is contained in:
1 parent
ec4a28cd2a
commit
6ed3895fcd
13 files changed
+292
-534
No files matched your search
@@ -167,10 +167,16 @@ namespace Assets.Scripts.Apis
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<JsonResult<List<MapRoute>>> GetMapRouteAreaDetail(int id, int pageIndex, int pageSize)
|
||||
public async Task<JsonResult<List<MapRoute>>> GetMapRouteAreaDetailList(int id, int pageIndex, int pageSize)
|
||||
{
|
||||
var result = await GetAsync<JsonResult<List<MapRoute>>>($"MapRouteArea/GetRouteList?areaId={id}&pageSize={pageSize}&pageIndex={pageIndex}");
|
||||
return result;
|
||||
}
|
||||
|
||||
public async Task<JsonResult<MapRouteAreaDetail>> GetMapRouteAreaDetail(int id)
|
||||
{
|
||||
var result = await GetAsync<JsonResult<MapRouteAreaDetail>>($"MapRouteArea/GetDetail?areaId={id}");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,4 +93,48 @@ namespace Assets.Scripts.Apis.Models
|
||||
/// </summary>
|
||||
public int? ParentId { get; set; }
|
||||
}
|
||||
|
||||
public class MapRouteAreaDetail
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double TotalClimb { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double TotalDistance { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public double AverageGrade { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public int RideCount { get; set; }
|
||||
/// <summary>
|
||||
/// 环徐州
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string Description { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string BannerImage { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public string CoverImage { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public DateTime CreateTime { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public DateTime UpdateTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public static class App
|
||||
public static int CompetionId { get; set; }//比赛id
|
||||
//public static string AppDownloadUrl { get; internal set; }
|
||||
//public static string AppVersionCode { get; internal set; }
|
||||
|
||||
|
||||
public static List<JoinedCompetitionModel> JoinedCompetitionList { get; set; }//我参加的比赛
|
||||
public static List<int> CompetitionIdList = new List<int>();
|
||||
|
||||
@@ -157,6 +157,8 @@ public static class App
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
//记录当前集合
|
||||
public static MapRouteAreaItem currentArea = null;
|
||||
static App()
|
||||
{
|
||||
|
||||
|
||||
@@ -85,11 +85,15 @@ public class MainController : BaseScene
|
||||
if (App.MainSceneParam.ContainsKey("Name") && !string.IsNullOrEmpty(App.MainSceneParam["Name"]))
|
||||
{
|
||||
UIManager.ShowHomePanel();
|
||||
UIManager.ShowNewRouteOverviewPanel();
|
||||
if (App.MainSceneParam["Name"] == "MapListPanel")
|
||||
{
|
||||
UIManager.ShowMapListPanel();
|
||||
}
|
||||
|
||||
if (App.MainSceneParam["Name"] == "NewRouteDetail" && App.currentArea != null)
|
||||
{
|
||||
UIManager.ShowNewRouteDetailPanel(App.currentArea);
|
||||
}
|
||||
if (App.MainSceneParam["Name"] == "UserInfoPanel")
|
||||
{
|
||||
UIManager.ShowUserInfoPanel();
|
||||
|
||||
@@ -44,12 +44,14 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
|
||||
float? localY = null;
|
||||
MapRoute map;
|
||||
Dictionary<string, Texture> caches;
|
||||
public void Initial(MapRoute myMap, Dictionary<string, Texture> caches)
|
||||
private MapRouteAreaItem area = null;
|
||||
public void Initial(MapRoute myMap, Dictionary<string, Texture> caches, MapRouteAreaItem area = null)
|
||||
{
|
||||
if (caches != null)
|
||||
{
|
||||
this.caches = caches;
|
||||
}
|
||||
this.area = area;
|
||||
map = myMap;
|
||||
//localY = transform.GetComponent<RectTransform>().rect.height;
|
||||
//Debug.Log(localY);
|
||||
@@ -87,20 +89,7 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
|
||||
// SceneManager.LoadScene("Ride");
|
||||
//});
|
||||
transform.GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
transform.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
//UIManager.ShowMapDetailPanel(myMap.Id);
|
||||
App.RouteIdParam = myMap.Id;
|
||||
if (!App.MainSceneParam.ContainsKey("Name"))
|
||||
{
|
||||
App.MainSceneParam.Add("Name", "MapListPanel");
|
||||
}
|
||||
else
|
||||
{
|
||||
App.MainSceneParam["Name"] = "MapListPanel";
|
||||
}
|
||||
SceneManager.LoadScene("Ride");
|
||||
});
|
||||
transform.GetComponent<Button>().onClick.AddListener(Ride);
|
||||
transform.Find("Name").GetComponent<Text>().text = myMap.Name;
|
||||
|
||||
transform.Find("IdContainer/Text").GetComponent<Text>().text = $"#{myMap.Id}";
|
||||
@@ -136,13 +125,21 @@ public class MapItem : MonoBehaviour, IPointerExitHandler, IPointerEnterHandler,
|
||||
private void Ride()
|
||||
{
|
||||
App.RouteIdParam = map.Id;
|
||||
if (!App.MainSceneParam.ContainsKey("Name"))
|
||||
App.currentArea = area;
|
||||
if (area != null)
|
||||
{
|
||||
App.MainSceneParam.Add("Name", "MapListPanel");
|
||||
App.MainSceneParam["Name"] = "NewRouteDetail";
|
||||
}
|
||||
else
|
||||
{
|
||||
App.MainSceneParam["Name"] = "MapListPanel";
|
||||
if (!App.MainSceneParam.ContainsKey("Name"))
|
||||
{
|
||||
App.MainSceneParam.Add("Name", "MapListPanel");
|
||||
}
|
||||
else
|
||||
{
|
||||
App.MainSceneParam["Name"] = "MapListPanel";
|
||||
}
|
||||
}
|
||||
SceneManager.LoadScene("Ride");
|
||||
//foreach (var item in Utils.propTextureCache)
|
||||
|
||||
@@ -27,10 +27,10 @@ public class NewRouteItemController : MonoBehaviour
|
||||
Utils.DisplayImageTempDict(GetComponent<RawImage>(), area.CoverImage, caches);
|
||||
}
|
||||
transform.Find("Panel/Text").GetComponent<Text>().text = area.Name;
|
||||
UIManager.AddEvent(gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
GetComponent<Button>().onClick.RemoveAllListeners();
|
||||
GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
UIManager.ShowNewRouteDetailPanel(area);
|
||||
//ConfigHelper.mapApi.GetMapRouteAreaDetail(area.Id, 0, 10);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -46,14 +46,20 @@ public class MapListController : PFUIPanel
|
||||
}
|
||||
private bool isEnd = false;
|
||||
private Transform topContainer;
|
||||
void ResetPage()
|
||||
{
|
||||
var rect = transform.GetComponent<RectTransform>();
|
||||
rect.offsetMax = new Vector2(rect.offsetMax.x, 0);
|
||||
rect.offsetMin = new Vector2(rect.offsetMin.x, 0);
|
||||
rect.localScale = Vector3.one;
|
||||
rect.localPosition = Vector3.zero;
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
#if (UNITY_ANDROID || UNITY_IOS)
|
||||
topContainer = transform.Find("Top");
|
||||
var rect = transform.GetComponent<RectTransform>();
|
||||
rect.offsetMax = new Vector2(rect.offsetMax.x, 0);
|
||||
rect.offsetMin = new Vector2(rect.offsetMin.x, 0);
|
||||
ResetPage();
|
||||
//var rectTransform = transform.GetComponent<RectTransform>();
|
||||
//var offsetMax = rectTransform.offsetMax;
|
||||
//rectTransform.offsetMax = new Vector2(0, offsetMax.y);
|
||||
@@ -499,6 +505,9 @@ public class MapListController : PFUIPanel
|
||||
{
|
||||
transform.Find("RawImage").GetComponent<RawImage>().texture = App.DefaultRotateTexture;
|
||||
}
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
ResetPage();
|
||||
#endif
|
||||
ResetPanel();
|
||||
transform.MyDOFade();
|
||||
}
|
||||
|
||||
@@ -71,11 +71,20 @@ public class NewRouteDetailController : PFUIPanel
|
||||
var left = transform.Find("Container/Left");
|
||||
left.Find("Icon").GetComponent<RawImage>().texture = null;
|
||||
scroll.content.DestroyChildren();
|
||||
transform.Find("Container/Left/RideContainer/Text").GetComponent<Text>()
|
||||
.text = string.Empty;
|
||||
transform.Find("Container/Left/Infos/DistanceContainer/Text").GetComponent<Text>()
|
||||
.text = string.Empty;
|
||||
transform.Find("Container/Left/Infos/EleContainer/Text").GetComponent<Text>()
|
||||
.text = string.Empty;
|
||||
transform.Find("Container/Left/Infos/SlopeContainer/Text").GetComponent<Text>()
|
||||
.text = string.Empty;
|
||||
if (area.BannerImage != null)
|
||||
{
|
||||
Utils.DisplayImageTempDict(left.Find("Icon").GetComponent<RawImage>(), area.BannerImage, caches);
|
||||
}
|
||||
left.Find("Name").GetComponent<Text>().text = area.Name;
|
||||
GetData();
|
||||
GetList();
|
||||
|
||||
}
|
||||
@@ -89,10 +98,26 @@ public class NewRouteDetailController : PFUIPanel
|
||||
GetList();
|
||||
}
|
||||
}
|
||||
private async void GetData()
|
||||
{
|
||||
var res = await ConfigHelper.mapApi.GetMapRouteAreaDetail(area.Id);
|
||||
if (res.result)
|
||||
{
|
||||
transform.Find("Container/Left/RideContainer/Text").GetComponent<Text>()
|
||||
.text = res.data.RideCount.ToString();
|
||||
transform.Find("Container/Left/Infos/DistanceContainer/Text").GetComponent<Text>()
|
||||
.text = $"{res.data.TotalDistance.ToString("#0")}KM";
|
||||
transform.Find("Container/Left/Infos/EleContainer/Text").GetComponent<Text>()
|
||||
.text = $"{res.data.TotalClimb.ToString("#0")}M";
|
||||
transform.Find("Container/Left/Infos/SlopeContainer/Text").GetComponent<Text>()
|
||||
.text = $"{res.data.AverageGrade.ToString("#0.00")}%";
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(transform.Find("Container/Left/RideContainer").GetComponent<RectTransform>());
|
||||
}
|
||||
}
|
||||
|
||||
private async void GetList()
|
||||
{
|
||||
var res = await ConfigHelper.mapApi.GetMapRouteAreaDetail(area.Id, pageIndex, pageSize);
|
||||
var res = await ConfigHelper.mapApi.GetMapRouteAreaDetailList(area.Id, pageIndex, pageSize);
|
||||
if (res.result)
|
||||
{
|
||||
if (res.data.Count > 0)
|
||||
@@ -113,7 +138,7 @@ public class NewRouteDetailController : PFUIPanel
|
||||
foreach (var item in list)
|
||||
{
|
||||
var obj = Instantiate(map);
|
||||
obj.GetComponent<MapItem>().Initial(item, caches);
|
||||
obj.GetComponent<MapItem>().Initial(item, caches, area);
|
||||
//obj.SendMessage("Initial", );
|
||||
obj.transform.SetParent(scroll.content.transform);
|
||||
obj.transform.localScale = new Vector3(1, 1, 1);
|
||||
|
||||
@@ -78,20 +78,21 @@ public class NewRouteOverviewController: PFUIPanel
|
||||
{
|
||||
ToList("All Route");
|
||||
});
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
var banner = collectionContent.Find("Banner");
|
||||
bannerContent = banner.Find("Viewport/Content").GetComponent<RectTransform>();
|
||||
var btnLeft = banner.Find("Left");
|
||||
var btnRight = banner.Find("Right");
|
||||
UIManager.AddEvent(btnLeft.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
MoveBanner(false);
|
||||
});
|
||||
UIManager.AddEvent(btnRight.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
MoveBanner(true);
|
||||
});
|
||||
#endif
|
||||
//banner暂时注释
|
||||
//#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
// var banner = collectionContent.Find("Banner");
|
||||
// bannerContent = banner.Find("Viewport/Content").GetComponent<RectTransform>();
|
||||
// var btnLeft = banner.Find("Left");
|
||||
// var btnRight = banner.Find("Right");
|
||||
// UIManager.AddEvent(btnLeft.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
// {
|
||||
// MoveBanner(false);
|
||||
// });
|
||||
// UIManager.AddEvent(btnRight.gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
// {
|
||||
// MoveBanner(true);
|
||||
// });
|
||||
//#endif
|
||||
}
|
||||
int pageIndex = 0, pageSize = 10;
|
||||
bool isEnd = false,isLock = false;
|
||||
|
||||
Reference in new issue
Block a user