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

This commit is contained in:
CaiYanPeng 2021-11-22 16:09:51 +08:00
parent 9570334e25
commit 37e4c54c20
5 changed files with 12 additions and 9 deletions

View File

@ -510,7 +510,7 @@ public class CyclingController : DeviceServiceMonoBase
#if UNITY_EDITOR
check = true;
#endif
if (check)
if (check || isWatch)
{
singleUIManager.StartRide();
transform.Find("UI/Panel(Clone)/ToolBarPanel/StartOrPauseButton").GetComponent<Button>().enabled = true;
@ -521,7 +521,7 @@ public class CyclingController : DeviceServiceMonoBase
transform.Find("UI/Panel(Clone)/ToolBarPanel/StartOrPauseButton").GetComponent<Button>().enabled = false;
transform.Find("UI/Panel(Clone)/ToolBarPanel/SettingButton").GetComponent<Button>().enabled = false;
Utils.showToast(null, "Please connect the device!", duration: int.MaxValue, isLowest: true
, stopFunc: () => !(!CheckAnt() && !isWatch) || transform.Find("UI/Panel(Clone)/SelectPlayer").gameObject.activeInHierarchy
, stopFunc: () => isWatch || CheckAnt() || transform.Find("UI/Panel(Clone)/SelectPlayer").gameObject.activeInHierarchy
, endCallback: () =>
{
if (!transform.Find("UI/Panel(Clone)/SelectPlayer").gameObject.activeInHierarchy)

View File

@ -61,7 +61,7 @@ namespace Assets.Scenes.Ride.Scripts
weight = App.CurrentUser.Weight;
bicycleWeight = App.CurrentUser.BicycleWeight;
#if UNITY_EDITOR
power = 343;
power = 143;
#endif
mainController.TrackResistance(currentSlope * App.RideSetting.Sensitivity / 100);
}

View File

@ -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);

View File

@ -38,7 +38,6 @@ GraphicsSettings:
- {fileID: 16000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16001, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 17000, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 16003, guid: 0000000000000000f000000000000000, type: 0}
m_PreloadedShaders: []
m_SpritesDefaultMaterial: {fileID: 10754, guid: 0000000000000000f000000000000000,
type: 0}

View File

@ -86,7 +86,7 @@ PlayerSettings:
submitAnalytics: 1
usePlayerLog: 1
bakeCollisionMeshes: 0
forceSingleInstance: 0
forceSingleInstance: 1
useFlipModelSwapchain: 1
resizableWindow: 0
useMacAppStoreValidation: 0