123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- #pragma once
- #include "Components/Widget.h"
- #include "AkItemProperties.h"
- #include "AkSlider.generated.h"
- class AkSSlider;
- DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FAkOnFloatValueChangedEvent, float, Value);
- DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnItemDropDetected, FGuid, ItemDroppedID);
- DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPropertyDropDetected, FString, PropertyDropped);
- USTRUCT(BlueprintType)
- struct AKAUDIO_API FAkWwiseObjectDetails
- {
- GENERATED_BODY()
-
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=ItemName, meta = (DisplayName = "Name"))
- FString ItemName;
-
-
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = ItemPath, meta = (DisplayName = "Path"))
- FString ItemPath;
-
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category =ItemId, meta = (DisplayName = "Id"))
- FString ItemId;
- };
- USTRUCT(BlueprintType)
- struct AKAUDIO_API FAkWwiseItemToControl
- {
- GENERATED_BODY()
-
- UPROPERTY(VisibleAnywhere, Category= ItemPicked, meta = (DisplayName = "Name"))
- FAkWwiseObjectDetails ItemPicked;
- UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=ItemPath, meta = (DisplayName = "Path"))
- FString ItemPath;
- };
- UCLASS(config = Editor, defaultconfig)
- class AKAUDIO_API UAkSlider : public UWidget
- {
- GENERATED_BODY()
- public:
- UAkSlider(const FObjectInitializer& ObjectInitializer);
-
- UPROPERTY(EditAnywhere, Category=Appearance, meta=(ClampMin = "0", ClampMax = "1", UIMin = "0", UIMax = "1"))
- float Value = .0f;
-
- UPROPERTY()
- FGetFloat ValueDelegate;
- public:
-
-
- UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Style", meta=( DisplayName="Style" ))
- FSliderStyle WidgetStyle;
-
- UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Appearance)
- TEnumAsByte<EOrientation> Orientation = EOrientation::Orient_Horizontal;
-
- UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Appearance)
- FLinearColor SliderBarColor = FLinearColor(EForceInit::ForceInitToZero);
-
- UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Appearance)
- FLinearColor SliderHandleColor = FLinearColor(EForceInit::ForceInitToZero);
-
- UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Appearance, AdvancedDisplay)
- bool IndentHandle = false;
-
- UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Appearance, AdvancedDisplay)
- bool Locked = false;
-
- UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Appearance, meta=( ClampMin="0", ClampMax="1", UIMin="0", UIMax="1"))
- float StepSize = .0f;
-
- UPROPERTY(EditAnywhere, BlueprintReadOnly, Category="Interaction")
- bool IsFocusable = false;
- UPROPERTY(VisibleAnywhere, Category = "Audiokinetic|WAAPI|Slider", meta = (DisplayName = "Property to control"))
- FAkPropertyToControl ThePropertyToControl;
- UPROPERTY(Config, VisibleAnywhere, Category = "Audiokinetic|WAAPI|Slider", meta = (DisplayName = "Item to control"))
- FAkWwiseItemToControl ItemToControl;
-
- UPROPERTY(BlueprintAssignable, Category="Widget Event")
- FAkOnFloatValueChangedEvent OnValueChanged;
-
- UPROPERTY(BlueprintAssignable, Category = "Widget Event")
- FOnItemDropDetected OnItemDropped;
-
- UPROPERTY(BlueprintAssignable, Category = "Widget Event")
- FOnPropertyDropDetected OnPropertyDropped;
- public:
-
- UFUNCTION(BlueprintCallable, Category="Behavior")
- float GetValue() const;
-
- UFUNCTION(BlueprintCallable, Category="Behavior")
- void SetValue(float InValue);
-
- UFUNCTION(BlueprintCallable, Category="Behavior")
- void SetIndentHandle(bool InValue);
-
- UFUNCTION(BlueprintCallable, Category="Behavior")
- void SetLocked(bool InValue);
-
- UFUNCTION(BlueprintCallable, Category="Behavior")
- void SetStepSize(float InValue);
-
- UFUNCTION(BlueprintCallable, Category="Appearance")
- void SetSliderBarColor(FLinearColor InValue);
-
- UFUNCTION(BlueprintCallable, Category="Appearance")
- void SetSliderHandleColor(FLinearColor InValue);
-
-
- UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WAAPI|Slider", meta = (Keywords = "Set Item Id"))
- void SetAkSliderItemId(const FGuid& ItemId);
-
- UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WAAPI|Slider", meta = (Keywords = "Get Item Id"))
- const FGuid GetAkSliderItemId() const;
-
- UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WAAPI|Slider", meta = (Keywords = "Set Item Property"))
- void SetAkSliderItemProperty(const FString& ItemProperty);
-
- UFUNCTION(BlueprintCallable, Category = "Audiokinetic|WAAPI|Slider", meta = (Keywords = "Get Item Property"))
- const FString GetAkSliderItemProperty() const;
-
- virtual void SynchronizeProperties() override;
-
-
- virtual void ReleaseSlateResources(bool bReleaseChildren) override;
-
- virtual void BeginDestroy() override;
- #if WITH_EDITOR
- virtual const FText GetPaletteCategory() override;
- #endif
- protected:
- uint64 SubscriptionId;
-
- TSharedPtr<AkSSlider> MyAkSlider;
-
- virtual TSharedRef<SWidget> RebuildWidget() override;
-
- void HandleOnValueChanged(float InValue);
-
- FReply HandleDropped(const FGeometry& DropZoneGeometry, const FDragDropEvent& DragDropEvent);
- PROPERTY_BINDING_IMPLEMENTATION(float, Value);
- private:
- void SynchronizePropertyWithWwise();
- void UnsubscribePropertyChangedCallback();
-
- float minValue;
-
- float maxValue;
- };
|