Implemented Quit Tab and its Functionality
This commit is contained in:
parent
ca0365e41b
commit
14ff02285c
@ -9,6 +9,14 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="dfa3053d-1d51-4dad-9270-4c17e086f627" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.EndlessVendetta/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/FirstPerson/Blueprints/BP_FirstPersonCharacter.uasset" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/PauseMenu/WBP_PauseMenu.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/PauseMenu/WBP_PauseMenu.uasset" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/PauseMenu/WBP_TestMenuTab.uasset" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/StarterContent/Architecture/Floor_400x400.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/Architecture/Floor_400x400.uasset" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Content/StarterContent/Particles/P_Ambient_Dust.uasset" beforeDir="false" afterPath="$PROJECT_DIR$/Content/StarterContent/Particles/P_Ambient_Dust.uasset" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.cpp" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/Characters/BountyHunterCharacter.h" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/Source/EndlessVendetta/PauseMenu/PauseMenuClass.h" beforeDir="false" afterPath="$PROJECT_DIR$/Source/EndlessVendetta/PauseMenu/PauseMenuClass.h" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -126,7 +134,7 @@
|
||||
<workItem from="1706900342753" duration="2652000" />
|
||||
<workItem from="1706972179014" duration="11096000" />
|
||||
<workItem from="1707046474738" duration="8878000" />
|
||||
<workItem from="1707103463352" duration="1032000" />
|
||||
<workItem from="1707103463352" duration="6662000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f1ecafab249f201ddeaf8e1c7b6631e183f9bf07d10e1f460002076e75795801
|
||||
size 470059
|
||||
oid sha256:d2f8d95778a3400a1cb4f254ce88e826577c5600bacca7246b34c0a3f10ee51d
|
||||
size 472419
|
||||
|
BIN
EndlessVendetta/Content/Levels/MainMenuLevel.umap
(Stored with Git LFS)
BIN
EndlessVendetta/Content/Levels/MainMenuLevel.umap
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/PauseMenu/Tabs/WBP_BountiesTab.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/PauseMenu/Tabs/WBP_BountiesTab.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/PauseMenu/Tabs/WBP_QuitTab.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/PauseMenu/Tabs/WBP_QuitTab.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/PauseMenu/Tabs/WBP_TestMenuTab.uasset
(Stored with Git LFS)
Normal file
BIN
EndlessVendetta/Content/PauseMenu/Tabs/WBP_TestMenuTab.uasset
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
EndlessVendetta/Content/PauseMenu/WBP_PauseMenu.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/PauseMenu/WBP_PauseMenu.uasset
(Stored with Git LFS)
Binary file not shown.
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:9cf9c231c4b94dec2434c03af547e75968039b3ab03ce0e9d4518c94a86b1fa9
|
||||
size 32656
|
BIN
EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/Architecture/Floor_400x400.uasset
(Stored with Git LFS)
Binary file not shown.
BIN
EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset
(Stored with Git LFS)
BIN
EndlessVendetta/Content/StarterContent/Particles/P_Ambient_Dust.uasset
(Stored with Git LFS)
Binary file not shown.
@ -60,6 +60,7 @@ void ABountyHunterCharacter::BeginPlay()
|
||||
Cast<APlayerController>(GetController())->SetControlRotation(GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave.GetRotation().Rotator());
|
||||
}
|
||||
}
|
||||
CreatePauseMenuTabs();
|
||||
Super::BeginPlay();
|
||||
}
|
||||
|
||||
@ -75,28 +76,6 @@ void ABountyHunterCharacter::SetupPlayerInputComponent(UInputComponent* PlayerIn
|
||||
Super::SetupPlayerInputComponent(PlayerInputComponent);
|
||||
}
|
||||
|
||||
void ABountyHunterCharacter::TogglePauseMenu()
|
||||
{
|
||||
const bool bOpenNewPauseMenu = !IsValid(PauseMenu);
|
||||
FInputModeUIOnly UIOnly;
|
||||
FInputModeGameOnly GameOnly;
|
||||
APlayerController* PC = Cast<APlayerController>(GetController());
|
||||
|
||||
InPauseMenu = bOpenNewPauseMenu;
|
||||
PC->SetIgnoreMoveInput(bOpenNewPauseMenu);
|
||||
PC->SetIgnoreLookInput(bOpenNewPauseMenu);
|
||||
PC->SetShowMouseCursor(bOpenNewPauseMenu);
|
||||
if (!bOpenNewPauseMenu)
|
||||
{
|
||||
PauseMenu->RemoveFromParent();
|
||||
PauseMenu = nullptr;
|
||||
}
|
||||
PauseMenu = CreateWidget<UPauseMenuClass>(GetWorld(), PauseMenuWidgetClass);
|
||||
PauseMenu->AddToViewport(50);
|
||||
BountiesTab = CreateWidget(GetWorld(), BountyTabWidgetClass);
|
||||
PauseMenu->OpenNewTab(BountiesTab);
|
||||
}
|
||||
|
||||
void ABountyHunterCharacter::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
{
|
||||
Super::EndPlay(EndPlayReason);
|
||||
@ -124,3 +103,39 @@ void ABountyHunterCharacter::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||
GI->MainSaveGameInstanceRef->PlayerOpenWorldSpawnTransformSave = ClosestLandingZone->GetExitTransform();
|
||||
UGameplayStatics::SaveGameToSlot(GI->MainSaveGameInstanceRef, "MainSave", 0);
|
||||
}
|
||||
|
||||
void ABountyHunterCharacter::CreatePauseMenuTabs()
|
||||
{
|
||||
BountiesTab = CreateWidget<UBountiesTab>(GetWorld(), BountyTabWidgetClass);
|
||||
FavoursTab = CreateWidget<UTabWidget>(GetWorld(), FavoursTabWidgetClass);
|
||||
NavigationTab = CreateWidget<UTabWidget>(GetWorld(), NavigationTabWidgetClass);
|
||||
SettingsTab = CreateWidget<UTabWidget>(GetWorld(), SettingsTabWidgetClass);
|
||||
QuitTab = CreateWidget<UQuitTab>(GetWorld(), QuitTabWidgetClass);
|
||||
}
|
||||
|
||||
void ABountyHunterCharacter::TogglePauseMenu()
|
||||
{
|
||||
const bool bOpenNewPauseMenu = !IsValid(PauseMenu);
|
||||
FInputModeUIOnly UIOnly;
|
||||
FInputModeGameOnly GameOnly;
|
||||
APlayerController* PC = Cast<APlayerController>(GetController());
|
||||
|
||||
InPauseMenu = bOpenNewPauseMenu;
|
||||
PC->SetIgnoreMoveInput(bOpenNewPauseMenu);
|
||||
PC->SetIgnoreLookInput(bOpenNewPauseMenu);
|
||||
PC->SetShowMouseCursor(bOpenNewPauseMenu);
|
||||
if (!bOpenNewPauseMenu)
|
||||
{
|
||||
PauseMenu->RemoveFromParent();
|
||||
PauseMenu = nullptr;
|
||||
return;
|
||||
}
|
||||
PauseMenu = CreateWidget<UPauseMenuClass>(GetWorld(), PauseMenuWidgetClass);
|
||||
PauseMenu->AddToViewport(50);
|
||||
PauseMenu->OpenNewTab(BountiesTab);
|
||||
PauseMenu->OpenedBountiesTab.AddDynamic(this, &ABountyHunterCharacter::OpenBountiesTab);
|
||||
PauseMenu->OpenedFavoursTab.AddDynamic(this, &ABountyHunterCharacter::OpenFavoursTab);
|
||||
PauseMenu->OpenedNavigationTab.AddDynamic(this, &ABountyHunterCharacter::OpenNavigationTab);
|
||||
PauseMenu->OpenedSettingsTab.AddDynamic(this, &ABountyHunterCharacter::OpenSettingsTab);
|
||||
PauseMenu->OpenedQuitTab.AddDynamic(this, &ABountyHunterCharacter::OpenQuitTab);
|
||||
}
|
@ -7,7 +7,9 @@
|
||||
#include "EndlessVendetta/EVGameInstance.h"
|
||||
#include "EndlessVendetta/MainSaveGameClass.h"
|
||||
#include "EndlessVendetta/BountySystem/MainBountyClass.h"
|
||||
#include "EndlessVendetta/PauseMenu/BountiesTab.h"
|
||||
#include "EndlessVendetta/PauseMenu/PauseMenuClass.h"
|
||||
#include "EndlessVendetta/PauseMenu/QuitTab.h"
|
||||
#include "BountyHunterCharacter.generated.h"
|
||||
|
||||
/**
|
||||
@ -33,25 +35,7 @@ class ENDLESSVENDETTA_API ABountyHunterCharacter : public AEndlessVendettaCharac
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Bounty Hunter")
|
||||
FString OpenWorldLevelName = "ControlTutorialLevel";
|
||||
|
||||
// Input Action for Opening and Closing Pause Menu
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||
UInputAction* PauseMenuAction;
|
||||
|
||||
// Widget Class used to Spawn Pause Menu
|
||||
UPROPERTY(EditDefaultsOnly, Category = PauseMenu)
|
||||
TSubclassOf<UPauseMenuClass> PauseMenuWidgetClass;
|
||||
|
||||
// Reference to Pause Menu Widget
|
||||
UPauseMenuClass* PauseMenu;
|
||||
|
||||
protected:
|
||||
// Widget Class used to Spawn Bounties Tab Widget
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Pause Menu")
|
||||
TSubclassOf<UUserWidget> BountyTabWidgetClass;
|
||||
|
||||
// Reference to Bounty Tab Widget
|
||||
UUserWidget* BountiesTab;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -73,11 +57,9 @@ protected:
|
||||
// Overridden to Setup up Pause Menu Inputs
|
||||
virtual void SetupPlayerInputComponent(UInputComponent* PlayerInputComponent) override;
|
||||
|
||||
// Open or Close the Pause Menu, Defaults to Opening Bounty Tab
|
||||
void TogglePauseMenu();
|
||||
|
||||
// Called When Actor destroyed or Removed from Level
|
||||
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
||||
|
||||
public:
|
||||
// Used by Final Checkpoint to always load the Level set as the Open Level in here
|
||||
FString GetOpenWorldLevelName()
|
||||
@ -85,4 +67,97 @@ public:
|
||||
return OpenWorldLevelName;
|
||||
}
|
||||
|
||||
// ------------------- Pause Menu ---------------------------------
|
||||
private:
|
||||
// Input Action for Opening and Closing Pause Menu
|
||||
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))
|
||||
UInputAction* PauseMenuAction;
|
||||
|
||||
// Widget Class used to Spawn Pause Menu
|
||||
UPROPERTY(EditDefaultsOnly, Category = PauseMenu)
|
||||
TSubclassOf<UPauseMenuClass> PauseMenuWidgetClass;
|
||||
|
||||
// Reference to Pause Menu Widget
|
||||
UPauseMenuClass* PauseMenu;
|
||||
|
||||
// Widget Class used to Spawn Bounties Tab Widget
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Pause Menu")
|
||||
TSubclassOf<UBountiesTab> BountyTabWidgetClass;
|
||||
|
||||
// Reference to Bounty Tab Widget
|
||||
UPROPERTY()
|
||||
UBountiesTab* BountiesTab;
|
||||
|
||||
// Widget Class used to Spawn Favours Tab Widget
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Pause Menu")
|
||||
TSubclassOf<UTabWidget> FavoursTabWidgetClass;
|
||||
|
||||
// Reference to Favours Tab Widget
|
||||
UPROPERTY()
|
||||
UTabWidget* FavoursTab;
|
||||
|
||||
// Widget Class used to Spawn Navigation Tab Widget
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Pause Menu")
|
||||
TSubclassOf<UTabWidget> NavigationTabWidgetClass;
|
||||
|
||||
// Reference to Navigation Tab Widget
|
||||
UPROPERTY()
|
||||
UTabWidget* NavigationTab;
|
||||
|
||||
// Widget Class used to Spawn Settings Tab Widget
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Pause Menu")
|
||||
TSubclassOf<UTabWidget> SettingsTabWidgetClass;
|
||||
|
||||
// Reference to Settings Tab Widget
|
||||
UPROPERTY()
|
||||
UTabWidget* SettingsTab;
|
||||
|
||||
// Widget Class used to Spawn Quit Tab Widget
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Pause Menu")
|
||||
TSubclassOf<UQuitTab> QuitTabWidgetClass;
|
||||
|
||||
// Reference to Quit Tab Widget
|
||||
UPROPERTY()
|
||||
UQuitTab* QuitTab;
|
||||
|
||||
// Creates and Stores References to each Pause Menu Tab on Begin Play
|
||||
void CreatePauseMenuTabs();
|
||||
|
||||
// Open or Close the Pause Menu, Defaults to Opening Bounty Tab
|
||||
void TogglePauseMenu();
|
||||
|
||||
// Opens Bounties Tab
|
||||
UFUNCTION()
|
||||
void OpenBountiesTab()
|
||||
{
|
||||
PauseMenu->OpenNewTab(BountiesTab);
|
||||
}
|
||||
|
||||
// Opens Favours Tab
|
||||
UFUNCTION()
|
||||
void OpenFavoursTab()
|
||||
{
|
||||
PauseMenu->OpenNewTab(FavoursTab);
|
||||
}
|
||||
|
||||
// Opens Navigation Tab
|
||||
UFUNCTION()
|
||||
void OpenNavigationTab()
|
||||
{
|
||||
PauseMenu->OpenNewTab(NavigationTab);
|
||||
}
|
||||
|
||||
// Opens Settings Tab
|
||||
UFUNCTION()
|
||||
void OpenSettingsTab()
|
||||
{
|
||||
PauseMenu->OpenNewTab(SettingsTab);
|
||||
}
|
||||
|
||||
// Opens Quit Tab
|
||||
UFUNCTION()
|
||||
void OpenQuitTab()
|
||||
{
|
||||
PauseMenu->OpenNewTab(QuitTab);
|
||||
}
|
||||
};
|
||||
|
@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "BountiesTab.h"
|
||||
|
@ -0,0 +1,31 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "TabWidget.h"
|
||||
#include "EndlessVendetta/BountySystem/BountyClass.h"
|
||||
#include "BountiesTab.generated.h"
|
||||
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FTrackBounty, ABountyClass*, BountyToTrack);
|
||||
|
||||
UCLASS()
|
||||
class ENDLESSVENDETTA_API UBountiesTab : public UTabWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
// ------------------- ATTRIBUTES ------------------------------
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
UPROPERTY(BlueprintAssignable)
|
||||
FTrackBounty TrackBountyDelegate;
|
||||
|
||||
// ------------------- METHODS ---------------------------------
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
};
|
@ -6,26 +6,36 @@
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "PauseMenuClass.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOpenedBountiesTab);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOpenedFavoursTab);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOpenedNavigationTab);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOpenedSettingsTab);
|
||||
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOpenedQuitTab);
|
||||
|
||||
UCLASS()
|
||||
class ENDLESSVENDETTA_API UPauseMenuClass : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
// ------------------- ATTRIBUTES ------------------------------
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
UPROPERTY(BlueprintCallable)
|
||||
FOpenedBountiesTab OpenedBountiesTab;
|
||||
|
||||
UPROPERTY(BlueprintCallable)
|
||||
FOpenedFavoursTab OpenedFavoursTab;
|
||||
|
||||
UPROPERTY(BlueprintCallable)
|
||||
FOpenedNavigationTab OpenedNavigationTab;
|
||||
|
||||
UPROPERTY(BlueprintCallable)
|
||||
FOpenedSettingsTab OpenedSettingsTab;
|
||||
|
||||
UPROPERTY(BlueprintCallable)
|
||||
FOpenedQuitTab OpenedQuitTab;
|
||||
|
||||
// ------------------- METHODS ---------------------------------
|
||||
private:
|
||||
|
||||
protected:
|
||||
|
||||
public:
|
||||
// Closes any Previously Opened Tab and Opens the Given new Tab
|
||||
UFUNCTION(BlueprintImplementableEvent)
|
||||
void OpenNewTab(UUserWidget* TabWidget);
|
||||
|
||||
void OpenNewTab(UTabWidget* TabWidget);
|
||||
};
|
||||
|
@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "QuitTab.h"
|
||||
|
14
EndlessVendetta/Source/EndlessVendetta/PauseMenu/QuitTab.h
Normal file
14
EndlessVendetta/Source/EndlessVendetta/PauseMenu/QuitTab.h
Normal file
@ -0,0 +1,14 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "TabWidget.h"
|
||||
#include "QuitTab.generated.h"
|
||||
|
||||
UCLASS()
|
||||
class ENDLESSVENDETTA_API UQuitTab : public UTabWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
@ -0,0 +1,5 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "TabWidget.h"
|
||||
|
17
EndlessVendetta/Source/EndlessVendetta/PauseMenu/TabWidget.h
Normal file
17
EndlessVendetta/Source/EndlessVendetta/PauseMenu/TabWidget.h
Normal file
@ -0,0 +1,17 @@
|
||||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "TabWidget.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class ENDLESSVENDETTA_API UTabWidget : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
};
|
Loading…
Reference in New Issue
Block a user