using Assets.Scenes.Ride.Scripts;
using Assets.Scripts;
using Assets.Scripts.Apis.Models;
using Assets.Scripts.Ble.Service;
using Assets.Scripts.Devices;
using Assets.Scripts.Devices.Ant;
using Assets.Scripts.Devices.Ant.Interfaces;
using Assets.Scripts.Devices.Ble;
using Assets.Scripts.Devices.Ble.Characteristic;
using Assets.Scripts.Devices.Ble.Devices;
using Assets.Scripts.Devices.Ble.Interfaces;
using ChartAndGraph;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
using static RowerTaskPanel;
public class RowerHomeScript : PFUIPanel
{
private class TempRowerCalc
{
public int power { get; set; }
public ushort pace { get; set; }
public uint rate { get; set; }
public int heartRate { get; set; }
public int energy { get; set; }
public int distance { get; set; }
public int strokeCount { get; set; }
}
///
/// 划船机数据
///
private IRowerCommonData RowerData
{
get
{
return Rower != null ? (C2RowerData.IsEnabled == true ? (IRowerCommonData)(Rower.c2RowerData) : (IRowerCommonData)(Rower.rowerData)) : null;
//var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected) && d.Sensor == SensorType.Rower);
//if (device != null)
//{
// return ((IRowerDevice)device).rowerData;
//}
//return null;
}
}
protected override void OnDestroy()
{
Debug.Log("銷毀");
if (RowerData != null)
{
RowerData.PullChanged -= PaintPullCurve;
RowerData.StartEvent -= StartFunc;
RowerData.RowerResChanged -= ResChanged;
}
C2RowerData.EnableChanged -= ModeChanged;
}
private IRowerDevice Rower
{
get
{
var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && d.Sensor == SensorType.Rower);
if (device != null)
{
return (IRowerDevice)device;
}
return null;
}
}
///
/// 心率数据
///
private int? HeartRate
{
get
{
var device = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && d.Sensor == SensorType.HeartRate);
if (device != null)
{
return ((IHeartRateDevice)device).HeartRate;
}
return null;
}
}
GameObject btnStart;
Transform left, bottom, mid,rmydata;
float timer = 1.0f;
List pullList, historyPullList;
public Dictionary