|
| 1 | +# asobi-unity |
| 2 | + |
| 3 | +Unity client SDK for the [Asobi](https://asobi.dev) game backend. Unity 2021.3+, pure C#. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +Add via Unity Package Manager using the git URL: |
| 8 | + |
| 9 | +``` |
| 10 | +https://github.com/widgrensit/asobi-unity.git |
| 11 | +``` |
| 12 | + |
| 13 | +Window > Package Manager > + > Add package from git URL... |
| 14 | + |
| 15 | +## Quick Start |
| 16 | + |
| 17 | +```csharp |
| 18 | +using Asobi; |
| 19 | + |
| 20 | +var client = new AsobiClient("localhost", port: 8080); |
| 21 | + |
| 22 | +// Auth |
| 23 | +await client.Auth.Register("player1", "secret123"); |
| 24 | +await client.Auth.Login("player1", "secret123"); |
| 25 | + |
| 26 | +// REST APIs |
| 27 | +var player = await client.Players.GetSelf(); |
| 28 | +var top = await client.Leaderboards.GetTop("weekly"); |
| 29 | +var wallets = await client.Economy.GetWallets(); |
| 30 | + |
| 31 | +// Real-time |
| 32 | +client.Realtime.OnMatchState += (state) => Debug.Log($"Tick: {state["tick"]}"); |
| 33 | +await client.Realtime.ConnectAsync(); |
| 34 | +await client.Realtime.AddToMatchmaker("arena"); |
| 35 | +``` |
| 36 | + |
| 37 | +## Features |
| 38 | + |
| 39 | +- **Auth** - Register, login, token refresh |
| 40 | +- **Players** - Profiles, updates |
| 41 | +- **Matchmaker** - Queue, status, cancel |
| 42 | +- **Matches** - List, details |
| 43 | +- **Leaderboards** - Top scores, around player, submit |
| 44 | +- **Economy** - Wallets, store, purchases |
| 45 | +- **Inventory** - Items, consume |
| 46 | +- **Social** - Friends, groups, chat history |
| 47 | +- **Tournaments** - List, join |
| 48 | +- **Notifications** - List, read, delete |
| 49 | +- **Storage** - Cloud saves, key-value |
| 50 | +- **IAP** - In-app purchase receipt validation |
| 51 | +- **Realtime** - WebSocket for matches, chat, presence, matchmaking |
| 52 | + |
| 53 | +## API Reference |
| 54 | + |
| 55 | +All API modules are accessible from `AsobiClient`: |
| 56 | + |
| 57 | +| Property | Class | |
| 58 | +|----------|-------| |
| 59 | +| `Auth` | `AsobiAuth` | |
| 60 | +| `Players` | `AsobiPlayers` | |
| 61 | +| `Matchmaker` | `AsobiMatchmaker` | |
| 62 | +| `Matches` | `AsobiMatches` | |
| 63 | +| `Leaderboards` | `AsobiLeaderboards` | |
| 64 | +| `Economy` | `AsobiEconomy` | |
| 65 | +| `Inventory` | `AsobiInventory` | |
| 66 | +| `Social` | `AsobiSocial` | |
| 67 | +| `Tournaments` | `AsobiTournaments` | |
| 68 | +| `Notifications` | `AsobiNotifications` | |
| 69 | +| `Storage` | `AsobiStorage` | |
| 70 | +| `IAP` | `AsobiIAP` | |
| 71 | +| `Realtime` | `AsobiRealtime` | |
| 72 | + |
| 73 | +## Demo |
| 74 | + |
| 75 | +See [asobi-unity-demo](https://github.com/widgrensit/asobi-unity-demo) for a complete example project. |
| 76 | + |
| 77 | +## License |
| 78 | + |
| 79 | +Apache-2.0 |
0 commit comments