Skip to content
Snippets Groups Projects
Commit 77bff727 authored by Jonathan Ehret's avatar Jonathan Ehret
Browse files

Merge remote-tracking branch 'origin/HEAD' into dev/5.3

# Conflicts:
#	Source/StudyFrameworkPlugin/Private/SFGameInstance.cpp
parents 899cf7a4 3212cb57
Branches
Tags
No related merge requests found
......@@ -98,7 +98,8 @@ void USFConditionListEntry::GoTo()
void USFConditionListEntry::UpdateData()
{
IsActive = USFGameInstance::Get()->GetParticipant()->GetCurrentCondition() == Condition && USFGameInstance::Get()->
GetParticipant()->GetCurrentCondition()->WasStarted();
GetParticipant()->GetCurrentCondition()->WasStarted() && USFGameInstance::Get()->IsStarted();
//the last part IsStarted() is needed when continuing a run where the first condition was already started
IsDone = Condition->IsFinished();
if (IsHeader)
......
......@@ -98,7 +98,7 @@ void ASFMasterHUD::BeginPlay()
SetNextConditionButtonVisibility(ESlateVisibility::Collapsed);
}
if (USFGameInstance::Get()->GetParticipant() && USFGameInstance::Get()->GetParticipant()->GetAllConditions()[0]->IsFinished())
if (USFGameInstance::Get()->IsContinueStudyStart())
{
Cast<UTextBlock>(HUDWidget->GetStartButton()->GetAllChildren()[0])->SetText(
FText::FromString("Continue Study"));
......
......@@ -237,8 +237,8 @@ void USFGameInstance::PrepareWithStudySetup(ASFStudySetup* Setup)
const FString MessageText = FString("The last participant did not finish the study run. Would you like to:") +
"\n[Continue Participant] Continue last participant (Participant ID: " +
LastParticipantID + ", SequenceNumber: " + FString::FromInt(ParticipantSequenceNumber) + ") where he/she left off in condition # " +
FString::FromInt(USFParticipant::GetLastParticipantLastConditionStarted()) +
LastParticipantID + ", SequenceNumber: " + FString::FromInt(ParticipantSequenceNumber) + ") where he/she left off in Condition " +
FString::FromInt(USFParticipant::GetLastParticipantLastConditionStarted() + 1) + "/" + FString::FromInt(USFParticipant::GetLastParticipantsConditions().Num()) +
"\n[Next Participant] Continue with the next participant (ParticipantSequenceNumber: " + FString::FromInt(ParticipantSequenceNumber + 1) +
")\n[Restart Study] Restart the entire study anew (ParticipantSequenceNumber: 0)";
const FString MessageTitle = "WARNING: Unfinished study run detected";
......@@ -276,6 +276,11 @@ void USFGameInstance::PrepareWithStudySetup(ASFStudySetup* Setup)
FString ParticipantID = "";
if (StudySetup->bUseCustomParticipantIDs)
{
//if we arerecovering, restore it:
if (bRecoverParticipantData) {
ParticipantID = USFParticipant::GetLastParticipantID();
}
else {
//ask for it:
bool bValidIDEntered = false;
while (!bValidIDEntered)
......@@ -298,6 +303,7 @@ void USFGameInstance::PrepareWithStudySetup(ASFStudySetup* Setup)
}
}
}
}
else
{
//otherwise just use sequence number:
......@@ -419,7 +425,7 @@ bool USFGameInstance::StartStudy()
return false;
}
if (!StartCondition)
if (!bInDebugMode)
{
//we are actually doing a real start and not just a "debug-start"
if (!Participant->StartStudy())
......@@ -671,6 +677,11 @@ bool USFGameInstance::IsInDebugMode() const
return bInDebugMode;
}
bool USFGameInstance::IsContinueStudyStart() const
{
return !bInDebugMode && StartCondition;
}
bool USFGameInstance::HasEnded() const
{
return bStudyEnded;
......@@ -824,13 +835,14 @@ void USFGameInstance::OnLevelLoaded()
void USFGameInstance::OnFadedIn()
{
FString NumberStr = FString::FromInt(GetCurrentConditionsSequenceNumber()) + "/" + FString::FromInt(Participant->GetAllConditions().Num());
if (Participant && Participant->GetCurrentCondition())
{
//this should be logged first
if (bInDebugMode) {
USFLoggingBPLibrary::LogComment("Running in DEBUG MODE");
}
USFLoggingBPLibrary::LogComment("Start Condition: " + Participant->GetCurrentCondition()->GetPrettyName());
USFLoggingBPLibrary::LogComment("Start Condition " + NumberStr + ": " + Participant->GetCurrentCondition()->GetPrettyName());
}
OnFadedInDelegate.Broadcast();
......@@ -842,7 +854,7 @@ void USFGameInstance::OnFadedIn()
Participant->GetCurrentCondition()->Begin();
UpdateHUD("Condition " + FString::FromInt(GetCurrentConditionsSequenceNumber()) + "/" + FString::FromInt(Participant->GetAllConditions().Num()));
UpdateHUD("Condition " + NumberStr);
}
USFParticipant* USFGameInstance::GetParticipant() const
......
......@@ -71,6 +71,7 @@ private:
void CreatePositionLogFile();
void CreateGazeTrackingLogFile();
UPROPERTY()
TArray<FComponentLoggingInformation> ComponentLoggingInfoArray;
FDateTime StaticDateTime;
bool bLoggingLoopsActive = false;
......
......@@ -72,6 +72,9 @@ public:
UFUNCTION(BlueprintCallable)
bool IsInDebugMode() const;
UFUNCTION(BlueprintCallable)
bool IsContinueStudyStart() const;
//Whether the study is done (this is actually only true for a short duration), as once faded out Unreal is quit
UFUNCTION(BlueprintCallable)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment