划船机暂存
This commit is contained in:
1 parent
1c73701e73
commit
c73545d912
164 files changed
+38281
-2181
No files matched your search
@@ -13,6 +13,9 @@ public class Confirm : PFUIPanel
|
||||
private PFUIText _content;
|
||||
private PfUIButton _ok;
|
||||
private UnityAction _callback;
|
||||
|
||||
public UnityAction _cancelCallback;
|
||||
|
||||
private PfUIButton _cancel;
|
||||
protected override void Awake()
|
||||
{
|
||||
@@ -47,6 +50,10 @@ public class Confirm : PFUIPanel
|
||||
});
|
||||
UIManager.AddEvent(_cancel.gameObject, EventTriggerType.PointerClick, (e) =>
|
||||
{
|
||||
if (_cancelCallback != null)
|
||||
{
|
||||
_cancelCallback();
|
||||
}
|
||||
this.Close();
|
||||
});
|
||||
}
|
||||
@@ -57,7 +64,7 @@ public class Confirm : PFUIPanel
|
||||
|
||||
}
|
||||
|
||||
public void Set(string title, string content, UnityAction callback)
|
||||
public void Set(string title, string content, UnityAction callback,UnityAction cancelCallback)
|
||||
{
|
||||
//if(text == null)
|
||||
//{
|
||||
@@ -67,6 +74,7 @@ public class Confirm : PFUIPanel
|
||||
_title.Text = title;
|
||||
_content.Text = content;
|
||||
_callback = callback;
|
||||
_cancelCallback = cancelCallback;
|
||||
}
|
||||
|
||||
public void SetType(int type)
|
||||
|
||||
@@ -175,7 +175,10 @@ public class ConnectDeviceModal : PFUIPanel
|
||||
devices = App.MainDeviceAdapter.GetDevices().Where(d => d.Sensor == SensorType || (d is ISpeedDevice && d.State == DeviceState.Connected)).OrderBy(d => d.Priority).ToList();
|
||||
break;
|
||||
case SensorType.Trainer:
|
||||
devices = App.MainDeviceAdapter.GetDevices().Where(d => d.Sensor == SensorType).ToList();
|
||||
devices = App.MainDeviceAdapter.GetDevices().Where(d => d.Sensor == SensorType && d is ITrainerDevice).ToList();
|
||||
break;
|
||||
case SensorType.Rower:
|
||||
devices = App.MainDeviceAdapter.GetDevices().Where(d => d.Sensor == SensorType && d is IRowerDevice).ToList();
|
||||
break;
|
||||
case SensorType.VirtualPower:
|
||||
break;
|
||||
|
||||
@@ -13,12 +13,13 @@ using Assets.Scripts;
|
||||
using DG.Tweening;
|
||||
using Assets.Scripts.UI.Prefab.Device;
|
||||
using Assets.Scripts.Devices;
|
||||
using Assets.Scripts.Devices.Ble;
|
||||
|
||||
public class DeviceView : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private SensorType mType;
|
||||
|
||||
|
||||
private SensorType SensorType
|
||||
{
|
||||
get
|
||||
@@ -162,7 +163,7 @@ public class DeviceView : MonoBehaviour
|
||||
{
|
||||
if (SensorType == SensorType.Power)
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Power_0");
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Power_1");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Power_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Power_4");
|
||||
|
||||
@@ -170,7 +171,7 @@ public class DeviceView : MonoBehaviour
|
||||
}
|
||||
else if (SensorType == SensorType.Speed)
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Speed_0");
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Speed_1");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Speed_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Speed_4");
|
||||
|
||||
@@ -178,7 +179,7 @@ public class DeviceView : MonoBehaviour
|
||||
}
|
||||
else if (SensorType == SensorType.Cadence || SensorType == SensorType.SpeedCadence)
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Cadence_0");
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Cadence_1");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Cadence_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Cadence_4");
|
||||
|
||||
@@ -186,18 +187,24 @@ public class DeviceView : MonoBehaviour
|
||||
}
|
||||
else if (SensorType == SensorType.HeartRate)
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Heart Rate_0");
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Heart Rate_1");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Heart Rate_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Heart Rate_4");
|
||||
|
||||
powerUnit.text = "BPM";
|
||||
}
|
||||
else if(SensorType == SensorType.Trainer)
|
||||
else if (SensorType == SensorType.Trainer)
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Trainer_0");
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Trainer_1");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Trainer_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Trainer_4");
|
||||
}
|
||||
else if (SensorType == SensorType.Rower)
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Rower/设备 - 划船机 - 未连接");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Rower/设备 - 划船机 - 未连接");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Rower/设备 - 划船机");
|
||||
}
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
@@ -304,10 +311,7 @@ public class DeviceView : MonoBehaviour
|
||||
//}
|
||||
});
|
||||
DeviceCache.Add(connectedDevice);
|
||||
|
||||
Debug.Log("connected");
|
||||
|
||||
|
||||
}
|
||||
|
||||
logo.sprite = sprite3;
|
||||
@@ -351,6 +355,8 @@ public class DeviceView : MonoBehaviour
|
||||
return "Speed Meter";
|
||||
case SensorType.Trainer:
|
||||
return "Smart Trainer";
|
||||
case SensorType.Rower:
|
||||
return "Rower Machine";
|
||||
case SensorType.VirtualPower:
|
||||
break;
|
||||
default:
|
||||
@@ -424,6 +430,8 @@ public class DeviceView : MonoBehaviour
|
||||
return item;
|
||||
case SensorType.Speed:
|
||||
return devices.FirstOrDefault(d => d is ISpeedDevice);
|
||||
case SensorType.Rower:
|
||||
return devices.FirstOrDefault(d => d.Sensor == SensorType.Rower);
|
||||
case SensorType.Trainer:
|
||||
var item3 = devices.FirstOrDefault(d => d.Sensor == SensorType.Trainer);
|
||||
return item3;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
@@ -50,6 +51,14 @@ public class MainNav : MonoBehaviour
|
||||
});
|
||||
}
|
||||
|
||||
public void HideDevice()
|
||||
{
|
||||
if (transform.Find("Device"))
|
||||
{
|
||||
transform.Find("Device").gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@@ -64,7 +73,13 @@ public class MainNav : MonoBehaviour
|
||||
|
||||
public void ShowExit()
|
||||
{
|
||||
exit.SetActive(true);
|
||||
home.SetActive(false);
|
||||
if (exit)
|
||||
{
|
||||
exit.SetActive(true);
|
||||
}
|
||||
if (home)
|
||||
{
|
||||
home.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,14 @@ public class HomeController : PFUIPanel
|
||||
UIManager.ShowUserInfoPanel();
|
||||
//UIManager.ShowConfirm("Quit", "Do you want to quit PowerFun?", null);
|
||||
});
|
||||
if (transform.Find("Other/BtnRower"))
|
||||
{
|
||||
UIManager.AddEvent(transform.Find("Other/BtnRower").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowRowerPanel();
|
||||
});
|
||||
}
|
||||
|
||||
//GetSummary();
|
||||
dict = new Dictionary<string, Sprite[]>
|
||||
{
|
||||
|
||||
@@ -0,0 +1,347 @@
|
||||
using Assets.Scenes.Ride.Scripts;
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
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 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;
|
||||
|
||||
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; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 划船机数据
|
||||
/// </summary>
|
||||
private FtmsRowerData RowerData
|
||||
{
|
||||
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).rowerData;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 心率数据
|
||||
/// </summary>
|
||||
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;
|
||||
float timer = 1.0f;
|
||||
EventHandler PaintPullCurveDelegate;
|
||||
List<DoubleVector2> pullList = new List<DoubleVector2>();
|
||||
Dictionary<object, Sprite> spriteDict;
|
||||
List<string> records;
|
||||
List<TempRowerCalc> values;
|
||||
DateTime startTime,createTime;
|
||||
double Kj = 0;
|
||||
protected override void Awake()
|
||||
{
|
||||
spriteDict = new Dictionary<object, Sprite>()
|
||||
{
|
||||
{"Start",Resources.Load<Sprite>("Images/Rower/System_play")},
|
||||
{"Untagged",Resources.Load<Sprite>("Images/Rower/System_pause")},
|
||||
{0,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0001") },
|
||||
{1,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0002") },
|
||||
{2,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0003") },
|
||||
{3,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0004") },
|
||||
{4,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0005") },
|
||||
{5,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0006") },
|
||||
{6,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0007") },
|
||||
{7,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0008") },
|
||||
{8,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0009") },
|
||||
{9,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0010") },
|
||||
{10,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0011") },
|
||||
{11,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0012") },
|
||||
{12,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0013") },
|
||||
{13,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0014") },
|
||||
{14,Resources.Load<Sprite>("Images/Rower/序列帧/划船机0015") },
|
||||
};
|
||||
GetComponent<RectTransform>().localScale = Vector3.one;
|
||||
GetComponent<RectTransform>().localPosition = Vector3.zero;
|
||||
var mainNav = this.transform.Find("MainNav").GetComponent<MainNav>();
|
||||
mainNav.ShowExit();
|
||||
mainNav.HideDevice();
|
||||
var btnHome = transform.Find("Other/BtnHome").gameObject;
|
||||
UIManager.AddEvent(btnHome, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => ReturnHome());
|
||||
btnStart = transform.Find("Other1/BtnStart").gameObject;
|
||||
UIManager.AddEvent(btnStart, UnityEngine.EventSystems.EventTriggerType.PointerClick, b => HandleStartOrPause());
|
||||
left = transform.Find("Left");
|
||||
bottom = transform.Find("Bottom");
|
||||
PaintPullCurveDelegate = new EventHandler(PaintPullCurve);
|
||||
Init();
|
||||
}
|
||||
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
Init();
|
||||
//transform.Find("Left/Rower").GetComponent<RowerAnimation>().StartAnimation();
|
||||
}
|
||||
private void HandleStartOrPause()
|
||||
{
|
||||
//UIManager.ShowRowerResult();
|
||||
//return;
|
||||
if (btnStart.CompareTag("Start"))
|
||||
{
|
||||
if (RowerData == null)
|
||||
{
|
||||
Utils.showToast(null, "Please connect the device!");
|
||||
return;
|
||||
}
|
||||
if (RowerData != null)
|
||||
{
|
||||
RowerData.PullChanged += PaintPullCurveDelegate;
|
||||
}
|
||||
btnStart.GetComponent<Image>().sprite = spriteDict["Untagged"];
|
||||
startTime = UIManager.Now.GetDateTime();
|
||||
TimerTicks();
|
||||
openTimer = true;
|
||||
timer = 1.0f;
|
||||
btnStart.tag = "Untagged";
|
||||
}
|
||||
else
|
||||
{
|
||||
UIManager.ShowConfirm("Quit", "Do you want to keep the record?", () =>
|
||||
{
|
||||
UIManager.CloseConfirm();
|
||||
Save();
|
||||
Init();
|
||||
},cancel:()=>
|
||||
{
|
||||
Init();
|
||||
});
|
||||
}
|
||||
Debug.Log(RowerData);
|
||||
//StartCoroutine();
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
createTime = UIManager.Now.GetDateTime();
|
||||
var bleDevice = App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && d.Sensor == SensorType.Rower) as BleDevice;
|
||||
RowerRecordModel model = new RowerRecordModel();
|
||||
model.Ticks = records.Count;
|
||||
if (bleDevice != null)
|
||||
{
|
||||
model.ManufacturerName = bleDevice.Name + " " + bleDevice.Network + " " + bleDevice.Sensor;
|
||||
model.DeviceNumber = $"{ bleDevice.Address },{ bleDevice.Sensor }";
|
||||
}
|
||||
model.Id = Guid.NewGuid().ToString();
|
||||
model.Weight = App.CurrentUser.Weight;
|
||||
model.Kj = RowerData.TotalEnergy;
|
||||
model.StartTime = startTime;
|
||||
model.CreateTime = createTime;
|
||||
Debug.Log(values.Count);
|
||||
if (values.Count > 0)
|
||||
{
|
||||
model.MaxPower = values.Max(x => x.power);
|
||||
model.MaxPace = values.Min(x => x.pace);
|
||||
model.MaxRate = values.Max(x => x.rate);
|
||||
model.MaxHeartRate = values.Max(x => x.heartRate);
|
||||
model.AvgPower = values.Average(x => x.power);
|
||||
model.AvgPace = values.Average(x => x.pace);
|
||||
model.AvgRate = values.Average(x => x.rate);
|
||||
model.AvgHeartRate = (int)values.Average(x => x.heartRate);
|
||||
}
|
||||
model.StrokeCount = RowerData.StrokeCount;
|
||||
model.TotalTime = RowerData.ElapsedTime;
|
||||
model.TotalDistance = RowerData.TotalDistance;
|
||||
var path = PFConstants.RowerRecordFolder + "/" + model.Id;
|
||||
Helper.CreateDirectoryIfNotExsit(path);
|
||||
var files = new List<string>();
|
||||
try
|
||||
{
|
||||
var fname = path + "/" + model.Id + ".txt";
|
||||
using (var fs = new FileInfo(fname).OpenWrite())
|
||||
{
|
||||
var stream = new StreamWriter(fs);
|
||||
stream.BaseStream.Seek(0, SeekOrigin.End);
|
||||
foreach (var item in records)
|
||||
{
|
||||
stream.Write(item + "\r\n");
|
||||
}
|
||||
stream.Flush();
|
||||
stream.Close();
|
||||
files.Add(fname);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Helper.DelectDir(path);
|
||||
Debug.Log(ex.Message);
|
||||
}
|
||||
UIManager.ShowRowerWelldone(model);
|
||||
Task.Run(()=>
|
||||
{
|
||||
var res = ConfigHelper.rowerApi.Add(model, files);
|
||||
});
|
||||
}
|
||||
|
||||
private void Init()
|
||||
{
|
||||
if (RowerData != null)
|
||||
{
|
||||
RowerData.PullChanged -= PaintPullCurveDelegate;
|
||||
RowerData.Reset();
|
||||
}
|
||||
btnStart.tag = "Start";
|
||||
btnStart.GetComponent<Image>().sprite = spriteDict["Start"];
|
||||
left.Find("Rower").GetComponent<Image>().sprite = spriteDict[0];
|
||||
left.Find("LeftImage/Value").GetComponent<Image>().fillAmount = 0;
|
||||
left.Find("RightImage/Value").GetComponent<Image>().fillAmount = 0;
|
||||
left.Find("Times/Value").GetComponent<Text>().text = "---";
|
||||
left.Find("Calories/Value").GetComponent<Text>().text = "---";
|
||||
pullList = new List<DoubleVector2>();
|
||||
transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
openTimer = false;
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("W/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("W/AvgValue").GetComponent<Text>().text = "---";
|
||||
bottom.Find("500/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("500/AvgValue").GetComponent<Text>().text = "---";
|
||||
bottom.Find("MS/Value").GetComponent<Text>().text = "---";
|
||||
bottom.Find("MS/AvgValue").GetComponent<Text>().text = "---";
|
||||
bottom.Find("BPM/Value").GetComponent<Text>().text = "---";
|
||||
records = new List<string>();
|
||||
values = new List<TempRowerCalc>();
|
||||
Kj = 0;
|
||||
x = 0;
|
||||
}
|
||||
private void ReturnHome()
|
||||
{
|
||||
UIManager.ShowHomePanel();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
bool openTimer = false;
|
||||
double x = 0f;
|
||||
//List<ushort> tempList = new List<ushort>()
|
||||
//{
|
||||
// 0,1,4,5,12,13,16,20,30,40,50,60,500
|
||||
//};
|
||||
//int tempx = 0;
|
||||
void TimerTicks()
|
||||
{
|
||||
//Debug.Log(123);
|
||||
//PaintPullCurve(tempList[(tempx++) % tempList.Count]);
|
||||
if (RowerData == null) return;
|
||||
|
||||
bottom.Find("Time/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(RowerData.ElapsedTime).ToString();
|
||||
bottom.Find("KM/Value").GetComponent<Text>().text = RowerData.TotalDistance.ToString();
|
||||
var power = RowerData.InstantaneousPower;
|
||||
bottom.Find("W/Value").GetComponent<Text>().text = power.ToString();
|
||||
bottom.Find("W/AvgValue").GetComponent<Text>().text = RowerData.AveragePower.ToString();
|
||||
var pace = RowerData.InstantaneousPace;
|
||||
bottom.Find("500/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(pace).ToString(@"mm\:ss");
|
||||
bottom.Find("500/AvgValue").GetComponent<Text>().text = TimeSpan.FromSeconds(RowerData.AveragePace).ToString(@"mm\:ss");
|
||||
var rate = RowerData.StrokeRate;
|
||||
bottom.Find("MS/Value").GetComponent<Text>().text = rate.ToString();
|
||||
bottom.Find("MS/AvgValue").GetComponent<Text>().text = RowerData.AverageStrokeRate.ToString();
|
||||
var heartRate = HeartRate ?? 0;
|
||||
bottom.Find("BPM/Value").GetComponent<Text>().text = heartRate.ToString();
|
||||
left.Find("Times/Value").GetComponent<Text>().text = RowerData.StrokeCount.ToString();
|
||||
left.Find("Calories/Value").GetComponent<Text>().text = RowerData.TotalEnergy.ToString();
|
||||
records.Add($"{RowerData.StrokeCount},{RowerData.ElapsedTime},{RowerData.TotalDistance},{RowerData.InstantaneousPower},{RowerData.InstantaneousPace},{RowerData.StrokeRate},{RowerData.ResistanceLevel},{heartRate}");
|
||||
values.Add(new TempRowerCalc() { pace = pace, power = power, rate = rate,heartRate = heartRate });
|
||||
//Debug.Log(1);
|
||||
}
|
||||
|
||||
|
||||
void PaintPullCurve(object sender, EventArgs e)
|
||||
{
|
||||
var ftms = (FtmsRowerData)sender;
|
||||
Debug.Log(ftms.PullValue);
|
||||
PaintPullCurve(ftms.PullValue);
|
||||
}
|
||||
void PaintPullCurve(ushort y)
|
||||
{
|
||||
if (y > 1000) y = 1000;
|
||||
//拉力条
|
||||
left.Find("LeftImage/Value").GetComponent<Image>().fillAmount = ((float)y) / 1000;
|
||||
left.Find("RightImage/Value").GetComponent<Image>().fillAmount = ((float)y) / 1000;
|
||||
//动画
|
||||
left.Find("Rower").GetComponent<Image>().sprite = spriteDict[y / 67];
|
||||
//曲线
|
||||
if (y == 0)
|
||||
{
|
||||
if (pullList.Count == 0)
|
||||
{
|
||||
x = 0;
|
||||
pullList.Add(new DoubleVector2(x, y));
|
||||
transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 0.1;
|
||||
pullList.Add(new DoubleVector2(x, y));
|
||||
transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
pullList.Clear();
|
||||
x = 0;
|
||||
pullList.Add(new DoubleVector2(x, y));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x += 0.1;
|
||||
pullList.Add(new DoubleVector2(x, y));
|
||||
transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
}
|
||||
Debug.Log($"{x},{y}");
|
||||
//transform.Find("Mid/GraphChart").GetComponent<RowerGraphChartFeed>().SetData(pullList);
|
||||
//pullList.Add(new DoubleVector2(x, y));
|
||||
//if (pullList.Count >= 75)
|
||||
//{
|
||||
// pullList.RemoveAt(0);
|
||||
// pullList = pullList.Select(val => new DoubleVector2(val.x - 0.1, val.y)).ToList();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// x += 0.1f;
|
||||
//}
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
if (openTimer)
|
||||
{
|
||||
timer -= Time.deltaTime;
|
||||
if (timer <= 0)
|
||||
{
|
||||
TimerTicks();
|
||||
timer = 1f + timer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 406120aa4593dd340844428cea64a7bc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -13,7 +13,7 @@ public class BigLeftController : MonoBehaviour
|
||||
{
|
||||
route.OnPointerExit(null);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
route.OnPointerEnter(null);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using DG.Tweening;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -14,20 +16,23 @@ public class ResultListController : PFUIPanel
|
||||
[SerializeField]Transform routeResult;
|
||||
Transform localRouteItem;
|
||||
Transform scrollContent;
|
||||
Transform routeScroll, matchScroll;
|
||||
Transform routeContent, matchContent;
|
||||
Transform btnRoute, btnMatch,searchInput;
|
||||
Transform routeScroll, matchScroll, rowerScroll;
|
||||
Transform routeContent, matchContent, rowerContent;
|
||||
Transform btnRoute, btnMatch ,btnRower, searchInput;
|
||||
Color c1, c2;
|
||||
// Start is called before the first frame update
|
||||
int pageSize = 20;
|
||||
string name = "";
|
||||
Transform[] contents,scrolls;
|
||||
Transform[] contents,scrolls,btns;
|
||||
Dictionary<int, string> filterOptionDict = new Dictionary<int, string>
|
||||
{
|
||||
{0,"routes" },{1,"competition" }
|
||||
};
|
||||
//交互用
|
||||
public Transform currentItem { get; set; }
|
||||
|
||||
int scrollIndex = 0;
|
||||
ScrollRect scroll;
|
||||
void Awake()
|
||||
{
|
||||
//ApiBase.SetCookie("73385F5F719B610D132C1ECF3E9143272BF15214D57ED91CD7A9DFD832407471535112AAEB8E9271F75D54FBBF2D99F18FA313C1EEA5676F5D722D7FBB07C926BEC5905591BF9AFDDC6336552DF273112C2DA1794E6FA2F465B11FECD2E82E52");
|
||||
@@ -40,30 +45,41 @@ public class ResultListController : PFUIPanel
|
||||
scroll = transform.Find("ListPanel").Find("Scroll").GetComponent<ScrollRect>();
|
||||
btnMatch = transform.Find("ListPanel").Find("BtnMatch");
|
||||
btnRoute = transform.Find("ListPanel").Find("BtnRoute");
|
||||
btnRower = transform.Find("ListPanel").Find("BtnRower");
|
||||
searchInput = transform.Find("ListPanel").Find("SearchInput");
|
||||
scrollContent = scroll.transform.Find("Viewport").Find("Content");
|
||||
routeScroll = scrollContent.Find("RouteList");
|
||||
routeContent = routeScroll.Find("Viewport").Find("Content");
|
||||
matchScroll = scrollContent.Find("MatchList");
|
||||
matchContent = matchScroll.Find("Viewport").Find("Content");
|
||||
contents = new Transform[] { routeContent, matchContent};
|
||||
rowerScroll = scrollContent.Find("RowerList");
|
||||
rowerContent = rowerScroll.Find("Viewport").Find("Content");
|
||||
contents = new Transform[] { routeContent, matchContent, rowerContent};
|
||||
|
||||
if (btnMatch != null)
|
||||
{
|
||||
UIManager.AddEvent(btnMatch.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
StartScroll(0);
|
||||
});
|
||||
//btnMatch.GetComponent<Button>().onClick.AddListener(() => StartScroll(0));
|
||||
}
|
||||
if (btnRoute != null)
|
||||
{
|
||||
UIManager.AddEvent(btnRoute.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
StartScroll(1);
|
||||
StartScroll(0);
|
||||
});
|
||||
//btnRoute.GetComponent<Button>().onClick.AddListener(() => StartScroll(1));
|
||||
}
|
||||
if (btnMatch != null)
|
||||
{
|
||||
UIManager.AddEvent(btnMatch.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
StartScroll(1);
|
||||
});
|
||||
//btnMatch.GetComponent<Button>().onClick.AddListener(() => StartScroll(0));
|
||||
}
|
||||
if (btnRower != null)
|
||||
{
|
||||
UIManager.AddEvent(btnRower.gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
{
|
||||
StartScroll(2);
|
||||
});
|
||||
}
|
||||
btns = new Transform[] { btnRoute,btnMatch,btnRower };
|
||||
if (searchInput != null)
|
||||
{
|
||||
UIManager.AddEvent(searchInput.Find("Button").gameObject, EventTriggerType.PointerClick, (b) =>
|
||||
@@ -88,15 +104,22 @@ public class ResultListController : PFUIPanel
|
||||
{
|
||||
UIManager.AddEvent(matchScroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
|
||||
}
|
||||
scrolls = new Transform[] { routeScroll, matchScroll };
|
||||
if (rowerScroll != null)
|
||||
{
|
||||
UIManager.AddEvent(rowerScroll.gameObject, UnityEngine.EventSystems.EventTriggerType.EndDrag, OnEndDrag);
|
||||
|
||||
}
|
||||
scrolls = new Transform[] { routeScroll, matchScroll, rowerScroll };
|
||||
//GetList(0);
|
||||
GetList(1);
|
||||
GetList(2);
|
||||
}
|
||||
|
||||
public void Load()
|
||||
{
|
||||
Debug.Log("刷新show");
|
||||
if (contents != null && contents.Length == 2)
|
||||
//Refresh(contents[0]);
|
||||
if (contents != null && contents.Length == 3)
|
||||
{
|
||||
Debug.Log("刷新show进入");
|
||||
Refresh(contents[scrollIndex]);
|
||||
@@ -151,19 +174,26 @@ public class ResultListController : PFUIPanel
|
||||
}
|
||||
Dictionary<int, bool> isEnd = new Dictionary<int, bool>
|
||||
{
|
||||
{0,false },{1,false }
|
||||
{0,false },{1,false },{2,false }
|
||||
};
|
||||
Dictionary<int, int> pageIndex = new Dictionary<int, int>
|
||||
{
|
||||
{0,0 },{1,0 }
|
||||
{0,0 },{1,0 },{2,0 }
|
||||
};
|
||||
async void GetList(int? sindex = null)
|
||||
{
|
||||
var index = sindex ?? scrollIndex;
|
||||
if (isEnd[index]) return;
|
||||
Debug.Log(sindex);
|
||||
var r = await ConfigHelper.mapInterruptRecordApi.GetMapInterruptRecord(name, pageIndex[index], 20,filterOptionDict[index]);
|
||||
|
||||
JsonResult<List<JObject>> r = null;
|
||||
if (index == 0 || index == 1)
|
||||
{
|
||||
r = await ConfigHelper.mapInterruptRecordApi.GetMapInterruptRecord(name, pageIndex[index], 20, filterOptionDict[index]);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = await ConfigHelper.rowerApi.GetList(pageIndex[index], 20);
|
||||
}
|
||||
if (r.result)
|
||||
{
|
||||
if (r.data.Count == 0)
|
||||
@@ -173,10 +203,10 @@ public class ResultListController : PFUIPanel
|
||||
isEnd[index] = true;
|
||||
scroll.transform.Find("Error").gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
//contents[index];
|
||||
if (!sindex.HasValue ||(sindex.HasValue && sindex.Value == scrollIndex))
|
||||
if (!sindex.HasValue || (sindex.HasValue && sindex.Value == scrollIndex))
|
||||
{
|
||||
scroll.transform.Find("Error").gameObject.SetActive(true);
|
||||
}
|
||||
@@ -185,25 +215,32 @@ public class ResultListController : PFUIPanel
|
||||
else
|
||||
{
|
||||
isEnd[index] = false;
|
||||
DisplayRouteResult(r.data, contents[index],index);
|
||||
DisplayRouteResult(r.data, contents[index], index);
|
||||
scroll.transform.Find("Error").gameObject.SetActive(false);
|
||||
//DisplayRouteResult(r.data, matchContent);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
}
|
||||
void DisplayRouteResult(List<RouteResult> list,Transform content,int index)
|
||||
void DisplayRouteResult(List<JObject> list,Transform content,int index)
|
||||
{
|
||||
if (routeResult != null)
|
||||
{
|
||||
foreach (var item in list)
|
||||
{
|
||||
var obj = Instantiate(routeResult);
|
||||
obj.GetComponent<RouteItem>().Initial(item, index, transform);
|
||||
if (index == 0 || index == 1)
|
||||
{
|
||||
obj.GetComponent<RouteItem>().Initial(item.ToObject<RouteResult>(), index, transform, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
obj.GetComponent<RouteItem>().Initial(item.ToObject<RowerResultModel>(), index, transform,true);
|
||||
}
|
||||
//obj.SendMessage("Initial", );
|
||||
obj.transform.parent = content;
|
||||
obj.transform.localScale = new Vector3(1, 1, 1);
|
||||
@@ -249,7 +286,7 @@ public class ResultListController : PFUIPanel
|
||||
bool startMouse = false;
|
||||
void Update()
|
||||
{
|
||||
GoScroll();
|
||||
//GoScroll();
|
||||
if (Input.GetAxis("Mouse ScrollWheel") != 0)
|
||||
{
|
||||
if (scrolls[scrollIndex].GetComponent<ScrollRect>().verticalNormalizedPosition <= 0 ||
|
||||
@@ -273,88 +310,42 @@ public class ResultListController : PFUIPanel
|
||||
}
|
||||
void StartScroll(int index)
|
||||
{
|
||||
if (startScroll) return;
|
||||
if (index == 0)
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
scrollContent.DOLocalMoveX(674*index*-1,0.3f);
|
||||
#else
|
||||
scrollContent.DOLocalMoveX(1158*index*-1,0.3f);
|
||||
#endif
|
||||
scrollIndex = index;
|
||||
for (int i = 0; i < btns.Length; i++)
|
||||
{
|
||||
//翻到比赛页,比赛按钮变白,线路按钮变灰
|
||||
scrollIndex = 1;
|
||||
startScroll = true;
|
||||
btnRoute.GetComponent<Text>().color = c2;
|
||||
btnMatch.GetComponent<Text>().color = c1;
|
||||
}
|
||||
else if (index == 1)
|
||||
{
|
||||
//反过来
|
||||
scrollIndex = 0;
|
||||
startScroll = true;
|
||||
btnRoute.GetComponent<Text>().color = c1;
|
||||
btnMatch.GetComponent<Text>().color = c2;
|
||||
}
|
||||
scroll.transform.Find("Error").gameObject.SetActive(contents[scrollIndex].childCount == 0);
|
||||
}
|
||||
#region 主页面滑动逻辑
|
||||
int scrollIndex = 0;
|
||||
bool startScroll = false;
|
||||
ScrollRect scroll;
|
||||
//private float scrollValue = 0.5f;
|
||||
int pageNums = 2;
|
||||
void GoScroll()
|
||||
{
|
||||
var index = scrollIndex;
|
||||
var scrollValue = 1f / (pageNums - 1);
|
||||
var value = index * scrollValue;
|
||||
if (scroll != null && startScroll)
|
||||
{
|
||||
if (scroll.horizontalNormalizedPosition >= value)
|
||||
if (!btns[i]) continue;
|
||||
if (i == index)
|
||||
{
|
||||
scroll.horizontalNormalizedPosition -= (scrollValue / 20);
|
||||
if (scroll.horizontalNormalizedPosition <= value)
|
||||
{
|
||||
Debug.Log(index);
|
||||
scroll.horizontalNormalizedPosition = value;
|
||||
startScroll = false;
|
||||
}
|
||||
btns[i].GetComponent<Text>().color = c1;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
scroll.horizontalNormalizedPosition += (scrollValue / 20);
|
||||
if (scroll.horizontalNormalizedPosition >= value)
|
||||
{
|
||||
Debug.Log(index);
|
||||
scroll.horizontalNormalizedPosition = value;
|
||||
startScroll = false;
|
||||
}
|
||||
btns[i].GetComponent<Text>().color = c2;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
//float scrollIndex = 0;
|
||||
//bool startScroll = false;
|
||||
//ScrollRect scroll;
|
||||
//void GoScroll()
|
||||
//{
|
||||
// float value = scrollIndex;
|
||||
// if (scroll != null && startScroll)
|
||||
// {
|
||||
// if (scrollIndex == 0)
|
||||
// {
|
||||
// scroll.horizontalNormalizedPosition -= (1f / 20);
|
||||
// if (scroll.horizontalNormalizedPosition <= 0)
|
||||
// {
|
||||
// scroll.horizontalNormalizedPosition = 0;
|
||||
// startScroll = false;
|
||||
|
||||
//if (startScroll) return;
|
||||
//if (index == 0)
|
||||
//{
|
||||
// //翻到比赛页,比赛按钮变白,线路按钮变灰
|
||||
// scrollIndex = 1;
|
||||
// startScroll = true;
|
||||
// btnRoute.GetComponent<Text>().color = c2;
|
||||
// btnMatch.GetComponent<Text>().color = c1;
|
||||
//}
|
||||
//else if (index == 1)
|
||||
//{
|
||||
// //反过来
|
||||
// scrollIndex = 0;
|
||||
// startScroll = true;
|
||||
// btnRoute.GetComponent<Text>().color = c1;
|
||||
// btnMatch.GetComponent<Text>().color = c2;
|
||||
//}
|
||||
|
||||
// }
|
||||
// }
|
||||
// else if (scrollIndex == 1)
|
||||
// {
|
||||
// scroll.horizontalNormalizedPosition += (1f / 20);
|
||||
// if (scroll.horizontalNormalizedPosition >= 1)
|
||||
// {
|
||||
// scroll.horizontalNormalizedPosition = 1;
|
||||
// startScroll = false;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using System;
|
||||
using System.Collections;
|
||||
@@ -14,6 +15,7 @@ public class RouteItem : MonoBehaviour
|
||||
#endif
|
||||
{
|
||||
RouteResult routeResult;
|
||||
RowerResultModel rowerResult;
|
||||
// Start is called before the first frame update
|
||||
Transform left,row1,row2,right,rightDot;
|
||||
Transform btnReRide, btnContinue, btnDelete;
|
||||
@@ -22,6 +24,7 @@ public class RouteItem : MonoBehaviour
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
@@ -33,18 +36,97 @@ public class RouteItem : MonoBehaviour
|
||||
int index;
|
||||
//交互用
|
||||
private Transform parent { get; set; }
|
||||
public void Initial(RouteResult result,int index,Transform parent = null)
|
||||
public void Initial(object result, int index, Transform parent = null,bool top = false)
|
||||
{
|
||||
if (parent)
|
||||
this.index = index;
|
||||
if (parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
}
|
||||
routeResult = result;
|
||||
this.index = index;
|
||||
left = transform.Find("BigLeft/Left");
|
||||
row1 = left.Find("Main").Find("Row1");
|
||||
row2 = left.Find("Main").Find("Row2");
|
||||
rightDot = transform.Find("RightDot");
|
||||
if (rightDot != null)
|
||||
{
|
||||
UIManager.AddEvent(rightDot.Find("BtnDot").gameObject, EventTriggerType.PointerClick, (b) => OnPointerEnter(null));
|
||||
UIManager.AddEvent(rightDot.Find("BtnDelete").gameObject, EventTriggerType.PointerClick, (b) => Delete());
|
||||
}
|
||||
|
||||
//right.gameObject.SetActive(true);
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
gameObject.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
Detail();
|
||||
});
|
||||
#else
|
||||
gameObject.GetComponent<Button>().enabled = false;
|
||||
#endif
|
||||
if (result is RouteResult)
|
||||
{
|
||||
Initial((RouteResult)result, index, parent);
|
||||
}
|
||||
else
|
||||
{
|
||||
Initial((RowerResultModel)result, index, parent);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 划船机初始化
|
||||
/// </summary>
|
||||
/// <param name="result"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="parent"></param>
|
||||
public void Initial(RowerResultModel result, int index, Transform parent = null)
|
||||
{
|
||||
rowerResult = result;
|
||||
row1.Find("Rank").gameObject.SetActive(false);
|
||||
row1.Find("Times").gameObject.SetActive(false);
|
||||
var raw = transform.Find("BigLeft/CoverImage").GetComponent<RawImage>();
|
||||
if (string.IsNullOrEmpty(result.Cover))
|
||||
{
|
||||
raw.texture = Resources.Load<Texture>("Images/Rower/地图1");
|
||||
}
|
||||
else
|
||||
{
|
||||
Utils.DisplayImage(raw, result.Cover, true);
|
||||
}
|
||||
row1.Find("Time").GetComponent<Text>().text = $"<color=#5c5c6e>Rowing time:</color>{TimeSpan.FromSeconds(result.TotalTime).ToString()}";
|
||||
row1.Find("Distance").GetComponent<Text>().text = $"<color=#5c5c6e>Distance:</color>{result.TotalDistance}M";
|
||||
row2.Find("Device").GetComponent<Text>().text = $"<color=#5c5c6e>Rowing equipment:</color>{result.ManufacturerName}";
|
||||
left.Find("Progress").gameObject.SetActive(false);
|
||||
left.Find("Main/Name").GetComponent<Text>().text = "Free rowing";
|
||||
left.Find("Main/Time").GetComponent<Text>().text = $"{result.StartTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")} ~ {result.CreateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}";
|
||||
var rect = left.Find("Main").GetComponent<RectTransform>();
|
||||
rect.sizeDelta = new Vector2(399,rect.sizeDelta.y);
|
||||
SetButtonColor(false);
|
||||
right = transform.Find("RightRower");
|
||||
if (right != null)
|
||||
{
|
||||
btnDetail = right.Find("BtnDetail");
|
||||
if (btnDetail)
|
||||
{
|
||||
UIManager.AddEvent(btnDetail.gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowRowerResult(result.Id);
|
||||
});
|
||||
}
|
||||
btnReRide = right.Find("BtnRide");
|
||||
if (btnReRide)
|
||||
{
|
||||
UIManager.AddEvent(btnReRide.gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
UIManager.ShowRowerPanel();
|
||||
});
|
||||
}
|
||||
}
|
||||
//UIManager.AddEvent(transform.gameObject, EventTriggerType.PointerClick, b => UIManager.ShowRowerResult(result.Id));
|
||||
}
|
||||
|
||||
public void Initial(RouteResult result,int index,Transform parent = null)
|
||||
{
|
||||
routeResult = result;
|
||||
|
||||
Utils.DisplayImage(transform.Find("BigLeft/CoverImage").GetComponent<RawImage>(), result.RouteImage, true);
|
||||
|
||||
left.Find("Main").Find("Name").GetComponent<Text>().text = result.RouteName;
|
||||
@@ -107,22 +189,7 @@ public class RouteItem : MonoBehaviour
|
||||
SetButtonColor(false);
|
||||
transform.Find("Right").gameObject.SetActive(false);
|
||||
}
|
||||
rightDot = transform.Find("RightDot");
|
||||
if (rightDot != null)
|
||||
{
|
||||
UIManager.AddEvent(rightDot.Find("BtnDot").gameObject, EventTriggerType.PointerClick, (b) => OnPointerEnter(null));
|
||||
UIManager.AddEvent(rightDot.Find("BtnDelete").gameObject, EventTriggerType.PointerClick, (b) => Delete());
|
||||
}
|
||||
|
||||
//right.gameObject.SetActive(true);
|
||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||
gameObject.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
Detail();
|
||||
});
|
||||
#else
|
||||
gameObject.GetComponent<Button>().enabled = false;
|
||||
#endif
|
||||
|
||||
}
|
||||
void Detail()
|
||||
{
|
||||
@@ -148,13 +215,21 @@ public class RouteItem : MonoBehaviour
|
||||
{
|
||||
UIManager.ShowConfirm("Delete", "Delete this record?", async () =>
|
||||
{
|
||||
var r = await ConfigHelper.mapApi.DeleteRecord(routeResult.Id);
|
||||
JsonResult<object> r = null;
|
||||
if (index != 2)
|
||||
{
|
||||
r = await ConfigHelper.mapApi.DeleteRecord(routeResult.Id);
|
||||
}
|
||||
else
|
||||
{
|
||||
r = await ConfigHelper.rowerApi.Delete(rowerResult.Id);
|
||||
}
|
||||
UIManager.CloseConfirm();
|
||||
if (r.result)
|
||||
{
|
||||
DestroyImmediate(gameObject);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
Utils.showToast(gameObject, r.errMsg);
|
||||
}
|
||||
@@ -245,6 +320,7 @@ public class RouteItem : MonoBehaviour
|
||||
{
|
||||
if (!f)
|
||||
{
|
||||
transform.Find("RightRower").gameObject.SetActive(false);
|
||||
transform.Find("Right").gameObject.SetActive(false);
|
||||
transform.Find("RightMatch").gameObject.SetActive(false);
|
||||
transform.Find("RightDot").gameObject.SetActive(true);
|
||||
@@ -262,6 +338,7 @@ public class RouteItem : MonoBehaviour
|
||||
}
|
||||
|
||||
transform.Find("RightMatch").gameObject.SetActive(index == 1);
|
||||
transform.Find("RightRower").gameObject.SetActive(index == 2);
|
||||
transform.Find("RightDot").gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 879e9656cc32a33448968cc1f71e5e10
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,81 @@
|
||||
using DG.Tweening;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RowerAnimation : PFUIPanel
|
||||
{
|
||||
List<Sprite> sprites;
|
||||
Image image;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
sprites = new List<Sprite>();
|
||||
for (int i = 1; i < 26; i++)
|
||||
{
|
||||
sprites.Add(Resources.Load<Sprite>($"Images/Rower/序列帧/划船机{i.ToString("0000")}"));
|
||||
}
|
||||
image = transform.GetComponent<Image>();
|
||||
}
|
||||
|
||||
protected override void Start()
|
||||
{
|
||||
|
||||
//time = 0;
|
||||
|
||||
}
|
||||
int index = 0;
|
||||
//float time = 0;
|
||||
public override void Show()
|
||||
{
|
||||
//base.Show();
|
||||
|
||||
//index = 0;
|
||||
////time = 0;
|
||||
|
||||
//StartCoroutine(Animation());
|
||||
}
|
||||
public void StartAnimation()
|
||||
{
|
||||
index = 0;
|
||||
StartCoroutine(Animation());
|
||||
}
|
||||
|
||||
IEnumerator Animation()
|
||||
{
|
||||
for (; ; )
|
||||
{
|
||||
if (index % 25 == 0)
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
image.sprite = sprites[index];
|
||||
index++;
|
||||
yield return new WaitForSeconds(0.08f);
|
||||
}
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
//time += Time.deltaTime;
|
||||
//if (time < 0.03)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
//time = 0;
|
||||
//if (index % 79 == 0)
|
||||
//{
|
||||
// index = 0;
|
||||
//}
|
||||
//image.sprite = sprites[index];
|
||||
//index++;
|
||||
}
|
||||
|
||||
public override void Close()
|
||||
{
|
||||
StopCoroutine(Animation());
|
||||
base.Close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e84219e49caa1f46be9f0277fd3b7c5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,448 @@
|
||||
using Assets.Scripts.Devices.Ant;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Events;
|
||||
using Assets.Scripts.Devices.Ant.Interfaces;
|
||||
using Assets.Scripts.UI.UIEffect;
|
||||
using Assets.Scripts;
|
||||
using DG.Tweening;
|
||||
using Assets.Scripts.UI.Prefab.Device;
|
||||
using Assets.Scripts.Devices;
|
||||
using Assets.Scripts.Devices.Ble;
|
||||
|
||||
public class RowerDeviceView : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private SensorType mType;
|
||||
|
||||
private SensorType SensorType
|
||||
{
|
||||
get
|
||||
{
|
||||
//Debug.Log(mType);
|
||||
//Enum.TryParse(mType, out SensorType sensorType);
|
||||
return mType;
|
||||
}
|
||||
}
|
||||
|
||||
private GameObject mSearchButton;
|
||||
private GameObject mPairButton;
|
||||
private GameObject mDisconnectButton;
|
||||
private GameObject unconnectionPanel;
|
||||
private GameObject connectionPanel;
|
||||
private Text searchState;
|
||||
private ConnectDeviceModal deviceModal;
|
||||
private Text title;
|
||||
private Text noDevice;
|
||||
private Text powerValue;
|
||||
private Text powerUnit;
|
||||
//private Text cadenceValue;
|
||||
//private Text speedValue;
|
||||
//private Text heartRateValue;
|
||||
private Image logo;
|
||||
/// <summary>
|
||||
/// 没有设备的logo
|
||||
/// </summary>
|
||||
private Sprite sprite0;
|
||||
/// <summary>
|
||||
/// 连接中的logo
|
||||
/// </summary>
|
||||
private Sprite sprite1;
|
||||
/// <summary>
|
||||
/// 已连接的logo
|
||||
/// </summary>
|
||||
private Sprite sprite3;
|
||||
|
||||
private float timer = 1.0f;
|
||||
private void Awake()
|
||||
{
|
||||
title = this.transform.Find("Title").GetComponent<Text>();
|
||||
noDevice = this.transform.Find("NoDevice").GetComponent<Text>();
|
||||
unconnectionPanel = this.transform.Find("UnconnectionPanel").gameObject;
|
||||
mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject;
|
||||
mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject;
|
||||
searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>();
|
||||
mPairButton.SetActive(false);
|
||||
connectionPanel = this.transform.Find("ConnectionPanel").gameObject;
|
||||
|
||||
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
var rect = ((RectTransform)transform).rect;
|
||||
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height * 0.2f, 0));
|
||||
this.GetComponent<Image>().material = material;
|
||||
|
||||
var img1 = unconnectionPanel.GetComponent<Image>();
|
||||
if(img1 != null)
|
||||
{
|
||||
img1.material = material;
|
||||
|
||||
//var gradient = unconnectionPanel.GetComponent<UIGradient>();
|
||||
//if (gradient != null)
|
||||
//{
|
||||
// gradient.color1 = Utils.HexToColor("353543");
|
||||
// gradient.color2 = Utils.HexToColor("23232D");
|
||||
//}
|
||||
}
|
||||
|
||||
var img2 = connectionPanel.GetComponent<Image>();
|
||||
if(img2 != null)
|
||||
{
|
||||
img2.material = material;
|
||||
|
||||
//var gradient1 = connectionPanel.GetComponent<UIGradient>();
|
||||
//if (gradient1 != null)
|
||||
//{
|
||||
// gradient1.color1 = Utils.HexToColor("FF7485");
|
||||
// gradient1.color2 = Utils.HexToColor("F93086");
|
||||
//}
|
||||
}
|
||||
|
||||
logo = this.transform.Find("Logo").GetComponent<Image>();
|
||||
|
||||
|
||||
mDisconnectButton = connectionPanel.transform.Find("DisconnectBtn").gameObject;
|
||||
var powerValueObj = connectionPanel.transform.Find("PowerValue");
|
||||
if(powerValueObj != null)
|
||||
{
|
||||
powerValue = powerValueObj.gameObject.GetComponent<Text>();
|
||||
}
|
||||
|
||||
var powerUnitObj = connectionPanel.transform.Find("PowerUnit");
|
||||
if(powerUnitObj != null)
|
||||
{
|
||||
powerUnit = powerUnitObj.gameObject.GetComponent<Text>();
|
||||
}
|
||||
|
||||
InitLogo();
|
||||
title.text = GetTitle();
|
||||
|
||||
connectionPanel.SetActive(false);
|
||||
|
||||
UIManager.AddEvent(mPairButton, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
|
||||
{
|
||||
if (deviceModal == null)
|
||||
{
|
||||
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
var obj = Resources.Load("UI/Prefab/Device/Mobile/ConnectDeviceModal");
|
||||
#else
|
||||
var obj = Resources.Load("UI/Prefab/Device/ConnectDeviceModal");
|
||||
#endif
|
||||
GameObject gameObject = (GameObject)Instantiate(obj);
|
||||
deviceModal = gameObject.GetComponent<ConnectDeviceModal>();
|
||||
}
|
||||
deviceModal.SensorType = this.SensorType;
|
||||
UIManager.Show(deviceModal, null, true);
|
||||
}));
|
||||
|
||||
UIManager.AddEvent(mDisconnectButton, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => {
|
||||
//var device = GetDevice();
|
||||
//if(device != null && device.State == DeviceState.Connected)
|
||||
//{
|
||||
// device.Disconnect();
|
||||
//}
|
||||
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
var obj = Resources.Load("UI/Prefab/Device/Mobile/ConnectDeviceModal");
|
||||
#else
|
||||
var obj = Resources.Load("UI/Prefab/Device/ConnectDeviceModal");
|
||||
#endif
|
||||
GameObject gameObject = (GameObject)Instantiate(obj);
|
||||
deviceModal = gameObject.GetComponent<ConnectDeviceModal>();
|
||||
deviceModal.SensorType = this.SensorType;
|
||||
UIManager.Show(deviceModal, null, true);
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
void InitLogo()
|
||||
{
|
||||
if (SensorType == SensorType.Power)
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Power_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Power_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Power_4");
|
||||
|
||||
powerUnit.text = "W";
|
||||
}
|
||||
else if (SensorType == SensorType.Speed)
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Speed_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Speed_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Speed_4");
|
||||
|
||||
powerUnit.text = "KPH";
|
||||
}
|
||||
else if (SensorType == SensorType.Cadence || SensorType == SensorType.SpeedCadence)
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Cadence_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Cadence_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Cadence_4");
|
||||
|
||||
powerUnit.text = "RPM";
|
||||
}
|
||||
else if (SensorType == SensorType.HeartRate)
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Heart Rate_1");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Heart Rate_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Heart Rate_4");
|
||||
|
||||
powerUnit.text = "BPM";
|
||||
}
|
||||
else if (SensorType == SensorType.Trainer)
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Devices/Trainer_0");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Devices/Trainer_1");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Devices/Trainer_4");
|
||||
}
|
||||
else if (SensorType == SensorType.Rower)
|
||||
{
|
||||
sprite0 = Resources.Load<Sprite>("Images/Rower/设备 - 划船机 - 未连接");
|
||||
sprite1 = Resources.Load<Sprite>("Images/Rower/设备 - 划船机 - 未连接");
|
||||
sprite3 = Resources.Load<Sprite>("Images/Rower/设备 - 划船机");
|
||||
powerUnit.text = "";
|
||||
}
|
||||
}
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
Main();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
//if(SensorType != SensorType.Trainer)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
timer -= Time.deltaTime;
|
||||
if (timer <= 0)
|
||||
{
|
||||
Main();
|
||||
|
||||
timer = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void Main()
|
||||
{
|
||||
var connectedDevice = GetCurrentDevice();
|
||||
if(connectedDevice == null)
|
||||
{
|
||||
connectedDevice = GetDevice();
|
||||
}
|
||||
if(connectedDevice == null)
|
||||
{
|
||||
unconnectionPanel.SetActive(true);
|
||||
connectionPanel.SetActive(false);
|
||||
|
||||
logo.sprite = sprite0;
|
||||
noDevice.text = "NO DEVICE";
|
||||
searchState.text = "Searching...";
|
||||
|
||||
var hasDevice = false;
|
||||
if (SensorType == SensorType.SpeedCadence)
|
||||
{
|
||||
hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType.SpeedCadence || d.Sensor == SensorType.Cadence);
|
||||
}
|
||||
else
|
||||
{
|
||||
hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType);
|
||||
}
|
||||
if (hasDevice)
|
||||
{
|
||||
mSearchButton.SetActive(false);
|
||||
mPairButton.SetActive(true);
|
||||
#if UNITY_IOS || UNITY_ANDROID
|
||||
//searchState.gameObject.SetActive(false);
|
||||
#endif
|
||||
logo.sprite = sprite1;
|
||||
|
||||
//App.MainDeviceAdapter.GetDevices().First(d => d.Sensor == SensorType).Connect();
|
||||
}
|
||||
else
|
||||
{
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
mSearchButton.SetActive(true);
|
||||
#endif
|
||||
mPairButton.SetActive(false);
|
||||
}
|
||||
}
|
||||
else if(connectedDevice.State == DeviceState.Connecting)
|
||||
{
|
||||
unconnectionPanel.SetActive(true);
|
||||
connectionPanel.SetActive(false);
|
||||
logo.sprite = sprite1;
|
||||
|
||||
//title.text = connectedDevice.Name;
|
||||
if (connectedDevice.Network == NetworkType.BLE)
|
||||
{
|
||||
//noDevice.enabled = false;
|
||||
noDevice.text = connectedDevice.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
//noDevice.enabled = true;
|
||||
noDevice.text = connectedDevice.Name +" "+ connectedDevice.DeviceNumber.ToString();
|
||||
}
|
||||
#if (UNITY_IOS || UNITY_ANDROID)
|
||||
mPairButton.SetActive(true);
|
||||
searchState.gameObject.SetActive(true);
|
||||
#endif
|
||||
searchState.text = "Connecting...";
|
||||
|
||||
|
||||
}
|
||||
else if (connectedDevice.State == DeviceState.Connected)
|
||||
{
|
||||
unconnectionPanel.SetActive(false);
|
||||
|
||||
if (connectionPanel.activeInHierarchy == false)
|
||||
{
|
||||
var connectionCanvasGroup = connectionPanel.GetComponent<CanvasGroup>();
|
||||
connectionCanvasGroup.alpha = 0;
|
||||
connectionPanel.SetActive(true);
|
||||
connectionCanvasGroup.DOFade(1f, .3f).OnComplete(()=> {
|
||||
//if (logoSprite != null) {
|
||||
// logo.sprite = logoSprite;
|
||||
//}
|
||||
});
|
||||
DeviceCache.Add(connectedDevice);
|
||||
Debug.Log("connected");
|
||||
}
|
||||
|
||||
logo.sprite = sprite3;
|
||||
|
||||
//title.text = connectedDevice.Name;
|
||||
if (connectedDevice.Network == NetworkType.BLE)
|
||||
{
|
||||
//noDevice.enabled = false;
|
||||
noDevice.text = connectedDevice.Name;
|
||||
}
|
||||
else
|
||||
{
|
||||
//noDevice.enabled = true;
|
||||
noDevice.text = connectedDevice.Name +" "+ connectedDevice.DeviceNumber.ToString();
|
||||
}
|
||||
noDevice.color = Color.white;
|
||||
|
||||
if (powerValue != null)
|
||||
{
|
||||
powerValue.text = GetValue(connectedDevice);
|
||||
}
|
||||
}
|
||||
|
||||
//Debug.Log(Newtonsoft.Json.JsonConvert.SerializeObject(App.MainDeviceAdapter.GetDevices().Where(d => d.Sensor == SensorType)));
|
||||
}
|
||||
|
||||
string GetTitle()
|
||||
{
|
||||
switch (SensorType)
|
||||
{
|
||||
case SensorType.None:
|
||||
break;
|
||||
case SensorType.SpeedCadence:
|
||||
case SensorType.Cadence:
|
||||
return "Cadence Sensor";
|
||||
case SensorType.HeartRate:
|
||||
return "Heart Rate Monitor";
|
||||
case SensorType.Power:
|
||||
return "Power Meter";
|
||||
case SensorType.Speed:
|
||||
return "Speed Meter";
|
||||
case SensorType.Trainer:
|
||||
return "Smart Trainer";
|
||||
case SensorType.Rower:
|
||||
return "Rower Machine";
|
||||
case SensorType.VirtualPower:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
string GetValue(AbstractDevice connectedDevice)
|
||||
{
|
||||
switch (SensorType)
|
||||
{
|
||||
case SensorType.None:
|
||||
break;
|
||||
case SensorType.SpeedCadence:
|
||||
case SensorType.Cadence:
|
||||
//cadenceValue.text = (connectedDevice as ICadenceDevice).Cadence.ToString();
|
||||
return (connectedDevice as ICadenceDevice).Cadence.ToString();
|
||||
case SensorType.HeartRate:
|
||||
return (connectedDevice as IHeartRateDevice).HeartRate.ToString();
|
||||
case SensorType.Power:
|
||||
return (connectedDevice as IPowerDevice).Power.ToString();
|
||||
case SensorType.Speed:
|
||||
return (connectedDevice as ISpeedDevice).Speed.ToString("f1");
|
||||
case SensorType.Trainer:
|
||||
//powerValue.text = (connectedDevice as IPowerDevice).Power.ToString();
|
||||
//cadenceValue.GetComponent<Text>().text = (connectedDevice as ICadenceDevice).Cadence.ToString();
|
||||
//speedValue.GetComponent<Text>().text = (connectedDevice as ISpeedDevice).Speed.ToString();
|
||||
break;
|
||||
case SensorType.VirtualPower:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
AbstractDevice GetCurrentDevice()
|
||||
{
|
||||
//return AntConnector.Instance().discoveredDevices.FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && d.Sensor == SensorType);
|
||||
if(SensorType == SensorType.SpeedCadence || SensorType == SensorType.Cadence)
|
||||
{
|
||||
return App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && (d.Sensor == SensorType.SpeedCadence || d.Sensor == SensorType.Cadence));
|
||||
}
|
||||
return App.MainDeviceAdapter.GetDevices().FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && d.Sensor == SensorType);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取已经连接的设备
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
AbstractDevice GetDevice()
|
||||
{
|
||||
//return AntConnector.Instance().discoveredDevices.FirstOrDefault(d => (d.State == DeviceState.Connected || d.State == DeviceState.Connecting) && d.Sensor == SensorType);
|
||||
var devices = App.MainDeviceAdapter.GetDevices().Where(d => (d.State == DeviceState.Connected));
|
||||
switch (SensorType)
|
||||
{
|
||||
case SensorType.None:
|
||||
break;
|
||||
case SensorType.SpeedCadence:
|
||||
case SensorType.Cadence:
|
||||
return devices.FirstOrDefault(d => d is ICadenceDevice);
|
||||
case SensorType.HeartRate:
|
||||
return devices.FirstOrDefault(d => d is IHeartRateDevice);
|
||||
case SensorType.Power:
|
||||
var item = devices.FirstOrDefault(d => d is IPowerDevice);
|
||||
//if (powerValue != null)
|
||||
//{
|
||||
// powerValue.GetComponent<Text>().text = (item as IPowerDevice).Power.ToString();
|
||||
//}
|
||||
return item;
|
||||
case SensorType.Speed:
|
||||
return devices.FirstOrDefault(d => d is ISpeedDevice);
|
||||
case SensorType.Rower:
|
||||
return devices.FirstOrDefault(d => d.Sensor == SensorType.Rower);
|
||||
case SensorType.Trainer:
|
||||
var item3 = devices.FirstOrDefault(d => d.Sensor == SensorType.Trainer);
|
||||
return item3;
|
||||
case SensorType.VirtualPower:
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 954bbf32f326f684c90a328ec1db5ff9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,63 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using UnityEngine;
|
||||
using ChartAndGraph;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class RowerGraphChartFeed : MonoBehaviour
|
||||
{
|
||||
void Start ()
|
||||
{
|
||||
//GraphChartBase graph = GetComponent<GraphChartBase>();
|
||||
//if (graph != null)
|
||||
//{
|
||||
// graph.Scrollable = false;
|
||||
// graph.HorizontalValueToStringMap[0.0] = "Zero"; // example of how to set custom axis strings
|
||||
// graph.DataSource.StartBatch();
|
||||
// graph.DataSource.ClearCategory("Player 1");
|
||||
// graph.DataSource.ClearAndMakeBezierCurve("Player 2");
|
||||
|
||||
// for (int i = 0; i <10000; i++)
|
||||
// {
|
||||
// graph.DataSource.AddPointToCategory("Player 1",i*5,Random.value*10f + 20f);
|
||||
// if (i == 0)
|
||||
// graph.DataSource.SetCurveInitialPoint("Player 2",i*5, Random.value * 10f + 10f);
|
||||
// else
|
||||
// graph.DataSource.AddLinearCurveToCategory("Player 2",
|
||||
// new DoubleVector2(i*5 , Random.value * 10f + 10f));
|
||||
// }
|
||||
// graph.DataSource.MakeCurveCategorySmooth("Player 2");
|
||||
// graph.DataSource.EndBatch();
|
||||
//}
|
||||
// StartCoroutine(ClearAll());
|
||||
}
|
||||
|
||||
public void SetData(List<DoubleVector2> list)
|
||||
{
|
||||
GraphChartBase graph = GetComponent<GraphChartBase>();
|
||||
if (graph != null)
|
||||
{
|
||||
graph.Scrollable = false;
|
||||
//graph.HorizontalValueToStringMap[0.0] = "Zero"; // example of how to set custom axis strings
|
||||
graph.DataSource.StartBatch();
|
||||
graph.DataSource.ClearAndMakeBezierCurve("Player 1");
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
var item = list[i];
|
||||
if (i == 0)
|
||||
graph.DataSource.SetCurveInitialPoint("Player 1", item.x, item.y);
|
||||
else
|
||||
graph.DataSource.AddLinearCurveToCategory("Player 1", new DoubleVector2(item.x, item.y));
|
||||
}
|
||||
graph.DataSource.MakeCurveCategorySmooth("Player 1");
|
||||
graph.DataSource.EndBatch();
|
||||
}
|
||||
}
|
||||
IEnumerator ClearAll()
|
||||
{
|
||||
yield return new WaitForSeconds(5f);
|
||||
GraphChartBase graph = GetComponent<GraphChartBase>();
|
||||
|
||||
graph.DataSource.Clear();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa4e07579b1f9574788e0b83b1fac799
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,254 @@
|
||||
#define Graph_And_Chart_PRO
|
||||
using UnityEngine;
|
||||
using ChartAndGraph;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
public partial class RowerLargeDataFeed : MonoBehaviour, IComparer<DoubleVector2>
|
||||
{
|
||||
public string Category = "Player 1";
|
||||
public int DownSampleToPoints = 100;
|
||||
List<DoubleVector2> mData = new List<DoubleVector2>(); // the data held by the chart
|
||||
double pageSize = 2f;
|
||||
double currentPagePosition = 0.0;
|
||||
double currentZoom = 0f;
|
||||
GraphChartBase graph;
|
||||
double mCurrentPageSizeFactor = double.NegativeInfinity;
|
||||
void Start()
|
||||
{
|
||||
graph = GetComponent<GraphChartBase>();
|
||||
//SetInitialData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// called with Start(). These will be used to load the data into the large data feed. You should replace this with your own loading logic.
|
||||
/// </summary>
|
||||
void SetInitialData()
|
||||
{
|
||||
List<DoubleVector2> data = new List<DoubleVector2>(75);
|
||||
double x = 0f;
|
||||
double y = 20f;
|
||||
for (int i = 0; i < 75; i++) // initialize with random data
|
||||
{
|
||||
y = 20 + UnityEngine.Random.value * 80;
|
||||
Debug.Log(y);
|
||||
x += 1;
|
||||
data.Add(new DoubleVector2(x, y));
|
||||
}
|
||||
SetData(data);
|
||||
}
|
||||
|
||||
public void SaveToFile(string path)
|
||||
{
|
||||
using (StreamWriter file = new StreamWriter(path))
|
||||
{
|
||||
file.WriteLine(mData.Count);
|
||||
for (int i = 0; i < mData.Count; i++)
|
||||
{
|
||||
DoubleVector2 item = mData[i];
|
||||
file.WriteLine(item.x);
|
||||
file.WriteLine(item.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void LoadFromFile(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<DoubleVector2> data = new List<DoubleVector2>();
|
||||
using (StreamReader file = new StreamReader(path))
|
||||
{
|
||||
int count = int.Parse(file.ReadLine());
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
double x = double.Parse(file.ReadLine());
|
||||
double y = double.Parse(file.ReadLine());
|
||||
data.Add(new DoubleVector2(x, y));
|
||||
}
|
||||
}
|
||||
SetData(data);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new Exception("Invalid file format");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// vertify's that the graph data is sorted so it can be searched using a binary search.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
bool VerifySorted(List<DoubleVector2> data)
|
||||
{
|
||||
if (data == null)
|
||||
return true;
|
||||
for (int i = 1; i < data.Count; i++)
|
||||
{
|
||||
if (data[i].x < data[i - 1].x)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// set the data of the large data graph
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
public void SetData(List<DoubleVector2> data)
|
||||
{
|
||||
if (data == null)
|
||||
data = new List<DoubleVector2>(); // set up an empty list instead of null
|
||||
if (VerifySorted(data) == false)
|
||||
{
|
||||
Debug.LogWarning("The data used with large data feed must be sorted acoording to the x value, aborting operation");
|
||||
return;
|
||||
}
|
||||
mData = data;
|
||||
LoadPage(currentPagePosition); // load the page at position 0
|
||||
}
|
||||
|
||||
int FindClosestIndex(double position) // if you want to know what is index is currently displayed . use binary search to find it
|
||||
{
|
||||
//NOTE :: this method assumes your data is sorted !!!
|
||||
int res = mData.BinarySearch(new DoubleVector2(position, 0.0), this);
|
||||
if (res >= 0)
|
||||
return res;
|
||||
return ~res;
|
||||
}
|
||||
|
||||
double PageSizeFactor
|
||||
{
|
||||
get
|
||||
{
|
||||
return pageSize * graph.DataSource.HorizontalViewSize;
|
||||
}
|
||||
}
|
||||
|
||||
void findPointsForPage(double position, out int start, out int end) // given a page position , find the right most and left most indices in the data for that page.
|
||||
{
|
||||
int index = FindClosestIndex(position); // use binary search to find the closest position to the current scroll point
|
||||
|
||||
double endPosition = position + PageSizeFactor;
|
||||
double startPosition = position - PageSizeFactor;
|
||||
|
||||
//starting from the current index , we find the page boundries
|
||||
for (start = index; start > 0; start--)
|
||||
{
|
||||
if (mData[start].x < startPosition) // take the first point that is out of the page. so the graph doesn't break at the edge
|
||||
break;
|
||||
}
|
||||
|
||||
for (end = index; end < mData.Count; end++)
|
||||
{
|
||||
if (mData[end].x > endPosition) // take the first point that is out of the page
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
if (graph != null)
|
||||
{
|
||||
//check the scrolling position of the graph. if we are past the view size , load a new page
|
||||
double pageStartThreshold = currentPagePosition - mCurrentPageSizeFactor;
|
||||
double pageEndThreshold = currentPagePosition + mCurrentPageSizeFactor - graph.DataSource.HorizontalViewSize;
|
||||
|
||||
if (graph.HorizontalScrolling < pageStartThreshold || graph.HorizontalScrolling > pageEndThreshold || currentZoom >= graph.DataSource.HorizontalViewSize * 2f)
|
||||
{
|
||||
currentZoom = graph.DataSource.HorizontalViewSize;
|
||||
mCurrentPageSizeFactor = PageSizeFactor * 0.9f;
|
||||
LoadPage(graph.HorizontalScrolling);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LoadWithoutDownSampling(int start, int end)
|
||||
{
|
||||
for (int i = start; i < end; i++) // load the data
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
graph.DataSource.SetCurveInitialPoint(Category, mData[i].x, mData[i].y);
|
||||
}
|
||||
else
|
||||
{
|
||||
graph.DataSource.AddLinearCurveToCategory(Category, new DoubleVector2(mData[i].x, mData[i].y));
|
||||
}
|
||||
//graph.DataSource.AddPointToCategory(Category, mData[i].x, mData[i].y);
|
||||
}
|
||||
}
|
||||
|
||||
void LoadWithDownSampling(int start, int end)
|
||||
{
|
||||
int total = end - start;
|
||||
|
||||
if (DownSampleToPoints >= total)
|
||||
{
|
||||
LoadWithoutDownSampling(start, end);
|
||||
return;
|
||||
}
|
||||
|
||||
double sampleCount = ((double)total) / (double)DownSampleToPoints;
|
||||
// graph.DataSource.AddPointToCategory(Category, mData[start].x, mData[start].y);
|
||||
for (int i = 0; i < DownSampleToPoints; i++)
|
||||
{
|
||||
int fractionStart = start + (int)(i * sampleCount); // the first point with a fraction
|
||||
int fractionEnd = start + (int)((i + 1) * sampleCount); // the first point with a fraction
|
||||
fractionEnd = Math.Min(fractionEnd, mData.Count - 1);
|
||||
double x = 0, y = 0;
|
||||
double divide = 0.0;
|
||||
for (int j = fractionStart; j < fractionEnd; j++) // avarge the poins
|
||||
{
|
||||
x += mData[j].x;
|
||||
y += mData[j].y;
|
||||
divide++;
|
||||
}
|
||||
if (divide > 0.0)
|
||||
{
|
||||
x /= divide;
|
||||
y /= divide;
|
||||
graph.DataSource.AddPointToCategory(Category, x, y);
|
||||
}
|
||||
else
|
||||
Debug.Log("error");
|
||||
}
|
||||
// graph.DataSource.AddPointToCategory(Category, mData[last].x, mData[last].y);
|
||||
}
|
||||
|
||||
void LoadPage(double pagePosition)
|
||||
{
|
||||
if (graph != null)
|
||||
{
|
||||
|
||||
Debug.Log("Loading page :" + pagePosition);
|
||||
graph.DataSource.StartBatch(); // call start batch
|
||||
graph.DataSource.HorizontalViewOrigin = 0;
|
||||
int start, end;
|
||||
findPointsForPage(pagePosition, out start, out end); // get the page edges
|
||||
graph.DataSource.ClearAndMakeBezierCurve(Category); // clear the cateogry
|
||||
|
||||
if (DownSampleToPoints <= 0)
|
||||
LoadWithoutDownSampling(start, end);
|
||||
else
|
||||
LoadWithDownSampling(start, end);
|
||||
graph.DataSource.MakeCurveCategorySmooth(Category);
|
||||
graph.DataSource.EndBatch();
|
||||
graph.HorizontalScrolling = pagePosition;
|
||||
}
|
||||
currentPagePosition = pagePosition;
|
||||
}
|
||||
|
||||
|
||||
public int Compare(DoubleVector2 x, DoubleVector2 y)
|
||||
{
|
||||
if (x.x < y.x)
|
||||
return -1;
|
||||
if (x.x > y.x)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7916cf3d11e8e7b4ebd8712801923455
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,103 @@
|
||||
using Assets.Scripts;
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using ChartAndGraph;
|
||||
using DG.Tweening;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RowerResult : PFUIPanel
|
||||
{
|
||||
RowerResultModel _model;
|
||||
private GraphChart chartPace, chartRate, chartHR;
|
||||
Transform dataContent;
|
||||
// Start is called before the first frame update
|
||||
void Awake()
|
||||
{
|
||||
var grid = transform.Find("Scroll View/Viewport/Content/Content/Table").GetComponent<GridLayoutGroup>();
|
||||
float width = (App.canvasWidth - 60 - 3) / 4;
|
||||
grid.cellSize = new Vector2(width, 37);
|
||||
var grid1 = transform.Find("Scroll View/Viewport/Content/Content/Other/Datas").GetComponent<GridLayoutGroup>();
|
||||
grid1.cellSize = new Vector2(width, 53);
|
||||
chartPace = transform.Find("Scroll View/Viewport/Content/Content/ChartPace/Chart").GetComponent<GraphChart>();
|
||||
chartPace.DataSource.VerticalViewOrigin = ChartDateUtility.TimeSpanToValue(TimeSpan.FromHours(15));
|
||||
chartPace.DataSource.VerticalViewSize = ChartDateUtility.TimeSpanToValue(TimeSpan.FromHours(15)) * -1;
|
||||
chartRate = transform.Find("Scroll View/Viewport/Content/Content/ChartRate/Chart").GetComponent<GraphChart>();
|
||||
chartHR = transform.Find("Scroll View/Viewport/Content/Content/ChartHeartRate/Chart").GetComponent<GraphChart>();
|
||||
dataContent = transform.Find("Scroll View/Viewport/Content/Content");
|
||||
UIManager.AddEvent(transform.Find("Exit").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
Close();
|
||||
});
|
||||
//var a = new List<ChartAndGraph.DoubleVector2>();
|
||||
//for (int i = 0; i < 100; i++)
|
||||
//{
|
||||
// a.Add(new ChartAndGraph.DoubleVector2(i, ChartDateUtility.TimeSpanToValue(TimeSpan.FromMinutes(300))));
|
||||
//}
|
||||
//transform.Find("Scroll View/Viewport/Content/Content/ChartPace/Chart").GetComponent<RowerLargeDataFeed>().SetData(a);
|
||||
}
|
||||
|
||||
public async void Initial(string id)
|
||||
{
|
||||
GetComponent<CanvasGroup>().alpha = 0;
|
||||
var res = await ConfigHelper.rowerApi.GetDetail(id);
|
||||
if (res.result)
|
||||
{
|
||||
_model = res.data;
|
||||
dataContent.Find("Time").GetComponent<Text>().text = $"{_model.StartTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")} ~ {_model.CreateTime.ToLocalTime().ToString("yyyy-MM-dd HH:mm:ss")}";
|
||||
dataContent.Find("TitleContent/Duration").GetComponent<Text>().text
|
||||
= $"<color=#5c5c6e>Rowing time :</color> {TimeSpan.FromSeconds(_model.TotalTime).ToString()}";
|
||||
dataContent.Find("TitleContent/Distance").GetComponent<Text>().text
|
||||
= $"<color=#5c5c6e>Distance :</color> {_model.TotalDistance}M";
|
||||
dataContent.Find("TitleContent/Device").GetComponent<Text>().text
|
||||
= $"<color=#5c5c6e>Rowing equipment :</color> {_model.ManufacturerName}";
|
||||
dataContent.Find("Table/AvgPower/Text").GetComponent<Text>().text
|
||||
= $"{_model.AvgPower.ToString("#0")} W";
|
||||
dataContent.Find("Table/AvgHR/Text").GetComponent<Text>().text
|
||||
= $"{_model.AvgHeartRate} BPM";
|
||||
dataContent.Find("Table/AvgRate/Text").GetComponent<Text>().text
|
||||
= $"{_model.AvgRate.ToString("#0")} W";
|
||||
dataContent.Find("Table/MaxPower/Text").GetComponent<Text>().text
|
||||
= $"{_model.MaxPower.ToString("#0")} W";
|
||||
dataContent.Find("Table/AvgHR/Text").GetComponent<Text>().text
|
||||
= $"{_model.MaxHeartRate} BPM";
|
||||
dataContent.Find("Table/AvgRate/Text").GetComponent<Text>().text
|
||||
= $"{_model.MaxRate.ToString("#0")} W";
|
||||
dataContent.Find("ChartPace/Avg/Value").GetComponent<Text>().text
|
||||
= $"{TimeSpan.FromSeconds(_model.AvgPace).ToString(@"mm\:ss")} /500M";
|
||||
dataContent.Find("ChartRate/Avg/Value").GetComponent<Text>().text
|
||||
= $"{_model.AvgRate.ToString("#0")} SPM";
|
||||
dataContent.Find("ChartHeartRate/Avg/Value").GetComponent<Text>().text
|
||||
= $"{_model.AvgHeartRate.ToString("#0")} BPM";
|
||||
dataContent.Find("ChartPace/Max/Value").GetComponent<Text>().text
|
||||
= $"{TimeSpan.FromSeconds(_model.MaxPace).ToString(@"mm\:ss")} /500M";
|
||||
dataContent.Find("ChartRate/Max/Value").GetComponent<Text>().text
|
||||
= $"{_model.MaxRate.ToString("#0")} SPM";
|
||||
dataContent.Find("ChartHeartRate/Max/Value").GetComponent<Text>().text
|
||||
= $"{_model.MaxHeartRate.ToString("#0")} BPM";
|
||||
dataContent.Find("Other/Datas/Calories/Value").GetComponent<Text>().text
|
||||
= $"{(_model.Kj ?? 0).ToString("#0")} KCAL";
|
||||
dataContent.Find("Other/Datas/StrokeCount/Value").GetComponent<Text>().text
|
||||
= _model.StrokeCount.ToString();
|
||||
//var b = _model.ChartList.Select((x, i) => new DoubleVector2(i, ChartDateUtility.TimeSpanToValue(TimeSpan.FromMinutes(x.Pace + UnityEngine.Random.value * 300)))).ToList();
|
||||
//Debug.Log(_model.ChartList.Select((x, i) => new DoubleVector2(i, ChartDateUtility.TimeSpanToValue(TimeSpan.FromMinutes(x.Pace + UnityEngine.Random.value * 300)))).ToList());
|
||||
chartPace.GetComponent<RowerLargeDataFeed>()
|
||||
.SetData(_model.ChartList.Select((x, i) => new DoubleVector2(i, ChartDateUtility.TimeSpanToValue(TimeSpan.FromMinutes(x.Pace)))).ToList());
|
||||
chartRate.GetComponent<RowerLargeDataFeed>()
|
||||
.SetData(_model.ChartList.Select((x, i) => new DoubleVector2(i, x.Rate)).ToList());
|
||||
chartHR.GetComponent<RowerLargeDataFeed>()
|
||||
.SetData(_model.ChartList.Select((x, i) => new DoubleVector2(i, x.HeartRate)).ToList());
|
||||
}
|
||||
GetComponent<CanvasGroup>().DOFade(1, 0.3f);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa3ab67bcc540104589072a282858e44
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,49 @@
|
||||
using Assets.Scripts.Apis.Models;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class RowerWelldone : PFUIPanel
|
||||
{
|
||||
public override void Show()
|
||||
{
|
||||
base.Show();
|
||||
Debug.Log("well done show");
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
UIManager.AddEvent(transform.Find("BtnDefine").gameObject, UnityEngine.EventSystems.EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
RowerRecordModel model;
|
||||
public void Initial(RowerRecordModel model)
|
||||
{
|
||||
Debug.Log("Initial");
|
||||
if (model == null) return;
|
||||
this.model = model;
|
||||
transform.Find("Time/Value1").GetComponent<Text>().text = model.CreateTime.ToLocalTime().ToString("yyyy-MM-dd");
|
||||
transform.Find("Time/Value2").GetComponent<Text>().text = model.CreateTime.ToLocalTime().ToString("HH:mm:ss");
|
||||
transform.Find("RowingTime/Value").GetComponent<Text>().text = TimeSpan.FromSeconds(model.TotalTime).ToString();
|
||||
transform.Find("Distance/Value").GetComponent<Text>().text = $"{model.TotalDistance.ToString()}M";
|
||||
var datas = transform.Find("Other/Datas");
|
||||
datas.Find("AvgRate/Value").GetComponent<Text>().text = $"{model.AvgRate.ToString("#0")}";
|
||||
datas.Find("MaxRate/Value").GetComponent<Text>().text = $"{model.MaxRate.ToString()}";
|
||||
datas.Find("AvgPower/Value").GetComponent<Text>().text = $"{model.AvgPower.ToString("#0")}";
|
||||
datas.Find("MaxPower/Value").GetComponent<Text>().text = $"{model.MaxPower.ToString()}";
|
||||
datas.Find("MaxPace/Value").GetComponent<Text>().text = $"{TimeSpan.FromSeconds(model.MaxPace).ToString(@"mm\:ss")}";
|
||||
datas.Find("AvgPace/Value").GetComponent<Text>().text = $"{TimeSpan.FromSeconds(model.AvgPace).ToString(@"mm\:ss")}";
|
||||
datas.Find("Calories/Value").GetComponent<Text>().text = $"{(model.Kj ?? 0).ToString("#0")}";
|
||||
datas.Find("StrokeCount/Value").GetComponent<Text>().text = $"{model.StrokeCount}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0932c4066cf3c24da73e66759aaec1f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user