205 - Leaving the Game
This commit is contained in:
parent
30e976772f
commit
ca24ebf39e
|
@ -85,6 +85,8 @@ DoubleClickTime=0.200000
|
||||||
+ActionMappings=(ActionName="Fire",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton)
|
+ActionMappings=(ActionName="Fire",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton)
|
||||||
+ActionMappings=(ActionName="Reload",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=R)
|
+ActionMappings=(ActionName="Reload",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=R)
|
||||||
+ActionMappings=(ActionName="ThrowGrenade",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=G)
|
+ActionMappings=(ActionName="ThrowGrenade",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=G)
|
||||||
|
+ActionMappings=(ActionName="Quit",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Escape)
|
||||||
|
+ActionMappings=(ActionName="Quit",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Q)
|
||||||
+AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=W)
|
+AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=W)
|
||||||
+AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=S)
|
+AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=S)
|
||||||
+AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=D)
|
+AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=D)
|
||||||
|
|
Binary file not shown.
|
@ -24,7 +24,7 @@ void UReturnToMainMenu::MenuSetup()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ReturnButton)
|
if (ReturnButton && !ReturnButton->OnClicked.IsBound())
|
||||||
{
|
{
|
||||||
ReturnButton->OnClicked.AddDynamic(this, &UReturnToMainMenu::ReturnButtonClicked);
|
ReturnButton->OnClicked.AddDynamic(this, &UReturnToMainMenu::ReturnButtonClicked);
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,14 @@ void UReturnToMainMenu::MenuTearDown()
|
||||||
PlayerController->SetShowMouseCursor(false);
|
PlayerController->SetShowMouseCursor(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (ReturnButton && ReturnButton->OnClicked.IsBound())
|
||||||
|
{
|
||||||
|
ReturnButton->OnClicked.RemoveDynamic(this, &UReturnToMainMenu::ReturnButtonClicked);
|
||||||
|
}
|
||||||
|
if (MultiplayerSessionsSubsystem && MultiplayerSessionsSubsystem->MultiplayerOnDestroySessionComplete.IsBound())
|
||||||
|
{
|
||||||
|
MultiplayerSessionsSubsystem->MultiplayerOnDestroySessionComplete.RemoveDynamic(this, &UReturnToMainMenu::OnDestroySessionComplete);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UReturnToMainMenu::ReturnButtonClicked()
|
void UReturnToMainMenu::ReturnButtonClicked()
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "Blaster/HUD/BlasterHUD.h"
|
#include "Blaster/HUD/BlasterHUD.h"
|
||||||
#include "Blaster/HUD/CharacterOverlay.h"
|
#include "Blaster/HUD/CharacterOverlay.h"
|
||||||
#include "Blaster/HUD/DebugWidget.h"
|
#include "Blaster/HUD/DebugWidget.h"
|
||||||
|
#include "Blaster/HUD/ReturnToMainMenu.h"
|
||||||
#include "Blaster/PlayerState/BlasterPlayerState.h"
|
#include "Blaster/PlayerState/BlasterPlayerState.h"
|
||||||
#include "Components/ProgressBar.h"
|
#include "Components/ProgressBar.h"
|
||||||
#include "Components/TextBlock.h"
|
#include "Components/TextBlock.h"
|
||||||
|
@ -27,6 +28,15 @@ void ABlasterPlayerController::BeginPlay()
|
||||||
ServerCheckMatchState();
|
ServerCheckMatchState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ABlasterPlayerController::SetupInputComponent()
|
||||||
|
{
|
||||||
|
Super::SetupInputComponent();
|
||||||
|
|
||||||
|
if (InputComponent == nullptr) return;
|
||||||
|
|
||||||
|
InputComponent->BindAction("Quit", IE_Pressed, this, &ABlasterPlayerController::ShowReturnToMainMenu);
|
||||||
|
}
|
||||||
|
|
||||||
void ABlasterPlayerController::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
|
void ABlasterPlayerController::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
|
||||||
{
|
{
|
||||||
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
||||||
|
@ -70,7 +80,6 @@ void ABlasterPlayerController::CheckPing(float DeltaTime)
|
||||||
PlayerState = PlayerState == nullptr ? GetPlayerState<APlayerState>() : PlayerState;
|
PlayerState = PlayerState == nullptr ? GetPlayerState<APlayerState>() : PlayerState;
|
||||||
if (PlayerState)
|
if (PlayerState)
|
||||||
{
|
{
|
||||||
UE_LOG(LogTemp, Warning, TEXT("Ping: %f"), PlayerState->GetPingInMilliseconds());
|
|
||||||
if (PlayerState->GetPingInMilliseconds() > HighPingThreshold)
|
if (PlayerState->GetPingInMilliseconds() > HighPingThreshold)
|
||||||
{
|
{
|
||||||
HighPingWarning();
|
HighPingWarning();
|
||||||
|
@ -468,6 +477,28 @@ void ABlasterPlayerController::StopHighPingWarning()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ABlasterPlayerController::ShowReturnToMainMenu()
|
||||||
|
{
|
||||||
|
if (ReturnToMainMenuWidget == nullptr) return;
|
||||||
|
|
||||||
|
if (ReturnToMainMenu == nullptr)
|
||||||
|
{
|
||||||
|
ReturnToMainMenu = CreateWidget<UReturnToMainMenu>(this, ReturnToMainMenuWidget);
|
||||||
|
}
|
||||||
|
if (ReturnToMainMenu)
|
||||||
|
{
|
||||||
|
bReturnToMainMenuOpen = !bReturnToMainMenuOpen;
|
||||||
|
if (bReturnToMainMenuOpen)
|
||||||
|
{
|
||||||
|
ReturnToMainMenu->MenuSetup();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ReturnToMainMenu->MenuTearDown();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ABlasterPlayerController::ServerRequestServerTime_Implementation(float TimeOfClientRequest)
|
void ABlasterPlayerController::ServerRequestServerTime_Implementation(float TimeOfClientRequest)
|
||||||
{
|
{
|
||||||
float ServerTimeOfReceipt = GetWorld()->GetTimeSeconds();
|
float ServerTimeOfReceipt = GetWorld()->GetTimeSeconds();
|
||||||
|
|
|
@ -52,7 +52,7 @@ public:
|
||||||
FHighPingDelegate HighPingDelegate;
|
FHighPingDelegate HighPingDelegate;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void SetupInputComponent() override;
|
||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
void CheckTimeSync(float DeltaTime);
|
void CheckTimeSync(float DeltaTime);
|
||||||
void HandleMatchHasStarted();
|
void HandleMatchHasStarted();
|
||||||
|
@ -85,14 +85,26 @@ protected:
|
||||||
|
|
||||||
void HighPingWarning();
|
void HighPingWarning();
|
||||||
void StopHighPingWarning();
|
void StopHighPingWarning();
|
||||||
private:
|
|
||||||
|
|
||||||
|
void ShowReturnToMainMenu();
|
||||||
|
|
||||||
|
private:
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
class UDebugWidget* DebugWidget;
|
class UDebugWidget* DebugWidget;
|
||||||
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
class ABlasterHUD* BlasterHUD;
|
class ABlasterHUD* BlasterHUD;
|
||||||
|
|
||||||
|
// Return to main menu
|
||||||
|
|
||||||
|
UPROPERTY(EditAnywhere, Category = HUD)
|
||||||
|
TSubclassOf<class UUserWidget> ReturnToMainMenuWidget;
|
||||||
|
|
||||||
|
UPROPERTY()
|
||||||
|
class UReturnToMainMenu* ReturnToMainMenu;
|
||||||
|
|
||||||
|
bool bReturnToMainMenuOpen = false;
|
||||||
|
|
||||||
UPROPERTY()
|
UPROPERTY()
|
||||||
class ABlasterGameMode* BlasterGameMode;
|
class ABlasterGameMode* BlasterGameMode;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue