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
71
Assets/Scripts/3.5/ModLeaderboard.cs
Normal file
71
Assets/Scripts/3.5/ModLeaderboard.cs
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
public class ModLeaderboard : MonoBehaviour
|
||||
{
|
||||
[Header("━━━ UI SLOTS (10 satır) ━━━━━━━━━━━━━━━")]
|
||||
public TMP_Text[] rows;
|
||||
[Header("━━━ BUTONLAR ━━━━━━━━━━━━━━━━━━━━━━━━━━")]
|
||||
public Button mainMenuButton;
|
||||
[Header("━━━ MOD AYARI ━━━━━━━━━━━━━━━━━━━━━━━━━")]
|
||||
public string scoreKey = "GalaxyScore";
|
||||
//
|
||||
// Her mod için scoreKey değeri:
|
||||
// ─────────────────────────────
|
||||
// Galaxy Modu → "GalaxyScore"
|
||||
// Time Modu → "TimeScore"
|
||||
// Classic Modu → "ClassicScore"
|
||||
// Challenge Modu → "ChallengeScore"
|
||||
private readonly string[] botNames =
|
||||
{
|
||||
"ShadowWolf", "CrystalMind", "NightHunter",
|
||||
"BlueVortex", "IronSoul", "PixelGhost",
|
||||
"SilverClaw", "MegaCore", "NeonBlade", "DarkNova"
|
||||
};
|
||||
class LBEntry
|
||||
{
|
||||
public string name;
|
||||
public int score;
|
||||
public LBEntry(string n, int s) { name = n; score = s; }
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
GenerateLeaderboard();
|
||||
if (mainMenuButton != null)
|
||||
mainMenuButton.onClick.AddListener(() =>
|
||||
SceneManager.LoadScene("Anamen"));
|
||||
}
|
||||
void GenerateLeaderboard()
|
||||
{
|
||||
List<LBEntry> list = new List<LBEntry>();
|
||||
int botLimit = Mathf.Min(rows.Length - 1, botNames.Length);
|
||||
for (int i = 0; i < botLimit; i++)
|
||||
list.Add(new LBEntry(botNames[i], Random.Range(3000, 12000)));
|
||||
string highKey = scoreKey + "_High";
|
||||
int lastScore = PlayerPrefs.GetInt(scoreKey, 0);
|
||||
int highScore = PlayerPrefs.GetInt(highKey, 0);
|
||||
if (lastScore > highScore)
|
||||
{
|
||||
highScore = lastScore;
|
||||
PlayerPrefs.SetInt(highKey, highScore);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
list.Add(new LBEntry("YOU", highScore));
|
||||
list.Sort((a, b) => b.score.CompareTo(a.score));
|
||||
for (int i = 0; i < rows.Length; i++)
|
||||
{
|
||||
if (i < list.Count)
|
||||
{
|
||||
rows[i].text = list[i].name == "YOU"
|
||||
? $"<color=#00FF00>{i + 1}. {list[i].name} - {list[i].score}</color>"
|
||||
: $"{i + 1}. {list[i].name} - {list[i].score}";
|
||||
}
|
||||
else
|
||||
{
|
||||
rows[i].text = $"{i + 1}. ---";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue