Merge remote-tracking branch 'origin/dev_nonearth' into dev_cyp

# Conflicts:
#	Assets/Resources/UI/language.json
This commit is contained in:
Caiyanpeng committed 2021-12-29 14:49:07 +08:00
commit 0ab425cb52
15 files changed
+249 -116

No files matched your search

+9
View File
@@ -112,6 +112,15 @@ namespace Assets.Scripts.Apis
return null;
}
public JsonResult<List<MapRoute>> GetMapRouteInfo(IEnumerable<int> ids)
{
var result = Newtonsoft.Json.JsonConvert.DeserializeObject<JsonResult<List<MapRoute>>>(Post("Map/GetMapRouteInfo", ids));
if (result.result)
{
return result;
}
return null;
}
public async Task<JsonResult<List<NearRouteModel>>> GetNearRouteAsync(float lat, float lng, float zoom, string bounds)
{
+2 -14
View File
@@ -384,19 +384,6 @@ public class MainController : BaseScene
{
if (item.RouteId > 0)
{
if (!App.RouteNameDict.ContainsKey(item.RouteId))
{
var result = ConfigHelper.mapApi.GetById(item.RouteId);
if (result.result)
{
item.RouteName = result.data.Name;
App.RouteNameDict.Add(item.RouteId, item.RouteName);
}
}
else
{
item.RouteName = App.RouteNameDict[item.RouteId];
}
var message = "";
if (item.TotalTicks == 0)
{
@@ -492,7 +479,8 @@ public class MainController : BaseScene
var tempRecordData = Newtonsoft.Json.JsonConvert.DeserializeObject<TempRecordData>(content);
App.tempRecordData = tempRecordData;
UIManager.ShowConfirm(App.GetLocalString("Reconnect"), App.GetLocalString("Did you want to reconnect the trip that was interrupted abnormally?"), () => { SceneManager.LoadScene("Ride"); },2,()=> {
UIManager.ShowConfirm(App.GetLocalString("Reconnect"), App.GetLocalString("Did you want to reconnect the trip that was interrupted abnormally?"), () => { App.RouteIdParam = App.tempRecordData.RouteId; App.CompetionId = App.tempRecordData.CompetitionId;
SceneManager.LoadScene("Ride"); },2,()=> {
Helper.DelectDir(PFConstants.MapWorkoutRecordTempFolder);
App.tempRecordData = null;
});
@@ -41,8 +41,8 @@ namespace Assets.Scenes.Ride.Scripts
if (count >= 0 && !competitionModel.recorderData.Saved)
{
ShowCountDown(count, App.GetLocalString("Get Ready!"));//显示倒计时面板信息
Timer.gameObject.SetActive(false);
TimerTitle.gameObject.SetActive(false);
//Timer.gameObject.SetActive(false);
//TimerTitle.gameObject.SetActive(false);
}
else
{
@@ -56,7 +56,7 @@ namespace Assets.Scenes.Ride.Scripts
//显示倒计时面板信息
ShowCountDown(s.Item1, App.GetLocalString("Time Limit"));
#else
ShowCountDown(s.Item1, "Get The First Place. Time Limit");
ShowCountDown(s.Item1, App.GetLocalString("Get The First Place. Time Limit"));
#endif
}
else if (s.Item1 >= 0)
@@ -66,19 +66,19 @@ namespace Assets.Scenes.Ride.Scripts
ShowCountDown(s.Item1, App.GetLocalString("Remaining Time"));
}
//显示当前选手骑行时间
Timer.gameObject.SetActive(true);
TimerTitle.gameObject.SetActive(true);
Timer.text = Helper.FormatTicks(s.Item2);// Helper.FormatTicks(cyclingController.currentPlayer.TotalTicks);
//CountTimer.gameObject.SetActive(true);
//TimerTitle.gameObject.SetActive(true);
CountTimer.text = Helper.FormatTicks(s.Item2);// Helper.FormatTicks(cyclingController.currentPlayer.TotalTicks);
}
}
}
private void ShowCountDown(int count, string text)
{
Title.text = text;
TimerTitle.text = text;
if (count >= 0)
{
CountTimer.text = Helper.FormatTicks(count);
Timer.text = Helper.FormatTicks(count);
}
}
}
@@ -267,6 +267,7 @@ namespace Assets.Scenes.Ride.Scripts.Model
public class TempRecordData
{
public int CompetitionId { get; set; }
public int RouteId { get; set; }
public RouteResultParam selectParam { get; set; }
public double CurrentRouteStartDistance { get; set; }
@@ -428,6 +428,7 @@ namespace Assets.Scenes.Ride.Scripts
var msgs = RemoveExceptionData(mes);
//LastActiveTime = DateTime.Now;
var ids = msgs.Where(m => onlineUsers.All(u => u.Id != m.MemberId)).Select(m => m.MemberId);
var routeIds = msgs.Where(m => onlineUsers.All(u => u.Id != m.MemberId)).Select(m => m.RouteId);
if (ids.Any())
{
List<int> notCachedIds = new List<int>();
@@ -447,6 +448,8 @@ namespace Assets.Scenes.Ride.Scripts
if (notCachedIds.Count > 0)
{
var rangeUser = ConfigHelper.mapApi.GetOnlineUserInfo(ids).data;
var rangeRoute = ConfigHelper.mapApi.GetMapRouteInfo(routeIds).data;
App.RouteList.AddRange(rangeRoute);
onlineUsers.AddRange(rangeUser);
App.userList.AddRange(rangeUser);
}
@@ -454,10 +457,16 @@ namespace Assets.Scenes.Ride.Scripts
foreach (var user in onlineUsers)
{
var item = msgs.FirstOrDefault(u => u.MemberId == user.Id);
var route = App.RouteList.Where(c => c.Id == item.RouteId).FirstOrDefault();
if (route != null)
{
user.RouteName = route.NickName;
}
if (item != null)
{
user.LastActiveTime = DateTime.Now;
user.RouteId = item.RouteId;
user.Point = item.Point;
user.IsCompleted = item.IsCompleted;
//user.exit = item.exit;
@@ -92,8 +92,8 @@ public class CyclingController : DeviceServiceMonoBase
if (App.tempRecordData != null)
{
selectParamModel = App.tempRecordData.selectParam;
competitionId = selectParamModel.CompetitionId ?? 0;
routeId = selectParamModel.RouteId ?? 0;
competitionId = App.tempRecordData.CompetitionId;
routeId = App.tempRecordData.RouteId;
}
Resources.UnloadUnusedAssets();
}
@@ -560,8 +560,10 @@ public class CyclingController : DeviceServiceMonoBase
//初始比赛
private IEnumerator InitRace()
{
yield return new WaitForSeconds(1);
yield return null;//new WaitForSeconds(1);
UnityEngine.Debug.Log($"TEST:{routeId}");
mapRoute = mapApi.GetById(routeId).data;
var mapCompetitionApi = new MapCompetitionApi();
competition = mapCompetitionApi.GetById(competitionId).data;
loadingController.Init();//初始化loading页面
@@ -602,7 +604,7 @@ public class CyclingController : DeviceServiceMonoBase
EndDistance = 0,
RankingsId = new List<string>(),
OnlineUserId = 0,
RouteId = App.RouteIdParam
RouteId = routeId
};
}
@@ -1146,7 +1148,8 @@ public BaseUIManager singleUIManager;
RecorderDataModel recorderData = cyclingController.recorderData;
tempRecordData.RiderDatas = recorderData.RiderDatas;
tempRecordData.selectParam = recorderData.selectParam;
tempRecordData.RouteId = mapRoute.Id;
tempRecordData.RouteId = recorderData.Competitionid;
tempRecordData.CompetitionId = mapRoute.Id;
tempRecordData.StartTime = startTime;
tempRecordData.ManufacturerId = recorderData.ManufacturerId;
tempRecordData.ManufacturerName = recorderData.ManufacturerName;
@@ -137,7 +137,7 @@ namespace Assets.Scenes.Ride.Scripts
DrawMapRouteAsync(route.Id);
AddProcess(10);
//查询排行榜
var list = mapApi.GetRouteRanking(App.RouteIdParam, "1", 0, 99999, "");
var list = mapApi.GetRouteRanking(route.Id, "1", 0, 10, "");
if (list.result)
{
if (list.data.list.Count > 10)