mirror of
https://github.com/storytold/EventCenterPlugin.git
synced 2026-10-09 00:09:42 +00:00
this works! command parsing for spawn and tts
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user