Bridge imported generated selectors into launch config
This commit is contained in:
parent
2b899aedc5
commit
fd09e17459
7 changed files with 155 additions and 0 deletions
|
|
@ -2801,6 +2801,65 @@ bool UHyperTwistTrainingCatalogLibrary::TryGetImportedRuntimeSelectorOptionCaseF
|
|||
return OutCase.IsStructurallyValid();
|
||||
}
|
||||
|
||||
bool UHyperTwistTrainingCatalogLibrary::TryBuildImportedGeneratedModeLaunchConfig(
|
||||
const FHyperTwistTrainingDeck& Deck,
|
||||
const FHyperTwistTrainingImportedRuntimeSelectionState& ImportedRuntimeSelectionState,
|
||||
const FHyperTwistTrainingSession& Session,
|
||||
FHyperTwistTrainingImportedGeneratedModeLaunchConfig& OutLaunchConfig
|
||||
)
|
||||
{
|
||||
OutLaunchConfig = FHyperTwistTrainingImportedGeneratedModeLaunchConfig();
|
||||
if (!Deck.IsStructurallyValid()
|
||||
|| !Session.IsStructurallyValid()
|
||||
|| !Deck.ImportedRuntimeSurface.IsStructurallyValid()
|
||||
|| !ImportedRuntimeSelectionState.IsStructurallyValid()
|
||||
|| !Deck.ImportedRuntimeSurface.SurfaceKind.Equals(TEXT("generated-mode"), ESearchCase::IgnoreCase)
|
||||
|| ImportedRuntimeSelectionState.SurfaceId != Deck.ImportedRuntimeSurface.SurfaceId)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const FHyperTwistTrainingImportedRuntimeSelector& Selector : Deck.ImportedRuntimeSurface.Selectors)
|
||||
{
|
||||
const FHyperTwistTrainingImportedRuntimeSelectorChoice* MatchingChoice =
|
||||
ImportedRuntimeSelectionState.SelectorChoices.FindByPredicate(
|
||||
[&Selector](const FHyperTwistTrainingImportedRuntimeSelectorChoice& Candidate)
|
||||
{
|
||||
return Candidate.SelectorId == Selector.SelectorId && Candidate.IsStructurallyValid();
|
||||
}
|
||||
);
|
||||
if (MatchingChoice == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
OutLaunchConfig.DeckId = Deck.DeckId;
|
||||
OutLaunchConfig.UserId = Session.UserId;
|
||||
OutLaunchConfig.TrainingSessionId = Session.TrainingSessionId;
|
||||
OutLaunchConfig.DeliveryMode = Session.Mode;
|
||||
OutLaunchConfig.SurfaceId = Deck.ImportedRuntimeSurface.SurfaceId;
|
||||
OutLaunchConfig.SurfaceLabel = Deck.ImportedRuntimeSurface.SurfaceLabel;
|
||||
OutLaunchConfig.RuntimeModeId = Deck.ImportedRuntimeSurface.RuntimeModeId;
|
||||
OutLaunchConfig.GeneratorType = Deck.ImportedRuntimeSurface.GeneratorType;
|
||||
OutLaunchConfig.OriginPaths = Deck.ImportedRuntimeSurface.OriginPaths;
|
||||
OutLaunchConfig.Notes = Deck.ImportedRuntimeSurface.Notes;
|
||||
OutLaunchConfig.SelectorChoices = ImportedRuntimeSelectionState.SelectorChoices;
|
||||
|
||||
const FHyperTwistTrainingCase* SeedCase = Deck.Cases.FindByPredicate(
|
||||
[](const FHyperTwistTrainingCase& Candidate)
|
||||
{
|
||||
return Candidate.IsStructurallyValid();
|
||||
}
|
||||
);
|
||||
if (SeedCase != nullptr)
|
||||
{
|
||||
OutLaunchConfig.PuzzleId = SeedCase->PuzzleId;
|
||||
}
|
||||
|
||||
return OutLaunchConfig.IsStructurallyValid();
|
||||
}
|
||||
|
||||
FHyperTwistTrainingMethodDescriptor UHyperTwistTrainingCatalogLibrary::DescribeTrainingDeckMethod(
|
||||
const FHyperTwistTrainingDeck& Deck
|
||||
)
|
||||
|
|
|
|||
|
|
@ -116,6 +116,20 @@ bool UHyperTwistTrainingRuntimeLibrary::TryGetActiveImportedRuntimeSelectionStat
|
|||
return false;
|
||||
}
|
||||
|
||||
bool UHyperTwistTrainingRuntimeLibrary::TryGetActiveImportedGeneratedModeLaunchConfig(
|
||||
UObject* WorldContextObject,
|
||||
FHyperTwistTrainingImportedGeneratedModeLaunchConfig& OutLaunchConfig
|
||||
)
|
||||
{
|
||||
if (UHyperTwistTrainingSubsystem* TrainingSubsystem = GetTrainingSubsystem(WorldContextObject))
|
||||
{
|
||||
return TrainingSubsystem->TryGetActiveImportedGeneratedModeLaunchConfig(OutLaunchConfig);
|
||||
}
|
||||
|
||||
OutLaunchConfig = FHyperTwistTrainingImportedGeneratedModeLaunchConfig();
|
||||
return false;
|
||||
}
|
||||
|
||||
FHyperTwistTrainingRunState UHyperTwistTrainingRuntimeLibrary::ApplyActiveImportedRuntimeSelectorOption(
|
||||
UObject* WorldContextObject,
|
||||
const FString& SelectorId,
|
||||
|
|
|
|||
|
|
@ -759,6 +759,18 @@ bool UHyperTwistTrainingSubsystem::TryGetActiveImportedRuntimeSelectionState(
|
|||
return OutSelectionState.IsStructurallyValid();
|
||||
}
|
||||
|
||||
bool UHyperTwistTrainingSubsystem::TryGetActiveImportedGeneratedModeLaunchConfig(
|
||||
FHyperTwistTrainingImportedGeneratedModeLaunchConfig& OutLaunchConfig
|
||||
) const
|
||||
{
|
||||
return UHyperTwistTrainingCatalogLibrary::TryBuildImportedGeneratedModeLaunchConfig(
|
||||
ActiveRunState.ActiveDeck,
|
||||
ActiveRunState.ImportedRuntimeSelectionState,
|
||||
ActiveRunState.Session,
|
||||
OutLaunchConfig
|
||||
);
|
||||
}
|
||||
|
||||
FHyperTwistTrainingRunState UHyperTwistTrainingSubsystem::ApplyActiveImportedRuntimeSelectorOption(
|
||||
const FString& SelectorId,
|
||||
const FString& OptionId
|
||||
|
|
|
|||
|
|
@ -162,6 +162,14 @@ public:
|
|||
FHyperTwistTrainingCase& OutCase
|
||||
);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "HyperTwist|Training|Catalog")
|
||||
static bool TryBuildImportedGeneratedModeLaunchConfig(
|
||||
const FHyperTwistTrainingDeck& Deck,
|
||||
const FHyperTwistTrainingImportedRuntimeSelectionState& ImportedRuntimeSelectionState,
|
||||
const FHyperTwistTrainingSession& Session,
|
||||
FHyperTwistTrainingImportedGeneratedModeLaunchConfig& OutLaunchConfig
|
||||
);
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "HyperTwist|Training|Catalog")
|
||||
static FHyperTwistTrainingMethodDescriptor DescribeTrainingDeckMethod(
|
||||
const FHyperTwistTrainingDeck& Deck
|
||||
|
|
|
|||
|
|
@ -54,6 +54,12 @@ public:
|
|||
FHyperTwistTrainingImportedRuntimeSelectionState& OutSelectionState
|
||||
);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "HyperTwist|Training", meta = (WorldContext = "WorldContextObject"))
|
||||
static bool TryGetActiveImportedGeneratedModeLaunchConfig(
|
||||
UObject* WorldContextObject,
|
||||
FHyperTwistTrainingImportedGeneratedModeLaunchConfig& OutLaunchConfig
|
||||
);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "HyperTwist|Training", meta = (WorldContext = "WorldContextObject"))
|
||||
static FHyperTwistTrainingRunState ApplyActiveImportedRuntimeSelectorOption(
|
||||
UObject* WorldContextObject,
|
||||
|
|
|
|||
|
|
@ -43,6 +43,11 @@ public:
|
|||
FHyperTwistTrainingImportedRuntimeSelectionState& OutSelectionState
|
||||
) const;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "HyperTwist|Training")
|
||||
bool TryGetActiveImportedGeneratedModeLaunchConfig(
|
||||
FHyperTwistTrainingImportedGeneratedModeLaunchConfig& OutLaunchConfig
|
||||
) const;
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "HyperTwist|Training")
|
||||
FHyperTwistTrainingRunState ApplyActiveImportedRuntimeSelectorOption(
|
||||
const FString& SelectorId,
|
||||
|
|
|
|||
|
|
@ -493,6 +493,57 @@ struct FHyperTwistTrainingImportedRuntimeSelectionState
|
|||
}
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FHyperTwistTrainingImportedGeneratedModeLaunchConfig
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
FString DeckId;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
FString UserId;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
FString TrainingSessionId;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
EHyperTwistTrainingDeliveryMode DeliveryMode = EHyperTwistTrainingDeliveryMode::Timer;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
FString PuzzleId;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
FString SurfaceId;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
FString SurfaceLabel;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
FString RuntimeModeId;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
FString GeneratorType;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
TArray<FHyperTwistTrainingImportedRuntimeSelectorChoice> SelectorChoices;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
TArray<FString> OriginPaths;
|
||||
|
||||
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "HyperTwist")
|
||||
FString Notes;
|
||||
|
||||
bool IsStructurallyValid() const
|
||||
{
|
||||
return !DeckId.IsEmpty()
|
||||
&& !TrainingSessionId.IsEmpty()
|
||||
&& !SurfaceId.IsEmpty()
|
||||
&& !RuntimeModeId.IsEmpty()
|
||||
&& SelectorChoices.Num() > 0;
|
||||
}
|
||||
};
|
||||
|
||||
USTRUCT(BlueprintType)
|
||||
struct FHyperTwistTrainingDeck
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue