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
189
Assets/Scripts/4.0/resume/ResultScene_AllMods.cs
Normal file
189
Assets/Scripts/4.0/resume/ResultScene_AllMods.cs
Normal file
|
|
@ -0,0 +1,189 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class ResultScene_AllMods : MonoBehaviour
|
||||
{
|
||||
[Header("RESULT TEXTS")]
|
||||
public TMP_Text scoreText;
|
||||
public TMP_Text correctText;
|
||||
public TMP_Text wrongText;
|
||||
public TMP_Text statusText;
|
||||
|
||||
[Header("EXTRA (opsiyonel)")]
|
||||
public TMP_Text comboText;
|
||||
public TMP_Text accuracyText;
|
||||
|
||||
[Header("BUTTONS")]
|
||||
public Button retryButton;
|
||||
public Button mainMenuButton;
|
||||
|
||||
[Header("MOD SETTINGS")]
|
||||
public int fallbackModNumber = 13;
|
||||
|
||||
[Header("SCENES")]
|
||||
public string retrySceneTemplate = "modsec {0}";
|
||||
public string mainMenuScene = "Anamen";
|
||||
|
||||
[Header("SUCCESS THRESHOLD")]
|
||||
public int successScoreThreshold = 2000;
|
||||
|
||||
[Header("COLORS")]
|
||||
public Color passColor = new Color32(70, 240, 130, 255);
|
||||
public Color failColor = new Color32(255, 80, 95, 255);
|
||||
|
||||
private string modKey;
|
||||
private int modNumber;
|
||||
|
||||
private int score;
|
||||
private int correct;
|
||||
private int wrong;
|
||||
private int bestCombo;
|
||||
private int accuracy;
|
||||
|
||||
void Start()
|
||||
{
|
||||
ResolveMod();
|
||||
LoadResults();
|
||||
ShowResults();
|
||||
BindButtons();
|
||||
}
|
||||
|
||||
void ResolveMod()
|
||||
{
|
||||
string lastPlayed = PlayerPrefs.GetString("LastPlayedMod", "");
|
||||
|
||||
if (!string.IsNullOrEmpty(lastPlayed) && lastPlayed.StartsWith("Mod"))
|
||||
{
|
||||
modKey = lastPlayed;
|
||||
modNumber = ParseModNumber(lastPlayed);
|
||||
}
|
||||
else
|
||||
{
|
||||
modNumber = fallbackModNumber;
|
||||
modKey = "Mod" + modNumber;
|
||||
}
|
||||
|
||||
if (modNumber <= 0)
|
||||
{
|
||||
modNumber = fallbackModNumber;
|
||||
modKey = "Mod" + modNumber;
|
||||
}
|
||||
}
|
||||
|
||||
int ParseModNumber(string key)
|
||||
{
|
||||
string numberPart = key.Replace("Mod", "");
|
||||
|
||||
int value;
|
||||
if (int.TryParse(numberPart, out value))
|
||||
return value;
|
||||
|
||||
return fallbackModNumber;
|
||||
}
|
||||
|
||||
void LoadResults()
|
||||
{
|
||||
score = GetIntFallback(
|
||||
modKey + "_LastScore",
|
||||
modKey + "Score",
|
||||
0
|
||||
);
|
||||
|
||||
correct = GetIntFallback(
|
||||
modKey + "_Correct",
|
||||
modKey + "Correct",
|
||||
0
|
||||
);
|
||||
|
||||
wrong = GetIntFallback(
|
||||
modKey + "_Wrong",
|
||||
modKey + "Wrong",
|
||||
0
|
||||
);
|
||||
|
||||
bestCombo = GetIntFallback(
|
||||
modKey + "_BestComboRun",
|
||||
modKey + "_BestCombo",
|
||||
0
|
||||
);
|
||||
|
||||
accuracy = PlayerPrefs.GetInt(modKey + "_LastAccuracy", -1);
|
||||
|
||||
if (accuracy < 0)
|
||||
{
|
||||
int total = correct + wrong;
|
||||
|
||||
if (total > 0)
|
||||
accuracy = Mathf.RoundToInt((correct / (float)total) * 100f);
|
||||
else
|
||||
accuracy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int GetIntFallback(string newKey, string oldKey, int defaultValue)
|
||||
{
|
||||
if (PlayerPrefs.HasKey(newKey))
|
||||
return PlayerPrefs.GetInt(newKey, defaultValue);
|
||||
|
||||
if (PlayerPrefs.HasKey(oldKey))
|
||||
return PlayerPrefs.GetInt(oldKey, defaultValue);
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
void ShowResults()
|
||||
{
|
||||
if (scoreText != null)
|
||||
scoreText.text = score.ToString();
|
||||
|
||||
if (correctText != null)
|
||||
correctText.text = correct.ToString();
|
||||
|
||||
if (wrongText != null)
|
||||
wrongText.text = wrong.ToString();
|
||||
|
||||
if (comboText != null)
|
||||
comboText.text = bestCombo + "x";
|
||||
|
||||
if (accuracyText != null)
|
||||
accuracyText.text = "%" + accuracy;
|
||||
|
||||
if (statusText != null)
|
||||
{
|
||||
if (score >= successScoreThreshold)
|
||||
{
|
||||
statusText.text = "LEVEL PASSED";
|
||||
statusText.color = passColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
statusText.text = "FAILED";
|
||||
statusText.color = failColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BindButtons()
|
||||
{
|
||||
if (retryButton != null)
|
||||
{
|
||||
retryButton.onClick.RemoveAllListeners();
|
||||
retryButton.onClick.AddListener(() =>
|
||||
{
|
||||
string retryScene = string.Format(retrySceneTemplate, modNumber);
|
||||
SceneManager.LoadScene(retryScene);
|
||||
});
|
||||
}
|
||||
|
||||
if (mainMenuButton != null)
|
||||
{
|
||||
mainMenuButton.onClick.RemoveAllListeners();
|
||||
mainMenuButton.onClick.AddListener(() =>
|
||||
{
|
||||
SceneManager.LoadScene(mainMenuScene);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/4.0/resume/ResultScene_AllMods.cs.meta
Normal file
2
Assets/Scripts/4.0/resume/ResultScene_AllMods.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4663529fe03e96b4dabf5ea7f924d4e4
|
||||
102
Assets/Scripts/4.0/resume/ResultScene_Mod13.cs
Normal file
102
Assets/Scripts/4.0/resume/ResultScene_Mod13.cs
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class ResultScene_Mod13 : MonoBehaviour
|
||||
{
|
||||
[Header("RESULT TEXTS")]
|
||||
public TMP_Text scoreText;
|
||||
public TMP_Text correctText;
|
||||
public TMP_Text wrongText;
|
||||
public TMP_Text statusText;
|
||||
|
||||
[Header("EXTRA (opsiyonel)")]
|
||||
public TMP_Text comboText; // en iyi combo
|
||||
public TMP_Text accuracyText; // doğruluk %
|
||||
|
||||
[Header("BUTTONS")]
|
||||
public Button retryButton;
|
||||
public Button mainMenuButton;
|
||||
|
||||
[Header("SCENES")]
|
||||
public string gameSceneName = "ModSec13"; // tekrar oyna → oyun sahnesi
|
||||
public string mainMenuScene = "Anamen";
|
||||
|
||||
[Header("SUCCESS THRESHOLD")]
|
||||
public int successScoreThreshold = 2000;
|
||||
|
||||
[Header("COLORS")]
|
||||
public Color passColor = new Color32(70, 240, 130, 255);
|
||||
public Color failColor = new Color32(255, 80, 95, 255);
|
||||
|
||||
private const string modKey = "Mod13";
|
||||
|
||||
private int score;
|
||||
private int correct;
|
||||
private int wrong;
|
||||
private int bestCombo;
|
||||
private int accuracy;
|
||||
|
||||
void Start()
|
||||
{
|
||||
LoadResults();
|
||||
ShowResults();
|
||||
BindButtons();
|
||||
}
|
||||
|
||||
void LoadResults()
|
||||
{
|
||||
// MOD 13'ün GameOver içinde kaydettiği anahtarlar
|
||||
score = PlayerPrefs.GetInt("Mod13LastScore", 0);
|
||||
correct = PlayerPrefs.GetInt("Mod13Correct", 0);
|
||||
wrong = PlayerPrefs.GetInt("Mod13Wrong", 0);
|
||||
bestCombo = PlayerPrefs.GetInt(modKey + "_BestComboRun", 0);
|
||||
accuracy = PlayerPrefs.GetInt(modKey + "_LastAccuracy", 0);
|
||||
}
|
||||
|
||||
void ShowResults()
|
||||
{
|
||||
if (scoreText != null) scoreText.text = score.ToString();
|
||||
if (correctText != null) correctText.text = correct.ToString();
|
||||
if (wrongText != null) wrongText.text = wrong.ToString();
|
||||
|
||||
if (comboText != null) comboText.text = bestCombo + "x";
|
||||
if (accuracyText != null) accuracyText.text = "%" + accuracy;
|
||||
|
||||
if (statusText != null)
|
||||
{
|
||||
if (score >= successScoreThreshold)
|
||||
{
|
||||
statusText.text = "LEVEL PASSED";
|
||||
statusText.color = passColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
statusText.text = "FAILED";
|
||||
statusText.color = failColor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BindButtons()
|
||||
{
|
||||
if (retryButton != null)
|
||||
{
|
||||
retryButton.onClick.RemoveAllListeners();
|
||||
retryButton.onClick.AddListener(() =>
|
||||
{
|
||||
SceneManager.LoadScene(gameSceneName);
|
||||
});
|
||||
}
|
||||
|
||||
if (mainMenuButton != null)
|
||||
{
|
||||
mainMenuButton.onClick.RemoveAllListeners();
|
||||
mainMenuButton.onClick.AddListener(() =>
|
||||
{
|
||||
SceneManager.LoadScene(mainMenuScene);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/4.0/resume/ResultScene_Mod13.cs.meta
Normal file
2
Assets/Scripts/4.0/resume/ResultScene_Mod13.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2048ae5cdefe3114787664d7963032b9
|
||||
Loading…
Add table
Add a link
Reference in a new issue