Make options menu accessable from Main Menu
This commit is contained in:
parent
738f4a2b8b
commit
bb6ad4b9f7
BIN
Content/Widgets/MainMenu/BP_MainMenuWidget.uasset
(Stored with Git LFS)
BIN
Content/Widgets/MainMenu/BP_MainMenuWidget.uasset
(Stored with Git LFS)
Binary file not shown.
@ -24,6 +24,18 @@ void UMainMenuWidget::NativeConstruct()
|
|||||||
NewGameButton->OnUnhovered.AddUniqueDynamic(this, &UMainMenuWidget::PlayUnhoveredSound);
|
NewGameButton->OnUnhovered.AddUniqueDynamic(this, &UMainMenuWidget::PlayUnhoveredSound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (OptionsButton)
|
||||||
|
{
|
||||||
|
OptionsButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::OptionsButtonOnClicked);
|
||||||
|
OptionsButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::PlayClickedSound);
|
||||||
|
|
||||||
|
OptionsButton->OnHovered.AddUniqueDynamic(this, &UMainMenuWidget::PlayHoveredSound);
|
||||||
|
OptionsButton->OnHovered.AddUniqueDynamic(this, &UMainMenuWidget::OptionsTextBlockHoveredDelegate);
|
||||||
|
|
||||||
|
OptionsButton->OnUnhovered.AddUniqueDynamic(this, &UMainMenuWidget::OptionsTextBlockUnhoveredDelegate);
|
||||||
|
OptionsButton->OnUnhovered.AddUniqueDynamic(this, &UMainMenuWidget::PlayUnhoveredSound);
|
||||||
|
}
|
||||||
|
|
||||||
if (QuitButton)
|
if (QuitButton)
|
||||||
{
|
{
|
||||||
QuitButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::QuitButtonOnClicked);
|
QuitButton->OnClicked.AddUniqueDynamic(this, &UMainMenuWidget::QuitButtonOnClicked);
|
||||||
@ -61,6 +73,22 @@ void UMainMenuWidget::NewGameButtonOnClicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UMainMenuWidget::OptionsButtonOnClicked()
|
||||||
|
{
|
||||||
|
if (OptionsMenuWidget)
|
||||||
|
{
|
||||||
|
RemoveFromParent();
|
||||||
|
|
||||||
|
UUserWidget* OptionWeaponWidget = CreateWidget<UUserWidget, APlayerController*>(
|
||||||
|
UGameplayStatics::GetPlayerController(GetWorld(), 0), OptionsMenuWidget);
|
||||||
|
|
||||||
|
if (OptionWeaponWidget)
|
||||||
|
{
|
||||||
|
OptionWeaponWidget->AddToViewport();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UMainMenuWidget::QuitButtonOnClicked()
|
void UMainMenuWidget::QuitButtonOnClicked()
|
||||||
{
|
{
|
||||||
// TODO: Add platform specific Exit requests
|
// TODO: Add platform specific Exit requests
|
||||||
|
@ -15,30 +15,33 @@ class VAMPIRES_API UMainMenuWidget : public UVampireInteractiveWidget
|
|||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
// TODO: Add options menu
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UButton> NewGameButton;
|
TObjectPtr<UButton> NewGameButton;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UTextBlock> NewGameTextBlock;
|
TObjectPtr<UTextBlock> NewGameTextBlock;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
|
TObjectPtr<UButton> OptionsButton;
|
||||||
|
|
||||||
|
UPROPERTY(meta = (BindWidget))
|
||||||
|
TObjectPtr<UTextBlock> OptionsTextBlock;
|
||||||
|
|
||||||
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UButton> QuitButton;
|
TObjectPtr<UButton> QuitButton;
|
||||||
|
|
||||||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
UPROPERTY(meta = (BindWidget))
|
||||||
TObjectPtr<UTextBlock> QuitTextBlock;
|
TObjectPtr<UTextBlock> QuitTextBlock;
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Widget Settings | New Game")
|
UPROPERTY(EditDefaultsOnly, Category = "Widget Settings | New Game")
|
||||||
TSubclassOf<class UUserWidget> NewGameMenuWidget;
|
TSubclassOf<UUserWidget> NewGameMenuWidget;
|
||||||
|
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite, Category = "Widget Settings | New Game")
|
UPROPERTY(EditDefaultsOnly, Category = "Widget Settings | New Game")
|
||||||
TSoftObjectPtr<UWorld> NewGameLevel;
|
TSoftObjectPtr<UWorld> NewGameLevel;
|
||||||
|
|
||||||
private:
|
UPROPERTY(EditDefaultsOnly, Category = "Widget Settings | Options")
|
||||||
UPROPERTY()
|
TSubclassOf<UUserWidget> OptionsMenuWidget;
|
||||||
TObjectPtr<UUserWidget> CurrentNewGameWidget;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void NativeConstruct() override;
|
virtual void NativeConstruct() override;
|
||||||
@ -47,6 +50,9 @@ private:
|
|||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void NewGameButtonOnClicked();
|
void NewGameButtonOnClicked();
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void OptionsButtonOnClicked();
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void QuitButtonOnClicked();
|
void QuitButtonOnClicked();
|
||||||
|
|
||||||
@ -56,6 +62,12 @@ private:
|
|||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void NewGameTextBlockUnhoveredDelegate() { SetTextBlockUnhovered(NewGameTextBlock); }
|
void NewGameTextBlockUnhoveredDelegate() { SetTextBlockUnhovered(NewGameTextBlock); }
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void OptionsTextBlockHoveredDelegate() { SetTextBlockHovered(OptionsTextBlock); }
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void OptionsTextBlockUnhoveredDelegate() { SetTextBlockUnhovered(OptionsTextBlock); }
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void QuitTextBlockHoveredDelegate() { SetTextBlockHovered(QuitTextBlock); }
|
void QuitTextBlockHoveredDelegate() { SetTextBlockHovered(QuitTextBlock); }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user