Added Tutorial Widget with Functionality

This commit is contained in:
Philip W 2023-04-24 11:54:28 +01:00
parent 233125cc81
commit fa3a811553
8 changed files with 32 additions and 1 deletions

BIN
Content/Blueprints/Combat_UI/CombatTutorial.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Blueprints/Combat_UI/TutorialArrow.uasset (Stored with Git LFS) Normal file

Binary file not shown.

BIN
Content/Blueprints/Combat_UI/TutorialRippedPaper.uasset (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -206,7 +206,6 @@ void ATempCharacter::InputDisabler()
//TURNING OFF CROSSHAIR //TURNING OFF CROSSHAIR
CrossHairWidget->SetVisibility(ESlateVisibility::Hidden); CrossHairWidget->SetVisibility(ESlateVisibility::Hidden);
ImportantStatsWidget->SetVisibility(ESlateVisibility::Hidden);
//Set to UI Mode Only //Set to UI Mode Only
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();

View File

@ -27,6 +27,9 @@ ATurnBaseCombatV2::ATurnBaseCombatV2()
static ConstructorHelpers::FClassFinder<UUserWidget> DeathScreenWidgetClass(TEXT("/Game/Blueprints/Death_UI/Death_UI")); static ConstructorHelpers::FClassFinder<UUserWidget> DeathScreenWidgetClass(TEXT("/Game/Blueprints/Death_UI/Death_UI"));
DeathScreenWidgetSubclass = DeathScreenWidgetClass.Class; DeathScreenWidgetSubclass = DeathScreenWidgetClass.Class;
static ConstructorHelpers::FClassFinder<UUserWidget> CombatTutorialWidgetClass(TEXT("/Game/Blueprints/Combat_UI/CombatTutorial"));
CombatTutorialWidget = CombatTutorialWidgetClass.Class;
} }
} }
@ -34,6 +37,13 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy)
{ {
if (Enemy == nullptr) return; if (Enemy == nullptr) return;
UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(Enemy->GetInstigatorController())->GetBlackboardComponent(); UBlackboardComponent* EnemyBlackboard = Cast<AAIController>(Enemy->GetInstigatorController())->GetBlackboardComponent();
if (!HasSeenTutorial)
{
ToggleButtons();
CombatTutorialWidgetInstance = CreateWidget<UUserWidget>(GetWorld(), CombatTutorialWidget);
CombatTutorialWidgetInstance->AddToViewport();
HasSeenTutorial = true;
}
if (EnemyBlackboard->GetValueAsBool("IsInCombat")) return; if (EnemyBlackboard->GetValueAsBool("IsInCombat")) return;
EnemyBlackboard->SetValueAsBool("IsInCombat", true); EnemyBlackboard->SetValueAsBool("IsInCombat", true);

View File

@ -54,6 +54,8 @@ public:
UPROPERTY() UPROPERTY()
UUserWidget* BookHUD; UUserWidget* BookHUD;
UPROPERTY() UPROPERTY()
UUserWidget* CombatTutorialWidgetInstance;
UPROPERTY()
UWidgetComponent* PlayerWidget; UWidgetComponent* PlayerWidget;
/* /*
TODO: TODO:
@ -62,6 +64,10 @@ public:
UPROPERTY(EditAnywhere) UPROPERTY(EditAnywhere)
TSubclassOf<UUserWidget> HUDWidget; TSubclassOf<UUserWidget> HUDWidget;
UPROPERTY(EditAnywhere) UPROPERTY(EditAnywhere)
TSubclassOf<UUserWidget> CombatTutorialWidget;
UPROPERTY()
bool HasSeenTutorial = false;
UPROPERTY(EditAnywhere)
TMap<FString, int32> ValidCombos = TMap<FString, int32> ValidCombos =
{ {
{"P", 5}, {"P", 5},
@ -206,6 +212,7 @@ private:
void ClearBattleLog(); void ClearBattleLog();
void UpdateBattleLog(); void UpdateBattleLog();
void UpdateResourceBars() const; void UpdateResourceBars() const;
UFUNCTION(BlueprintCallable)
void ToggleButtons() const; void ToggleButtons() const;
void EnemyTurn(); void EnemyTurn();

BIN
UI designs/TutorialArrow.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
UI designs/TutorialRippedPaper.png (Stored with Git LFS) Normal file

Binary file not shown.