设备连接界面文案与交互调整

This commit is contained in:
lishuo committed 2022-05-31 18:25:53 +08:00
1 parent 2524e3a004
commit a1010091f8
9 files changed
+78 -45

No files matched your search

@@ -202,27 +202,6 @@ public class ConnectDeviceModal : PFUIPanel
UIManager.AddEvent(deviceItemObj.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
{
deviceItemObj.Set(true);
var trainer = SensorType == SensorType.Trainer && deviceItemObj.DeviceInfo.State == DeviceState.Connected;
var nontrainer = deviceItemObj.DeviceInfo.Sensor != SensorType.Trainer && SensorType != SensorType.Trainer && deviceItemObj.DeviceInfo.State == DeviceState.Connected;
if (trainer || nontrainer)
{
connectBtnText.text = App.GetLocalString("DISCONNECT");
connectBtnText.GetComponent<PFUIText>().key = "DISCONNECT";
}
else
{
connectBtnText.text = App.GetLocalString("CONNECT");
connectBtnText.GetComponent<PFUIText>().key = "CONNECT";
}
foreach (var item in deviceList)
{
if (item.Key != deviceItemObj.DeviceInfo.Id)
{
item.Value.Set(false);
}
}
}));
//UIManager.AddEvent(deviceItemObj.gameObject, EventTriggerType.Deselect, new UnityEngine.Events.UnityAction<BaseEventData>(e =>
@@ -259,6 +238,14 @@ public class ConnectDeviceModal : PFUIPanel
//connectBtn.text.text = "DISCOUNECT";
noDevice.text = firstDevice.DeviceInfo.Name;
}
else
{
var defaultDevice = deviceList.FirstOrDefault();
if (defaultDevice.Value != null)
{
defaultDevice.Value.Set(true);
}
}
//DeviceItem firstDevice;
//var devicesTemp = deviceList.Select(d => d.Value).Where(d => d.DeviceInfo.State == DeviceState.Connected);
//if(SensorType == SensorType.Cadence || SensorType == SensorType.SpeedCadence)
@@ -268,6 +255,30 @@ public class ConnectDeviceModal : PFUIPanel
}
}
}
//选中需要连接的设备
public void SelectDevice(DeviceItem deviceItemObj)
{
var trainer = SensorType == SensorType.Trainer && deviceItemObj.DeviceInfo.State == DeviceState.Connected;
var nontrainer = deviceItemObj.DeviceInfo.Sensor != SensorType.Trainer && SensorType != SensorType.Trainer && deviceItemObj.DeviceInfo.State == DeviceState.Connected;
if (trainer || nontrainer)
{
connectBtnText.text = App.GetLocalString("DISCONNECT");
connectBtnText.GetComponent<PFUIText>().key = "DISCONNECT";
}
else
{
connectBtnText.text = App.GetLocalString("CONNECT");
connectBtnText.GetComponent<PFUIText>().key = "CONNECT";
}
foreach (var item in deviceList)
{
if (item.Key != deviceItemObj.DeviceInfo.Id)
{
item.Value.Set(false);
}
}
}
public override void Show()
{
@@ -153,6 +153,8 @@ public class DeviceItem : Selectable, IEventSystemHandler, IPointerClickHandler
if (this.isOn)
{
SetSelectedStyle();
var manager = FindObjectOfType<ConnectDeviceModal>();
manager.SelectDevice(this);
}
else
{
@@ -137,7 +137,10 @@ public class DeviceView : MonoBehaviour
connectButtonClick();
}));
#endif
UIManager.AddEvent(mSearchButton, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
{
connectButtonClick();
}));
UIManager.AddEvent(mPairButton, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
{
connectButtonClick();