173 Commits

Author SHA1 Message Date
Joshua (MordenTral) Statzer
8315e35a8f Adding function to get the net id of a session owner 2025-09-26 08:36:19 -04:00
Joshua (MordenTral) Statzer
6462cd4c6f added note, trying to get epic to fix 2025-09-24 14:23:51 -04:00
Joshua (MordenTral) Statzer
e576724b63 include is gone 2025-09-23 13:52:32 -04:00
Joshua
682ac3f676 Added a control bool for the auto travel setup
Added a control bool for the auto travel setup, and exposed two new variables to the Update Session node
2025-08-07 15:01:34 -04:00
Joshua
b7b684fae9 fix missing return 2025-07-29 08:29:26 -04:00
mordentral
9eedc08f9a set built settings 2025-07-24 00:29:45 -04:00
mordentral
07634f173d fix a bug in the overlays 2025-07-19 23:57:47 -04:00
Joshua
df749735dd they didn't fix it fully turns out 2025-06-05 15:14:50 -04:00
Joshua
9a62ea3b61 looks like they fixed the steam status string crash 2025-05-16 12:35:30 -04:00
Joshua
2ade31aaa0 add workaround to FindFriendSession node as well 2025-01-10 08:58:07 -05:00
Joshua
116aca3a14 change over to manual delegate for steam notification 2024-12-12 09:14:42 -05:00
Joshua
f914c71e1b missed one 2024-11-19 13:05:57 -05:00
Joshua
324193a73b Adding missing includes to steam friends library texture composition 2024-11-19 12:19:23 -05:00
Joshua
af535c2f0c Test enforcing lobbies values to work around epic bugs 2024-11-18 08:30:07 -05:00
Joshua
711cb07121 move loading phase later and directly link to steam sdk 2024-11-15 08:54:29 -05:00
mordentral
4601328395 Revert "restore presence info, it no longer crashes"
This reverts commit 0decc37599.
2024-10-06 13:51:30 -04:00
mordentral
0decc37599 restore presence info, it no longer crashes 2024-10-06 12:56:24 -04:00
Joshua
579e2a1f60 update AS for the new presence changes
update AS for the new presence changes, with no SEARCH_PRESENCE and only bSearchLobbies being used, we don't need to actually set it manually, but rather just allow the type of search to handle whether it should be set or not.
2024-10-02 09:46:58 -04:00
Joshua (MordenTral) Statzer
7db3e9bc69 Merge pull request #95 from uno1982/SteamFriendUIFunctions
Join and Invite Steam FriendsUI sub menu support
2024-09-30 12:17:51 -04:00
Uno1982
d8e3d9cbff Join and Invite Steam FriendsUI sub menu support 2024-09-29 20:19:35 -05:00
mordentral
b7275c4fda Swapping around the compile time check so it will work with android 2024-04-26 21:50:07 -04:00
Joshua
f7701e76cf Epic is improperly forming the status string and its causing memory access issues. 2024-04-25 15:49:34 -04:00
Joshua
e982007518 safety check 2024-04-25 13:44:54 -04:00
Joshua
1cab9033a3 update plugin version 2024-04-23 16:02:14 -04:00
mordentral
c84e58e157 steam sessions appears to work with it enabled by default again 2024-03-20 22:33:52 -04:00
mordentral
817964b560 returns needed to be inside of the preprocessing 2024-03-20 22:29:57 -04:00
mordentral
d9ca76cfde Don't need to set this for steam
Don't need to set this for steam, it doesn't really hurt but people keep getting confused by the console warning.
2024-03-08 00:03:12 -05:00
Joshua
c883b1dc75 add auto conversion from my unique net id to the engines new bp accessible one 2024-02-13 10:09:02 -05:00
Joshua
892343a786 final changes 2024-01-22 16:05:26 -05:00
Joshua
3e265f1a64 more changes 2024-01-22 15:36:47 -05:00
Joshua
fe461af3b0 Merge branch 'master' into Refactorwork 2024-01-19 16:06:37 -05:00
Joshua
6ba73a5bbb initial refactor of latent nodes 2024-01-19 16:06:32 -05:00
Joshua (MordenTral) Statzer
f13d9ad8cc Merge pull request #83 from rubyperrin/master
Fix rare memory leak
2024-01-08 14:38:48 -05:00
ruby
2045c91b1d Fix rare memory leak 2024-01-02 15:23:52 +00:00
Joshua
d5e5c73ce6 testing new setup for Advanced steam sessions steam module ref 2023-12-13 10:34:13 -05:00
mordentral
82b1af6e34 ASS needed a new overlay type to be able to open 2023-11-12 13:58:38 -05:00
Joshua
8ce4613d71 go back to pre default loading phase 2023-11-01 08:52:18 -04:00
mordentral
0b79fb1817 no real reason 2023-10-16 21:30:49 -04:00
Joshua
069b2cbf87 Merge branch 'master' of https://github.com/mordentral/AdvancedSessionsPlugin 2023-10-12 11:09:42 -04:00
Joshua
9713ca512c not sure why these were both in private and public dependencies, looks like a copy paste typo. 2023-10-12 11:06:47 -04:00
mordentral
be280a6dfd Removed the steam subsystem entirely from the advanced steam module
Removed the steam subsystem entirely from the advanced steam module. In 5.3 it has a lot of issues with it for some reason, the steam subsystem is not loading if I directly reference it.

Changes should also work in prior versions.
2023-10-10 20:25:51 -04:00
Joshua (MordenTral) Statzer
b5c8b348c0 Merge pull request #77 from Nadwey/master
Fix build on platforms other than Windows, Mac or Linux
2023-08-22 09:00:21 -04:00
Nadwey
c292d70374 Fix build on platforms other than Windows, Mac or Linux 2023-08-21 21:32:48 +02:00
mordentral
df22d77b10 Adding in Steam Notifications Subsystem
Adding in Steam Notifications Subsystem, For now it just adds the OnOverlayActivated event, but it is expandable into the future being a subsystem.
2023-07-26 16:59:53 -04:00
Joshua
fc998399a2 Merge branch 'master' of https://github.com/mordentral/AdvancedSessionsPlugin 2023-07-26 08:53:04 -04:00
Joshua
8d92717bf6 update session add advertisement 2023-07-26 08:53:01 -04:00
Joshua (MordenTral) Statzer
e6c63eb756 Merge pull request #74 from Scylin232/master
Fix compilation error due to missing 'Online.h' inclusion
2023-06-26 08:22:42 -04:00
Scylin232
8ca00321fe Fix compilation error due to missing 'Online.h' inclusion 2023-06-24 08:15:31 +02:00
Joshua
b18041438e online session online session names additionnames addition 2023-05-11 15:13:15 -04:00
Joshua
2a2ca9a0d2 Mac filter text now only has the 5 parameter version. 2023-04-24 15:38:54 -04:00
Joshua
3d41678a62 forgot to delete definition 2023-01-25 15:01:24 -05:00
Joshua
5d2d63df75 fix multiple session results when searching both dedicated and lobbies
fix multiple session results when searching both dedicated and lobbies, its not a problem on steam but with lan and such it returns the same results as it doesn't care about presence.
2023-01-25 14:59:26 -05:00
Joshua
843a6024a5 Merge branch '5.1-Preview' 2022-11-15 12:07:58 -05:00
mordentral
6469e5e0bf they use a new virtual type hash now 2022-10-11 19:38:48 -04:00
Joshua
6c26d78568 a fix 2022-10-07 12:39:21 -04:00
Joshua
b6804f0f56 initial compiling version 2022-10-06 15:30:31 -04:00
Joshua (MordenTral) Statzer
382ed08217 Merge pull request #48 from Elewyth/master
properly forward UWorld::ServerTravel return value
2022-09-08 14:06:02 -04:00
Marc Etter
f760855494 properly forward UWorld::ServerTravel return value 2022-09-08 19:01:27 +02:00
Joshua
fe76b60b2e ue5 correction 2022-08-30 15:32:43 -04:00
Joshua
7f1b47f42d set cached unique net id in auto login as well 2022-08-30 08:42:41 -04:00
Joshua
3ac5d6c664 ported changes over 2022-08-22 16:00:22 -04:00
Joshua
fd33fc34a5 correct the create session node not passing on bAllowJoingViaPresence 2022-06-24 08:10:11 -04:00
Joshua
bc26be2a12 porting session change to ue5 2022-05-03 08:39:29 -04:00
Joshua
936532f1a0 forcing steam shared on
forcing steam shared on, its off by default and including steam subsystem isn't automatically turning it on.
2022-04-26 09:01:05 -04:00
Joshua
64710df075 whoops 2022-04-08 12:04:03 -04:00
Joshua
ab9de1b344 re-enabling end session 2022-04-08 10:54:04 -04:00
Joshua
bf4d99cba8 adding in pull request manually
https://github.com/mordentral/AdvancedSessionsPlugin/pull/32 manually merging due to changes since creation
2022-04-08 10:53:41 -04:00
Joshua
f7f56e7038 Merge branch 'UE5-ReleaseStaging' 2022-04-05 15:29:19 -04:00
Joshua
90fff579ba manually merging server travel node to ue5 2022-03-11 13:45:01 -05:00
Joshua (MordenTral) Statzer
2520d15e54 Merge pull request #30 from uno1982/master
Add server travel blueprint node.
2022-03-11 13:40:23 -05:00
uno1982
fbbb39c06c Merge pull request #1 from uno1982/uno1982-Servertravel
servertravel changes
2022-03-11 11:04:48 -06:00
uno1982
4922cd2154 Update AdvancedSessionsLibrary.h
Fixed typo on bShouldSkipGameNotify
2022-03-10 20:48:21 -06:00
uno1982
36cb58ea15 Added ServerTravel to library cpp 2022-03-10 20:34:11 -06:00
uno1982
e9747ff440 Update AdvancedSessionsLibrary.h 2022-03-10 20:10:48 -06:00
Joshua
e1ed0f22b6 normalizing EOL 2022-03-07 11:03:10 -05:00
Joshua
0de641f7d9 adding gitattributes 2022-03-07 10:46:44 -05:00
Joshua
295ab98a91 correct this pull request for ue5 2022-03-07 09:22:25 -05:00
Joshua (MordenTral) Statzer
18475eb2ef Merge pull request #24 from lotodore/login_update_playerstate_uniqueid
Update PlayerState UniqueId after Login

Good pull request, accepted
2022-03-07 08:23:56 -05:00
Joshua (MordenTral) Statzer
9784cd2f01 Merge pull request #25 from lotodore/change_type_to_authtype
Rename Login parameter "Type" to "AuthType".

Not a relevant change, it predates EOS, but will merge for clarity
2022-03-07 08:23:56 -05:00
Joshua (MordenTral) Statzer
ee9252a0df Merge pull request #24 from lotodore/login_update_playerstate_uniqueid
Update PlayerState UniqueId after Login

Good pull request, accepted
2022-03-07 08:22:33 -05:00
Joshua (MordenTral) Statzer
b3cc471bf3 Merge pull request #25 from lotodore/change_type_to_authtype
Rename Login parameter "Type" to "AuthType".

Not a relevant change, it predates EOS, but will merge for clarity
2022-03-07 08:20:21 -05:00
Lothar May
9bb2c553cd Rename parameter "Type" to "AuthType". 2022-03-05 14:32:41 +01:00
Lothar May
56639eb4a7 Fixing build of plugin changes on MacOS.
(cherry picked from commit cc311df9699a99305fe3c7d5d83f4fb0bb4b5550)
2022-03-05 13:47:55 +01:00
Lothar May
31c4be3629 Update UniqueId in login callback. See also ShowLoginUICallbackProxy.cpp in UE sources.
(cherry picked from commit 826bef7b861e8c20013033b57dd45cd8fec304e5)
2022-03-05 13:47:47 +01:00
mordentral
2e43a65acd fix include 2022-02-28 17:08:09 -05:00
Joshua
09bbe211a8 fix type and some functions that are soon to be replaced 2022-02-25 15:06:42 -05:00
Joshua
fded4d065b commit to bring to parity 2022-02-07 10:29:19 -05:00
Joshua
b0ae86b017 revert to ue5 EA on this branch, spool up a new one 2022-02-07 10:28:08 -05:00
Joshua
4d913be381 Merge branch 'master' into UE5-Prerelease 2022-01-27 09:15:56 -05:00
Joshua (MordenTral) Statzer
b986d7be2d Merge pull request #19 from mrcodesx/issue-18
Fix: Issue #18 Update session fails with "NO REGISTERED SESSIONS" error
2022-01-21 13:41:54 -05:00
MrCodesX
82b2f9f594 Fix: Issue #18 Update session not finding sessions to update 2022-01-09 00:54:42 -06:00
Joshua (MordenTral) Statzer
ec634238f8 Merge pull request #16 from Ji-Rath/EOS_QOL
EOS QOL
2021-12-21 14:37:19 -05:00
Ji-Rath
21b5b139d9 Add UseLobbiesVoiceChat option for CreateSession
Allows the user to setup voice chat lobbies if the API supports it
2021-12-17 15:47:39 -06:00
Ji-Rath
7b8bebac66 Add AutoLoginUserCallbackProxy
Implement AutoLogin function, can be used to login automatically using the EOS SDK Dev Auth Tool
2021-12-17 15:45:18 -06:00
Ji-Rath
444b632a72 Add type parameter to LoginUser
Add type parameter so EOS can use "accountportal" to authenticate, falls back to default implementation if left blank
2021-12-17 15:27:22 -06:00
Joshua
8192f73ca7 fix bad header 2021-10-25 08:26:13 -04:00
Joshua
f2a33fe1c6 Revert "update for new session option"
This reverts commit b72b0d59fe.
2021-10-22 15:50:52 -04:00
Joshua
c59f4bba43 Revert "fix default value for lobby sessions on create session"
This reverts commit 7b21ee2344.
2021-10-22 15:50:45 -04:00
Joshua
7b21ee2344 fix default value for lobby sessions on create session
fix default value for lobby sessions on create session
2021-10-22 15:32:24 -04:00
Joshua
94fb993ad7 fix default value for lobby sessions on create session
fix default value for lobby sessions on create session
2021-10-22 15:31:22 -04:00
Joshua
b72b0d59fe update for new session option
update for new session option
2021-10-22 15:31:06 -04:00
Louis Raverdy
5b2260079c Update SteamRequestGroupOfficersCallbackProxy.h 2021-10-18 22:02:12 +02:00
Louis Raverdy
c4df122248 Update AdvancedSteamFriendsLibrary.h 2021-10-18 22:01:46 +02:00
Louis Raverdy
6065bd9a36 Update SteamRequestGroupOfficersCallbackProxy.cpp 2021-10-18 22:00:37 +02:00
Joshua
d67c039088 support steam bug on mac
support steam bug on mac
2021-10-12 10:01:02 -04:00
Joshua
6c392ee1fb backing out search lobbies in ue5, it doesn't exist here yet
backing out search lobbies in ue5, it doesn't exist here yet
2021-09-29 08:39:45 -04:00
Joshua
4b7cffc1c0 add lobby search to find
add lobby search to find
2021-09-13 08:21:23 -04:00
Joshua
0be6427845 corrected uplugin versions
corrected uplugin versions
2021-09-01 13:24:33 -04:00
Joshua
816b701963 add lobby search to find
add lobby search to find
2021-08-24 09:22:34 -04:00
Joshua
e9bea6cac0 fix default value for lobby sessions on create session
fix default value for lobby sessions on create session
2021-08-23 08:39:21 -04:00
Joshua
a63bb0916a Merge branch '4.27-Port' 2021-08-19 13:20:53 -04:00
Joshua
be6f532c1e Added new steam sessions functions
IsOverlay Enabled
InitTextFiltering
FilterText
IsSteamInBigPictureMode
2021-08-16 12:52:55 -04:00
Joshua
1f6b7dbb3b Added new steam sessions functions
IsOverlay Enabled
InitTextFiltering
FilterText
IsSteamInBigPictureMode
2021-08-16 12:52:44 -04:00
Joshua
c391737812 fix ADmissing properties
fix ADmissing properties
2021-08-09 15:35:20 -04:00
Joshua
156025af2d update for new session option
update for new session option
2021-06-10 09:50:13 -04:00
Joshua
ce25430643 packages
packages
2021-06-07 12:27:07 -04:00
Joshua
dfb5ad544a removed win32 check
removed win32 check
2021-05-28 10:03:52 -04:00
Joshua
188d5059fc forgot to update AS version
forgot to update AS version
2021-01-08 08:22:45 -05:00
Joshua
e561b92679 added comparison operator for FBPUniqueNetID
added comparison operator for FBPUniqueNetID, so that STD functions will work with it.
2020-11-13 15:42:24 -05:00
Joshua
0cee743c63 adding plater state header fix
adding plater state header fix
2020-09-18 09:22:34 -04:00
mordentral
bfd459b461 Ban/Kick Player
Adds BP nodes to the library to kick / ban player

Since built in game sessions does not actually implement ban player, I also provide a very basic naive implementation with a custom game session that bans for the duration of the session. A real implementation would save out the net id and also perform the check in the game mode before spooling up a player for login.
2020-06-27 18:43:06 -04:00
mordentral
17228f6bbb added gitignore
added gitignore
2020-06-07 20:50:51 -04:00
mordentral
c32fc3488f Update README.md 2020-06-05 21:59:07 -04:00
mordentral
05497d3226 Taking 4.25 live
Former-commit-id: 8d82ec41ffb783c0cfbb667ca1aa5061afa74c8e
2020-05-05 19:09:42 -04:00
mordentral
2216aaf041 made a note on the literal search bool nodes that they aren't used for filtering
on steam


Former-commit-id: dd4423b2810500c7106c065ca632a5bd4794749a
2020-02-04 09:51:33 -05:00
mordentral
192307b542 fixing a replace operation that screwed up the .uplugin files
Former-commit-id: bef14f3afc4f9cff36b62441ccf79ed8e6d21edc
2019-12-09 10:47:53 -05:00
mordentral
51cf0acb2e Taking 4.24 live
Former-commit-id: 9fd092e594a1c561c109633f8661a766e5a2a6e4
2019-12-09 10:26:49 -05:00
mordentral
3c4ba2af3b fixed deprecating function call
Former-commit-id: 3b0a2802808bce6cf442f233e5f041d8b0ea3505
2019-10-29 10:12:27 -04:00
mordentral
8744035160 Added world context to a bunch of relevant nodes.
Should likely add it to others in the future as well.


Former-commit-id: c41024927d6525c3c35ff609bdffdb2960b6e3ae
2019-10-29 09:52:28 -04:00
mordentral
71f16cadd2 fixed a compilation issue
Former-commit-id: 2a9d3410b912fa418c62e54561dfe0a60df50c33
2019-10-15 14:20:02 -04:00
mordentral
fdfc2d272f added an include to fix up potential Gengine issues
Former-commit-id: d3b5af9617865f37f3c207ec41e42d1ea107d0c3
2019-10-15 10:07:13 -04:00
mordentral
297848aed8 merging 4.23
Former-commit-id: 15eff386a29a783738c08a95ccced0bf750e7611
2019-09-04 16:22:01 -04:00
morden
60d1d272a5 Added more exclusions that were missing so that this module works with android
Former-commit-id: 761446368dbf589018c1a9cb9ab94bf44544569d
2019-08-04 15:43:13 -04:00
morden
c3f889c9c5 cleaned up some includes
Former-commit-id: f5553794bc0bb12c833829ef2728df168994c694
2019-05-25 13:15:54 -04:00
mordentral
2e93c6095a Converted over to using the newer session names
Former-commit-id: f6d820a363d9e6881c647d9d29059ade0ac05746
2019-04-18 15:11:12 -04:00
mordentral
6007506189 Added another session id utility function
Former-commit-id: 4e97162f7c10db3bd97b3756fa2de911e360b662
2019-04-18 13:35:15 -04:00
mordentral
0952d9b18a Added a new utility function to the Advanced Sessions Function Library
(Thanks to Vorixo)

Gets the specified session results session ID as a string


Former-commit-id: da5f0345f3e48ac0c832dbdbc365b0111341dd0b
2019-04-17 15:32:12 -04:00
morden
438d0a69ba Fixed a steam id error
Former-commit-id: cb35546a02707558f615fc2d20a3e2af5fe6d3c8
2019-04-05 19:51:00 -04:00
J
85e9b54fab Merged 4.22 into default
Former-commit-id: 70a1989c1dc8a6925fffd5588906629c63b8ffa7
2019-04-02 18:19:51 +00:00
mordentral
ba28fccfe0 pushing 4.22 live
Former-commit-id: e68353ec156bef65a4823eae2b056e5f5b0878aa
2019-03-26 12:52:48 -04:00
mordentral
d71aaede8d Added OpenSteamUserOverlay to the AdvancedSteamFriendsLibrary
Former-commit-id: d65ec87132032ccfbc06dac90630548ee56d800f
2019-01-15 12:56:03 -05:00
mordentral
38b5c96cbd Adding extended comment to create advanced session, thanks rumbleball
Former-commit-id: 1ed8d2f155d8ea51df6649b674636ceb87c27661
2018-12-05 09:49:57 -05:00
mordentral
ad745512ac Switched to epics new hashing setup for unique ids
Also added new function GetLocalSteamIDFromSteam.


Former-commit-id: 7a15f500cd86064444cedb47433417b7bb9298e4
2018-11-14 14:08:45 -05:00
mordentral
ce7d8b1bf3 4.21 update
Former-commit-id: 91ebbaafc5a4f262d0b811c22b2a83799219fb15
2018-11-07 14:13:15 -05:00
mordentral
abb9e5687c fixed some case sensitivity issues with player controller include.
Former-commit-id: 433cd31b27d21c232453b038a1bd3c077bfb43d3
2018-10-23 14:30:29 -04:00
mordentral
47c6981a2a Fixing the blueprint events being thrown in the steam callback thread.
Former-commit-id: e333ce44217f61acd3545ea12a33a5fddcd27d98
2018-09-28 14:37:34 -04:00
mordentral
20f99a5e10 Removing a test I had been doing like a year ago from GetFriendGamePlayed function
Former-commit-id: 7e0d599ed253f90b789850578accda5d89c1f0d6
2018-08-17 14:33:19 -04:00
morden
289fa84dd5 Large header file cleanup, removing engine minimal
Former-commit-id: 44000ab1d974311615c30ba2fe1f7cd9d6c61ca2
2018-07-30 20:37:20 -04:00
morden
b8a5e7500b some more include path changes for 4.20's weirdness
Former-commit-id: b5adb4101cdf41d29ba0c1d9ecbfb306b727fc26
2018-07-29 18:59:52 -04:00
mordentral
4cc84d68c4 Fixed some more includes
Former-commit-id: 4d8a7bfa7bf7dfbecfa85bdebb0f4baf28ae6a1d
2018-07-23 08:18:44 -04:00
mordentral
b553a8c3b6 Replaced some more interface includes
Former-commit-id: da6919b9a3dc9ee0e75d232e2a47caffd84e2d81
2018-07-20 10:39:08 -04:00
J
bc0e8f7d1b Merged 4.20 Beta into default
Former-commit-id: 5d177fa3f45a0f4430150d0b321dc9eecba23815
2018-07-18 13:23:58 -04:00
mordentral
886b4c2f8a Final sessions commit
Former-commit-id: 1151cf522d737add4908b62dd2616e3260bc7049
2018-07-18 13:23:12 -04:00
mordentral
47775e70bf 4.20 update, working
Former-commit-id: b4d3b7358c168e4e34576b001d18c0cc3b5d8c59
2018-06-21 14:06:02 -04:00
J
924b1ecf1c README.md edited online with Bitbucket
Former-commit-id: 04d85045133970c8e3e956281a58cdec437b332d
2018-04-04 14:47:41 +00:00
J
c73b96993c Merged 4.19 Beta into default
Former-commit-id: 56f3400a30ceb21ce5cce9dc73511e64fb2e514e
2018-04-04 10:41:49 -04:00
J
0229b69d9c Close branch 4.19 Beta
Former-commit-id: 1c0ff2831cd4ddf6e4f511d0399926aa88b6d74b
2018-04-04 10:41:49 -04:00
mordentral
ad2881cd75 Updated some documentation comments
Prepping for auto documentation generation


Former-commit-id: a26d6bbb5c6ba5e11d096bfaa486fd08c5b149ff
2018-04-04 10:40:26 -04:00
mordentral
d007eed9a8 Update module files
Former-commit-id: f88e13eeeb0741e9809aceeb902347d6eea760da
2018-02-27 08:53:00 -05:00
morden
37891f168a Backed out changeset: cdeecf8d12f5
Former-commit-id: a312d44bca502ca3252ced596c326e26c3a89d35
2018-02-08 17:37:39 -05:00
morden
c2a5598582 Backed out changeset: e30e5f51636b
Former-commit-id: eb6dcaf4988028da6feb01f69e465fdfbe497e74
2018-02-08 17:37:28 -05:00
morden
90e7a3f7e4 Changed the findsessions to force searching presence off for dedicated server
searching.

I am fairly sure it defaults to false, but just in case.


Former-commit-id: ef5c861daa1e7259d81cef046ada39d82f403ac1
2018-02-08 17:29:55 -05:00
morden
2db3b7221c Changed the findsessions to force searching presence off for dedicated server
searching.

I am fairly sure it defaults to false, but just in case.


Former-commit-id: 725cd3a3e9b3914bed549ff18a93334348075493
2018-02-08 17:29:55 -05:00
morden
ea77c18a2e 4.19
Former-commit-id: 58eebfc1e9bfa9211a5acde5a65e75254c5904ea
2018-01-16 21:32:40 -05:00
mordentral
483ffd5f6b Thanks to CriErr for the following submission via a pull request.
Made some small modifications to them but they are mostly the same.


Former-commit-id: f304534c4f34dd92a3e6d96a87e3f2652321b1ae
2017-11-22 09:50:03 -05:00
mordentral
64218a7f5b Fixing a missing IsValid check in FindSessions
Former-commit-id: c4e3fc15f93f71fe8256be447da02af75cfc72c2
2017-10-31 10:03:43 -04:00
morden
651292d8a9 Header file cleanup
Former-commit-id: e2a964c8464034860505b51d5ef4ece9bf1ad8e6
2017-08-31 23:56:34 -04:00
morden
f338fd62f2 Removed an unessacary player controller check in CreateSession
Added a valid player controller check and instant fail if not true.


Former-commit-id: b21de68a2c16fde8eae56c6d92da30d5fb8955d7
2017-08-19 18:57:55 -04:00
mordentral
fcba71790f Adding dependancy modules
Former-commit-id: 86081d7970d5ce82bdd582aae222c22331ebe507
2017-08-08 15:48:44 -04:00
J
ab557a31d5 Merged 4.17 beta into default
Former-commit-id: 710fe29881f2cba9f4957b64573ed003cd233836
2017-08-07 12:51:34 -04:00
J
2faf24bce3 Close branch 4.17 beta
Former-commit-id: a03b09bcdb05545872adb9319e372c745b063540
2017-08-07 12:51:34 -04:00
mordentral
9b2899cf28 Updating some functions for 4.17
Former-commit-id: 77d4a2b8d5f2e3949d676b1968ee405e25989c7d
2017-08-03 16:09:14 -04:00
mordentral
f5f801273d 4.17 changes
Former-commit-id: 401105bdd16dfc01e118f7d96daf63cf8360503a
2017-07-24 08:30:57 -04:00
68 changed files with 6223 additions and 4412 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
* text=auto
*.bat eol=crlf

10
.gitignore vendored Normal file
View File

@@ -0,0 +1,10 @@
.hg/
binaries/
deriveddatacache/
.vs/
build/
intermediate/
PACKPLUGIN/
saved/
*.orig

View File

@@ -1,20 +1,34 @@
{
"FileVersion" : 3,
"FriendlyName" : "Advanced Sessions",
"Version" : 1.9,
"VersionName": "1.9",
"Description" : "Adds new blueprint functions to handle more advanced session operations.",
"Category" : "Advanced Sessions Plugin",
"CreatedBy" : "Joshua Statzer",
"CreatedByURL" : "N/A",
"Modules" :
[
{
"Name" : "AdvancedSessions",
"Type" : "RunTime",
"LoadingPhase" : "PreDefault"
}
]
"FileVersion": 3,
"FriendlyName": "Advanced Sessions",
"Version": 5.5,
"VersionName": "5.5",
"Description": "Adds new blueprint functions to handle more advanced session operations.",
"Category": "Advanced Sessions Plugin",
"CreatedBy": "Joshua Statzer",
"CreatedByURL": "N/A",
"Modules": [
{
"Name": "AdvancedSessions",
"Type": "Runtime",
"LoadingPhase": "PreDefault"
}
],
"Plugins": [
{
"Name": "OnlineSubsystem",
"Enabled": true
},
{
"Name": "OnlineSubsystemUtils",
"Enabled": true
}
],
"DocsURL": "",
"MarketplaceURL": "",
"SupportURL": "",
"CanContainContent": false,
"IsBetaVersion": false,
"IsExperimentalVersion": false,
"Installed": false
}

View File

@@ -0,0 +1,8 @@
[FilterPlugin]
; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and
; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively.
;
; Examples:
; /README.txt
; /Extras/...
; /Binaries/ThirdParty/*.dll

View File

@@ -5,14 +5,16 @@ public class AdvancedSessions : ModuleRules
{
public AdvancedSessions(ReadOnlyTargetRules Target) : base(Target)
{
DefaultBuildSettings = BuildSettingsVersion.Latest;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
//bEnforceIWYU = true;
Definitions.Add("WITH_ADVANCED_SESSIONS=1");
PublicDefinitions.Add("WITH_ADVANCED_SESSIONS=1");
PrivateIncludePaths.AddRange(new string[] { "AdvancedSessions/Private"/*, "OnlineSubsystemSteam/Private"*/ });
PublicIncludePaths.AddRange(new string[] { "AdvancedSessions/Public" });
// PrivateIncludePaths.AddRange(new string[] { "AdvancedSessions/Private"/*, "OnlineSubsystemSteam/Private"*/ });
// PublicIncludePaths.AddRange(new string[] { "AdvancedSessions/Public" });
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "OnlineSubsystem", "CoreUObject", "OnlineSubsystemUtils", "Networking", "Sockets"/*"Voice", "OnlineSubsystemSteam"*/ });
PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "Sockets", "Networking", "OnlineSubsystemUtils" /*"Voice", "Steamworks","OnlineSubsystemSteam"*/});
}
}

View File

@@ -13,7 +13,7 @@
//#include "OnlineMessageInterface.h"
//#include "OnlinePresenceInterface.h"
//#include "Engine/GameInstance.h"
#include "OnlineSessionInterface.h"
#include "Interfaces/OnlineSessionInterface.h"
//#include "UObjectIterator.h"
@@ -32,32 +32,32 @@ public:
//********* External UI Functions *************//
// Show the UI that handles the Friends list
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result"))
static void ShowFriendsUI(APlayerController *PlayerController, EBlueprintResultSwitch &Result);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void ShowFriendsUI(UObject* WorldContextObject, APlayerController *PlayerController, EBlueprintResultSwitch &Result);
// Show the UI that handles inviting people to your game
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result"))
static void ShowInviteUI(APlayerController *PlayerController, EBlueprintResultSwitch &Result);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void ShowInviteUI(UObject* WorldContextObject, APlayerController *PlayerController, EBlueprintResultSwitch &Result);
// Show the UI that shows the leaderboard (doesn't work with steam)
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result"))
static void ShowLeaderBoardUI(FString LeaderboardName, EBlueprintResultSwitch &Result);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void ShowLeaderBoardUI(UObject* WorldContextObject, FString LeaderboardName, EBlueprintResultSwitch &Result);
// Show the UI that shows a web URL
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", AutoCreateRefTerm = "AllowedDomains"))
static void ShowWebURLUI(FString URLToShow, EBlueprintResultSwitch &Result, TArray<FString>& AllowedDomains, bool bEmbedded = false , bool bShowBackground = false, bool bShowCloseButton = false, int32 OffsetX = 0, int32 OffsetY = 0, int32 SizeX = 0, int32 SizeY = 0);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", AutoCreateRefTerm = "AllowedDomains", WorldContext = "WorldContextObject"))
static void ShowWebURLUI(UObject* WorldContextObject, FString URLToShow, EBlueprintResultSwitch &Result, TArray<FString>& AllowedDomains, bool bEmbedded = false , bool bShowBackground = false, bool bShowCloseButton = false, int32 OffsetX = 0, int32 OffsetY = 0, int32 SizeX = 0, int32 SizeY = 0);
// Show the UI that shows a web URL
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI")
static void CloseWebURLUI();
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (WorldContext = "WorldContextObject"))
static void CloseWebURLUI(UObject* WorldContextObject);
// Show the UI that shows the profile of a uniquenetid
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result"))
static void ShowProfileUI(const FBPUniqueNetId PlayerViewingProfile, const FBPUniqueNetId PlayerToViewProfileOf, EBlueprintResultSwitch &Result);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void ShowProfileUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerViewingProfile, const FBPUniqueNetId PlayerToViewProfileOf, EBlueprintResultSwitch &Result);
// Show the UI that shows the account upgrade UI (doesn't work with steam)
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result"))
static void ShowAccountUpgradeUI(const FBPUniqueNetId PlayerRequestingAccountUpgradeUI, EBlueprintResultSwitch &Result);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedExternalUI", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void ShowAccountUpgradeUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerRequestingAccountUpgradeUI, EBlueprintResultSwitch &Result);
};

View File

@@ -2,19 +2,20 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/Engine.h"
#include "BlueprintDataDefinitions.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Online.h"
#include "OnlineSubsystem.h"
#include "OnlineFriendsInterface.h"
#include "OnlineUserInterface.h"
#include "OnlineMessageInterface.h"
#include "OnlinePresenceInterface.h"
#include "Interfaces/OnlineFriendsInterface.h"
#include "Interfaces/OnlineUserInterface.h"
#include "Interfaces/OnlineMessageInterface.h"
#include "Interfaces/OnlinePresenceInterface.h"
#include "Engine/GameInstance.h"
#include "Engine/LocalPlayer.h"
#include "OnlineSessionInterface.h"
#include "Interfaces/OnlineSessionInterface.h"
#include "OnlineSessionSettings.h"
#include "UObjectIterator.h"
#include "UObject/UObjectIterator.h"
#include "AdvancedFriendsInterface.h"
#include "AdvancedFriendsGameInstance.generated.h"
@@ -43,6 +44,11 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedVoiceInterface)
bool bEnableTalkingStatusDelegate;
// If true we will auto travel to a game session when an invite is received.
// This can get in the way of Beacon Sessions, you may want to disable it.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = AdvancedFriendsInterface)
bool bAutoTravelOnAcceptedUserInviteReceived = true;
//virtual void PostLoad() override;
virtual void Shutdown() override;
virtual void Init() override;
@@ -51,6 +57,13 @@ public:
FOnSessionInviteReceivedDelegate SessionInviteReceivedDelegate;
FDelegateHandle SessionInviteReceivedDelegateHandle;
// custom handle to join directly from steam ui "Join Game"
FDelegateHandle OnJoinSessionCompleteDelegateHandle;
// custom Steam UI Join User function #Self invite#
void OnSessionUserInviteAccepted(const bool bWasSuccessful, const int32 ControllerId, FUniqueNetIdPtr UserId, const FOnlineSessionSearchResult& InviteResult);
// custom Steam UI function to client travel #Self invite#
void OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result);
//const FUniqueNetId& /*UserId*/, const FUniqueNetId& /*FromId*/, const FString& /*AppId*/, const FOnlineSessionSearchResult& /*InviteResult*/
void OnSessionInviteReceivedMaster(const FUniqueNetId & PersonInvited, const FUniqueNetId & PersonInviting, const FString & AppId, const FOnlineSessionSearchResult& SessionToJoin);
@@ -65,6 +78,7 @@ public:
void OnSessionInviteAcceptedMaster(const bool bWasSuccessful, int32 LocalPlayer, TSharedPtr<const FUniqueNetId> PersonInviting, const FOnlineSessionSearchResult& SessionToJoin);
// After a session invite has been accepted by the local player this event is triggered, call JoinSession on the session result to join it
// This function is currently not hooked up in any of Epics default subsystems, it is here for custom subsystems
UFUNCTION(BlueprintImplementableEvent, Category = "AdvancedFriends")
void OnSessionInviteAccepted(int32 LocalPlayerNum, FBPUniqueNetId PersonInvited, const FBlueprintSessionResult& SessionToJoin);

View File

@@ -5,14 +5,14 @@
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Online.h"
#include "OnlineSubsystem.h"
#include "OnlineFriendsInterface.h"
#include "OnlineUserInterface.h"
#include "OnlineMessageInterface.h"
#include "OnlinePresenceInterface.h"
#include "Interfaces/OnlineFriendsInterface.h"
#include "Interfaces/OnlineUserInterface.h"
#include "Interfaces/OnlineMessageInterface.h"
#include "Interfaces/OnlinePresenceInterface.h"
#include "Engine/GameInstance.h"
#include "OnlineSessionInterface.h"
#include "Interfaces/OnlineSessionInterface.h"
#include "OnlineSessionSettings.h"
#include "UObjectIterator.h"
#include "UObject/UObjectIterator.h"
#include "BlueprintDataDefinitions.h"
#include "AdvancedFriendsInterface.generated.h"

View File

@@ -7,14 +7,14 @@
#include "Online.h"
#include "Engine/LocalPlayer.h"
#include "OnlineSubsystem.h"
#include "OnlineFriendsInterface.h"
#include "OnlineUserInterface.h"
#include "OnlineMessageInterface.h"
#include "OnlinePresenceInterface.h"
#include "Interfaces/OnlineFriendsInterface.h"
#include "Interfaces/OnlineUserInterface.h"
#include "Interfaces/OnlineMessageInterface.h"
#include "Interfaces/OnlinePresenceInterface.h"
#include "Engine/GameInstance.h"
#include "OnlineSessionInterface.h"
#include "Interfaces/OnlineSessionInterface.h"
#include "UObjectIterator.h"
#include "UObject/UObjectIterator.h"
#include "AdvancedFriendsLibrary.generated.h"

View File

@@ -0,0 +1,71 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Engine/Engine.h"
#include "Online.h"
#include "OnlineSubsystem.h"
#include "Engine/GameInstance.h"
#include "GameFramework/GameModeBase.h"
#include "GameFramework/GameSession.h"
#include "GameFramework/PlayerState.h"
//#include "UObjectIterator.h"
#include "AdvancedGameSession.generated.h"
/**
A quick wrapper around the game session to add a partial ban implementation. Just bans for the duration of the current session
*/
UCLASS(config = Game, notplaceable)
class AAdvancedGameSession : public AGameSession
{
GENERATED_UCLASS_BODY()
public:
UPROPERTY(Transient)
TMap<FUniqueNetIdRepl, FText> BanList;
virtual bool BanPlayer(class APlayerController* BannedPlayer, const FText& BanReason)
{
if (APlayerState* PlayerState = (BannedPlayer != NULL) ? BannedPlayer->PlayerState : NULL)
{
FUniqueNetIdRepl UniqueNetID = PlayerState->GetUniqueId();
bool bWasKicked = KickPlayer(BannedPlayer, BanReason);
if (bWasKicked)
{
BanList.Add(UniqueNetID, BanReason);
}
return bWasKicked;
}
return false;
}
// This should really be handled in the game mode asking game session, but I didn't want to force a custom game session AND game mode
// If done in the game mode, we could check prior to actually spooling up any player information in ApproveLogin
virtual void PostLogin(APlayerController* NewPlayer) override
{
if (APlayerState* PlayerState = (NewPlayer != NULL) ? NewPlayer->PlayerState : NULL)
{
FUniqueNetIdRepl UniqueNetID = PlayerState->GetUniqueId();
if (BanList.Contains(UniqueNetID))
{
KickPlayer(NewPlayer, BanList[UniqueNetID]);
}
}
}
};
AAdvancedGameSession::AAdvancedGameSession(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}

View File

@@ -6,13 +6,13 @@
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Online.h"
#include "OnlineSubsystem.h"
#include "OnlineIdentityInterface.h"
#include "OnlineUserInterface.h"
#include "OnlinePresenceInterface.h"
#include "Interfaces/OnlineIdentityInterface.h"
#include "Interfaces/OnlineUserInterface.h"
#include "Interfaces/OnlinePresenceInterface.h"
#include "Engine/GameInstance.h"
#include "Engine/LocalPlayer.h"
#include "UObjectIterator.h"
#include "UObject/UObjectIterator.h"
#include "AdvancedIdentityLibrary.generated.h"
@@ -28,26 +28,26 @@ public:
//********* Identity Functions *************//
// Get the login status of a local player
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity", meta = (ExpandEnumAsExecs = "Result"))
static void GetLoginStatus(const FBPUniqueNetId & UniqueNetID, EBPLoginStatus & LoginStatus, EBlueprintResultSwitch &Result);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void GetLoginStatus(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetID, EBPLoginStatus & LoginStatus, EBlueprintResultSwitch &Result);
// Get the auth token for a local player
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity", meta = (ExpandEnumAsExecs = "Result"))
static void GetPlayerAuthToken(APlayerController * PlayerController, FString & AuthToken, EBlueprintResultSwitch &Result);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void GetPlayerAuthToken(UObject* WorldContextObject, APlayerController * PlayerController, FString & AuthToken, EBlueprintResultSwitch &Result);
// Get a players nickname
UFUNCTION(BlueprintPure, Category = "Online|AdvancedIdentity")
static void GetPlayerNickname(const FBPUniqueNetId & UniqueNetID, FString & PlayerNickname);
UFUNCTION(BlueprintPure, Category = "Online|AdvancedIdentity", meta = (WorldContext = "WorldContextObject"))
static void GetPlayerNickname(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetID, FString & PlayerNickname);
//********* User Account Functions *************//
// Get a users account
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result"))
static void GetUserAccount(const FBPUniqueNetId & UniqueNetId, FBPUserOnlineAccount & AccountInfo, EBlueprintResultSwitch &Result);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void GetUserAccount(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetId, FBPUserOnlineAccount & AccountInfo, EBlueprintResultSwitch &Result);
// Get all known users accounts
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result"))
static void GetAllUserAccounts(TArray<FBPUserOnlineAccount> & AccountInfos, EBlueprintResultSwitch &Result);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedIdentity|UserAccount", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void GetAllUserAccounts(UObject* WorldContextObject, TArray<FBPUserOnlineAccount> & AccountInfos, EBlueprintResultSwitch &Result);
// Get a user account access token
UFUNCTION(BlueprintPure, Category = "Online|AdvancedIdentity|UserAccount")

View File

@@ -1,6 +1,6 @@
#pragma once
#include "ModuleManager.h"
#include "Modules/ModuleManager.h"
class AdvancedSessions : public IModuleInterface
{

View File

@@ -2,18 +2,22 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/Engine.h"
#include "BlueprintDataDefinitions.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Online.h"
#include "OnlineSubsystem.h"
#include "OnlineFriendsInterface.h"
#include "OnlineUserInterface.h"
#include "OnlineMessageInterface.h"
#include "OnlinePresenceInterface.h"
#include "Interfaces/OnlineFriendsInterface.h"
#include "Interfaces/OnlineUserInterface.h"
#include "Interfaces/OnlineMessageInterface.h"
#include "Interfaces/OnlinePresenceInterface.h"
#include "Engine/GameInstance.h"
#include "OnlineSessionInterface.h"
#include "Interfaces/OnlineSessionInterface.h"
#include "UObjectIterator.h"
#include "GameFramework/GameModeBase.h"
#include "GameFramework/GameSession.h"
//#include "UObjectIterator.h"
#include "AdvancedSessionsLibrary.generated.h"
@@ -27,6 +31,17 @@ class UAdvancedSessionsLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
//********* Session Admin Functions *************//
// Kick a player from the currently active game session, only available on the server
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions", meta = (WorldContext = "WorldContextObject"))
static bool KickPlayer(UObject* WorldContextObject, APlayerController* PlayerToKick, FText KickReason);
// Ban a player from the currently active game session, only available on the server
// Note that the default gamesession class does not implement an actual ban list and just kicks when this is called
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions", meta = (WorldContext = "WorldContextObject"))
static bool BanPlayer(UObject* WorldContextObject, APlayerController* PlayerToBan, FText BanReason);
//********* Session Search Functions *************//
// Adds or modifies session settings in an existing array depending on if they exist already or not
@@ -38,16 +53,16 @@ public:
static void GetExtraSettings(FBlueprintSessionResult SessionResult, TArray<FSessionPropertyKeyPair> & ExtraSettings);
// Get the current session state
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo")
static void GetSessionState(EBPOnlineSessionState &SessionState);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (WorldContext = "WorldContextObject"))
static void GetSessionState(UObject* WorldContextObject, EBPOnlineSessionState &SessionState);
// Get the current session settings
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result"))
static void GetSessionSettings(int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, EBlueprintResultSwitch &Result);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result", WorldContext = "WorldContextObject"))
static void GetSessionSettings(UObject* WorldContextObject, int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, EBlueprintResultSwitch &Result);
// Check if someone is in the current session
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo")
static void IsPlayerInSession(const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (WorldContext = "WorldContextObject"))
static void IsPlayerInSession(UObject* WorldContextObject, const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession);
// Make a literal session search parameter
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals")
@@ -60,6 +75,14 @@ public:
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo")
static bool IsValidSession(const FBlueprintSessionResult & SessionResult);
// Get a string copy of a session ID
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo")
static void GetSessionID_AsString(const FBlueprintSessionResult & SessionResult, FString& SessionID);
// Get a string copy of the current session ID
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo", meta = (WorldContext = "WorldContextObject"))
static void GetCurrentSessionID_AsString(UObject* WorldContextObject, FString& SessionID);
// Get the Unique Current Build ID
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo")
static void GetCurrentUniqueBuildID(int32 &UniqueBuildId);
@@ -68,11 +91,31 @@ public:
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo")
static void GetUniqueBuildID(FBlueprintSessionResult SessionResult, int32 &UniqueBuildId);
// Thanks CriErr for submission
// Get session property Key Name value
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo")
static FName GetSessionPropertyKey(const FSessionPropertyKeyPair& SessionProperty);
// Find session property by Name
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result"))
static void FindSessionPropertyByName(const TArray<FSessionPropertyKeyPair>& ExtraSettings, FName SettingsName, EBlueprintResultSwitch &Result, FSessionPropertyKeyPair& OutProperty);
// Find session property index by Name
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "Result"))
static void FindSessionPropertyIndexByName(const TArray<FSessionPropertyKeyPair>& ExtraSettings, FName SettingName, EBlueprintResultSwitch &Result, int32& OutIndex);
/// Removed the Index_None part of the last function, that isn't accessible in blueprint, better to return success/failure
// End Thanks CriErr :p
// Get session custom information key/value as Byte (For Enums)
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult"))
static void GetSessionPropertyByte(const TArray<FSessionPropertyKeyPair> & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, uint8 &SettingValue);
// Get session custom information key/value as Bool
// Steam only currently supports Int,Float,String,BYTE values for search filtering!!!
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedSessions|SessionInfo", meta = (ExpandEnumAsExecs = "SearchResult"))
static void GetSessionPropertyBool(const TArray<FSessionPropertyKeyPair> & ExtraSettings, FName SettingName, ESessionSettingSearchResult &SearchResult, bool &SettingValue);
@@ -94,6 +137,7 @@ public:
static FSessionPropertyKeyPair MakeLiteralSessionPropertyByte(FName Key, uint8 Value);
// Make a literal session custom information key/value pair from Bool
// Steam only currently supports Int,Float,String,BYTE values for search filtering!
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|SessionInfo|Literals")
static FSessionPropertyKeyPair MakeLiteralSessionPropertyBool(FName Key, bool Value);
@@ -116,6 +160,10 @@ public:
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
static void GetUniqueNetID(APlayerController *PlayerController, FBPUniqueNetId &UniqueNetId);
// Get the unique net id of a network player attached to the given controller
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
static void GetUniqueNetIdOfSessionOwner(FBlueprintSessionResult SessionResult, FBPUniqueNetId& UniqueNetId);
// Get the unique net id of a network player who is assigned the the given player state
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
static void GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId);
@@ -128,6 +176,10 @@ public:
UFUNCTION(BlueprintPure, meta = (DisplayName = "Equal Unique Net ID", CompactNodeTitle = "==", Keywords = "== equal"), Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
static bool EqualEqual_UNetIDUnetID(const FBPUniqueNetId &A, const FBPUniqueNetId &B);
/** Converts a FBPUniqueNetID into a FUniqueNetID_Repl */
UFUNCTION(BlueprintPure, meta = (DisplayName = "ToUniqueNetIDRepl (Unique Net ID)", CompactNodeTitle = "->", BlueprintAutocast), Category = "Online|AdvancedSessions|PlayerInfo|PlayerID")
static FUniqueNetIdRepl Conv_BPUniqueIDToUniqueNetIDRepl(const FBPUniqueNetId& InUniqueID);
// Check if a UniqueNetId is a friend
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|UniqueNetId")
static void UniqueNetIdToString(const FBPUniqueNetId &UniqueNetId, FString &String);
@@ -156,5 +208,10 @@ public:
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|Misc")
static bool HasOnlineSubsystem(FName SubSystemName);
//**** Seamless travel Functions ****//
//Exposes Server travel to blueprint
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Online|AdvancedSessions|Seamless", meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject"))
static bool ServerTravel(UObject* WorldContextObject, const FString& InURL, bool bAbsolute, bool bShouldSkipGameNotify);
};

View File

