-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
247 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
Source/ActorInteractionPluginEditor/Private/HelpButton/AIntPCommands.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
|
||
#include "AIntPCommands.h" | ||
|
||
#define LOCTEXT_NAMESPACE "ActorInteractionPluginEditorModule" | ||
|
||
void FAIntPCommands::RegisterCommands() | ||
{ | ||
UI_COMMAND(PluginAction, "Support", "Opens Mountea Framework Support channel", EUserInterfaceActionType::Button, FInputChord(EModifierKey::Control|EModifierKey::Shift|EModifierKey::Alt, EKeys::X)); | ||
} | ||
|
||
#undef LOCTEXT_NAMESPACE |
24 changes: 24 additions & 0 deletions
24
Source/ActorInteractionPluginEditor/Private/HelpButton/AIntPCommands.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "AIntPHelpStyle.h" | ||
|
||
|
||
class FAIntPCommands : public TCommands<FAIntPCommands> | ||
{ | ||
public: | ||
|
||
FAIntPCommands() | ||
: TCommands<FAIntPCommands>(TEXT("AIntPSupport"), NSLOCTEXT("Contexts", "Support", "ActorInteraction Plugin"), NAME_None, FAIntPHelpStyle::GetStyleSetName()) | ||
{ | ||
} | ||
|
||
// TCommands<> interface | ||
virtual void RegisterCommands() override; | ||
|
||
public: | ||
|
||
TSharedPtr< FUICommandInfo > PluginAction; | ||
}; |
72 changes: 72 additions & 0 deletions
72
Source/ActorInteractionPluginEditor/Private/HelpButton/AIntPHelpStyle.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
|
||
#include "AIntPHelpStyle.h" | ||
#include "Framework/Application/SlateApplication.h" | ||
#include "Styling/SlateStyleRegistry.h" | ||
#include "Slate/SlateGameResources.h" | ||
#include "Interfaces/IPluginManager.h" | ||
|
||
TSharedPtr< FSlateStyleSet > FAIntPHelpStyle::StyleInstance = nullptr; | ||
|
||
void FAIntPHelpStyle::Initialize() | ||
{ | ||
if (!StyleInstance.IsValid()) | ||
{ | ||
StyleInstance = Create(); | ||
FSlateStyleRegistry::RegisterSlateStyle(*StyleInstance); | ||
} | ||
} | ||
|
||
void FAIntPHelpStyle::Shutdown() | ||
{ | ||
FSlateStyleRegistry::UnRegisterSlateStyle(*StyleInstance); | ||
ensure(StyleInstance.IsUnique()); | ||
StyleInstance.Reset(); | ||
} | ||
|
||
void FAIntPHelpStyle::ReloadTextures() | ||
{ | ||
if (FSlateApplication::IsInitialized()) | ||
{ | ||
FSlateApplication::Get().GetRenderer()->ReloadTextureResources(); | ||
} | ||
} | ||
|
||
const ISlateStyle& FAIntPHelpStyle::Get() | ||
{ | ||
return *StyleInstance; | ||
} | ||
|
||
FName FAIntPHelpStyle::GetStyleSetName() | ||
{ | ||
static FName StyleSetName(TEXT("AIntPHelpStyle")); | ||
return StyleSetName; | ||
} | ||
|
||
#define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ ) | ||
#define BOX_BRUSH( RelativePath, ... ) FSlateBoxBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ ) | ||
#define BORDER_BRUSH( RelativePath, ... ) FSlateBorderBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ ) | ||
#define TTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".ttf") ), __VA_ARGS__ ) | ||
#define OTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".otf") ), __VA_ARGS__ ) | ||
|
||
const FVector2D Icon16x16(16.0f, 16.0f); | ||
const FVector2D Icon20x20(20.0f, 20.0f); | ||
const FVector2D Icon40x40(40.0f, 40.0f); | ||
|
||
TSharedRef<FSlateStyleSet> FAIntPHelpStyle::Create() | ||
{ | ||
TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("AIntPHelpStyle")); | ||
Style->SetContentRoot(IPluginManager::Get().FindPlugin("ActorInteractionPlugin")->GetBaseDir() / TEXT("Resources")); | ||
|
||
Style->Set("AIntPSupport.PluginAction", new IMAGE_BRUSH(TEXT("Mountea_Logo"), Icon40x40)); | ||
Style->Set("AIntPSupport.PluginAction.small", new IMAGE_BRUSH(TEXT("HelpIcon"), Icon20x20)); | ||
|
||
return Style; | ||
} | ||
|
||
#undef IMAGE_BRUSH | ||
#undef BOX_BRUSH | ||
#undef BORDER_BRUSH | ||
#undef TTF_FONT | ||
#undef OTF_FONT |
31 changes: 31 additions & 0 deletions
31
Source/ActorInteractionPluginEditor/Private/HelpButton/AIntPHelpStyle.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Fill out your copyright notice in the Description page of Project Settings. | ||
|
||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "Styling/SlateStyle.h" | ||
|
||
class FAIntPHelpStyle | ||
{ | ||
public: | ||
|
||
static void Initialize(); | ||
|
||
static void Shutdown(); | ||
|
||
/** reloads textures used by slate renderer */ | ||
static void ReloadTextures(); | ||
|
||
/** @return The Slate style set for the Actor Interaction Plugin Help Button */ | ||
static const ISlateStyle& Get(); | ||
|
||
static FName GetStyleSetName(); | ||
|
||
private: | ||
|
||
static TSharedRef< class FSlateStyleSet > Create(); | ||
|
||
private: | ||
|
||
static TSharedPtr< class FSlateStyleSet > StyleInstance; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters