steamworks-ffi-node 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/SteamLibraryLoader.d.ts +13 -0
- package/dist/internal/SteamLibraryLoader.d.ts.map +1 -1
- package/dist/internal/SteamLibraryLoader.js +15 -0
- package/dist/internal/SteamLibraryLoader.js.map +1 -1
- package/dist/internal/SteamOverlayManager.d.ts +407 -0
- package/dist/internal/SteamOverlayManager.d.ts.map +1 -0
- package/dist/internal/SteamOverlayManager.js +523 -0
- package/dist/internal/SteamOverlayManager.js.map +1 -0
- package/dist/internal/SteamRichPresenceManager.d.ts +265 -0
- package/dist/internal/SteamRichPresenceManager.d.ts.map +1 -0
- package/dist/internal/SteamRichPresenceManager.js +374 -0
- package/dist/internal/SteamRichPresenceManager.js.map +1 -0
- package/dist/steam.d.ts +63 -0
- package/dist/steam.d.ts.map +1 -1
- package/dist/steam.js +10 -0
- package/dist/steam.js.map +1 -1
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +6 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/overlay.d.ts +72 -0
- package/dist/types/overlay.d.ts.map +1 -0
- package/dist/types/overlay.js +79 -0
- package/dist/types/overlay.js.map +1 -0
- package/dist/types/richpresence.d.ts +43 -0
- package/dist/types/richpresence.d.ts.map +1 -0
- package/dist/types/richpresence.js +33 -0
- package/dist/types/richpresence.js.map +1 -0
- package/package.json +5 -3
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SteamOverlayManager = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
/**
|
|
6
|
+
* Manager for Steam Overlay API operations
|
|
7
|
+
*
|
|
8
|
+
* The SteamOverlayManager provides control over the Steam overlay, allowing games
|
|
9
|
+
* to programmatically open various overlay dialogs, web pages, store pages, and
|
|
10
|
+
* invite dialogs. This enables deep integration between your game and Steam's social
|
|
11
|
+
* and store features.
|
|
12
|
+
*
|
|
13
|
+
* The overlay appears on top of your game window and provides access to:
|
|
14
|
+
* - Friends list and chat
|
|
15
|
+
* - Steam community features
|
|
16
|
+
* - Web browser
|
|
17
|
+
* - Store pages
|
|
18
|
+
* - User profiles
|
|
19
|
+
* - Invite dialogs
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* All overlay functions work only when:
|
|
23
|
+
* - Steam client is running
|
|
24
|
+
* - User has the overlay enabled in Steam settings
|
|
25
|
+
* - Your game is running in a graphics mode that supports overlay
|
|
26
|
+
*
|
|
27
|
+
* The overlay can be disabled by users in Steam settings. Your game should
|
|
28
|
+
* provide alternative methods for critical features if the overlay is unavailable.
|
|
29
|
+
*
|
|
30
|
+
* @example Open friends list
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const steam = SteamworksSDK.getInstance();
|
|
33
|
+
* steam.init({ appId: 480 });
|
|
34
|
+
*
|
|
35
|
+
* // Open friends list
|
|
36
|
+
* steam.overlay.activateGameOverlay(EOverlayDialog.FRIENDS);
|
|
37
|
+
*
|
|
38
|
+
* // Open achievements
|
|
39
|
+
* steam.overlay.activateGameOverlay(EOverlayDialog.ACHIEVEMENTS);
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example Open user profile
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const friends = steam.friends.getAllFriends();
|
|
45
|
+
* const friend = friends[0];
|
|
46
|
+
*
|
|
47
|
+
* // Open friend's profile
|
|
48
|
+
* steam.overlay.activateGameOverlayToUser(
|
|
49
|
+
* EOverlayToUserDialog.STEAM_ID,
|
|
50
|
+
* friend.steamId
|
|
51
|
+
* );
|
|
52
|
+
*
|
|
53
|
+
* // Open chat with friend
|
|
54
|
+
* steam.overlay.activateGameOverlayToUser(
|
|
55
|
+
* EOverlayToUserDialog.CHAT,
|
|
56
|
+
* friend.steamId
|
|
57
|
+
* );
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example Open store page
|
|
61
|
+
* ```typescript
|
|
62
|
+
* // Open your game's store page
|
|
63
|
+
* steam.overlay.activateGameOverlayToStore(480, EOverlayToStoreFlag.None);
|
|
64
|
+
*
|
|
65
|
+
* // Open DLC store page and add to cart
|
|
66
|
+
* steam.overlay.activateGameOverlayToStore(12345, EOverlayToStoreFlag.AddToCart);
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @see {@link https://partner.steamgames.com/doc/api/ISteamFriends ISteamFriends Documentation}
|
|
70
|
+
*/
|
|
71
|
+
class SteamOverlayManager {
|
|
72
|
+
/**
|
|
73
|
+
* Creates a new SteamOverlayManager instance
|
|
74
|
+
*
|
|
75
|
+
* @param libraryLoader - The Steam library loader for FFI calls
|
|
76
|
+
* @param apiCore - The Steam API core for lifecycle management
|
|
77
|
+
*/
|
|
78
|
+
constructor(libraryLoader, apiCore) {
|
|
79
|
+
this.libraryLoader = libraryLoader;
|
|
80
|
+
this.apiCore = apiCore;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Activates the Steam overlay with an optional dialog
|
|
84
|
+
*
|
|
85
|
+
* @param dialog - The dialog to open (e.g., 'Friends', 'Community', 'Settings')
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* Opens the Steam overlay to a specific section. The overlay will appear
|
|
89
|
+
* on top of your game window. Common dialogs:
|
|
90
|
+
* - `Friends` - Friends list
|
|
91
|
+
* - `Community` - Community hub
|
|
92
|
+
* - `Players` - Recent players list
|
|
93
|
+
* - `Settings` - Steam settings
|
|
94
|
+
* - `OfficialGameGroup` - Your game's Steam group
|
|
95
|
+
* - `Stats` - Stats page
|
|
96
|
+
* - `Achievements` - Achievements page
|
|
97
|
+
* - `chatroomgroup/[groupid]` - Specific chat room
|
|
98
|
+
*
|
|
99
|
+
* @example Open various overlay dialogs
|
|
100
|
+
* ```typescript
|
|
101
|
+
* // Open friends list
|
|
102
|
+
* steam.overlay.activateGameOverlay(EOverlayDialog.FRIENDS);
|
|
103
|
+
*
|
|
104
|
+
* // Open achievements
|
|
105
|
+
* steam.overlay.activateGameOverlay(EOverlayDialog.ACHIEVEMENTS);
|
|
106
|
+
*
|
|
107
|
+
* // Open community hub
|
|
108
|
+
* steam.overlay.activateGameOverlay(EOverlayDialog.COMMUNITY);
|
|
109
|
+
*
|
|
110
|
+
* // Open settings
|
|
111
|
+
* steam.overlay.activateGameOverlay(EOverlayDialog.SETTINGS);
|
|
112
|
+
*
|
|
113
|
+
* // Open stats
|
|
114
|
+
* steam.overlay.activateGameOverlay(EOverlayDialog.STATS);
|
|
115
|
+
* ```
|
|
116
|
+
*
|
|
117
|
+
* @example Keyboard shortcut alternative
|
|
118
|
+
* ```typescript
|
|
119
|
+
* // Provide in-game button as alternative to Shift+Tab
|
|
120
|
+
* function onSettingsButtonClick() {
|
|
121
|
+
* steam.overlay.activateGameOverlay(EOverlayDialog.SETTINGS);
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
activateGameOverlay(dialog) {
|
|
126
|
+
if (!this.apiCore.isInitialized()) {
|
|
127
|
+
console.error('[SteamOverlay] Cannot activate overlay: Steam not initialized');
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const friendsInterface = this.apiCore.getFriendsInterface();
|
|
131
|
+
if (!friendsInterface) {
|
|
132
|
+
console.error('[SteamOverlay] Friends interface not available');
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
this.libraryLoader.SteamAPI_ISteamFriends_ActivateGameOverlay(friendsInterface, dialog);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
console.error('[SteamOverlay] Error activating overlay:', error);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Activates the Steam overlay to a specific user's page
|
|
144
|
+
*
|
|
145
|
+
* @param dialog - The type of user dialog to open
|
|
146
|
+
* @param steamId - The target user's Steam ID
|
|
147
|
+
*
|
|
148
|
+
* @remarks
|
|
149
|
+
* Opens the overlay to a specific user-related page. Available dialogs:
|
|
150
|
+
* - `steamid` - User's Steam profile
|
|
151
|
+
* - `chat` - Chat window with user or group chat
|
|
152
|
+
* - `jointrade` - Steam Trading session (requires ISteamEconomy/StartTrade)
|
|
153
|
+
* - `stats` - User's stats page
|
|
154
|
+
* - `achievements` - User's achievements page
|
|
155
|
+
* - `friendadd` - Prompt to add user as friend
|
|
156
|
+
* - `friendremove` - Prompt to remove friend
|
|
157
|
+
* - `friendrequestaccept` - Accept friend invite
|
|
158
|
+
* - `friendrequestignore` - Ignore friend invite
|
|
159
|
+
*
|
|
160
|
+
* @example Open friend interactions
|
|
161
|
+
* ```typescript
|
|
162
|
+
* const friends = steam.friends.getAllFriends();
|
|
163
|
+
* const friend = friends[0];
|
|
164
|
+
*
|
|
165
|
+
* // View friend's profile
|
|
166
|
+
* steam.overlay.activateGameOverlayToUser(
|
|
167
|
+
* EOverlayToUserDialog.STEAM_ID,
|
|
168
|
+
* friend.steamId
|
|
169
|
+
* );
|
|
170
|
+
*
|
|
171
|
+
* // Open chat with friend
|
|
172
|
+
* steam.overlay.activateGameOverlayToUser(
|
|
173
|
+
* EOverlayToUserDialog.CHAT,
|
|
174
|
+
* friend.steamId
|
|
175
|
+
* );
|
|
176
|
+
*
|
|
177
|
+
* // View friend's achievements
|
|
178
|
+
* steam.overlay.activateGameOverlayToUser(
|
|
179
|
+
* EOverlayToUserDialog.ACHIEVEMENTS,
|
|
180
|
+
* friend.steamId
|
|
181
|
+
* );
|
|
182
|
+
* ```
|
|
183
|
+
*
|
|
184
|
+
* @example Friend management
|
|
185
|
+
* ```typescript
|
|
186
|
+
* // Add user as friend
|
|
187
|
+
* steam.overlay.activateGameOverlayToUser(
|
|
188
|
+
* EOverlayToUserDialog.FRIEND_ADD,
|
|
189
|
+
* '76561198012345678'
|
|
190
|
+
* );
|
|
191
|
+
*
|
|
192
|
+
* // Remove friend
|
|
193
|
+
* steam.overlay.activateGameOverlayToUser(
|
|
194
|
+
* EOverlayToUserDialog.FRIEND_REMOVE,
|
|
195
|
+
* friend.steamId
|
|
196
|
+
* );
|
|
197
|
+
* ```
|
|
198
|
+
*/
|
|
199
|
+
activateGameOverlayToUser(dialog, steamId) {
|
|
200
|
+
if (!this.apiCore.isInitialized()) {
|
|
201
|
+
console.error('[SteamOverlay] Cannot activate overlay to user: Steam not initialized');
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const friendsInterface = this.apiCore.getFriendsInterface();
|
|
205
|
+
if (!friendsInterface) {
|
|
206
|
+
console.error('[SteamOverlay] Friends interface not available');
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
try {
|
|
210
|
+
const steamId64 = BigInt(steamId);
|
|
211
|
+
this.libraryLoader.SteamAPI_ISteamFriends_ActivateGameOverlayToUser(friendsInterface, dialog, steamId64);
|
|
212
|
+
}
|
|
213
|
+
catch (error) {
|
|
214
|
+
console.error('[SteamOverlay] Error activating overlay to user:', error);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Activates the Steam overlay web browser to a specified URL
|
|
219
|
+
*
|
|
220
|
+
* @param url - The URL to open (must include protocol: http:// or https://)
|
|
221
|
+
* @param mode - Browser display mode (Default or Modal)
|
|
222
|
+
*
|
|
223
|
+
* @remarks
|
|
224
|
+
* Opens the Steam overlay's built-in web browser to the specified URL.
|
|
225
|
+
*
|
|
226
|
+
* Modes:
|
|
227
|
+
* - `Default` - Browser opens alongside other overlay windows, stays open
|
|
228
|
+
* when overlay is closed and reopened
|
|
229
|
+
* - `Modal` - Browser opens alone, hides other overlay windows. Browser and
|
|
230
|
+
* overlay close together
|
|
231
|
+
*
|
|
232
|
+
* The URL must include the protocol (http:// or https://).
|
|
233
|
+
*
|
|
234
|
+
* @example Open web pages
|
|
235
|
+
* ```typescript
|
|
236
|
+
* // Open game's wiki
|
|
237
|
+
* steam.overlay.activateGameOverlayToWebPage(
|
|
238
|
+
* 'https://wiki.example.com/game',
|
|
239
|
+
* EActivateGameOverlayToWebPageMode.Default
|
|
240
|
+
* );
|
|
241
|
+
*
|
|
242
|
+
* // Open modal for important announcement
|
|
243
|
+
* steam.overlay.activateGameOverlayToWebPage(
|
|
244
|
+
* 'https://example.com/news/important-update',
|
|
245
|
+
* EActivateGameOverlayToWebPageMode.Modal
|
|
246
|
+
* );
|
|
247
|
+
*
|
|
248
|
+
* // Open support page
|
|
249
|
+
* steam.overlay.activateGameOverlayToWebPage(
|
|
250
|
+
* 'https://support.example.com'
|
|
251
|
+
* );
|
|
252
|
+
* ```
|
|
253
|
+
*
|
|
254
|
+
* @example Context-sensitive help
|
|
255
|
+
* ```typescript
|
|
256
|
+
* function showHelp(topic: string) {
|
|
257
|
+
* const helpUrl = `https://help.example.com/${topic}`;
|
|
258
|
+
* steam.overlay.activateGameOverlayToWebPage(
|
|
259
|
+
* helpUrl,
|
|
260
|
+
* EActivateGameOverlayToWebPageMode.Modal
|
|
261
|
+
* );
|
|
262
|
+
* }
|
|
263
|
+
*
|
|
264
|
+
* // Usage
|
|
265
|
+
* showHelp('getting-started');
|
|
266
|
+
* showHelp('crafting-system');
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
activateGameOverlayToWebPage(url, mode = types_1.EActivateGameOverlayToWebPageMode.Default) {
|
|
270
|
+
if (!this.apiCore.isInitialized()) {
|
|
271
|
+
console.error('[SteamOverlay] Cannot activate overlay to web page: Steam not initialized');
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
const friendsInterface = this.apiCore.getFriendsInterface();
|
|
275
|
+
if (!friendsInterface) {
|
|
276
|
+
console.error('[SteamOverlay] Friends interface not available');
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
try {
|
|
280
|
+
this.libraryLoader.SteamAPI_ISteamFriends_ActivateGameOverlayToWebPage(friendsInterface, url, mode);
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
console.error('[SteamOverlay] Error activating overlay to web page:', error);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Activates the Steam overlay to a specific app's store page
|
|
288
|
+
*
|
|
289
|
+
* @param appId - The Steam App ID of the game/DLC
|
|
290
|
+
* @param flag - Store page behavior flag
|
|
291
|
+
*
|
|
292
|
+
* @remarks
|
|
293
|
+
* Opens the Steam overlay to a store page for the specified app.
|
|
294
|
+
*
|
|
295
|
+
* Flags:
|
|
296
|
+
* - `None` - Just open the store page
|
|
297
|
+
* - `AddToCart` - Open store page and add to cart
|
|
298
|
+
* - `AddToCartAndShow` - Add to cart and show the cart
|
|
299
|
+
*
|
|
300
|
+
* Useful for:
|
|
301
|
+
* - Showing DLC store pages
|
|
302
|
+
* - Cross-promoting other games
|
|
303
|
+
* - Quick purchase flow for in-game DLC prompts
|
|
304
|
+
*
|
|
305
|
+
* @example Open store pages
|
|
306
|
+
* ```typescript
|
|
307
|
+
* // Open your game's main store page
|
|
308
|
+
* steam.overlay.activateGameOverlayToStore(480, EOverlayToStoreFlag.None);
|
|
309
|
+
*
|
|
310
|
+
* // Show DLC and add to cart
|
|
311
|
+
* steam.overlay.activateGameOverlayToStore(12345, EOverlayToStoreFlag.AddToCart);
|
|
312
|
+
*
|
|
313
|
+
* // Add DLC to cart and show cart
|
|
314
|
+
* steam.overlay.activateGameOverlayToStore(
|
|
315
|
+
* 67890,
|
|
316
|
+
* EOverlayToStoreFlag.AddToCartAndShow
|
|
317
|
+
* );
|
|
318
|
+
* ```
|
|
319
|
+
*
|
|
320
|
+
* @example DLC promotion in-game
|
|
321
|
+
* ```typescript
|
|
322
|
+
* function showDLCStore(dlcAppId: number) {
|
|
323
|
+
* // Show a prompt
|
|
324
|
+
* const userWantsToBuy = confirm('Open store page for this DLC?');
|
|
325
|
+
*
|
|
326
|
+
* if (userWantsToBuy) {
|
|
327
|
+
* steam.overlay.activateGameOverlayToStore(
|
|
328
|
+
* dlcAppId,
|
|
329
|
+
* EOverlayToStoreFlag.AddToCart
|
|
330
|
+
* );
|
|
331
|
+
* }
|
|
332
|
+
* }
|
|
333
|
+
*
|
|
334
|
+
* // Show DLC when player tries to access locked content
|
|
335
|
+
* showDLCStore(12345);
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
activateGameOverlayToStore(appId, flag = types_1.EOverlayToStoreFlag.None) {
|
|
339
|
+
if (!this.apiCore.isInitialized()) {
|
|
340
|
+
console.error('[SteamOverlay] Cannot activate overlay to store: Steam not initialized');
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
const friendsInterface = this.apiCore.getFriendsInterface();
|
|
344
|
+
if (!friendsInterface) {
|
|
345
|
+
console.error('[SteamOverlay] Friends interface not available');
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
try {
|
|
349
|
+
this.libraryLoader.SteamAPI_ISteamFriends_ActivateGameOverlayToStore(friendsInterface, appId, flag);
|
|
350
|
+
}
|
|
351
|
+
catch (error) {
|
|
352
|
+
console.error('[SteamOverlay] Error activating overlay to store:', error);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Activates the Steam overlay invite dialog for a lobby
|
|
357
|
+
*
|
|
358
|
+
* @param steamIdLobby - The Steam ID of the lobby to invite friends to
|
|
359
|
+
*
|
|
360
|
+
* @remarks
|
|
361
|
+
* Opens the Steam overlay with the invite dialog, allowing the player
|
|
362
|
+
* to select friends to invite to the specified lobby.
|
|
363
|
+
*
|
|
364
|
+
* The lobby must be created first using Steam's matchmaking API.
|
|
365
|
+
* Friends will receive an invite notification that they can accept.
|
|
366
|
+
*
|
|
367
|
+
* @example Invite friends to multiplayer lobby
|
|
368
|
+
* ```typescript
|
|
369
|
+
* // After creating a lobby
|
|
370
|
+
* const lobbyId = '109775241021923456'; // From matchmaking API
|
|
371
|
+
*
|
|
372
|
+
* // Show invite dialog
|
|
373
|
+
* steam.overlay.activateGameOverlayInviteDialog(lobbyId);
|
|
374
|
+
* ```
|
|
375
|
+
*
|
|
376
|
+
* @example Multiplayer host menu
|
|
377
|
+
* ```typescript
|
|
378
|
+
* function onInviteFriendsClick() {
|
|
379
|
+
* const currentLobby = getCurrentLobbyId();
|
|
380
|
+
*
|
|
381
|
+
* if (currentLobby) {
|
|
382
|
+
* steam.overlay.activateGameOverlayInviteDialog(currentLobby);
|
|
383
|
+
* } else {
|
|
384
|
+
* console.log('No active lobby');
|
|
385
|
+
* }
|
|
386
|
+
* }
|
|
387
|
+
* ```
|
|
388
|
+
*/
|
|
389
|
+
activateGameOverlayInviteDialog(steamIdLobby) {
|
|
390
|
+
if (!this.apiCore.isInitialized()) {
|
|
391
|
+
console.error('[SteamOverlay] Cannot activate invite dialog: Steam not initialized');
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
const friendsInterface = this.apiCore.getFriendsInterface();
|
|
395
|
+
if (!friendsInterface) {
|
|
396
|
+
console.error('[SteamOverlay] Friends interface not available');
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
try {
|
|
400
|
+
const lobbyId64 = BigInt(steamIdLobby);
|
|
401
|
+
this.libraryLoader.SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialog(friendsInterface, lobbyId64);
|
|
402
|
+
}
|
|
403
|
+
catch (error) {
|
|
404
|
+
console.error('[SteamOverlay] Error activating invite dialog:', error);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Activates the Steam overlay Remote Play Together invite dialog
|
|
409
|
+
*
|
|
410
|
+
* @param steamIdLobby - The Steam ID of the lobby (can be 0 for no specific lobby)
|
|
411
|
+
*
|
|
412
|
+
* @remarks
|
|
413
|
+
* Opens the Steam overlay with the Remote Play Together invite dialog.
|
|
414
|
+
* Remote Play Together allows friends to play local multiplayer games together
|
|
415
|
+
* online - only the host needs to own the game.
|
|
416
|
+
*
|
|
417
|
+
* This is a Steam feature that streams your game to friends who join.
|
|
418
|
+
* Your game needs to support local multiplayer for this to work properly.
|
|
419
|
+
*
|
|
420
|
+
* @example Open Remote Play Together invite
|
|
421
|
+
* ```typescript
|
|
422
|
+
* // Open Remote Play Together invite (no specific lobby)
|
|
423
|
+
* steam.overlay.activateGameOverlayRemotePlayTogetherInviteDialog('0');
|
|
424
|
+
*
|
|
425
|
+
* // With a specific lobby
|
|
426
|
+
* const lobbyId = getCurrentLobbyId();
|
|
427
|
+
* steam.overlay.activateGameOverlayRemotePlayTogetherInviteDialog(lobbyId);
|
|
428
|
+
* ```
|
|
429
|
+
*
|
|
430
|
+
* @example Local multiplayer menu
|
|
431
|
+
* ```typescript
|
|
432
|
+
* function onRemotePlayClick() {
|
|
433
|
+
* console.log('Opening Remote Play Together invite...');
|
|
434
|
+
* steam.overlay.activateGameOverlayRemotePlayTogetherInviteDialog('0');
|
|
435
|
+
* }
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
activateGameOverlayRemotePlayTogetherInviteDialog(steamIdLobby) {
|
|
439
|
+
if (!this.apiCore.isInitialized()) {
|
|
440
|
+
console.error('[SteamOverlay] Cannot activate Remote Play invite: Steam not initialized');
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
const friendsInterface = this.apiCore.getFriendsInterface();
|
|
444
|
+
if (!friendsInterface) {
|
|
445
|
+
console.error('[SteamOverlay] Friends interface not available');
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
try {
|
|
449
|
+
const lobbyId64 = BigInt(steamIdLobby);
|
|
450
|
+
this.libraryLoader.SteamAPI_ISteamFriends_ActivateGameOverlayRemotePlayTogetherInviteDialog(friendsInterface, lobbyId64);
|
|
451
|
+
}
|
|
452
|
+
catch (error) {
|
|
453
|
+
console.error('[SteamOverlay] Error activating Remote Play invite:', error);
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Activates the Steam overlay invite dialog with a custom connect string
|
|
458
|
+
*
|
|
459
|
+
* @param connectString - The connect string that will be sent to invited friends
|
|
460
|
+
*
|
|
461
|
+
* @remarks
|
|
462
|
+
* Opens the invite dialog where players can select friends to invite.
|
|
463
|
+
* The specified connect string will be sent with the invitation.
|
|
464
|
+
*
|
|
465
|
+
* When a friend accepts the invite, your game will receive the connect string
|
|
466
|
+
* through the Rich Presence system or command-line (depending on configuration).
|
|
467
|
+
*
|
|
468
|
+
* The connect string typically contains information needed to join, such as:
|
|
469
|
+
* - Server IP and port
|
|
470
|
+
* - Session ID
|
|
471
|
+
* - Password or token
|
|
472
|
+
*
|
|
473
|
+
* @example Invite with server info
|
|
474
|
+
* ```typescript
|
|
475
|
+
* // Create connect string with server details
|
|
476
|
+
* const serverIP = '192.168.1.100';
|
|
477
|
+
* const serverPort = 27015;
|
|
478
|
+
* const connectString = `+connect ${serverIP}:${serverPort}`;
|
|
479
|
+
*
|
|
480
|
+
* // Open invite dialog
|
|
481
|
+
* steam.overlay.activateGameOverlayInviteDialogConnectString(connectString);
|
|
482
|
+
* ```
|
|
483
|
+
*
|
|
484
|
+
* @example Invite with session ID
|
|
485
|
+
* ```typescript
|
|
486
|
+
* function inviteFriendsToSession(sessionId: string) {
|
|
487
|
+
* const connectString = `+join_session ${sessionId}`;
|
|
488
|
+
* steam.overlay.activateGameOverlayInviteDialogConnectString(connectString);
|
|
489
|
+
* }
|
|
490
|
+
*
|
|
491
|
+
* // Usage
|
|
492
|
+
* const currentSession = 'abc123-def456';
|
|
493
|
+
* inviteFriendsToSession(currentSession);
|
|
494
|
+
* ```
|
|
495
|
+
*
|
|
496
|
+
* @example Invite with encrypted token
|
|
497
|
+
* ```typescript
|
|
498
|
+
* function inviteToPrivateMatch(matchToken: string) {
|
|
499
|
+
* const connectString = `+join_match ${matchToken}`;
|
|
500
|
+
* steam.overlay.activateGameOverlayInviteDialogConnectString(connectString);
|
|
501
|
+
* }
|
|
502
|
+
* ```
|
|
503
|
+
*/
|
|
504
|
+
activateGameOverlayInviteDialogConnectString(connectString) {
|
|
505
|
+
if (!this.apiCore.isInitialized()) {
|
|
506
|
+
console.error('[SteamOverlay] Cannot activate invite dialog: Steam not initialized');
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
const friendsInterface = this.apiCore.getFriendsInterface();
|
|
510
|
+
if (!friendsInterface) {
|
|
511
|
+
console.error('[SteamOverlay] Friends interface not available');
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
try {
|
|
515
|
+
this.libraryLoader.SteamAPI_ISteamFriends_ActivateGameOverlayInviteDialogConnectString(friendsInterface, connectString);
|
|
516
|
+
}
|
|
517
|
+
catch (error) {
|
|
518
|
+
console.error('[SteamOverlay] Error activating invite dialog with connect string:', error);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
exports.SteamOverlayManager = SteamOverlayManager;
|
|
523
|
+
//# sourceMappingURL=SteamOverlayManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SteamOverlayManager.js","sourceRoot":"","sources":["../../src/internal/SteamOverlayManager.ts"],"names":[],"mappings":";;;AAEA,oCAKkB;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiEG;AACH,MAAa,mBAAmB;IAO9B;;;;;OAKG;IACH,YAAY,aAAiC,EAAE,OAAqB;QAClE,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACH,mBAAmB,CAAC,MAA+B;QACjD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC;YAClC,O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