@@ -6,7 +6,7 @@
#include "BlueprintDataDefinitions.h"
#include "Online.h"
#include "OnlineSubsystem.h"
#include "VoiceInterface.h"
#include "Interfaces/VoiceInterface.h"
//#include "OnlineFriendsInterface.h"
//#include "OnlineUserInterface.h"
//#include "OnlineMessageInterface.h"
@@ -14,7 +14,7 @@
#include "Engine/GameInstance.h"
//#include "OnlineSessionInterface.h"
#include "UObjectIterator.h"
#include "UObject/UObjectIterator.h"
#include "AdvancedVoiceLibrary.generated.h"
@@ -32,66 +32,68 @@ public:
//********* Voice Library Functions *************//
// Get if a headset is present for the specified local user
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo")
static void IsHeadsetPresent(bool & bHasHeadset, uint8 LocalPlayerNum = 0);
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo", meta = (WorldContext = "WorldContextObject"))
static void IsHeadsetPresent(UObject* WorldContextObject, bool & bHasHeadset, uint8 LocalPlayerNum = 0);
// Starts networked voice, allows push to talk in coordination with StopNetworkedVoice
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
static void StartNetworkedVoice(uint8 LocalPlayerNum = 0);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice", meta = (WorldContext = "WorldContextObject"))
static void StartNetworkedVoice(UObject* WorldContextObject, uint8 LocalPlayerNum = 0);
// Stops networked voice, allows push to talk in coordination with StartNetworkedVoice
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
static void StopNetworkedVoice(uint8 LocalPlayerNum = 0);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice", meta = (WorldContext = "WorldContextObject"))
static void StopNetworkedVoice(UObject* WorldContextObject, uint8 LocalPlayerNum = 0);
// Registers a local player as someone interested in voice data
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
static bool RegisterLocalTalker(uint8 LocalPlayerNum = 0);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice", meta = (WorldContext = "WorldContextObject"))
static bool RegisterLocalTalker(UObject* WorldContextObject, uint8 LocalPlayerNum = 0);
// Registers all signed in players as local talkers
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
static void RegisterAllLocalTalkers();
// This is already done automatically, only do it manually if you unregistered someone
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice", meta = (WorldContext = "WorldContextObject"))
static void RegisterAllLocalTalkers(UObject* WorldContextObject);
// UnRegisters local player as a local talker
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
static void UnRegisterLocalTalker(uint8 LocalPlayerNum = 0);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice", meta = (WorldContext = "WorldContextObject"))
static void UnRegisterLocalTalker(UObject* WorldContextObject, uint8 LocalPlayerNum = 0);
// UnRegisters all signed in players as local talkers
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
static void UnRegisterAllLocalTalkers();
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice", meta = (WorldContext = "WorldContextObject"))
static void UnRegisterAllLocalTalkers(UObject* WorldContextObject);
// Registers a remote player as a talker
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
static bool RegisterRemoteTalker(const FBPUniqueNetId& UniqueNetId);
// This is already done automatically, only do it manually if you unregistered someone
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice", meta = (WorldContext = "WorldContextObject"))
static bool RegisterRemoteTalker(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetId);
// UnRegisters a remote player as a talker
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
static bool UnRegisterRemoteTalker(const FBPUniqueNetId& UniqueNetId);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice", meta = (WorldContext = "WorldContextObject"))
static bool UnRegisterRemoteTalker(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetId);
// UnRegisters all remote players as talkers
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
static void RemoveAllRemoteTalkers();
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice", meta = (WorldContext = "WorldContextObject"))
static void RemoveAllRemoteTalkers(UObject* WorldContextObject);
// Returns whether a local player is currently talking
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo")
static bool IsLocalPlayerTalking(uint8 LocalPlayerNum);
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo", meta = (WorldContext = "WorldContextObject"))
static bool IsLocalPlayerTalking(UObject* WorldContextObject, uint8 LocalPlayerNum);
// Returns whether a remote player is currently talking
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo")
static bool IsRemotePlayerTalking(const FBPUniqueNetId& UniqueNetId);
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo", meta = (WorldContext = "WorldContextObject"))
static bool IsRemotePlayerTalking(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetId);
// Returns whether a player is muted for the specified local player
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo")
static bool IsPlayerMuted(uint8 LocalUserNumChecking, const FBPUniqueNetId& UniqueNetId);
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo", meta = (WorldContext = "WorldContextObject"))
static bool IsPlayerMuted(UObject* WorldContextObject, uint8 LocalUserNumChecking, const FBPUniqueNetId& UniqueNetId);
// Mutes the player associated with the uniquenetid for the specified local player, if IsSystemWide is true then it will attempt to mute globally for the player
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
static bool MuteRemoteTalker(uint8 LocalUserNum, const FBPUniqueNetId& UniqueNetId, bool bIsSystemWide = false);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice", meta = (WorldContext = "WorldContextObject"))
static bool MuteRemoteTalker(UObject* WorldContextObject, uint8 LocalUserNum, const FBPUniqueNetId& UniqueNetId, bool bIsSystemWide = false);
// UnMutes the player associated with the uniquenetid for the specified local player, if IsSystemWide is true then it will attempt to unmute globally for the player
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice")
static bool UnMuteRemoteTalker(uint8 LocalUserNum, const FBPUniqueNetId& UniqueNetId, bool bIsSystemWide = false);
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedVoice", meta = (WorldContext = "WorldContextObject"))
static bool UnMuteRemoteTalker(UObject* WorldContextObject, uint8 LocalUserNum, const FBPUniqueNetId& UniqueNetId, bool bIsSystemWide = false);
// Gets the number of local talkers for this system
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo")
static void GetNumLocalTalkers(int32 & NumLocalTalkers);
UFUNCTION(BlueprintPure, Category = "Online|AdvancedVoice|VoiceInfo", meta = (WorldContext = "WorldContextObject"))
static void GetNumLocalTalkers(UObject* WorldContextObject, int32 & NumLocalTalkers);
};

View File

@@ -0,0 +1,55 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "BlueprintDataDefinitions.h"
#include "Interfaces/OnlineIdentityInterface.h"
#include "Engine/LocalPlayer.h"
#include "AutoLoginUserCallbackProxy.generated.h"
UCLASS(MinimalAPI)
class UAutoLoginUserCallbackProxy : public UOnlineBlueprintCallProxyBase
{
GENERATED_UCLASS_BODY()
// Called when there is a successful destroy
UPROPERTY(BlueprintAssignable)
FEmptyOnlineDelegate OnSuccess;
// Called when there is an unsuccessful destroy
UPROPERTY(BlueprintAssignable)
FEmptyOnlineDelegate OnFailure;
/**
* Logs the player into the online service using parameters passed on the
* command line. Expects -AUTH_LOGIN=<UserName> -AUTH_PASSWORD=<password>. If either
* are missing, the function returns false and doesn't start the login
* process
*
* @param LocalUserNum the controller number of the associated user
*
*/
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedIdentity")
static UAutoLoginUserCallbackProxy* AutoLoginUser(UObject* WorldContextObject, int32 LocalUserNum);
// UOnlineBlueprintCallProxyBase interface
virtual void Activate() override;
// End of UOnlineBlueprintCallProxyBase interface
private:
// Internal callback when the operation completes, calls out to the public success/failure callbacks
void OnCompleted(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& ErrorVal);
private:
// The controller number of the associated user
int32 LocalUserNumber;
// The delegate executed by the online subsystem
FOnLoginCompleteDelegate Delegate;
// Handle to the registered OnDestroySessionComplete delegate
FDelegateHandle DelegateHandle;
// The world context object in which this call is taking place
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -1,17 +1,18 @@
#pragma once
#include "CoreMinimal.h"
#include "EngineMinimal.h"
//#include "EngineMinimal.h"
#include "Engine/Engine.h"
#include "GameFramework/PlayerState.h"
#include "Core.h"
#include "OnlineSessionInterface.h"
//#include "Core.h"
#include "Interfaces/OnlineSessionInterface.h"
#include "OnlineSessionSettings.h"
#include "OnlineDelegateMacros.h"
#include "OnlineSubsystem.h"
#include "OnlineSubsystemImpl.h"
#include "OnlineSubsystemUtils.h"
#include "OnlineSubsystemUtilsModule.h"
#include "ModuleManager.h"
#include "GameFramework/PlayerController.h"
#include "Modules/ModuleManager.h"
#include "OnlineSubsystemUtilsClasses.h"
#include "BlueprintDataDefinitions.generated.h"
@@ -199,6 +200,17 @@ public:
return nullptr;
}
// Adding in a compare operator so that std functions will work with this struct
FORCEINLINE bool operator==(const FBPUniqueNetId& Other) const
{
return (IsValid() && Other.IsValid() && (*GetUniqueNetId() == *Other.GetUniqueNetId()));
}
FORCEINLINE bool operator!=(const FBPUniqueNetId& Other) const
{
return !(IsValid() && Other.IsValid() && (*GetUniqueNetId() == *Other.GetUniqueNetId()));
}
FBPUniqueNetId()
{
bUseDirectPointer = false;
@@ -239,23 +251,31 @@ struct FBPFriendPresenceInfo
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
bool bIsOnline;
bool bIsOnline = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
bool bIsPlaying;
bool bIsPlaying = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
bool bIsPlayingThisGame;
bool bIsPlayingThisGame = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
bool bIsJoinable;
bool bIsJoinable = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
bool bHasVoiceSupport;
bool bHasVoiceSupport = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
EBPOnlinePresenceState PresenceState;
EBPOnlinePresenceState PresenceState = EBPOnlinePresenceState::Offline;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
FString StatusString;
FBPFriendPresenceInfo()
{
bIsOnline = false;
bIsPlaying = false;
bIsPlayingThisGame = false;
bIsJoinable = false;
bHasVoiceSupport = false;
PresenceState = EBPOnlinePresenceState::Offline;
}
};
USTRUCT(BlueprintType)
struct FBPFriendInfo
{
@@ -268,15 +288,22 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
FString RealName;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
EBPOnlinePresenceState OnlineState;
EBPOnlinePresenceState OnlineState = EBPOnlinePresenceState::Offline;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
FBPUniqueNetId UniqueNetId;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
bool bIsPlayingSameGame;
bool bIsPlayingSameGame = false;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Online|Friend")
FBPFriendPresenceInfo PresenceInfo;
FBPFriendInfo()
{
OnlineState = EBPOnlinePresenceState::Offline;
bIsPlayingSameGame = false;
}
};
/** The types of comparison operations for a given search query */
// Used to compare session properties
UENUM(BlueprintType)
@@ -339,7 +366,7 @@ public:
//return const_cast<FUniqueNetId*>(UniqueNetIdPtr);
if (APlayerState* PlayerState = (PlayerController != NULL) ? PlayerController->PlayerState : NULL)
{
UserID = PlayerState->UniqueId.GetUniqueNetId();
UserID = PlayerState->GetUniqueId().GetUniqueNetId();
if (!UserID.IsValid())
{
FFrame::KismetExecutionMessage(*FString::Printf(TEXT("%s - Cannot map local player to unique net ID"), FunctionContext), ELogVerbosity::Warning);

View File

@@ -1,7 +1,8 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "OnlineSessionInterface.h"
#include "Engine/Engine.h"
#include "Interfaces/OnlineSessionInterface.h"
#include "BlueprintDataDefinitions.h"
#include "CancelFindSessionsCallbackProxy.generated.h"
@@ -41,5 +42,5 @@ private:
FDelegateHandle DelegateHandle;
// The world context object in which this call is taking place
UObject* WorldContextObject;
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -2,6 +2,7 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/Engine.h"
#include "BlueprintDataDefinitions.h"
#include "CreateSessionCallbackProxyAdvanced.generated.h"
@@ -18,19 +19,28 @@ class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
UPROPERTY(BlueprintAssignable)
FEmptyOnlineDelegate OnFailure;
// Creates a session with the default online subsystem with advanced optional inputs, for dedicated servers leave UsePresence as false and set IsDedicatedServer to true. Dedicated servers don't use presence.
/**
* Creates a session with the default online subsystem with advanced optional inputs, for dedicated servers leave UsePresence as false and set IsDedicatedServer to true. Dedicated servers don't use presence.
* @param PublicConnections When doing a 'listen' server, this must be >=2 (ListenServer itself counts as a connection)
* @param bUseLAN When you want to play LAN, the level to play on must be loaded with option 'bIsLanMatch'
* @param bUseLobbiesIfAvailable Used to flag the subsystem to use a lobby api instead of general hosting if the API supports it, generally true on steam for listen servers and false for dedicated
* Must be true for a 'listen' server (Map must be loaded with option 'listen'), false for a 'dedicated' server.
* @param bShouldAdvertise Set to true when the OnlineSubsystem should list your server when someone is searching for servers. Otherwise the server is hidden and only join via invite is possible.
* @param bUseLobbiesVoiceChatIfAvailable Set to true to setup voice chat lobbies if the API supports it
* @param bStartAfterCreate Set to true to start the session after it's created. If false you need to manually call StartSession when ready.
*/
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject",AutoCreateRefTerm="ExtraSettings"), Category = "Online|AdvancedSessions")
static UCreateSessionCallbackProxyAdvanced* CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, class APlayerController* PlayerController = NULL, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = true, bool bIsDedicatedServer = false, bool bUsePresence = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true);
static UCreateSessionCallbackProxyAdvanced* CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair>& ExtraSettings, class APlayerController* PlayerController = NULL, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = true, bool bIsDedicatedServer = false, /*bool bUsePresence = true,*/ bool bUseLobbiesIfAvailable = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true, bool bUseLobbiesVoiceChatIfAvailable = false, bool bStartAfterCreate = true);
// UOnlineBlueprintCallProxyBase interface
virtual void Activate() override;
// End of UOnlineBlueprintCallProxyBase interface
private:
// Internal callback when session creation completes, calls StartSession
// Internal callback when session creation completes, optionally calls StartSession
void OnCreateCompleted(FName SessionName, bool bWasSuccessful);
// Internal callback when session creation completes, calls StartSession
// Internal callback when session start completes
void OnStartCompleted(FName SessionName, bool bWasSuccessful);
// The player controller triggering things
@@ -64,6 +74,9 @@ private:
// Whether to use the presence option
bool bUsePresence;
// Whether to prefer the use of lobbies for hosting if the api supports them
bool bUseLobbiesIfAvailable;
// Whether to allow joining via presence
bool bAllowJoinViaPresence;
@@ -79,10 +92,16 @@ private:
// Should advertise server?
bool bShouldAdvertise;
// Whether to prefer the use of voice chat lobbies if the api supports them
bool bUseLobbiesVoiceChatIfAvailable;
// Whether to start the session automatically after it is created
bool bStartAfterCreate;
// Store extra settings
TArray<FSessionPropertyKeyPair> ExtraSettings;
// The world context object in which this call is taking place
UObject* WorldContextObject;
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -1,7 +1,8 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "OnlineSessionInterface.h"
#include "Engine/Engine.h"
#include "Interfaces/OnlineSessionInterface.h"
#include "BlueprintDataDefinitions.h"
#include "EndSessionCallbackProxy.generated.h"
@@ -18,8 +19,11 @@ class UEndSessionCallbackProxy : public UOnlineBlueprintCallProxyBase
UPROPERTY(BlueprintAssignable)
FEmptyOnlineDelegate OnFailure;
// Ends the current session
UFUNCTION(BlueprintCallable, meta=(DeprecatedFunction,DeprecationMessage = "This function is deprecated, I realized that people have been using it wrong and it doesn't have much use in blueprints. Use Destroy Session only instead.",BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedSessions|Deprecated")
/**
* Ends the current sessions, Generally for almost all uses you should be using the engines native Destroy Session node instead.
* This exists for people using StartSession and optionally hand managing the session state.
*/
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedSessions")
static UEndSessionCallbackProxy* EndSession(UObject* WorldContextObject, class APlayerController* PlayerController);
// UOnlineBlueprintCallProxyBase interface
@@ -41,5 +45,5 @@ private:
FDelegateHandle DelegateHandle;
// The world context object in which this call is taking place
UObject* WorldContextObject;
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -46,6 +46,6 @@ private:
FDelegateHandle FindFriendSessionCompleteDelegateHandle;
// The world context object in which this call is taking place
UObject* WorldContextObject;
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -1,11 +1,18 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "OnlineSessionInterface.h"
#include "Engine/Engine.h"
#include "Interfaces/OnlineSessionInterface.h"
#include "FindSessionsCallbackProxy.h"
#include "BlueprintDataDefinitions.h"
#include "FindSessionsCallbackProxyAdvanced.generated.h"
FORCEINLINE bool operator==(const FBlueprintSessionResult& A, const FBlueprintSessionResult& B)
{
return (A.OnlineResult.IsValid() == B.OnlineResult.IsValid() && (A.OnlineResult.GetSessionIdStr() == B.OnlineResult.GetSessionIdStr()));
}
UCLASS(MinimalAPI)
class UFindSessionsCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
{
@@ -21,7 +28,7 @@ class UFindSessionsCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
// Searches for advertised sessions with the default online subsystem and includes an array of filters
UFUNCTION(BlueprintCallable, meta = (BlueprintInternalUseOnly = "true", WorldContext = "WorldContextObject", AutoCreateRefTerm="Filters"), Category = "Online|AdvancedSessions")
static UFindSessionsCallbackProxyAdvanced* FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int32 MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly = false, bool bNonEmptyServersOnly = false, bool bSecureServersOnly = false, int MinSlotsAvailable = 0);
static UFindSessionsCallbackProxyAdvanced* FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int32 MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly = false, bool bNonEmptyServersOnly = false, bool bSecureServersOnly = false, /*bool bSearchLobbies = true,*/ int MinSlotsAvailable = 0);
static bool CompareVariants(const FVariantData &A, const FVariantData &B, EOnlineComparisonOpRedux Comparator);
@@ -91,9 +98,12 @@ private:
// Search for secure servers only
bool bSecureServersOnly;
// Search through lobbies
//bool bSearchLobbies;
// Min slots requires to search
int MinSlotsAvailable;
// The world context object in which this call is taking place
UObject* WorldContextObject;
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -44,6 +44,6 @@ private:
//EBPFriendsLists FriendListToGet;
// The world context object in which this call is taking place
UObject* WorldContextObject;
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -44,6 +44,6 @@ private:
FOnQueryRecentPlayersCompleteDelegate QueryRecentPlayersCompleteDelegate;
// The world context object in which this call is taking place
UObject* WorldContextObject;
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -3,7 +3,7 @@
#include "CoreMinimal.h"
#include "BlueprintDataDefinitions.h"
#include "OnlineIdentityInterface.h"
#include "Interfaces/OnlineIdentityInterface.h"
#include "GetUserPrivilegeCallbackProxy.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FBlueprintGetUserPrivilegeDelegate,/* const &FBPUniqueNetId, PlayerID,*/ EBPUserPrivileges, QueriedPrivilege, bool, HadPrivilege);
@@ -21,7 +21,7 @@ class UGetUserPrivilegeCallbackProxy : public UOnlineBlueprintCallProxyBase
UPROPERTY(BlueprintAssignable)
FEmptyOnlineDelegate OnFailure;
// Logs out of the identity interface
// Gets the privilage of the user
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedIdentity")
static UGetUserPrivilegeCallbackProxy* GetUserPrivilege(UObject* WorldContextObject, const EBPUserPrivileges & PrivilegeToCheck, const FBPUniqueNetId & PlayerUniqueNetID);
@@ -41,5 +41,5 @@ private:
EBPUserPrivileges UserPrivilege;
// The world context object in which this call is taking place
UObject* WorldContextObject;
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -3,7 +3,7 @@
#include "CoreMinimal.h"
#include "BlueprintDataDefinitions.h"
#include "OnlineIdentityInterface.h"
#include "Interfaces/OnlineIdentityInterface.h"
#include "Engine/LocalPlayer.h"
#include "LoginUserCallbackProxy.generated.h"
@@ -20,9 +20,9 @@ class ULoginUserCallbackProxy : public UOnlineBlueprintCallProxyBase
UPROPERTY(BlueprintAssignable)
FEmptyOnlineDelegate OnFailure;
// Logs out of the identity interface
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|AdvancedIdentity")
static ULoginUserCallbackProxy* LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken);
// Logs into the identity interface
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject", AdvancedDisplay = "AuthType"), Category = "Online|AdvancedIdentity")
static ULoginUserCallbackProxy* LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken, FString AuthType);
// UOnlineBlueprintCallProxyBase interface
virtual void Activate() override;
@@ -42,6 +42,8 @@ private:
// The user pass / token
FString UserToken;
FString AuthType;
// The delegate executed by the online subsystem
FOnLoginCompleteDelegate Delegate;
@@ -49,5 +51,5 @@ private:
FDelegateHandle DelegateHandle;
// The world context object in which this call is taking place
UObject* WorldContextObject;
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -3,7 +3,7 @@
#include "CoreMinimal.h"
#include "BlueprintDataDefinitions.h"
#include "OnlineIdentityInterface.h"
#include "Interfaces/OnlineIdentityInterface.h"
#include "Engine/LocalPlayer.h"
#include "LogoutUserCallbackProxy.generated.h"
@@ -43,5 +43,5 @@ private:
FDelegateHandle DelegateHandle;
// The world context object in which this call is taking place
UObject* WorldContextObject;
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -44,6 +44,6 @@ private:
FOnSendInviteComplete OnSendInviteCompleteDelegate;
// The world context object in which this call is taking place
UObject* WorldContextObject;
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -0,0 +1,46 @@
#pragma once
#include "CoreMinimal.h"
#include "BlueprintDataDefinitions.h"
#include "StartSessionCallbackProxyAdvanced.generated.h"
UCLASS(MinimalAPI)
class UStartSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
{
GENERATED_UCLASS_BODY()
// Called when the session starts successfully
UPROPERTY(BlueprintAssignable)
FEmptyOnlineDelegate OnSuccess;
// Called when there is an error starting the session
UPROPERTY(BlueprintAssignable)
FEmptyOnlineDelegate OnFailure;
/**
* Starts a session with the default online subsystem. The session needs to be previously created by calling the "CreateAdvancedSession" node.
* @param WorldContextObject
*/
UFUNCTION(
BlueprintCallable
, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject")
, Category = "Online|AdvancedSessions"
)
static UStartSessionCallbackProxyAdvanced* StartAdvancedSession(UObject* WorldContextObject);
// UOnlineBlueprintCallProxyBase interface
virtual void Activate() override;
// End of UOnlineBlueprintCallProxyBase interface
private:
// Internal callback when session start completes
void OnStartCompleted(FName SessionName, bool bWasSuccessful);
// The delegate executed by the online subsystem
FOnStartSessionCompleteDelegate StartCompleteDelegate;
// Handles to the registered delegates above
FDelegateHandle StartCompleteDelegateHandle;
// The world context object in which this call is taking place
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -2,6 +2,7 @@
#pragma once
#include "CoreMinimal.h"
#include "Engine/Engine.h"
#include "BlueprintDataDefinitions.h"
#include "UpdateSessionCallbackProxyAdvanced.generated.h"
@@ -20,7 +21,7 @@ class UUpdateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
// Creates a session with the default online subsystem with advanced optional inputs, you MUST fill in all categories or it will pass in values that you didn't want as default values
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject",AutoCreateRefTerm="ExtraSettings"), Category = "Online|AdvancedSessions")
static UUpdateSessionCallbackProxyAdvanced* UpdateSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = false, bool bAllowJoinInProgress = false, bool bRefreshOnlineData = true, bool bIsDedicatedServer = false);
static UUpdateSessionCallbackProxyAdvanced* UpdateSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, int32 PublicConnections = 100, int32 PrivateConnections = 0, bool bUseLAN = false, bool bAllowInvites = false, bool bAllowJoinInProgress = false, bool bRefreshOnlineData = true, bool bIsDedicatedServer = false, bool bShouldAdvertise = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false);
// UOnlineBlueprintCallProxyBase interface
virtual void Activate() override;
@@ -37,30 +38,38 @@ private:
FDelegateHandle OnUpdateSessionCompleteDelegateHandle;
// Number of public connections
int NumPublicConnections;
int NumPublicConnections = 100;
// Number of private connections
int NumPrivateConnections;
int NumPrivateConnections = 0;
// Whether or not to search LAN
bool bUseLAN;
bool bUseLAN = false;
// Whether or not to allow invites
bool bAllowInvites;
bool bAllowInvites = true;
// Store extra settings
TArray<FSessionPropertyKeyPair> ExtraSettings;
// Whether to update the online data
bool bRefreshOnlineData;
bool bRefreshOnlineData = true;
// Allow joining in progress
bool bAllowJoinInProgress;
bool bAllowJoinInProgress = true;
// Allow joining in progress
bool bAllowJoinViaPresence = true;
// Allow joining in progress
bool bAllowJoinViaPresenceFriendsOnly = false;
// Update whether this is a dedicated server or not
bool bDedicatedServer;
bool bDedicatedServer = false;
bool bShouldAdvertise = true;
// The world context object in which this call is taking place
UObject* WorldContextObject;
TWeakObjectPtr<UObject> WorldContextObject;
};

View File

