Fix restart button not being gray

This commit is contained in:
2025-08-24 15:00:43 -07:00
parent c0e3105abb
commit 35e3ad3712
2 changed files with 16 additions and 16 deletions

View File

@@ -2289,11 +2289,11 @@ MonoBehaviour:
overlayRender: {fileID: 450099081} overlayRender: {fileID: 450099081}
berryParent: {fileID: 157908646} berryParent: {fileID: 157908646}
mobileButtons: {fileID: 872476494} mobileButtons: {fileID: 872476494}
pauseButton: {fileID: 1577031231} pauseButton: {fileID: 1577031227}
restartButton: {fileID: 34767209} restartButton: {fileID: 34767206}
jumpButton: {fileID: 293594132} jumpButton: {fileID: 293594129}
rightButton: {fileID: 1125207525} rightButton: {fileID: 1125207522}
leftButton: {fileID: 2069651271} leftButton: {fileID: 2069651268}
--- !u!1 &527090675 --- !u!1 &527090675
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -42,11 +42,11 @@ public class GamePlayer : MonoBehaviour
public GameObject berryParent; public GameObject berryParent;
public GameObject mobileButtons; public GameObject mobileButtons;
public HoldableButton pauseButton; public Button pauseButton;
public HoldableButton restartButton; public Button restartButton;
public HoldableButton jumpButton; public Button jumpButton;
public HoldableButton rightButton; public Button rightButton;
public HoldableButton leftButton; public Button leftButton;
void Start() void Start()
{ {
@@ -205,11 +205,11 @@ public class GamePlayer : MonoBehaviour
var pos = touches[i].screenPosition; var pos = touches[i].screenPosition;
UnityEngine.Vector3 clickPosition = Camera.main.ScreenToWorldPoint(new UnityEngine.Vector3(pos.x, pos.y, 0f)); UnityEngine.Vector3 clickPosition = Camera.main.ScreenToWorldPoint(new UnityEngine.Vector3(pos.x, pos.y, 0f));
clickPosition.z = 0f; clickPosition.z = 0f;
if (leftButton.isPressed) doMoveLeft = true; if (leftButton.GetComponent<HoldableButton>().isPressed) doMoveLeft = true;
if (rightButton.isPressed) doMoveRight = true; if (rightButton.GetComponent<HoldableButton>().isPressed) doMoveRight = true;
if (jumpButton.isPressed) doJump = true; if (jumpButton.GetComponent<HoldableButton>().isPressed) doJump = true;
if (restartButton.isPressed) doRestart = true; if (restartButton.GetComponent<HoldableButton>().isPressed) doRestart = true;
if (pauseButton.isPressed) doBack = true; if (pauseButton.GetComponent<HoldableButton>().isPressed) doBack = true;
} }
} }
if (doMoveLeft && !doMoveRight) if (doMoveLeft && !doMoveRight)
@@ -608,7 +608,7 @@ public class GamePlayer : MonoBehaviour
scoreText.text = $"Score: {Tools.FormatWithCommas(score)} \\u2022 Attempts: {Tools.FormatWithCommas(attempts)}"; scoreText.text = $"Score: {Tools.FormatWithCommas(score)} \\u2022 Attempts: {Tools.FormatWithCommas(attempts)}";
highScoreText.text = $"High Score: {Tools.FormatWithCommas(highscore)} \\u2022 Total Attempts: {Tools.FormatWithCommas(totalAttempts)}"; highScoreText.text = $"High Score: {Tools.FormatWithCommas(highscore)} \\u2022 Total Attempts: {Tools.FormatWithCommas(totalAttempts)}";
coinText.text = $"Coins: {Tools.FormatWithCommas(totalCoins)}"; coinText.text = $"Coins: {Tools.FormatWithCommas(totalCoins)}";
if (Application.isMobilePlatform) restartButton.transform.GetChild(0).GetComponent<TMP_Text>().material.color = score == 0 ? Color.gray : Color.white; if (Application.isMobilePlatform) restartButton.interactable = score != 0;
} }
void CheckIfGrounded() void CheckIfGrounded()