diff --git a/Source/EventCenterPlugin/Private/ProtocolLibrary.cpp b/Source/EventCenterPlugin/Private/ProtocolLibrary.cpp index 41b9477..e0341a7 100644 --- a/Source/EventCenterPlugin/Private/ProtocolLibrary.cpp +++ b/Source/EventCenterPlugin/Private/ProtocolLibrary.cpp @@ -13,20 +13,38 @@ FTtsRequest UProtocolLibrary::DecodeTtsPayload(const FString& payload) if (input.Split(TEXT("|"), &Left, &input)) { username = Left; - if (input.Split(TEXT("|"), &Left, &Right)) { + if (input.Split(TEXT(" "), &Left, &Right)) { voiceName = Left; text = Right; } } FTtsRequest request = FTtsRequest(); - request.Username = username; - request.VoiceName = voiceName; - request.Text = text; + request.Username = username.TrimStartAndEnd(); + request.VoiceName = voiceName.TrimStartAndEnd(); + request.Text = text.TrimStartAndEnd(); return request; } -/*void UProtocolLibrary::DecodeTtsPayload() +FSpawnRequest UProtocolLibrary::DecodeSpawnPayload(const FString& payload) { -}*/ + FString input = payload; + + FString username = TEXT(""); + FString model = TEXT(""); + + FString Left, Right; + + if (input.Split(TEXT("|"), &Left, &Right)) { + username = Left; + model = Right; + } + + FSpawnRequest request = FSpawnRequest(); + request.Username = username.TrimStartAndEnd(); + request.Model = model.TrimStartAndEnd(); + + return request; +} + diff --git a/Source/EventCenterPlugin/Public/ProtocolLibrary.h b/Source/EventCenterPlugin/Public/ProtocolLibrary.h index 133476a..44d4fa6 100644 --- a/Source/EventCenterPlugin/Public/ProtocolLibrary.h +++ b/Source/EventCenterPlugin/Public/ProtocolLibrary.h @@ -18,4 +18,8 @@ public: // Decode TTS instructions UFUNCTION(BlueprintPure, Category = "EventCenterHelperFunctions") static FTtsRequest DecodeTtsPayload(const FString& payload); + + // Decode Spawn instructions + UFUNCTION(BlueprintPure, Category = "EventCenterHelperFunctions") + static FSpawnRequest DecodeSpawnPayload(const FString& payload); }; diff --git a/Source/EventCenterPlugin/Public/ProtocolTypes.h b/Source/EventCenterPlugin/Public/ProtocolTypes.h index edeb7a4..8f226bd 100644 --- a/Source/EventCenterPlugin/Public/ProtocolTypes.h +++ b/Source/EventCenterPlugin/Public/ProtocolTypes.h @@ -6,6 +6,9 @@ #include "ProtocolTypes.generated.h" +/** + * Text to speech instructions. + */ USTRUCT(BlueprintType) struct EVENTCENTERPLUGIN_API FTtsRequest { GENERATED_BODY() @@ -21,3 +24,18 @@ public: FString Text; }; +/** + * Spawn instructions + */ +USTRUCT(BlueprintType) +struct EVENTCENTERPLUGIN_API FSpawnRequest { + GENERATED_BODY() + +public: + UPROPERTY(VisibleAnywhere, BlueprintReadOnly) + FString Username; + + UPROPERTY(VisibleAnywhere, BlueprintReadOnly) + FString Model; +}; + diff --git a/server.py b/server.py index 6a74b2a..b28c254 100644 --- a/server.py +++ b/server.py @@ -11,8 +11,18 @@ from aioredis.pubsub import Receiver from aioredis.abc import AbcChannel CHANNELS = [ + # Text to speech + 'tts', + 'say', 'vocode', + + # Object generation 'spawn', + + # Teleport + 'warp', + + # Misc 'testing', ]