You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
136 lines
3.4 KiB
C++
136 lines
3.4 KiB
C++
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "OutputLogPrivatePCH.h"
|
|
#include "OutputLogModule.h"
|
|
#include "SDebugConsole.h"
|
|
#include "SOutputLog.h"
|
|
|
|
namespace DebugConsoleDefs
|
|
{
|
|
// How many seconds to animate when console is summoned
|
|
static const float IntroAnimationDuration = 0.25f;
|
|
}
|
|
|
|
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
|
|
|
void SDebugConsole::Construct( const FArguments& InArgs, const EDebugConsoleStyle::Type InStyle, FOutputLogModule* OutputLogModule, const FDebugConsoleDelegates* DebugConsoleDelegates )
|
|
{
|
|
CurrentStyle = InStyle;
|
|
|
|
TSharedPtr<SConsoleInputBox> ConsoleInputBox;
|
|
|
|
check( OutputLogModule != NULL );
|
|
ChildSlot
|
|
[
|
|
SNew( SVerticalBox )
|
|
+SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
[
|
|
SNew( SVerticalBox )
|
|
.Visibility( this, &SDebugConsole::MakeVisibleIfLogIsShown )
|
|
|
|
+SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
.Padding( 10.0f )
|
|
[
|
|
SNew(SBox)
|
|
.HeightOverride( 200.0f )
|
|
[
|
|
SNew( SBorder )
|
|
.BorderImage( FEditorStyle::GetBrush( "ToolPanel.GroupBorder" ) )
|
|
.ColorAndOpacity( this, &SDebugConsole::GetAnimatedColorAndOpacity )
|
|
.BorderBackgroundColor( this, &SDebugConsole::GetAnimatedSlateColor )
|
|
[
|
|
SNew( SSpacer )
|
|
]
|
|
]
|
|
]
|
|
]
|
|
|
|
+SVerticalBox::Slot()
|
|
.AutoHeight()
|
|
.Padding( 10.0f )
|
|
[
|
|
SNew(SBox)
|
|
.HeightOverride( 26.0f )
|
|
.HAlign( HAlign_Left )
|
|
[
|
|
SNew( SBorder )
|
|
.Padding( FMargin(2) )
|
|
.BorderImage( FEditorStyle::GetBrush( "DebugConsole.Background" ) )
|
|
.ColorAndOpacity( this, &SDebugConsole::GetAnimatedColorAndOpacity )
|
|
.BorderBackgroundColor( this, &SDebugConsole::GetAnimatedSlateColor )
|
|
[
|
|
SNew(SHorizontalBox)
|
|
+ SHorizontalBox::Slot()
|
|
.AutoWidth()
|
|
.Padding(3.0f)
|
|
.VAlign(VAlign_Center)
|
|
[
|
|
SNew(STextBlock)
|
|
.Text(NSLOCTEXT("Console", "ConsoleLabel", "Console"))
|
|
|
|
]
|
|
+ SHorizontalBox::Slot()
|
|
.Padding(5.0f, 2.0f)
|
|
.VAlign(VAlign_Center)
|
|
.MaxWidth(400.0f)
|
|
[
|
|
SAssignNew(ConsoleInputBox, SConsoleInputBox)
|
|
.OnConsoleCommandExecuted(DebugConsoleDelegates->OnConsoleCommandExecuted)
|
|
]
|
|
]
|
|
]
|
|
]
|
|
];
|
|
|
|
EditableTextBox = ConsoleInputBox->GetEditableTextBox();
|
|
|
|
// Kick off intro animation
|
|
AnimCurveSequence = FCurveSequence();
|
|
AnimCurve = AnimCurveSequence.AddCurve( 0.0f, DebugConsoleDefs::IntroAnimationDuration, ECurveEaseFunction::QuadOut );
|
|
FlashCurve = AnimCurveSequence.AddCurve( DebugConsoleDefs::IntroAnimationDuration, .15f, ECurveEaseFunction::QuadInOut );
|
|
|
|
AnimCurveSequence.Play(this->AsShared());
|
|
}
|
|
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
|
|
|
SDebugConsole::SDebugConsole()
|
|
: CurrentStyle( EDebugConsoleStyle::Compact )
|
|
{
|
|
}
|
|
|
|
|
|
void SDebugConsole::SetFocusToEditableText()
|
|
{
|
|
FSlateApplication::Get().SetKeyboardFocus( EditableTextBox.ToSharedRef(), EFocusCause::SetDirectly );
|
|
}
|
|
|
|
EVisibility SDebugConsole::MakeVisibleIfLogIsShown() const
|
|
{
|
|
return CurrentStyle == EDebugConsoleStyle::WithLog ? EVisibility::Visible : EVisibility::Collapsed;
|
|
}
|
|
|
|
|
|
FLinearColor SDebugConsole::GetAnimatedColorAndOpacity() const
|
|
{
|
|
return FLinearColor( 1.0f, 1.0f, 1.0f, AnimCurve.GetLerp() );
|
|
}
|
|
|
|
|
|
FSlateColor SDebugConsole::GetAnimatedSlateColor() const
|
|
{
|
|
return FSlateColor( GetAnimatedColorAndOpacity() );
|
|
}
|
|
|
|
FSlateColor SDebugConsole::GetFlashColor() const
|
|
{
|
|
float FlashAlpha = 1.0f - FlashCurve.GetLerp();
|
|
|
|
if (FlashAlpha == 1.0f)
|
|
{
|
|
FlashAlpha = 0.0f;
|
|
}
|
|
|
|
return FLinearColor(1,1,1,FlashAlpha);
|
|
} |