You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Icon is only visible if content is available for the editor in question. Split editor settings into two groups - one is persistent settings and one is progress/state. Tutorials record their dismissed state, so users can permenantly disable the 'nag' for a particular tutorial. Tutorial content now solidifies when the mouse is hovered over it, so it can be made easier to read. Fixed crash on startup if an intro tutorial was displaying rich text. Also fixed crash for TTP# 345094, where a zero-length tutorial was being accessed. [CL 2275934 by Thomas Sarkanen in Main branch]
121 lines
3.1 KiB
C++
121 lines
3.1 KiB
C++
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "IntroTutorialsPrivatePCH.h"
|
|
#include "TutorialStateSettings.h"
|
|
|
|
UTutorialStateSettings::UTutorialStateSettings(const class FPostConstructInitializeProperties& PCIP)
|
|
: Super(PCIP)
|
|
{
|
|
|
|
}
|
|
|
|
void UTutorialStateSettings::PostInitProperties()
|
|
{
|
|
Super::PostInitProperties();
|
|
|
|
for(const auto& Progress : TutorialsProgress)
|
|
{
|
|
TSubclassOf<UEditorTutorial> TutorialClass = LoadClass<UEditorTutorial>(NULL, *Progress.Tutorial.AssetLongPathname, NULL, LOAD_None, NULL);
|
|
if(TutorialClass != nullptr)
|
|
{
|
|
UEditorTutorial* Tutorial = TutorialClass->GetDefaultObject<UEditorTutorial>();
|
|
ProgressMap.Add(Tutorial, Progress);
|
|
}
|
|
}
|
|
}
|
|
|
|
int32 UTutorialStateSettings::GetProgress(UEditorTutorial* InTutorial, bool& bOutHaveSeenTutorial) const
|
|
{
|
|
const FTutorialProgress* FoundProgress = ProgressMap.Find(InTutorial);
|
|
if(FoundProgress != nullptr)
|
|
{
|
|
bOutHaveSeenTutorial = true;
|
|
return FoundProgress->CurrentStage;
|
|
}
|
|
|
|
bOutHaveSeenTutorial = false;
|
|
return 0;
|
|
}
|
|
|
|
bool UTutorialStateSettings::HaveSeenTutorial(UEditorTutorial* InTutorial) const
|
|
{
|
|
return ProgressMap.Find(InTutorial) != nullptr;
|
|
}
|
|
|
|
bool UTutorialStateSettings::HaveCompletedTutorial(UEditorTutorial* InTutorial) const
|
|
{
|
|
const FTutorialProgress* FoundProgress = ProgressMap.Find(InTutorial);
|
|
if (FoundProgress != nullptr)
|
|
{
|
|
return FoundProgress->CurrentStage >= InTutorial->Stages.Num() - 1;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void UTutorialStateSettings::RecordProgress(UEditorTutorial* InTutorial, int32 CurrentStage)
|
|
{
|
|
if(InTutorial != nullptr)
|
|
{
|
|
FTutorialProgress* FoundProgress = ProgressMap.Find(InTutorial);
|
|
if(FoundProgress != nullptr)
|
|
{
|
|
FoundProgress->CurrentStage = FMath::Max(FoundProgress->CurrentStage, CurrentStage);
|
|
}
|
|
else
|
|
{
|
|
FTutorialProgress Progress;
|
|
Progress.Tutorial = FStringClassReference(InTutorial->GetClass());
|
|
Progress.CurrentStage = CurrentStage;
|
|
Progress.bUserDismissed = false;
|
|
Progress.bUserDismissedThisSession = false;
|
|
|
|
ProgressMap.Add(InTutorial, Progress);
|
|
}
|
|
}
|
|
}
|
|
|
|
void UTutorialStateSettings::DismissTutorial(UEditorTutorial* InTutorial, bool bDismissAcrossSessions)
|
|
{
|
|
if (InTutorial != nullptr)
|
|
{
|
|
FTutorialProgress* FoundProgress = ProgressMap.Find(InTutorial);
|
|
if (FoundProgress != nullptr)
|
|
{
|
|
FoundProgress->bUserDismissed = bDismissAcrossSessions;
|
|
FoundProgress->bUserDismissedThisSession = true;
|
|
}
|
|
else
|
|
{
|
|
FTutorialProgress Progress;
|
|
Progress.Tutorial = FStringClassReference(InTutorial->GetClass());
|
|
Progress.CurrentStage = 0;
|
|
Progress.bUserDismissed = bDismissAcrossSessions;
|
|
Progress.bUserDismissedThisSession = true;
|
|
|
|
ProgressMap.Add(InTutorial, Progress);
|
|
}
|
|
}
|
|
}
|
|
|
|
bool UTutorialStateSettings::IsTutorialDismissed(UEditorTutorial* InTutorial) const
|
|
{
|
|
const FTutorialProgress* FoundProgress = ProgressMap.Find(InTutorial);
|
|
if (FoundProgress != nullptr)
|
|
{
|
|
return FoundProgress->bUserDismissed || FoundProgress->bUserDismissedThisSession;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void UTutorialStateSettings::SaveProgress()
|
|
{
|
|
TutorialsProgress.Empty();
|
|
|
|
for(const auto& ProgressMapEntry : ProgressMap)
|
|
{
|
|
TutorialsProgress.Add(ProgressMapEntry.Value);
|
|
}
|
|
|
|
SaveConfig();
|
|
}
|