diff --git a/Assets/Scenes/StartScreen.unity b/Assets/Scenes/StartScreen.unity index 99fac6c..1e85340 100644 --- a/Assets/Scenes/StartScreen.unity +++ b/Assets/Scenes/StartScreen.unity @@ -1124,7 +1124,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 100, y: 100} + m_SizeDelta: {x: 1096.5, y: 1950.2} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1045523108 GameObject: @@ -1546,9 +1546,9 @@ RectTransform: m_Father: {fileID: 1017433380} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0.5, y: 0.5} - m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: -431, y: 722.33} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 100.35, y: -252.77} m_SizeDelta: {x: 187.77, y: 187.77} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1452896264 diff --git a/Assets/Scripts/StartScreen/StartManager.cs b/Assets/Scripts/StartScreen/StartManager.cs index d7be559..e948428 100644 --- a/Assets/Scripts/StartScreen/StartManager.cs +++ b/Assets/Scripts/StartScreen/StartManager.cs @@ -30,13 +30,13 @@ public void QuitGame() } public void ShowStats() { - Dictionary stats = GameDataManager.GetLeaderboard(); + Dictionary stats = GameDataManager.GetLeaderboard(); mainMenu.SetActive(false); statsMenu.SetActive(true); string text = ""; if (stats.Count > 0) { - foreach (KeyValuePair kvp in stats) { - text += kvp.Key + " -- " + kvp.Value + "\n"; + foreach (KeyValuePair kvp in stats) { + text += kvp.Value + " -- " + kvp.Key + "\n"; } } else { text = "No players lmao"; diff --git a/Assets/Scripts/Utility/GameData.cs b/Assets/Scripts/Utility/GameData.cs index 8b0f564..a12e375 100644 --- a/Assets/Scripts/Utility/GameData.cs +++ b/Assets/Scripts/Utility/GameData.cs @@ -6,16 +6,20 @@ [Serializable] public class GameData { - public Dictionary leaderboard; + private static int version = 1; + public Dictionary leaderboard; public int money; - private static readonly string dataPath = Application.persistentDataPath + "/GameData.dat"; + private static readonly string dataPath = Application.persistentDataPath + "/GameData1.dat"; private GameData() { this.money = 0; - this.leaderboard = new Dictionary(); + this.leaderboard = new Dictionary(); } public static GameData GetFromFile() { + if (File.Exists(Application.persistentDataPath + "/GameData.dat")) { + File.Delete(Application.persistentDataPath + "/GameData.dat"); + } BinaryFormatter bf = new BinaryFormatter(); if (!File.Exists(dataPath)) { GameData gameData = new GameData(); diff --git a/Assets/Scripts/Utility/GameDataManager.cs b/Assets/Scripts/Utility/GameDataManager.cs index 0edf81c..262703f 100644 --- a/Assets/Scripts/Utility/GameDataManager.cs +++ b/Assets/Scripts/Utility/GameDataManager.cs @@ -3,8 +3,18 @@ public static class GameDataManager { private static GameData gameData = GameData.GetFromFile(); - public static Dictionary GetLeaderboard() { - return gameData.leaderboard; + public static Dictionary GetLeaderboard() { + Dictionary dictLeaderboard = new Dictionary(); + List> leaderboard = gameData.leaderboard.ToList(); + leaderboard.Sort( + delegate(KeyValuePair pair1, KeyValuePair pair2) { + return pair1.Key.CompareTo(pair2.Key); + } + ); + foreach (KeyValuePair kvp in leaderboard) { + dictLeaderboard[kvp.Key] = kvp.Value; + } + return dictLeaderboard; } public static int GetMoney() { @@ -26,16 +36,16 @@ public static void RemoveMoney(int amount) { } public static bool IsRecord(int score) { - return GetLowestScore().Value < score || gameData.leaderboard.Count < 10; + return GetLowestScore().Key < score || gameData.leaderboard.Count < 10; } public static void AddScore(string name, int score) { if (gameData.leaderboard.Count > 10) { - KeyValuePair lowest = GetLowestScore(); + KeyValuePair lowest = GetLowestScore(); gameData.leaderboard.Remove(lowest.Key); } - gameData.leaderboard[name] = score; + gameData.leaderboard[score] = name; gameData.Save(); } @@ -44,13 +54,13 @@ public static void ResetScores() { gameData.Save(); } - private static KeyValuePair GetLowestScore() { + private static KeyValuePair GetLowestScore() { if (gameData.leaderboard.Count == 0) { - return new KeyValuePair(null, 0); + return new KeyValuePair(0, null); } - KeyValuePair minimum = gameData.leaderboard.First(); - foreach (KeyValuePair kvp in gameData.leaderboard) { - if (kvp.Value < minimum.Value) { + KeyValuePair minimum = gameData.leaderboard.First(); + foreach (KeyValuePair kvp in gameData.leaderboard) { + if (kvp.Key < minimum.Key) { minimum = kvp; } } diff --git a/Builds/Android/com.exenifix.fnaf69-1.2.1.apk b/Builds/Android/com.exenifix.fnaf69-1.2.1.apk new file mode 100644 index 0000000..d919fae Binary files /dev/null and b/Builds/Android/com.exenifix.fnaf69-1.2.1.apk differ diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 8122720..ba01827 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -134,7 +134,7 @@ PlayerSettings: 16:10: 1 16:9: 1 Others: 1 - bundleVersion: 1.2 + bundleVersion: 1.2.1 preloadedAssets: [] metroInputSource: 0 wsaTransparentSwapchain: 0