Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
ARNOBeta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ar-noc
ARNOBeta
Commits
5323d637
Commit
5323d637
authored
2 years ago
by
Giovanni Vindiola
Browse files
Options
Downloads
Patches
Plain Diff
Updated arnocMainGameModeBase
parent
9e3322a9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Source/arnocMain/arnocMainGameModeBase.cpp
+79
-0
79 additions, 0 deletions
Source/arnocMain/arnocMainGameModeBase.cpp
Source/arnocMain/arnocMainGameModeBase.h
+2
-0
2 additions, 0 deletions
Source/arnocMain/arnocMainGameModeBase.h
with
81 additions
and
0 deletions
Source/arnocMain/arnocMainGameModeBase.cpp
+
79
−
0
View file @
5323d637
...
@@ -159,6 +159,85 @@ void AarnocMainGameModeBase::RegisterExistingPlayers()
...
@@ -159,6 +159,85 @@ void AarnocMainGameModeBase::RegisterExistingPlayers()
bExistingPlayersRegistered
=
true
;
bExistingPlayersRegistered
=
true
;
}
}
void
AarnocMainGameModeBase
::
Logout
(
AController
*
Exiting
)
{
if
(
!
IsValid
(
Exiting
))
{
return
;
}
APlayerController
*
PC
=
Cast
<
APlayerController
>
(
Exiting
);
if
(
!
IsValid
(
PC
))
{
return
;
}
if
(
!
PC
->
IsLocalPlayerController
()
||
!
IsValid
(
PC
->
Player
))
{
return
;
}
UNetConnection
*
PCNet
=
Cast
<
UNetConnection
>
(
PC
->
Player
);
if
(
!
IsValid
(
PCNet
)
||
!
PCNet
->
PlayerId
.
IsValid
())
{
return
;
}
TSharedRef
<
const
FUniqueNetId
>
UserId
=
GetControllerUniqueNetId
(
PC
).
ToSharedRef
();
IOnlineSubsystem
*
Subsystem
=
Online
::
GetSubsystem
(
this
->
GetWorld
());
TSharedPtr
<
IOnlineIdentity
,
ESPMode
::
ThreadSafe
>
Identity
=
Subsystem
->
GetIdentityInterface
();
TSharedPtr
<
IOnlineVoiceAdmin
,
ESPMode
::
ThreadSafe
>
VoiceAdmin
=
Online
::
GetVoiceAdminInterface
(
Subsystem
);
// Get the online session interface.
IOnlineSessionPtr
Session
=
Subsystem
->
GetSessionInterface
();
// You'll need to use the same channel as when you issued credentials in the first place.
FString
ChannelName
=
Session
->
GetNamedSession
(
"MyLocalSessionName"
)
->
GetSessionIdStr
();
VoiceAdmin
->
KickParticipant
(
*
Identity
->
GetUniquePlayerId
(
0
),
// This will get the "dedicated server" ID.
ChannelName
,
*
UserId
,
FOnVoiceAdminKickParticipantComplete
::
CreateLambda
([](
const
FOnlineError
&
Result
,
const
FUniqueNetId
&
LocalUserId
,
const
FUniqueNetId
&
TargetUserId
)
{
if
(
!
Result
.
WasSuccessful
())
{
// User couldn't be kicked. They've already left the server at this point, so
// all you can really do is log the error.
}
}));
// This must be at the end, or the player's unique net ID will have been unset.
Super
::
Logout
(
Exiting
);
}
TSharedPtr
<
const
FUniqueNetId
>
AarnocMainGameModeBase
::
GetControllerUniqueNetId
(
APlayerController
*
InPlayerController
)
{
if
(
!
IsValid
(
InPlayerController
))
{
return
nullptr
;
}
if
(
InPlayerController
->
IsLocalPlayerController
())
{
ULocalPlayer
*
LocalPlayer
=
InPlayerController
->
GetLocalPlayer
();
if
(
IsValid
(
LocalPlayer
))
{
return
LocalPlayer
->
GetPreferredUniqueNetId
().
GetUniqueNetId
();
}
}
UNetConnection
*
RemoteNetConnection
=
Cast
<
UNetConnection
>
(
InPlayerController
->
Player
);
if
(
IsValid
(
RemoteNetConnection
))
{
return
RemoteNetConnection
->
PlayerId
.
GetUniqueNetId
();
}
UE_LOG
(
LogTemp
,
Error
,
TEXT
(
"Player controller does not have a valid remote network connection"
));
return
nullptr
;
}
void
AarnocMainGameModeBase
::
IssuedCredentialsForPlayer
(
const
FOnlineError
&
Result
,
const
FUniqueNetId
&
LocalUserId
,
void
AarnocMainGameModeBase
::
IssuedCredentialsForPlayer
(
const
FOnlineError
&
Result
,
const
FUniqueNetId
&
LocalUserId
,
const
TArray
<
FVoiceAdminChannelCredentials
>&
Credentials
,
FString
InChannelName
,
AARNOPlayerController
*
NewPlayer
)
const
TArray
<
FVoiceAdminChannelCredentials
>&
Credentials
,
FString
InChannelName
,
AARNOPlayerController
*
NewPlayer
)
{
{
...
...
This diff is collapsed.
Click to expand it.
Source/arnocMain/arnocMainGameModeBase.h
+
2
−
0
View file @
5323d637
...
@@ -24,6 +24,8 @@ public:
...
@@ -24,6 +24,8 @@ public:
virtual
void
PostLogin
(
APlayerController
*
NewPlayer
)
override
;
virtual
void
PostLogin
(
APlayerController
*
NewPlayer
)
override
;
void
RegisterExistingPlayers
();
void
RegisterExistingPlayers
();
virtual
void
Logout
(
AController
*
Exiting
)
override
;
TSharedPtr
<
const
FUniqueNetId
>
GetControllerUniqueNetId
(
APlayerController
*
InPlayerController
);
private:
private:
bool
bExistingPlayersRegistered
;
bool
bExistingPlayersRegistered
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment