骑行和赛事分享&集合正在骑行的人数
This commit is contained in:
1 parent
2743c8d185
commit
ffc98f1a58
23 files changed
+3736
-1103
No files matched your search
@@ -6,6 +6,7 @@ using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using System.Linq;
|
||||
|
||||
namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
@@ -62,6 +63,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
altitudeGraph = panel.transform.Find("AltitudeGraph").GetComponent<RawImage>();
|
||||
mapRanking = panel.transform.Find("MapRanking");
|
||||
mapId = panel.transform.Find("MapId").GetComponent<Text>();
|
||||
|
||||
#if UNITY_STANDALONE_WIN
|
||||
UIManager.RemoveEvent(distance.gameObject);
|
||||
UIManager.RemoveEvent(slope.gameObject);
|
||||
@@ -135,9 +137,18 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
DrawMapRouteAsync(route.Id);
|
||||
AddProcess(10);
|
||||
//查询排行榜
|
||||
var list = mapApi.GetRouteRanking(App.RouteIdParam, "1", 0, 10, "");
|
||||
var list = mapApi.GetRouteRanking(App.RouteIdParam, "1", 0, 99999, "");
|
||||
if (list.result)
|
||||
{
|
||||
if (list.data.list.Count > 10)
|
||||
{
|
||||
var ViewAll = panel.transform.Find("ViewAll").gameObject;
|
||||
ViewAll.SetActive(true);
|
||||
UIManager.AddEvent(ViewAll, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
Application.OpenURL($"{App.CurrentUser.WebHost}/Routes/{cyclingController.mapRoute.Id}?Token={App.CurrentUser.cookie}");
|
||||
});
|
||||
}
|
||||
CreateRankingList(list.data.list);
|
||||
AddProcess(10);
|
||||
}
|
||||
@@ -149,14 +160,20 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
var prefab = Resources.Load<GameObject>("UI/Prefab/Ride/Mobile/RankingItem");
|
||||
var myprefab = Resources.Load<GameObject>("UI/Prefab/Ride/Mobile/MySelfRankingItem");
|
||||
#else
|
||||
var prefab = Resources.Load<GameObject>("UI/Prefab/Ride/RankingItem");
|
||||
var myprefab = Resources.Load<GameObject>("UI/Prefab/Ride/MySelfRankingItem");
|
||||
#endif
|
||||
var parent = panel.transform.Find("MapRanking");
|
||||
var title = panel.transform.Find("RankingTitle").gameObject;
|
||||
title.SetActive(list.Count != 0);
|
||||
int index = 0;
|
||||
foreach (var item in list)
|
||||
{
|
||||
index++;
|
||||
if (index > 10)
|
||||
break;
|
||||
GameObject newObj = (GameObject)Instantiate(prefab, parent);
|
||||
var selectPlayerItemScript = newObj.GetComponent<RankingItemScript>();
|
||||
selectPlayerItemScript.SetRanking(item.RowNumber.ToString());
|
||||
@@ -166,6 +183,19 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var texture = cyclingController.GetCountryImageByCode(item.CountryCode);
|
||||
selectPlayerItemScript.SetCountry(texture);
|
||||
}
|
||||
//如果有自己的记录显示自己的排名
|
||||
var myself = list.Where(c => c.MySelf).FirstOrDefault();
|
||||
if (myself != null)
|
||||
{
|
||||
GameObject newObj = (GameObject)Instantiate(myprefab, parent);
|
||||
var selectPlayerItemScript = newObj.GetComponent<RankingItemScript>();
|
||||
selectPlayerItemScript.SetRanking(myself.RowNumber.ToString());
|
||||
selectPlayerItemScript.SetName(myself.NickName);
|
||||
selectPlayerItemScript.SetTimer(myself.IsDNF ? "DNF" : myself.TotalTime);
|
||||
selectPlayerItemScript.SetHead(myself.WxHeadImg);
|
||||
var texture = cyclingController.GetCountryImageByCode(myself.CountryCode);
|
||||
selectPlayerItemScript.SetCountry(texture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user