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");
|
||||
|
||||
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] );
|
||||
} break;
|
||||
|
||||
@ -756,7 +757,14 @@ extern "C" {
|
||||
{
|
||||
NSLog(@"Central State: Powered On");
|
||||
if (_isInitializing)
|
||||
UnitySendMessage ("BluetoothLEReceiver", "OnBluetoothMessage", "Initialized");
|
||||
{
|
||||
UnitySendMessage ("BluetoothLEReceiver", "OnBluetoothMessage", "Initialized");
|
||||
}
|
||||
else
|
||||
{
|
||||
NSString *message = [NSString stringWithFormat:@"BleStatusChanged~11"];
|
||||
UnitySendMessage ("BluetoothLEReceiver", "OnBluetoothMessage", [message UTF8String] );
|
||||
}
|
||||
_isInitializing = FALSE;
|
||||
} break;
|
||||
|
||||
|
||||
@ -122,7 +122,7 @@ namespace Assets.Scripts.Apis
|
||||
#else
|
||||
defaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("Unity", ConfigHelper.AppVersion));
|
||||
#endif
|
||||
defaultRequestHeaders.Add("deviceUniqueIdentifier", SystemInfo.deviceUniqueIdentifier);
|
||||
defaultRequestHeaders.Add("deviceUniqueIdentifier", App.DeviceUniqueIdentifier);
|
||||
defaultRequestHeaders.Remove("Language");
|
||||
defaultRequestHeaders.Add("Language", App.GetLocalLanguage());
|
||||
}
|
||||
@ -558,6 +558,7 @@ namespace Assets.Scripts.Apis
|
||||
request.UserAgent = httpClient.DefaultRequestHeaders.UserAgent.ToString();
|
||||
request.Accept = "application/json";
|
||||
request.Headers.Add("Language", App.GetLocalLanguage());
|
||||
request.Headers.Add("deviceUniqueIdentifier", App.DeviceUniqueIdentifier);
|
||||
request.CookieContainer = new CookieContainer();
|
||||
foreach (Cookie item in cookies)
|
||||
{
|
||||
|
||||
@ -95,6 +95,15 @@ namespace Assets.Scripts.Apis
|
||||
{
|
||||
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>
|
||||
/// 获取在线用户的数据
|
||||
|
||||
@ -8,6 +8,7 @@ using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Assets.Scenes.Ride.Scripts;
|
||||
|
||||
namespace Assets.Scripts.Apis
|
||||
{
|
||||
@ -62,6 +63,9 @@ namespace Assets.Scripts.Apis
|
||||
}
|
||||
IEnumerator LoadLogin(string msg)
|
||||
{
|
||||
//删除本地文件
|
||||
Helper.DelectDir(PFConstants.MapWorkoutRecordTempFolder);
|
||||
App.tempRecordData = null;
|
||||
UnityEngine.SceneManagement.SceneManager.LoadScene(0);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
@ -177,6 +177,7 @@ public static class App
|
||||
public static List<MapRoute> RouteList = new List<MapRoute>();
|
||||
public static bool _currentPageIsHome = false;
|
||||
public static event EventHandler isHomeChanged;
|
||||
public static string DeviceUniqueIdentifier = SystemInfo.deviceUniqueIdentifier;
|
||||
public static bool currentPageIsHome
|
||||
{
|
||||
get => _currentPageIsHome;
|
||||
|
||||
@ -210,13 +210,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
protected void _map_OnInitialized()
|
||||
{
|
||||
var visualizer = _map.MapVisualizer;
|
||||
visualizer.OnMapVisualizerStateChanged += (s) =>
|
||||
visualizer.OnTileHeightProcessingFinished += (s) =>
|
||||
{
|
||||
if (s == ModuleState.Finished)
|
||||
{
|
||||
AddProcess(40);
|
||||
Debug.Log($"add 40");
|
||||
}
|
||||
AddProcess(40);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,6 +62,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
#endregion
|
||||
GameObject loadingcanvas;
|
||||
AbstratctLoadingController loadingController;
|
||||
|
||||
private async Task Login()
|
||||
{
|
||||
var result = await new UserApi().Login("15261826280", "123456", "");
|
||||
@ -73,6 +74,8 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
public GraphChartBase graph { get; set; }
|
||||
|
||||
private float activeSeconds { get; set; }//移动端用户进入骑行超过2min,界面进入沉浸状态
|
||||
public int RankingId;
|
||||
public string recordId;
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
@ -83,6 +86,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
}
|
||||
#endif
|
||||
//获取路书信息
|
||||
recordId = Guid.NewGuid().ToString();
|
||||
mapApi = ConfigHelper.mapApi;
|
||||
routeId = App.RouteIdParam > 0 ? App.RouteIdParam : 2633;
|
||||
competitionId = App.CompetionId;
|
||||
@ -237,6 +241,7 @@ public class CyclingController : DeviceServiceMonoBase
|
||||
SceneManager.activeSceneChanged += SceneManager_activeSceneChanged;
|
||||
|
||||
HandleTouchAndInput();
|
||||
StartCoroutine(Ping());
|
||||
//进入比赛
|
||||
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;
|
||||
bool clearLock = false;
|
||||
@ -1187,14 +1200,14 @@ public BaseUIManager singleUIManager;
|
||||
var tempContent = Newtonsoft.Json.JsonConvert.SerializeObject(tempRecordData);
|
||||
System.IO.File.WriteAllText(filePath, tempContent);
|
||||
}
|
||||
public int RankingId;
|
||||
|
||||
public void Save(double totalDistance)
|
||||
{
|
||||
ClearTempFile();
|
||||
cyclingController.recorderData.EndTime = UIManager.Now.GetDateTime();
|
||||
isQuit = true;
|
||||
isStart = false;
|
||||
string recordId = Guid.NewGuid().ToString();
|
||||
//string recordId = Guid.NewGuid().ToString();
|
||||
//var path = Helper.GetDataDir("MapWorkoutRecords/"+ recordId);
|
||||
var path = PFConstants.MapWorkoutRecordFolder + "/" + recordId;
|
||||
Helper.CreateDirectoryIfNotExsit(path);
|
||||
|
||||
@ -12,7 +12,7 @@ namespace Assets.Scripts.UI.Control
|
||||
public class PFUIText : PFUIComponentBase
|
||||
{
|
||||
public string key;
|
||||
private Text text;
|
||||
protected Text text;
|
||||
|
||||
public string Text
|
||||
{
|
||||
|
||||
@ -7,7 +7,6 @@ using Assets.Scripts;
|
||||
|
||||
public class MultiTips:PFUIText
|
||||
{
|
||||
private Text text;
|
||||
private Button button;
|
||||
private string[] tips { get; set; }
|
||||
private int currentIndex = 0;
|
||||
|
||||
@ -79,42 +79,50 @@ public class LocalRouteItem : MonoBehaviour, IPointerExitHandler, IPointerEnterH
|
||||
|
||||
Name.text = record.RouteName;
|
||||
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";
|
||||
Device.text = $"<color={titleColor}>{App.GetLocalString("Cycling equipment")}:</color>{record.ManufacturerName}";
|
||||
Device.text = $"<color={titleColor}>{App.GetLocalString("Cycling Equipment")}:</color>{record.ManufacturerName}";
|
||||
}
|
||||
else
|
||||
{
|
||||
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()
|
||||
{
|
||||
UIManager.ShowConfirm("Upload", "Upload the local record?", () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
MapInterruptRecordApi service = new MapInterruptRecordApi();
|
||||
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);
|
||||
}
|
||||
DeleteLocalRecord(true);
|
||||
//删除文件
|
||||
UIManager.CloseConfirm();
|
||||
});
|
||||
}
|
||||
void GoDelete()
|
||||
|
||||
@ -264,7 +264,7 @@ public class ResultListController : PFUIPanel
|
||||
{
|
||||
if (Directory.Exists(item))
|
||||
{
|
||||
var d = new DirectoryInfo(item);
|
||||
//var d = new DirectoryInfo(item);
|
||||
//var createTime = d.CreationTime;//create time
|
||||
//var newTime = createTime.AddSeconds(30D);
|
||||
//if (newTime < DateTime.Now)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user