Compare commits

...

3 Commits

Author SHA1 Message Date
baz
4ff8d8eca3 Remove unused variable from LevelUpWidget 2025-06-12 23:17:12 +01:00
baz
e29e4e5b32 Add placeholder select weapon widget 2025-06-12 23:17:00 +01:00
baz
7d8c59d3fe Misc changes 2025-06-12 23:16:39 +01:00
8 changed files with 105 additions and 19 deletions

BIN
Content/Player/BP_PlayerCharacter.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Content/Widgets/MainMenu/BP_SelectWeaponWidget.uasset (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -24,14 +24,10 @@ public:
UPROPERTY(BlueprintReadWrite, meta=(BindWidget))
UListView* UpgradesListView;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<TSubclassOf<UUpgradeButtonDataObject>> UpgradeItems;
virtual void NativeConstruct() override;
private:
UFUNCTION()
void ResumeButtonClicked();

View File

@ -3,6 +3,7 @@
#include "MainMenuWidget.h"
#include "SelectWeaponWidget.h"
#include "Blueprint/WidgetBlueprintLibrary.h"
#include "Components/Button.h"
#include "Kismet/GameplayStatics.h"
@ -35,6 +36,8 @@ void UMainMenuWidget::NativeConstruct()
QuitButton->OnUnhovered.AddUniqueDynamic(this, &UMainMenuWidget::PlayUnhoveredSound);
}
QuitButton->SetIsEnabled(false);
if (APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0))
{
UWidgetBlueprintLibrary::SetInputMode_UIOnlyEx(PlayerController, this, EMouseLockMode::LockAlways);
@ -44,18 +47,31 @@ void UMainMenuWidget::NativeConstruct()
void UMainMenuWidget::NewGameButtonOnClicked()
{
if (!NewGameLevel.IsNull())
if (NewGameMenuWidget)
{
UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NewGameLevel);
}
RemoveFromParent();
if (APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0))
{
PlayerController->bShowMouseCursor = false;
UWidgetBlueprintLibrary::SetInputMode_GameOnly(PlayerController);
}
UUserWidget* selectWeaponWidget = CreateWidget<UUserWidget, APlayerController*>(
UGameplayStatics::GetPlayerController(GetWorld(), 0), NewGameMenuWidget);
SetIsFocusable(false);
if (selectWeaponWidget)
{
selectWeaponWidget->AddToViewport();
}
}
// if (!NewGameLevel.IsNull())
// {
// UGameplayStatics::OpenLevelBySoftObjectPtr(GetWorld(), NewGameLevel);
// }
//
// if (APlayerController* PlayerController = UGameplayStatics::GetPlayerController(GetWorld(), 0))
// {
// PlayerController->bShowMouseCursor = false;
// UWidgetBlueprintLibrary::SetInputMode_GameOnly(PlayerController);
// }
//
// SetIsFocusable(false);
}
void UMainMenuWidget::QuitButtonOnClicked()

View File

@ -0,0 +1,34 @@
// Louis Hobbs | 2024-2025
#include "SelectWeaponWidget.h"
#include "MainMenuWidget.h"
#include "Components/Button.h"
#include "Kismet/GameplayStatics.h"
void USelectWeaponWidget::NativeConstruct()
{
Super::NativeConstruct();
if (BackButton)
{
BackButton->OnClicked.AddUniqueDynamic(this, &USelectWeaponWidget::BackButtonClicked);
}
}
void USelectWeaponWidget::BackButtonClicked()
{
if (PreviousWidget)
{
RemoveFromParent();
UUserWidget* selectWeaponWidget = CreateWidget<UUserWidget, APlayerController*>(
UGameplayStatics::GetPlayerController(GetWorld(), 0), PreviousWidget);
if (selectWeaponWidget)
{
selectWeaponWidget->AddToViewport();
}
}
}

View File

@ -0,0 +1,37 @@
// Louis Hobbs | 2024-2025
#pragma once
#include "CoreMinimal.h"
#include "VampireInteractiveWidget.h"
#include "SelectWeaponWidget.generated.h"
class UListView;
class UButton;
/**
*
*/
UCLASS()
class VAMPIRES_API USelectWeaponWidget : public UVampireInteractiveWidget
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintReadWrite, meta=(BindWidget))
UButton* BackButton;
UPROPERTY(BlueprintReadWrite, meta=(BindWidget))
UListView* UpgradesListView;
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
TSubclassOf<class UUserWidget> PreviousWidget;
virtual void NativeConstruct() override;
private:
UFUNCTION()
void BackButtonClicked();
};