设备连接界面文案与交互调整
This commit is contained in:
parent
2524e3a004
commit
a1010091f8
@ -59,6 +59,7 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 2a0878e6d65232b4eb49c2aa886ab9da, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
newNav: {fileID: 0}
|
||||
--- !u!1 &2752224541465288006
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -411,7 +412,7 @@ MonoBehaviour:
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Smart Trainer
|
||||
m_Text:
|
||||
--- !u!114 &2376164354960099470
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@ -1,18 +1,5 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &6820942701388656379
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 600129134975741725}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 954bbf32f326f684c90a328ec1db5ff9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mType: 2
|
||||
--- !u!114 &2374286134688455127
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -56,19 +43,19 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &6820942701245574145
|
||||
--- !u!114 &6820942701388656379
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 600129135100964347}
|
||||
m_GameObject: {fileID: 600129134975741725}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 954bbf32f326f684c90a328ec1db5ff9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mType: 8
|
||||
mType: 2
|
||||
--- !u!114 &619076547355285759
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -112,6 +99,19 @@ MonoBehaviour:
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &6820942701245574145
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 600129135100964347}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 954bbf32f326f684c90a328ec1db5ff9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
mType: 8
|
||||
--- !u!1 &6820942700051256070
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1682,7 +1682,7 @@ PrefabInstance:
|
||||
- target: {fileID: 7414013380646078914, guid: 95d5b69c6ebb5f34bb864b2c0756d442,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: -51
|
||||
value: -57
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7509276603553944008, guid: 95d5b69c6ebb5f34bb864b2c0756d442,
|
||||
type: 3}
|
||||
|
||||
@ -205,7 +205,7 @@
|
||||
"Cadence Sensor": "踏频",
|
||||
"Speed Meter": "速度计",
|
||||
"Heart Rate Monitor": "心率带",
|
||||
"NO DEVICE": "无可用设备",
|
||||
"NO DEVICE": "尚未连接设备",
|
||||
"Edit": "编辑",
|
||||
"Record": "记录",
|
||||
"More": "更多",
|
||||
|
||||
@ -23,6 +23,22 @@ public static class PFConstants
|
||||
return Application.persistentDataPath + "/RowerRecords/";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 划船机训练保存在本地的路径
|
||||
/// </summary>
|
||||
public static string RowerRecordCacheFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!Directory.Exists(Application.persistentDataPath + "/RowerRecordCaches/"))
|
||||
{
|
||||
Directory.CreateDirectory(Application.persistentDataPath + "/RowerRecordCaches/");
|
||||
}
|
||||
|
||||
return Application.persistentDataPath + "/RowerRecordCaches/";
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 课程训练保存在本地的路径
|
||||
/// </summary>
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -857,7 +857,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
{
|
||||
try
|
||||
{
|
||||
var files = Directory.GetFiles(PFConstants.RowerRecordFolder);
|
||||
var files = Directory.GetFiles(PFConstants.RowerRecordCacheFolder);
|
||||
if (files.Length > 0)
|
||||
{
|
||||
UIManager.ShowConfirm(App.GetLocalString("Warn"), App.GetLocalString("continue a game?"), () =>
|
||||
@ -894,7 +894,7 @@ public class RowerHomeScript : PFUIPanel
|
||||
{
|
||||
try
|
||||
{
|
||||
var path = $"{PFConstants.RowerRecordFolder}/{Id}.txt";
|
||||
var path = $"{PFConstants.RowerRecordCacheFolder}/{Id}.txt";
|
||||
File.WriteAllText(path, string.Join("\r\n", records));
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@ -67,7 +67,7 @@ public class RowerDeviceView : MonoBehaviour
|
||||
mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject;
|
||||
mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject;
|
||||
searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>();
|
||||
mPairButton.SetActive(false);
|
||||
//mPairButton.SetActive(false);
|
||||
connectionPanel = this.transform.Find("ConnectionPanel").gameObject;
|
||||
|
||||
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
|
||||
@ -278,7 +278,7 @@ public class RowerDeviceView : MonoBehaviour
|
||||
#if !(UNITY_IOS || UNITY_ANDROID)
|
||||
mSearchButton.SetActive(true);
|
||||
#endif
|
||||
mPairButton.SetActive(false);
|
||||
//mPairButton.SetActive(false);
|
||||
}
|
||||
}
|
||||
else if(connectedDevice.State == DeviceState.Connecting)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user