Added Module Remote To add HTTP basic RemoteControl
This commit is contained in:
@ -22,6 +22,7 @@ public class DTFluxUtilities : ModuleRules
|
||||
"SlateCore",
|
||||
"DTFluxCore",
|
||||
"DTFluxCoreSubsystem",
|
||||
"AvalancheMedia",
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
114
Source/DTFluxUtilities/Private/RundownController.cpp
Normal file
114
Source/DTFluxUtilities/Private/RundownController.cpp
Normal file
@ -0,0 +1,114 @@
|
||||
// ===============================================
|
||||
// 3. SOURCE FILE (.CPP) - TOUS LES INCLUDES
|
||||
// ===============================================
|
||||
|
||||
// YourRundownController.cpp
|
||||
#include "RundownController.h"
|
||||
|
||||
#include "DTFluxUtilitiesModule.h"
|
||||
#include "Rundown/AvaRundown.h"
|
||||
#include "Rundown/AvaRundownPage.h"
|
||||
#include "Engine/Engine.h"
|
||||
#include "Engine/World.h"
|
||||
#include "UObject/UObjectGlobals.h"
|
||||
#include "UObject/ConstructorHelpers.h"
|
||||
#include "TimerManager.h"
|
||||
#include "Logging/LogMacros.h"
|
||||
#include "Components/StaticMeshComponent.h"
|
||||
#include "Materials/MaterialInterface.h"
|
||||
#include "Blueprint/UserWidget.h"
|
||||
|
||||
DEFINE_LOG_CATEGORY_STATIC(LogYourRundownController, Log, All);
|
||||
|
||||
// ===============================================
|
||||
// 4. IMPLÉMENTATION SIMPLE
|
||||
// ===============================================
|
||||
|
||||
ARundownController::ARundownController()
|
||||
{
|
||||
PrimaryActorTick.bCanEverTick = false;
|
||||
}
|
||||
|
||||
bool ARundownController::LoadRundown(const TSoftObjectPtr<UAvaRundown> RundownAsset)
|
||||
{
|
||||
if (RundownAsset.IsNull())
|
||||
{
|
||||
UE_LOG(logDTFluxUtilities, Error, TEXT("RundownAsset Null"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Charger l'asset rundown
|
||||
CurrentRundown = RundownAsset.LoadSynchronous();
|
||||
|
||||
if (!CurrentRundown)
|
||||
{
|
||||
UE_LOG(LogYourRundownController, Error, TEXT("Failed to load rundown: %s"), *RundownAsset.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialiser le contexte de playback
|
||||
CurrentRundown->InitializePlaybackContext();
|
||||
|
||||
UE_LOG(LogYourRundownController, Log, TEXT("Successfully loaded rundown: %s"), *RundownAsset.ToString());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ARundownController::PlayPage(int32 PageId)
|
||||
{
|
||||
if (!CurrentRundown)
|
||||
{
|
||||
UE_LOG(LogYourRundownController, Error, TEXT("No rundown loaded. Call LoadRundown first."));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Vérifier que la page existe
|
||||
const FAvaRundownPage& Page = CurrentRundown->GetPage(PageId);
|
||||
if (!Page.IsValidPage())
|
||||
{
|
||||
UE_LOG(LogYourRundownController, Error, TEXT("Invalid page ID: %d"), PageId);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Jouer la page
|
||||
bool bSuccess = CurrentRundown->PlayPage(PageId, EAvaRundownPagePlayType::PlayFromStart);
|
||||
|
||||
if (bSuccess)
|
||||
{
|
||||
CurrentPageId = PageId;
|
||||
UE_LOG(LogYourRundownController, Log, TEXT("Playing page %d: %s"), PageId, *Page.GetPageName());
|
||||
}
|
||||
else
|
||||
{
|
||||
UE_LOG(LogYourRundownController, Warning, TEXT("Failed to play page %d"), PageId);
|
||||
}
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
bool ARundownController::StopPage(int32 PageId)
|
||||
{
|
||||
if (!CurrentRundown)
|
||||
{
|
||||
UE_LOG(LogYourRundownController, Error, TEXT("No rundown loaded"));
|
||||
return false;
|
||||
}
|
||||
|
||||
bool bSuccess = CurrentRundown->StopPage(PageId, EAvaRundownPageStopOptions::Default, false);
|
||||
|
||||
if (bSuccess)
|
||||
{
|
||||
UE_LOG(LogYourRundownController, Log, TEXT("Stopped page %d"), PageId);
|
||||
}
|
||||
|
||||
return bSuccess;
|
||||
}
|
||||
|
||||
FString ARundownController::ListePages()
|
||||
{
|
||||
if (!CurrentRundown)
|
||||
{
|
||||
UE_LOG(logDTFluxUtilities, Error, TEXT("No rundown loaded"));
|
||||
return FString();
|
||||
}
|
||||
return FString();
|
||||
}
|
||||
41
Source/DTFluxUtilities/Public/RundownController.h
Normal file
41
Source/DTFluxUtilities/Public/RundownController.h
Normal file
@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include "CoreMinimal.h"
|
||||
#include "GameFramework/Actor.h"
|
||||
#include "Engine/World.h"
|
||||
#include "TimerManager.h"
|
||||
#include "Rundown/AvaRundown.h"
|
||||
#include "UObject/SoftObjectPath.h"
|
||||
#include "UObject/ObjectMacros.h"
|
||||
#include "RundownController.generated.h"
|
||||
|
||||
|
||||
|
||||
|
||||
UCLASS(BlueprintType, Blueprintable)
|
||||
class DTFLUXUTILITIES_API ARundownController : public AActor
|
||||
{
|
||||
GENERATED_BODY()
|
||||
|
||||
public:
|
||||
ARundownController();
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "DTFlux")
|
||||
bool LoadRundown(const TSoftObjectPtr<UAvaRundown> RundownAsset);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "DTFlux")
|
||||
bool PlayPage(int32 PageId);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "DTFlux")
|
||||
bool StopPage(int32 PageId);
|
||||
|
||||
UFUNCTION(BlueprintCallable, Category = "DTFlux")
|
||||
FString ListePages();
|
||||
|
||||
protected:
|
||||
UPROPERTY(BlueprintReadOnly, Category = "DTFlux")
|
||||
TObjectPtr<UAvaRundown> CurrentRundown;
|
||||
|
||||
UPROPERTY(BlueprintReadWrite, Category = "DTFlux")
|
||||
int32 CurrentPageId = 1;
|
||||
};
|
||||
Reference in New Issue
Block a user