TO SQUASH: menu callbacks

This commit is contained in:
2026-07-30 03:03:24 -04:00
parent 2b2492e86e
commit 011fc467b8
7 changed files with 174 additions and 10 deletions
+18 -6
View File
@@ -1,11 +1,20 @@
using UnityEngine;
public class MenuCallbackHolder
public class MenuCallbackHolder: MonoBehaviour
{
private System.Action[] callbacks;
public MenuCallbackHolder()
private AudioSource audioSource;
private AudioClip zapAudioClip;
private static readonly string zapAudioClipPath = "Audio/1496_YummyStorm";
void Start()
{
audioSource = GetComponent<AudioSource>();
zapAudioClip = Resources.Load<AudioClip>(zapAudioClipPath);
callbacks = new System.Action[]
{
PlayButtonCallback,
@@ -38,25 +47,28 @@ public class MenuCallbackHolder
public void InstruccionsButtonCallback()
{
Debug.Log("Instructions button pressed");
// UnityEngine.SceneManagement.SceneManager.LoadScene("Instructions");
// TODO: Implement instructions scene.
}
public void SetupButtonCallback()
{
Debug.Log("Setup button pressed");
// UnityEngine.SceneManagement.SceneManager.LoadScene("Setup");
// TODO: Implement setup dialog.
}
public void ZapButtonCallback()
{
Debug.Log("Zap Scores button pressed");
// UnityEngine.SceneManagement.SceneManager.LoadScene("Zap");
audioSource.PlayOneShot(zapAudioClip);
// TODO: Add a confirmation dialog before resetting scores
GameSetup.ZapScores();
}
public void AboutButtonCallback()
{
Debug.Log("About button pressed");
// UnityEngine.SceneManagement.SceneManager.LoadScene("About");
// TODO: Implement about dialog.
}
public void QuitButtonCallback()
+2 -3
View File
@@ -6,6 +6,8 @@ public class MenuKey : MonoBehaviour
public AudioClip keyTurnClose;
public MenuCallbackHolder callbackHolder;
private AudioSource audioSource;
private Animator animator;
@@ -22,8 +24,6 @@ public class MenuKey : MonoBehaviour
private float translationTargetY = 0f;
private MenuCallbackHolder callbackHolder;
private static float animationDuration = 0.45f;
private static float[] rowPositions = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
@@ -33,7 +33,6 @@ public class MenuKey : MonoBehaviour
{
audioSource = GetComponent<AudioSource>();
animator = GetComponent<Animator>();
callbackHolder = new MenuCallbackHolder();
// Precompute the row positions based on the number of rows and the desired spacing.
for (int i = 0; i < rowPositions.Length; i++)