From 5f2046252dc051b411078db2bc01c02054b5a5c8 Mon Sep 17 00:00:00 2001 From: Dominik Pavlicek Date: Thu, 22 Dec 2022 19:34:14 +0100 Subject: [PATCH] Update to 5.1 --- ActorInteractionPlugin.uplugin | 2 +- .../ActorInteractionPluginEditor.Build.cs | 6 +- .../Private/ActorInteractionPluginEditor.cpp | 8 + .../Private/Popup/AIntPPopup.cpp | 205 ++++++++++++++++++ .../Private/Popup/AIntPPopup.h | 10 + .../Private/Popup/AIntPPopupConfig.h | 19 ++ 6 files changed, 248 insertions(+), 2 deletions(-) create mode 100644 Source/ActorInteractionPluginEditor/Private/Popup/AIntPPopup.cpp create mode 100644 Source/ActorInteractionPluginEditor/Private/Popup/AIntPPopup.h create mode 100644 Source/ActorInteractionPluginEditor/Private/Popup/AIntPPopupConfig.h diff --git a/ActorInteractionPlugin.uplugin b/ActorInteractionPlugin.uplugin index ee786f3..93e3b46 100644 --- a/ActorInteractionPlugin.uplugin +++ b/ActorInteractionPlugin.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, "Version": 1, - "VersionName": "3.0.0.4", + "VersionName": "3.0.1.0", "FriendlyName": "Actor Interaction Plugin", "Description": "Actor Interaction Plugin is an Open-source Mountea Framework components-based simple framework providing utilities for smart Actor Interaction with other Actors. Developed with Game Developers in mind to allow as easy as possible implementation while maintaining high scalability and diverse options to tweak everything.", "Category": "Mountea Framework", diff --git a/Source/ActorInteractionPluginEditor/ActorInteractionPluginEditor.Build.cs b/Source/ActorInteractionPluginEditor/ActorInteractionPluginEditor.Build.cs index aac13bf..ef0d802 100644 --- a/Source/ActorInteractionPluginEditor/ActorInteractionPluginEditor.Build.cs +++ b/Source/ActorInteractionPluginEditor/ActorInteractionPluginEditor.Build.cs @@ -42,7 +42,11 @@ public ActorInteractionPluginEditor(ReadOnlyTargetRules Target) : base(Target) "AssetTools", "BlueprintGraph", - "Kismet" + "Kismet", + + "WebBrowser", + "EditorStyle", + "DeveloperSettings" } ); diff --git a/Source/ActorInteractionPluginEditor/Private/ActorInteractionPluginEditor.cpp b/Source/ActorInteractionPluginEditor/Private/ActorInteractionPluginEditor.cpp index 132fb61..a4c28c2 100644 --- a/Source/ActorInteractionPluginEditor/Private/ActorInteractionPluginEditor.cpp +++ b/Source/ActorInteractionPluginEditor/Private/ActorInteractionPluginEditor.cpp @@ -14,6 +14,7 @@ #include "AssetToolsModule.h" #include "Kismet2/KismetEditorUtilities.h" +#include "Popup/AIntPPopup.h" #include "Utilities/ActorInteractionEditorUtilities.h" @@ -108,6 +109,13 @@ void FActorInteractionPluginEditor::StartupModule() FKismetEditorUtilities::FOnBlueprintCreated::CreateRaw(this, &FActorInteractionPluginEditor::HandleNewInteractorBlueprintCreated) ); } + + // Register popup + { + + + AIntPPopup::Register(); + } } void FActorInteractionPluginEditor::ShutdownModule() diff --git a/Source/ActorInteractionPluginEditor/Private/Popup/AIntPPopup.cpp b/Source/ActorInteractionPluginEditor/Private/Popup/AIntPPopup.cpp new file mode 100644 index 0000000..41b9911 --- /dev/null +++ b/Source/ActorInteractionPluginEditor/Private/Popup/AIntPPopup.cpp @@ -0,0 +1,205 @@ +#include "AIntPPopup.h" +#include "AIntPPopupConfig.h" +#include "EditorStyleSet.h" +#include "Widgets/Layout/SScrollBox.h" +#include "Widgets/Text/SRichTextBlock.h" +#include "SWebBrowser.h" +#include "Interfaces/IPluginManager.h" + +void AIntPPopup::OnBrowserLinkClicked(const FSlateHyperlinkRun::FMetadata& Metadata) +{ + const FString* URL = Metadata.Find(TEXT("href")); + + if (URL) + { + FPlatformProcess::LaunchURL(**URL, nullptr, nullptr); + } +} + +void AIntPPopup::Register() +{ + const FString PluginDirectory = IPluginManager::Get().FindPlugin(TEXT("ActorInteractionPlugin"))->GetBaseDir(); + const FString UpdatedConfigFile = PluginDirectory + "/Config/UpdateConfig.ini"; + const FString CurrentPluginVersion = "3.0"; + + UAIntPPopupConfig* AIntPPopupConfig = GetMutableDefault(); + + if (FPaths::FileExists(UpdatedConfigFile)) + { + AIntPPopupConfig->LoadConfig(nullptr, *UpdatedConfigFile); + } + else + { + AIntPPopupConfig->SaveConfig(CPF_Config, *UpdatedConfigFile); + } + + if (AIntPPopupConfig->PluginVersionUpdate != CurrentPluginVersion) + { + AIntPPopupConfig->PluginVersionUpdate = CurrentPluginVersion; + AIntPPopupConfig->SaveConfig(CPF_Config, *UpdatedConfigFile); + + FCoreDelegates::OnPostEngineInit.AddLambda([]() + { + Open(); + }); + } +} + +void AIntPPopup::Open() +{ + if (!FSlateApplication::Get().CanDisplayWindows()) + { + return; + } + + TSharedRef WindowContent = SNew(SBorder) + .BorderImage(FCoreStyle::Get().GetBrush("ToolPanel.GroupBorder")) + .Padding(FMargin(8.0f, 8.0f)); + + TSharedPtr Window = SNew(SWindow) + .AutoCenter(EAutoCenter::PreferredWorkArea) + .SupportsMaximize(false) + .SupportsMinimize(false) + .SizingRule(ESizingRule::FixedSize) + .ClientSize(FVector2D(800, 600)) + .Title(FText::FromString("Actor Interaction Plugin")) + .IsTopmostWindow(true) + [ + WindowContent + ]; + + const FSlateFontInfo HeadingFont = FCoreStyle::GetDefaultFontStyle("Regular", 24); + const FSlateFontInfo ContentFont = FCoreStyle::GetDefaultFontStyle("Regular", 12); + + TSharedRef InnerContent = SNew(SVerticalBox) + // Default settings example + + SVerticalBox::Slot() + .AutoHeight() + .Padding(10) + [ + SNew(STextBlock) + .Font(HeadingFont) + .Text(FText::FromString("Actor Interaction Plugin v3.0")) + .Justification(ETextJustify::Center) + ] + + SVerticalBox::Slot() + .FillHeight(1.0) + .Padding(10) + [ + SNew(SBorder) + .Padding(10) + .BorderImage(FAppStyle::GetBrush("ToolPanel.DarkGroupBorder")) + [ + SNew(SScrollBox) + + SScrollBox::Slot() + [ + SNew(SRichTextBlock) + .Text(FText::FromString(R"( +Hello and thank you for using Actor Interaction Plugin! + +First thing first, if you've been enjoying using it, it would mean a lot if you could just drop a small review on the marketplace page :). + +I also made a paid Modular Sword Pack. It's a simple yet powerful tool which allows creating thousands upon thousands unique swords with simple click, not coming with free upgrade of Modular Scabbard System! + +But let's keep it short, here are the cool new features (and bugfixes) of version 3.0! + +Version 3.0 + +Features + +* Add new Interactor Component Base Class implementing IActorInteractorInterface +* Add new child Classes for this new Interactor Base class, replacing existing monolithic ActorInteractorComponent solution +* Add new Interactable Base Component class implementing IActorInteractableInterface +* Add new child Classes for this new Interactable Base class, replacing existing monolithic ActorInteractableComponent solution +* Add new Interactable Widget Interface for easier communication between Widgets and Interactables +* Add Editor billboard so Interactable Components are now easier to spot +* Add new Overlay Materials for 5.1 only + +Bugfixes + +* Fix missed descriptions +* Add DEPRECATED to old Component Classes +)")) + .TextStyle(FAppStyle::Get(), "NormalText") + .DecoratorStyleSet(&FAppStyle::Get()) + .AutoWrapText(true) + + SRichTextBlock::HyperlinkDecorator(TEXT("browser"), FSlateHyperlinkRun::FOnClick::CreateStatic(&OnBrowserLinkClicked)) + ] + ] + ] + + SVerticalBox::Slot() + .AutoHeight() + .Padding(10) + [ + SNew(SHorizontalBox) + + SHorizontalBox::Slot().FillWidth(1.0f) + [ + SNew(SButton) + .Text(FText::FromString("Leave a review <3")) + .HAlign(HAlign_Center) + .OnClicked_Lambda([]() + { + const FString URL = "https://bit.ly/AIntP_UE4Marketplace"; + FPlatformProcess::LaunchURL(*URL, nullptr, nullptr); + + return FReply::Handled(); + }) + ] + + SHorizontalBox::Slot().AutoWidth() + [ + SNew(SSpacer) + .Size(FVector2D(20, 10)) + ] + + SHorizontalBox::Slot().FillWidth(1.0f) + [ + SNew(SButton) + .Text(FText::FromString("Support our work")) + .HAlign(HAlign_Center) + .OnClicked_Lambda([]() + { + const FString URL = "https://bit.ly/AIntP_GitHubDonate"; + FPlatformProcess::LaunchURL(*URL, nullptr, nullptr); + + return FReply::Handled(); + }) + ] + + SHorizontalBox::Slot().AutoWidth() + [ + SNew(SSpacer) + .Size(FVector2D(20, 10)) + ] + + SHorizontalBox::Slot().FillWidth(1.0f) + [ + SNew(SButton) + .Text(FText::FromString("Join support Discord")) + .HAlign(HAlign_Center) + .OnClicked_Lambda([]() + { + const FString URL = "https://discord.gg/2vXWEEN"; + FPlatformProcess::LaunchURL(*URL, nullptr, nullptr); + + return FReply::Handled(); + }) + ] + + SHorizontalBox::Slot().AutoWidth() + [ + SNew(SSpacer) + .Size(FVector2D(20, 10)) + ] + + SHorizontalBox::Slot().FillWidth(1.0f) + [ + SNew(SButton) + .Text(FText::FromString("Close this window")) + .HAlign(HAlign_Center) + .OnClicked_Lambda([Window]() + { + Window->RequestDestroyWindow(); + + return FReply::Handled(); + }) + ] + ]; + + WindowContent->SetContent(InnerContent); + Window = FSlateApplication::Get().AddWindow(Window.ToSharedRef()); +} diff --git a/Source/ActorInteractionPluginEditor/Private/Popup/AIntPPopup.h b/Source/ActorInteractionPluginEditor/Private/Popup/AIntPPopup.h new file mode 100644 index 0000000..9597d62 --- /dev/null +++ b/Source/ActorInteractionPluginEditor/Private/Popup/AIntPPopup.h @@ -0,0 +1,10 @@ +#pragma once +#include "Framework/Text/SlateHyperlinkRun.h" + +class AIntPPopup +{ +public: + static void Register(); + static void Open(); + static void OnBrowserLinkClicked(const FSlateHyperlinkRun::FMetadata& Metadata); +}; diff --git a/Source/ActorInteractionPluginEditor/Private/Popup/AIntPPopupConfig.h b/Source/ActorInteractionPluginEditor/Private/Popup/AIntPPopupConfig.h new file mode 100644 index 0000000..bdd2a16 --- /dev/null +++ b/Source/ActorInteractionPluginEditor/Private/Popup/AIntPPopupConfig.h @@ -0,0 +1,19 @@ +#pragma once + +#include "Engine/DeveloperSettings.h" +#include "AIntPPopupConfig.generated.h" + +UCLASS(config = EditorPerProjectUserSettings) +class UAIntPPopupConfig : public UDeveloperSettings +{ + GENERATED_BODY() + +public: + UAIntPPopupConfig() + { + } + + UPROPERTY(config) + FString PluginVersionUpdate = ""; + +};