diff --git a/Content/Blueprints/BP_MyTempCharacter.uasset b/Content/Blueprints/BP_MyTempCharacter.uasset index 2511028..269b1f1 100644 --- a/Content/Blueprints/BP_MyTempCharacter.uasset +++ b/Content/Blueprints/BP_MyTempCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:191e50199b24a870f7a204a31859477a601a2f654c3f60091d0a8ef50a6315e2 -size 29434 +oid sha256:fb0a77b0f469d017557974965bdd05383d263fdb8e96bb7d176fd760f02c53f2 +size 30012 diff --git a/Content/Levels/MerchantPrototype.umap b/Content/Levels/MerchantPrototype.umap index 4d2eef1..218ee10 100644 --- a/Content/Levels/MerchantPrototype.umap +++ b/Content/Levels/MerchantPrototype.umap @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ec29ba0db3dfe4058261d9534947c299b31f5b36d3a91ddfdd70f1606afd1b3d -size 23329 +oid sha256:e11da137b25dda1d74cb3fcbcc1feaaa4fa3d8cffb13e8994b75a01e3691eed7 +size 23038 diff --git a/Content/Merchant/BP_MerchantGameMode.uasset b/Content/Merchant/BP_MerchantGameMode.uasset index f9bbf98..cc33181 100644 --- a/Content/Merchant/BP_MerchantGameMode.uasset +++ b/Content/Merchant/BP_MerchantGameMode.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:2d2407c9aeda28720c26b714c16034f1209ee213730b0931ebd93ead214b261c -size 27962 +oid sha256:cc549e8f57a466d4be83e0d4519404f3b2dd0186c70090e944c9089772a594b8 +size 20569 diff --git a/Content/Merchant_Blueprint.uasset b/Content/Merchant_Blueprint.uasset new file mode 100644 index 0000000..fb48a05 --- /dev/null +++ b/Content/Merchant_Blueprint.uasset @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a6417b56f9b2842d2ba70bedffc0f6ff3e8b428f5f84d5aa37e5cd7e8a77256d +size 30945 diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index ed9890a..bde03dc 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -1,8 +1,10 @@ // Fill out your copyright notice in the Description page of Project Settings. - #include "TempCharacter.h" - +#include "UObject/SoftObjectPath.h" +#include "Dialogs/Dialogs.h" +#include "Engine/GameViewportClient.h" +#include "Blueprint/UserWidget.h" #include "../../../Plugins/Developer/RiderLink/Source/RD/thirdparty/clsocket/src/ActiveSocket.h" @@ -66,16 +68,44 @@ void ATempCharacter::LineTraceLogic() TraceParams.AddIgnoredActor(this); - bool bHit = GetWorld()->LineTraceSingleByChannel(OutHit, Start, End, ECC_Visibility, TraceParams); + /*bool bHit = GetWorld()->LineTraceSingleByChannel(OutHit, Start, End, ECC_Visibility, TraceParams); if (bHit) { if (OutHit.GetActor()->ActorHasTag("MerchantTag")) { + FStringClassReference WidgetRef(TEXT("WidgetBlueprint/Game/Merchant/BP_OPENDIAL.BP_OPENDIAL")); + TSubclassOf WidgetLoad = WidgetRef.TryLoadClass(); + + UUserWidget* TestWidget = CreateWidget(this, WidgetLoad, FName(TEXT("MyWidget"))); + if(TestWidget) + { + TestWidget->AddToViewport(0); + } DrawDebugLine(GetWorld(), Start, End, FColor::Green, false, 1.0f); UE_LOG(LogTemp, Display, TEXT("HIT: %s"), *OutHit.GetActor()->GetName()); } } +*/ - - + // In a constructor + FStringClassReference MyWidgetClassRef(TEXT("/Game/Widgets/TestWidget.TestWidget_C")); + // Get the widget class + + TSubclassOf TestWidgetClass = MyWidgetClassRef.TryLoadClass(); + + // ... then to display you widget do + + // Check if class was found + if (TestWidgetClass ) + { + // Create the widget + UUserWidget* TestWidget= CreateWidget(this, TestWidgetClass, FName(TEXT("MyWidget"))); + // Check if widget was created + if (TestWidget) + { + TestWidget->AddToViewport(); + } + } + + // I GIVE UP LOL! } diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index a726a8d..d264f59 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -4,6 +4,7 @@ #include "CoreMinimal.h" #include "GameFramework/Character.h" +#include "Blueprint/UserWidget.h" #include "TempCharacter.generated.h" UCLASS() diff --git a/Source/the_twilight_abyss/the_twilight_abyss.Build.cs b/Source/the_twilight_abyss/the_twilight_abyss.Build.cs index 9cb5741..b6dac8e 100644 --- a/Source/the_twilight_abyss/the_twilight_abyss.Build.cs +++ b/Source/the_twilight_abyss/the_twilight_abyss.Build.cs @@ -8,7 +8,7 @@ public class the_twilight_abyss : ModuleRules { PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; - PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" }); + PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "UMG" }); PrivateDependencyModuleNames.AddRange(new string[] { }); diff --git a/the_twilight_abyss.uproject b/the_twilight_abyss.uproject index 2387df4..4f33989 100644 --- a/the_twilight_abyss.uproject +++ b/the_twilight_abyss.uproject @@ -9,7 +9,8 @@ "Type": "Runtime", "LoadingPhase": "Default", "AdditionalDependencies": [ - "Engine" + "Engine", + "UMG" ] } ],