Compare commits
2 Commits
a86c56fccb
...
71889f9578
Author | SHA1 | Date |
---|---|---|
baz | 71889f9578 | |
baz | 4c795a3a27 |
|
@ -95,21 +95,3 @@ void UMainMenuUIWidget::QuitButtonOnClicked()
|
|||
// For some reason the generic version does not work the same as FWindowsPlatformMisc
|
||||
FWindowsPlatformMisc::RequestExit(false);
|
||||
}
|
||||
|
||||
void UMainMenuUIWidget::PlayHoveredSound()
|
||||
{
|
||||
if (ButtonHoveredSound)
|
||||
{
|
||||
UGameplayStatics::PlaySound2D(GetWorld(), ButtonHoveredSound);
|
||||
}
|
||||
}
|
||||
|
||||
void UMainMenuUIWidget::SetTextBlockHovered(UTextBlock* TextBlock)
|
||||
{
|
||||
TextBlock->SetColorAndOpacity(FSlateColor(ButtonHoveredTextColor));
|
||||
}
|
||||
|
||||
void UMainMenuUIWidget::SetTextBlockUnhovered(UTextBlock* TextBlock)
|
||||
{
|
||||
TextBlock->SetColorAndOpacity(FSlateColor(ButtonUnhoveredTextColor));
|
||||
}
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
#include "OptionsUIWidget.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "Components/Button.h"
|
||||
#include "UI/NakatomiInteractiveWidget.h"
|
||||
#include "MainMenuUIWidget.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class NAKATOMI_API UMainMenuUIWidget : public UUserWidget
|
||||
class NAKATOMI_API UMainMenuUIWidget : public UNakatomiInteractiveWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
public:
|
||||
|
@ -53,15 +54,6 @@ public:
|
|||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
TSoftObjectPtr<UWorld> NewGameLevel;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
USoundBase* ButtonHoveredSound;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
FLinearColor ButtonHoveredTextColor = {0, 1, 0, 1};
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
FLinearColor ButtonUnhoveredTextColor = {1, 1, 1, 1};
|
||||
|
||||
private:
|
||||
UUserWidget* currentNewGameWidget;
|
||||
|
||||
|
@ -85,15 +77,6 @@ private:
|
|||
UFUNCTION()
|
||||
void QuitButtonOnClicked();
|
||||
|
||||
UFUNCTION()
|
||||
void PlayHoveredSound();
|
||||
|
||||
UFUNCTION()
|
||||
void SetTextBlockHovered(UTextBlock* TextBlock);
|
||||
|
||||
UFUNCTION()
|
||||
void SetTextBlockUnhovered(UTextBlock* TextBlock);
|
||||
|
||||
UFUNCTION()
|
||||
void NewGameTextBlockHoveredDelegate() { SetTextBlockHovered(NewGameTextBlock); }
|
||||
|
||||
|
|
|
@ -200,11 +200,3 @@ void UOptionsUIWidget::OnDynamicResolutionCheckboxChanged(bool bIsChecked)
|
|||
GEngine->GameUserSettings->ApplySettings(true);
|
||||
this->PlayHoveredSound();
|
||||
}
|
||||
|
||||
void UOptionsUIWidget::PlayHoveredSound()
|
||||
{
|
||||
if (ButtonHoveredSound)
|
||||
{
|
||||
UGameplayStatics::PlaySound2D(GetWorld(), ButtonHoveredSound);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,13 +7,14 @@
|
|||
#include "Components/CheckBox.h"
|
||||
#include "Components/Button.h"
|
||||
#include "Components/TextBlock.h"
|
||||
#include "UI/NakatomiInteractiveWidget.h"
|
||||
#include "OptionsUIWidget.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class NAKATOMI_API UOptionsUIWidget : public UUserWidget
|
||||
class NAKATOMI_API UOptionsUIWidget : public UNakatomiInteractiveWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
|
@ -45,9 +46,6 @@ public:
|
|||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
||||
UButton* ResetToDefaultsButton;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
USoundBase* ButtonHoveredSound;
|
||||
|
||||
private:
|
||||
|
||||
UUserWidget* PreviousScreen;
|
||||
|
@ -82,7 +80,4 @@ private:
|
|||
|
||||
UFUNCTION()
|
||||
void OnDynamicResolutionCheckboxChanged(bool bIsChecked);
|
||||
|
||||
UFUNCTION()
|
||||
void PlayHoveredSound();
|
||||
};
|
||||
|
|
|
@ -92,11 +92,3 @@ void UPauseUIWidget::ExitGameButtonOnClicked()
|
|||
// For some reason the generic version does not work the same as FWindowsPlatformMisc
|
||||
FWindowsPlatformMisc::RequestExit(false);
|
||||
}
|
||||
|
||||
void UPauseUIWidget::PlayHoveredSound()
|
||||
{
|
||||
if (ButtonHoveredSound)
|
||||
{
|
||||
UGameplayStatics::PlaySound2D(GetWorld(), ButtonHoveredSound);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
#include "OptionsUIWidget.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "Components/Button.h"
|
||||
#include "UI/NakatomiInteractiveWidget.h"
|
||||
#include "PauseUIWidget.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class NAKATOMI_API UPauseUIWidget : public UUserWidget
|
||||
class NAKATOMI_API UPauseUIWidget : public UNakatomiInteractiveWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
|
@ -35,9 +36,6 @@ public:
|
|||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
TSubclassOf<class UUserWidget> OptionsMenuWidget;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
USoundBase* ButtonHoveredSound;
|
||||
|
||||
private:
|
||||
UOptionsUIWidget* currentOptionsMenuWidget;
|
||||
|
||||
|
@ -59,7 +57,4 @@ private:
|
|||
|
||||
UFUNCTION()
|
||||
void ExitGameButtonOnClicked();
|
||||
|
||||
UFUNCTION()
|
||||
void PlayHoveredSound();
|
||||
};
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
|
||||
#include "../UI/NakatomiInteractiveWidget.h"
|
||||
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
|
||||
void UNakatomiInteractiveWidget::PlayHoveredSound()
|
||||
{
|
||||
if (ButtonHoveredSound)
|
||||
{
|
||||
UGameplayStatics::PlaySound2D(GetWorld(), ButtonHoveredSound);
|
||||
}
|
||||
}
|
||||
|
||||
void UNakatomiInteractiveWidget::SetTextBlockHovered(UTextBlock* TextBlock)
|
||||
{
|
||||
TextBlock->SetColorAndOpacity(FSlateColor(ButtonHoveredTextColor));
|
||||
}
|
||||
|
||||
void UNakatomiInteractiveWidget::SetTextBlockUnhovered(UTextBlock* TextBlock)
|
||||
{
|
||||
TextBlock->SetColorAndOpacity(FSlateColor(ButtonUnhoveredTextColor));
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
// Fill out your copyright notice in the Description page of Project Settings.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
#include "Components/TextBlock.h"
|
||||
#include "NakatomiInteractiveWidget.generated.h"
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
UCLASS()
|
||||
class NAKATOMI_API UNakatomiInteractiveWidget : public UUserWidget
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
USoundBase* ButtonHoveredSound;
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
FLinearColor ButtonHoveredTextColor = {0, 1, 0, 1};
|
||||
|
||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||
FLinearColor ButtonUnhoveredTextColor = {1, 1, 1, 1};
|
||||
|
||||
protected:
|
||||
UFUNCTION()
|
||||
void PlayHoveredSound();
|
||||
|
||||
UFUNCTION()
|
||||
void SetTextBlockHovered(UTextBlock* TextBlock);
|
||||
|
||||
UFUNCTION()
|
||||
void SetTextBlockUnhovered(UTextBlock* TextBlock);
|
||||
|
||||
};
|
Loading…
Reference in New Issue