Compare commits
No commits in common. "71889f9578cd00696b45830897e6e307f5d75353" and "a86c56fccb0d51dd50bcd339bbd96facc81a71c8" have entirely different histories.
71889f9578
...
a86c56fccb
|
@ -95,3 +95,21 @@ void UMainMenuUIWidget::QuitButtonOnClicked()
|
||||||
// For some reason the generic version does not work the same as FWindowsPlatformMisc
|
// For some reason the generic version does not work the same as FWindowsPlatformMisc
|
||||||
FWindowsPlatformMisc::RequestExit(false);
|
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,14 +6,13 @@
|
||||||
#include "OptionsUIWidget.h"
|
#include "OptionsUIWidget.h"
|
||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
#include "Components/Button.h"
|
#include "Components/Button.h"
|
||||||
#include "UI/NakatomiInteractiveWidget.h"
|
|
||||||
#include "MainMenuUIWidget.generated.h"
|
#include "MainMenuUIWidget.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class NAKATOMI_API UMainMenuUIWidget : public UNakatomiInteractiveWidget
|
class NAKATOMI_API UMainMenuUIWidget : public UUserWidget
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
public:
|
public:
|
||||||
|
@ -54,6 +53,15 @@ public:
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
TSoftObjectPtr<UWorld> NewGameLevel;
|
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:
|
private:
|
||||||
UUserWidget* currentNewGameWidget;
|
UUserWidget* currentNewGameWidget;
|
||||||
|
|
||||||
|
@ -77,6 +85,15 @@ private:
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void QuitButtonOnClicked();
|
void QuitButtonOnClicked();
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void PlayHoveredSound();
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void SetTextBlockHovered(UTextBlock* TextBlock);
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void SetTextBlockUnhovered(UTextBlock* TextBlock);
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void NewGameTextBlockHoveredDelegate() { SetTextBlockHovered(NewGameTextBlock); }
|
void NewGameTextBlockHoveredDelegate() { SetTextBlockHovered(NewGameTextBlock); }
|
||||||
|
|
||||||
|
|
|
@ -200,3 +200,11 @@ void UOptionsUIWidget::OnDynamicResolutionCheckboxChanged(bool bIsChecked)
|
||||||
GEngine->GameUserSettings->ApplySettings(true);
|
GEngine->GameUserSettings->ApplySettings(true);
|
||||||
this->PlayHoveredSound();
|
this->PlayHoveredSound();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UOptionsUIWidget::PlayHoveredSound()
|
||||||
|
{
|
||||||
|
if (ButtonHoveredSound)
|
||||||
|
{
|
||||||
|
UGameplayStatics::PlaySound2D(GetWorld(), ButtonHoveredSound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -7,14 +7,13 @@
|
||||||
#include "Components/CheckBox.h"
|
#include "Components/CheckBox.h"
|
||||||
#include "Components/Button.h"
|
#include "Components/Button.h"
|
||||||
#include "Components/TextBlock.h"
|
#include "Components/TextBlock.h"
|
||||||
#include "UI/NakatomiInteractiveWidget.h"
|
|
||||||
#include "OptionsUIWidget.generated.h"
|
#include "OptionsUIWidget.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class NAKATOMI_API UOptionsUIWidget : public UNakatomiInteractiveWidget
|
class NAKATOMI_API UOptionsUIWidget : public UUserWidget
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -46,6 +45,9 @@ public:
|
||||||
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
UPROPERTY(BlueprintReadWrite, meta = (BindWidget))
|
||||||
UButton* ResetToDefaultsButton;
|
UButton* ResetToDefaultsButton;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
|
USoundBase* ButtonHoveredSound;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
UUserWidget* PreviousScreen;
|
UUserWidget* PreviousScreen;
|
||||||
|
@ -80,4 +82,7 @@ private:
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void OnDynamicResolutionCheckboxChanged(bool bIsChecked);
|
void OnDynamicResolutionCheckboxChanged(bool bIsChecked);
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void PlayHoveredSound();
|
||||||
};
|
};
|
||||||
|
|
|
@ -92,3 +92,11 @@ void UPauseUIWidget::ExitGameButtonOnClicked()
|
||||||
// For some reason the generic version does not work the same as FWindowsPlatformMisc
|
// For some reason the generic version does not work the same as FWindowsPlatformMisc
|
||||||
FWindowsPlatformMisc::RequestExit(false);
|
FWindowsPlatformMisc::RequestExit(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UPauseUIWidget::PlayHoveredSound()
|
||||||
|
{
|
||||||
|
if (ButtonHoveredSound)
|
||||||
|
{
|
||||||
|
UGameplayStatics::PlaySound2D(GetWorld(), ButtonHoveredSound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -6,14 +6,13 @@
|
||||||
#include "OptionsUIWidget.h"
|
#include "OptionsUIWidget.h"
|
||||||
#include "Blueprint/UserWidget.h"
|
#include "Blueprint/UserWidget.h"
|
||||||
#include "Components/Button.h"
|
#include "Components/Button.h"
|
||||||
#include "UI/NakatomiInteractiveWidget.h"
|
|
||||||
#include "PauseUIWidget.generated.h"
|
#include "PauseUIWidget.generated.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
UCLASS()
|
UCLASS()
|
||||||
class NAKATOMI_API UPauseUIWidget : public UNakatomiInteractiveWidget
|
class NAKATOMI_API UPauseUIWidget : public UUserWidget
|
||||||
{
|
{
|
||||||
GENERATED_BODY()
|
GENERATED_BODY()
|
||||||
|
|
||||||
|
@ -36,6 +35,9 @@ public:
|
||||||
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
TSubclassOf<class UUserWidget> OptionsMenuWidget;
|
TSubclassOf<class UUserWidget> OptionsMenuWidget;
|
||||||
|
|
||||||
|
UPROPERTY(EditDefaultsOnly, BlueprintReadWrite)
|
||||||
|
USoundBase* ButtonHoveredSound;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UOptionsUIWidget* currentOptionsMenuWidget;
|
UOptionsUIWidget* currentOptionsMenuWidget;
|
||||||
|
|
||||||
|
@ -57,4 +59,7 @@ private:
|
||||||
|
|
||||||
UFUNCTION()
|
UFUNCTION()
|
||||||
void ExitGameButtonOnClicked();
|
void ExitGameButtonOnClicked();
|
||||||
|
|
||||||
|
UFUNCTION()
|
||||||
|
void PlayHoveredSound();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
// 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));
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
// 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