开放划船机,增加阻力设置

This commit is contained in:
Caiyanpeng committed 2022-02-11 17:38:23 +08:00
1 parent c12df53c18
commit 7c1d1e797c
13 files changed
+2376 -1642

No files matched your search

+8 -5
View File
@@ -62,7 +62,7 @@ public class NewMainNav : MonoBehaviour
SetExpand(false);
}
/// <summary>
/// true:展开 false:关闭
/// </summary>
@@ -75,7 +75,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];
}
@@ -115,7 +115,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;
}
@@ -125,7 +125,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;
}
@@ -230,7 +230,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();
}