Merge remote-tracking branch 'origin/dev_lishuo' into dev_cyp
This commit is contained in:
commit
353c19662c
@ -748,7 +748,8 @@ extern "C" {
|
|||||||
{
|
{
|
||||||
NSLog(@"Central State: Powered Off");
|
NSLog(@"Central State: Powered Off");
|
||||||
|
|
||||||
NSString *message = [NSString stringWithFormat:@"Error~Bluetooth LE Powered Off"];
|
//NSString *message = [NSString stringWithFormat:@"Error~Bluetooth LE Powered Off"];
|
||||||
|
NSString *message = [NSString stringWithFormat:@"BleStatusChanged~13"];
|
||||||
UnitySendMessage ("BluetoothLEReceiver", "OnBluetoothMessage", [message UTF8String] );
|
UnitySendMessage ("BluetoothLEReceiver", "OnBluetoothMessage", [message UTF8String] );
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
@ -756,7 +757,14 @@ extern "C" {
|
|||||||
{
|
{
|
||||||
NSLog(@"Central State: Powered On");
|
NSLog(@"Central State: Powered On");
|
||||||
if (_isInitializing)
|
if (_isInitializing)
|
||||||
UnitySendMessage ("BluetoothLEReceiver", "OnBluetoothMessage", "Initialized");
|
{
|
||||||
|
UnitySendMessage ("BluetoothLEReceiver", "OnBluetoothMessage", "Initialized");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSString *message = [NSString stringWithFormat:@"BleStatusChanged~11"];
|
||||||
|
UnitySendMessage ("BluetoothLEReceiver", "OnBluetoothMessage", [message UTF8String] );
|
||||||
|
}
|
||||||
_isInitializing = FALSE;
|
_isInitializing = FALSE;
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|||||||
@ -122,7 +122,7 @@ namespace Assets.Scripts.Apis
|
|||||||
#else
|
#else
|
||||||
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
|
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
|
||||||
#endif
|
#endif
|
||||||
defaultRequestHeaders.Add("deviceUniqueIdentifier", SystemInfo.deviceUniqueIdentifier);
|
defaultRequestHeaders.Add("deviceUniqueIdentifier", App.DeviceUniqueIdentifier);
|
||||||
defaultRequestHeaders.Remove("Language");
|
defaultRequestHeaders.Remove("Language");
|
||||||
defaultRequestHeaders.Add("Language", App.GetLocalLanguage());
|
defaultRequestHeaders.Add("Language", App.GetLocalLanguage());
|
||||||
}
|
}
|
||||||
@ -558,6 +558,7 @@ namespace Assets.Scripts.Apis
|
|||||||
request.UserAgent = httpClient.DefaultRequestHeaders.UserAgent.ToString();
|
request.UserAgent = httpClient.DefaultRequestHeaders.UserAgent.ToString();
|
||||||
request.Accept = "application/json";
|
request.Accept = "application/json";
|
||||||
request.Headers.Add("Language", App.GetLocalLanguage());
|
request.Headers.Add("Language", App.GetLocalLanguage());
|
||||||
|
request.Headers.Add("deviceUniqueIdentifier", App.DeviceUniqueIdentifier);
|
||||||
request.CookieContainer = new CookieContainer();
|
request.CookieContainer = new CookieContainer();
|
||||||
foreach (Cookie item in cookies)
|
foreach (Cookie item in cookies)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -95,6 +95,15 @@ namespace Assets.Scripts.Apis
|
|||||||
{
|
{
|
||||||
return Get<JsonResult<Dictionary<string, string>>>($"Map/GetServiceKey").data;
|
return Get<JsonResult<Dictionary<string, string>>>($"Map/GetServiceKey").data;
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 骑行场景轮询是否有新设备登录
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<JsonResult> GetPing()
|
||||||
|
{
|
||||||
|
var res = await GetAsync<JsonResult>($"/Map/v1/Ping");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取在线用户的数据
|
/// 获取在线用户的数据
|
||||||
|
|||||||
@ -8,6 +8,7 @@ using System.Text;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using Assets.Scenes.Ride.Scripts;
|
||||||
|
|
||||||
namespace Assets.Scripts.Apis
|
namespace Assets.Scripts.Apis
|
||||||
{
|
{
|
||||||
@ -62,6 +63,9 @@ namespace Assets.Scripts.Apis
|
|||||||
}
|
}
|
||||||
IEnumerator LoadLogin(string msg)
|
IEnumerator LoadLogin(string msg)
|
||||||
{
|
{
|
||||||
|
//删除本地文件
|
||||||
|
Helper.DelectDir(PFConstants.MapWorkoutRecordTempFolder);
|
||||||
|
App.tempRecordData = null;
|
||||||
UnityEngine.SceneManagement.SceneManager.LoadScene(0);
|
UnityEngine.SceneManagement.SceneManager.LoadScene(0);
|
||||||
yield return null;
|
yield return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -177,6 +177,7 @@ public static class App
|
|||||||
public static List<MapRoute> RouteList = new List<MapRoute>();
|
public static List<MapRoute> RouteList = new List<MapRoute>();
|
||||||
public static bool _currentPageIsHome = false;
|
public static bool _currentPageIsHome = false;
|
||||||
public static event EventHandler isHomeChanged;
|
public static event EventHandler isHomeChanged;
|
||||||
|
public static string DeviceUniqueIdentifier = SystemInfo.deviceUniqueIdentifier;
|
||||||
public static bool currentPageIsHome
|
public static bool currentPageIsHome
|
||||||
{
|
{
|
||||||
get => _currentPageIsHome;
|
get => _currentPageIsHome;
|
||||||
|
|||||||
@ -210,13 +210,9 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
protected void _map_OnInitialized()
|
protected void _map_OnInitialized()
|
||||||
{
|
{
|
||||||
var visualizer = _map.MapVisualizer;
|
var visualizer = _map.MapVisualizer;
|
||||||
visualizer.OnMapVisualizerStateChanged += (s) =>
|
visualizer.OnTileHeightProcessingFinished += (s) =>
|
||||||
{
|
{
|
||||||
if (s == ModuleState.Finished)
|
AddProcess(40);
|
||||||
{
|
|
||||||
AddProcess(40);
|
|
||||||
Debug.Log($"add 40");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -62,6 +62,7 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
#endregion
|
#endregion
|
||||||
GameObject loadingcanvas;
|
GameObject loadingcanvas;
|
||||||
AbstratctLoadingController loadingController;
|
AbstratctLoadingController loadingController;
|
||||||
|
|
||||||
private async Task Login()
|
private async Task Login()
|
||||||
{
|
{
|
||||||
var result = await new UserApi().Login("15261826280", "123456", "");
|
var result = await new UserApi().Login("15261826280", "123456", "");
|
||||||
@ -73,6 +74,8 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
public GraphChartBase graph { get; set; }
|
public GraphChartBase graph { get; set; }
|
||||||
|
|
||||||
private float activeSeconds { get; set; }//移动端用户进入骑行超过2min,界面进入沉浸状态
|
private float activeSeconds { get; set; }//移动端用户进入骑行超过2min,界面进入沉浸状态
|
||||||
|
public int RankingId;
|
||||||
|
public string recordId;
|
||||||
protected override void Awake()
|
protected override void Awake()
|
||||||
{
|
{
|
||||||
base.Awake();
|
base.Awake();
|
||||||
@ -83,6 +86,7 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
//获取路书信息
|
//获取路书信息
|
||||||
|
recordId = Guid.NewGuid().ToString();
|
||||||
mapApi = ConfigHelper.mapApi;
|
mapApi = ConfigHelper.mapApi;
|
||||||
routeId = App.RouteIdParam > 0 ? App.RouteIdParam : 2633;
|
routeId = App.RouteIdParam > 0 ? App.RouteIdParam : 2633;
|
||||||
competitionId = App.CompetionId;
|
competitionId = App.CompetionId;
|
||||||
@ -237,6 +241,7 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
SceneManager.activeSceneChanged += SceneManager_activeSceneChanged;
|
SceneManager.activeSceneChanged += SceneManager_activeSceneChanged;
|
||||||
|
|
||||||
HandleTouchAndInput();
|
HandleTouchAndInput();
|
||||||
|
StartCoroutine(Ping());
|
||||||
//进入比赛
|
//进入比赛
|
||||||
if (competitionId > 0)
|
if (competitionId > 0)
|
||||||
{
|
{
|
||||||
@ -253,6 +258,14 @@ public class CyclingController : DeviceServiceMonoBase
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private IEnumerator Ping()
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
var result = ConfigHelper.mapApi.GetPing();
|
||||||
|
yield return new WaitForSeconds(5);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
float timer = 1f;
|
float timer = 1f;
|
||||||
bool clearLock = false;
|
bool clearLock = false;
|
||||||
@ -1187,14 +1200,14 @@ 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);
|
||||||
}
|
}
|
||||||
public int RankingId;
|
|
||||||
public void Save(double totalDistance)
|
public void Save(double totalDistance)
|
||||||
{
|
{
|
||||||
ClearTempFile();
|
ClearTempFile();
|
||||||
cyclingController.recorderData.EndTime = UIManager.Now.GetDateTime();
|
cyclingController.recorderData.EndTime = UIManager.Now.GetDateTime();
|
||||||
isQuit = true;
|
isQuit = true;
|
||||||
isStart = false;
|
isStart = false;
|
||||||
string recordId = Guid.NewGuid().ToString();
|
//string recordId = Guid.NewGuid().ToString();
|
||||||
//var path = Helper.GetDataDir("MapWorkoutRecords/"+ recordId);
|
//var path = Helper.GetDataDir("MapWorkoutRecords/"+ recordId);
|
||||||
var path = PFConstants.MapWorkoutRecordFolder + "/" + recordId;
|
var path = PFConstants.MapWorkoutRecordFolder + "/" + recordId;
|
||||||
Helper.CreateDirectoryIfNotExsit(path);
|
Helper.CreateDirectoryIfNotExsit(path);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace Assets.Scripts.UI.Control
|
|||||||
public class PFUIText : PFUIComponentBase
|
public class PFUIText : PFUIComponentBase
|
||||||
{
|
{
|
||||||
public string key;
|
public string key;
|
||||||
private Text text;
|
protected Text text;
|
||||||
|
|
||||||
public string Text
|
public string Text
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,7 +7,6 @@ using Assets.Scripts;
|
|||||||
|
|
||||||
public class MultiTips:PFUIText
|
public class MultiTips:PFUIText
|
||||||
{
|
{
|
||||||
private Text text;
|
|
||||||
private Button button;
|
private Button button;
|
||||||
private string[] tips { get; set; }
|
private string[] tips { get; set; }
|
||||||
private int currentIndex = 0;
|
private int currentIndex = 0;
|
||||||
|
|||||||
@ -79,42 +79,50 @@ public class LocalRouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterH
|
|||||||
|
|
||||||
Name.text = record.RouteName;
|
Name.text = record.RouteName;
|
||||||
Time.text = record.StartTime.ToLocalString("HH:mm:ss dd-MM-yyyy");
|
Time.text = record.StartTime.ToLocalString("HH:mm:ss dd-MM-yyyy");
|
||||||
RidingTime.text = $"<color={titleColor}>{App.GetLocalString("Riding time")}:</color>{Helper.FormatTicks(record.Ticks)}";
|
RidingTime.text = $"<color={titleColor}>{App.GetLocalString("Riding Time")}:</color>{Helper.FormatTicks(record.Ticks)}";
|
||||||
RidingDistance.text = $"<color={titleColor}>{App.GetLocalString("Mileage")}:</color>{record.EndDistance.ToString("#0.00")}KM";
|
RidingDistance.text = $"<color={titleColor}>{App.GetLocalString("Mileage")}:</color>{record.EndDistance.ToString("#0.00")}KM";
|
||||||
Device.text = $"<color={titleColor}>{App.GetLocalString("Cycling equipment")}:</color>{record.ManufacturerName}";
|
Device.text = $"<color={titleColor}>{App.GetLocalString("Cycling Equipment")}:</color>{record.ManufacturerName}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
listFileName.Add(item);
|
listFileName.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DeleteLocalRecord();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DeleteLocalRecord(bool showMessage=false)
|
||||||
|
{
|
||||||
|
//自动上传
|
||||||
|
try
|
||||||
|
{
|
||||||
|
MapInterruptRecordApi service = ConfigHelper.mapInterruptRecordApi;
|
||||||
|
var result = service.Add(record, listFileName);
|
||||||
|
//删除文件
|
||||||
|
if (result.result)
|
||||||
|
{
|
||||||
|
Helper.DelectDir(path);
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
if (showMessage)
|
||||||
|
{
|
||||||
|
Utils.showToast(gameObject, result.errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Utils.showToast(gameObject, e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GoUplaod()
|
void GoUplaod()
|
||||||
{
|
{
|
||||||
UIManager.ShowConfirm("Upload", "Upload the local record?", () =>
|
UIManager.ShowConfirm("Upload", "Upload the local record?", () =>
|
||||||
{
|
{
|
||||||
try
|
DeleteLocalRecord(true);
|
||||||
{
|
//删除文件
|
||||||
MapInterruptRecordApi service = new MapInterruptRecordApi();
|
UIManager.CloseConfirm();
|
||||||
var result = service.Add(record, listFileName);
|
|
||||||
//删除文件
|
|
||||||
UIManager.CloseConfirm();
|
|
||||||
if (result.result)
|
|
||||||
{
|
|
||||||
Helper.DelectDir(path);
|
|
||||||
DestroyImmediate(gameObject);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Utils.showToast(gameObject, result.errMsg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Utils.showToast(gameObject, e.Message);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
void GoDelete()
|
void GoDelete()
|
||||||
|
|||||||
@ -264,7 +264,7 @@ public class ResultListController : PFUIPanel
|
|||||||
{
|
{
|
||||||
if (Directory.Exists(item))
|
if (Directory.Exists(item))
|
||||||
{
|
{
|
||||||
var d = new DirectoryInfo(item);
|
//var d = new DirectoryInfo(item);
|
||||||
//var createTime = d.CreationTime;//create time
|
//var createTime = d.CreationTime;//create time
|
||||||
//var newTime = createTime.AddSeconds(30D);
|
//var newTime = createTime.AddSeconds(30D);
|
||||||
//if (newTime < DateTime.Now)
|
//if (newTime < DateTime.Now)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user