日志包

This commit is contained in:
CaiYanPeng 2022-06-02 15:52:10 +08:00
parent 71c9907c89
commit d498dd9148
6 changed files with 52 additions and 25 deletions

View File

@ -218,6 +218,7 @@ public static class App
{"http://192.168.0.101:5083/","http://pfweb.juze.pro/" } {"http://192.168.0.101:5083/","http://pfweb.juze.pro/" }
}; };
public static List<string> cacheList = new List<string>();
static App() static App()
{ {
InitLanguage(); InitLanguage();
@ -234,7 +235,7 @@ public static class App
//Host = "http://192.168.0.101:5087/"; //Host = "http://192.168.0.101:5087/";
//UdpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.97"), 11000); //UdpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.97"), 11000);
//TcpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.102"), 21001); //TcpAddress = new IPEndPoint(IPAddress.Parse("192.168.0.102"), 21001);
//Debug.unityLogger.logEnabled = false; Debug.unityLogger.logEnabled = false;
#else #else
//Host = "http://pf.juze.pro/"; //Host = "http://pf.juze.pro/";
//Host = "http://192.168.0.101:5087/"; //Host = "http://192.168.0.101:5087/";

View File

@ -127,8 +127,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
//} //}
var output = ""; var output = "";
output += "收到消息:" + string.Join("\t", data); output += "收到消息:" + string.Join("\t", data);
Debug.Log(output);
this.Flags = (RowerDataFlag)BitConverter.ToUInt16(data, 0); this.Flags = (RowerDataFlag)BitConverter.ToUInt16(data, 0);
int b = 2; int b = 2;
if (!this.MoreDataFlag) if (!this.MoreDataFlag)
@ -156,6 +155,10 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
{ {
var vvv = BitConvertHelper.ToUInt24(data, (int)b); var vvv = BitConvertHelper.ToUInt24(data, (int)b);
output += $" 总距离{ vvv }米"; output += $" 总距离{ vvv }米";
if (vvv < 10)
{
App.cacheList.Add(DateTime.Now.ToString() + ":" + output);
}
b += this.SizeOfDataForFlag(RowerDataFlag.TotalDistance); b += this.SizeOfDataForFlag(RowerDataFlag.TotalDistance);
this.TotalDistance = vvv; this.TotalDistance = vvv;
@ -258,7 +261,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
} }
pullList.Add(pull); pullList.Add(pull);
} }
Debug.Log("拉力:" + string.Join(",",list)); //Debug.Log("拉力:" + string.Join(",",list));
} }
} }
List<ushort> pullList; List<ushort> pullList;
@ -267,7 +270,7 @@ namespace Assets.Scripts.Devices.Ble.Characteristic
this.StrokeRate = 0; this.StrokeRate = 0;
this.StrokeCount = 0; this.StrokeCount = 0;
this.AverageStrokeRate = 0; this.AverageStrokeRate = 0;
this.TotalDistance = 0; //this.TotalDistance = 0;
this.InstantaneousPace = 0; this.InstantaneousPace = 0;
this.AveragePace = 0; this.AveragePace = 0;
this.InstantaneousPower = 0; this.InstantaneousPower = 0;

View File

@ -188,6 +188,7 @@ namespace Assets.Scripts.Devices.Ble.Devices
if (this.controlPointCharacteristic != null) if (this.controlPointCharacteristic != null)
{ {
Debug.Log("发送重置命令" + this.controlPointCharacteristic.ToString()); Debug.Log("发送重置命令" + this.controlPointCharacteristic.ToString());
App.cacheList.Add(DateTime.Now.ToString() + ":发送重置命令" + this.controlPointCharacteristic.ToString());
hwInterface.WriteCharacteristic(this.controlPointCharacteristic, new byte[] { 0x01 }); hwInterface.WriteCharacteristic(this.controlPointCharacteristic, new byte[] { 0x01 });
} }
} }

View File

