Skip to content

Commit

Permalink
Add RC settings
Browse files Browse the repository at this point in the history
  • Loading branch information
ivazhuk committed Apr 24, 2024
1 parent 3d0be8c commit 79e1e37
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Source/SodaLoadingScreen/Private/SodaLoadingScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ void FSodaLoadingScreenModule::StartupModule()

SetupLoadingScreen();
}

FCommandLine::Append(TEXT(" -RCWebControlEnable"));
}

void FSodaLoadingScreenModule::ShutdownModule()
Expand Down
61 changes: 61 additions & 0 deletions Source/UnrealSoda/Private/UI/Toolbar/SSodaViewportToolBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "Soda/SodaUserSettings.h"
#include "JoystickGameSettings.h"
#include "SodaJoystick.h"
#include "RemoteControlSettings.h"

#define LOCTEXT_NAMESPACE "SodaViewportToolBar"

Expand Down Expand Up @@ -575,6 +576,66 @@ TSharedRef<SWidget> SSodaViewportToolBar::GenerateOptionsMenu()
Action);
}

{
FUIAction Action;
Action.ExecuteAction.BindLambda([]()
{
USodaGameModeComponent* GameMode = USodaGameModeComponent::GetChecked();
FRuntimeEditorModule& RuntimeEditorModule = FModuleManager::LoadModuleChecked<FRuntimeEditorModule>("RuntimeEditor");
soda::FDetailsViewArgs Args;
Args.bHideSelectionTip = true;
Args.bLockable = false;
TSharedPtr<soda::IDetailsView> DetailView = RuntimeEditorModule.CreateDetailView(Args);
DetailView->SetObject(GetMutableDefault<URemoteControlSettings>());
GameMode->PushToolBox(
SNew(SToolBox)
.Caption(FText::FromString("RC Settings"))
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.FillHeight(1)

[
DetailView.ToSharedRef()
]
+ SVerticalBox::Slot()
.AutoHeight()
.VAlign(VAlign_Top)
.HAlign(HAlign_Center)
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.Padding(5)
[
SNew(SButton)
.Text(FText::FromString(TEXT("Save")))
.OnClicked(FOnClicked::CreateLambda([]()
{
GetMutableDefault<URemoteControlSettings>()->SaveConfig();
return FReply::Handled();
}))
]
+ SHorizontalBox::Slot()
.Padding(5)
[
SNew(SButton)
.Text(FText::FromString(TEXT("Reset")))
.OnClicked(FOnClicked::CreateLambda([]()
{
GetMutableDefault<URemoteControlSettings>()->LoadConfig();
return FReply::Handled();
}))
]
]
]);
});
MenuBuilder.AddMenuEntry(
FText::FromString("RC Settings"),
FText::FromString("RC Settings"),
FSlateIcon(FSodaStyle::Get().GetStyleSetName(), "Icons.World"),
Action);
}

{
FUIAction Action;
Action.ExecuteAction.BindLambda([this]()
Expand Down

0 comments on commit 79e1e37

Please sign in to comment.