2025-07-03 17:28:51 +02:00
|
|
|
|
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "widgets/DTFluxStatusWidget.h"
|
|
|
|
|
|
|
|
|
|
|
|
#include "SlateOptMacros.h"
|
|
|
|
|
|
#include "DTFluxAPIStatusModule.h"
|
2025-07-08 16:50:31 +02:00
|
|
|
|
#include "DTFluxCoreSubsystem.h"
|
2025-07-03 17:28:51 +02:00
|
|
|
|
#include "ISettingsModule.h"
|
2025-07-08 16:50:31 +02:00
|
|
|
|
#include "MovieSceneSequenceID.h"
|
|
|
|
|
|
#include "OutputLogCreationParams.h"
|
|
|
|
|
|
#include "OutputLogModule.h"
|
2025-07-03 17:28:51 +02:00
|
|
|
|
#include "Types/Enum/DTFluxCoreEnum.h"
|
|
|
|
|
|
#include "Subsystems/DTFluxNetworkSubsystem.h"
|
|
|
|
|
|
#include "Framework/MultiBox/MultiBoxBuilder.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
|
|
|
|
|
|
|
|
|
|
|
|
void SDTFluxStatusWidget::OnOpenSettingsClicked()
|
|
|
|
|
|
{
|
|
|
|
|
|
UE_LOG(logDTFluxStatus, Warning, TEXT("Settings Clicked !!!!"));
|
|
|
|
|
|
ISettingsModule& SettingsModule = FModuleManager::LoadModuleChecked<ISettingsModule>("Settings");
|
|
|
|
|
|
SettingsModule.ShowViewer("Project", "DTFluxProjectSettings", "DTFluxNetworkSettings");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FReply SDTFluxStatusWidget::OnRaceDatasClicked()
|
|
|
|
|
|
{
|
2025-07-08 16:50:31 +02:00
|
|
|
|
DTFluxNetwork->SendRequest(EDTFluxRequestType::RaceData);
|
2025-07-03 17:28:51 +02:00
|
|
|
|
return FReply::Handled();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FReply SDTFluxStatusWidget::OnTeamListClicked()
|
|
|
|
|
|
{
|
2025-07-08 16:50:31 +02:00
|
|
|
|
DTFluxNetwork->SendRequest(EDTFluxRequestType::TeamList);
|
2025-07-03 17:28:51 +02:00
|
|
|
|
return FReply::Handled();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SDTFluxStatusWidget::Construct(const FArguments& InArgs)
|
|
|
|
|
|
{
|
2025-07-08 16:50:31 +02:00
|
|
|
|
DTFluxNetwork =
|
|
|
|
|
|
GEngine->GetEngineSubsystem<UDTFluxNetworkSubsystem>();
|
|
|
|
|
|
DTFluxCore =
|
|
|
|
|
|
GEngine->GetEngineSubsystem<UDTFluxCoreSubsystem>();
|
2025-07-03 17:28:51 +02:00
|
|
|
|
ConnectionActionButtonText.Set(
|
2025-07-08 16:50:31 +02:00
|
|
|
|
DTFluxNetwork->WsStatus != EDTFluxConnectionStatus::Connected
|
|
|
|
|
|
? FText::FromString("Connect")
|
|
|
|
|
|
: FText::FromString("Disconnect")
|
|
|
|
|
|
);
|
|
|
|
|
|
FOutputLogModule& OutputLogModule = FModuleManager::LoadModuleChecked<FOutputLogModule>("OutputLog");
|
|
|
|
|
|
const FOutputLogCreationParams Params;
|
2025-07-03 17:28:51 +02:00
|
|
|
|
bCanSupportFocus = true;
|
2025-07-08 16:50:31 +02:00
|
|
|
|
PopulateComboBoxItems();
|
2025-07-03 17:28:51 +02:00
|
|
|
|
|
|
|
|
|
|
FSlimHorizontalToolBarBuilder ToolBarBuilder(
|
|
|
|
|
|
nullptr,
|
|
|
|
|
|
FMultiBoxCustomization::None,
|
|
|
|
|
|
nullptr,
|
|
|
|
|
|
false
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
ToolBarBuilder.BeginSection("Settings");
|
|
|
|
|
|
{
|
|
|
|
|
|
ToolBarBuilder.AddToolBarButton(
|
|
|
|
|
|
FUIAction(FExecuteAction::CreateSP(this, &SDTFluxStatusWidget::OnOpenSettingsClicked)),
|
|
|
|
|
|
NAME_None,
|
|
|
|
|
|
INVTEXT("DTFlux Settings"),
|
|
|
|
|
|
INVTEXT("Ouvrir les paramètres DTFlux"),
|
|
|
|
|
|
FSlateIcon(FAppStyle::GetAppStyleSetName(), "Icons.Settings")
|
|
|
|
|
|
);
|
|
|
|
|
|
}
|
|
|
|
|
|
ToolBarBuilder.EndSection();
|
|
|
|
|
|
|
2025-07-08 16:50:31 +02:00
|
|
|
|
|
2025-07-03 17:28:51 +02:00
|
|
|
|
FSlateFontInfo TitleTextFont = FCoreStyle::Get().GetFontStyle(FName("EmbossedText"));
|
|
|
|
|
|
TitleTextFont.Size = 15;
|
|
|
|
|
|
ChildSlot
|
|
|
|
|
|
[
|
2025-07-08 16:50:31 +02:00
|
|
|
|
SNew(SBorder)
|
|
|
|
|
|
.BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder"))
|
2025-07-03 17:28:51 +02:00
|
|
|
|
[
|
2025-07-08 16:50:31 +02:00
|
|
|
|
SNew(SVerticalBox)
|
|
|
|
|
|
+ SVerticalBox::Slot()
|
|
|
|
|
|
.AutoHeight()
|
2025-07-03 17:28:51 +02:00
|
|
|
|
[
|
2025-07-08 16:50:31 +02:00
|
|
|
|
#pragma region ToolBarSection
|
|
|
|
|
|
SNew(SBox)
|
2025-07-03 17:28:51 +02:00
|
|
|
|
[
|
2025-07-08 16:50:31 +02:00
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
|
.FillWidth(2.0)
|
|
|
|
|
|
[
|
|
|
|
|
|
SNew(SSpacer)
|
|
|
|
|
|
]
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
|
.FillWidth(1.0)
|
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
|
.HAlign(HAlign_Right)
|
|
|
|
|
|
[
|
|
|
|
|
|
ToolBarBuilder.MakeWidget()
|
|
|
|
|
|
]
|
2025-07-03 17:28:51 +02:00
|
|
|
|
]
|
2025-07-08 16:50:31 +02:00
|
|
|
|
#pragma endregion
|
2025-07-03 17:28:51 +02:00
|
|
|
|
]
|
2025-07-08 16:50:31 +02:00
|
|
|
|
+ SVerticalBox::Slot()
|
|
|
|
|
|
.AutoHeight()
|
2025-07-03 17:28:51 +02:00
|
|
|
|
[
|
2025-07-08 16:50:31 +02:00
|
|
|
|
#pragma region WebsocketStatusSection
|
|
|
|
|
|
SNew(SBorder)
|
|
|
|
|
|
.Padding(6.0f)
|
2025-07-03 17:28:51 +02:00
|
|
|
|
[
|
2025-07-08 16:50:31 +02:00
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
2025-07-03 17:28:51 +02:00
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
|
.HAlign(HAlign_Center)
|
2025-07-08 16:50:31 +02:00
|
|
|
|
.MaxWidth(175.0)
|
|
|
|
|
|
.MinWidth(150.0)
|
|
|
|
|
|
[
|
|
|
|
|
|
SNew(STextBlock)
|
|
|
|
|
|
.Text(FText::FromString(TEXT("Websocket connection :")))
|
|
|
|
|
|
.Justification(ETextJustify::Left)
|
|
|
|
|
|
]
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
|
.MinWidth(50.0)
|
|
|
|
|
|
.MaxWidth(100.0)
|
|
|
|
|
|
[
|
|
|
|
|
|
SAssignNew(WsStatusText, STextBlock)
|
|
|
|
|
|
.Text(this, &SDTFluxStatusWidget::GetWebSocketStatusText)
|
|
|
|
|
|
.Justification(ETextJustify::Left)
|
|
|
|
|
|
.ColorAndOpacity(this, &SDTFluxStatusWidget::GetWebSocketStatusColor)
|
|
|
|
|
|
]
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
|
.MaxWidth(100.0)
|
|
|
|
|
|
.MinWidth(30.0)
|
|
|
|
|
|
[
|
|
|
|
|
|
SAssignNew(ConnectionActionButton, SButton)
|
|
|
|
|
|
.Text(this, &SDTFluxStatusWidget::GetWebConnectActionButtonText)
|
|
|
|
|
|
.ForegroundColor_Raw(this, &SDTFluxStatusWidget::GetWebConnectActionButtonColor)
|
|
|
|
|
|
.OnClicked(this, &SDTFluxStatusWidget::OnConnectionActionButtonClicked)
|
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
|
.HAlign(HAlign_Center)
|
|
|
|
|
|
.ContentPadding(1.5f)
|
|
|
|
|
|
]
|
2025-07-03 17:28:51 +02:00
|
|
|
|
]
|
|
|
|
|
|
#pragma endregion
|
2025-07-08 16:50:31 +02:00
|
|
|
|
]
|
|
|
|
|
|
+ SVerticalBox::Slot()
|
|
|
|
|
|
.VAlign(VAlign_Fill)
|
|
|
|
|
|
.HAlign(HAlign_Fill)
|
|
|
|
|
|
.AutoHeight()
|
2025-07-03 17:28:51 +02:00
|
|
|
|
[
|
2025-07-08 16:50:31 +02:00
|
|
|
|
#pragma region DataModelControlSection
|
|
|
|
|
|
SNew(SBorder)
|
|
|
|
|
|
.Padding(6.0f)
|
|
|
|
|
|
.BorderImage(FAppStyle::GetBrush("ToolPanel.DarkGroupBorder"))
|
2025-07-03 17:28:51 +02:00
|
|
|
|
[
|
2025-07-08 16:50:31 +02:00
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
|
[
|
|
|
|
|
|
SNew(SButton)
|
|
|
|
|
|
.Text(FText::FromString("Get RaceDatas"))
|
|
|
|
|
|
.OnClicked(this, &SDTFluxStatusWidget::OnRaceDatasClicked)
|
|
|
|
|
|
]
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
|
[
|
|
|
|
|
|
SNew(SButton)
|
|
|
|
|
|
.Text(FText::FromString("Get TeamList"))
|
|
|
|
|
|
.OnClicked(this, &SDTFluxStatusWidget::OnTeamListClicked)
|
|
|
|
|
|
]
|
|
|
|
|
|
|
2025-07-03 17:28:51 +02:00
|
|
|
|
]
|
2025-07-08 16:50:31 +02:00
|
|
|
|
#pragma endregion
|
|
|
|
|
|
]
|
|
|
|
|
|
+ SVerticalBox::Slot()
|
|
|
|
|
|
.VAlign(VAlign_Fill)
|
|
|
|
|
|
.HAlign(HAlign_Fill)
|
|
|
|
|
|
.AutoHeight()
|
|
|
|
|
|
[
|
|
|
|
|
|
#pragma region RankingSection
|
|
|
|
|
|
SNew(SBorder)
|
|
|
|
|
|
.Padding(6.0f)
|
|
|
|
|
|
.BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder"))
|
2025-07-03 17:28:51 +02:00
|
|
|
|
[
|
2025-07-08 16:50:31 +02:00
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
|
[
|
|
|
|
|
|
SNew(SBorder)
|
|
|
|
|
|
.Padding(6.0f)
|
|
|
|
|
|
.BorderImage(FAppStyle::GetBrush("ToolPanel.DarkGroupBorder"))
|
|
|
|
|
|
[
|
|
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
|
.HAlign(HAlign_Left)
|
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
|
[
|
|
|
|
|
|
SNew(STextBlock)
|
|
|
|
|
|
.Text(FText::FromString(TEXT("Contest Rankings:")))
|
|
|
|
|
|
.Margin(FMargin(0.0f, 0.0f, 8.0f, 0.0f))
|
|
|
|
|
|
]
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
|
.FillWidth(1.0f)
|
|
|
|
|
|
.MaxWidth(200.0f)
|
|
|
|
|
|
[
|
|
|
|
|
|
SNew(SBorder)
|
|
|
|
|
|
.BorderImage(FAppStyle::GetBrush("ToolPanel.GroupBorder"))
|
|
|
|
|
|
[
|
|
|
|
|
|
SNew(SHorizontalBox)
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
|
[
|
|
|
|
|
|
SAssignNew(ContestComboBox, SComboBox<TSharedPtr<FComboBoxItem>>)
|
|
|
|
|
|
.OptionsSource(&ContestComboBoxItems)
|
|
|
|
|
|
.OnGenerateWidget(this, &SDTFluxStatusWidget::OnGeneRankingComboWidget)
|
|
|
|
|
|
.OnSelectionChanged(this, &SDTFluxStatusWidget::OnComboContestRankingChanged)
|
|
|
|
|
|
.Content()
|
|
|
|
|
|
[
|
|
|
|
|
|
SNew(STextBlock)
|
|
|
|
|
|
.Text(this, &SDTFluxStatusWidget::GetCurrContestComboBoxValue)
|
|
|
|
|
|
]
|
|
|
|
|
|
]
|
|
|
|
|
|
]
|
|
|
|
|
|
]
|
|
|
|
|
|
+ SHorizontalBox::Slot()
|
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
|
.AutoWidth()
|
|
|
|
|
|
.Padding(FMargin(8.0f, 0.0f, 0.0f, 0.0f))
|
|
|
|
|
|
[
|
|
|
|
|
|
SNew(SButton)
|
|
|
|
|
|
.Text(FText::FromString(TEXT("RequestRanking")))
|
|
|
|
|
|
.OnClicked(this, &SDTFluxStatusWidget::OnRankingButtonClicked)
|
|
|
|
|
|
.ContentPadding(FMargin(12.0f, 4.0f))
|
|
|
|
|
|
.VAlign(VAlign_Center)
|
|
|
|
|
|
.HAlign(HAlign_Center)
|
|
|
|
|
|
]
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
]
|
2025-07-03 17:28:51 +02:00
|
|
|
|
]
|
|
|
|
|
|
#pragma endregion
|
2025-07-08 16:50:31 +02:00
|
|
|
|
]
|
|
|
|
|
|
+ SVerticalBox::Slot()
|
|
|
|
|
|
.FillHeight(1.0f)
|
|
|
|
|
|
.Padding(3.0f)
|
|
|
|
|
|
[
|
|
|
|
|
|
OutputLogModule.MakeOutputLogWidget(Params)
|
|
|
|
|
|
]
|
2025-07-03 17:28:51 +02:00
|
|
|
|
|
2025-07-08 16:50:31 +02:00
|
|
|
|
]
|
2025-07-03 17:28:51 +02:00
|
|
|
|
];
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FText SDTFluxStatusWidget::GetWebSocketStatusText() const
|
|
|
|
|
|
{
|
|
|
|
|
|
FString Status =
|
2025-07-08 16:50:31 +02:00
|
|
|
|
UEnum::GetDisplayValueAsText(DTFluxNetwork->WsStatus).ToString();
|
2025-07-03 17:28:51 +02:00
|
|
|
|
return
|
2025-07-08 16:50:31 +02:00
|
|
|
|
FText::FromString(Status);
|
2025-07-03 17:28:51 +02:00
|
|
|
|
// FText::FromString("Unknown");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FText SDTFluxStatusWidget::GetWebConnectActionButtonText() const
|
|
|
|
|
|
{
|
2025-07-08 16:50:31 +02:00
|
|
|
|
switch (DTFluxNetwork->WsStatus)
|
2025-07-03 17:28:51 +02:00
|
|
|
|
{
|
|
|
|
|
|
case EDTFluxConnectionStatus::Connected:
|
|
|
|
|
|
return FText::FromString("Disconnect");
|
|
|
|
|
|
default:
|
|
|
|
|
|
return FText::FromString("Connect");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FReply SDTFluxStatusWidget::OnConnectionActionButtonClicked()
|
|
|
|
|
|
{
|
2025-07-08 16:50:31 +02:00
|
|
|
|
if (DTFluxNetwork)
|
2025-07-03 17:28:51 +02:00
|
|
|
|
{
|
2025-07-08 16:50:31 +02:00
|
|
|
|
switch (DTFluxNetwork->WsStatus)
|
2025-07-03 17:28:51 +02:00
|
|
|
|
{
|
2025-07-08 16:50:31 +02:00
|
|
|
|
case EDTFluxConnectionStatus::Connected:
|
|
|
|
|
|
DTFluxNetwork->Reconnect();
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
DTFluxNetwork->Connect();
|
|
|
|
|
|
break;
|
2025-07-03 17:28:51 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
|
}
|
2025-07-08 16:50:31 +02:00
|
|
|
|
|
2025-07-03 17:28:51 +02:00
|
|
|
|
FSlateColor SDTFluxStatusWidget::GetWebSocketStatusColor() const
|
|
|
|
|
|
{
|
|
|
|
|
|
FColor Color;
|
2025-07-08 16:50:31 +02:00
|
|
|
|
switch (DTFluxNetwork->WsStatus)
|
2025-07-03 17:28:51 +02:00
|
|
|
|
{
|
|
|
|
|
|
case EDTFluxConnectionStatus::Unset:
|
|
|
|
|
|
Color = FColor::Orange;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case EDTFluxConnectionStatus::Connected:
|
2025-07-08 16:50:31 +02:00
|
|
|
|
Color = FColor::Green;
|
2025-07-03 17:28:51 +02:00
|
|
|
|
break;
|
|
|
|
|
|
case EDTFluxConnectionStatus::NotConnected:
|
2025-07-08 16:50:31 +02:00
|
|
|
|
Color = FColor::Orange;
|
2025-07-03 17:28:51 +02:00
|
|
|
|
break;
|
|
|
|
|
|
case EDTFluxConnectionStatus::Closed:
|
2025-07-08 16:50:31 +02:00
|
|
|
|
Color = FColor::Magenta;
|
2025-07-03 17:28:51 +02:00
|
|
|
|
break;
|
|
|
|
|
|
default:
|
2025-07-08 16:50:31 +02:00
|
|
|
|
Color = FColor::Red;
|
2025-07-03 17:28:51 +02:00
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return FSlateColor(Color);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FSlateColor SDTFluxStatusWidget::GetWebConnectActionButtonColor() const
|
|
|
|
|
|
{
|
2025-07-08 16:50:31 +02:00
|
|
|
|
FColor Color = FColor::Green;
|
|
|
|
|
|
switch (DTFluxNetwork->WsStatus)
|
2025-07-03 17:28:51 +02:00
|
|
|
|
{
|
|
|
|
|
|
case EDTFluxConnectionStatus::Connected:
|
|
|
|
|
|
Color = FColor::Red;
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
Color = FColor::Green;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return FSlateColor(Color);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-08 16:50:31 +02:00
|
|
|
|
void SDTFluxStatusWidget::PopulateComboBoxItems()
|
|
|
|
|
|
{
|
|
|
|
|
|
ContestComboBoxItems.Empty();
|
|
|
|
|
|
|
|
|
|
|
|
if (DTFluxNetwork)
|
|
|
|
|
|
{
|
|
|
|
|
|
FString Separator = " | ";
|
|
|
|
|
|
FString RootSeparator = " -> ";
|
2025-07-14 09:58:10 +02:00
|
|
|
|
TArray<FDTFluxContest> DataFromSubsystem = TArray<FDTFluxContest>();
|
|
|
|
|
|
DTFluxCore->GetContests(DataFromSubsystem);
|
2025-07-08 16:50:31 +02:00
|
|
|
|
|
|
|
|
|
|
for (const auto& Contest : DataFromSubsystem)
|
|
|
|
|
|
{
|
|
|
|
|
|
ContestComboBoxItems.Add(
|
|
|
|
|
|
FComboBoxItem::CreateItem(EComboBoxItemType::Contest, Contest.Name + RootSeparator, Contest.ContestId));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (const auto& Stage : Contest.Stages)
|
|
|
|
|
|
{
|
|
|
|
|
|
int StageId = Stage.StageId;
|
|
|
|
|
|
FString StageDisplayName = Contest.Name + Separator + Stage.Name;
|
|
|
|
|
|
ContestComboBoxItems.Add(FComboBoxItem::CreateItem(EComboBoxItemType::Stage,
|
|
|
|
|
|
StageDisplayName + RootSeparator, Contest.ContestId,
|
|
|
|
|
|
StageId));
|
|
|
|
|
|
for (const auto& Split : Contest.Splits)
|
|
|
|
|
|
{
|
|
|
|
|
|
ContestComboBoxItems.Add(FComboBoxItem::CreateItem(EComboBoxItemType::Split,
|
|
|
|
|
|
StageDisplayName + Separator + Split.Name,
|
|
|
|
|
|
Contest.ContestId, StageId, Split.SplitId));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (ContestComboBox.IsValid())
|
|
|
|
|
|
{
|
|
|
|
|
|
ContestComboBox->RefreshOptions();
|
|
|
|
|
|
if (ContestComboBoxItems.Num() > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
ContestComboBox->SetSelectedItem(ContestComboBoxItems[0]);
|
|
|
|
|
|
SelectedContestComboBoxItem = ContestComboBoxItems[0];
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TSharedRef<SWidget> SDTFluxStatusWidget::OnGeneRankingComboWidget(TSharedPtr<FComboBoxItem> InItem)
|
|
|
|
|
|
{
|
|
|
|
|
|
return SNew(STextBlock)
|
|
|
|
|
|
.Text(FText::FromString(InItem->DisplayText))
|
|
|
|
|
|
.ColorAndOpacity(GetComboItemRankingColor(InItem))
|
|
|
|
|
|
.Margin(FMargin(2.0f, 1.0f));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SDTFluxStatusWidget::OnComboContestRankingChanged(TSharedPtr<FComboBoxItem> NewSelection,
|
|
|
|
|
|
ESelectInfo::Type SelectInfo)
|
|
|
|
|
|
{
|
|
|
|
|
|
SelectedContestComboBoxItem = NewSelection;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FText SDTFluxStatusWidget::GetCurrContestComboBoxValue() const
|
|
|
|
|
|
{
|
|
|
|
|
|
if (SelectedContestComboBoxItem.IsValid())
|
|
|
|
|
|
{
|
|
|
|
|
|
return FText::FromString(SelectedContestComboBoxItem->DisplayText);
|
|
|
|
|
|
}
|
|
|
|
|
|
return FText::FromString("None");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FSlateColor SDTFluxStatusWidget::GetComboItemRankingColor(const TSharedPtr<FComboBoxItem> Item)
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (Item->Type)
|
|
|
|
|
|
{
|
|
|
|
|
|
case EComboBoxItemType::Contest:
|
|
|
|
|
|
return FSlateColor(FLinearColor(0.2f, 0.6f, 1.0f));
|
|
|
|
|
|
case EComboBoxItemType::Stage:
|
|
|
|
|
|
return FSlateColor(FLinearColor(0.2f, 0.8f, 0.2f));
|
|
|
|
|
|
case EComboBoxItemType::Split:
|
|
|
|
|
|
return FSlateColor(FLinearColor(1.0f, 0.8f, 0.2f));
|
|
|
|
|
|
case EComboBoxItemType::None:
|
|
|
|
|
|
return FSlateColor(FLinearColor(0.6f, 0.28f, 0.28f));
|
|
|
|
|
|
default:
|
|
|
|
|
|
return FSlateColor(FLinearColor::White);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FReply SDTFluxStatusWidget::OnRankingButtonClicked() const
|
|
|
|
|
|
{
|
2025-07-11 23:45:23 +02:00
|
|
|
|
if (DTFluxCore)
|
2025-07-08 16:50:31 +02:00
|
|
|
|
{
|
|
|
|
|
|
// Exemple d'envoi de requête basée sur la sélection
|
|
|
|
|
|
int ForContest = SelectedContestComboBoxItem.IsValid() ? SelectedContestComboBoxItem->ContestId : -1;
|
|
|
|
|
|
int ForStage = SelectedContestComboBoxItem.IsValid() ? SelectedContestComboBoxItem->StageId : -1;
|
|
|
|
|
|
int ForSplit = SelectedContestComboBoxItem.IsValid() ? SelectedContestComboBoxItem->SplitId : -1;
|
|
|
|
|
|
|
|
|
|
|
|
EDTFluxApiDataType RequestType = EDTFluxApiDataType::None;
|
|
|
|
|
|
if (ForContest == -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
UE_LOG(logDTFluxStatus, Error, TEXT("Contest not selected !!!!"));
|
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (ForStage == -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
UE_LOG(logDTFluxStatus, Warning, TEXT("Stage not selected !!!! Requesting contest Ranking"));
|
2025-07-11 23:45:23 +02:00
|
|
|
|
DTFluxCore->TrackedRequestContestRankings({ForContest});
|
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (ForSplit == -1)
|
|
|
|
|
|
{
|
|
|
|
|
|
UE_LOG(logDTFluxStatus, Warning, TEXT("Split not selected !!!! Requesting stage Ranking"));
|
|
|
|
|
|
FDTFluxStageKey StageKey = {ForContest, ForStage};
|
|
|
|
|
|
DTFluxCore->TrackedRequestStageRankings({StageKey});
|
2025-07-08 16:50:31 +02:00
|
|
|
|
return FReply::Handled();
|
|
|
|
|
|
}
|
2025-07-11 23:45:23 +02:00
|
|
|
|
FDTFluxSplitKey SplitKey = {ForContest, ForStage, ForSplit};
|
|
|
|
|
|
DTFluxCore->TrackedRequestSplitRankings({SplitKey});
|
2025-07-08 16:50:31 +02:00
|
|
|
|
UE_LOG(logDTFluxStatus, Warning, TEXT("Requesting %s Ranking"), *UEnum::GetValueAsString(RequestType));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return FReply::Handled();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-03 17:28:51 +02:00
|
|
|
|
END_SLATE_FUNCTION_BUILD_OPTIMIZATION
|