diff --git a/Content/Blueprint/component/BPC_DataTrasnfer.uasset b/Content/Blueprint/component/BPC_DataTrasnfer.uasset index ef411136..a4554499 100644 Binary files a/Content/Blueprint/component/BPC_DataTrasnfer.uasset and b/Content/Blueprint/component/BPC_DataTrasnfer.uasset differ diff --git a/Content/Blueprint/oldRobotsBP/BP_DJI_DroneMovementBluePrint.uasset b/Content/Blueprint/oldRobotsBP/BP_DJI_DroneMovementBluePrint.uasset index 5b55f4ce..72fcc8a4 100644 Binary files a/Content/Blueprint/oldRobotsBP/BP_DJI_DroneMovementBluePrint.uasset and b/Content/Blueprint/oldRobotsBP/BP_DJI_DroneMovementBluePrint.uasset differ diff --git a/Content/Blueprint/vehicle/StretchRobot_vehicle_BP.uasset b/Content/Blueprint/vehicle/StretchRobot_vehicle_BP.uasset index a295091a..e39ac53f 100644 Binary files a/Content/Blueprint/vehicle/StretchRobot_vehicle_BP.uasset and b/Content/Blueprint/vehicle/StretchRobot_vehicle_BP.uasset differ diff --git a/Content/GameBP/Core/BP_LuckyRobotsGameInstance.uasset b/Content/GameBP/Core/BP_LuckyRobotsGameInstance.uasset index 8988116a..9b89357e 100644 Binary files a/Content/GameBP/Core/BP_LuckyRobotsGameInstance.uasset and b/Content/GameBP/Core/BP_LuckyRobotsGameInstance.uasset differ diff --git a/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset b/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset index e774a9cd..c6c244a2 100644 Binary files a/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset and b/Content/GameBP/FunctionLibraries/BP_LuckyRobotsLibrary.uasset differ diff --git a/Content/GameBP/Menus/WB_MainScreen.uasset b/Content/GameBP/Menus/WB_MainScreen.uasset index 16765213..a37bef86 100644 Binary files a/Content/GameBP/Menus/WB_MainScreen.uasset and b/Content/GameBP/Menus/WB_MainScreen.uasset differ diff --git a/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset b/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset index 2db07bec..f2452b8c 100644 Binary files a/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset and b/Content/GameBP/UI/Settings/WB_CaptureSettings.uasset differ diff --git a/Content/GameBP/UI/WB_GameWidget.uasset b/Content/GameBP/UI/WB_GameWidget.uasset index a9893f14..288f1793 100644 Binary files a/Content/GameBP/UI/WB_GameWidget.uasset and b/Content/GameBP/UI/WB_GameWidget.uasset differ diff --git a/Content/luckyBot/Luckywidget/ChildItems/WB_ObjectsListCheckbox.uasset b/Content/luckyBot/Luckywidget/ChildItems/WB_ObjectsListCheckbox.uasset index 15dcbc60..0669ca82 100644 Binary files a/Content/luckyBot/Luckywidget/ChildItems/WB_ObjectsListCheckbox.uasset and b/Content/luckyBot/Luckywidget/ChildItems/WB_ObjectsListCheckbox.uasset differ diff --git a/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp b/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp index 8ceb3dd2..31960174 100644 --- a/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp +++ b/Source/Luckyrobots/Private/Core/LuckyRobotsGameInstance.cpp @@ -9,6 +9,8 @@ #include "GameFramework/GameUserSettings.h" #include "Kismet/KismetMathLibrary.h" #include "FunctionLibraries/LuckyRobotsFunctionLibrary.h" +#include "VaRestSubsystem.h" +#include "Subsystems/SubsystemBlueprintLibrary.h" void ULuckyRobotsGameInstance::DoSendMessage(const FString& SendValue) { @@ -284,6 +286,64 @@ TArray ULuckyRobotsGameInstance::GetSelectableItemList(EIte return SelectableItemList; } +void ULuckyRobotsGameInstance::GetMessageParse(FString Json) +{ + auto VaRestSubsystem = CastChecked(USubsystemBlueprintLibrary::GetEngineSubsystem(UVaRestSubsystem::StaticClass()), ECastCheckedType::NullChecked); + if (VaRestSubsystem) + { + UVaRestJsonObject* VaRestJsonObject = VaRestSubsystem->ConstructVaRestJsonObject(); + if (VaRestJsonObject) + { + if (VaRestJsonObject->DecodeJson(Json, true)) + { + TArray VaRestJsonValueList = VaRestJsonObject->GetArrayField("LuckyCode"); + if (VaRestJsonValueList.Num() > 0) + { + LuckyCodeList.Empty(); + for (auto VaRestJsonValue : VaRestJsonValueList) + { + if (VaRestJsonValue) + { + UVaRestJsonObject* TempObject = VaRestJsonValue->AsObject(); + if (TempObject) + { + FLuckyCode TempLuckyCode; + TempLuckyCode.ID = FCString::Atoi(*(TempObject->GetStringField("ID"))); + TempLuckyCode.Code = TempObject->GetStringField("code"); + TempLuckyCode.Time = FCString::Atof(*(TempObject->GetStringField("time"))); + TempLuckyCode.bCallback = (TempObject->GetStringField("callback") == "on"); + LuckyCodeList.Add(TempLuckyCode); + } + } + } + } + else + { + UVaRestJsonValue* VaRestJsonValue = VaRestJsonObject->GetField("LuckyCapture"); + if (VaRestJsonValue) + { + UVaRestJsonObject* TempObject = VaRestJsonValue->AsObject(); + if (TempObject) + { + bIsCapture = (TempObject->GetStringField("capture") == "on"); + bIsCaptureHand = (TempObject->GetStringField("is_capture_hand") == "on"); + bIsCaptureHead = (TempObject->GetStringField("is_capture_head") == "on"); + bScenarioCapture = (TempObject->GetStringField("scenario_capture") == "on"); + TargetPosition = FTransform(); + SetCurrentFileName(TempObject->GetStringField("file_name")); + SetCurrentFolderName(TempObject->GetStringField("folder_name")); + SetCurrentCaptureNumber(FCString::Atoi(*TempObject->GetStringField("capture_name"))); + SetCurrentIsInfiniteCapture(TempObject->GetStringField("infinite_capture") == "on"); + SetCurrentWritesPerSec(FCString::Atoi(*TempObject->GetStringField("per_second"))); + SetCurrentIsRandomPeople(TempObject->GetStringField("random_people") == "on"); + } + } + } + } + } + } +} + void ULuckyRobotsGameInstance::SetCurrentFolderName(const FString& FolderName) { CurrentCaptureSettingsData.FolderName = FText::FromString(FolderName); diff --git a/Source/Luckyrobots/Private/GameModes/LuckyRobotsGameState.cpp b/Source/Luckyrobots/Private/GameModes/LuckyRobotsGameState.cpp index dfe75858..84a0d745 100644 --- a/Source/Luckyrobots/Private/GameModes/LuckyRobotsGameState.cpp +++ b/Source/Luckyrobots/Private/GameModes/LuckyRobotsGameState.cpp @@ -5,6 +5,7 @@ #include "SocketIOClientComponent.h" #include "FunctionLibraries/LuckyRobotsFunctionLibrary.h" #include "Core/LuckyRobotsGameInstance.h" +#include "SIOJLibrary.h" ALuckyRobotsGameState::ALuckyRobotsGameState() { @@ -41,6 +42,7 @@ void ALuckyRobotsGameState::DoSocketOnGenericEvent(FString EventName, USIOJsonVa { if (ULuckyRobotsGameInstance* GameInstance = ULuckyRobotsFunctionLibrary::GetLuckyRobotsGameInstance(this)) { - GameInstance->DoGetDispatch(EventName, EventData); + GameInstance->OnMessageDispatched.Broadcast(EventName); + GameInstance->GetMessageParse(USIOJLibrary::Conv_SIOJsonValueToString(EventData)); } } diff --git a/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h b/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h index c844bc95..5341d132 100644 --- a/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h +++ b/Source/Luckyrobots/Public/Core/LuckyRobotsGameInstance.h @@ -7,6 +7,9 @@ #include "SharedDef.h" #include "LuckyRobotsGameInstance.generated.h" +DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnMessageDispatched, const FString&, Message); +DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnRandomMeshesUpdated); + class USIOJsonValue; class UGameUserWidget; /** @@ -128,6 +131,13 @@ public: UPROPERTY(EditAnywhere, BlueprintReadWrite) TArray LuckyCodeList; +public: + UPROPERTY(BlueprintCallable, BlueprintAssignable, Category = "Event") + FOnMessageDispatched OnMessageDispatched; + + UPROPERTY(BlueprintCallable, BlueprintAssignable, Category = "Event") + FOnRandomMeshesUpdated OnRandomMeshesUpdated; + public: UFUNCTION(BlueprintCallable) void DoSendMessage(const FString& SendValue); @@ -190,6 +200,9 @@ public: UFUNCTION(BlueprintPure, Category = "Selectable Items") TArray GetSelectableItemList(EItemCategory ItemCategory); + UFUNCTION(BlueprintCallable) + void GetMessageParse(FString Json); + public: UFUNCTION(BlueprintCallable) void SetCurrentFolderName(const FString& FolderName); @@ -295,7 +308,4 @@ public: UFUNCTION(BlueprintPure) int32 GetWidgetTotalHit() const; -public: - UFUNCTION(BlueprintImplementableEvent) - void DoGetDispatch(const FString& EventName, USIOJsonValue* EventData); };