31 lines
750 B
C++
31 lines
750 B
C++
// Fill out your copyright notice in the Description page of Project Settings.
|
|
|
|
|
|
#include "UEJSBlueprintFunctionLibrary.h"
|
|
|
|
#include "DMScenario.h"
|
|
#include "UEDMPlugin.h"
|
|
|
|
bool UUEJSBlueprintFunctionLibrary::JsMessageDispatch(const FString& message)
|
|
{
|
|
TSharedPtr<FJsonObject>jsonObject;
|
|
TSharedRef<TJsonReader<TCHAR>>jsonReader=TJsonReaderFactory<TCHAR>::Create(message);
|
|
bool success = FJsonSerializer::Deserialize(jsonReader, jsonObject);
|
|
if (!success)
|
|
{
|
|
UE_LOG(LogUEDMPlugin, Warning, TEXT("message parse failed, message=%s"), *message);
|
|
return false;
|
|
}
|
|
|
|
FString func = jsonObject->GetStringField(TEXT("command"));
|
|
if (TEXT("LoadTask") == func)
|
|
{
|
|
auto Scenario = TDMScenario::Create();
|
|
Scenario->Query();
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
}
|