修改观察者模式提示连接设备bug;新版本设备连接bug;单开限定

This commit is contained in:
Caiyanpeng committed 2021-11-22 16:10:11 +08:00
1 parent 9570334e25
commit 37e4c54c20
5 files changed
+12 -9

No files matched your search

@@ -70,10 +70,12 @@ public class DeviceView : MonoBehaviour
mSearchButton = unconnectionPanel.transform.Find("SearchButton").gameObject;
mPairButton = unconnectionPanel.transform.Find("PairButton").gameObject;
searchState = unconnectionPanel.transform.Find("SearchState").GetComponent<Text>();
unconnectionButton = unconnectionPanel.GetComponent<Button>();
mPairButton.SetActive(false);
connectionPanel = this.transform.Find("ConnectionPanel").gameObject;
#if UNITY_IOS || UNITY_ANDROID
unconnectionButton = unconnectionPanel.GetComponent<Button>();
connectionButton = connectionPanel.GetComponent<Button>();
#endif
var material = Instantiate(Resources.Load<Material>("UI/Material/RoundedCornersTextureMaterial"));
var rect = ((RectTransform)transform).rect;
material.SetVector(Shader.PropertyToID("_WidthHeightRadius"), new Vector4(rect.width, rect.height, rect.height * 0.2f, 0));
@@ -125,7 +127,7 @@ public class DeviceView : MonoBehaviour
title.text = GetTitle();
connectionPanel.SetActive(false);
#if UNITY_IOS || UNITY_ANDROID
UIManager.AddEvent(unconnectionButton.gameObject, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
{
if (!mPairButton.activeSelf)
@@ -134,13 +136,13 @@ public class DeviceView : MonoBehaviour
}
connectButtonClick();
}));
#endif
UIManager.AddEvent(mPairButton, EventTriggerType.PointerClick, new UnityAction<UnityEngine.EventSystems.BaseEventData>(e =>
{
connectButtonClick();
}));
#if UNITY_IOS || UNITY_ANDROID
UIManager.AddEvent(connectionButton.gameObject, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => {
if (!connectionPanel.activeSelf)
{
@@ -148,6 +150,7 @@ public class DeviceView : MonoBehaviour
}
mDisconnectButtonClick();
}));
#endif
UIManager.AddEvent(mDisconnectButton, EventTriggerType.PointerClick, new UnityEngine.Events.UnityAction<BaseEventData>(e => {
@@ -283,6 +286,7 @@ public class DeviceView : MonoBehaviour
else {
hasDevice = App.MainDeviceAdapter.GetDevices().Any(d => d.Sensor == SensorType);
}
Debug.Log(hasDevice);
if (hasDevice)
{
mSearchButton.SetActive(false);