| 49 | #include "Components/CheckBox.h" |
| 50 | |
| 51 | void UMjSimulateWidget::NativeConstruct() |
| 52 | { |
| 53 | Super::NativeConstruct(); |
| 54 | |
| 55 | auto StyleButton = [](UButton* Btn, FLinearColor BGColor) { |
| 56 | if (!Btn) |
| 57 | return; |
| 58 | FButtonStyle Style = Btn->GetStyle(); |
| 59 | Style.Normal.TintColor = FSlateColor(BGColor); |
| 60 | Style.Hovered.TintColor = FSlateColor(BGColor * 1.5f); |
| 61 | Style.Pressed.TintColor = FSlateColor(BGColor * 0.5f); |
| 62 | Btn->SetStyle(Style); |
| 63 | }; |
| 64 | |
| 65 | StyleButton(PlayPauseButton, FLinearColor(0.2f, 0.6f, 0.2f, 0.9f)); |
| 66 | StyleButton(ResetButton, FLinearColor(0.6f, 0.2f, 0.2f, 0.9f)); |
| 67 | StyleButton(RecordButton, FLinearColor(0.8f, 0.3f, 0.1f, 0.9f)); |
| 68 | StyleButton(ReplayButton, FLinearColor(0.2f, 0.4f, 0.8f, 0.9f)); |
| 69 | StyleButton(SnapshotButton, FLinearColor(0.2f, 0.6f, 0.8f, 0.9f)); |
| 70 | StyleButton(RestoreButton, FLinearColor(0.2f, 0.6f, 0.8f, 0.9f)); |
| 71 | |
| 72 | if (TimeText) |
| 73 | { |
| 74 | FSlateFontInfo FontInfo = TimeText->GetFont(); |
| 75 | FontInfo.Size = 14; |
| 76 | FontInfo.TypefaceFontName = TEXT("Bold"); |
| 77 | TimeText->SetFont(FontInfo); |
| 78 | TimeText->SetColorAndOpacity(FSlateColor(FLinearColor(1.0f, 0.9f, 0.3f, 1.0f))); |
| 79 | } |
| 80 | |
| 81 | // Shrink Button Fonts |
| 82 | if (PlayPauseButton) |
| 83 | { |
| 84 | if (UTextBlock* BtnText = Cast<UTextBlock>(PlayPauseButton->GetChildAt(0))) |
| 85 | { |
| 86 | FSlateFontInfo FontInfo = BtnText->GetFont(); |
| 87 | FontInfo.Size = 14; |
| 88 | FontInfo.TypefaceFontName = TEXT("Bold"); |
| 89 | BtnText->SetFont(FontInfo); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | if (ResetButton) |
| 94 | { |
| 95 | if (UTextBlock* BtnText = Cast<UTextBlock>(ResetButton->GetChildAt(0))) |
| 96 | { |
| 97 | FSlateFontInfo FontInfo = BtnText->GetFont(); |
| 98 | FontInfo.Size = 14; |
| 99 | FontInfo.TypefaceFontName = TEXT("Bold"); |
| 100 | BtnText->SetFont(FontInfo); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | // Dynamic Top Bar Layout |
| 105 | if (TimeText && PlayPauseButton && ResetButton && ArticulationSelector) |
| 106 | { |
| 107 | // Find the top bar horizontal box |
| 108 | if (UHorizontalBox* TopBar = Cast<UHorizontalBox>(TimeText->GetParent())) |
nothing calls this directly
no outgoing calls
no test coverage detected