TSharedRef< FSlateStyleSet > FFriendsAndChatModuleStyle::Create(FFriendsAndChatStyle FriendStyle) { TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("FriendsAndChatStyle")); const FTextBlockStyle DefaultText = FTextBlockStyle() .SetFont(FriendStyle.FriendsFontStyleSmall); // Name Style const FTextBlockStyle GlobalChatFont = FTextBlockStyle(DefaultText) .SetFont(FriendStyle.FriendsFontStyleSmallBold) .SetColorAndOpacity(FriendStyle.DefaultChatColor); const FTextBlockStyle PartyChatFont = FTextBlockStyle(DefaultText) .SetFont(FriendStyle.FriendsFontStyleSmallBold) .SetColorAndOpacity(FriendStyle.PartyChatColor); const FTextBlockStyle WhisperChatFont = FTextBlockStyle(DefaultText) .SetFont(FriendStyle.FriendsFontStyleSmallBold) .SetColorAndOpacity(FriendStyle.WhisplerChatColor); const FButtonStyle UserNameButton = FButtonStyle() .SetNormal(FSlateNoResource()) .SetPressed(FSlateNoResource()) .SetHovered(FSlateNoResource()); const FHyperlinkStyle GlobalChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(GlobalChatFont) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle PartyChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(PartyChatFont) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle WhisperChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(WhisperChatFont) .SetPadding(FMargin(0.0f)); Style->Set("UserNameTextStyle.GlobalHyperlink", GlobalChatHyperlink); Style->Set("UserNameTextStyle.PartyHyperlink", PartyChatHyperlink); Style->Set("UserNameTextStyle.Whisperlink", WhisperChatHyperlink); Style->Set("UserNameTextStyle.GlobalTextStyle", GlobalChatFont); Style->Set("UserNameTextStyle.PartyTextStyle", PartyChatFont); Style->Set("UserNameTextStyle.WhisperTextStyle", WhisperChatFont); return Style; }
FSlateBrush UBrushBinding::GetValue() const { //SCOPE_CYCLE_COUNTER(STAT_UMGBinding); if ( UObject* Source = SourceObject.Get() ) { if ( bConversion.Get(EConversion::None) == EConversion::None ) { FSlateBrush Value; if ( SourcePath.GetValue<FSlateBrush>(Source, Value) ) { bConversion = EConversion::None; return Value; } } if ( bConversion.Get(EConversion::Texture) == EConversion::Texture ) { UObject* Value; if ( SourcePath.GetValue<UObject*>(Source, Value) ) { if ( UTexture2D* Texture = Cast<UTexture2D>(Value) ) { bConversion = EConversion::Texture; return GetDefault<UWidgetBlueprintLibrary>()->MakeBrushFromTexture(Texture); } } } } return FSlateNoResource(); }
TSharedPtr< FSlateStyleSet > FSlateFileDialogsStyle::Create() { TSharedPtr< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet(FSlateFileDialogsStyle::GetStyleSetName())); Style->SetContentRoot(FPaths::EngineContentDir()); const FVector2D Icon10x10(10.0f, 10.0f); const FVector2D Icon16x16(16.0f, 16.0f); const FVector2D Icon24x24(24.0f, 24.0f); const FVector2D Icon64x64(64.0f, 64.0f); const FSlateColor InvertedForeground(FLinearColor(0.0f, 0.0f, 0.0f)); const FSlateColor SelectionColor(FLinearColor(0.701f, 0.225f, 0.003f)); const FSlateColor SelectionColor_Inactive(FLinearColor(0.25f, 0.25f, 0.25f)); const FSlateColor SelectionColor_Pressed(FLinearColor(0.701f, 0.225f, 0.003f)); // SButton defaults... const FButtonStyle Button = FButtonStyle() .SetNormal( BOX_BRUSH( "Slate/Common/Button", FVector2D(32,32), 8.0f/32.0f ) ) .SetHovered( BOX_BRUSH( "Slate/Common/Button_Hovered", FVector2D(32,32), 8.0f/32.0f ) ) .SetPressed( BOX_BRUSH( "Slate/Common/Button_Pressed", FVector2D(32,32), 8.0f/32.0f ) ) .SetDisabled( BOX_BRUSH( "Slate/Common/Button_Disabled", 8.0f/32.0f ) ) .SetNormalPadding( FMargin( 2,2,2,2 ) ) .SetPressedPadding( FMargin( 2,3,2,1 ) ); { Style->Set( "Button", Button ); Style->Set( "InvertedForeground", InvertedForeground ); } Style->Set("SlateFileDialogs.Dialog", TTF_FONT("Slate/Fonts/Roboto-Regular", 10)); Style->Set("SlateFileDialogs.DialogBold", TTF_FONT("Slate/Fonts/Roboto-Bold", 10)); Style->Set("SlateFileDialogs.DialogLarge", TTF_FONT("Slate/Fonts/Roboto-Bold", 16)); Style->Set("SlateFileDialogs.DirectoryItem", TTF_FONT("Slate/Fonts/Roboto-Bold", 11)); Style->Set( "SlateFileDialogs.GroupBorder", new BOX_BRUSH( "Slate/Common/GroupBorder", FMargin(4.0f/16.0f) ) ); Style->Set("SlateFileDialogs.Folder16", new IMAGE_BRUSH("SlateFileDialogs/Icons/icon_file_folder_16x", Icon16x16)); Style->Set("SlateFileDialogs.Folder24", new IMAGE_BRUSH("SlateFileDialogs/Icons/icon_file_folder_40x", Icon24x24)); Style->Set("SlateFileDialogs.NewFolder24", new IMAGE_BRUSH("SlateFileDialogs/Icons/icon_new_folder_40x", Icon24x24)); Style->Set("SlateFileDialogs.WhiteBackground", new IMAGE_BRUSH("SlateFileDialogs/Common/Window/WindowWhite", Icon64x64)); Style->Set( "SlateFileDialogs.PathDelimiter", new IMAGE_BRUSH( "SlateFileDialogs/Common/SmallArrowRight", Icon10x10 ) ); Style->Set( "SlateFileDialogs.PathText", FTextBlockStyle() .SetFont( TTF_FONT( "Slate/Fonts/Roboto-Bold", 11 ) ) .SetColorAndOpacity( FLinearColor( 1.0f, 1.0f, 1.0f ) ) .SetHighlightColor( FLinearColor( 1.0f, 1.0f, 1.0f ) ) .SetHighlightShape(BOX_BRUSH("Slate/Common/TextBlockHighlightShape", FMargin(3.f /8.f))) .SetShadowOffset( FVector2D( 1,1 ) ) .SetShadowColorAndOpacity( FLinearColor(0,0,0,0.9f) ) ); Style->Set("SlateFileDialogs.FlatButton", FButtonStyle(Button) .SetNormal(FSlateNoResource()) .SetHovered(BOX_BRUSH("SlateFileDialogs/Common/FlatButton", 2.0f / 8.0f, SelectionColor)) .SetPressed(BOX_BRUSH("SlateFileDialogs/Common/FlatButton", 2.0f / 8.0f, SelectionColor_Pressed)) ); return Style; }
TSharedRef< FSlateStyleSet > FPluginCreatorStyle::Create() { TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("PCStyle")); Style->SetContentRoot(FPaths::EngineContentDir() / TEXT("Slate")); const FTextBlockStyle TabButtonText = FTextBlockStyle() .SetFont(TTF_FONT("Fonts/Roboto-Bold", 10)) .SetColorAndOpacity(FSlateColor::UseForeground()) .SetShadowColorAndOpacity(FLinearColor::Black) .SetHighlightColor(FLinearColor(0.02f, 0.3f, 0.0f)) .SetShadowOffset(FVector2D(-1, 1)) .SetHighlightShape(BOX_BRUSH("Common/TextBlockHighlightShape", FMargin(3.f / 8.f))); Style->Set("TabButton.Text", TabButtonText); Style->Set("PluginNameFont", TTF_FONT("Fonts/Roboto-Bold", 18)); Style->SetContentRoot(GetPluginCreatorRootPath() / TEXT("Resources")); Style->Set("DefaultPluginIcon", new IMAGE_BRUSH(TEXT("DefaultIcon128"), Icon128x128)); Style->Set("BlankPluginSource", new IMAGE_BRUSH(TEXT("blankpluginSource"), FVector2D(301, 200))); Style->Set("BasicPluginSource", new IMAGE_BRUSH(TEXT("basicpluginSource"), FVector2D(288, 290))); const FButtonStyle NoBorder = FButtonStyle() .SetNormal(FSlateNoResource()) .SetHovered(FSlateNoResource()) .SetPressed(FSlateNoResource()) .SetNormalPadding(FMargin(0, 0, 0, 1)) .SetPressedPadding(FMargin(0, 1, 0, 0)); Style->Set("NoBorderButton", NoBorder); Style->Set("NoBorder", new FSlateNoResource()); Style->Set("DarkGrayBackground", new BOX_BRUSH("DarkGrayBackground", FMargin(4 / 16.0f))); return Style; }
FSlateBrush UPaperSpriteBlueprintLibrary::MakeBrushFromSprite(UPaperSprite* Sprite, int32 Width, int32 Height) { if ( Sprite ) { const FSlateAtlasData SpriteAtlasData = Sprite->GetSlateAtlasData(); const FVector2D SpriteSize = SpriteAtlasData.GetSourceDimensions(); FSlateBrush Brush; Brush.SetResourceObject(Sprite); Width = ( Width > 0 ) ? Width : SpriteSize.X; Height = ( Height > 0 ) ? Height : SpriteSize.Y; Brush.ImageSize = FVector2D(Width, Height); return Brush; } return FSlateNoResource(); }
TSharedRef< FSlateStyleSet > FFriendsAndChatModuleStyle::Create(FFriendsAndChatStyle FriendStyle) { TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("FriendsAndChatStyle")); const FTextBlockStyle DefaultText = FTextBlockStyle(FriendStyle.FriendsChatStyle.TextStyle) .SetFont(FriendStyle.FriendsNormalFontStyle.FriendsFontSmall); // Name Style const FTextBlockStyle GlobalChatFont = FTextBlockStyle(DefaultText) .SetFont(FriendStyle.FriendsNormalFontStyle.FriendsFontNormalBold) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.GlobalChatColor); const FTextBlockStyle GameChatFont = FTextBlockStyle(DefaultText) .SetFont(FriendStyle.FriendsNormalFontStyle.FriendsFontNormalBold) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.GameChatColor); const FTextBlockStyle PartyChatFont = FTextBlockStyle(DefaultText) .SetFont(FriendStyle.FriendsNormalFontStyle.FriendsFontNormalBold) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.PartyChatColor); const FTextBlockStyle WhisperChatFont = FTextBlockStyle(DefaultText) .SetFont(FriendStyle.FriendsNormalFontStyle.FriendsFontNormalBold) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.WhisplerChatColor); const FButtonStyle UserNameButton = FButtonStyle() .SetNormal(FSlateNoResource()) .SetPressed(FSlateNoResource()) .SetHovered(FSlateNoResource()); const FHyperlinkStyle GlobalChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(GlobalChatFont) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle GameChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(GameChatFont) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle PartyChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(PartyChatFont) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle WhisperChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(WhisperChatFont) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle DefaultChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(DefaultText) .SetPadding(FMargin(0.0f)); Style->Set("UserNameTextStyle.Default", DefaultText); Style->Set("UserNameTextStyle.GlobalHyperlink", GlobalChatHyperlink); Style->Set("UserNameTextStyle.GameHyperlink", GameChatHyperlink); Style->Set("UserNameTextStyle.PartyHyperlink", GameChatHyperlink); Style->Set("UserNameTextStyle.Whisperlink", WhisperChatHyperlink); Style->Set("UserNameTextStyle.DefaultHyperlink", DefaultChatHyperlink); Style->Set("UserNameTextStyle.GlobalTextStyle", GlobalChatFont); Style->Set("UserNameTextStyle.GameTextStyle", GameChatFont); Style->Set("UserNameTextStyle.PartyTextStyle", PartyChatFont); Style->Set("UserNameTextStyle.WhisperTextStyle", WhisperChatFont); Style->Set("MessageBreak", FTextBlockStyle(DefaultText) .SetFont(FSlateFontInfo( FriendStyle.FriendsNormalFontStyle.FriendsFontSmall.FontObject, 6, FriendStyle.FriendsNormalFontStyle.FriendsFontSmall.TypefaceFontName ))); Style->Set("GlobalChatIcon", FInlineTextImageStyle() .SetImage(FriendStyle.FriendsChatStyle.ChatGlobalBrush) .SetBaseline(0)); Style->Set("WhisperChatIcon", FInlineTextImageStyle() .SetImage(FriendStyle.FriendsChatStyle.ChatWhisperBrush) .SetBaseline(0)); Style->Set("PartyChatIcon", FInlineTextImageStyle() .SetImage(FriendStyle.FriendsChatStyle.ChatGameBrush) .SetBaseline(0)); return Style; }
TSharedRef< FSlateStyleSet > FAllarBuilderClientStyle::Create() { const FVector2D Icon16x16(16.0f, 16.0f); const FVector2D Icon32x32(32.0f, 32.0f); const FVector2D Icon48x48(48.0f, 48.0f); const FVector2D Icon64x64(64.0f, 64.0f); TSharedRef<FSlateStyleSet> StyleRef = MakeShareable(new FSlateStyleSet("FAllarBuilderClientStyle")); FSlateStyleSet& Style = StyleRef.Get(); const FTextBlockStyle DefaultText = FTextBlockStyle() .SetFont(TTF_FONT("Fonts/Roboto-Regular", 10)) .SetColorAndOpacity(FSlateColor::UseForeground()) .SetShadowOffset(FVector2D::ZeroVector) .SetShadowColorAndOpacity(FLinearColor::Black); // Set the client app styles Style.Set(TEXT("Background"), new IMAGE_BRUSH("Common/NoiseBackground", Icon64x64, FLinearColor(1,1,1,1), ESlateBrushTileType::Both)); Style.Set(TEXT("ProjectPicker.Text"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Regular", 24)) ); Style.Set(TEXT("ProjectPicker.ErrorImage"), new IMAGE_BRUSH("Icons/icon_error_16x", Icon32x32)); Style.Set(TEXT("Section.Label"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Bold", 18)) ); Style.Set(TEXT("Section.Border"), new BOX_BRUSH("Common/GroupBorder", FMargin(4.0f / 16.0f))); Style.Set(TEXT("Section.Text"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Regular", 10)) ); Style.Set(TEXT("Code"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Regular", 8)) .SetColorAndOpacity(FSlateColor(FLinearColor::White * 0.8f)) ); Style.Set(TEXT("Title"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Bold", 12)) ); Style.Set(TEXT("Status"), FTextBlockStyle(DefaultText) .SetColorAndOpacity(FSlateColor::UseSubduedForeground()) ); FSlateBrush* GenericWhiteBox = new IMAGE_BRUSH("Old/White", Icon16x16); // Scrollbar const FScrollBarStyle ScrollBar = FScrollBarStyle() .SetVerticalTopSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Vertical", FVector2D(8, 8))) .SetVerticalBottomSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Vertical", FVector2D(8, 8))) .SetHorizontalTopSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Horizontal", FVector2D(8, 8))) .SetHorizontalBottomSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Horizontal", FVector2D(8, 8))) .SetNormalThumbImage(BOX_BRUSH("Common/Scrollbar_Thumb", FMargin(4.f / 16.f))) .SetDraggedThumbImage(BOX_BRUSH("Common/Scrollbar_Thumb", FMargin(4.f / 16.f))) .SetHoveredThumbImage(BOX_BRUSH("Common/Scrollbar_Thumb", FMargin(4.f / 16.f))); // SEditableTextBox defaults... const FEditableTextBoxStyle NormalEditableTextBoxStyle = FEditableTextBoxStyle() .SetBackgroundImageNormal(*GenericWhiteBox) .SetBackgroundImageHovered(*GenericWhiteBox) .SetBackgroundImageFocused(*GenericWhiteBox) .SetBackgroundImageReadOnly(*GenericWhiteBox) .SetScrollBarStyle(ScrollBar); { Style.Set("NormalEditableTextBox", NormalEditableTextBoxStyle); } // RichText const FTextBlockStyle AllarBuilderDataStyle = FTextBlockStyle() .SetFont(TTF_FONT("Testing/Fonts/Roboto-Italic", 9)) .SetColorAndOpacity(FSlateColor(FLinearColor::White * 0.5f)) .SetShadowOffset(FVector2D::ZeroVector) .SetShadowColorAndOpacity(FLinearColor::Black); Style.Set("AllarBuilderDataStyle", AllarBuilderDataStyle); FButtonStyle DarkHyperlinkButton = FButtonStyle() .SetNormal(BORDER_BRUSH("Old/HyperlinkDotted", FMargin(0, 0, 0, 3 / 16.0f), FSlateColor(FLinearColor::White * 0.5f))) .SetPressed(FSlateNoResource()) .SetHovered(BORDER_BRUSH("Old/HyperlinkUnderline", FMargin(0, 0, 0, 3 / 16.0f), FSlateColor(FLinearColor::White * 0.5f))); const FHyperlinkStyle DarkHyperlink = FHyperlinkStyle() .SetUnderlineStyle(DarkHyperlinkButton) .SetTextStyle(AllarBuilderDataStyle) .SetPadding(FMargin(0.0f)); Style.Set("RichText.Hyperlink", DarkHyperlink); return StyleRef; }
TSharedRef< FSlateStyleSet > FFriendsAndChatModuleStyle::Create(FFriendsAndChatStyle FriendStyle) { TSharedRef< FSlateStyleSet > Style = MakeShareable(new FSlateStyleSet("FriendsAndChatStyle")); const FButtonStyle UserNameButton = FButtonStyle() .SetNormal(FSlateNoResource()) .SetPressed(FSlateNoResource()) .SetHovered(FSlateNoResource()); // Small { const FTextBlockStyle DefaultTextSmall = FTextBlockStyle(FriendStyle.FriendsChatStyle.TextStyle) .SetFont(FriendStyle.ChatFontStyle.FriendsFontSmallBold); const FTextBlockStyle GlobalChatFontSmall = FTextBlockStyle(DefaultTextSmall) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.GlobalHyperlinkChatColor); const FTextBlockStyle GameChatFontSmall = FTextBlockStyle(DefaultTextSmall) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.GameHyperlinkChatColor); const FTextBlockStyle TeamChatFontSmall = FTextBlockStyle(DefaultTextSmall) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.TeamHyperlinkChatColor); const FTextBlockStyle PartyChatFontSmall = FTextBlockStyle(DefaultTextSmall) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.PartyHyperlinkChatColor); const FTextBlockStyle WhisperChatFontSmall = FTextBlockStyle(DefaultTextSmall) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.WhisperHyperlinkChatColor); const FHyperlinkStyle GlobalChatHyperlinkSmall = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(GlobalChatFontSmall) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle GameChatHyperlinkSmall = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(GameChatFontSmall) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle TeamChatHyperlinkSmall = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(TeamChatFontSmall) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle PartyChatHyperlinkSmall = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(PartyChatFontSmall) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle WhisperChatHyperlinkSmall = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(WhisperChatFontSmall) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle DefaultChatHyperlinkSmall = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(DefaultTextSmall) .SetPadding(FMargin(0.0f)); Style->Set("UserNameTextStyle.DefaultSmall", DefaultTextSmall); Style->Set("UserNameTextStyle.GlobalHyperlinkSmall", GlobalChatHyperlinkSmall); Style->Set("UserNameTextStyle.GameHyperlinkSmall", GameChatHyperlinkSmall); Style->Set("UserNameTextStyle.TeamHyperlinkSmall", TeamChatHyperlinkSmall); Style->Set("UserNameTextStyle.PartyHyperlinkSmall", PartyChatHyperlinkSmall); Style->Set("UserNameTextStyle.WhisperlinkSmall", WhisperChatHyperlinkSmall); Style->Set("UserNameTextStyle.DefaultHyperlinkSmall", DefaultChatHyperlinkSmall); Style->Set("UserNameTextStyle.GlobalTextStyleSmall", GlobalChatFontSmall); Style->Set("UserNameTextStyle.GameTextStyleSmall", GameChatFontSmall); Style->Set("UserNameTextStyle.TeamTextStyleSmall", TeamChatFontSmall); Style->Set("UserNameTextStyle.PartyTextStyleSmall", PartyChatFontSmall); Style->Set("UserNameTextStyle.WhisperTextStyleSmall", WhisperChatFontSmall); Style->Set("MessageBreak", FTextBlockStyle(DefaultTextSmall) .SetFont(FSlateFontInfo( FriendStyle.FriendsNormalFontStyle.FriendsFontSmall.FontObject, 6, FriendStyle.FriendsNormalFontStyle.FriendsFontSmall.TypefaceFontName ))); } // Normal { const FTextBlockStyle DefaultText = FTextBlockStyle(FriendStyle.FriendsChatStyle.TextStyle) .SetFont(FriendStyle.ChatFontStyle.FriendsFontNormalBold); const FTextBlockStyle GlobalChatFont = FTextBlockStyle(DefaultText) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.GlobalHyperlinkChatColor); const FTextBlockStyle GameChatFont = FTextBlockStyle(DefaultText) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.GameHyperlinkChatColor); const FTextBlockStyle TeamChatFont = FTextBlockStyle(DefaultText) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.TeamHyperlinkChatColor); const FTextBlockStyle PartyChatFont = FTextBlockStyle(DefaultText) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.PartyHyperlinkChatColor); const FTextBlockStyle WhisperChatFont = FTextBlockStyle(DefaultText) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.WhisperHyperlinkChatColor); const FHyperlinkStyle GlobalChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(GlobalChatFont) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle GameChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(GameChatFont) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle TeamChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(TeamChatFont) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle PartyChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(PartyChatFont) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle WhisperChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(WhisperChatFont) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle DefaultChatHyperlink = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(DefaultText) .SetPadding(FMargin(0.0f)); Style->Set("UserNameTextStyle.Default", DefaultText); Style->Set("UserNameTextStyle.GlobalHyperlink", GlobalChatHyperlink); Style->Set("UserNameTextStyle.GameHyperlink", GameChatHyperlink); Style->Set("UserNameTextStyle.TeamHyperlink", TeamChatHyperlink); Style->Set("UserNameTextStyle.PartyHyperlink", PartyChatHyperlink); Style->Set("UserNameTextStyle.Whisperlink", WhisperChatHyperlink); Style->Set("UserNameTextStyle.DefaultHyperlink", DefaultChatHyperlink); Style->Set("UserNameTextStyle.GlobalTextStyle", GlobalChatFont); Style->Set("UserNameTextStyle.GameTextStyle", GameChatFont); Style->Set("UserNameTextStyle.TeamTextStyle", TeamChatFont); Style->Set("UserNameTextStyle.PartyTextStyle", PartyChatFont); Style->Set("UserNameTextStyle.WhisperTextStyle", WhisperChatFont); } // Large { const FTextBlockStyle DefaultTextLarge = FTextBlockStyle(FriendStyle.FriendsChatStyle.TextStyle) .SetFont(FriendStyle.ChatFontStyle.FriendsFontLargeBold); const FTextBlockStyle GlobalChatFontLarge = FTextBlockStyle(DefaultTextLarge) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.GlobalHyperlinkChatColor); const FTextBlockStyle GameChatFontLarge = FTextBlockStyle(DefaultTextLarge) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.GameHyperlinkChatColor); const FTextBlockStyle TeamChatFontLarge = FTextBlockStyle(DefaultTextLarge) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.TeamHyperlinkChatColor); const FTextBlockStyle PartyChatFontLarge = FTextBlockStyle(DefaultTextLarge) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.PartyHyperlinkChatColor); const FTextBlockStyle WhisperChatFontLarge = FTextBlockStyle(DefaultTextLarge) .SetColorAndOpacity(FriendStyle.FriendsChatStyle.WhisperHyperlinkChatColor); const FHyperlinkStyle GlobalChatHyperlinkLarge = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(GlobalChatFontLarge) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle GameChatHyperlinkLarge = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(GameChatFontLarge) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle TeamChatHyperlinkLarge = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(TeamChatFontLarge) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle PartyChatHyperlinkLarge = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(PartyChatFontLarge) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle WhisperChatHyperlinkLarge = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(WhisperChatFontLarge) .SetPadding(FMargin(0.0f)); const FHyperlinkStyle DefaultChatHyperlinkLarge = FHyperlinkStyle() .SetUnderlineStyle(UserNameButton) .SetTextStyle(DefaultTextLarge) .SetPadding(FMargin(0.0f)); Style->Set("UserNameTextStyle.DefaultLarge", DefaultTextLarge); Style->Set("UserNameTextStyle.GlobalHyperlinkLarge", GlobalChatHyperlinkLarge); Style->Set("UserNameTextStyle.GameHyperlinkLarge", GameChatHyperlinkLarge); Style->Set("UserNameTextStyle.TeamHyperlinkLarge", TeamChatHyperlinkLarge); Style->Set("UserNameTextStyle.PartyHyperlinkLarge", PartyChatHyperlinkLarge); Style->Set("UserNameTextStyle.WhisperlinkLarge", WhisperChatHyperlinkLarge); Style->Set("UserNameTextStyle.DefaultHyperlinkLarge", DefaultChatHyperlinkLarge); Style->Set("UserNameTextStyle.GlobalTextStyleLarge", GlobalChatFontLarge); Style->Set("UserNameTextStyle.GameTextStyleLarge", GameChatFontLarge); Style->Set("UserNameTextStyle.TeamTextStyleLarge", TeamChatFontLarge); Style->Set("UserNameTextStyle.PartyTextStyleLarge", PartyChatFontLarge); Style->Set("UserNameTextStyle.WhisperTextStyleLarge", WhisperChatFontLarge); } return Style; }
void FCodeEditorStyle::Initialize() { // Only register once if( StyleSet.IsValid() ) { return; } StyleSet = MakeShareable(new FSlateStyleSet("CodeEditor") ); StyleSet->SetContentRoot(FPaths::EnginePluginsDir() / TEXT("Experimental/CodeEditor/Resources")); // Icons { StyleSet->Set("CodeEditor.TabIcon", new IMAGE_BRUSH("UI/CodeEditor_16x", Icon16x16)); StyleSet->Set("CodeEditor.Save", new IMAGE_BRUSH("UI/Save_40x", Icon40x40)); StyleSet->Set("CodeEditor.Save.Small", new IMAGE_BRUSH("UI/Save_40x", Icon16x16)); StyleSet->Set("CodeEditor.SaveAll", new IMAGE_BRUSH("UI/SaveAll_40x", Icon40x40)); StyleSet->Set("CodeEditor.SaveAll.Small", new IMAGE_BRUSH("UI/SaveAll_40x", Icon16x16)); } const FSlateFontInfo Consolas10 = TTF_FONT("Font/DroidSansMono", 9); const FTextBlockStyle NormalText = FTextBlockStyle() .SetFont(Consolas10) .SetColorAndOpacity(FLinearColor::White) .SetShadowOffset(FVector2D::ZeroVector) .SetShadowColorAndOpacity(FLinearColor::Black) .SetHighlightColor(FLinearColor(0.02f, 0.3f, 0.0f)) .SetHighlightShape(BOX_BRUSH("UI/TextBlockHighlightShape", FMargin(3.f / 8.f))); // Text editor { StyleSet->Set("TextEditor.NormalText", NormalText); StyleSet->Set("SyntaxHighlight.CPP.Normal", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffdfd706))));// yellow StyleSet->Set("SyntaxHighlight.CPP.Operator", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffcfcfcf)))); // light grey StyleSet->Set("SyntaxHighlight.CPP.Keyword", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xff006ab4)))); // blue StyleSet->Set("SyntaxHighlight.CPP.String", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xff9e4a1e)))); // pinkish StyleSet->Set("SyntaxHighlight.CPP.Number", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xff6db3a8)))); // cyan StyleSet->Set("SyntaxHighlight.CPP.Comment", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xff57a64a)))); // green StyleSet->Set("SyntaxHighlight.CPP.PreProcessorKeyword", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffcfcfcf)))); // light grey StyleSet->Set("TextEditor.Border", new BOX_BRUSH("UI/TextEditorBorder", FMargin(4.0f/16.0f), FLinearColor(0.02f,0.02f,0.02f,1))); const FEditableTextBoxStyle EditableTextBoxStyle = FEditableTextBoxStyle() .SetBackgroundImageNormal( FSlateNoResource() ) .SetBackgroundImageHovered( FSlateNoResource() ) .SetBackgroundImageFocused( FSlateNoResource() ) .SetBackgroundImageReadOnly( FSlateNoResource() ); StyleSet->Set("TextEditor.EditableTextBox", EditableTextBoxStyle); } // Project editor { StyleSet->Set("ProjectEditor.Border", new BOX_BRUSH("UI/TextEditorBorder", FMargin(4.0f/16.0f), FLinearColor(0.048f,0.048f,0.048f,1))); StyleSet->Set("ProjectEditor.Icon.Project", new IMAGE_BRUSH("UI/FolderClosed", Icon16x16, FLinearColor(0.25f,0.25f,0.25f,1))); StyleSet->Set("ProjectEditor.Icon.Folder", new IMAGE_BRUSH("UI/FolderClosed", Icon16x16, FLinearColor(0.25f,0.25f,0.25f,1))); StyleSet->Set("ProjectEditor.Icon.File", new IMAGE_BRUSH("UI/GenericFile", Icon16x16)); StyleSet->Set("ProjectEditor.Icon.GenericFile", new IMAGE_BRUSH("UI/GenericFile", Icon16x16)); } FSlateStyleRegistry::RegisterSlateStyle( *StyleSet.Get() ); }
void FPythonEditorStyle::Initialize() { // Only register once if( StyleSet.IsValid() ) { return; } StyleSet = MakeShareable(new FSlateStyleSet("PythonEditor") ); StyleSet->SetContentRoot(IPluginManager::Get().FindPlugin("UnrealEnginePython")->GetBaseDir() / TEXT("Resources")); // Icons { StyleSet->Set("PythonEditor.TabIcon", new IMAGE_BRUSH("UI/PythonEditor_16x", Icon16x16)); StyleSet->Set("PythonEditor.New", new IMAGE_BRUSH("UI/GenericFile", Icon40x40)); StyleSet->Set("PythonEditor.NewDirectory", new IMAGE_BRUSH("UI/GenericFile", Icon40x40)); StyleSet->Set("PythonEditor.New.Small", new IMAGE_BRUSH("UI/GenericFile", Icon16x16)); StyleSet->Set("PythonEditor.Delete", new IMAGE_BRUSH("UI/DeleteFile", Icon40x40)); StyleSet->Set("PythonEditor.Delete.Small", new IMAGE_BRUSH("UI/DeleteFile", Icon16x16)); StyleSet->Set("PythonEditor.Save", new IMAGE_BRUSH("UI/Save_40x", Icon40x40)); StyleSet->Set("PythonEditor.Save.Small", new IMAGE_BRUSH("UI/Save_40x", Icon16x16)); StyleSet->Set("PythonEditor.SaveAll", new IMAGE_BRUSH("UI/SaveAll_40x", Icon40x40)); StyleSet->Set("PythonEditor.SaveAll.Small", new IMAGE_BRUSH("UI/SaveAll_40x", Icon16x16)); StyleSet->Set("PythonEditor.Execute", new IMAGE_BRUSH("UI/Excute_x40", Icon40x40)); StyleSet->Set("PythonEditor.Execute.Small", new IMAGE_BRUSH("UI/Excute_x40", Icon16x16)); StyleSet->Set("PythonEditor.ExecuteInSandbox", new IMAGE_BRUSH("UI/Excute_x40", Icon40x40)); StyleSet->Set("PythonEditor.ExecuteInSandbox.Small", new IMAGE_BRUSH("UI/Excute_x40", Icon16x16)); StyleSet->Set("PythonEditor.PEP8ize", new IMAGE_BRUSH("UI/Excute_x40", Icon40x40)); StyleSet->Set("PythonEditor.PEP8ize.Small", new IMAGE_BRUSH("UI/Excute_x40", Icon16x16)); } const FSlateFontInfo Consolas10 = TTF_FONT("Font/DroidSansMono", 9); const FTextBlockStyle NormalText = FTextBlockStyle() .SetFont(Consolas10) .SetColorAndOpacity(FLinearColor::White) .SetShadowOffset(FVector2D::ZeroVector) .SetShadowColorAndOpacity(FLinearColor::Black) .SetHighlightColor(FLinearColor(0.02f, 0.3f, 0.0f)) .SetHighlightShape(BOX_BRUSH("UI/TextBlockHighlightShape", FMargin(3.f / 8.f))); // Text editor { StyleSet->Set("TextEditor.NormalText", NormalText); StyleSet->Set("SyntaxHighlight.PY.Normal", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffffffff))));// yellow StyleSet->Set("SyntaxHighlight.PY.Operator", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xfff92672)))); // light grey StyleSet->Set("SyntaxHighlight.PY.Keyword", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xfff92672)))); // blue StyleSet->Set("SyntaxHighlight.PY.String", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffe6db74)))); // pinkish StyleSet->Set("SyntaxHighlight.PY.Number", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffae81dd)))); // cyan StyleSet->Set("SyntaxHighlight.PY.Comment", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xff75715e)))); // green StyleSet->Set("SyntaxHighlight.PY.BuiltIn", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xff52d9ef)))); // light grey StyleSet->Set("SyntaxHighlight.PY.Define", FTextBlockStyle(NormalText).SetColorAndOpacity(FLinearColor(FColor(0xffa6e22a)))); // light grey StyleSet->Set("TextEditor.Border", new BOX_BRUSH("UI/TextEditorBorder", FMargin(4.0f/16.0f), FLinearColor(0.02f,0.02f,0.02f,1))); const FEditableTextBoxStyle EditableTextBoxStyle = FEditableTextBoxStyle() .SetBackgroundImageNormal( FSlateNoResource() ) .SetBackgroundImageHovered( FSlateNoResource() ) .SetBackgroundImageFocused( FSlateNoResource() ) .SetBackgroundImageReadOnly( FSlateNoResource() ); StyleSet->Set("TextEditor.EditableTextBox", EditableTextBoxStyle); } // Project editor { StyleSet->Set("ProjectEditor.Border", new BOX_BRUSH("UI/TextEditorBorder", FMargin(4.0f/16.0f), FLinearColor(0.048f,0.048f,0.048f,1))); StyleSet->Set("ProjectEditor.Icon.Project", new IMAGE_BRUSH("UI/FolderClosed", Icon16x16, FLinearColor(0.25f,0.25f,0.25f,1))); StyleSet->Set("ProjectEditor.Icon.Folder", new IMAGE_BRUSH("UI/FolderClosed", Icon16x16, FLinearColor(0.25f,0.25f,0.25f,1))); StyleSet->Set("ProjectEditor.Icon.File", new IMAGE_BRUSH("UI/PythonEditor_16x", Icon16x16)); StyleSet->Set("ProjectEditor.Icon.GenericFile", new IMAGE_BRUSH("UI/GenericFile", Icon16x16)); } FSlateStyleRegistry::RegisterSlateStyle( *StyleSet.Get() ); }
TSharedRef< FSlateStyleSet > FCrashReportClientStyle::Create() { TSharedRef<FSlateStyleSet> StyleRef = MakeShareable(new FSlateStyleSet("CrashReportClientStyle")); FSlateStyleSet& Style = StyleRef.Get(); const FTextBlockStyle DefaultText = FTextBlockStyle() .SetFont(TTF_FONT("Fonts/Roboto-Bold", 10)) .SetColorAndOpacity(FSlateColor::UseForeground()) .SetShadowOffset(FVector2D::ZeroVector) .SetShadowColorAndOpacity(FLinearColor::Black); // Set the client app styles Style.Set(TEXT("Code"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Regular", 8)) .SetColorAndOpacity(FSlateColor(FLinearColor::White * 0.8f)) ); Style.Set(TEXT("Title"), FTextBlockStyle(DefaultText) .SetFont(TTF_FONT("Fonts/Roboto-Bold", 12)) ); Style.Set(TEXT("Status"), FTextBlockStyle(DefaultText) .SetColorAndOpacity(FSlateColor::UseSubduedForeground()) ); const FVector2D Icon16x16( 16.0f, 16.0f ); FSlateBrush* GenericWhiteBox = new IMAGE_BRUSH( "Old/White", Icon16x16 ); // Scrollbar const FScrollBarStyle ScrollBar = FScrollBarStyle() .SetVerticalTopSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Vertical", FVector2D(8, 8))) .SetVerticalBottomSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Vertical", FVector2D(8, 8))) .SetHorizontalTopSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Horizontal", FVector2D(8, 8))) .SetHorizontalBottomSlotImage(IMAGE_BRUSH("Common/Scrollbar_Background_Horizontal", FVector2D(8, 8))) .SetNormalThumbImage(BOX_BRUSH("Common/Scrollbar_Thumb", FMargin(4.f / 16.f))) .SetDraggedThumbImage(BOX_BRUSH("Common/Scrollbar_Thumb", FMargin(4.f / 16.f))) .SetHoveredThumbImage(BOX_BRUSH("Common/Scrollbar_Thumb", FMargin(4.f / 16.f))); // SEditableTextBox defaults... const FEditableTextBoxStyle NormalEditableTextBoxStyle = FEditableTextBoxStyle() .SetBackgroundImageNormal(*GenericWhiteBox) .SetBackgroundImageHovered(*GenericWhiteBox) .SetBackgroundImageFocused(*GenericWhiteBox) .SetBackgroundImageReadOnly(*GenericWhiteBox) .SetScrollBarStyle(ScrollBar); { Style.Set( "NormalEditableTextBox", NormalEditableTextBoxStyle ); } // RichText const FTextBlockStyle CrashReportDataStyle = FTextBlockStyle() .SetFont( TTF_FONT( "Testing/Fonts/Roboto-Italic", 9 ) ) .SetColorAndOpacity( FSlateColor( FLinearColor::White * 0.5f ) ) .SetShadowOffset( FVector2D::ZeroVector ) .SetShadowColorAndOpacity( FLinearColor::Black ); Style.Set( "CrashReportDataStyle", CrashReportDataStyle ); FButtonStyle DarkHyperlinkButton = FButtonStyle() .SetNormal( BORDER_BRUSH( "Old/HyperlinkDotted", FMargin( 0, 0, 0, 3 / 16.0f ), FSlateColor( FLinearColor::White * 0.5f ) ) ) .SetPressed( FSlateNoResource() ) .SetHovered( BORDER_BRUSH( "Old/HyperlinkUnderline", FMargin( 0, 0, 0, 3 / 16.0f ), FSlateColor( FLinearColor::White * 0.5f ) ) ); const FHyperlinkStyle DarkHyperlink = FHyperlinkStyle() .SetUnderlineStyle( DarkHyperlinkButton ) .SetTextStyle( CrashReportDataStyle ) .SetPadding( FMargin( 0.0f ) ); Style.Set( "RichText.Hyperlink", DarkHyperlink ); return StyleRef; }
void AFlareGame::ReadAllSaveSlots() { // Setup SaveSlots.Empty(); FVector2D EmblemSize = 128 * FVector2D::UnitVector; UMaterial* BaseEmblemMaterial = Cast<UMaterial>(FFlareStyleSet::GetIcon("CompanyEmblem")->GetResourceObject()); // Get all saves for (int32 Index = 1; Index <= SaveSlotCount; Index++) { FFlareSaveSlotInfo SaveSlotInfo; SaveSlotInfo.EmblemBrush.ImageSize = EmblemSize; UFlareSaveGame* Save = AFlareGame::ReadSaveSlot(Index); SaveSlotInfo.Save = Save; if (Save) { // Basic setup UFlareCustomizationCatalog* Catalog = GetCustomizationCatalog(); FLOGV("AFlareGame::ReadAllSaveSlots : found valid save data in slot %d", Index); // Count player ships SaveSlotInfo.CompanyShipCount = 0; // Find player company and count ships FFlareCompanySave* PlayerCompany = NULL; for (int32 CompanyIndex = 0; CompanyIndex < Save->WorldData.CompanyData.Num(); CompanyIndex++) { const FFlareCompanySave& Company = Save->WorldData.CompanyData[CompanyIndex]; if (Company.Identifier == Save->PlayerData.CompanyIdentifier) { PlayerCompany = &(Save->WorldData.CompanyData[CompanyIndex]); SaveSlotInfo.CompanyShipCount = Save->WorldData.CompanyData[CompanyIndex].ShipData.Num(); } } // Company info if (PlayerCompany) { const FFlareCompanyDescription* Desc = &Save->PlayerCompanyDescription; // Money and general infos SaveSlotInfo.CompanyValue = PlayerCompany->CompanyValue; SaveSlotInfo.CompanyName = Desc->Name; // Emblem material SaveSlotInfo.Emblem = UMaterialInstanceDynamic::Create(BaseEmblemMaterial, GetWorld()); SaveSlotInfo.Emblem->SetVectorParameterValue("BasePaintColor", Catalog->GetColor(Desc->CustomizationBasePaintColorIndex)); SaveSlotInfo.Emblem->SetVectorParameterValue("PaintColor", Catalog->GetColor(Desc->CustomizationPaintColorIndex)); SaveSlotInfo.Emblem->SetVectorParameterValue("OverlayColor", Catalog->GetColor(Desc->CustomizationOverlayColorIndex)); SaveSlotInfo.Emblem->SetVectorParameterValue("GlowColor", Catalog->GetColor(Desc->CustomizationLightColorIndex)); // Create the brush dynamically SaveSlotInfo.EmblemBrush.SetResourceObject(SaveSlotInfo.Emblem); } } else { SaveSlotInfo.Save = NULL; SaveSlotInfo.Emblem = NULL; SaveSlotInfo.EmblemBrush = FSlateNoResource(); SaveSlotInfo.CompanyShipCount = 0; SaveSlotInfo.CompanyValue = 0; SaveSlotInfo.CompanyName = FText(); } SaveSlots.Add(SaveSlotInfo); } FLOG("AFlareGame::ReadAllSaveSlots : all slots found"); }