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
101
Assets/Scripts/2.0/ResultScene_Galaxy.cs
Normal file
101
Assets/Scripts/2.0/ResultScene_Galaxy.cs
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class ResultScene_Galaxy : MonoBehaviour
|
||||
{
|
||||
[Header("RESULT TEXTS")]
|
||||
public TMP_Text scoreText;
|
||||
public TMP_Text correctText;
|
||||
public TMP_Text wrongText;
|
||||
public TMP_Text statusText;
|
||||
|
||||
[Header("BUTTONS")]
|
||||
public Button retryButton;
|
||||
public Button mainMenuButton;
|
||||
|
||||
[Header("SCENES (Inspector'dan gir)")]
|
||||
public string retrySceneName = "GalaxyGameScene_Level"; // tekrar oyna -> oyun sahnesi
|
||||
public string mainMenuScene = "Anamen";
|
||||
|
||||
[Header("SUCCESS THRESHOLD")]
|
||||
public int successScoreThreshold = 2000;
|
||||
|
||||
[Header("AUDIO")]
|
||||
public AudioSource audioSource;
|
||||
public AudioClip clickSound;
|
||||
|
||||
private int score;
|
||||
private int correct;
|
||||
private int wrong;
|
||||
|
||||
void Start()
|
||||
{
|
||||
score = PlayerPrefs.GetInt("Mod3Score", 0);
|
||||
correct = PlayerPrefs.GetInt("Mod3Correct", 0);
|
||||
wrong = PlayerPrefs.GetInt("Mod3Wrong", 0);
|
||||
|
||||
if (scoreText != null) scoreText.text = score.ToString();
|
||||
if (correctText != null) correctText.text = correct.ToString();
|
||||
if (wrongText != null) wrongText.text = wrong.ToString();
|
||||
|
||||
if (statusText != null)
|
||||
{
|
||||
if (score >= successScoreThreshold)
|
||||
{
|
||||
statusText.text = "LEVEL PASSED";
|
||||
statusText.color = Color.green;
|
||||
}
|
||||
else
|
||||
{
|
||||
statusText.text = "FAILED";
|
||||
statusText.color = Color.red;
|
||||
}
|
||||
}
|
||||
|
||||
if (retryButton != null)
|
||||
{
|
||||
retryButton.onClick.RemoveAllListeners();
|
||||
retryButton.onClick.AddListener(() =>
|
||||
{
|
||||
PlayClick();
|
||||
LoadScene(retrySceneName);
|
||||
});
|
||||
}
|
||||
|
||||
if (mainMenuButton != null)
|
||||
{
|
||||
mainMenuButton.onClick.RemoveAllListeners();
|
||||
mainMenuButton.onClick.AddListener(() =>
|
||||
{
|
||||
PlayClick();
|
||||
LoadScene(mainMenuScene);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void LoadScene(string sceneName)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sceneName))
|
||||
{
|
||||
Debug.LogError("ResultScene: Sahne adı boş! Inspector'dan doldur.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Application.CanStreamedLevelBeLoaded(sceneName))
|
||||
{
|
||||
Debug.LogError("ResultScene: '" + sceneName +
|
||||
"' sahnesi Build Settings'te yok ya da adı yanlış!");
|
||||
return;
|
||||
}
|
||||
|
||||
SceneManager.LoadScene(sceneName);
|
||||
}
|
||||
|
||||
void PlayClick()
|
||||
{
|
||||
if (audioSource && clickSound)
|
||||
audioSource.PlayOneShot(clickSound);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue