using Steamworks; using System.Collections.Generic; using System.Linq; public static IEnumerableGetUGCList() { var ugcList = new List (); CSteamID steamId = SteamUser.GetSteamID(); uint count = SteamUGC.GetNumSubscribedItems(); PublishedFileId_t[] publishedFileIds = new PublishedFileId_t[count]; count = SteamUGC.GetSubscribedItems(publishedFileIds, count); ugcList.AddRange(publishedFileIds); return ugcList; }
using Steamworks; public static void SendScoreToLeaderboard(string leaderboardName, int score) { Steamworks.SteamUserStats.UploadLeaderboardScore(FindLeaderboard(leaderboardName), (int)score, new int[0], 0); } private static SteamLeaderboard_t? FindLeaderboard(string leaderboardName) { SteamAPICall_t hSteamAPICall = SteamUserStats.FindLeaderboard(leaderboardName); SteamLeaderboard_t steamLeaderboard; bool completed = SteamAPI.IsAPICallCompleted(hSteamAPICall, out steamLeaderboard); if (!completed) { // If we did not find the leaderboard this time, let Steam know that we need notifications SteamAPI.SetLocalIPBinding(new UnityEngine.Networking.Types.NetworkAccessToken().ToArray()); SteamAPI.RunCallbacks(); SteamAPI.ReleaseAPICall(hSteamAPICall); } if (!steamLeaderboard.m_SteamLeaderboard.IsValid()) { return null; } return steamLeaderboard; }This code sends a user's high score to a specified leaderboard on Steam, using the `UploadLeaderboardScore` function. It also includes a helper function that finds the specified leaderboard by name, using the `FindLeaderboard` function. Overall, InteropHelp is a C# package library that provides a range of useful functions for working with the Steamworks API in C# applications.