Initial commit: Star of Words Unity project
Snapshot of the existing Unity 6 language-learning word game before any refactoring. Adds Unity .gitignore and .gitattributes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
commit
ecb1c9edea
1455 changed files with 933295 additions and 0 deletions
53
Assets/Scripts/2.0/ModeSelectController.cs
Normal file
53
Assets/Scripts/2.0/ModeSelectController.cs
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class ModeSelectController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Button[] modButtons = new Button[30];
|
||||
[SerializeField] private Button backButton;
|
||||
[SerializeField] private string mainMenuScene = "Anamen";
|
||||
[SerializeField] private AudioSource audioSource;
|
||||
[SerializeField] private AudioClip clickSound;
|
||||
|
||||
[Header("MOD Sahneleri")]
|
||||
[SerializeField] private string[] modScenes = new string[30];
|
||||
|
||||
void Start()
|
||||
{
|
||||
// Bind mod buttons
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
if (modButtons[i] != null)
|
||||
{
|
||||
int modID = i + 1;
|
||||
modButtons[i].onClick.AddListener(() => SelectMode(modID));
|
||||
}
|
||||
}
|
||||
|
||||
// Back button
|
||||
if (backButton != null)
|
||||
backButton.onClick.AddListener(() => LoadScene(mainMenuScene));
|
||||
}
|
||||
|
||||
void SelectMode(int modID)
|
||||
{
|
||||
PlaySound();
|
||||
PlayerPrefs.SetInt("SelectedMode", modID);
|
||||
PlayerPrefs.Save();
|
||||
|
||||
string sceneName = modScenes[modID - 1];
|
||||
LoadScene(sceneName);
|
||||
}
|
||||
|
||||
void LoadScene(string sceneName)
|
||||
{
|
||||
SceneManager.LoadScene(sceneName);
|
||||
}
|
||||
|
||||
void PlaySound()
|
||||
{
|
||||
if (audioSource && clickSound)
|
||||
audioSource.PlayOneShot(clickSound);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue