You've already forked LuckyWorld
Optimizing gameinstance
This commit is contained in:
@ -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<FSelectableItemData> ULuckyRobotsGameInstance::GetSelectableItemList(EIte
|
||||
return SelectableItemList;
|
||||
}
|
||||
|
||||
void ULuckyRobotsGameInstance::GetMessageParse(FString Json)
|
||||
{
|
||||
auto VaRestSubsystem = CastChecked<UVaRestSubsystem>(USubsystemBlueprintLibrary::GetEngineSubsystem(UVaRestSubsystem::StaticClass()), ECastCheckedType::NullChecked);
|
||||
if (VaRestSubsystem)
|
||||
{
|
||||
UVaRestJsonObject* VaRestJsonObject = VaRestSubsystem->ConstructVaRestJsonObject();
|
||||
if (VaRestJsonObject)
|
||||
{
|
||||
if (VaRestJsonObject->DecodeJson(Json, true))
|
||||
{
|
||||
TArray<UVaRestJsonValue*> 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);
|
||||
|
Reference in New Issue
Block a user