pc设备连接界面微调

This commit is contained in:
lishuo 2022-05-31 19:43:50 +08:00
parent a1010091f8
commit e7af21b126
4 changed files with 19 additions and 35 deletions

View File

@ -179,7 +179,6 @@ GameObject:
- component: {fileID: 7672791435969097068}
- component: {fileID: 740803332586528087}
- component: {fileID: 913971118869806231}
- component: {fileID: 3736854379713315744}
m_Layer: 5
m_Name: NoDevice
m_TagString: Untagged
@ -246,20 +245,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: NO DEVICE
--- !u!114 &3736854379713315744
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3184548043826394215}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e47f6ee11b78f3247a0b474b6c36e2cd, type: 3}
m_Name:
m_EditorClassIdentifier:
key:
m_Text:
--- !u!1 &3878003491430181822
GameObject:
m_ObjectHideFlags: 0

View File

@ -205,7 +205,8 @@
"Cadence Sensor": "踏频",
"Speed Meter": "速度计",
"Heart Rate Monitor": "心率带",
"NO DEVICE": "尚未连接设备",
"NO DEVICE": "无可用设备",
"CHOOSE DEVICE": "查看可用设备",
"Edit": "编辑",
"Record": "记录",
"More": "更多",
@ -450,6 +451,7 @@
"Cancel Reserve": "Cancel Reserve",
"Smart Trainer": "Smart Trainer",
"NO DEVICE": "NO DEVICE",
"CHOOSE DEVICE": "CHOOSE DEVICE",
"CONNECT": "CONNECT",
"CLOSE": "CLOSE",
"PAIR": "PAIR",

View File

@ -14,7 +14,7 @@ using Assets.Scripts.Devices;
public class ConnectDeviceModal : PFUIPanel
{
private float timer = 1.0f;
private float timer = 0f;
private SensorType mSensorType = SensorType.None;
public SensorType SensorType {
get {
@ -59,7 +59,7 @@ public class ConnectDeviceModal : PFUIPanel
content = panel.Find("Scroll View").Find("Viewport").Find("Content").GetComponent<VerticalLayoutGroup>();
noDevice = container.Find("NoDevice").GetComponent<Text>();
noDevice.text = App.GetLocalString("NO DEVICE");
searchIconRect = container.Find("SearchIcon").GetComponent<RectTransform>();
_x = searchIconRect.localPosition.x;
_y = searchIconRect.localPosition.y;
@ -147,7 +147,7 @@ public class ConnectDeviceModal : PFUIPanel
if(timer <= 0)
{
SearchDevice();
timer = 1.0f;
timer += 1.0f;
}
Move();
@ -222,21 +222,6 @@ public class ConnectDeviceModal : PFUIPanel
if (firstDevice != null)
{
firstDevice.Set(true);
var trainer = SensorType == SensorType.Trainer && firstDevice.DeviceInfo.State == DeviceState.Connected;
var nontrainer = firstDevice.DeviceInfo.Sensor != SensorType.Trainer && SensorType != SensorType.Trainer && firstDevice.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";
}
//connectBtn.text.text = "DISCOUNECT";
noDevice.text = firstDevice.DeviceInfo.Name;
}
else
{
@ -278,6 +263,16 @@ public class ConnectDeviceModal : PFUIPanel
item.Value.Set(false);
}
}
noDevice.text = deviceItemObj.DeviceInfo.Name + "-"+ deviceItemObj.DeviceInfo.DeviceNumber;
if (deviceItemObj.DeviceInfo.State == DeviceState.Connected)
{
noDevice.color = Color.white;
}
else
{
noDevice.color = Utils.HexToColor("5C5C6E");
}
}
public override void Show()

View File

@ -279,7 +279,7 @@ public class DeviceView : MonoBehaviour
connectionPanel.SetActive(false);
logo.sprite = sprite0;
noDevice.text = App.GetLocalString("NO DEVICE");
searchState.text = App.GetLocalString("Searching...");
var hasDevice = false;
@ -289,6 +289,7 @@ public class DeviceView : MonoBehaviour
else {
hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType);
}
noDevice.text = hasDevice? App.GetLocalString("CHOOSE DEVICE") : App.GetLocalString("NO DEVICE");
//Debug.Log(hasDevice);
if (hasDevice)
{