Fix buttons being usable in edit ui on mobile

This commit is contained in:
2025-08-25 22:47:48 -07:00
parent fef5b86927
commit 608b471b81
2 changed files with 16 additions and 7 deletions

View File

@@ -1350,7 +1350,6 @@ MonoBehaviour:
jumpButton: {fileID: 293594129} jumpButton: {fileID: 293594129}
rightButton: {fileID: 1125207522} rightButton: {fileID: 1125207522}
leftButton: {fileID: 2069651268} leftButton: {fileID: 2069651268}
editingUI: 0
--- !u!1 &349314674 --- !u!1 &349314674
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -91,12 +91,22 @@ public class GamePlayerPauseMenu : MonoBehaviour
coinsText.GetComponent<DraggableUI>().canDrag = !coinsText.GetComponent<DraggableUI>().canDrag; coinsText.GetComponent<DraggableUI>().canDrag = !coinsText.GetComponent<DraggableUI>().canDrag;
if (Application.isMobilePlatform) if (Application.isMobilePlatform)
{ {
pauseButton.transform.parent.SetSiblingIndex(pauseButton.GetComponent<DraggableUI>().canDrag ? 0 : 2); var pauseDraggableUI = pauseButton.GetComponent<DraggableUI>();
pauseButton.GetComponent<DraggableUI>().canDrag = !pauseButton.GetComponent<DraggableUI>().canDrag; var restartDraggableUI = restartButton.GetComponent<DraggableUI>();
restartButton.GetComponent<DraggableUI>().canDrag = !restartButton.GetComponent<DraggableUI>().canDrag; var jumpDraggableUI = jumpButton.GetComponent<DraggableUI>();
jumpButton.GetComponent<DraggableUI>().canDrag = !jumpButton.GetComponent<DraggableUI>().canDrag; var rightDraggableUI = rightButton.GetComponent<DraggableUI>();
rightButton.GetComponent<DraggableUI>().canDrag = !rightButton.GetComponent<DraggableUI>().canDrag; var leftDraggableUI = leftButton.GetComponent<DraggableUI>();
leftButton.GetComponent<DraggableUI>().canDrag = !leftButton.GetComponent<DraggableUI>().canDrag; pauseButton.transform.parent.SetSiblingIndex(pauseDraggableUI.canDrag ? 0 : 2);
pauseDraggableUI.canDrag = !pauseDraggableUI.canDrag;
restartDraggableUI.canDrag = !restartDraggableUI.canDrag;
jumpDraggableUI.canDrag = !jumpDraggableUI.canDrag;
rightDraggableUI.canDrag = !rightDraggableUI.canDrag;
leftDraggableUI.canDrag = !leftDraggableUI.canDrag;
pauseButton.interactable = !pauseDraggableUI.canDrag;
restartButton.interactable = !restartDraggableUI.canDrag;
jumpButton.interactable = !jumpDraggableUI.canDrag;
rightButton.interactable = !rightDraggableUI.canDrag;
leftButton.interactable = !leftDraggableUI.canDrag;
} }
} }
} }