@@ -6,9 +6,17 @@
//General Log
DEFINE_LOG_CATEGORY(AdvancedExternalUILog);
void UAdvancedExternalUILibrary::ShowAccountUpgradeUI(const FBPUniqueNetId PlayerRequestingAccountUpgradeUI, EBlueprintResultSwitch &Result)
void UAdvancedExternalUILibrary::ShowAccountUpgradeUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerRequestingAccountUpgradeUI, EBlueprintResultSwitch &Result)
{
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid())
{
@@ -21,10 +29,17 @@ void UAdvancedExternalUILibrary::ShowAccountUpgradeUI(const FBPUniqueNetId Playe
Result = EBlueprintResultSwitch::OnSuccess;
}
void UAdvancedExternalUILibrary::ShowProfileUI(const FBPUniqueNetId PlayerViewingProfile, const FBPUniqueNetId PlayerToViewProfileOf, EBlueprintResultSwitch &Result)
void UAdvancedExternalUILibrary::ShowProfileUI(UObject* WorldContextObject, const FBPUniqueNetId PlayerViewingProfile, const FBPUniqueNetId PlayerToViewProfileOf, EBlueprintResultSwitch &Result)
{
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid())
{
@@ -39,9 +54,16 @@ void UAdvancedExternalUILibrary::ShowProfileUI(const FBPUniqueNetId PlayerViewin
void UAdvancedExternalUILibrary::ShowWebURLUI(FString URLToShow, EBlueprintResultSwitch &Result, TArray<FString>& AllowedDomains, bool bEmbedded, bool bShowBackground, bool bShowCloseButton, int32 OffsetX, int32 OffsetY, int32 SizeX, int32 SizeY)
void UAdvancedExternalUILibrary::ShowWebURLUI(UObject* WorldContextObject, FString URLToShow, EBlueprintResultSwitch &Result, TArray<FString>& AllowedDomains, bool bEmbedded, bool bShowBackground, bool bShowCloseButton, int32 OffsetX, int32 OffsetY, int32 SizeX, int32 SizeY)
{
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid())
{
@@ -67,9 +89,15 @@ void UAdvancedExternalUILibrary::ShowWebURLUI(FString URLToShow, EBlueprintResul
Result = EBlueprintResultSwitch::OnSuccess;
}
void UAdvancedExternalUILibrary::CloseWebURLUI()
void UAdvancedExternalUILibrary::CloseWebURLUI(UObject* WorldContextObject)
{
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid())
{
@@ -80,9 +108,16 @@ void UAdvancedExternalUILibrary::CloseWebURLUI()
ExternalUIInterface->CloseWebURL();
}
void UAdvancedExternalUILibrary::ShowLeaderBoardUI(FString LeaderboardName, EBlueprintResultSwitch &Result)
void UAdvancedExternalUILibrary::ShowLeaderBoardUI(UObject* WorldContextObject, FString LeaderboardName, EBlueprintResultSwitch &Result)
{
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid())
{
@@ -97,7 +132,7 @@ void UAdvancedExternalUILibrary::ShowLeaderBoardUI(FString LeaderboardName, EBlu
}
void UAdvancedExternalUILibrary::ShowInviteUI(APlayerController *PlayerController, EBlueprintResultSwitch &Result)
void UAdvancedExternalUILibrary::ShowInviteUI(UObject* WorldContextObject, APlayerController *PlayerController, EBlueprintResultSwitch &Result)
{
if (!PlayerController)
{
@@ -106,7 +141,14 @@ void UAdvancedExternalUILibrary::ShowInviteUI(APlayerController *PlayerControlle
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid())
{
@@ -124,11 +166,11 @@ void UAdvancedExternalUILibrary::ShowInviteUI(APlayerController *PlayerControlle
return;
}
ExternalUIInterface->ShowInviteUI(Player->GetControllerId(), GameSessionName);
ExternalUIInterface->ShowInviteUI(Player->GetControllerId(), NAME_GameSession);
Result = EBlueprintResultSwitch::OnSuccess;
}
void UAdvancedExternalUILibrary::ShowFriendsUI(APlayerController *PlayerController, EBlueprintResultSwitch &Result)
void UAdvancedExternalUILibrary::ShowFriendsUI(UObject* WorldContextObject, APlayerController *PlayerController, EBlueprintResultSwitch &Result)
{
if (!PlayerController)
{
@@ -137,7 +179,14 @@ void UAdvancedExternalUILibrary::ShowFriendsUI(APlayerController *PlayerControll
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineExternalUIPtr ExternalUIInterface = Online::GetExternalUIInterface(World);
if (!ExternalUIInterface.IsValid())
{

View File

@@ -1,5 +1,7 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "AdvancedFriendsGameInstance.h"
#include "Kismet/GameplayStatics.h"
#include "GameFramework/PlayerController.h"
//General Log
DEFINE_LOG_CATEGORY(AdvancedFriendsInterfaceLog);
@@ -18,9 +20,58 @@ UAdvancedFriendsGameInstance::UAdvancedFriendsGameInstance(const FObjectInitiali
{
}
void UAdvancedFriendsGameInstance::OnSessionUserInviteAccepted(const bool bWasSuccessful, const int32 ControllerId, FUniqueNetIdPtr UserId, const FOnlineSessionSearchResult& InviteResult)
{
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());
if (SessionInterface.IsValid())
{
SessionInterface->ClearOnJoinSessionCompleteDelegate_Handle(OnJoinSessionCompleteDelegateHandle);
OnJoinSessionCompleteDelegateHandle = SessionInterface->AddOnJoinSessionCompleteDelegate_Handle(
FOnJoinSessionCompleteDelegate::CreateUObject(this, &UAdvancedFriendsGameInstance::OnJoinSessionComplete));
// Temp for 5.5, they aren't filling in the struct correctly
if (!InviteResult.Session.SessionSettings.bIsDedicated)
{
FOnlineSessionSearchResult ModResult = InviteResult;
ModResult.Session.SessionSettings.bUsesPresence = true;
ModResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
SessionInterface->JoinSession(0, NAME_GameSession, ModResult);
}
else
{
SessionInterface->JoinSession(0, NAME_GameSession, InviteResult);
}
}
UE_LOG(AdvancedFriendsInterfaceLog, Log, TEXT("Called Join Session for Steam Friends List UI InviteResults: %s, UserId: %s"), *InviteResult.GetSessionIdStr(), *UserId->ToString());
}
void UAdvancedFriendsGameInstance::OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result)
{
// If we don't want to auto travel to the session instance then exit out
if (!bAutoTravelOnAcceptedUserInviteReceived)
{
return;
}
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());
if (SessionInterface.IsValid())
{
FString ConnectInfo;
if (SessionInterface->GetResolvedConnectString(NAME_GameSession, ConnectInfo))
{
APlayerController* PlayerController = GetFirstLocalPlayerController();
if (PlayerController)
{
PlayerController->ClientTravel(ConnectInfo, ETravelType::TRAVEL_Absolute);
}
}
}
}
void UAdvancedFriendsGameInstance::Shutdown()
{
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface();
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());
if (!SessionInterface.IsValid())
{
@@ -32,12 +83,13 @@ void UAdvancedFriendsGameInstance::Shutdown()
// Clear all of the delegate handles here
SessionInterface->ClearOnSessionUserInviteAcceptedDelegate_Handle(SessionInviteAcceptedDelegateHandle);
SessionInterface->ClearOnSessionInviteReceivedDelegate_Handle(SessionInviteReceivedDelegateHandle);
SessionInterface->ClearOnJoinSessionCompleteDelegate_Handle(OnJoinSessionCompleteDelegateHandle);
}
if (bEnableTalkingStatusDelegate)
{
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(GetWorld());
if (VoiceInterface.IsValid())
{
@@ -50,7 +102,7 @@ void UAdvancedFriendsGameInstance::Shutdown()
}
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(GetWorld());
if (IdentityInterface.IsValid())
{
@@ -67,7 +119,7 @@ void UAdvancedFriendsGameInstance::Shutdown()
void UAdvancedFriendsGameInstance::Init()
{
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface();//OnlineSub->GetSessionInterface();
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(GetWorld());//OnlineSub->GetSessionInterface();
if (SessionInterface.IsValid())
{
@@ -78,6 +130,9 @@ void UAdvancedFriendsGameInstance::Init()
SessionInviteAcceptedDelegateHandle = SessionInterface->AddOnSessionUserInviteAcceptedDelegate_Handle(SessionInviteAcceptedDelegate);
SessionInviteReceivedDelegateHandle = SessionInterface->AddOnSessionInviteReceivedDelegate_Handle(SessionInviteReceivedDelegate);
// Custom steam join game delegate
SessionInterface->OnSessionUserInviteAcceptedDelegates.AddUObject(this, &UAdvancedFriendsGameInstance::OnSessionUserInviteAccepted);
}
else
{
@@ -88,7 +143,7 @@ void UAdvancedFriendsGameInstance::Init()
// Beginning work on the voice interface
if (bEnableTalkingStatusDelegate)
{
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(GetWorld());
if (VoiceInterface.IsValid())
{
@@ -101,7 +156,7 @@ void UAdvancedFriendsGameInstance::Init()
}
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(GetWorld());
if (IdentityInterface.IsValid())
{
@@ -261,7 +316,7 @@ void UAdvancedFriendsGameInstance::OnSessionInviteReceivedMaster(const FUniqueNe
int32 LocalPlayer = 0;
for (int i = 0; i < PlayerList.Num(); i++)
{
if (*PlayerList[i]->PlayerState->UniqueId.GetUniqueNetId() == PersonInvited)
if (*PlayerList[i]->PlayerState->GetUniqueId().GetUniqueNetId() == PersonInvited)
{
LocalPlayer = i;
Player = PlayerList[i];
@@ -269,6 +324,13 @@ void UAdvancedFriendsGameInstance::OnSessionInviteReceivedMaster(const FUniqueNe
}
}
// Temp for 5.5, they aren't filling in the struct correctly
if (!BluePrintResult.OnlineResult.Session.SessionSettings.bIsDedicated)
{
BluePrintResult.OnlineResult.Session.SessionSettings.bUsesPresence = true;
BluePrintResult.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
}
OnSessionInviteReceived(LocalPlayer, PInviting, AppId, BluePrintResult);
//IAdvancedFriendsInterface* TheInterface = NULL;
@@ -305,6 +367,13 @@ void UAdvancedFriendsGameInstance::OnSessionInviteAcceptedMaster(const bool bWas
FBPUniqueNetId PInvited;
PInvited.SetUniqueNetId(PersonInvited);
// Temp for 5.5, they aren't filling in the struct correctly
if (!BluePrintResult.OnlineResult.Session.SessionSettings.bIsDedicated)
{
BluePrintResult.OnlineResult.Session.SessionSettings.bUsesPresence = true;
BluePrintResult.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
}
OnSessionInviteAccepted(LocalPlayer,PInvited, BluePrintResult);
APlayerController* Player = UGameplayStatics::GetPlayerController(GetWorld(), LocalPlayer);

View File

@@ -50,7 +50,7 @@ void UAdvancedFriendsLibrary::SendSessionInviteToFriends(APlayerController *Play
List.Add(val);
}
if (SessionInterface->SendSessionInviteToFriends(Player->GetControllerId(), GameSessionName, List))
if (SessionInterface->SendSessionInviteToFriends(Player->GetControllerId(), NAME_GameSession, List))
{
Result = EBlueprintResultSwitch::OnSuccess;
return;
@@ -94,7 +94,7 @@ void UAdvancedFriendsLibrary::SendSessionInviteToFriend(APlayerController *Playe
return;
}
if (SessionInterface->SendSessionInviteToFriend(Player->GetControllerId(), GameSessionName, *FriendUniqueNetId.GetUniqueNetId()))
if (SessionInterface->SendSessionInviteToFriend(Player->GetControllerId(), NAME_GameSession, *FriendUniqueNetId.GetUniqueNetId()))
{
Result = EBlueprintResultSwitch::OnSuccess;
return;
@@ -138,7 +138,7 @@ void UAdvancedFriendsLibrary::GetFriend(APlayerController *PlayerController, con
TSharedPtr<FOnlineFriend> fr = FriendsInterface->GetFriend(Player->GetControllerId(), *FriendUniqueNetId.GetUniqueNetId(), EFriendsLists::ToString(EFriendsLists::Default));
if (fr.IsValid())
{
FOnlineUserPresence pres = fr->GetPresence();
const FOnlineUserPresence& pres = fr->GetPresence();
Friend.DisplayName = fr->GetDisplayName();
Friend.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
Friend.RealName = fr->GetRealName();
@@ -151,7 +151,10 @@ void UAdvancedFriendsLibrary::GetFriend(APlayerController *PlayerController, con
Friend.PresenceInfo.bIsPlaying = pres.bIsPlaying;
Friend.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame;
Friend.PresenceInfo.PresenceState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
Friend.PresenceInfo.StatusString = pres.Status.StatusStr;
// #TODO: Check back in on this in shipping, epic is missing the UTF8_TO_TCHAR call on converting this and its making an invalid string
// OnlineFriendPresenceInterfaceSteam has the issue
//Friend.PresenceInfo.StatusString = pres.Status.StatusStr;
}
}
@@ -247,28 +250,35 @@ void UAdvancedFriendsLibrary::GetStoredFriendsList(APlayerController *PlayerCont
TArray< TSharedRef<FOnlineFriend> > FriendList;
FriendsInterface->GetFriendsList(Player->GetControllerId(), EFriendsLists::ToString((EFriendsLists::Default)), FriendList);
for (int32 i = 0; i < FriendList.Num(); i++)
if (FriendsInterface->GetFriendsList(Player->GetControllerId(), EFriendsLists::ToString((EFriendsLists::Default)), FriendList))
{
TSharedRef<FOnlineFriend> Friend = FriendList[i];
FBPFriendInfo BPF;
FOnlineUserPresence pres = Friend->GetPresence();
for (int32 i = 0; i < FriendList.Num(); i++)
{
FBPFriendInfo BPF;
const FOnlineUserPresence& pres = FriendList[i]->GetPresence();
BPF.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
BPF.DisplayName = Friend->GetDisplayName();
BPF.RealName = Friend->GetRealName();
BPF.UniqueNetId.SetUniqueNetId(Friend->GetUserId());
BPF.bIsPlayingSameGame = pres.bIsPlayingThisGame;
BPF.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
BPF.DisplayName = FriendList[i]->GetDisplayName();
BPF.RealName = FriendList[i]->GetRealName();
BPF.UniqueNetId.SetUniqueNetId(FriendList[i]->GetUserId());
BPF.bIsPlayingSameGame = pres.bIsPlayingThisGame;
BPF.PresenceInfo.bIsOnline = pres.bIsOnline;
BPF.PresenceInfo.bHasVoiceSupport = pres.bHasVoiceSupport;
BPF.PresenceInfo.bIsPlaying = pres.bIsPlaying;
BPF.PresenceInfo.PresenceState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
BPF.PresenceInfo.StatusString = pres.Status.StatusStr;
BPF.PresenceInfo.bIsJoinable = pres.bIsJoinable;
BPF.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame;
BPF.PresenceInfo.bIsOnline = pres.bIsOnline;
BPF.PresenceInfo.bHasVoiceSupport = pres.bHasVoiceSupport;
BPF.PresenceInfo.bIsPlaying = pres.bIsPlaying;
BPF.PresenceInfo.PresenceState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
// #TODO: Check back in on this in shipping, epic is missing the UTF8_TO_TCHAR call on converting this and its making an invalid string
// OnlineFriendPresenceInterfaceSteam has the issue
//BPF.PresenceInfo.StatusString = pres.Status.StatusStr;
BPF.PresenceInfo.bIsJoinable = pres.bIsJoinable;
BPF.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame;
FriendsList.Add(BPF);
FriendsList.Add(BPF);
}
return;
}
UE_LOG(AdvancedFriendsLog, Warning, TEXT("GetFriendsList Failed to get any friends!"));
return;
}

View File

@@ -5,7 +5,7 @@
DEFINE_LOG_CATEGORY(AdvancedIdentityLog);
void UAdvancedIdentityLibrary::GetPlayerAuthToken(APlayerController * PlayerController, FString & AuthToken, EBlueprintResultSwitch &Result)
void UAdvancedIdentityLibrary::GetPlayerAuthToken(UObject* WorldContextObject, APlayerController * PlayerController, FString & AuthToken, EBlueprintResultSwitch &Result)
{
if (!PlayerController)
{
@@ -23,7 +23,14 @@ void UAdvancedIdentityLibrary::GetPlayerAuthToken(APlayerController * PlayerCont
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(World);
if (!IdentityInterface.IsValid())
{
@@ -36,7 +43,7 @@ void UAdvancedIdentityLibrary::GetPlayerAuthToken(APlayerController * PlayerCont
Result = EBlueprintResultSwitch::OnSuccess;
}
void UAdvancedIdentityLibrary::GetPlayerNickname(const FBPUniqueNetId & UniqueNetID, FString & PlayerNickname)
void UAdvancedIdentityLibrary::GetPlayerNickname(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetID, FString & PlayerNickname)
{
if (!UniqueNetID.IsValid())
{
@@ -44,7 +51,13 @@ void UAdvancedIdentityLibrary::GetPlayerNickname(const FBPUniqueNetId & UniqueNe
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(World);
if (!IdentityInterface.IsValid())
{
@@ -55,7 +68,7 @@ void UAdvancedIdentityLibrary::GetPlayerNickname(const FBPUniqueNetId & UniqueNe
}
void UAdvancedIdentityLibrary::GetLoginStatus(const FBPUniqueNetId & UniqueNetID, EBPLoginStatus & LoginStatus, EBlueprintResultSwitch &Result)
void UAdvancedIdentityLibrary::GetLoginStatus(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetID, EBPLoginStatus & LoginStatus, EBlueprintResultSwitch &Result)
{
if (!UniqueNetID.IsValid())
{
@@ -64,7 +77,14 @@ void UAdvancedIdentityLibrary::GetLoginStatus(const FBPUniqueNetId & UniqueNetID
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(World);
if (!IdentityInterface.IsValid())
{
@@ -78,9 +98,17 @@ void UAdvancedIdentityLibrary::GetLoginStatus(const FBPUniqueNetId & UniqueNetID
}
void UAdvancedIdentityLibrary::GetAllUserAccounts(TArray<FBPUserOnlineAccount> & AccountInfos, EBlueprintResultSwitch &Result)
void UAdvancedIdentityLibrary::GetAllUserAccounts(UObject* WorldContextObject, TArray<FBPUserOnlineAccount> & AccountInfos, EBlueprintResultSwitch &Result)
{
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(World);
if (!IdentityInterface.IsValid())
{
@@ -99,9 +127,17 @@ void UAdvancedIdentityLibrary::GetAllUserAccounts(TArray<FBPUserOnlineAccount> &
Result = EBlueprintResultSwitch::OnSuccess;
}
void UAdvancedIdentityLibrary::GetUserAccount(const FBPUniqueNetId & UniqueNetId, FBPUserOnlineAccount & AccountInfo, EBlueprintResultSwitch &Result)
void UAdvancedIdentityLibrary::GetUserAccount(UObject* WorldContextObject, const FBPUniqueNetId & UniqueNetId, FBPUserOnlineAccount & AccountInfo, EBlueprintResultSwitch &Result)
{
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
Result = EBlueprintResultSwitch::OnFailure;
return;
}
IOnlineIdentityPtr IdentityInterface = Online::GetIdentityInterface(World);
if(!UniqueNetId.IsValid())
{

View File

@@ -1,17 +1,93 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "AdvancedSessionsLibrary.h"
#include "GameFramework/PlayerState.h"
#include "GameFramework/GameStateBase.h"
//General Log
DEFINE_LOG_CATEGORY(AdvancedSessionsLog);
bool UAdvancedSessionsLibrary::KickPlayer(UObject* WorldContextObject, APlayerController* PlayerToKick, FText KickReason)
{
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (World)
{
if (AGameModeBase* GameMode = World->GetAuthGameMode())
{
if (GameMode->GameSession)
{
return GameMode->GameSession->KickPlayer(PlayerToKick, KickReason);
}
}
}
return false;
}
bool UAdvancedSessionsLibrary::BanPlayer(UObject* WorldContextObject, APlayerController* PlayerToBan, FText BanReason)
{
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (World)
{
if (AGameModeBase* GameMode = World->GetAuthGameMode())
{
if (GameMode->GameSession)
{
return GameMode->GameSession->BanPlayer(PlayerToBan, BanReason);
}
}
}
return false;
}
bool UAdvancedSessionsLibrary::IsValidSession(const FBlueprintSessionResult & SessionResult)
{
return SessionResult.OnlineResult.IsValid();
}
void UAdvancedSessionsLibrary::GetSessionID_AsString(const FBlueprintSessionResult & SessionResult, FString& SessionID)
{
const TSharedPtr<class FOnlineSessionInfo> SessionInfo = SessionResult.OnlineResult.Session.SessionInfo;
if (SessionInfo.IsValid() && SessionInfo->IsValid() && SessionInfo->GetSessionId().IsValid())
{
SessionID = SessionInfo->GetSessionId().ToString();
return;
}
// Zero the string out if we didn't have a valid one, in case this is called in c++
SessionID.Empty();
}
void UAdvancedSessionsLibrary::GetCurrentSessionID_AsString(UObject* WorldContextObject, FString& SessionID)
{
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World);
if (!SessionInterface.IsValid())
{
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetCurrentSessionID_AsString couldn't get the session interface!"));
SessionID.Empty();
return;
}
const FNamedOnlineSession* Session = SessionInterface->GetNamedSession(NAME_GameSession);
if (Session != nullptr)
{
const TSharedPtr<class FOnlineSessionInfo> SessionInfo = Session->SessionInfo;
if (SessionInfo.IsValid() && SessionInfo->IsValid() && SessionInfo->GetSessionId().IsValid())
{
SessionID = SessionInfo->GetSessionId().ToString();
return;
}
}
// Zero the string out if we didn't have a valid one, in case this is called in c++
SessionID.Empty();
}
void UAdvancedSessionsLibrary::GetCurrentUniqueBuildID(int32 &UniqueBuildId)
{
UniqueBuildId = GetBuildUniqueId();
@@ -22,6 +98,31 @@ void UAdvancedSessionsLibrary::GetUniqueBuildID(FBlueprintSessionResult SessionR
UniqueBuildId = SessionResult.OnlineResult.Session.SessionSettings.BuildUniqueId;
}
FName UAdvancedSessionsLibrary::GetSessionPropertyKey(const FSessionPropertyKeyPair& SessionProperty)
{
return SessionProperty.Key;
}
void UAdvancedSessionsLibrary::FindSessionPropertyByName(const TArray<FSessionPropertyKeyPair>& ExtraSettings, FName SettingName, EBlueprintResultSwitch &Result, FSessionPropertyKeyPair& OutProperty)
{
const FSessionPropertyKeyPair* prop = ExtraSettings.FindByPredicate([&](const FSessionPropertyKeyPair& it) {return it.Key == SettingName; });
if (prop)
{
Result = EBlueprintResultSwitch::OnSuccess;
OutProperty = *prop;
return;
}
Result = EBlueprintResultSwitch::OnFailure;
}
void UAdvancedSessionsLibrary::FindSessionPropertyIndexByName(const TArray<FSessionPropertyKeyPair>& ExtraSettings, FName SettingName, EBlueprintResultSwitch &Result, int32& OutIndex)
{
OutIndex = ExtraSettings.IndexOfByPredicate([&](const FSessionPropertyKeyPair& it) {return it.Key == SettingName; });
Result = OutIndex != INDEX_NONE ? EBlueprintResultSwitch::OnSuccess : EBlueprintResultSwitch::OnFailure;
}
void UAdvancedSessionsLibrary::AddOrModifyExtraSettings(UPARAM(ref) TArray<FSessionPropertyKeyPair> & SettingsArray, UPARAM(ref) TArray<FSessionPropertyKeyPair> & NewOrChangedSettings, TArray<FSessionPropertyKeyPair> & ModifiedSettingsArray)
{
ModifiedSettingsArray = SettingsArray;
@@ -62,9 +163,10 @@ void UAdvancedSessionsLibrary::GetExtraSettings(FBlueprintSessionResult SessionR
}
}
void UAdvancedSessionsLibrary::GetSessionState(EBPOnlineSessionState &SessionState)
void UAdvancedSessionsLibrary::GetSessionState(UObject* WorldContextObject, EBPOnlineSessionState &SessionState)
{
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World);
if (!SessionInterface.IsValid())
{
@@ -72,12 +174,13 @@ void UAdvancedSessionsLibrary::GetSessionState(EBPOnlineSessionState &SessionSta
return;
}
SessionState = ((EBPOnlineSessionState)SessionInterface->GetSessionState(GameSessionName));
SessionState = ((EBPOnlineSessionState)SessionInterface->GetSessionState(NAME_GameSession));
}
void UAdvancedSessionsLibrary::GetSessionSettings(int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, EBlueprintResultSwitch &Result)
void UAdvancedSessionsLibrary::GetSessionSettings(UObject* WorldContextObject, int32 &NumConnections, int32 &NumPrivateConnections, bool &bIsLAN, bool &bIsDedicated, bool &bAllowInvites, bool &bAllowJoinInProgress, bool &bIsAnticheatEnabled, int32 &BuildUniqueID, TArray<FSessionPropertyKeyPair> &ExtraSettings, EBlueprintResultSwitch &Result)
{
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World);
if (!SessionInterface.IsValid())
{
@@ -86,7 +189,7 @@ void UAdvancedSessionsLibrary::GetSessionSettings(int32 &NumConnections, int32 &
return;
}
FOnlineSessionSettings* settings = SessionInterface->GetSessionSettings(GameSessionName);
FOnlineSessionSettings* settings = SessionInterface->GetSessionSettings(NAME_GameSession);
if (!settings)
{
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetSessionSettings couldn't get the session settings!"));
@@ -115,9 +218,10 @@ void UAdvancedSessionsLibrary::GetSessionSettings(int32 &NumConnections, int32 &
Result = EBlueprintResultSwitch::OnSuccess;
}
void UAdvancedSessionsLibrary::IsPlayerInSession(const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession)
void UAdvancedSessionsLibrary::IsPlayerInSession(UObject* WorldContextObject, const FBPUniqueNetId &PlayerToCheck, bool &bIsInSession)
{
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World);
if (!SessionInterface.IsValid())
{
@@ -126,7 +230,7 @@ void UAdvancedSessionsLibrary::IsPlayerInSession(const FBPUniqueNetId &PlayerToC
return;
}
bIsInSession = SessionInterface->IsPlayerInSession(GameSessionName, *PlayerToCheck.GetUniqueNetId());
bIsInSession = SessionInterface->IsPlayerInSession(NAME_GameSession, *PlayerToCheck.GetUniqueNetId());
}
FSessionsSearchSetting UAdvancedSessionsLibrary::MakeLiteralSessionSearchProperty(FSessionPropertyKeyPair SessionSearchProperty, EOnlineComparisonOpRedux ComparisonOp)
@@ -338,7 +442,7 @@ void UAdvancedSessionsLibrary::GetUniqueNetID(APlayerController *PlayerControlle
if (APlayerState* PlayerState = (PlayerController != NULL) ? PlayerController->PlayerState : NULL)
{
UniqueNetId.SetUniqueNetId(PlayerState->UniqueId.GetUniqueNetId());
UniqueNetId.SetUniqueNetId(PlayerState->GetUniqueId().GetUniqueNetId());
if (!UniqueNetId.IsValid())
{
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetUniqueNetIdFromController couldn't get the player uniquenetid!"));
@@ -347,6 +451,17 @@ void UAdvancedSessionsLibrary::GetUniqueNetID(APlayerController *PlayerControlle
}
}
void UAdvancedSessionsLibrary::GetUniqueNetIdOfSessionOwner(FBlueprintSessionResult SessionResult, FBPUniqueNetId& UniqueNetId)
{
FBPUniqueNetId ReturnID;
if (SessionResult.OnlineResult.IsValid())
{
ReturnID.SetUniqueNetId(SessionResult.OnlineResult.Session.OwningUserId);
}
UniqueNetId = ReturnID;
}
void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState *PlayerState, FBPUniqueNetId &UniqueNetId)
{
if (!PlayerState)
@@ -355,7 +470,7 @@ void UAdvancedSessionsLibrary::GetUniqueNetIDFromPlayerState(APlayerState *Playe
return;
}
UniqueNetId.SetUniqueNetId(PlayerState->UniqueId.GetUniqueNetId());
UniqueNetId.SetUniqueNetId(PlayerState->GetUniqueId().GetUniqueNetId());
if (!UniqueNetId.IsValid())
{
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetUniqueNetIdFromPlayerState couldn't get the player uniquenetid!"));
@@ -373,6 +488,11 @@ bool UAdvancedSessionsLibrary::EqualEqual_UNetIDUnetID(const FBPUniqueNetId &A,
return ((A.IsValid() && B.IsValid()) && (*A.GetUniqueNetId() == *B.GetUniqueNetId()));
}
FUniqueNetIdRepl UAdvancedSessionsLibrary::Conv_BPUniqueIDToUniqueNetIDRepl(const FBPUniqueNetId& InUniqueID)
{
return FUniqueNetIdRepl(InUniqueID.GetUniqueNetId()->AsShared());
}
void UAdvancedSessionsLibrary::SetPlayerName(APlayerController *PlayerController, FString PlayerName)
{
if (!PlayerController)
@@ -402,7 +522,7 @@ void UAdvancedSessionsLibrary::GetPlayerName(APlayerController *PlayerController
if (APlayerState* PlayerState = (PlayerController != NULL) ? PlayerController->PlayerState : NULL)
{
PlayerName = PlayerState->PlayerName;
PlayerName = PlayerState->GetPlayerName();
return;
}
else
@@ -413,23 +533,31 @@ void UAdvancedSessionsLibrary::GetPlayerName(APlayerController *PlayerController
void UAdvancedSessionsLibrary::GetNumberOfNetworkPlayers(UObject* WorldContextObject, int32 &NumNetPlayers)
{
//Get an actor to GetWorld() from
/*TObjectIterator<AActor> Itr;
if (!Itr)
{
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetNumberOfNetworkPlayers Failed to get iterator!"));
return;
}*/
//~~~~~~~~~~~~
//Get World
UWorld* TheWorld = GEngine->GetWorldFromContextObject(WorldContextObject);
UWorld* TheWorld = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!TheWorld)
{
UE_LOG(AdvancedSessionsLog, Warning, TEXT("GetNumberOfNetworkPlayers Failed to get World()!"));
return;
}
TArray<class APlayerState*>& PlayerArray = (TheWorld->GetGameState()->PlayerArray);
NumNetPlayers = PlayerArray.Num();
NumNetPlayers = TheWorld->GetGameState()->PlayerArray.Num();
}
bool UAdvancedSessionsLibrary::ServerTravel(UObject* WorldContextObject, const FString& FURL, bool bAbsolute, bool bShouldSkipGameNotify)
{
if (!WorldContextObject)
{
return false;
}
//using a context object to get the world
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
if (World)
{
return World->ServerTravel(FURL, bAbsolute, bShouldSkipGameNotify);
}
return false;
}

View File

@@ -5,9 +5,16 @@
//General Log
DEFINE_LOG_CATEGORY(AdvancedVoiceLog);
void UAdvancedVoiceLibrary::IsHeadsetPresent(bool & bHasHeadset, uint8 LocalPlayerNum)
void UAdvancedVoiceLibrary::IsHeadsetPresent(UObject* WorldContextObject, bool & bHasHeadset, uint8 LocalPlayerNum)
{
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -19,9 +26,16 @@ void UAdvancedVoiceLibrary::IsHeadsetPresent(bool & bHasHeadset, uint8 LocalPlay
bHasHeadset = VoiceInterface->IsHeadsetPresent(LocalPlayerNum);
}
void UAdvancedVoiceLibrary::StartNetworkedVoice(uint8 LocalPlayerNum)
void UAdvancedVoiceLibrary::StartNetworkedVoice(UObject* WorldContextObject, uint8 LocalPlayerNum)
{
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -32,9 +46,16 @@ void UAdvancedVoiceLibrary::StartNetworkedVoice(uint8 LocalPlayerNum)
VoiceInterface->StartNetworkedVoice(LocalPlayerNum);
}
void UAdvancedVoiceLibrary::StopNetworkedVoice(uint8 LocalPlayerNum)
void UAdvancedVoiceLibrary::StopNetworkedVoice(UObject* WorldContextObject, uint8 LocalPlayerNum)
{
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -45,9 +66,15 @@ void UAdvancedVoiceLibrary::StopNetworkedVoice(uint8 LocalPlayerNum)
VoiceInterface->StopNetworkedVoice(LocalPlayerNum);
}
bool UAdvancedVoiceLibrary::RegisterLocalTalker(uint8 LocalPlayerNum)
bool UAdvancedVoiceLibrary::RegisterLocalTalker(UObject* WorldContextObject, uint8 LocalPlayerNum)
{
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -58,9 +85,16 @@ bool UAdvancedVoiceLibrary::RegisterLocalTalker(uint8 LocalPlayerNum)
return VoiceInterface->RegisterLocalTalker(LocalPlayerNum);
}
void UAdvancedVoiceLibrary::RegisterAllLocalTalkers()
void UAdvancedVoiceLibrary::RegisterAllLocalTalkers(UObject* WorldContextObject)
{
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -72,9 +106,16 @@ void UAdvancedVoiceLibrary::RegisterAllLocalTalkers()
}
void UAdvancedVoiceLibrary::UnRegisterLocalTalker(uint8 LocalPlayerNum)
void UAdvancedVoiceLibrary::UnRegisterLocalTalker(UObject* WorldContextObject, uint8 LocalPlayerNum)
{
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -85,9 +126,16 @@ void UAdvancedVoiceLibrary::UnRegisterLocalTalker(uint8 LocalPlayerNum)
VoiceInterface->UnregisterLocalTalker(LocalPlayerNum);
}
void UAdvancedVoiceLibrary::UnRegisterAllLocalTalkers()
void UAdvancedVoiceLibrary::UnRegisterAllLocalTalkers(UObject* WorldContextObject)
{
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -98,7 +146,7 @@ void UAdvancedVoiceLibrary::UnRegisterAllLocalTalkers()
VoiceInterface->UnregisterLocalTalkers();
}
bool UAdvancedVoiceLibrary::RegisterRemoteTalker(const FBPUniqueNetId& UniqueNetId)
bool UAdvancedVoiceLibrary::RegisterRemoteTalker(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetId)
{
if (!UniqueNetId.IsValid())
{
@@ -106,7 +154,13 @@ bool UAdvancedVoiceLibrary::RegisterRemoteTalker(const FBPUniqueNetId& UniqueNet
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -117,7 +171,7 @@ bool UAdvancedVoiceLibrary::RegisterRemoteTalker(const FBPUniqueNetId& UniqueNet
return VoiceInterface->RegisterRemoteTalker(*UniqueNetId.GetUniqueNetId());
}
bool UAdvancedVoiceLibrary::UnRegisterRemoteTalker(const FBPUniqueNetId& UniqueNetId)
bool UAdvancedVoiceLibrary::UnRegisterRemoteTalker(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetId)
{
if (!UniqueNetId.IsValid())
{
@@ -125,7 +179,13 @@ bool UAdvancedVoiceLibrary::UnRegisterRemoteTalker(const FBPUniqueNetId& UniqueN
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -136,9 +196,16 @@ bool UAdvancedVoiceLibrary::UnRegisterRemoteTalker(const FBPUniqueNetId& UniqueN
return VoiceInterface->UnregisterRemoteTalker(*UniqueNetId.GetUniqueNetId());
}
void UAdvancedVoiceLibrary::RemoveAllRemoteTalkers()
void UAdvancedVoiceLibrary::RemoveAllRemoteTalkers(UObject* WorldContextObject)
{
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -149,9 +216,16 @@ void UAdvancedVoiceLibrary::RemoveAllRemoteTalkers()
VoiceInterface->RemoveAllRemoteTalkers();
}
bool UAdvancedVoiceLibrary::IsLocalPlayerTalking(uint8 LocalPlayerNum)
bool UAdvancedVoiceLibrary::IsLocalPlayerTalking(UObject* WorldContextObject, uint8 LocalPlayerNum)
{
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -162,7 +236,7 @@ bool UAdvancedVoiceLibrary::IsLocalPlayerTalking(uint8 LocalPlayerNum)
return VoiceInterface->IsLocalPlayerTalking(LocalPlayerNum);
}
bool UAdvancedVoiceLibrary::IsRemotePlayerTalking(const FBPUniqueNetId& UniqueNetId)
bool UAdvancedVoiceLibrary::IsRemotePlayerTalking(UObject* WorldContextObject, const FBPUniqueNetId& UniqueNetId)
{
if (!UniqueNetId.IsValid())
{
@@ -170,7 +244,13 @@ bool UAdvancedVoiceLibrary::IsRemotePlayerTalking(const FBPUniqueNetId& UniqueNe
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -181,7 +261,7 @@ bool UAdvancedVoiceLibrary::IsRemotePlayerTalking(const FBPUniqueNetId& UniqueNe
return VoiceInterface->IsRemotePlayerTalking(*UniqueNetId.GetUniqueNetId());
}
bool UAdvancedVoiceLibrary::IsPlayerMuted(uint8 LocalUserNumChecking, const FBPUniqueNetId& UniqueNetId)
bool UAdvancedVoiceLibrary::IsPlayerMuted(UObject* WorldContextObject, uint8 LocalUserNumChecking, const FBPUniqueNetId& UniqueNetId)
{
if (!UniqueNetId.IsValid())
{
@@ -189,7 +269,13 @@ bool UAdvancedVoiceLibrary::IsPlayerMuted(uint8 LocalUserNumChecking, const FBPU
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -200,7 +286,7 @@ bool UAdvancedVoiceLibrary::IsPlayerMuted(uint8 LocalUserNumChecking, const FBPU
return VoiceInterface->IsMuted(LocalUserNumChecking, *UniqueNetId.GetUniqueNetId());
}
bool UAdvancedVoiceLibrary::MuteRemoteTalker(uint8 LocalUserNum, const FBPUniqueNetId& UniqueNetId, bool bIsSystemWide)
bool UAdvancedVoiceLibrary::MuteRemoteTalker(UObject* WorldContextObject, uint8 LocalUserNum, const FBPUniqueNetId& UniqueNetId, bool bIsSystemWide)
{
if (!UniqueNetId.IsValid())
{
@@ -208,7 +294,13 @@ bool UAdvancedVoiceLibrary::MuteRemoteTalker(uint8 LocalUserNum, const FBPUnique
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -219,7 +311,7 @@ bool UAdvancedVoiceLibrary::MuteRemoteTalker(uint8 LocalUserNum, const FBPUnique
return VoiceInterface->MuteRemoteTalker(LocalUserNum, *UniqueNetId.GetUniqueNetId(), bIsSystemWide);
}
bool UAdvancedVoiceLibrary::UnMuteRemoteTalker(uint8 LocalUserNum, const FBPUniqueNetId& UniqueNetId, bool bIsSystemWide)
bool UAdvancedVoiceLibrary::UnMuteRemoteTalker(UObject* WorldContextObject, uint8 LocalUserNum, const FBPUniqueNetId& UniqueNetId, bool bIsSystemWide)
{
if (!UniqueNetId.IsValid())
{
@@ -227,7 +319,13 @@ bool UAdvancedVoiceLibrary::UnMuteRemoteTalker(uint8 LocalUserNum, const FBPUniq
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return false;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{
@@ -239,9 +337,16 @@ bool UAdvancedVoiceLibrary::UnMuteRemoteTalker(uint8 LocalUserNum, const FBPUniq
}
void UAdvancedVoiceLibrary::GetNumLocalTalkers(int32 & NumLocalTalkers)
void UAdvancedVoiceLibrary::GetNumLocalTalkers(UObject* WorldContextObject, int32 & NumLocalTalkers)
{
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface();
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
if (!IsValid(World))
{
return;
}
IOnlineVoicePtr VoiceInterface = Online::GetVoiceInterface(World);
if (!VoiceInterface.IsValid())
{

View File

@@ -0,0 +1,91 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "AutoLoginUserCallbackProxy.h"
#include "Kismet/GameplayStatics.h"
#include "Online.h"
//////////////////////////////////////////////////////////////////////////
// ULoginUserCallbackProxy
UAutoLoginUserCallbackProxy::UAutoLoginUserCallbackProxy(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
, Delegate(FOnLoginCompleteDelegate::CreateUObject(this, &ThisClass::OnCompleted))
{
}
UAutoLoginUserCallbackProxy* UAutoLoginUserCallbackProxy::AutoLoginUser(UObject* WorldContextObject, int32 LocalUserNum)
{
UAutoLoginUserCallbackProxy* Proxy = NewObject<UAutoLoginUserCallbackProxy>();
Proxy->LocalUserNumber = LocalUserNum;
Proxy->WorldContextObject = WorldContextObject;
return Proxy;
}
void UAutoLoginUserCallbackProxy::Activate()
{
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("AutoLoginUser"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (Helper.OnlineSub != nullptr)
{
auto Identity = Helper.OnlineSub->GetIdentityInterface();
if (Identity.IsValid())
{
DelegateHandle = Identity->AddOnLoginCompleteDelegate_Handle(LocalUserNumber, Delegate);
Identity->AutoLogin(LocalUserNumber);
return;
}
}
// Fail immediately
OnFailure.Broadcast();
}
void UAutoLoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessful, const FUniqueNetId& UserId, const FString& ErrorVal)
{
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("AutoLoginUser"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (Helper.OnlineSub != nullptr)
{
auto Identity = Helper.OnlineSub->GetIdentityInterface();
if (Identity.IsValid())
{
Identity->ClearOnLoginCompleteDelegate_Handle(LocalUserNum, DelegateHandle);
}
if (APlayerController* PController = UGameplayStatics::GetPlayerController(WorldContextObject->GetWorld(), LocalUserNum))
{
ULocalPlayer* Player = Cast<ULocalPlayer>(PController->Player);
FUniqueNetIdRepl uniqueId(UserId.AsShared());
if (Player)
{
Player->SetCachedUniqueNetId(uniqueId);
}
if (APlayerState* State = PController->PlayerState)
{
// Update UniqueId. See also ShowLoginUICallbackProxy.cpp
State->SetUniqueId(uniqueId);
}
}
if (bWasSuccessful)
{
OnSuccess.Broadcast();
}
else
{
OnFailure.Broadcast();
}
return;
}
OnFailure.Broadcast();
}

View File

@@ -1,5 +1,4 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "CancelFindSessionsCallbackProxy.h"
@@ -22,7 +21,7 @@ UCancelFindSessionsCallbackProxy* UCancelFindSessionsCallbackProxy::CancelFindSe
void UCancelFindSessionsCallbackProxy::Activate()
{
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("CancelFindSessions"), GEngine->GetWorldFromContextObject(WorldContextObject));
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("CancelFindSessions"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
if (Helper.IsValid())
@@ -48,7 +47,7 @@ void UCancelFindSessionsCallbackProxy::Activate()
void UCancelFindSessionsCallbackProxy::OnCompleted(bool bWasSuccessful)
{
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("CancelFindSessionsCallback"), GEngine->GetWorldFromContextObject(WorldContextObject));
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("CancelFindSessionsCallback"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
if (Helper.IsValid())

View File

@@ -13,7 +13,7 @@ UCreateSessionCallbackProxyAdvanced::UCreateSessionCallbackProxyAdvanced(const F
{
}
UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, class APlayerController* PlayerController, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bIsDedicatedServer, bool bUsePresence, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly, bool bAntiCheatProtected, bool bUsesStats, bool bShouldAdvertise)
UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair>& ExtraSettings, class APlayerController* PlayerController, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bIsDedicatedServer, /*bool bUsePresence,*/ bool bUseLobbiesIfAvailable, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly, bool bAntiCheatProtected, bool bUsesStats, bool bShouldAdvertise, bool bUseLobbiesVoiceChatIfAvailable, bool bStartAfterCreate)
{
UCreateSessionCallbackProxyAdvanced* Proxy = NewObject<UCreateSessionCallbackProxyAdvanced>();
Proxy->PlayerControllerWeakPtr = PlayerController;
@@ -24,18 +24,21 @@ UCreateSessionCallbackProxyAdvanced* UCreateSessionCallbackProxyAdvanced::Create
Proxy->bAllowInvites = bAllowInvites;
Proxy->ExtraSettings = ExtraSettings;
Proxy->bDedicatedServer = bIsDedicatedServer;
Proxy->bUsePresence = bUsePresence;
/*Proxy->bUsePresence = bUsePresence;*/
Proxy->bUseLobbiesIfAvailable = bUseLobbiesIfAvailable;
Proxy->bAllowJoinViaPresence = bAllowJoinViaPresence;
Proxy->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
Proxy->bAntiCheatProtected = bAntiCheatProtected;
Proxy->bUsesStats = bUsesStats;
Proxy->bShouldAdvertise = bShouldAdvertise;
Proxy->bUseLobbiesVoiceChatIfAvailable = bUseLobbiesVoiceChatIfAvailable;
Proxy->bStartAfterCreate = bStartAfterCreate;
return Proxy;
}
void UCreateSessionCallbackProxyAdvanced::Activate()
{
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("CreateSession"), GEngine->GetWorldFromContextObject(WorldContextObject));
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("CreateSession"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (PlayerControllerWeakPtr.IsValid() )
Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
@@ -50,21 +53,27 @@ void UCreateSessionCallbackProxyAdvanced::Activate()
FOnlineSessionSettings Settings;
Settings.NumPublicConnections = NumPublicConnections;
Settings.NumPrivateConnections = NumPrivateConnections;
Settings.bShouldAdvertise = true;
Settings.bShouldAdvertise = bShouldAdvertise;
Settings.bAllowJoinInProgress = true;
Settings.bIsLANMatch = bUseLAN;
Settings.bAllowJoinViaPresence = true;
Settings.bAllowJoinViaPresence = bAllowJoinViaPresence;
Settings.bIsDedicated = bDedicatedServer;
if (bDedicatedServer)
{
Settings.bUseLobbiesIfAvailable = false;
Settings.bUsesPresence = false;
}
else
Settings.bUsesPresence = bUsePresence;
{
Settings.bUseLobbiesIfAvailable = bUseLobbiesIfAvailable;
Settings.bUsesPresence = bUseLobbiesIfAvailable;
}
Settings.bUseLobbiesVoiceChatIfAvailable = bUseLobbiesIfAvailable ? bUseLobbiesVoiceChatIfAvailable : false;
Settings.bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
Settings.bAntiCheatProtected = bAntiCheatProtected;
Settings.bUsesStats = bUsesStats;
Settings.bShouldAdvertise = bShouldAdvertise;
// These are about the only changes over the standard Create Sessions Node
Settings.bAllowInvites = bAllowInvites;
@@ -79,10 +88,23 @@ void UCreateSessionCallbackProxyAdvanced::Activate()
}
if (!bDedicatedServer && PlayerControllerWeakPtr.IsValid() && Helper.UserID.IsValid())
Sessions->CreateSession(*Helper.UserID, GameSessionName, Settings);
if (!bDedicatedServer )
{
if (PlayerControllerWeakPtr.IsValid() && Helper.UserID.IsValid())
{
Sessions->CreateSession(*Helper.UserID, NAME_GameSession, Settings);
}
else
{
FFrame::KismetExecutionMessage(TEXT("Invalid Player controller when attempting to start a session"), ELogVerbosity::Warning);
Sessions->ClearOnCreateSessionCompleteDelegate_Handle(CreateCompleteDelegateHandle);
// Fail immediately
OnFailure.Broadcast();
}
}
else
Sessions->CreateSession(0, GameSessionName, Settings);
Sessions->CreateSession(0, NAME_GameSession, Settings);
// OnCreateCompleted will get called, nothing more to do now
return;
@@ -99,7 +121,7 @@ void UCreateSessionCallbackProxyAdvanced::Activate()
void UCreateSessionCallbackProxyAdvanced::OnCreateCompleted(FName SessionName, bool bWasSuccessful)
{
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("CreateSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject));
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("CreateSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
//Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
if (Helper.OnlineSub != nullptr)
@@ -111,8 +133,17 @@ void UCreateSessionCallbackProxyAdvanced::OnCreateCompleted(FName SessionName, b
if (bWasSuccessful)
{
StartCompleteDelegateHandle = Sessions->AddOnStartSessionCompleteDelegate_Handle(StartCompleteDelegate);
Sessions->StartSession(GameSessionName);
if (this->bStartAfterCreate)
{
UE_LOG_ONLINE_SESSION(Display, TEXT("Session creation completed. Automatic start is turned on, starting session now."));
StartCompleteDelegateHandle = Sessions->AddOnStartSessionCompleteDelegate_Handle(StartCompleteDelegate);
Sessions->StartSession(NAME_GameSession); // We'll call `OnSuccess.Broadcast()` when start succeeds.
}
else
{
UE_LOG_ONLINE_SESSION(Display, TEXT("Session creation completed. Automatic start is turned off, to start the session call 'StartSession'."));
OnSuccess.Broadcast();
}
// OnStartCompleted will get called, nothing more to do now
return;
@@ -128,8 +159,8 @@ void UCreateSessionCallbackProxyAdvanced::OnCreateCompleted(FName SessionName, b
void UCreateSessionCallbackProxyAdvanced::OnStartCompleted(FName SessionName, bool bWasSuccessful)
{
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("StartSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject));
Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("StartSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
//Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
if (Helper.OnlineSub != nullptr)
{

View File

@@ -1,5 +1,4 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "EndSessionCallbackProxy.h"
@@ -22,7 +21,7 @@ UEndSessionCallbackProxy* UEndSessionCallbackProxy::EndSession(UObject* WorldCon
void UEndSessionCallbackProxy::Activate()
{
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("EndSession"), GEngine->GetWorldFromContextObject(WorldContextObject));
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("EndSession"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
if (Helper.IsValid())
@@ -30,12 +29,12 @@ void UEndSessionCallbackProxy::Activate()
auto Sessions = Helper.OnlineSub->GetSessionInterface();
if (Sessions.IsValid())
{
FNamedOnlineSession* Session = Sessions->GetNamedSession(GameSessionName);
FNamedOnlineSession* Session = Sessions->GetNamedSession(NAME_GameSession);
if (Session &&
Session->SessionState == EOnlineSessionState::InProgress)
{
DelegateHandle = Sessions->AddOnEndSessionCompleteDelegate_Handle(Delegate);
Sessions->EndSession(GameSessionName);
Sessions->EndSession(NAME_GameSession);
}
else
{
@@ -56,7 +55,7 @@ void UEndSessionCallbackProxy::Activate()
void UEndSessionCallbackProxy::OnCompleted(FName SessionName, bool bWasSuccessful)
{
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("EndSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject));
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("EndSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
if (Helper.IsValid())

View File

@@ -41,7 +41,18 @@ void UFindFriendSessionCallbackProxy::Activate()
return;
}
IOnlineSessionPtr Sessions = Online::GetSessionInterface();
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("EndSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
if (!Helper.IsValid())
{
// Fail immediately
TArray<FBlueprintSessionResult> EmptyResult;
OnFailure.Broadcast(EmptyResult);
return;
}
IOnlineSessionPtr Sessions = Helper.OnlineSub->GetSessionInterface();
if (Sessions.IsValid())
{
@@ -71,31 +82,51 @@ void UFindFriendSessionCallbackProxy::Activate()
void UFindFriendSessionCallbackProxy::OnFindFriendSessionCompleted(int32 LocalPlayer, bool bWasSuccessful, const TArray<FOnlineSessionSearchResult>& SessionInfo)
{
IOnlineSessionPtr Sessions = Online::GetSessionInterface();
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("EndSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
if (Sessions.IsValid())
Sessions->ClearOnFindFriendSessionCompleteDelegate_Handle(LocalPlayer, FindFriendSessionCompleteDelegateHandle);
if ( bWasSuccessful )
if (Helper.IsValid())
{
TArray<FBlueprintSessionResult> Result;
IOnlineSessionPtr Sessions = Helper.OnlineSub->GetSessionInterface();
for (auto& Sesh : SessionInfo)
if (Sessions.IsValid())
Sessions->ClearOnFindFriendSessionCompleteDelegate_Handle(LocalPlayer, FindFriendSessionCompleteDelegateHandle);
if (bWasSuccessful)
{
if (Sesh.IsValid())
TArray<FBlueprintSessionResult> Result;
for (auto& Sesh : SessionInfo)
{
FBlueprintSessionResult BSesh;
BSesh.OnlineResult = Sesh;
Result.Add(BSesh);
if (Sesh.IsValid())
{
FBlueprintSessionResult BSesh;
BSesh.OnlineResult = Sesh;
// Temp for 5.5, force the values if epic isn't setting them, lobbies should always have these true
if (!BSesh.OnlineResult.Session.SessionSettings.bIsDedicated)
{
BSesh.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
BSesh.OnlineResult.Session.SessionSettings.bUsesPresence = true;
}
Result.Add(BSesh);
}
}
if (Result.Num() > 0)
OnSuccess.Broadcast(Result);
else
{
UE_LOG(AdvancedFindFriendSessionLog, Warning, TEXT("FindFriendSession Failed, returned an invalid session."));
OnFailure.Broadcast(Result);
}
}
if(Result.Num() > 0)
OnSuccess.Broadcast(Result);
else
{
UE_LOG(AdvancedFindFriendSessionLog, Warning, TEXT("FindFriendSession Failed, returned an invalid session."));
OnFailure.Broadcast(Result);
UE_LOG(AdvancedFindFriendSessionLog, Warning, TEXT("FindFriendSession Failed"));
TArray<FBlueprintSessionResult> EmptyResult;
OnFailure.Broadcast(EmptyResult);
}
}
else

View File

@@ -1,7 +1,7 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "FindSessionsCallbackProxyAdvanced.h"
#include "Online/OnlineSessionNames.h"
//////////////////////////////////////////////////////////////////////////
// UFindSessionsCallbackProxyAdvanced
@@ -16,7 +16,7 @@ UFindSessionsCallbackProxyAdvanced::UFindSessionsCallbackProxyAdvanced(const FOb
bIsOnSecondSearch = false;
}
UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly, bool bNonEmptyServersOnly, bool bSecureServersOnly, int MinSlotsAvailable)
UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSessionsAdvanced(UObject* WorldContextObject, class APlayerController* PlayerController, int MaxResults, bool bUseLAN, EBPServerPresenceSearchType ServerTypeToSearch, const TArray<FSessionsSearchSetting> &Filters, bool bEmptyServersOnly, bool bNonEmptyServersOnly, bool bSecureServersOnly, /*bool bSearchLobbies,*/ int MinSlotsAvailable)
{
UFindSessionsCallbackProxyAdvanced* Proxy = NewObject<UFindSessionsCallbackProxyAdvanced>();
Proxy->PlayerControllerWeakPtr = PlayerController;
@@ -28,13 +28,14 @@ UFindSessionsCallbackProxyAdvanced* UFindSessionsCallbackProxyAdvanced::FindSess
Proxy->bEmptyServersOnly = bEmptyServersOnly,
Proxy->bNonEmptyServersOnly = bNonEmptyServersOnly;
Proxy->bSecureServersOnly = bSecureServersOnly;
//Proxy->bSearchLobbies = bSearchLobbies;
Proxy->MinSlotsAvailable = MinSlotsAvailable;
return Proxy;
}
void UFindSessionsCallbackProxyAdvanced::Activate()
{
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("FindSessions"), GEngine->GetWorldFromContextObject(WorldContextObject));
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("FindSessions"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
if (Helper.IsValid())
@@ -74,7 +75,17 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
#define SEARCH_USER FName(TEXT("SEARCHUSER"))
// Keywords to match in session search
#define SEARCH_KEYWORDS FName(TEXT("SEARCHKEYWORDS"))*/
/** Keywords to match in session search */
/** The matchmaking queue name to matchmake in, e.g. "TeamDeathmatch" (value is string) */
/** #define SEARCH_MATCHMAKING_QUEUE FName(TEXT("MATCHMAKINGQUEUE"))*/
/** If set, use the named Xbox Live hopper to find a session via matchmaking (value is a string) */
/** #define SEARCH_XBOX_LIVE_HOPPER_NAME FName(TEXT("LIVEHOPPERNAME"))*/
/** Which session template from the service configuration to use */
/** #define SEARCH_XBOX_LIVE_SESSION_TEMPLATE_NAME FName(TEXT("LIVESESSIONTEMPLATE"))*/
/** Selection method used to determine which match to join when multiple are returned (valid only on Switch) */
/** #define SEARCH_SWITCH_SELECTION_METHOD FName(TEXT("SWITCHSELECTIONMETHOD"))*/
/** Whether to use lobbies vs sessions */
/** #define SEARCH_LOBBIES FName(TEXT("LOBBYSEARCH"))*/
if (bEmptyServersOnly)
tem.Set(SEARCH_EMPTY_SERVERS_ONLY, true, EOnlineComparisonOp::Equals);
@@ -87,8 +98,6 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
if (MinSlotsAvailable != 0)
tem.Set(SEARCH_MINSLOTSAVAILABLE, MinSlotsAvailable, EOnlineComparisonOp::GreaterThanEquals);
// Filter results
if (SearchSettings.Num() > 0)
{
@@ -104,7 +113,10 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
case EBPServerPresenceSearchType::ClientServersOnly:
{
tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
//tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
//if (bSearchLobbies)// && !IOnlineSubsystem::DoesInstanceExist("STEAM"))
tem.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals);
}
break;
@@ -117,21 +129,24 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
case EBPServerPresenceSearchType::AllServers:
default:
{
// Only steam uses the separate searching flags currently
if (IOnlineSubsystem::DoesInstanceExist("STEAM"))
{
bRunSecondSearch = true;
//if (IOnlineSubsystem::DoesInstanceExist("STEAM"))
//{
bRunSecondSearch = true;
SearchObjectDedicated = MakeShareable(new FOnlineSessionSearch);
SearchObjectDedicated->MaxSearchResults = MaxResults;
SearchObjectDedicated->bIsLanQuery = bUseLAN;
SearchObjectDedicated = MakeShareable(new FOnlineSessionSearch);
SearchObjectDedicated->MaxSearchResults = MaxResults;
SearchObjectDedicated->bIsLanQuery = bUseLAN;
FOnlineSearchSettingsEx DedicatedOnly = tem;
tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
FOnlineSearchSettingsEx DedicatedOnly = tem;
//DedicatedOnly.Set(SEARCH_DEDICATED_ONLY, true, EOnlineComparisonOp::Equals);
SearchObjectDedicated->QuerySettings = DedicatedOnly;
}
//tem.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);
//if (bSearchLobbies)// && !IOnlineSubsystem::DoesInstanceExist("STEAM"))
tem.Set(SEARCH_LOBBIES, true, EOnlineComparisonOp::Equals);
//DedicatedOnly.Set(SEARCH_DEDICATED_ONLY, true, EOnlineComparisonOp::Equals);
SearchObjectDedicated->QuerySettings = DedicatedOnly;
//}
}
break;
}
@@ -156,9 +171,16 @@ void UFindSessionsCallbackProxyAdvanced::Activate()
void UFindSessionsCallbackProxyAdvanced::OnCompleted(bool bSuccess)
{
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("FindSessionsCallback"), GEngine->GetWorldFromContextObject(WorldContextObject));
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("FindSessionsCallback"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
if (!Helper.IsValid())
{
// Fail immediately
OnFailure.Broadcast(SessionSearchResults);
return;
}
if (!bRunSecondSearch && Helper.IsValid())
{
auto Sessions = Helper.OnlineSub->GetSessionInterface();
@@ -183,7 +205,7 @@ void UFindSessionsCallbackProxyAdvanced::OnCompleted(bool bSuccess)
FBlueprintSessionResult BPResult;
BPResult.OnlineResult = Result;
SessionSearchResults.Add(BPResult);
SessionSearchResults.AddUnique(BPResult);
}
OnSuccess.Broadcast(SessionSearchResults);
return;
@@ -202,7 +224,15 @@ void UFindSessionsCallbackProxyAdvanced::OnCompleted(bool bSuccess)
FBlueprintSessionResult BPResult;
BPResult.OnlineResult = Result;
SessionSearchResults.Add(BPResult);
// Temp for 5.5, force the values if epic isn't setting them, lobbies should always have these true
if (ServerSearchType != EBPServerPresenceSearchType::DedicatedServersOnly )
{
BPResult.OnlineResult.Session.SessionSettings.bUseLobbiesIfAvailable = true;
BPResult.OnlineResult.Session.SessionSettings.bUsesPresence = true;
}
SessionSearchResults.AddUnique(BPResult);
}
if (!bRunSecondSearch)
{
@@ -225,13 +255,20 @@ void UFindSessionsCallbackProxyAdvanced::OnCompleted(bool bSuccess)
}
}
if (bRunSecondSearch && ServerSearchType == EBPServerPresenceSearchType::AllServers)
if (Helper.IsValid() && bRunSecondSearch && ServerSearchType == EBPServerPresenceSearchType::AllServers)
{
bRunSecondSearch = false;
bIsOnSecondSearch = true;
auto Sessions = Helper.OnlineSub->GetSessionInterface();
Sessions->FindSessions(*Helper.UserID, SearchObjectDedicated.ToSharedRef());
}
else // We lost our player controller
{
if (bSuccess && SessionSearchResults.Num() > 0)
OnSuccess.Broadcast(SessionSearchResults);
else
OnFailure.Broadcast(SessionSearchResults);
}
}

View File

@@ -1,6 +1,9 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "GetFriendsCallbackProxy.h"
#include "Online.h"
#include "Interfaces/OnlineFriendsInterface.h"
#include "Interfaces/OnlinePresenceInterface.h"
//////////////////////////////////////////////////////////////////////////
// UGetFriendsCallbackProxy
@@ -31,18 +34,23 @@ void UGetFriendsCallbackProxy::Activate()
return;
}
IOnlineFriendsPtr Friends = Online::GetFriendsInterface();
if (Friends.IsValid())
{
ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerControllerWeakPtr->Player);
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("GetFriends"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
Friends->ReadFriendsList(Player->GetControllerId(), EFriendsLists::ToString((EFriendsLists::Default)), FriendListReadCompleteDelegate);
return;
if (Helper.IsValid())
{
IOnlineFriendsPtr Friends = Helper.OnlineSub->GetFriendsInterface();
if (Friends.IsValid())
{
ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerControllerWeakPtr->Player);
Friends->ReadFriendsList(Player->GetControllerId(), EFriendsLists::ToString((EFriendsLists::Default)), FriendListReadCompleteDelegate);
return;
}
}
// Fail immediately
TArray<FBPFriendInfo> EmptyArray;
OnFailure.Broadcast(EmptyArray);
}
@@ -50,7 +58,17 @@ void UGetFriendsCallbackProxy::OnReadFriendsListCompleted(int32 LocalUserNum, bo
{
if (bWasSuccessful)
{
IOnlineFriendsPtr Friends = Online::GetFriendsInterface();
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("GetFriends"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
Helper.QueryIDFromPlayerController(PlayerControllerWeakPtr.Get());
if (!Helper.IsValid())
{
TArray<FBPFriendInfo> EmptyArray;
OnFailure.Broadcast(EmptyArray);
return;
}
auto Friends = Helper.OnlineSub->GetFriendsInterface();
if (Friends.IsValid())
{
// Not actually needed anymore, plus was not being validated and causing a crash
@@ -58,29 +76,31 @@ void UGetFriendsCallbackProxy::OnReadFriendsListCompleted(int32 LocalUserNum, bo
TArray<FBPFriendInfo> FriendsListOut;
TArray< TSharedRef<FOnlineFriend> > FriendList;
Friends->GetFriendsList(LocalUserNum, ListName, FriendList);
for (int32 i = 0; i < FriendList.Num(); i++)
if (Friends->GetFriendsList(LocalUserNum, ListName, FriendList))
{
TSharedRef<FOnlineFriend> Friend = FriendList[i];
FBPFriendInfo BPF;
FOnlineUserPresence pres = Friend->GetPresence();
BPF.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
BPF.DisplayName = Friend->GetDisplayName();
BPF.RealName = Friend->GetRealName();
BPF.UniqueNetId.SetUniqueNetId(Friend->GetUserId());
BPF.bIsPlayingSameGame = pres.bIsPlayingThisGame;
for (int32 i = 0; i < FriendList.Num(); i++)
{
FBPFriendInfo BPF;
const FOnlineUserPresence& pres = FriendList[i]->GetPresence();
BPF.OnlineState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
BPF.DisplayName = FriendList[i]->GetDisplayName();
BPF.RealName = FriendList[i]->GetRealName();
BPF.UniqueNetId.SetUniqueNetId(FriendList[i]->GetUserId());
BPF.bIsPlayingSameGame = pres.bIsPlayingThisGame;
BPF.PresenceInfo.bIsOnline = pres.bIsOnline;
BPF.PresenceInfo.bHasVoiceSupport = pres.bHasVoiceSupport;
BPF.PresenceInfo.bIsPlaying = pres.bIsPlaying;
BPF.PresenceInfo.PresenceState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
BPF.PresenceInfo.StatusString = pres.Status.StatusStr;
BPF.PresenceInfo.bIsJoinable = pres.bIsJoinable;
BPF.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame;
BPF.PresenceInfo.bIsOnline = pres.bIsOnline;
BPF.PresenceInfo.bHasVoiceSupport = pres.bHasVoiceSupport;
BPF.PresenceInfo.bIsPlaying = pres.bIsPlaying;
BPF.PresenceInfo.PresenceState = ((EBPOnlinePresenceState)((int32)pres.Status.State));
// #TODO: Check back in on this in shipping, epic is missing the UTF8_TO_TCHAR call on converting this and its making an invalid string
//BPF.PresenceInfo.StatusString = pres.Status.StatusStr;
BPF.PresenceInfo.bIsJoinable = pres.bIsJoinable;
BPF.PresenceInfo.bIsPlayingThisGame = pres.bIsPlayingThisGame;
FriendsListOut.Add(BPF);
FriendsListOut.Add(BPF);
}
}
OnSuccess.Broadcast(FriendsListOut);

View File

@@ -1,6 +1,7 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "GetRecentPlayersCallbackProxy.h"
#include "Online.h"
//////////////////////////////////////////////////////////////////////////
// UGetRecentPlayersCallbackProxy
@@ -31,7 +32,16 @@ void UGetRecentPlayersCallbackProxy::Activate()
return;
}
IOnlineFriendsPtr Friends = Online::GetFriendsInterface();
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("GetRecentPlayers"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (!Helper.OnlineSub)
{
TArray<FBPOnlineRecentPlayer> EmptyArray;
OnFailure.Broadcast(EmptyArray);
return;
}
IOnlineFriendsPtr Friends = Helper.OnlineSub->GetFriendsInterface();
if (Friends.IsValid())
{
DelegateHandle = Friends->AddOnQueryRecentPlayersCompleteDelegate_Handle(QueryRecentPlayersCompleteDelegate);
@@ -48,7 +58,16 @@ void UGetRecentPlayersCallbackProxy::Activate()
void UGetRecentPlayersCallbackProxy::OnQueryRecentPlayersCompleted(const FUniqueNetId &UserID, const FString &Namespace, bool bWasSuccessful, const FString& ErrorString)
{
IOnlineFriendsPtr Friends = Online::GetFriendsInterface();
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("GetRecentPlayers"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (!Helper.OnlineSub)
{
TArray<FBPOnlineRecentPlayer> EmptyArray;
OnFailure.Broadcast(EmptyArray);
return;
}
IOnlineFriendsPtr Friends = Helper.OnlineSub->GetFriendsInterface();
if (Friends.IsValid())
Friends->ClearOnQueryRecentPlayersCompleteDelegate_Handle(DelegateHandle);

View File

@@ -2,6 +2,7 @@
#include "GetUserPrivilegeCallbackProxy.h"
#include "Online.h"
//////////////////////////////////////////////////////////////////////////
// UGetUserPrivilegeCallbackProxy
@@ -22,7 +23,14 @@ UGetUserPrivilegeCallbackProxy* UGetUserPrivilegeCallbackProxy::GetUserPrivilege
void UGetUserPrivilegeCallbackProxy::Activate()
{
auto Identity = Online::GetIdentityInterface();
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("GetUserPrivilege"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (!Helper.OnlineSub)
{
OnFailure.Broadcast();
return;
}
auto Identity = Helper.OnlineSub->GetIdentityInterface();
if (Identity.IsValid())
{

View File

@@ -2,6 +2,7 @@
#include "LoginUserCallbackProxy.h"
#include "Online.h"
//////////////////////////////////////////////////////////////////////////
// ULoginUserCallbackProxy
@@ -12,12 +13,13 @@ ULoginUserCallbackProxy::ULoginUserCallbackProxy(const FObjectInitializer& Objec
{
}
ULoginUserCallbackProxy* ULoginUserCallbackProxy::LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken)
ULoginUserCallbackProxy* ULoginUserCallbackProxy::LoginUser(UObject* WorldContextObject, class APlayerController* PlayerController, FString UserID, FString UserToken, FString AuthType)
{
ULoginUserCallbackProxy* Proxy = NewObject<ULoginUserCallbackProxy>();
Proxy->PlayerControllerWeakPtr = PlayerController;
Proxy->UserID = UserID;
Proxy->UserToken = UserToken;
Proxy->AuthType = AuthType;
Proxy->WorldContextObject = WorldContextObject;
return Proxy;
}
@@ -39,12 +41,24 @@ void ULoginUserCallbackProxy::Activate()
return;
}
auto Identity = Online::GetIdentityInterface();
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("LoginUser"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (!Helper.OnlineSub)
{
OnFailure.Broadcast();
return;
}
auto Identity = Helper.OnlineSub->GetIdentityInterface();
if (Identity.IsValid())
{
// Fallback to default AuthType if nothing is specified
if (AuthType.IsEmpty())
{
AuthType = Identity->GetAuthType();
}
DelegateHandle = Identity->AddOnLoginCompleteDelegate_Handle(Player->GetControllerId(), Delegate);
FOnlineAccountCredentials AccountCreds(Identity->GetAuthType(), UserID, UserToken);
FOnlineAccountCredentials AccountCreds(AuthType, UserID, UserToken);
Identity->Login(Player->GetControllerId(), AccountCreds);
return;
}
@@ -59,14 +73,30 @@ void ULoginUserCallbackProxy::OnCompleted(int32 LocalUserNum, bool bWasSuccessfu
{
ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerControllerWeakPtr->Player);
FUniqueNetIdRepl UniqueID(UserId.AsShared());
if (Player)
{
auto Identity = Online::GetIdentityInterface();
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("GetUserPrivilege"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (!Helper.OnlineSub)
{
OnFailure.Broadcast();
return;
}
auto Identity = Helper.OnlineSub->GetIdentityInterface();
if (Identity.IsValid())
{
Identity->ClearOnLoginCompleteDelegate_Handle(Player->GetControllerId(), DelegateHandle);
}
Player->SetCachedUniqueNetId(UniqueID);
}
if (APlayerState* State = PlayerControllerWeakPtr->PlayerState)
{
// Update UniqueId. See also ShowLoginUICallbackProxy.cpp
State->SetUniqueId(UniqueID);
}
}

View File

@@ -2,6 +2,7 @@
#include "LogoutUserCallbackProxy.h"
#include "Online.h"
//////////////////////////////////////////////////////////////////////////
// ULogoutUserCallbackProxy
@@ -29,7 +30,6 @@ void ULogoutUserCallbackProxy::Activate()
return;
}
ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerControllerWeakPtr->Player);
if (!Player)
@@ -38,7 +38,14 @@ void ULogoutUserCallbackProxy::Activate()
return;
}
auto Identity = Online::GetIdentityInterface();
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("LogoutUser"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (!Helper.OnlineSub)
{
OnFailure.Broadcast();
return;
}
auto Identity = Helper.OnlineSub->GetIdentityInterface();
if (Identity.IsValid())
{
@@ -60,7 +67,14 @@ void ULogoutUserCallbackProxy::OnCompleted(int LocalUserNum, bool bWasSuccessful
if (Player)
{
auto Identity = Online::GetIdentityInterface();
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("LogoutUser"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (!Helper.OnlineSub)
{
OnFailure.Broadcast();
return;
}
auto Identity = Helper.OnlineSub->GetIdentityInterface();
if (Identity.IsValid())
{

View File

@@ -1,6 +1,7 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "SendFriendInviteCallbackProxy.h"
#include "Online.h"
//////////////////////////////////////////////////////////////////////////
// UGetRecentPlayersCallbackProxy
@@ -39,7 +40,15 @@ void USendFriendInviteCallbackProxy::Activate()
return;
}
IOnlineFriendsPtr Friends = Online::GetFriendsInterface();
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("SendFriendInvite"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (!Helper.OnlineSub)
{
OnFailure.Broadcast();
return;
}
auto Friends = Helper.OnlineSub->GetFriendsInterface();
if (Friends.IsValid())
{
ULocalPlayer* Player = Cast<ULocalPlayer>(PlayerControllerWeakPtr->Player);

View File

@@ -0,0 +1,58 @@
#include "StartSessionCallbackProxyAdvanced.h"
UStartSessionCallbackProxyAdvanced::UStartSessionCallbackProxyAdvanced(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
, StartCompleteDelegate(FOnStartSessionCompleteDelegate::CreateUObject(this, &ThisClass::OnStartCompleted))
{
}
UStartSessionCallbackProxyAdvanced* UStartSessionCallbackProxyAdvanced::StartAdvancedSession(
UObject* WorldContextObject)
{
UStartSessionCallbackProxyAdvanced* Proxy = NewObject<UStartSessionCallbackProxyAdvanced>();
Proxy->WorldContextObject = WorldContextObject;
return Proxy;
}
void UStartSessionCallbackProxyAdvanced::Activate()
{
const FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("StartSession"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (Helper.OnlineSub != nullptr)
{
const auto Sessions = Helper.OnlineSub->GetSessionInterface();
if (Sessions.IsValid())
{
StartCompleteDelegateHandle = Sessions->AddOnStartSessionCompleteDelegate_Handle(StartCompleteDelegate);
Sessions->StartSession(NAME_GameSession);
return;
}
FFrame::KismetExecutionMessage(TEXT("Sessions not supported by Online Subsystem"), ELogVerbosity::Warning);
}
// Fail immediately
OnFailure.Broadcast();
}
void UStartSessionCallbackProxyAdvanced::OnStartCompleted(FName SessionName, bool bWasSuccessful)
{
FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("StartSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (Helper.OnlineSub != nullptr)
{
auto Sessions = Helper.OnlineSub->GetSessionInterface();
if (Sessions.IsValid())
{
Sessions->ClearOnStartSessionCompleteDelegate_Handle(StartCompleteDelegateHandle);
}
}
if (bWasSuccessful)
{
OnSuccess.Broadcast();
}
else
{
OnFailure.Broadcast();
}
}

View File

@@ -12,7 +12,7 @@ UUpdateSessionCallbackProxyAdvanced::UUpdateSessionCallbackProxyAdvanced(const F
{
}
UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::UpdateSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bAllowJoinInProgress, bool bRefreshOnlineData, bool bIsDedicatedServer)
UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::UpdateSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, int32 PublicConnections, int32 PrivateConnections, bool bUseLAN, bool bAllowInvites, bool bAllowJoinInProgress, bool bRefreshOnlineData, bool bIsDedicatedServer, bool bShouldAdvertise, bool bAllowJoinViaPresence, bool bAllowJoinViaPresenceFriendsOnly)
{
UUpdateSessionCallbackProxyAdvanced* Proxy = NewObject<UUpdateSessionCallbackProxyAdvanced>();
Proxy->NumPublicConnections = PublicConnections;
@@ -24,75 +24,84 @@ UUpdateSessionCallbackProxyAdvanced* UUpdateSessionCallbackProxyAdvanced::Update
Proxy->bRefreshOnlineData = bRefreshOnlineData;
Proxy->bAllowJoinInProgress = bAllowJoinInProgress;
Proxy->bDedicatedServer = bIsDedicatedServer;
Proxy->bShouldAdvertise = bShouldAdvertise;
Proxy->bAllowJoinViaPresence = bAllowJoinViaPresence;
Proxy->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
return Proxy;
}
void UUpdateSessionCallbackProxyAdvanced::Activate()
{
const FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("UpdateSession"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
IOnlineSessionPtr Sessions = Online::GetSessionInterface();
if (Sessions.IsValid())
if (Helper.OnlineSub != nullptr)
{
if (Sessions->GetNumSessions() < 1)
const auto Sessions = Helper.OnlineSub->GetSessionInterface();
if (Sessions.IsValid())
{
OnFailure.Broadcast();
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("NO REGISTERED SESSIONS!"));
if (Sessions->GetNumSessions() < 1)
{
OnFailure.Broadcast();
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, TEXT("NO REGISTERED SESSIONS!"));
return;
}
// This gets the actual session itself
//FNamedOnlineSession * curSession = Sessions->GetNamedSession(NAME_GameSession);
FOnlineSessionSettings* Settings = Sessions->GetSessionSettings(NAME_GameSession);
if (!Settings)
{
// Fail immediately
OnFailure.Broadcast();
return;
}
OnUpdateSessionCompleteDelegateHandle = Sessions->AddOnUpdateSessionCompleteDelegate_Handle(OnUpdateSessionCompleteDelegate);
// FOnlineSessionSettings Settings;
//Settings->BuildUniqueId = GetBuildUniqueId();
Settings->NumPublicConnections = NumPublicConnections;
Settings->NumPrivateConnections = NumPrivateConnections;
Settings->bShouldAdvertise = bShouldAdvertise;
Settings->bAllowJoinInProgress = bAllowJoinInProgress;
Settings->bIsLANMatch = bUseLAN;
//Settings->bUsesPresence = true;
Settings->bAllowInvites = bAllowInvites;
Settings->bAllowJoinInProgress = bAllowJoinInProgress;
Settings->bIsDedicated = bDedicatedServer;
// Added in 5.6
Settings->bAllowJoinViaPresence = bAllowJoinViaPresence;
Settings->bAllowJoinViaPresenceFriendsOnly = bAllowJoinViaPresenceFriendsOnly;
FOnlineSessionSetting * fSetting = NULL;
FOnlineSessionSetting ExtraSetting;
for (int i = 0; i < ExtraSettings.Num(); i++)
{
fSetting = Settings->Settings.Find(ExtraSettings[i].Key);
if (fSetting)
{
fSetting->Data = ExtraSettings[i].Data;
}
else
{
ExtraSetting.Data = ExtraSettings[i].Data;
ExtraSetting.AdvertisementType = EOnlineDataAdvertisementType::ViaOnlineService;
Settings->Settings.Add(ExtraSettings[i].Key, ExtraSetting);
}
}
Sessions->UpdateSession(NAME_GameSession, *Settings, bRefreshOnlineData);
// OnUpdateCompleted will get called, nothing more to do now
return;
}
// This gets the actual session itself
//FNamedOnlineSession * curSession = Sessions->GetNamedSession(GameSessionName);
FOnlineSessionSettings* Settings = Sessions->GetSessionSettings(GameSessionName);
if (!Settings)
else
{
// Fail immediately
OnFailure.Broadcast();
return;
FFrame::KismetExecutionMessage(TEXT("Sessions not supported by Online Subsystem"), ELogVerbosity::Warning);
}
OnUpdateSessionCompleteDelegateHandle = Sessions->AddOnUpdateSessionCompleteDelegate_Handle(OnUpdateSessionCompleteDelegate);
// FOnlineSessionSettings Settings;
//Settings->BuildUniqueId = GetBuildUniqueId();
Settings->NumPublicConnections = NumPublicConnections;
Settings->NumPrivateConnections = NumPrivateConnections;
//Settings->bShouldAdvertise = true;
Settings->bAllowJoinInProgress = bAllowJoinInProgress;
Settings->bIsLANMatch = bUseLAN;
//Settings->bUsesPresence = true;
//Settings->bAllowJoinViaPresence = true;
Settings->bAllowInvites = bAllowInvites;
Settings->bAllowJoinInProgress = bAllowJoinInProgress;
Settings->bIsDedicated = bDedicatedServer;
FOnlineSessionSetting * fSetting = NULL;
FOnlineSessionSetting ExtraSetting;
for (int i = 0; i < ExtraSettings.Num(); i++)
{
fSetting = Settings->Settings.Find(ExtraSettings[i].Key);
if (fSetting)
{
fSetting->Data = ExtraSettings[i].Data;
}
else
{
ExtraSetting.Data = ExtraSettings[i].Data;
ExtraSetting.AdvertisementType = EOnlineDataAdvertisementType::ViaOnlineService;
Settings->Settings.Add(ExtraSettings[i].Key, ExtraSetting);
}
}
Sessions->UpdateSession(GameSessionName, *Settings, bRefreshOnlineData);
// OnUpdateCompleted will get called, nothing more to do now
return;
}
else
{
FFrame::KismetExecutionMessage(TEXT("Sessions not supported by Online Subsystem"), ELogVerbosity::Warning);
}
// Fail immediately
OnFailure.Broadcast();
@@ -101,15 +110,20 @@ void UUpdateSessionCallbackProxyAdvanced::Activate()
void UUpdateSessionCallbackProxyAdvanced::OnUpdateCompleted(FName SessionName, bool bWasSuccessful)
{
IOnlineSessionPtr Sessions = Online::GetSessionInterface();
if (Sessions.IsValid())
{
Sessions->ClearOnUpdateSessionCompleteDelegate_Handle(OnUpdateSessionCompleteDelegateHandle);
const FOnlineSubsystemBPCallHelperAdvanced Helper(TEXT("UpdateSessionCallback"), GEngine->GetWorldFromContextObject(WorldContextObject.Get(), EGetWorldErrorMode::LogAndReturnNull));
if (bWasSuccessful)
if (Helper.OnlineSub != nullptr)
{
const auto Sessions = Helper.OnlineSub->GetSessionInterface();
if (Sessions.IsValid())
{
OnSuccess.Broadcast();
return;
Sessions->ClearOnUpdateSessionCompleteDelegate_Handle(OnUpdateSessionCompleteDelegateHandle);
if (bWasSuccessful)
{
OnSuccess.Broadcast();
return;
}
}
}

View File

@@ -2,8 +2,8 @@
"FileVersion" : 3,
"FriendlyName" : "Advanced Steam Sessions",
"Version" : 1.9,
"VersionName": "1.9",
"Version" : 5.4,
"VersionName": "5.4",
"Description" : "Adds new blueprint functions to handle more advanced session operations in Steam. REQUIRES ADVANCED SESSIONS",
"Category" : "Advanced Sessions Plugin",
"CreatedBy" : "Joshua Statzer",
@@ -11,10 +11,32 @@
"Modules" :
[
{
"Name" : "AdvancedSteamSessions",
"Type" : "RunTime",
"LoadingPhase" : "PreDefault"
}
]
{
"Name": "AdvancedSteamSessions",
"Type": "RunTime",
"LoadingPhase": "PostDefault"
}
],
"Plugins": [
{
"Name": "AdvancedSessions",
"Enabled": true
},
{
"Name": "OnlineSubsystem",
"Enabled": true
},
{
"Name": "OnlineSubsystemSteam",
"Enabled": true
},
{
"Name": "OnlineSubsystemUtils",
"Enabled": true
},
{
"Name": "SteamShared",
"Enabled": true
}
]
}

View File

@@ -0,0 +1,8 @@
[FilterPlugin]
; This section lists additional files which will be packaged along with your plugin. Paths should be listed relative to the root plugin directory, and
; may include "...", "*", and "?" wildcards to match directories, files, and individual characters respectively.
;
; Examples:
; /README.txt
; /Extras/...
; /Binaries/ThirdParty/*.dll

View File

@@ -5,18 +5,22 @@ public class AdvancedSteamSessions : ModuleRules
{
public AdvancedSteamSessions(ReadOnlyTargetRules Target) : base(Target)
{
DefaultBuildSettings = BuildSettingsVersion.Latest;
IncludeOrderVersion = EngineIncludeOrderVersion.Latest;
PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;
//bEnforceIWYU = true;
Definitions.Add("WITH_ADVANCED_STEAM_SESSIONS=1");
PublicDefinitions.Add("WITH_ADVANCED_STEAM_SESSIONS=1");
PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "OnlineSubsystem", "CoreUObject", "OnlineSubsystemUtils", "Networking", "Sockets", "AdvancedSessions"/*"Voice", "OnlineSubsystemSteam"*/ });
PrivateDependencyModuleNames.AddRange(new string[] { "OnlineSubsystem", "Sockets", "Networking", "OnlineSubsystemUtils" /*"Voice", "Steamworks","OnlineSubsystemSteam"*/});
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32) || (Target.Platform == UnrealTargetPlatform.Linux) || (Target.Platform == UnrealTargetPlatform.Mac))
if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Linux) || (Target.Platform == UnrealTargetPlatform.Mac))
{
PublicDependencyModuleNames.AddRange(new string[] { "Steamworks",/*"Voice",*/ "OnlineSubsystemSteam" });
PublicIncludePaths.AddRange(new string[] { "../Plugins/Online/OnlineSubsystemSteam/Source/Private" });// This is dumb but it isn't very open
PublicDependencyModuleNames.AddRange(new string[] { "SteamShared", "Steamworks", "OnlineSubsystemSteam" });
AddEngineThirdPartyPrivateStaticDependencies(Target, "Steamworks");
//PublicIncludePaths.AddRange(new string[] { "../Plugins/Online/OnlineSubsystemSteam/Source/Private" });// This is dumb but it isn't very open
}
}
}

View File

@@ -6,14 +6,231 @@
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Online.h"
#include "OnlineSubsystem.h"
#include "OnlineFriendsInterface.h"
#include "OnlineUserInterface.h"
#include "OnlineMessageInterface.h"
#include "OnlinePresenceInterface.h"
#include "Interfaces/OnlineFriendsInterface.h"
#include "Interfaces/OnlineUserInterface.h"
#include "Interfaces/OnlineMessageInterface.h"
#include "Interfaces/OnlinePresenceInterface.h"
#include "Engine/GameInstance.h"
#include "OnlineSessionInterface.h"
#include "Interfaces/OnlineSessionInterface.h"
#include "BlueprintDataDefinitions.h"
#include "UObject/UObjectIterator.h"
#include "UObjectIterator.h"
// This is taken directly from UE4 - OnlineSubsystemSteamPrivatePCH.h as a fix for the array_count macro
// @todo Steam: Steam headers trigger secure-C-runtime warnings in Visual C++. Rather than mess with _CRT_SECURE_NO_WARNINGS, we'll just
// disable the warnings locally. Remove when this is fixed in the SDK
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4996)
// #TODO check back on this at some point
#pragma warning(disable:4265) // SteamAPI CCallback< specifically, this warning is off by default but 4.17 turned it on....
#endif
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
#pragma push_macro("ARRAY_COUNT")
#undef ARRAY_COUNT
#if USING_CODE_ANALYSIS
MSVC_PRAGMA(warning(push))
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
#endif // USING_CODE_ANALYSIS
#include <steam/steam_api.h>
#if USING_CODE_ANALYSIS
MSVC_PRAGMA(warning(pop))
#endif // USING_CODE_ANALYSIS
#include <steam/isteamapps.h>
//#include <steam/isteamapplist.h>
//#include <OnlineSubsystemSteamTypes.h>
#pragma pop_macro("ARRAY_COUNT")
// @todo Steam: See above
#ifdef _MSC_VER
#pragma warning(pop)
#endif
// Making a copy of this here since the original is still in a private folder and is screwing with things
/**
* Steam specific implementation of the unique net id
*/
class FUniqueNetIdSteam2 :
public FUniqueNetId
{
PACKAGE_SCOPE:
/** Holds the net id for a player */
uint64 UniqueNetId;
/** Hidden on purpose */
FUniqueNetIdSteam2() :
UniqueNetId(0)
{
}
/**
* Copy Constructor
*
* @param Src the id to copy
*/
explicit FUniqueNetIdSteam2(const FUniqueNetIdSteam2& Src) :
UniqueNetId(Src.UniqueNetId)
{
}
public:
/**
* Constructs this object with the specified net id
*
* @param InUniqueNetId the id to set ours to
*/
explicit FUniqueNetIdSteam2(uint64 InUniqueNetId) :
UniqueNetId(InUniqueNetId)
{
}
/**
* Constructs this object with the steam id
*
* @param InUniqueNetId the id to set ours to
*/
explicit FUniqueNetIdSteam2(CSteamID InSteamId) :
UniqueNetId(InSteamId.ConvertToUint64())
{
}
/**
* Constructs this object with the specified net id
*
* @param String textual representation of an id
*/
explicit FUniqueNetIdSteam2(const FString& Str) :
UniqueNetId(FCString::Atoi64(*Str))
{
}
/**
* Constructs this object with the specified net id
*
* @param InUniqueNetId the id to set ours to (assumed to be FUniqueNetIdSteam in fact)
*/
explicit FUniqueNetIdSteam2(const FUniqueNetId& InUniqueNetId) :
UniqueNetId(*(uint64*)InUniqueNetId.GetBytes())
{
}
virtual FName GetType() const override
{
return STEAM_SUBSYSTEM;
}
/**
* Get the raw byte representation of this net id
* This data is platform dependent and shouldn't be manipulated directly
*
* @return byte array of size GetSize()
*/
virtual const uint8* GetBytes() const override
{
return (uint8*)&UniqueNetId;
}
/**
* Get the size of the id
*
* @return size in bytes of the id representation
*/
virtual int32 GetSize() const override
{
return sizeof(uint64);
}
/**
* Check the validity of the id
*
* @return true if this is a well formed ID, false otherwise
*/
virtual bool IsValid() const override
{
return UniqueNetId != 0 && CSteamID(UniqueNetId).IsValid();
}
/**
* Platform specific conversion to string representation of data
*
* @return data in string form
*/
virtual FString ToString() const override
{
return FString::Printf(TEXT("%llu"), UniqueNetId);
}
/**
* Get a human readable representation of the net id
* Shouldn't be used for anything other than logging/debugging
*
* @return id in string form
*/
virtual FString ToDebugString() const override
{
CSteamID SteamID(UniqueNetId);
if (SteamID.IsLobby())
{
return FString::Printf(TEXT("Lobby [0x%llX]"), UniqueNetId);
}
else if (SteamID.BAnonGameServerAccount())
{
return FString::Printf(TEXT("Server [0x%llX]"), UniqueNetId);
}
else if (SteamID.IsValid())
{
const FString NickName(SteamFriends() ? UTF8_TO_TCHAR(SteamFriends()->GetFriendPersonaName(UniqueNetId)) : TEXT("UNKNOWN"));
return FString::Printf(TEXT("%s [0x%llX]"), *NickName, UniqueNetId);
}
else
{
return FString::Printf(TEXT("INVALID [0x%llX]"), UniqueNetId);
}
}
virtual uint32 GetTypeHash() const override
{
return ::GetTypeHash(UniqueNetId);
}
/** Convenience cast to CSteamID */
operator CSteamID()
{
return UniqueNetId;
}
/** Convenience cast to CSteamID */
operator const CSteamID() const
{
return UniqueNetId;
}
/** Convenience cast to CSteamID pointer */
operator CSteamID*()
{
return (CSteamID*)&UniqueNetId;
}
/** Convenience cast to CSteamID pointer */
operator const CSteamID*() const
{
return (const CSteamID*)&UniqueNetId;
}
friend FArchive& operator<<(FArchive& Ar, FUniqueNetIdSteam2& UserId)
{
return Ar << UserId.UniqueNetId;
}
};
#endif
#include "AdvancedSteamFriendsLibrary.generated.h"
@@ -24,11 +241,50 @@ DECLARE_LOG_CATEGORY_EXTERN(AdvancedSteamFriendsLog, Log, All);
UENUM(Blueprintable)
enum class SteamAvatarSize : uint8
{
SteamAvatar_INVALID = 0,
SteamAvatar_Small = 1,
SteamAvatar_Medium = 2,
SteamAvatar_Large = 3
};
UENUM(Blueprintable)
enum class ESteamUserOverlayType : uint8
{
/*Opens the overlay web browser to the specified user or groups profile.*/
steamid,
/*Opens a chat window to the specified user, or joins the group chat.*/
chat,
/*Opens a window to a Steam Trading session that was started with the ISteamEconomy / StartTrade Web API.*/
jointrade,
/*Opens the overlay web browser to the specified user's stats.*/
stats,
/*Opens the overlay web browser to the specified user's achievements.*/
achievements,
/*Opens the overlay in minimal mode prompting the user to add the target user as a friend.*/
friendadd,
/*Opens the overlay in minimal mode prompting the user to remove the target friend.*/
friendremove,
/*Opens the overlay in minimal mode prompting the user to accept an incoming friend invite.*/
friendrequestaccept,
/*Opens the overlay in minimal mode prompting the user to ignore an incoming friend invite.*/
friendrequestignore,
/*Opens the invite overlay, invitations sent from this dialog will be for the provided lobby*/
invitetolobby
};
static FString EnumToString(const FString& enumName, uint8 value)
{
const UEnum* EnumPtr = FindFirstObject<UEnum>(*enumName, EFindFirstObjectOptions::None, ELogVerbosity::Warning, TEXT("EumtoString"));
if (!EnumPtr)
return FString();
FString EnumName = EnumPtr->GetNameStringByIndex(value);
return EnumName;
}
USTRUCT(BlueprintType, Category = "Online|SteamAPI|SteamGroups")
struct FBPSteamGroupInfo
{
@@ -37,21 +293,32 @@ struct FBPSteamGroupInfo
public:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
FBPUniqueNetId GroupID; // Uint64 representation
FBPUniqueNetId GroupID; // Uint64 representation
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
FString GroupName;
FString GroupName;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
FString GroupTag;
FString GroupTag;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
int32 numOnline;
int32 numOnline = 0;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
int32 numInGame;
int32 numInGame = 0;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
int32 numChatting;
int32 numChatting = 0;
};
UENUM(Blueprintable)
enum class EBPTextFilteringContext : uint8
{
/*Unknown context.*/
FContext_Unknown = 0,
/*Game content, only legally required filtering is performed.*/
FContext_GameContent = 1,
/*Char from another player.*/
FContext_Chat = 2,
/*Character or item name.*/
FContext_Name = 3
};
UCLASS()
class UAdvancedSteamFriendsLibrary : public UBlueprintFunctionLibrary
@@ -69,6 +336,14 @@ public:
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
static bool RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly = false);
// Opens the steam overlay to go to the specified user dialog
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI", meta = (WorldContext = "WorldContextObject"))
static bool OpenSteamUserOverlay(UObject* WorldContextObject, const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType);
// Returns if the steam overlay is currently active (this can return false during initial overlay hooking)
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
static bool IsOverlayEnabled();
// Gets the level of a friends steam account, STEAM ONLY, Returns -1 if the steam level is not known, might need RequestSteamFriendInfo called first.
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI")
static int32 GetFriendSteamLevel(const FBPUniqueNetId UniqueNetId);
@@ -81,13 +356,34 @@ public:
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
static FBPUniqueNetId CreateSteamIDFromString(const FString SteamID64);
// Retreives the local steam ID from steam
UFUNCTION(BlueprintPure, Category = "Online|AdvancedFriends|SteamAPI")
static FBPUniqueNetId GetLocalSteamIDFromSteam();
/* Gets the current game played by a friend - AppID is int32 even though steam ids are uint32, can't be helped in blueprint currently
* The game name is retrieved from steamSDK AppList which isn't available to all game IDs without request, can use the AppID with the
* WebAPI GetAppList request as an alternative.
* can use the AppID with the WebAPI GetAppList request.
*/
UFUNCTION(BlueprintCallable, Category = "Online|AdvancedFriends|SteamAPI", meta = (ExpandEnumAsExecs = "Result"))
static void GetSteamFriendGamePlayed(const FBPUniqueNetId UniqueNetId, EBlueprintResultSwitch &Result, FString & GameName, int32 & AppID);
static void GetSteamFriendGamePlayed(const FBPUniqueNetId UniqueNetId, EBlueprintResultSwitch &Result/*, FString & GameName*/, int32 & AppID);
// Get a full list of steam groups
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|SteamGroups")
static void GetSteamGroups(TArray<FBPSteamGroupInfo> & SteamGroups);
// Initializes text filtering (pre-loading dictonaries)
// Returns if it succeeded, false if filtering is unavailable for the games language
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|TextFiltering")
static bool InitTextFiltering();
// Attempts to filter a string with the given filtering context
// Returns true if the text has been filtered, false if it hasn't (no filtering required or operation failed)
// If false it will still output the original text
// Textsource is the steam id that is the source of the text (player name / chat)
// Requires that InitTextFiltering be called first!!
UFUNCTION(BlueprintCallable, Category = "Online|SteamAPI|TextFiltering")
static bool FilterText(FString TextToFilter, EBPTextFilteringContext Context, const FBPUniqueNetId TextSourceID, FString& FilteredText);
// Returns if steam is running in big picture mode
UFUNCTION(BlueprintPure, Category = "Online|SteamAPI")
static bool IsSteamInBigPictureMode();
};

View File

@@ -1,7 +1,7 @@
#pragma once
#include "CoreMinimal.h"
#include "ModuleManager.h"
#include "Modules/ModuleManager.h"
class AdvancedSteamSessions : public IModuleInterface
{

View File

@@ -6,22 +6,38 @@
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Online.h"
#include "OnlineSubsystem.h"
#include "OnlineSessionInterface.h"
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
#include "steam/isteamugc.h"
#include "steam/isteamremotestorage.h"
#endif
#include "Interfaces/OnlineSessionInterface.h"
// @todo Steam: Steam headers trigger secure-C-runtime warnings in Visual C++. Rather than mess with _CRT_SECURE_NO_WARNINGS, we'll just
// disable the warnings locally. Remove when this is fixed in the SDK
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4996)
// #TODO check back on this at some point
#pragma warning(disable:4265) // SteamAPI CCallback< specifically, this warning is off by default but 4.17 turned it on....
#endif
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
#pragma push_macro("ARRAY_COUNT")
#undef ARRAY_COUNT
#if USING_CODE_ANALYSIS
MSVC_PRAGMA(warning(push))
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
#endif // USING_CODE_ANALYSIS
#include <steam/steam_api.h>
#if USING_CODE_ANALYSIS
MSVC_PRAGMA(warning(pop))
#endif // USING_CODE_ANALYSIS
#pragma pop_macro("ARRAY_COUNT")
#endif
@@ -67,6 +83,7 @@ public:
UENUM(BlueprintType)
enum class FBPSteamResult : uint8
{
K_EResultInvalid = 0,
k_EResultOK = 1, // success
k_EResultFail = 2, // generic failure
k_EResultNoConnection = 3, // no/failed network connection
@@ -191,11 +208,22 @@ struct FBPSteamWorkshopItemDetails
GENERATED_USTRUCT_BODY()
public:
FBPSteamWorkshopItemDetails()
{
ResultOfRequest = FBPSteamResult::k_EResultOK;
FileType = FBPWorkshopFileType::k_EWorkshopFileTypeMax;
CreatorAppID = 0;
ConsumerAppID = 0;
VotesUp = 0;
VotesDown = 0;
CalculatedScore = 0.f;
bBanned = false;
bAcceptedForUse = false;
bTagsTruncated = false;
}
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
FBPSteamWorkshopItemDetails(SteamUGCDetails_t &hUGCDetails)
{
ResultOfRequest = (FBPSteamResult)hUGCDetails.m_eResult;
@@ -215,6 +243,26 @@ public:
CreatorSteamID = FString::Printf(TEXT("%llu"), hUGCDetails.m_ulSteamIDOwner);
}
FBPSteamWorkshopItemDetails(const SteamUGCDetails_t &hUGCDetails)
{
ResultOfRequest = (FBPSteamResult)hUGCDetails.m_eResult;
FileType = (FBPWorkshopFileType)hUGCDetails.m_eFileType;
CreatorAppID = (int32)hUGCDetails.m_nCreatorAppID;
ConsumerAppID = (int32)hUGCDetails.m_nConsumerAppID;
Title = FString(hUGCDetails.m_rgchTitle, k_cchPublishedDocumentTitleMax);
Description = FString(hUGCDetails.m_rgchDescription, k_cchPublishedDocumentDescriptionMax);
ItemUrl = FString(hUGCDetails.m_rgchURL, k_cchPublishedFileURLMax);
VotesUp = (int32)hUGCDetails.m_unVotesUp;
VotesDown = (int32)hUGCDetails.m_unVotesDown;
CalculatedScore = hUGCDetails.m_flScore;
bBanned = hUGCDetails.m_bBanned;
bAcceptedForUse = hUGCDetails.m_bAcceptedForUse;
bTagsTruncated = hUGCDetails.m_bTagsTruncated;
CreatorSteamID = FString::Printf(TEXT("%llu"), hUGCDetails.m_ulSteamIDOwner);
}
#endif
// Result of obtaining the details
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|AdvancedSteamWorkshop")
FBPSteamResult ResultOfRequest;

View File

@@ -0,0 +1,101 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Subsystems/GameInstanceSubsystem.h"
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
#include <steam/steam_api.h>
#endif
#include "SteamNotificationsSubsystem.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSteamOverlayActivated, bool, bOverlayState);
UCLASS()
class ADVANCEDSTEAMSESSIONS_API USteamNotificationsSubsystem : public UGameInstanceSubsystem
{
GENERATED_BODY()
public:
// Event thrown when the steam overlay switches states
UPROPERTY(BlueprintAssignable, Category = "SteamEvents")
FOnSteamOverlayActivated OnSteamOverlayActivated_Bind;
USteamNotificationsSubsystem() : Super()
{
}
class cSteamEventsStore
{
public:
USteamNotificationsSubsystem* ParentSubsystem = nullptr;
void Initialize(USteamNotificationsSubsystem* MyParent)
{
ParentSubsystem = MyParent;
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
OnExternalUITriggeredCallback.Register(this, &USteamNotificationsSubsystem::cSteamEventsStore::OnExternalUITriggered);
#endif
}
void UnInitialize(USteamNotificationsSubsystem* MyParent)
{
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
OnExternalUITriggeredCallback.Unregister();
#endif
}
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
cSteamEventsStore()
{}
//:
/*OnExternalUITriggeredCallback(this, &cSteamEventsStore::OnExternalUITriggered)
{
}*/
#else
//cSteamEventsStore()
//{
//}
#endif
//~cSteamEventsStore(){}
private:
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
//STEAM_CALLBACK(cSteamEventsStore, OnExternalUITriggered, GameOverlayActivated_t, OnExternalUITriggeredCallback);
STEAM_CALLBACK_MANUAL(cSteamEventsStore, OnExternalUITriggered, GameOverlayActivated_t, OnExternalUITriggeredCallback);
#endif
};
cSteamEventsStore MyEvents;
/** Implement this for initialization of instances of the system */
virtual void Initialize(FSubsystemCollectionBase& Collection) override
{
MyEvents.Initialize(this);
}
/** Implement this for deinitialization of instances of the system */
virtual void Deinitialize() override
{
MyEvents.UnInitialize(this);
}
};
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
void USteamNotificationsSubsystem::cSteamEventsStore::OnExternalUITriggered(GameOverlayActivated_t* CallbackData)
{
if (ParentSubsystem)
{
ParentSubsystem->OnSteamOverlayActivated_Bind.Broadcast((bool)CallbackData->m_bActive);
}
}
#endif

View File

@@ -11,15 +11,29 @@
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4996)
// #TODO check back on this at some point
#pragma warning(disable:4265) // SteamAPI CCallback< specifically, this warning is off by default but 4.17 turned it on....
#endif
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
//#include "OnlineSubsystemSteam.h"
#pragma push_macro("ARRAY_COUNT")
#undef ARRAY_COUNT
#if USING_CODE_ANALYSIS
MSVC_PRAGMA(warning(push))
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
#endif // USING_CODE_ANALYSIS
#include <steam/steam_api.h>
#if USING_CODE_ANALYSIS
MSVC_PRAGMA(warning(pop))
#endif // USING_CODE_ANALYSIS
#pragma pop_macro("ARRAY_COUNT")
#endif
@@ -41,7 +55,7 @@ public:
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
FBPUniqueNetId OfficerUniqueNetID; // Uint64 representation
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Online|SteamAPI|SteamGroups")
bool bIsOwner;
bool bIsOwner = false;
};
@@ -53,6 +67,8 @@ class USteamRequestGroupOfficersCallbackProxy : public UOnlineBlueprintCallProxy
{
GENERATED_UCLASS_BODY()
virtual ~USteamRequestGroupOfficersCallbackProxy();
// Called when there is a successful results return
UPROPERTY(BlueprintAssignable)
FBlueprintGroupOfficerDetailsDelegate OnSuccess;
@@ -61,7 +77,7 @@ class USteamRequestGroupOfficersCallbackProxy : public UOnlineBlueprintCallProxy
UPROPERTY(BlueprintAssignable)
FBlueprintGroupOfficerDetailsDelegate OnFailure;
// Retruns a list of steam group officers
// Returns a list of steam group officers
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject"), Category = "Online|SteamAPI|SteamGroups")
static USteamRequestGroupOfficersCallbackProxy* GetSteamGroupOfficerList(UObject* WorldContextObject, FBPUniqueNetId GroupUniqueNetID);
@@ -71,9 +87,10 @@ class USteamRequestGroupOfficersCallbackProxy : public UOnlineBlueprintCallProxy
private:
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
void OnRequestGroupOfficerDetails( ClanOfficerListResponse_t *pResult, bool bIOFailure);
CCallResult<USteamRequestGroupOfficersCallbackProxy, ClanOfficerListResponse_t> m_callResultGroupOfficerRequestDetails;
#endif
private:

View File

@@ -12,15 +12,29 @@
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4996)
// #TODO check back on this at some point
#pragma warning(disable:4265) // SteamAPI CCallback< specifically, this warning is off by default but 4.17 turned it on....
#endif
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
//#include "OnlineSubsystemSteam.h"
#pragma push_macro("ARRAY_COUNT")
#undef ARRAY_COUNT
#if USING_CODE_ANALYSIS
MSVC_PRAGMA(warning(push))
MSVC_PRAGMA(warning(disable : ALL_CODE_ANALYSIS_WARNINGS))
#endif // USING_CODE_ANALYSIS
#include <steam/steam_api.h>
#if USING_CODE_ANALYSIS
MSVC_PRAGMA(warning(pop))
#endif // USING_CODE_ANALYSIS
#pragma pop_macro("ARRAY_COUNT")
#endif
@@ -30,6 +44,7 @@
#pragma warning(pop)
#endif
#include "SteamWSRequestUGCDetailsCallbackProxy.generated.h"
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FBlueprintWorkshopDetailsDelegate, const FBPSteamWorkshopItemDetails&, WorkShopDetails);
@@ -57,7 +72,7 @@ class USteamWSRequestUGCDetailsCallbackProxy : public UOnlineBlueprintCallProxyB
private:
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
// Internal callback when the operation completes, calls out to the public success/failure callbacks
void OnUGCRequestUGCDetails(SteamUGCQueryCompleted_t *pResult, bool bIOFailure);

View File

@@ -1,33 +1,11 @@
// Fill out your copyright notice in the Description page of Project Settings.
#include "AdvancedSteamFriendsLibrary.h"
#include "OnlineSubSystemHeader.h"
// This is taken directly from UE4 - OnlineSubsystemSteamPrivatePCH.h as a fix for the array_count macro
// @todo Steam: Steam headers trigger secure-C-runtime warnings in Visual C++. Rather than mess with _CRT_SECURE_NO_WARNINGS, we'll just
// disable the warnings locally. Remove when this is fixed in the SDK
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4996)
#endif
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#pragma push_macro("ARRAY_COUNT")
#undef ARRAY_COUNT
#include <steam/steam_api.h>
#include <steam/isteamapps.h>
#include <steam/isteamapplist.h>
#include <OnlineSubsystemSteamTypes.h>
#pragma pop_macro("ARRAY_COUNT")
#endif
// @todo Steam: See above
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#include "OnlineSubsystemTypes.h"
#include "Engine/Texture.h"
#include "Engine/Texture2D.h"
#include "TextureResource.h"
#include "PixelFormat.h"
//General Log
DEFINE_LOG_CATEGORY(AdvancedSteamFriendsLog);
@@ -37,8 +15,8 @@ DEFINE_LOG_CATEGORY(AdvancedSteamFriendsLog);
/*int32 UAdvancedSteamFriendsLibrary::GetFriendSteamLevel(const FBPUniqueNetId UniqueNetId)
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("IsAFriend Had a bad UniqueNetId!"));
return 0;
@@ -85,7 +63,8 @@ DEFINE_LOG_CATEGORY(AdvancedSteamFriendsLog);
void UAdvancedSteamFriendsLibrary::GetSteamGroups(TArray<FBPSteamGroupInfo> & SteamGroups)
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (SteamAPI_Init())
{
@@ -100,7 +79,7 @@ void UAdvancedSteamFriendsLibrary::GetSteamGroups(TArray<FBPSteamGroupInfo> & St
FBPSteamGroupInfo GroupInfo;
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam(SteamGroupID));
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam2(SteamGroupID));
GroupInfo.GroupID.SetUniqueNetId(ValueID);
SteamFriends()->GetClanActivityCounts(SteamGroupID, &GroupInfo.numOnline, &GroupInfo.numInGame, &GroupInfo.numChatting);
GroupInfo.GroupName = FString(UTF8_TO_TCHAR(SteamFriends()->GetClanName(SteamGroupID)));
@@ -110,13 +89,14 @@ void UAdvancedSteamFriendsLibrary::GetSteamGroups(TArray<FBPSteamGroupInfo> & St
}
}
#endif
}
void UAdvancedSteamFriendsLibrary::GetSteamFriendGamePlayed(const FBPUniqueNetId UniqueNetId, EBlueprintResultSwitch &Result, FString & GameName, int32 & AppID)
void UAdvancedSteamFriendsLibrary::GetSteamFriendGamePlayed(const FBPUniqueNetId UniqueNetId, EBlueprintResultSwitch &Result/*, FString & GameName*/, int32 & AppID)
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("GetSteamFriendGamePlayed Had a bad UniqueNetId!"));
Result = EBlueprintResultSwitch::OnFailure;
@@ -134,13 +114,15 @@ void UAdvancedSteamFriendsLibrary::GetSteamFriendGamePlayed(const FBPUniqueNetId
{
AppID = GameInfo.m_gameID.AppID();
char NameBuffer[512];
// Forgot this test and left it in, it is incorrect, you would need restricted access
// And it would only find games in the local library anyway
/*char NameBuffer[512];
int Len = SteamAppList()->GetAppName(GameInfo.m_gameID.AppID(), NameBuffer, 512);
if (Len != -1) // Invalid
{
GameName = FString(UTF8_TO_TCHAR(NameBuffer));
}
}*/
Result = EBlueprintResultSwitch::OnSuccess;
return;
@@ -155,8 +137,8 @@ void UAdvancedSteamFriendsLibrary::GetSteamFriendGamePlayed(const FBPUniqueNetId
int32 UAdvancedSteamFriendsLibrary::GetFriendSteamLevel(const FBPUniqueNetId UniqueNetId)
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("IsAFriend Had a bad UniqueNetId!"));
return 0;
@@ -176,8 +158,8 @@ int32 UAdvancedSteamFriendsLibrary::GetFriendSteamLevel(const FBPUniqueNetId Uni
FString UAdvancedSteamFriendsLibrary::GetSteamPersonaName(const FBPUniqueNetId UniqueNetId)
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("GetSteamPersonaName Had a bad UniqueNetId!"));
return FString(TEXT(""));
@@ -198,7 +180,7 @@ FBPUniqueNetId UAdvancedSteamFriendsLibrary::CreateSteamIDFromString(const FStri
{
FBPUniqueNetId netId;
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (!(SteamID64.Len() > 0))
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("CreateSteamIDFromString Had a bad UniqueNetId!"));
@@ -208,7 +190,7 @@ FBPUniqueNetId UAdvancedSteamFriendsLibrary::CreateSteamIDFromString(const FStri
if (SteamAPI_Init())
{
// Already does the conversion
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam(SteamID64));
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam2(SteamID64));
//FCString::Atoi64(*SteamID64));
netId.SetUniqueNetId(ValueID);
@@ -219,10 +201,25 @@ FBPUniqueNetId UAdvancedSteamFriendsLibrary::CreateSteamIDFromString(const FStri
return netId;
}
FBPUniqueNetId UAdvancedSteamFriendsLibrary::GetLocalSteamIDFromSteam()
{
FBPUniqueNetId netId;
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (SteamAPI_Init())
{
TSharedPtr<const FUniqueNetId> SteamID(new const FUniqueNetIdSteam2(SteamUser()->GetSteamID()));
netId.SetUniqueNetId(SteamID);
}
#endif
return netId;
}
bool UAdvancedSteamFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId UniqueNetId, bool bRequireNameOnly)
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("RequestSteamFriendInfo Had a bad UniqueNetId!"));
return false;
@@ -240,10 +237,64 @@ bool UAdvancedSteamFriendsLibrary::RequestSteamFriendInfo(const FBPUniqueNetId U
return false;
}
bool UAdvancedSteamFriendsLibrary::OpenSteamUserOverlay(UObject* WorldContextObject,const FBPUniqueNetId UniqueNetId, ESteamUserOverlayType DialogType)
{
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("OpenSteamUserOverlay Had a bad UniqueNetId!"));
return false;
}
if (SteamAPI_Init())
{
if (DialogType == ESteamUserOverlayType::invitetolobby)
{
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
IOnlineSessionPtr SessionInterface = Online::GetSessionInterface(World);
if (SessionInterface.IsValid())
{
FNamedOnlineSession* CurrentSession = SessionInterface->GetNamedSession(NAME_GameSession);
if (CurrentSession && CurrentSession->SessionInfo->GetSessionId().IsValid())
{
uint64 id = *((uint64*)CurrentSession->SessionInfo->GetSessionId().GetBytes());
SteamFriends()->ActivateGameOverlayInviteDialog(id);
}
}
}
else
{
uint64 id = *((uint64*)UniqueNetId.UniqueNetId->GetBytes());
FString DialogName = EnumToString("ESteamUserOverlayType", (uint8)DialogType);
SteamFriends()->ActivateGameOverlayToUser(TCHAR_TO_ANSI(*DialogName), id);
}
return true;
}
#endif
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("OpenSteamUserOverlay Couldn't init steamAPI!"));
return false;
}
bool UAdvancedSteamFriendsLibrary::IsOverlayEnabled()
{
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (SteamAPI_Init())
{
return SteamUtils()->IsOverlayEnabled();
}
#endif
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("OpenSteamUserOverlay Couldn't init steamAPI!"));
return false;
}
UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueNetId UniqueNetId, EBlueprintAsyncResultSwitch &Result, SteamAvatarSize AvatarSize)
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid())
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (!UniqueNetId.IsValid() || !UniqueNetId.UniqueNetId->IsValid() || UniqueNetId.UniqueNetId->GetType() != STEAM_SUBSYSTEM)
{
UE_LOG(AdvancedSteamFriendsLog, Warning, TEXT("GetSteamFriendAvatar Had a bad UniqueNetId!"));
Result = EBlueprintAsyncResultSwitch::OnFailure;
@@ -304,19 +355,22 @@ UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueN
UTexture2D* Avatar = UTexture2D::CreateTransient(Width, Height, PF_R8G8B8A8);
// Switched to a Memcpy instead of byte by byte transer
uint8* MipData = (uint8*)Avatar->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
FMemory::Memcpy(MipData, (void*)oAvatarRGBA, Height * Width * 4);
Avatar->PlatformData->Mips[0].BulkData.Unlock();
// Original implementation was missing this!!
// the hell man......
if (FTexturePlatformData* PlatformData = Avatar->GetPlatformData())
{
uint8* MipData = (uint8*)PlatformData->Mips[0].BulkData.Lock(LOCK_READ_WRITE);
FMemory::Memcpy(MipData, (void*)oAvatarRGBA, Height * Width * 4);
PlatformData->Mips[0].BulkData.Unlock();
//Setting some Parameters for the Texture and finally returning it
PlatformData->SetNumSlices(1);
Avatar->NeverStream = true;
//Avatar->CompressionSettings = TC_EditorIcon;
}
// Free RGBA buffer regardless of whether it was used or not
delete[] oAvatarRGBA;
//Setting some Parameters for the Texture and finally returning it
Avatar->PlatformData->NumSlices = 1;
Avatar->NeverStream = true;
//Avatar->CompressionSettings = TC_EditorIcon;
Avatar->UpdateResource();
Result = EBlueprintAsyncResultSwitch::OnSuccess;
@@ -336,3 +390,65 @@ UTexture2D * UAdvancedSteamFriendsLibrary::GetSteamFriendAvatar(const FBPUniqueN
Result = EBlueprintAsyncResultSwitch::OnFailure;
return nullptr;
}
bool UAdvancedSteamFriendsLibrary::InitTextFiltering()
{
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (SteamAPI_Init())
{
return SteamUtils()->InitFilterText();
}
#endif
return false;
}
bool UAdvancedSteamFriendsLibrary::FilterText(FString TextToFilter, EBPTextFilteringContext Context, const FBPUniqueNetId TextSourceID, FString& FilteredText)
{
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (SteamAPI_Init())
{
uint32 BufferLen = TextToFilter.Len() + 10; // Docs say 1 byte excess min, going with 10
char* OutText = new char[BufferLen];
uint64 id = 0;
if (TextSourceID.IsValid())
{
id = *((uint64*)TextSourceID.UniqueNetId->GetBytes());
}
int FilterCount = SteamUtils()->FilterText((ETextFilteringContext)Context, id, TCHAR_TO_ANSI(*TextToFilter), OutText, BufferLen);
if (FilterCount > 0)
{
FilteredText = FString(UTF8_TO_TCHAR(OutText));
delete[] OutText;
return true;
}
delete[] OutText;
}
#endif
FilteredText = TextToFilter;
return false;
}
bool UAdvancedSteamFriendsLibrary::IsSteamInBigPictureMode()
{
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (SteamAPI_Init())
{
return SteamUtils()->IsSteamInBigPictureMode();
}
#endif
return false;
}

View File

@@ -8,7 +8,7 @@ DEFINE_LOG_CATEGORY(AdvancedSteamWorkshopLog);
void UAdvancedSteamWorkshopLibrary::GetNumSubscribedWorkshopItems(int32 & NumberOfItems)
{
NumberOfItems = 0;
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (SteamAPI_Init())
{
@@ -20,10 +20,10 @@ void UAdvancedSteamWorkshopLibrary::GetNumSubscribedWorkshopItems(int32 & Number
UE_LOG(AdvancedSteamWorkshopLog, Warning, TEXT("Error in GetNumSubscribedWorkshopItemCount : SteamAPI is not Inited!"));
return;
}
#endif
#else
UE_LOG(AdvancedSteamWorkshopLog, Warning, TEXT("Error in GetNumSubscribedWorkshopItemCount : Called on an incompatible platform"));
return;
#endif
}
TArray<FBPSteamWorkshopID> UAdvancedSteamWorkshopLibrary::GetSubscribedWorkshopItems(int32 & NumberOfItems)
@@ -31,7 +31,7 @@ TArray<FBPSteamWorkshopID> UAdvancedSteamWorkshopLibrary::GetSubscribedWorkshopI
TArray<FBPSteamWorkshopID> outArray;
NumberOfItems = 0;
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (SteamAPI_Init())
{
@@ -62,8 +62,8 @@ TArray<FBPSteamWorkshopID> UAdvancedSteamWorkshopLibrary::GetSubscribedWorkshopI
UE_LOG(AdvancedSteamWorkshopLog, Warning, TEXT("Error in GetSubscribedWorkshopItemCount : SteamAPI is not Inited!"));
return outArray;
}
#endif
#else
UE_LOG(AdvancedSteamWorkshopLog, Warning, TEXT("Error in GetSubscribedWorkshopItemCount : Called on an incompatible platform"));
return outArray;
#endif
}

View File

@@ -1,7 +1,13 @@
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#include "SteamRequestGroupOfficersCallbackProxy.h"
#include "Online/CoreOnline.h"
#include "AdvancedSteamFriendsLibrary.h"
#include "OnlineSubSystemHeader.h"
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
#include "steam/isteamfriends.h"
#endif
//#include "OnlineSubsystemSteamTypes.h"
//////////////////////////////////////////////////////////////////////////
// UEndSessionCallbackProxy
@@ -11,6 +17,9 @@ USteamRequestGroupOfficersCallbackProxy::USteamRequestGroupOfficersCallbackProxy
{
}
USteamRequestGroupOfficersCallbackProxy::~USteamRequestGroupOfficersCallbackProxy()
{
}
USteamRequestGroupOfficersCallbackProxy* USteamRequestGroupOfficersCallbackProxy::GetSteamGroupOfficerList(UObject* WorldContextObject, FBPUniqueNetId GroupUniqueNetID)
{
@@ -22,7 +31,7 @@ USteamRequestGroupOfficersCallbackProxy* USteamRequestGroupOfficersCallbackProxy
void USteamRequestGroupOfficersCallbackProxy::Activate()
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (SteamAPI_Init())
{
uint64 id = *((uint64*)GroupUniqueID.UniqueNetId->GetBytes());
@@ -36,15 +45,24 @@ void USteamRequestGroupOfficersCallbackProxy::Activate()
OnFailure.Broadcast(EmptyArray);
}
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanOfficerListResponse_t *pResult, bool bIOFailure)
{
TArray<FBPSteamGroupOfficer> OfficerArray;
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
//FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM));
if (bIOFailure || !pResult || !pResult->m_bSuccess)
{
OnFailure.Broadcast(OfficerArray);
//if (SteamSubsystem != nullptr)
{
// SteamSubsystem->ExecuteNextTick([this]()
//{
TArray<FBPSteamGroupOfficer> FailureArray;
OnFailure.Broadcast(FailureArray);
//});
}
//OnFailure.Broadcast(OfficerArray);
return;
}
@@ -57,7 +75,7 @@ void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanO
Officer.bIsOwner = true;
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam(ClanOwner));
TSharedPtr<const FUniqueNetId> ValueID(new const FUniqueNetIdSteam2(ClanOwner));
Officer.OfficerUniqueNetID.SetUniqueNetId(ValueID);
OfficerArray.Add(Officer);
@@ -67,17 +85,37 @@ void USteamRequestGroupOfficersCallbackProxy::OnRequestGroupOfficerDetails(ClanO
Officer.bIsOwner = false;
TSharedPtr<const FUniqueNetId> newValueID(new const FUniqueNetIdSteam(OfficerSteamID));
TSharedPtr<const FUniqueNetId> newValueID(new const FUniqueNetIdSteam2(OfficerSteamID));
Officer.OfficerUniqueNetID.SetUniqueNetId(newValueID);
OfficerArray.Add(Officer);
}
OnSuccess.Broadcast(OfficerArray);
//if (SteamSubsystem != nullptr)
//{
//SteamSubsystem->ExecuteNextTick([OfficerArray, this]()
//{
OnSuccess.Broadcast(OfficerArray);
//});
//}
//OnSuccess.Broadcast(OfficerArray);
return;
}
else
{
//if (SteamSubsystem != nullptr)
{
//SteamSubsystem->ExecuteNextTick([this]()
//{
TArray<FBPSteamGroupOfficer> FailureArray;
OnFailure.Broadcast(FailureArray);
//});
}
}
// Should never hit this anyway
//OnFailure.Broadcast(OfficerArray);
}
#endif
OnFailure.Broadcast(OfficerArray);
}

View File

@@ -2,6 +2,9 @@
#include "SteamWSRequestUGCDetailsCallbackProxy.h"
#include "OnlineSubSystemHeader.h"
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
#include "steam/isteamugc.h"
#endif
//////////////////////////////////////////////////////////////////////////
// UEndSessionCallbackProxy
@@ -22,7 +25,7 @@ USteamWSRequestUGCDetailsCallbackProxy* USteamWSRequestUGCDetailsCallbackProxy::
void USteamWSRequestUGCDetailsCallbackProxy::Activate()
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
if (SteamAPI_Init())
{
// #TODO: Support arrays instead in the future?
@@ -46,13 +49,21 @@ void USteamWSRequestUGCDetailsCallbackProxy::Activate()
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
}
#if (PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX) && STEAM_SDK_INSTALLED
void USteamWSRequestUGCDetailsCallbackProxy::OnUGCRequestUGCDetails(SteamUGCQueryCompleted_t *pResult, bool bIOFailure)
{
#if PLATFORM_WINDOWS || PLATFORM_MAC || PLATFORM_LINUX
//FOnlineSubsystemSteam* SteamSubsystem = (FOnlineSubsystemSteam*)(IOnlineSubsystem::Get(STEAM_SUBSYSTEM));
if (bIOFailure || !pResult || pResult->m_unNumResultsReturned <= 0)
{
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
//if (SteamSubsystem != nullptr)
{
// SteamSubsystem->ExecuteNextTick([this]()
//{
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
//});
}
//OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
return;
}
if (SteamAPI_Init())
@@ -60,12 +71,31 @@ void USteamWSRequestUGCDetailsCallbackProxy::OnUGCRequestUGCDetails(SteamUGCQuer
SteamUGCDetails_t Details;
if (SteamUGC()->GetQueryUGCResult(pResult->m_handle, 0, &Details))
{
OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details));
//if (SteamSubsystem != nullptr)
{
//SteamSubsystem->ExecuteNextTick([Details, this]()
//{
OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details));
//});
}
//OnSuccess.Broadcast(FBPSteamWorkshopItemDetails(Details));
return;
}
}
else
{
//if (SteamSubsystem != nullptr)
{
//SteamSubsystem->ExecuteNextTick([this]()
//{
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
//});
}
}
// Not needed, should never hit here
//OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
}
#endif
OnFailure.Broadcast(FBPSteamWorkshopItemDetails());
}

View File

@@ -1 +1,7 @@
Readme and documentation will be worked on soon
### How do I use it? ###
**KantanDocGen Automatic Documentation ([KantanDocGen](http://kantandev.com/free/kantan-doc-gen))**
**[AdvancedSessions](https://vreue4.com/generated-node-documentation?section=advanced-sessions-plugin)**
**[AdvancedSteamSessions](https://vreue4.com/generated-node-documentation?section=advanced-steam-sessions-plugin)**