54 lines
1.2 KiB
C#
54 lines
1.2 KiB
C#
|
using Steamworks;
|
||
|
using TMPro;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class ChallengeLeaderboardSlot : MonoBehaviour
|
||
|
{
|
||
|
public RawImage profileIcon;
|
||
|
|
||
|
public TextMeshProUGUI userNameText;
|
||
|
|
||
|
public TextMeshProUGUI rankNumText;
|
||
|
|
||
|
public TextMeshProUGUI scrapCollectedText;
|
||
|
|
||
|
public SteamId steamId;
|
||
|
|
||
|
public void SetSlotValues(string userName, int rankNum, int scrapCollected, SteamId playerSteamId, int entryDetails)
|
||
|
{
|
||
|
Debug.Log("Slot A");
|
||
|
userNameText.text = userName.Substring(0, Mathf.Min(userName.Length, 15));
|
||
|
Debug.Log("Slot A1");
|
||
|
rankNumText.text = $"#{rankNum}";
|
||
|
Debug.Log("Slot B");
|
||
|
switch (entryDetails)
|
||
|
{
|
||
|
case 2:
|
||
|
scrapCollectedText.text = "(Removed score)";
|
||
|
break;
|
||
|
case 3:
|
||
|
scrapCollectedText.text = "Deceased";
|
||
|
break;
|
||
|
default:
|
||
|
scrapCollectedText.text = $"${scrapCollected} Collected";
|
||
|
break;
|
||
|
}
|
||
|
Debug.Log("Slot C");
|
||
|
steamId = playerSteamId;
|
||
|
Debug.Log("Slot D");
|
||
|
profileIcon.color = Color.white;
|
||
|
Debug.Log("Slot E");
|
||
|
HUDManager.FillImageWithSteamProfile(profileIcon, (ulong)playerSteamId, large: false);
|
||
|
Debug.Log("Slot F");
|
||
|
}
|
||
|
|
||
|
public void ClickProfileIcon()
|
||
|
{
|
||
|
if (!GameNetworkManager.Instance.disableSteam && (ulong)steamId != 0L)
|
||
|
{
|
||
|
SteamFriends.OpenUserOverlay(steamId, "steamid");
|
||
|
}
|
||
|
}
|
||
|
}
|