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
1127
Assets/Scripts/2.0/GalaxyGameScene.cs
Normal file
1127
Assets/Scripts/2.0/GalaxyGameScene.cs
Normal file
File diff suppressed because it is too large
Load diff
2
Assets/Scripts/2.0/GalaxyGameScene.cs.meta
Normal file
2
Assets/Scripts/2.0/GalaxyGameScene.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 59b9a2ac56496444bac7b43b2c8e916d
|
||||
1134
Assets/Scripts/2.0/LLGameScene.cs
Normal file
1134
Assets/Scripts/2.0/LLGameScene.cs
Normal file
File diff suppressed because it is too large
Load diff
2
Assets/Scripts/2.0/LLGameScene.cs.meta
Normal file
2
Assets/Scripts/2.0/LLGameScene.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 77da8ebed4f07fe4fad686635f694c51
|
||||
86
Assets/Scripts/2.0/LanguageSettingsController.cs
Normal file
86
Assets/Scripts/2.0/LanguageSettingsController.cs
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.SceneManagement;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class LanguageSettingsController : MonoBehaviour
|
||||
{
|
||||
[Header("━━━ DROPDOWNLAR ━━━━━━━━━━━━━━━━━━━━━━━")]
|
||||
public TMP_Dropdown questionDropdown;
|
||||
public TMP_Dropdown answerDropdown;
|
||||
|
||||
[Header("━━━ BUTONLAR ━━━━━━━━━━━━━━━━━━━━━━━━━━")]
|
||||
public Button saveAndBackButton;
|
||||
|
||||
[Header("━━━ AUDIO ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")]
|
||||
public AudioClip clickSound;
|
||||
public AudioSource sfxSource;
|
||||
|
||||
void Start()
|
||||
{
|
||||
PopulateDropdowns();
|
||||
|
||||
questionDropdown.value = PlayerPrefs.GetInt("QuestionLangID", 1);
|
||||
answerDropdown.value = PlayerPrefs.GetInt("AnswerLangID", 0);
|
||||
|
||||
questionDropdown.RefreshShownValue();
|
||||
answerDropdown.RefreshShownValue();
|
||||
|
||||
saveAndBackButton.onClick.AddListener(() => { PlayClick(); SaveAndBack(); });
|
||||
}
|
||||
|
||||
void PopulateDropdowns()
|
||||
{
|
||||
List<string> languageNames = new List<string>
|
||||
{
|
||||
"Türkçe", // 0
|
||||
"English", // 1
|
||||
"Español", // 2
|
||||
"Deutsch", // 3
|
||||
"Français", // 4
|
||||
"Português" // 5
|
||||
};
|
||||
|
||||
questionDropdown.ClearOptions();
|
||||
answerDropdown.ClearOptions();
|
||||
|
||||
questionDropdown.AddOptions(languageNames);
|
||||
answerDropdown.AddOptions(languageNames);
|
||||
}
|
||||
|
||||
void SaveAndBack()
|
||||
{
|
||||
int qID = questionDropdown.value;
|
||||
int aID = answerDropdown.value;
|
||||
|
||||
PlayerPrefs.SetInt("QuestionLangID", qID);
|
||||
PlayerPrefs.SetInt("AnswerLangID", aID);
|
||||
PlayerPrefs.SetString("QuestionLangCode", ToCode(qID));
|
||||
PlayerPrefs.SetString("AnswerLangCode", ToCode(aID));
|
||||
PlayerPrefs.SetString("AppLanguage", ToCode(qID));
|
||||
PlayerPrefs.Save();
|
||||
|
||||
SceneManager.LoadScene("Anamen");
|
||||
}
|
||||
|
||||
void PlayClick()
|
||||
{
|
||||
if (sfxSource != null && clickSound != null)
|
||||
sfxSource.PlayOneShot(clickSound);
|
||||
}
|
||||
|
||||
string ToCode(int id)
|
||||
{
|
||||
return id switch
|
||||
{
|
||||
0 => "tr",
|
||||
1 => "en",
|
||||
2 => "es",
|
||||
3 => "de",
|
||||
4 => "fr",
|
||||
5 => "pt",
|
||||
_ => "en"
|
||||
};
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/2.0/LanguageSettingsController.cs.meta
Normal file
2
Assets/Scripts/2.0/LanguageSettingsController.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3cbf52aaa9ea95145b92e9f010db66dd
|
||||
11
Assets/Scripts/2.0/LanguageType.cs
Normal file
11
Assets/Scripts/2.0/LanguageType.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using UnityEngine;
|
||||
|
||||
public enum LanguageType
|
||||
{
|
||||
TR = 1,
|
||||
EN = 2,
|
||||
ES = 3,
|
||||
DE = 4,
|
||||
FR = 5,
|
||||
PT = 6
|
||||
}
|
||||
2
Assets/Scripts/2.0/LanguageType.cs.meta
Normal file
2
Assets/Scripts/2.0/LanguageType.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 32b83b44bd3dd0d4a8f5186eaf12aeca
|
||||
220
Assets/Scripts/2.0/LevelSelectController.cs
Normal file
220
Assets/Scripts/2.0/LevelSelectController.cs
Normal file
|
|
@ -0,0 +1,220 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.SceneManagement;
|
||||
using System.Collections;
|
||||
|
||||
public class LevelSelectController : MonoBehaviour
|
||||
{
|
||||
[Header("━━━ UI ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")]
|
||||
public Button[] levelButtons;
|
||||
public TMP_Text[] levelNameTexts;
|
||||
public TMP_Text[] levelScoreTexts;
|
||||
|
||||
[Header("━━━ BACK BUTONU ━━━━━━━━━━━━━━━━━━━━━━━")]
|
||||
public Button backButton;
|
||||
public string backSceneName = "Anamen";
|
||||
|
||||
[Header("━━━ AUDIO ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━")]
|
||||
public AudioSource sfxSource;
|
||||
public AudioClip clickSound;
|
||||
|
||||
[Header("━━━ ANİMASYON ━━━━━━━━━━━━━━━━━━━━━━━━━")]
|
||||
[Range(0.005f, 0.1f)] public float buttonAniSpeed = 0.02f;
|
||||
|
||||
private int langIndex;
|
||||
private Vector3[] originalScales;
|
||||
private Vector3[] originalPositions;
|
||||
|
||||
// ============================================================
|
||||
private readonly string[,] levelNames = new string[,]
|
||||
{
|
||||
{ "Temel Selamlaşma ve İnsanlar","Basic Greetings & People","Saludos Básicos y Personas","Grundbegrüßungen & Menschen","Salutations de Base & Personnes","Saudações Básicas e Pessoas" },
|
||||
{ "Günlük Ev Nesneleri","Daily Household Items","Objetos del Hogar Diarios","Tägliche Haushaltsgegenstände","Objets Quotidiens de la Maison","Objetos Domésticos Diários" },
|
||||
{ "Yiyecekler ve İçecekler","Food & Drinks","Comida y Bebida","Essen & Getränke","Nourriture & Boissons","Comidas e Bebidas" },
|
||||
{ "Renkler, Şekiller ve Boyutlar","Colors, Shapes & Sizes","Colores, Formas y Tamaños","Farben, Formen & Größen","Couleurs, Formas & Tailles","Cores, Formas e Tamanhos" },
|
||||
{ "Zaman, Günler ve Mevsimler","Time, Days & Seasons","Tiempo, Días y Estaciones","Zeit, Tage & Jahreszeiten","Temps, Jours & Saisons","Tempo, Dias e Estações" },
|
||||
{ "Ev İçi Alanlar ve Temizlik","Home Areas & Cleaning","Áreas del Hogar y Limpieza","Hausbereiche & Reinigung","Espaces de Maison & Nettoyage","Áreas da Casa e Limpeza" },
|
||||
{ "Okul, Eğitim ve Ders Araçları","School, Education & Supplies","Escuela, Educación y Útiles","Schule, Bildung & Materialien","École, Éducation & Fournitures","Escola, Educação e Materiais" },
|
||||
{ "Vücut Parçaları ve Sağlık","Body Parts & Health","Partes del Cuerpo y Salud","Körperteile & Gesundheit","Parties du Corps & Santé","Partes do Corpo e Saúde" },
|
||||
{ "Doğa, Hava ve Çevre Unsurları","Nature, Weather & Environment","Naturaleza, Clima y Medio Ambiente","Natur, Wetter & Umwelt","Nature, Météo & Environnement","Natureza, Clima e Meio Ambiente" },
|
||||
{ "Evcil ve Vahşi Hayvanlar","Pets & Wild Animals","Mascotas y Animales Salvajes","Haustiere & Wildtiere","Animaux Domestiques & Sauvages","Animais Domésticos e Selvagens" },
|
||||
{ "Ulaşım Araçları ve Trafik","Transportation & Traffic","Transporte y Tráfico","Transport & Verkehr","Transport & Circulation","Transporte e Trânsito" },
|
||||
{ "Alışveriş ve Mağazalar","Shopping & Stores","Compras y Tiendas","Einkaufen & Geschäfte","Shopping & Magasins","Compras e Lojas" },
|
||||
{ "Spor Dalları ve Ekipmanları","Sports & Equipment","Deportes y Equipamiento","Sportarten & Ausrüstung","Sports & Équipement","Esportes e Equipamentos" },
|
||||
{ "Meslekler ve İş Alanları","Jobs & Work Fields","Profesiones y Áreas Laborales","Berufe & Arbeitsfelder","Métiers & Domaines de Travail","Profissões e Áreas de Trabalho" },
|
||||
{ "Şehir, Yerler ve Binalar","City, Places & Buildings","Ciudad, Lugares y Edificios","Stadt, Orte & Gebäude","Ville, Lieux & Bâtiments","Cidade, Lugares e Edifícios" },
|
||||
{ "Duygular, Durumlar ve Karakter","Emotions, States & Character","Emociones, Estados y Carácter","Gefühle, Zustände & Charakter","Émotions, États & Caractère","Emoções, Estados e Caráter" },
|
||||
{ "Seyahat, Tatil ve Turizm","Travel, Vacation & Tourism","Viajes, Vacaciones y Turismo","Reisen, Urlaub & Tourismus","Voyage, Vacances & Tourisme","Viagem, Férias e Turismo" },
|
||||
{ "Teknoloji, İnternet ve Cihazlar","Technology, Internet & Devices","Tecnología, Internet y Dispositivos","Technologie, Internet & Geräte","Technologie, Internet & Appareils","Tecnologia, Internet e Dispositivos" },
|
||||
{ "Çevre Koruma ve Geri Dönüşüm","Environmental Protection & Recycling","Protección Ambiental y Reciclaje","Umweltschutz & Recycling","Protection de l'Environnement & Recyclage","Proteção Ambiental e Reciclagem" },
|
||||
{ "İleri Günlük İfadeler ve İş Hayatı","Advanced Daily Phrases & Work Life","Frases Avanzadas y Vida Laboral","Fortgeschrittene Alltagssätze & Arbeitsleben","Phrases Avançées & Vie Professionnelle","Frases Avançadas e Vida Profissional" }
|
||||
};
|
||||
|
||||
private readonly string[] scoreLabel =
|
||||
{
|
||||
"Puan","Score","Puntuación","Punkte","Score","Pontuação"
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
void Start()
|
||||
{
|
||||
string ansLang = PlayerPrefs.GetString("AnswerLangCode", "tr").ToLower();
|
||||
langIndex = GetLangIndex(ansLang);
|
||||
|
||||
CacheButtonData();
|
||||
SetupLevelNames();
|
||||
LoadScoresToUI();
|
||||
BindButtons();
|
||||
|
||||
// ─── Buton giriş animasyonu ───────────────
|
||||
for (int i = 0; i < levelButtons.Length; i++)
|
||||
StartCoroutine(ButtonEnterAnim(levelButtons[i], i));
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
int GetLangIndex(string code)
|
||||
{
|
||||
return code switch
|
||||
{
|
||||
"tr" => 0,
|
||||
"en" => 1,
|
||||
"es" => 2,
|
||||
"de" => 3,
|
||||
"fr" => 4,
|
||||
"pt" => 5,
|
||||
_ => 1
|
||||
};
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void CacheButtonData()
|
||||
{
|
||||
if (levelButtons == null) return;
|
||||
originalScales = new Vector3[levelButtons.Length];
|
||||
originalPositions = new Vector3[levelButtons.Length];
|
||||
for (int i = 0; i < levelButtons.Length; i++)
|
||||
{
|
||||
if (levelButtons[i] == null) continue;
|
||||
originalScales[i] = levelButtons[i].transform.localScale;
|
||||
originalPositions[i] = levelButtons[i].transform.localPosition;
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void SetupLevelNames()
|
||||
{
|
||||
if (levelNameTexts == null) return;
|
||||
for (int i = 0; i < levelNameTexts.Length; i++)
|
||||
if (levelNameTexts[i] != null)
|
||||
levelNameTexts[i].text = levelNames[i, langIndex];
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void BindButtons()
|
||||
{
|
||||
if (levelButtons == null) return;
|
||||
|
||||
for (int i = 0; i < levelButtons.Length; i++)
|
||||
{
|
||||
if (levelButtons[i] == null) continue;
|
||||
int id = i + 1;
|
||||
levelButtons[i].onClick.RemoveAllListeners();
|
||||
levelButtons[i].onClick.AddListener(() =>
|
||||
{
|
||||
PlayClick();
|
||||
PlayerPrefs.SetInt("SelectedLevel", id);
|
||||
PlayerPrefs.Save();
|
||||
SceneManager.LoadScene("LLGameScene_Level");
|
||||
});
|
||||
}
|
||||
|
||||
if (backButton != null)
|
||||
backButton.onClick.AddListener(() => { PlayClick(); SceneManager.LoadScene(backSceneName); });
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void LoadScoresToUI()
|
||||
{
|
||||
if (levelScoreTexts == null) return;
|
||||
for (int i = 0; i < levelScoreTexts.Length; i++)
|
||||
{
|
||||
if (levelScoreTexts[i] == null) continue;
|
||||
int levelID = i + 1;
|
||||
int highScore = PlayerPrefs.GetInt("HighScore_Level_" + levelID, 0);
|
||||
|
||||
if (highScore >= 2000)
|
||||
{
|
||||
levelScoreTexts[i].text = $"{scoreLabel[langIndex]}: 2000 / 2000";
|
||||
levelScoreTexts[i].color = Color.green;
|
||||
}
|
||||
else
|
||||
{
|
||||
levelScoreTexts[i].text = $"{scoreLabel[langIndex]}: {highScore} / 2000";
|
||||
levelScoreTexts[i].color = Color.red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void PlayClick()
|
||||
{
|
||||
if (sfxSource != null && clickSound != null)
|
||||
sfxSource.PlayOneShot(clickSound);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// ANİMASYONLAR
|
||||
// ============================================================
|
||||
IEnumerator ButtonEnterAnim(Button btn, int delayIndex)
|
||||
{
|
||||
if (btn == null || originalScales == null) yield break;
|
||||
int idx = System.Array.IndexOf(levelButtons, btn);
|
||||
if (idx < 0 || idx >= originalScales.Length) yield break;
|
||||
|
||||
yield return new WaitForSeconds(delayIndex * 0.08f);
|
||||
|
||||
Vector3 targetPos = originalPositions[idx];
|
||||
Vector3 startPos = targetPos + Vector3.up * 60f;
|
||||
Vector3 targetScale = originalScales[idx];
|
||||
|
||||
btn.transform.localPosition = startPos;
|
||||
btn.transform.localScale = Vector3.zero;
|
||||
|
||||
float t = 0f;
|
||||
while (t < 1f)
|
||||
{
|
||||
t = Mathf.Min(t + buttonAniSpeed * 0.13f, 1f);
|
||||
float ease = EaseOutBack(t);
|
||||
btn.transform.localPosition = Vector3.Lerp(startPos, targetPos, ease);
|
||||
btn.transform.localScale = Vector3.Lerp(Vector3.zero, targetScale, ease);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
btn.transform.localPosition = targetPos;
|
||||
btn.transform.localScale = targetScale;
|
||||
}
|
||||
|
||||
IEnumerator PunchScale(Button btn, int idx)
|
||||
{
|
||||
if (btn == null || originalScales == null) yield break;
|
||||
if (idx < 0 || idx >= originalScales.Length) yield break;
|
||||
Vector3 original = originalScales[idx];
|
||||
Vector3 big = original * 1.08f;
|
||||
float t = 0f;
|
||||
while (t < 1f) { t = Mathf.Min(t + 0.15f, 1f); btn.transform.localScale = Vector3.Lerp(original, big, EaseOutQuad(t)); yield return null; }
|
||||
t = 0f;
|
||||
while (t < 1f) { t = Mathf.Min(t + 0.12f, 1f); btn.transform.localScale = Vector3.Lerp(big, original, EaseOutQuad(t)); yield return null; }
|
||||
btn.transform.localScale = original;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
float EaseOutBack(float t)
|
||||
{
|
||||
float c1 = 1.70158f;
|
||||
float c3 = c1 + 1f;
|
||||
return 1f + c3 * Mathf.Pow(t - 1f, 3f) + c1 * Mathf.Pow(t - 1f, 2f);
|
||||
}
|
||||
|
||||
float EaseOutQuad(float t) => 1f - (1f - t) * (1f - t);
|
||||
}
|
||||
2
Assets/Scripts/2.0/LevelSelectController.cs.meta
Normal file
2
Assets/Scripts/2.0/LevelSelectController.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1bdc7981307c4924f9526f3bba47b417
|
||||
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);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/2.0/ModeSelectController.cs.meta
Normal file
2
Assets/Scripts/2.0/ModeSelectController.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d46006198cd5c3b4d8c76badb7f20a2c
|
||||
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);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/2.0/ResultScene_Galaxy.cs.meta
Normal file
2
Assets/Scripts/2.0/ResultScene_Galaxy.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1ec4b2e43350ee04097c45d54640af8f
|
||||
221
Assets/Scripts/2.0/ResultScene_TTE.cs
Normal file
221
Assets/Scripts/2.0/ResultScene_TTE.cs
Normal file
|
|
@ -0,0 +1,221 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class ResultScene_TTE : MonoBehaviour
|
||||
{
|
||||
[Header("UI Texts")]
|
||||
public TMP_Text levelNameText;
|
||||
public TMP_Text scoreText;
|
||||
public TMP_Text highScoreText;
|
||||
public TMP_Text correctText;
|
||||
public TMP_Text wrongText;
|
||||
public TMP_Text resultStatusText;
|
||||
|
||||
[Header("Buttons")]
|
||||
public Button retryButton;
|
||||
public Button levelMapButton;
|
||||
public Button mainMenuButton;
|
||||
|
||||
[Header("Audio")]
|
||||
public AudioSource audioSource;
|
||||
public AudioClip clickSound;
|
||||
|
||||
[Header("Scene Names")]
|
||||
[SerializeField] private string levelMapScene = "StageLevelMap";
|
||||
[SerializeField] private string mainMenuScene = "Anamen";
|
||||
[SerializeField] private string gameSceneName = "LLGameScene_Level";
|
||||
|
||||
private int score;
|
||||
private int correct;
|
||||
private int wrong;
|
||||
private int selectedLevel;
|
||||
|
||||
private int langIndex; // CEVAP DİLİ İNDEKSİ
|
||||
|
||||
// ===========================
|
||||
// 20 LEVEL ADI (6 DİL)
|
||||
// ===========================
|
||||
private readonly string[,] levelNames = new string[,]
|
||||
{
|
||||
{ "Temel Selamlaşma ve İnsanlar","Basic Greetings & People","Saludos Básicos y Personas","Grundbegrüßungen & Menschen","Salutations de Base & Personnes","Saudações Básicas e Pessoas" },
|
||||
{ "Günlük Ev Nesneleri","Daily Household Items","Objetos del Hogar Diarios","Tägliche Haushaltsgegenstände","Objets Quotidiens de la Maison","Objetos Domésticos Diários" },
|
||||
{ "Yiyecekler ve İçecekler","Food & Drinks","Comida y Bebida","Essen & Getränke","Nourriture & Boissons","Comidas e Bebidas" },
|
||||
{ "Renkler, Şekiller ve Boyutlar","Colors, Shapes & Sizes","Colores, Formas y Tamaños","Farben, Formen & Größen","Couleurs, Formes & Tailles","Cores, Formas e Tamanhos" },
|
||||
{ "Zaman, Günler ve Mevsimler","Time, Days & Seasons","Tiempo, Días y Estaciones","Zeit, Tage & Jahreszeiten","Temps, Jours & Saisons","Tempo, Dias e Estações" },
|
||||
{ "Ev İçi Alanlar ve Temizlik","Home Areas & Cleaning","Áreas del Hogar y Limpieza","Hausbereiche & Reinigung","Espaces de Maison & Nettoyage","Áreas da Casa e Limpeza" },
|
||||
{ "Okul, Eğitim ve Ders Araçları","School, Education & Supplies","Escuela, Educación y Útiles","Schule, Bildung & Materialien","École, Éducation & Fournitures","Escola, Educação e Materiais" },
|
||||
{ "Vücut Parçaları ve Sağlık","Body Parts & Health","Partes del Cuerpo y Salud","Körperteile & Gesundheit","Parties du Corps & Santé","Partes do Corpo e Saúde" },
|
||||
{ "Doğa, Hava ve Çevre Unsurları","Nature, Weather & Environment","Naturaleza, Clima y Medio Ambiente","Natur, Wetter & Umwelt","Nature, Météo & Environnement","Natureza, Clima e Meio Ambiente" },
|
||||
{ "Evcil ve Vahşi Hayvanlar","Pets & Wild Animals","Mascotas y Animales Salvajes","Haustiere & Wildtiere","Animaux Domestiques & Sauvages","Animais Domésticos e Selvagens" },
|
||||
{ "Ulaşım Araçları ve Trafik","Transportation & Traffic","Transporte y Tráfico","Transport & Verkehr","Transport & Circulation","Transporte e Trânsito" },
|
||||
{ "Alışveriş ve Mağazalar","Shopping & Stores","Compras y Tiendas","Einkaufen & Geschäfte","Shopping & Magasins","Compras e Lojas" },
|
||||
{ "Spor Dalları ve Ekipmanları","Sports & Equipment","Deportes y Equipamiento","Sportarten & Ausrüstung","Sports & Équipement","Esportes e Equipamentos" },
|
||||
{ "Meslekler ve İş Alanları","Jobs & Work Fields","Profesiones y Áreas Laborales","Berufe & Arbeitsfelder","Métiers & Domaines de Travail","Profissões e Áreas de Trabalho" },
|
||||
{ "Şehir, Yerler ve Binalar","City, Places & Buildings","Ciudad, Lugares y Edificios","Stadt, Orte & Gebäude","Ville, Lieux & Bâtiments","Cidade, Lugares e Edifícios" },
|
||||
{ "Duygular, Durumlar ve Karakter","Emotions, States & Character","Emociones, Estados y Carácter","Gefühle, Zustände & Charakter","Émotions, États & Caractère","Emoções, Estados e Caráter" },
|
||||
{ "Seyahat, Tatil ve Turizm","Travel, Vacation & Tourism","Viajes, Vacaciones y Turismo","Reisen, Urlaub & Tourismus","Voyage, Vacances & Tourisme","Viagem, Férias e Turismo" },
|
||||
{ "Teknoloji, İnternet ve Cihazlar","Technology, Internet & Devices","Tecnología, Internet y Dispositivos","Technologie, Internet & Geräte","Technologie, Internet & Appareils","Tecnologia, Internet e Dispositivos" },
|
||||
{ "Çevre Koruma ve Geri Dönüşüm","Environmental Protection & Recycling","Protección Ambiental y Reciclaje","Umweltschutz & Recycling","Protection de l'Environnement & Recyclage","Proteção Ambiental e Reciclagem" },
|
||||
{ "İleri Günlük İfadeler ve İş Hayatı","Advanced Daily Phrases & Work Life","Frases Avanzadas y Vida Laboral","Fortgeschrittene Alltagssätze & Arbeitsleben","Phrases Avancées & Vie Professionnelle","Frases Avançadas e Vida Profissional" }
|
||||
};
|
||||
|
||||
private readonly string[] labelScore = { " ", " ", " ", " ", " ", " " };
|
||||
private readonly string[] labelHighScore = { " ", " ", " ", " ", " ", " " };
|
||||
private readonly string[] labelCorrect = { " ", " ", " ", " ", " ", " " };
|
||||
private readonly string[] labelWrong = { " ", " ", " ", " ", " ", " " };
|
||||
private readonly string[] labelPassed = {
|
||||
"TEBRİKLER! 🎉 LEVEL GEÇİLDİ",
|
||||
"CONGRATULATIONS! 🎉 LEVEL CLEARED",
|
||||
"¡FELICIDADES! 🎉 NIVEL COMPLETADO",
|
||||
"GLÜCKWUNSCH! 🎉 LEVEL GESCHAFFT",
|
||||
"FÉLICITATIONS ! 🎉 NIVEAU RÉUSSI",
|
||||
"PARABÉNS! 🎉 NÍVEL CONCLUÍDO"
|
||||
};
|
||||
|
||||
private readonly string[] labelFailed = {
|
||||
"LEVEL BAŞARISIZ ❌",
|
||||
"LEVEL FAILED ❌",
|
||||
"NIVEL FALLIDO ❌",
|
||||
"LEVEL NICHT BESTANDEN ❌",
|
||||
"NIVEAU ÉCHOUÉ ❌",
|
||||
"NÍVEL REPROVADO ❌"
|
||||
};
|
||||
|
||||
// ============================================================
|
||||
void Start()
|
||||
{
|
||||
// 1) Dil indexini al
|
||||
string ansLang = PlayerPrefs.GetString("AnswerLangCode", "tr").ToLower();
|
||||
langIndex = GetLangIndex(ansLang);
|
||||
|
||||
// 2) Sonuçları yükle + high score kaydet
|
||||
LoadResults();
|
||||
SaveHighScore();
|
||||
|
||||
// 3) ÖNCE butonları bağla (Start hata alsa bile en azından buraya kadar gelsin)
|
||||
if (retryButton != null)
|
||||
{
|
||||
retryButton.onClick.RemoveAllListeners();
|
||||
retryButton.onClick.AddListener(OnRetry);
|
||||
}
|
||||
|
||||
if (levelMapButton != null)
|
||||
{
|
||||
levelMapButton.onClick.RemoveAllListeners();
|
||||
levelMapButton.onClick.AddListener(OnLevelMap);
|
||||
}
|
||||
|
||||
if (mainMenuButton != null)
|
||||
{
|
||||
mainMenuButton.onClick.RemoveAllListeners();
|
||||
mainMenuButton.onClick.AddListener(OnMainMenu);
|
||||
}
|
||||
|
||||
// 4) UI’ı güncelle (null-safe)
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
int GetLangIndex(string code)
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case "tr": return 0;
|
||||
case "en": return 1;
|
||||
case "es": return 2;
|
||||
case "de": return 3;
|
||||
case "fr": return 4;
|
||||
case "pt": return 5;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void LoadResults()
|
||||
{
|
||||
score = PlayerPrefs.GetInt("Mod2Score", 0);
|
||||
correct = PlayerPrefs.GetInt("Mod2Correct", 0);
|
||||
wrong = PlayerPrefs.GetInt("Mod2Wrong", 0);
|
||||
|
||||
selectedLevel = Mathf.Clamp(PlayerPrefs.GetInt("SelectedLevel", 1), 1, 20);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void SaveHighScore()
|
||||
{
|
||||
string key = "HighScore_Level_" + selectedLevel;
|
||||
|
||||
int old = PlayerPrefs.GetInt(key, 0);
|
||||
if (score > old)
|
||||
{
|
||||
PlayerPrefs.SetInt(key, score);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void UpdateUI()
|
||||
{
|
||||
int safeLang = Mathf.Clamp(langIndex, 0, 5);
|
||||
int idx = Mathf.Clamp(selectedLevel - 1, 0, 19);
|
||||
|
||||
if (levelNameText != null)
|
||||
levelNameText.text = $"LEVEL {selectedLevel}\n{levelNames[idx, safeLang]}";
|
||||
|
||||
if (scoreText != null)
|
||||
scoreText.text = $"{labelScore[safeLang]} {score}";
|
||||
|
||||
if (highScoreText != null)
|
||||
highScoreText.text = $"{labelHighScore[safeLang]} {PlayerPrefs.GetInt("HighScore_Level_" + selectedLevel, 0)}";
|
||||
|
||||
if (correctText != null)
|
||||
correctText.text = $"{labelCorrect[safeLang]} {correct}";
|
||||
|
||||
if (wrongText != null)
|
||||
wrongText.text = $"{labelWrong[safeLang]} {wrong}";
|
||||
|
||||
if (resultStatusText != null)
|
||||
{
|
||||
if (score >= 2000)
|
||||
{
|
||||
resultStatusText.text = labelPassed[safeLang];
|
||||
resultStatusText.color = Color.green;
|
||||
}
|
||||
else
|
||||
{
|
||||
resultStatusText.text = labelFailed[safeLang];
|
||||
resultStatusText.color = Color.red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
void OnRetry()
|
||||
{
|
||||
PlayClick();
|
||||
if (!string.IsNullOrEmpty(gameSceneName))
|
||||
SceneManager.LoadScene(gameSceneName);
|
||||
}
|
||||
|
||||
void OnLevelMap()
|
||||
{
|
||||
PlayClick();
|
||||
if (!string.IsNullOrEmpty(levelMapScene))
|
||||
SceneManager.LoadScene(levelMapScene);
|
||||
}
|
||||
|
||||
void OnMainMenu()
|
||||
{
|
||||
PlayClick();
|
||||
if (!string.IsNullOrEmpty(mainMenuScene))
|
||||
SceneManager.LoadScene(mainMenuScene);
|
||||
}
|
||||
|
||||
void PlayClick()
|
||||
{
|
||||
if (audioSource && clickSound)
|
||||
audioSource.PlayOneShot(clickSound);
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/2.0/ResultScene_TTE.cs.meta
Normal file
2
Assets/Scripts/2.0/ResultScene_TTE.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b574853e950b6cf48a084ac772956c65
|
||||
Loading…
Add table
Add a link
Reference in a new issue