骑行保存数据改成同步
This commit is contained in:
parent
f3f17c1256
commit
d4fa2bbb69
@ -42,7 +42,7 @@
|
|||||||
"Total Climbed": "累计爬升",
|
"Total Climbed": "累计爬升",
|
||||||
"Other Account": "切换账号",
|
"Other Account": "切换账号",
|
||||||
"Ranking": "排名",
|
"Ranking": "排名",
|
||||||
"Time Limit:": "倒计时:",
|
"Close Gate:": "倒计时:",
|
||||||
"RANK": "排名",
|
"RANK": "排名",
|
||||||
"NAME": "昵称",
|
"NAME": "昵称",
|
||||||
"TIME": "时间",
|
"TIME": "时间",
|
||||||
@ -208,7 +208,7 @@
|
|||||||
"Record": "骑行记录",
|
"Record": "骑行记录",
|
||||||
"More": "更多",
|
"More": "更多",
|
||||||
"Remaining Time": "比赛结束倒计时:",
|
"Remaining Time": "比赛结束倒计时:",
|
||||||
"Time Limit": "关门时间:",
|
"Close Gate": "关门时间:",
|
||||||
"Start Time": "比赛开始时间:",
|
"Start Time": "比赛开始时间:",
|
||||||
"Start for Registration": "报名开始时间",
|
"Start for Registration": "报名开始时间",
|
||||||
"Deadline for Registration": "报名截止时间",
|
"Deadline for Registration": "报名截止时间",
|
||||||
@ -289,7 +289,7 @@
|
|||||||
"Reconnect": "重新连接",
|
"Reconnect": "重新连接",
|
||||||
"Did you want to reconnect the trip that was interrupted abnormally?": "你有异常中断的骑行,是否重新连接开始骑行?",
|
"Did you want to reconnect the trip that was interrupted abnormally?": "你有异常中断的骑行,是否重新连接开始骑行?",
|
||||||
"LIST MODE": "线路模式",
|
"LIST MODE": "线路模式",
|
||||||
"Get The First Place. Time Limit": "第一名已产生,倒计时:",
|
"Get The First Place. Close Gate": "第一名已产生,倒计时:",
|
||||||
"Competition Time": "比赛时间",
|
"Competition Time": "比赛时间",
|
||||||
"View All": "查看全部"
|
"View All": "查看全部"
|
||||||
},
|
},
|
||||||
@ -336,7 +336,7 @@
|
|||||||
"Total Climbed": "Total Climbed",
|
"Total Climbed": "Total Climbed",
|
||||||
"Other Account": "Other Account",
|
"Other Account": "Other Account",
|
||||||
"Ranking": "Ranking",
|
"Ranking": "Ranking",
|
||||||
"Time Limit:": "Time Limit:",
|
"Close Gate:": "Close Gate:",
|
||||||
"RANK": "RANK",
|
"RANK": "RANK",
|
||||||
"NAME": "NAME",
|
"NAME": "NAME",
|
||||||
"TIME": "TIME",
|
"TIME": "TIME",
|
||||||
@ -496,7 +496,7 @@
|
|||||||
"Record": "Record",
|
"Record": "Record",
|
||||||
"More": "More",
|
"More": "More",
|
||||||
"Remaining Time": "Remaining Time",
|
"Remaining Time": "Remaining Time",
|
||||||
"Time Limit": "Time Limit",
|
"Close Gate": "Close Gate",
|
||||||
"Start Time": "Start Time",
|
"Start Time": "Start Time",
|
||||||
"Start for Registration": "Start for Registration",
|
"Start for Registration": "Start for Registration",
|
||||||
"Deadline for Registration": "Deadline for Registration",
|
"Deadline for Registration": "Deadline for Registration",
|
||||||
@ -574,7 +574,7 @@
|
|||||||
"Reconnect": "Reconnect",
|
"Reconnect": "Reconnect",
|
||||||
"Did you want to reconnect the trip that was interrupted abnormally?": "Did you want to reconnect the trip that was interrupted abnormally?",
|
"Did you want to reconnect the trip that was interrupted abnormally?": "Did you want to reconnect the trip that was interrupted abnormally?",
|
||||||
"LIST MODE": "LIST MODE",
|
"LIST MODE": "LIST MODE",
|
||||||
"Get The First Place. Time Limit": "Get The First Place. Time Limit",
|
"Get The First Place. Close Gate": "Get The First Place. Close Gate",
|
||||||
"Competition Time": "Competition Time",
|
"Competition Time": "Competition Time",
|
||||||
"View All": "View All"
|
"View All": "View All"
|
||||||
}
|
}
|
||||||
|
|||||||
@ -412,8 +412,11 @@ public class MainController : BaseScene
|
|||||||
var tempRecordData = Newtonsoft.Json.JsonConvert.DeserializeObject<TempRecordData>(content);
|
var tempRecordData = Newtonsoft.Json.JsonConvert.DeserializeObject<TempRecordData>(content);
|
||||||
App.tempRecordData = tempRecordData;
|
App.tempRecordData = tempRecordData;
|
||||||
|
|
||||||
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;
|
UIManager.ShowConfirm(App.GetLocalString("Reconnect"), App.GetLocalString("Did you want to reconnect the trip that was interrupted abnormally?"), () => {
|
||||||
SceneManager.LoadScene("Ride"); },2,()=> {
|
App.RouteIdParam = App.tempRecordData.RouteId;
|
||||||
|
App.CompetionId = App.tempRecordData.CompetitionId;
|
||||||
|
SceneManager.LoadScene("Ride");
|
||||||
|
},2,()=> {
|
||||||
Helper.DelectDir(PFConstants.MapWorkoutRecordTempFolder);
|
Helper.DelectDir(PFConstants.MapWorkoutRecordTempFolder);
|
||||||
App.tempRecordData = null;
|
App.tempRecordData = null;
|
||||||
});
|
});
|
||||||
|
|||||||
@ -54,9 +54,9 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
{
|
{
|
||||||
#if UNITY_IOS || UNITY_ANDROID
|
#if UNITY_IOS || UNITY_ANDROID
|
||||||
//显示倒计时面板信息
|
//显示倒计时面板信息
|
||||||
ShowCountDown(s.Item1, App.GetLocalString("Time Limit"));
|
ShowCountDown(s.Item1, App.GetLocalString("Close Gate"));
|
||||||
#else
|
#else
|
||||||
ShowCountDown(s.Item1, App.GetLocalString("Get The First Place. Time Limit"));
|
ShowCountDown(s.Item1, App.GetLocalString("Get The First Place. Close Gate"));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (s.Item1 >= 0)
|
else if (s.Item1 >= 0)
|
||||||
|
|||||||
@ -119,13 +119,13 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
|
|
||||||
public RouteResultParam selectParam { get; set; }
|
public RouteResultParam selectParam { get; set; }
|
||||||
|
|
||||||
public void SaveWithLocalRecordAysnc(CyclingModel cyclingModel, RouteResultParam selectParam, string imageName,string recordId,string path)
|
public int SaveWithLocalRecordAysnc(CyclingModel cyclingModel, RouteResultParam selectParam, string imageName,string recordId,string path)
|
||||||
{
|
{
|
||||||
Saved = true;
|
Saved = true;
|
||||||
Dictionary<MapInterruptRecord, List<string>> recordData = new Dictionary<MapInterruptRecord, List<string>>();
|
Dictionary<MapInterruptRecord, List<string>> recordData = new Dictionary<MapInterruptRecord, List<string>>();
|
||||||
if (RiderDatas.Count <= 0)
|
if (RiderDatas.Count <= 0)
|
||||||
{
|
{
|
||||||
return ;
|
return -1;
|
||||||
}
|
}
|
||||||
string newFileName = Guid.NewGuid().ToString();
|
string newFileName = Guid.NewGuid().ToString();
|
||||||
int FTP = Helper.GetFtp();
|
int FTP = Helper.GetFtp();
|
||||||
@ -230,37 +230,43 @@ namespace Assets.Scenes.Ride.Scripts.Model
|
|||||||
Debug.Log(ex.Message);
|
Debug.Log(ex.Message);
|
||||||
}
|
}
|
||||||
recordData.Add(interruptRecord, files);
|
recordData.Add(interruptRecord, files);
|
||||||
SaveDataAysnc(recordData, path);
|
return SaveDataAysnc(recordData, path);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保存数据
|
/// 保存数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="base64Image"></param>
|
/// <param name="base64Image"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public void SaveDataAysnc(Dictionary<MapInterruptRecord, List<string>> data,string path)
|
public int SaveDataAysnc(Dictionary<MapInterruptRecord, List<string>> data,string path)
|
||||||
{
|
{
|
||||||
if (data != null && data.Count > 0)
|
if (data != null && data.Count > 0)
|
||||||
{
|
{
|
||||||
//var path = Helper.GetDataDir("MapWorkoutRecords");
|
//var path = Helper.GetDataDir("MapWorkoutRecords");
|
||||||
Task.Run(() => {
|
//Task.Run(() => {
|
||||||
|
try
|
||||||
|
{
|
||||||
var record = data.FirstOrDefault();
|
var record = data.FirstOrDefault();
|
||||||
MapInterruptRecordApi service = new MapInterruptRecordApi();
|
MapInterruptRecordApi service = new MapInterruptRecordApi();
|
||||||
var result = service.Add(record.Key, record.Value);
|
var result = service.Add(record.Key, record.Value);
|
||||||
|
|
||||||
//删除文件
|
if (result.result)
|
||||||
try
|
|
||||||
{
|
{
|
||||||
if (result.result && Directory.Exists(path))
|
//删除文件
|
||||||
|
|
||||||
|
if (Directory.Exists(path))
|
||||||
{
|
{
|
||||||
Helper.DelectDir(path);
|
Helper.DelectDir(path);
|
||||||
}
|
}
|
||||||
|
//});
|
||||||
|
return result.data.RankingId;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
}
|
||||||
{
|
catch (Exception e)
|
||||||
Debug.Log(e.Message);
|
{
|
||||||
}
|
Debug.Log(e.Message);
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1148,8 +1148,8 @@ public BaseUIManager singleUIManager;
|
|||||||
RecorderDataModel recorderData = cyclingController.recorderData;
|
RecorderDataModel recorderData = cyclingController.recorderData;
|
||||||
tempRecordData.RiderDatas = recorderData.RiderDatas;
|
tempRecordData.RiderDatas = recorderData.RiderDatas;
|
||||||
tempRecordData.selectParam = recorderData.selectParam;
|
tempRecordData.selectParam = recorderData.selectParam;
|
||||||
tempRecordData.RouteId = recorderData.Competitionid;
|
tempRecordData.RouteId = mapRoute.Id;
|
||||||
tempRecordData.CompetitionId = mapRoute.Id;
|
tempRecordData.CompetitionId = recorderData.Competitionid;
|
||||||
tempRecordData.StartTime = startTime;
|
tempRecordData.StartTime = startTime;
|
||||||
tempRecordData.ManufacturerId = recorderData.ManufacturerId;
|
tempRecordData.ManufacturerId = recorderData.ManufacturerId;
|
||||||
tempRecordData.ManufacturerName = recorderData.ManufacturerName;
|
tempRecordData.ManufacturerName = recorderData.ManufacturerName;
|
||||||
@ -1161,7 +1161,7 @@ public BaseUIManager singleUIManager;
|
|||||||
var tempContent = Newtonsoft.Json.JsonConvert.SerializeObject(tempRecordData);
|
var tempContent = Newtonsoft.Json.JsonConvert.SerializeObject(tempRecordData);
|
||||||
System.IO.File.WriteAllText(filePath, tempContent);
|
System.IO.File.WriteAllText(filePath, tempContent);
|
||||||
}
|
}
|
||||||
|
int RankingId;
|
||||||
public void Save(double totalDistance)
|
public void Save(double totalDistance)
|
||||||
{
|
{
|
||||||
ClearTempFile();
|
ClearTempFile();
|
||||||
@ -1182,6 +1182,7 @@ public BaseUIManager singleUIManager;
|
|||||||
cyclingController.recorderData.ManufacturerId = ManufacturerId;
|
cyclingController.recorderData.ManufacturerId = ManufacturerId;
|
||||||
cyclingController.recorderData.ManufacturerName = ManufacturerName;
|
cyclingController.recorderData.ManufacturerName = ManufacturerName;
|
||||||
cyclingController.recorderData.DeviceNumber = DeviceNumber;
|
cyclingController.recorderData.DeviceNumber = DeviceNumber;
|
||||||
|
RankingId =cyclingController.recorderData.SaveWithLocalRecordAysnc(cyclingModel, selectParamModel, imageFileName, recordId, path);
|
||||||
//显示骑行结果(如果是比赛模式显示比赛最终排名)
|
//显示骑行结果(如果是比赛模式显示比赛最终排名)
|
||||||
if (cyclingModel != CyclingModel.Competition)
|
if (cyclingModel != CyclingModel.Competition)
|
||||||
{
|
{
|
||||||
@ -1190,7 +1191,6 @@ public BaseUIManager singleUIManager;
|
|||||||
rs.InjectController(this);
|
rs.InjectController(this);
|
||||||
rs.SetDataSource(cyclingController.recorderData);
|
rs.SetDataSource(cyclingController.recorderData);
|
||||||
}
|
}
|
||||||
cyclingController.recorderData.SaveWithLocalRecordAysnc(cyclingModel, selectParamModel, imageFileName, recordId, path);
|
|
||||||
}
|
}
|
||||||
public byte[] CaptureCamera()
|
public byte[] CaptureCamera()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -61,7 +61,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
weight = App.CurrentUser.Weight;
|
weight = App.CurrentUser.Weight;
|
||||||
bicycleWeight = App.CurrentUser.BicycleWeight;
|
bicycleWeight = App.CurrentUser.BicycleWeight;
|
||||||
//#if UNITY_EDITOR
|
//#if UNITY_EDITOR
|
||||||
power = 143;
|
power = 1443;
|
||||||
//#endif
|
//#endif
|
||||||
mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100);
|
mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user