Started working on a Steam library
This commit is contained in:
@@ -9,6 +9,9 @@ This package provides a simple Steam API wrapper for common tasks like initializ
|
||||
- Safe shutdown with `SteamManager.Shutdown()`
|
||||
- Player persona name access with `SteamManager.GetSteamName()`
|
||||
- Achievement helpers via `AchievementManager`
|
||||
- Steam Workshop (UGC) helpers via `SteamManager.Instance.Ugc`
|
||||
- Steam Remote Play helpers via `SteamManager.Instance.RemotePlay`
|
||||
- Additional interface managers: Controller, Friends, GameServer, Input, Inventory, Matchmaking, Parties, RemoteStorage, Screenshots, UserStats, Utils, Video, and more.
|
||||
- Includes native Steam runtime files in NuGet package `runtimes/`
|
||||
|
||||
## Installation
|
||||
@@ -35,9 +38,59 @@ steam.Update();
|
||||
var achievements = new AchievementManager();
|
||||
achievements.UnlockAchievement("ACH_FIRST_WIN");
|
||||
|
||||
// Steam Workshop (UGC) example
|
||||
var subscribedIds = steam.Ugc.GetSubscribedItems();
|
||||
|
||||
// Steam Remote Play example
|
||||
var remotePlaySessionCount = steam.RemotePlay.GetSessionCount();
|
||||
|
||||
steam.Shutdown();
|
||||
```
|
||||
|
||||
## More API Examples
|
||||
```cs
|
||||
var steam = SteamManager.Instance;
|
||||
|
||||
// Friends / rich presence
|
||||
steam.Friends.SetRichPresence("status", "In Match");
|
||||
steam.Friends.SetRichPresence("map", "Arena_01");
|
||||
var friendName = steam.Friends.GetFriendPersonaName(76561198000000000UL);
|
||||
var friendStatus = steam.Friends.GetFriendRichPresence(76561198000000000UL, "status");
|
||||
|
||||
// Remote storage
|
||||
var saveBytes = System.Text.Encoding.UTF8.GetBytes("save-data-v1");
|
||||
steam.RemoteStorage.FileWrite("save_slot_1.dat", saveBytes);
|
||||
if (steam.RemoteStorage.FileRead("save_slot_1.dat", out var loadedBytes))
|
||||
{
|
||||
var loadedText = System.Text.Encoding.UTF8.GetString(loadedBytes);
|
||||
}
|
||||
|
||||
// User stats
|
||||
steam.UserStats.SetStatInt32("KILLS", 25);
|
||||
steam.UserStats.StoreStats();
|
||||
steam.UserStats.RequestGlobalStats(7);
|
||||
|
||||
// UGC update convenience APIs (existing item)
|
||||
var options = new SteamUgcItemUpdateOptions
|
||||
{
|
||||
Title = "My Workshop Item",
|
||||
Description = "Updated description.",
|
||||
Tags = new[] { "map", "coop" },
|
||||
ContentFolder = "/absolute/path/to/content",
|
||||
PreviewFile = "/absolute/path/to/preview.png"
|
||||
};
|
||||
var submitCallHandle = steam.Ugc.UpdateItem(480, 123456789012345678UL, options, "Updated content", out var failedStep);
|
||||
|
||||
// Fluent session alternative
|
||||
var session = steam.Ugc.BeginUpdateSession(480, 123456789012345678UL)
|
||||
.WithTitle("My Workshop Item")
|
||||
.WithDescription("Updated description")
|
||||
.WithTags("map", "coop")
|
||||
.WithContentFolder("/absolute/path/to/content")
|
||||
.WithPreviewFile("/absolute/path/to/preview.png");
|
||||
var submitCallHandle2 = session.Submit("Updated content", out var failedStep2);
|
||||
```
|
||||
|
||||
## Notes
|
||||
- Steam must be running and your app must be launched in a valid Steam context.
|
||||
- Configure your AppId before first access to `SteamManager.Instance`.
|
||||
|
||||
Reference in New Issue
Block a user