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>
82 lines
2.3 KiB
C#
82 lines
2.3 KiB
C#
using TMPro;
|
||
using UnityEngine;
|
||
using UnityEngine.SceneManagement;
|
||
using UnityEngine.UI;
|
||
|
||
public class Mod10Resume : MonoBehaviour
|
||
{
|
||
[Header("UI TEXTS (ONLY NUMBERS)")]
|
||
public TMP_Text scoreText;
|
||
public TMP_Text maxScoreText;
|
||
public TMP_Text correctText;
|
||
public TMP_Text wrongText;
|
||
|
||
[Header("BUTTONS")]
|
||
public Button retryButton;
|
||
public Button exitButton;
|
||
|
||
[Header("AUDIO")]
|
||
public AudioSource sfx;
|
||
public AudioClip clickSound;
|
||
|
||
// Bu modun kendi ana anahtarı
|
||
private string modKey = "Mod10";
|
||
|
||
private int score;
|
||
private int maxScore;
|
||
private int correct;
|
||
private int wrong;
|
||
|
||
void Start()
|
||
{
|
||
LoadResults();
|
||
UpdateUI();
|
||
|
||
if (retryButton != null)
|
||
retryButton.onClick.AddListener(() => { PlaySFX(); Retry(); });
|
||
|
||
if (exitButton != null)
|
||
exitButton.onClick.AddListener(() => { PlaySFX(); ExitToMenu(); });
|
||
}
|
||
|
||
// ---------------------------------------------------------------
|
||
void LoadResults()
|
||
{
|
||
score = PlayerPrefs.GetInt(modKey + "_LastScore", 0);
|
||
maxScore = PlayerPrefs.GetInt(modKey + "_MaxScore", 0);
|
||
correct = PlayerPrefs.GetInt(modKey + "_Correct", 0);
|
||
wrong = PlayerPrefs.GetInt(modKey + "_Wrong", 0);
|
||
|
||
Debug.Log("MOD10 RESULT → " +
|
||
$"Score:{score} | Max:{maxScore} | C:{correct} | W:{wrong}");
|
||
}
|
||
|
||
// ---------------------------------------------------------------
|
||
void UpdateUI()
|
||
{
|
||
if (scoreText != null) scoreText.text = score.ToString();
|
||
if (maxScoreText != null) maxScoreText.text = maxScore.ToString();
|
||
if (correctText != null) correctText.text = correct.ToString();
|
||
if (wrongText != null) wrongText.text = wrong.ToString();
|
||
}
|
||
|
||
// ---------------------------------------------------------------
|
||
void PlaySFX()
|
||
{
|
||
if (sfx && clickSound)
|
||
sfx.PlayOneShot(clickSound);
|
||
}
|
||
|
||
// ---------------------------------------------------------------
|
||
void Retry()
|
||
{
|
||
// 🔥 MOD 10 OYUN SAHNESİNE GERİ DÖNÜŞ
|
||
SceneManager.LoadScene("Mod10");
|
||
}
|
||
|
||
// ---------------------------------------------------------------
|
||
void ExitToMenu()
|
||
{
|
||
SceneManager.LoadScene("Anamen");
|
||
}
|
||
}
|