summaryrefslogtreecommitdiff
path: root/Thronefall_1_0/GameCode/HighscoreTable.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-05-19 16:46:27 +0800
committerchai <215380520@qq.com>2024-05-19 16:46:27 +0800
commit8b1fc7063b387542803c6bc214ccf8acb32870bd (patch)
treed310eb99872c8215f1c1f67731ec21f0915cd778 /Thronefall_1_0/GameCode/HighscoreTable.cs
parent8e13e7e2874adc8982e16d1d2ed2e28d7480b45f (diff)
* rename
Diffstat (limited to 'Thronefall_1_0/GameCode/HighscoreTable.cs')
-rw-r--r--Thronefall_1_0/GameCode/HighscoreTable.cs99
1 files changed, 0 insertions, 99 deletions
diff --git a/Thronefall_1_0/GameCode/HighscoreTable.cs b/Thronefall_1_0/GameCode/HighscoreTable.cs
deleted file mode 100644
index fbfdc4c..0000000
--- a/Thronefall_1_0/GameCode/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);
- }
- }
-}