93 lines
2.6 KiB
C++
93 lines
2.6 KiB
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Widgets/SCompoundWidget.h"
|
|
|
|
|
|
/**
|
|
*
|
|
*/
|
|
class UDTFluxNetworkSubsystem;
|
|
class UDTFluxCoreSubsystem;
|
|
class SSuperListView;
|
|
|
|
|
|
class DTFLUXAPISTATUS_API SDTFluxStatusWidget : public SCompoundWidget
|
|
{
|
|
public:
|
|
SLATE_BEGIN_ARGS(SDTFluxStatusWidget)
|
|
{
|
|
}
|
|
|
|
SLATE_END_ARGS()
|
|
|
|
void OnOpenSettingsClicked();
|
|
FReply OnRaceDatasClicked();
|
|
FReply OnTeamListClicked();
|
|
/** Constructs this widget with InArgs */
|
|
void Construct(const FArguments& InArgs);
|
|
TAttribute<FText> ConnectionActionButtonText;
|
|
FReply OnConnectionActionButtonClicked();
|
|
|
|
enum class EComboBoxItemType
|
|
{
|
|
Contest,
|
|
Stage,
|
|
Split,
|
|
None
|
|
};
|
|
|
|
struct FComboBoxItem
|
|
{
|
|
FString DisplayText;
|
|
int ContestId = -1;
|
|
int StageId = -1;
|
|
int SplitId = -1;
|
|
EComboBoxItemType Type = EComboBoxItemType::None;
|
|
|
|
|
|
FComboBoxItem(const EComboBoxItemType InType, const FString& InDisplayText, const int InContestId,
|
|
const int InStageId = -1, const int InSplitId = -1)
|
|
: DisplayText(InDisplayText), ContestId(InContestId), StageId(InStageId), SplitId(InSplitId), Type(InType)
|
|
{
|
|
}
|
|
|
|
static TSharedPtr<FComboBoxItem> CreateItem(const EComboBoxItemType& InType, const FString& InDisplayText,
|
|
const int InContestId, const int InStageId = -1,
|
|
const int InSplitId = -1)
|
|
{
|
|
TSharedPtr<FComboBoxItem> Item = MakeShareable(
|
|
new FComboBoxItem(InType, InDisplayText, InContestId, InStageId, InSplitId));
|
|
return Item;
|
|
}
|
|
};
|
|
|
|
private:
|
|
UDTFluxNetworkSubsystem* DTFluxNetwork = nullptr;
|
|
UDTFluxCoreSubsystem* DTFluxCore = nullptr;
|
|
// // TODO make a struct
|
|
FText GetWebSocketStatusText() const;
|
|
FText GetWebConnectActionButtonText() const;
|
|
FSlateColor GetWebSocketStatusColor() const;
|
|
FSlateColor GetWebConnectActionButtonColor() const;
|
|
TSharedPtr<STextBlock> WsStatusText;
|
|
TSharedPtr<SButton> ConnectionActionButton;
|
|
|
|
TSharedPtr<SComboBox<TSharedPtr<FComboBoxItem>>> ContestComboBox;
|
|
TArray<TSharedPtr<FComboBoxItem>> ContestComboBoxItems;
|
|
TSharedPtr<FComboBoxItem> SelectedContestComboBoxItem;
|
|
|
|
|
|
// Méthodes pour le ComboBox
|
|
void PopulateComboBoxItems();
|
|
TSharedRef<SWidget> OnGeneRankingComboWidget(TSharedPtr<FComboBoxItem> InItem);
|
|
void OnComboContestRankingChanged(TSharedPtr<FComboBoxItem> NewSelection, ESelectInfo::Type SelectInfo);
|
|
FText GetCurrContestComboBoxValue() const;
|
|
|
|
static FSlateColor GetComboItemRankingColor(const TSharedPtr<FComboBoxItem> Item);
|
|
|
|
FReply OnRankingButtonClicked() const;
|
|
};
|