@ -256,6 +256,7 @@ public class RowerHomeScript : PFUIPanel
}, false); }, false);
var c2 = new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/RowerNew/记录"), () => var c2 = new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/RowerNew/记录"), () =>
{ {
if (checkRowing()) return;
UIManager.ShowResultListPanel(); UIManager.ShowResultListPanel();
}, false); }, false);
btnStart = transform.Find("MainNav-mobile/Custom2").gameObject; btnStart = transform.Find("MainNav-mobile/Custom2").gameObject;
@ -314,9 +315,26 @@ public class RowerHomeScript : PFUIPanel
bottom.Find("Expected/Title").GetComponent<Text>().text = $"{App.GetLocalString("EST")}{dw}"; bottom.Find("Expected/Title").GetComponent<Text>().text = $"{App.GetLocalString("EST")}{dw}";
} }
} }
private void DeleteCacheDir()
{
//删除实时记录
try
{
var dir = $"{PFConstants.RowerRecordCacheFolder}/{App.CurrentUser.Id}/";
if (Directory.Exists(dir))
{
Helper.DelectDir(dir);
//Directory.Delete(dir, true);
}
}
catch (Exception e)
{
Debug.LogError(e.ToString());
}
}
private void Discard() private void Discard()
{ {
openTimer = false;
if (Application.internetReachability == NetworkReachability.NotReachable) if (Application.internetReachability == NetworkReachability.NotReachable)
{ {
transform.Find("Stopped").gameObject.SetActive(true); transform.Find("Stopped").gameObject.SetActive(true);
@ -324,8 +342,9 @@ public class RowerHomeScript : PFUIPanel
return; return;
} }
transform.Find("Stopped").gameObject.SetActive(false); transform.Find("Stopped").gameObject.SetActive(false);
openTimer = false;
isPause = true; isPause = true;
DeleteCacheDir();
historyTime = 0;
if (C2RowerData.IsEnabled == true) if (C2RowerData.IsEnabled == true)
{ {
Utils.showToast(null, "Press \"Menu\" to save.", int.MaxValue, stopFunc: () => C2RowerData.isReadyStatus, endCallback: Init); Utils.showToast(null, "Press \"Menu\" to save.", int.MaxValue, stopFunc: () => C2RowerData.isReadyStatus, endCallback: Init);
@ -479,6 +498,7 @@ public class RowerHomeScript : PFUIPanel
{ {
File.Delete(files[0]); File.Delete(files[0]);
} }
DeleteCacheDir();
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -572,14 +592,14 @@ public class RowerHomeScript : PFUIPanel
private void Init() private void Init()
{ {
print("初始化"); print("初始化");
if (RowerData != null)
{
RowerData.Reset();
}
if (Rower != null) if (Rower != null)
{ {
Rower.Reset(); Rower.Reset();
} }
if (RowerData != null)
{
RowerData.Reset();
}
GetComponent<RowerMultiModeScript>().GetShadowList(rowerType, reRowData); GetComponent<RowerMultiModeScript>().GetShadowList(rowerType, reRowData);
btnStart.tag = "Start"; btnStart.tag = "Start";
btnStart.GetComponent<Image>().sprite = spriteDict["Start"]; btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
@ -936,11 +956,7 @@ public class RowerHomeScript : PFUIPanel
if (!string.IsNullOrEmpty(_re)) if (!string.IsNullOrEmpty(_re))
{ {
var datas = _re.Split(','); var datas = _re.Split(',');
historyStrokeCount = int.Parse(datas[0]);
historyDistance = int.Parse(datas[2]);
historyTime = int.Parse(datas[10]); historyTime = int.Parse(datas[10]);
seconds = historyTime;
historyEnergy = int.Parse(datas[8]);
var historyRowerType = PlayerPrefs.GetString("historyRowerType"); var historyRowerType = PlayerPrefs.GetString("historyRowerType");
if (!string.IsNullOrEmpty(historyRowerType)) if (!string.IsNullOrEmpty(historyRowerType))
{ {
@ -948,6 +964,11 @@ public class RowerHomeScript : PFUIPanel
rowerType = new RowerType() { type = int.Parse(typeObject[0]), value = float.Parse(typeObject[1]) }; rowerType = new RowerType() { type = int.Parse(typeObject[0]), value = float.Parse(typeObject[1]) };
HandleSelectType(); HandleSelectType();
} }
historyTime = int.Parse(datas[10]);
historyStrokeCount = int.Parse(datas[0]);
historyDistance = int.Parse(datas[2]);
seconds = historyTime;
historyEnergy = int.Parse(datas[8]);
} }
} }
Helper.DelectDir(dir); Helper.DelectDir(dir);
@ -977,6 +998,7 @@ public class RowerHomeScript : PFUIPanel
Directory.CreateDirectory(dir); Directory.CreateDirectory(dir);
} }
File.WriteAllText(path, string.Join("\r\n", records)); File.WriteAllText(path, string.Join("\r\n", records));
File.WriteAllText($"{PFConstants.RowerRecordCacheFolder}/cache.txt", string.Join("\r\n", App.cacheList));
PlayerPrefs.SetString("historyRowerType", $"{rowerType.type},{rowerType.value}"); PlayerPrefs.SetString("historyRowerType", $"{rowerType.type},{rowerType.value}");
} }
catch (Exception e) catch (Exception e)
@ -1010,10 +1032,10 @@ public class RowerHomeScript : PFUIPanel
float curTime = 0f; float curTime = 0f;
void PaintPullCurve(ushort y) void PaintPullCurve(ushort y)
{ {
if (curTime-preTime < 0.1f) //if (y!=0 && curTime-preTime < 0.1f)
{ //{
return; // return;
} //}
preTime = curTime; preTime = curTime;
Debug.Log("收到拉力" + y + ","+ DateTime.Now.Ticks); Debug.Log("收到拉力" + y + ","+ DateTime.Now.Ticks);
//#if !UNITY_EDITOR //#if !UNITY_EDITOR
@ -1153,9 +1175,9 @@ public class RowerHomeScript : PFUIPanel
var power = RowerData.InstantaneousPower; var power = RowerData.InstantaneousPower;
var rate = RowerData.StrokeRate; var rate = RowerData.StrokeRate;
var pace = RowerData.InstantaneousPace; var pace = RowerData.InstantaneousPace;
var strokeCount = RowerData.StrokeCount; var strokeCount = RowerData.StrokeCount + historyStrokeCount;
var distance = (int)RowerData.TotalDistance; var distance = (int)RowerData.TotalDistance + historyDistance;
var energy = RowerData.TotalEnergy; var energy = RowerData.TotalEnergy + historyEnergy;
var heartRate = HeartRate ?? 0; var heartRate = HeartRate ?? 0;
if (rowerType.type == 1 && totalDistance >=rowerType.value && !createTime.HasValue) if (rowerType.type == 1 && totalDistance >=rowerType.value && !createTime.HasValue)
{ {

View File

@ -13,7 +13,7 @@
</packages> </packages>
<files /> <files />
<settings> <settings>
<setting name="androidAbis" value="armeabi-v7a" /> <setting name="androidAbis" value="arm64-v8a,armeabi-v7a" />
<setting name="bundleId" value="com.ZhiXingPai.PowerFunUnity" /> <setting name="bundleId" value="com.ZhiXingPai.PowerFunUnity" />
<setting name="explodeAars" value="True" /> <setting name="explodeAars" value="True" />
<setting name="gradleBuildEnabled" value="True" /> <setting name="gradleBuildEnabled" value="True" />

View File

@ -256,7 +256,7 @@ PlayerSettings:
clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea clonedFromGUID: c0afd0d1d80e3634a9dac47e8a0426ea
templatePackageId: com.unity.template.3d@4.2.8 templatePackageId: com.unity.template.3d@4.2.8
templateDefaultScene: Assets/Scenes/SampleScene.unity templateDefaultScene: Assets/Scenes/SampleScene.unity
AndroidTargetArchitectures: 1 AndroidTargetArchitectures: 3
AndroidSplashScreenScale: 0 AndroidSplashScreenScale: 0
androidSplashScreen: {fileID: 0} androidSplashScreen: {fileID: 0}
AndroidKeystoreName: '{inproject}: Assets/Plugins/Android/powerfun.keystore' AndroidKeystoreName: '{inproject}: Assets/Plugins/Android/powerfun.keystore'
@ -868,7 +868,7 @@ PlayerSettings:
platformArchitecture: platformArchitecture:
iPhone: 1 iPhone: 1
scriptingBackend: scriptingBackend:
Android: 0 Android: 1
Standalone: 0 Standalone: 0
il2cppCompilerConfiguration: il2cppCompilerConfiguration:
Standalone: 0 Standalone: 0