diff options
| author | chai <215380520@qq.com> | 2024-05-20 22:36:58 +0800 |
|---|---|---|
| committer | chai <215380520@qq.com> | 2024-05-20 22:36:58 +0800 |
| commit | a22c505984697881f5f911a165ee022087b69e09 (patch) | |
| tree | d3c030aef1ae9b8a01c889dd2902bb1e3324e72b /Thronefall_1_0/Decompile/HighscoreTable.cs | |
| parent | 4a4cc82d069b26bc4d4532e73860f86b211ca239 (diff) | |
Diffstat (limited to 'Thronefall_1_0/Decompile/HighscoreTable.cs')
| -rw-r--r-- | Thronefall_1_0/Decompile/HighscoreTable.cs | 99 |
1 files changed, 0 insertions, 99 deletions
diff --git a/Thronefall_1_0/Decompile/HighscoreTable.cs b/Thronefall_1_0/Decompile/HighscoreTable.cs deleted file mode 100644 index fbfdc4c..0000000 --- a/Thronefall_1_0/Decompile/HighscoreTable.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.Collections.Generic; -using Steamworks; -using UnityEngine; - -public class HighscoreTable : MonoBehaviour -{ - private ScoreTag[] scoreTags = new ScoreTag[0]; - - private string currentHighscoreTableToCall = ""; - - public Transform scoreTagParent; - - public GameObject loading; - - public GameObject notConnectedToSteam; - - public GameObject noScore; - - public GameObject noFriends; - - private bool subscribedToSteamManager; - - public void SetAndDownloadHighscoreTable(string _highscoreTableName) - { - noScore.SetActive(value: false); - noFriends.SetActive(value: false); - currentHighscoreTableToCall = _highscoreTableName; - scoreTags = new ScoreTag[scoreTagParent.childCount]; - for (int i = 0; i < scoreTagParent.childCount; i++) - { - scoreTags[i] = scoreTagParent.GetChild(i).GetComponent<ScoreTag>(); - scoreTagParent.GetChild(i).gameObject.SetActive(value: false); - } - if (SteamManager.Initialized) - { - SubscribeToSteamManger(); - SteamManager.Instance.DownloadFriendsHighscores(currentHighscoreTableToCall); - loading.SetActive(value: true); - notConnectedToSteam.SetActive(value: false); - } - else - { - loading.SetActive(value: false); - notConnectedToSteam.SetActive(value: true); - } - } - - private void OnEnable() - { - SetAndDownloadHighscoreTable(LevelInteractor.lastActivatedLevelInteractor.sceneName); - } - - private void SubscribeToSteamManger() - { - if (!subscribedToSteamManager) - { - SteamManager.Instance.OnLeaderboardDownloadCallbackComplete.AddListener(RefreshUI); - subscribedToSteamManager = true; - } - } - - private void RefreshUI() - { - for (int i = 0; i < scoreTags.Length; i++) - { - scoreTags[i].gameObject.SetActive(value: false); - } - List<SteamManager.LeaderboardEntry> lastDownloadedLeaderboardEntires = SteamManager.Instance.lastDownloadedLeaderboardEntires; - if (lastDownloadedLeaderboardEntires.Count > 0) - { - loading.SetActive(value: false); - notConnectedToSteam.SetActive(value: false); - bool flag = false; - foreach (SteamManager.LeaderboardEntry item in lastDownloadedLeaderboardEntires) - { - if (item.username == SteamFriends.GetPersonaName()) - { - flag = true; - break; - } - } - noScore.SetActive(!flag); - noFriends.SetActive(lastDownloadedLeaderboardEntires.Count == 1 && flag); - } - else - { - loading.SetActive(value: false); - notConnectedToSteam.SetActive(value: false); - noScore.SetActive(value: true); - noFriends.SetActive(value: true); - } - for (int j = 0; j < lastDownloadedLeaderboardEntires.Count && j <= scoreTags.Length - 1; j++) - { - bool isPlayer = lastDownloadedLeaderboardEntires[j].username == SteamFriends.GetPersonaName(); - scoreTags[j].gameObject.SetActive(value: true); - scoreTags[j].SetNameAndScore(lastDownloadedLeaderboardEntires[j].username, lastDownloadedLeaderboardEntires[j].score, j + 1, isPlayer); - } - } -} |
