Add investor startup sequence
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
// Copyright Pacificao. All Rights Reserved.
|
||||
|
||||
#include "AgrarianDemoNoticeWidget.h"
|
||||
|
||||
#include "Rendering/DrawElements.h"
|
||||
#include "Styling/CoreStyle.h"
|
||||
|
||||
int32 UAgrarianDemoNoticeWidget::NativePaint(
|
||||
const FPaintArgs& Args,
|
||||
const FGeometry& AllottedGeometry,
|
||||
const FSlateRect& MyCullingRect,
|
||||
FSlateWindowElementList& OutDrawElements,
|
||||
int32 LayerId,
|
||||
const FWidgetStyle& InWidgetStyle,
|
||||
bool bParentEnabled) const
|
||||
{
|
||||
LayerId = Super::NativePaint(Args, AllottedGeometry, MyCullingRect, OutDrawElements, LayerId, InWidgetStyle, bParentEnabled);
|
||||
|
||||
const FVector2D Size = AllottedGeometry.GetLocalSize();
|
||||
const float PanelWidth = FMath::Min(860.0f, Size.X - 96.0f);
|
||||
const float PanelHeight = 210.0f;
|
||||
const FVector2D PanelPosition((Size.X - PanelWidth) * 0.5f, 42.0f);
|
||||
|
||||
FSlateDrawElement::MakeBox(
|
||||
OutDrawElements,
|
||||
++LayerId,
|
||||
AllottedGeometry.ToPaintGeometry(FVector2f(PanelWidth, PanelHeight), FSlateLayoutTransform(FVector2f(PanelPosition))),
|
||||
FCoreStyle::Get().GetBrush(TEXT("WhiteBrush")),
|
||||
ESlateDrawEffect::None,
|
||||
FLinearColor(0.02f, 0.03f, 0.025f, 0.82f));
|
||||
|
||||
FSlateDrawElement::MakeBox(
|
||||
OutDrawElements,
|
||||
++LayerId,
|
||||
AllottedGeometry.ToPaintGeometry(FVector2f(PanelWidth, 3.0f), FSlateLayoutTransform(FVector2f(PanelPosition))),
|
||||
FCoreStyle::Get().GetBrush(TEXT("WhiteBrush")),
|
||||
ESlateDrawEffect::None,
|
||||
FLinearColor(0.45f, 0.72f, 0.40f, 1.0f));
|
||||
|
||||
const FSlateFontInfo MottoFont = FCoreStyle::GetDefaultFontStyle("Bold", 30);
|
||||
const FSlateFontInfo VersionFont = FCoreStyle::GetDefaultFontStyle("Regular", 18);
|
||||
const FSlateFontInfo NoticeFont = FCoreStyle::GetDefaultFontStyle("Regular", 16);
|
||||
|
||||
DrawCenteredText(OutDrawElements, LayerId, AllottedGeometry, Motto, PanelPosition.Y + 34.0f, MottoFont, FLinearColor(0.86f, 0.94f, 0.78f, 1.0f));
|
||||
DrawCenteredText(OutDrawElements, LayerId, AllottedGeometry, VersionLabel, PanelPosition.Y + 94.0f, VersionFont, FLinearColor(0.82f, 0.86f, 0.78f, 1.0f));
|
||||
DrawCenteredText(OutDrawElements, LayerId, AllottedGeometry, DemoNotice, PanelPosition.Y + 126.0f, NoticeFont, FLinearColor(0.78f, 0.82f, 0.75f, 1.0f));
|
||||
DrawCenteredText(OutDrawElements, LayerId, AllottedGeometry, CopyrightNotice, PanelPosition.Y + 158.0f, NoticeFont, FLinearColor(0.66f, 0.70f, 0.64f, 1.0f));
|
||||
|
||||
return LayerId;
|
||||
}
|
||||
|
||||
void UAgrarianDemoNoticeWidget::DrawCenteredText(
|
||||
FSlateWindowElementList& OutDrawElements,
|
||||
int32& LayerId,
|
||||
const FGeometry& AllottedGeometry,
|
||||
const FText& Text,
|
||||
float Y,
|
||||
const FSlateFontInfo& Font,
|
||||
const FLinearColor& Color) const
|
||||
{
|
||||
const FVector2D Size = AllottedGeometry.GetLocalSize();
|
||||
const FString TextString = Text.ToString();
|
||||
const float EstimatedWidth = FMath::Min(Size.X - 96.0f, static_cast<float>(TextString.Len()) * Font.Size * 0.52f);
|
||||
const FVector2D TextPosition((Size.X - EstimatedWidth) * 0.5f, Y);
|
||||
|
||||
FSlateDrawElement::MakeText(
|
||||
OutDrawElements,
|
||||
++LayerId,
|
||||
AllottedGeometry.ToPaintGeometry(FVector2f(EstimatedWidth, Font.Size + 12.0f), FSlateLayoutTransform(FVector2f(TextPosition))),
|
||||
Text,
|
||||
Font,
|
||||
ESlateDrawEffect::None,
|
||||
Color);
|
||||
}
|
||||
Reference in New Issue
Block a user