Merge branch 'dev_rower' into dev_cyp
# Conflicts: # ProjectSettings/ProjectSettings.asset
This commit is contained in:
commit
e6f3e2ecfa
10 files changed
+2371
-1638
No files matched your search
@@ -11,5 +11,6 @@ namespace Assets.Scripts.Devices.Ant.Interfaces
|
||||
{
|
||||
FtmsRowerData rowerData { get; }
|
||||
void Reset();
|
||||
void SetResistanceLevel(ushort v);
|
||||
}
|
||||
}
|
||||
@@ -77,5 +77,11 @@ namespace Assets.Scripts.Devices.Ble.Devices
|
||||
Debug.Log("发送重置命令"+this.controlPointCharacteristic.ToString());
|
||||
hwInterface.WriteCharacteristic(this.controlPointCharacteristic, new byte[] { 0x01 });
|
||||
}
|
||||
public void SetResistanceLevel(ushort v)
|
||||
{
|
||||
var r = new byte[] { 0x04 }.Concat(BitConverter.GetBytes(v)).ToArray();
|
||||
Debug.Log($"设置阻力{v}, {string.Join(",", r)}");
|
||||
hwInterface.WriteCharacteristic(this.controlPointCharacteristic, r);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,18 +296,18 @@ public class MainController : BaseScene
|
||||
//{
|
||||
// UIManager.ShowHomePanel();
|
||||
//});
|
||||
//#if UNITY_ANDROID || UNITY_IOS
|
||||
// if (!App.IsRowerMode.HasValue)
|
||||
// {
|
||||
// UIManager.ShowRowerSelector();
|
||||
// return;
|
||||
// }
|
||||
// if (App.IsRowerMode == true)
|
||||
// {
|
||||
// UIManager.ShowRowerPanel();
|
||||
// return;
|
||||
// }
|
||||
//#endif
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
if (!App.IsRowerMode.HasValue)
|
||||
{
|
||||
UIManager.ShowRowerSelector();
|
||||
return;
|
||||
}
|
||||
if (App.IsRowerMode == true)
|
||||
{
|
||||
UIManager.ShowRowerPanel();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
LastRide();//检查本地异常中断的骑行并弹窗提示继续
|
||||
if (App.MainSceneParam.ContainsKey("Name") && !string.IsNullOrEmpty(App.MainSceneParam["Name"]))
|
||||
{
|
||||
|
||||
@@ -17,6 +17,16 @@ public class PFUISlider : MonoBehaviour
|
||||
text.text = $"{(f * 100).ToString("#0")}%";
|
||||
});
|
||||
}
|
||||
public void SetValueChanged(System.Action<float> a)
|
||||
{
|
||||
slider = transform.GetComponent<Slider>();
|
||||
slider.onValueChanged.RemoveAllListeners();
|
||||
slider.onValueChanged.AddListener((f) =>
|
||||
{
|
||||
text.text = $"{(f * 100).ToString("#0")}%";
|
||||
a.Invoke(f);
|
||||
});
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
@@ -64,7 +64,7 @@ public class NewMainNav : MonoBehaviour
|
||||
SetExpand(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// true:展开 false:关闭
|
||||
/// </summary>
|
||||
@@ -77,7 +77,7 @@ public class NewMainNav : MonoBehaviour
|
||||
types = typeArray.Where((x, i) => indexs.Contains(i)).ToList();
|
||||
}
|
||||
string shrinkName = null;
|
||||
if (shrinkIndex.HasValue && (shrinkIndex == 0 || shrinkIndex == 2))
|
||||
if (shrinkIndex.HasValue && isShrinkIndex(shrinkIndex.Value))
|
||||
{
|
||||
shrinkName = typeArray[shrinkIndex.Value];
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public class NewMainNav : MonoBehaviour
|
||||
public void ShowButton(string v)
|
||||
{
|
||||
var i = typeArray.FindIndex((x)=>x == v);
|
||||
if (i == -1 || i == 0 || i == 2)
|
||||
if (i == -1 || isShrinkIndex(i))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class NewMainNav : MonoBehaviour
|
||||
public void HideButton(string v)
|
||||
{
|
||||
var i = typeArray.FindIndex((x) => x == v);
|
||||
if (i == -1 || i == 0 || i == 2)
|
||||
if (i == -1 || isShrinkIndex(i))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -245,7 +245,10 @@ public class NewMainNav : MonoBehaviour
|
||||
transform.Find("Home").gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
private bool isShrinkIndex(int ind)
|
||||
{
|
||||
return ind == 0 || ind == 2;
|
||||
}
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
@@ -42,7 +42,10 @@ public class HomeController : PFUIPanel
|
||||
|
||||
#if UNITY_ANDROID || UNITY_IOS
|
||||
var nav = transform.Find("MainNav-mobile").GetComponent<NewMainNav>();
|
||||
nav.SetButtonActive(new List<int> { 1, 3, 4, 6 });
|
||||
nav.SetButtonActive(new List<int> { 1, 3, 4, 6 },null,new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/Rower/划船"), () =>
|
||||
{
|
||||
UIManager.ShowRowerPanel();
|
||||
}));
|
||||
newNav = nav;
|
||||
UIManager.AddEvent(transform.Find("TodayData/Datas/Distance").gameObject, EventTriggerType.PointerClick, b =>
|
||||
{
|
||||
|
||||
@@ -93,6 +93,14 @@ public class RowerHomeScript : PFUIPanel
|
||||
/// </summary>
|
||||
int stopSeconds = 0;
|
||||
uint totalDistance = 0;
|
||||
protected override void Start()
|
||||
{
|
||||
var nav = transform.Find("MainNav-mobile").GetComponent<NewMainNav>();
|
||||
nav.SetButtonActive(new List<int> {1,4,6 }, null, new NewMainNav.CustomButton(Resources.Load<Sprite>("Images/Rower/骑行"), () =>
|
||||
{
|
||||
ReturnHome();
|
||||
}));
|
||||
}
|
||||
protected override void Awake()
|
||||
{
|
||||
spriteDict = new Dictionary<object, Sprite>()
|
||||
@@ -127,6 +135,15 @@ public class RowerHomeScript : PFUIPanel
|
||||
left = transform.Find("Left");
|
||||
bottom = transform.Find("Bottom");
|
||||
PaintPullCurveDelegate = new EventHandler(PaintPullCurve);
|
||||
transform.Find("PFUISlider").GetComponent<PFUISlider>().SetValueChanged(r =>
|
||||
{
|
||||
var v = (ushort)(r * 65535);
|
||||
if (Rower != null)
|
||||
{
|
||||
Rower.SetResistanceLevel(v);
|
||||
//RowerData.
|
||||
}
|
||||
});
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user