diff --git a/Content/BP_BugMarkerActor.uasset b/Content/BP_BugMarkerActor.uasset index 55d3325..9bfcbdc 100644 Binary files a/Content/BP_BugMarkerActor.uasset and b/Content/BP_BugMarkerActor.uasset differ diff --git a/Content/BP_BugPlacerPawn.uasset b/Content/BP_BugPlacerPawn.uasset index 92ffc90..608f855 100644 Binary files a/Content/BP_BugPlacerPawn.uasset and b/Content/BP_BugPlacerPawn.uasset differ diff --git a/Content/MC_BugPlacement.uasset b/Content/MC_BugPlacement.uasset index bba1fb4..a60e5b2 100644 Binary files a/Content/MC_BugPlacement.uasset and b/Content/MC_BugPlacement.uasset differ diff --git a/Content/M_BuggieIcon.uasset b/Content/M_BuggieIcon.uasset index 60f9452..a357e6f 100644 Binary files a/Content/M_BuggieIcon.uasset and b/Content/M_BuggieIcon.uasset differ diff --git a/Content/T_Buggie_370x512.uasset b/Content/T_Buggie_370x512.uasset deleted file mode 100644 index eeae6e5..0000000 Binary files a/Content/T_Buggie_370x512.uasset and /dev/null differ diff --git a/Content/T_Buggie_Centred.uasset b/Content/T_Buggie_Centred.uasset new file mode 100644 index 0000000..d0262b9 Binary files /dev/null and b/Content/T_Buggie_Centred.uasset differ diff --git a/Content/UI/BP_ExitingBugPlacementScreen.uasset b/Content/UI/BP_ExitingBugPlacementScreen.uasset new file mode 100644 index 0000000..3737f94 Binary files /dev/null and b/Content/UI/BP_ExitingBugPlacementScreen.uasset differ diff --git a/Content/UI/CUI_BugSubmissionForm.uasset b/Content/UI/CUI_BugSubmissionForm.uasset index 4be0024..a0ad011 100644 Binary files a/Content/UI/CUI_BugSubmissionForm.uasset and b/Content/UI/CUI_BugSubmissionForm.uasset differ diff --git a/Content/UI/M_ExitBugPlacementScreenCountdown.uasset b/Content/UI/M_ExitBugPlacementScreenCountdown.uasset new file mode 100644 index 0000000..9dca887 Binary files /dev/null and b/Content/UI/M_ExitBugPlacementScreenCountdown.uasset differ diff --git a/Content/UI/T_ConicalGradient.uasset b/Content/UI/T_ConicalGradient.uasset new file mode 100644 index 0000000..429172d Binary files /dev/null and b/Content/UI/T_ConicalGradient.uasset differ diff --git a/Source/Unrealzilla/Private/BugPlacerPawn.cpp b/Source/Unrealzilla/Private/BugPlacerPawn.cpp index c92dc7b..31b23f9 100644 --- a/Source/Unrealzilla/Private/BugPlacerPawn.cpp +++ b/Source/Unrealzilla/Private/BugPlacerPawn.cpp @@ -3,6 +3,7 @@ #include "BugPlacerPawn.h" #include "BugMarkerActor.h" +#include "ExitingBugPlacementScreen.h" #include "UnrealzillaGlobalSettings.h" #include "Components/MaterialBillboardComponent.h" @@ -50,19 +51,6 @@ void ABugPlacerPawn::BeginPlay() this->OriginalPlayer = UGameplayStatics::GetPlayerCharacter(this, 0); - // Create the bug marker we will be placing. - //if (this->BugPlacerBlueprintClass.IsValid()) - //{ - // FActorSpawnParameters SpawnParams; - // SpawnParams.Name = TEXT("BugMarker"); - // SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; - //#if WITH_EDITOR - // SpawnParams.bHideFromSceneOutliner = true; - //#endif - // this->BugMarker = this->GetWorld()->SpawnActor(this->BugPlacerBlueprintClass.Get(), this->SphereComponent->GetComponentTransform(), SpawnParams); - // this->BugMarker->AttachToComponent(this->PlacementMarkerRoot, FAttachmentTransformRules::SnapToTargetNotIncludingScale); - //} - this->Activate(); Super::BeginPlay(); @@ -158,7 +146,7 @@ void ABugPlacerPawn::PlaceBugMarker() SpawnParams.bHideFromSceneOutliner = true; #endif - ABugMarkerActor *Marker = this->GetWorld()->SpawnActor(this->BugPlacerBlueprintClass.Get(), this->PlacementMarkerRoot->GetComponentTransform(), SpawnParams); + ABugMarkerActor *Marker = this->GetWorld()->SpawnActor(this->BugMarkerBlueprintClass.Get(), this->PlacementMarkerRoot->GetComponentTransform(), SpawnParams); Marker->LoadBugSubmissionForm(); } } @@ -177,3 +165,55 @@ void ABugPlacerPawn::Deactivate() this->Destroy(); } + + +void ABugPlacerPawn::ExitStarted() +{ + if (this->ExitingBugPlacementScreenClass.IsValid()) + { + this->ExitingBugPlacementScreen = CreateWidget(UGameplayStatics::GetPlayerController(this, 0), this->ExitingBugPlacementScreenClass.Get()); + this->ExitingBugPlacementScreen->AddToViewport(GetDefault()->BugReportWidgetDepth + 10); + } + else + { + this->ExitingBugPlacementScreen = nullptr; + } +} + +void ABugPlacerPawn::ExitOngoing(const float ElapsedSeconds) +{ + if (this->ExitingBugPlacementScreen) + { + this->ExitingBugPlacementScreen->SetPercent(ElapsedSeconds); + } +} + +void ABugPlacerPawn::ExitTriggered() +{ + if (this->ExitingBugPlacementScreen) + { + this->ExitingBugPlacementScreen->RemoveFromParent(); + this->Deactivate(); + } +} + +void ABugPlacerPawn::ExitCanceled() +{ + if (this->ExitingBugPlacementScreen) + { + this->ExitingBugPlacementScreen->RemoveFromParent(); + } +} + + +void ABugPlacerPawn::SpawnBugPlacerPawn(const UObject *WorldContextObject, TSoftClassPtr Class) +{ + if (Class.IsValid()) + { + const FTransform &Transform = UGameplayStatics::GetPlayerCameraManager(WorldContextObject, 0)->GetActorTransform(); + FActorSpawnParameters SpawnParams; + //SpawnParams.Name = TEXT("BugPlacerPawn"); + SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + WorldContextObject->GetWorld()->SpawnActor(Class.Get(), Transform, SpawnParams); + } +} diff --git a/Source/Unrealzilla/Private/BugSubmissionForm.cpp b/Source/Unrealzilla/Private/BugSubmissionForm.cpp index 0e1b6db..04511bc 100644 --- a/Source/Unrealzilla/Private/BugSubmissionForm.cpp +++ b/Source/Unrealzilla/Private/BugSubmissionForm.cpp @@ -7,6 +7,7 @@ #include "CommonTextBlock.h" #include "HttpModule.h" #include "UnrealzillaGlobalSettings.h" +#include "Components/Overlay.h" #include "Kismet/GameplayStatics.h" @@ -38,6 +39,8 @@ void UBugSubmissionForm::SetMarkerData(ABugMarkerActor *BugMarker) { this->BugMarkerActor = BugMarker; + MapNameValue->SetText(FText::FromString(this->GetWorld()->GetMapName().RightChop(this->GetWorld()->StreamingLevelsPrefix.Len()))); + const FVector MarkerLocation = this->BugMarkerActor->GetActorLocation(); FFormatNamedArguments MarkerLocationArgs; MarkerLocationArgs.Add("X", FormatFloatToText(MarkerLocation.X, 1, 4)); @@ -53,10 +56,9 @@ void UBugSubmissionForm::SetMarkerData(ABugMarkerActor *BugMarker) const FText MarkerUpVectorText = FText::Format(NSLOCTEXT("BugSubmissionForm", "MarkerUpVector", "{X},{Y},{Z}"), MarkerUpVectorArgs); FFormatNamedArguments MapDataArgs; - MapDataArgs.Add("MapName", FText::FromString(this->GetWorld()->GetMapName().RightChop(this->GetWorld()->StreamingLevelsPrefix.Len()))); MapDataArgs.Add("MarkerLocation", MarkerLocationText); MapDataArgs.Add("MarkerUpVector", MarkerUpVectorText); - const FText MapDataText = FText::Format(NSLOCTEXT("BugSubmissionForm", "MapDataFormat", "{MapName}\n{MarkerLocation}\n{MarkerUpVector}"), MapDataArgs); + const FText MapDataText = FText::Format(NSLOCTEXT("BugSubmissionForm", "MapDataFormat", "{MarkerLocation}\n{MarkerUpVector}"), MapDataArgs); this->LocationValue->SetText(MapDataText); } @@ -64,8 +66,10 @@ void UBugSubmissionForm::SetMarkerData(ABugMarkerActor *BugMarker) void UBugSubmissionForm::SubmitForm() { + this->ProcessingRequestOverlay->SetVisibility(ESlateVisibility::Visible); + const FString RESTURL = "/rest.cgi"; - const FString RequestURL = "/bug/7"; + const FString RequestURL = "/bug"; const FString QueryString = "api_key=" + GetDefault()->APIKey; FHttpModule &HttpModule = FHttpModule::Get(); @@ -78,8 +82,6 @@ void UBugSubmissionForm::SubmitForm() Request->ProcessRequest(); this->OnFormSubmit.ExecuteIfBound(); - - this->CloseForm(); } void UBugSubmissionForm::CancelForm() @@ -94,7 +96,7 @@ void UBugSubmissionForm::CancelForm() void UBugSubmissionForm::CloseForm() { UGameplayStatics::GetPlayerController(this, 0)->SetInputMode(FInputModeGameOnly()); - UGameplayStatics::GetPlayerController(this, 0)->bShowMouseCursor = true; + UGameplayStatics::GetPlayerController(this, 0)->bShowMouseCursor = false; this->RemoveFromParent(); } @@ -104,6 +106,8 @@ void UBugSubmissionForm::ServerResponse(FHttpRequestPtr Request, FHttpResponsePt if (Success) { UE_LOG(LogTemp, Log, TEXT("%s"), *Response->GetContentAsString()); + + this->CloseForm(); } else { @@ -121,7 +125,7 @@ void UBugSubmissionForm::ServerResponse(FHttpRequestPtr Request, FHttpResponsePt UE_LOG(LogTemp, Error, TEXT("Connection failed")); break; case EHttpRequestStatus::Succeeded: - UE_LOG(LogTemp, Warning, TEXT("Connection succeeded")); + UE_LOG(LogTemp, Log, TEXT("Connection succeeded")); break; default: UE_LOG(LogTemp, Error, TEXT("Request failed")); diff --git a/Source/Unrealzilla/Private/ExitingBugPlacementScreen.cpp b/Source/Unrealzilla/Private/ExitingBugPlacementScreen.cpp new file mode 100644 index 0000000..aea1d23 --- /dev/null +++ b/Source/Unrealzilla/Private/ExitingBugPlacementScreen.cpp @@ -0,0 +1,6 @@ +// ©2022 Batty Bovine Productions, LLC. All Rights Reserved. + +#include "ExitingBugPlacementScreen.h" + + + diff --git a/Source/Unrealzilla/Public/BugPlacerPawn.h b/Source/Unrealzilla/Public/BugPlacerPawn.h index 31c0510..7061b36 100644 --- a/Source/Unrealzilla/Public/BugPlacerPawn.h +++ b/Source/Unrealzilla/Public/BugPlacerPawn.h @@ -27,6 +27,9 @@ public: UFUNCTION(BlueprintCallable) void Deactivate(); + UFUNCTION(BlueprintCallable, meta=(WorldContext="WorldContextObject")) + static void SpawnBugPlacerPawn(const UObject *WorldContextObject, TSoftClassPtr Class); + protected: UFUNCTION(BlueprintCallable) void SetArbitraryPlacement(bool bSet); @@ -34,40 +37,46 @@ protected: UFUNCTION(BlueprintCallable) void PlaceBugMarker(); - + UFUNCTION(BlueprintCallable) + void ExitStarted(); + UFUNCTION(BlueprintCallable) + void ExitOngoing(const float ElapsedSeconds); + UFUNCTION(BlueprintCallable) + void ExitTriggered(); + UFUNCTION(BlueprintCallable) + void ExitCanceled(); + // Collision sphere, and root component UPROPERTY(BlueprintReadOnly, VisibleAnywhere) TObjectPtr SphereComponent; - // Follows the collision point of a line trace, and indicates where the bug marker will be placed. UPROPERTY(BlueprintReadOnly, EditAnywhere) TObjectPtr PlacementMarkerRoot; - // The glowing end point of the laser, to indicate a surface where a marker can be placed. UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) TObjectPtr LaserGlow; - // The origin of our line trace; line extends from this origin position along the component's // forward vector a set distance to check for surfaces where a bug marker can be placed. UPROPERTY(BlueprintReadOnly, EditAnywhere) TObjectPtr TraceOriginComponent; - // Basic movement component to allow the bug placer to fly through a level. UPROPERTY(BlueprintReadOnly, VisibleAnywhere) TObjectPtr PawnMovement; - UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) - TSoftClassPtr BugPlacerBlueprintClass; + TSoftClassPtr BugMarkerBlueprintClass; + UPROPERTY(BlueprintReadOnly, EditDefaultsOnly) + TSoftClassPtr ExitingBugPlacementScreenClass; UPROPERTY(BlueprintReadWrite) float SavedMaxSpeed = 0.0f; private: uint8 bArbitraryPlacement : 1; - uint8 bCurrentTraceHit : 1; TObjectPtr OriginalPlayer; TObjectPtr BugMarker; + + TObjectPtr ExitingBugPlacementScreen; }; diff --git a/Source/Unrealzilla/Public/BugSubmissionForm.h b/Source/Unrealzilla/Public/BugSubmissionForm.h index 084daf3..b7e767c 100644 --- a/Source/Unrealzilla/Public/BugSubmissionForm.h +++ b/Source/Unrealzilla/Public/BugSubmissionForm.h @@ -28,6 +28,8 @@ protected: UPROPERTY(BlueprintReadOnly, meta=(BindWidget)) TObjectPtr ProductNameValue; + UPROPERTY(BlueprintReadOnly, meta=(BindWidget)) + TObjectPtr MapNameValue; UPROPERTY(BlueprintReadOnly, meta=(BindWidget)) TObjectPtr LocationValue; @@ -36,6 +38,9 @@ protected: UPROPERTY(BlueprintReadOnly, meta=(BindWidget)) TObjectPtr SubmitButton; + UPROPERTY(BlueprintReadOnly, meta=(BindWidget)) + TObjectPtr ProcessingRequestOverlay; + private: void ServerResponse(FHttpRequestPtr Request, FHttpResponsePtr Response, bool Success); diff --git a/Source/Unrealzilla/Public/ExitingBugPlacementScreen.h b/Source/Unrealzilla/Public/ExitingBugPlacementScreen.h new file mode 100644 index 0000000..f958720 --- /dev/null +++ b/Source/Unrealzilla/Public/ExitingBugPlacementScreen.h @@ -0,0 +1,19 @@ +// ©2022 Batty Bovine Productions, LLC. All Rights Reserved. + +#pragma once + +#include "CoreMinimal.h" +#include "Blueprint/UserWidget.h" + +#include "ExitingBugPlacementScreen.generated.h" + + +UCLASS() +class UNREALZILLA_API UExitingBugPlacementScreen : public UUserWidget +{ + GENERATED_BODY() + +public: + UFUNCTION(BlueprintImplementableEvent) + void SetPercent(const float Percent); +};