leopard8352
2023-12-04 8871a733498c8d717714b83bb096b7738224541a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Fill out your copyright notice in the Description page of Project Settings.
 
 
#include "Define/TapTraceEvent.h"
 
#include "Taptap.h"
 
UTapTraceEvent::UTapTraceEvent()
{
    JsonObject = MakeShareable(new FJsonObject());
}
 
void UTapTraceEvent::PutString(FString name, FString value)
{
    JsonObject->SetStringField(name,value);
}
 
void UTapTraceEvent::PutInt(FString name, int32 value)
{
    JsonObject->SetNumberField(name,value);
}
 
void UTapTraceEvent::PutFlot(FString name, float value)
{
    JsonObject->SetNumberField(name,value);
}
 
FString UTapTraceEvent::Build()
{
    FString content;
    const TSharedRef<TJsonWriter<TCHAR>> write = TJsonWriterFactory<TCHAR>::Create(&content);
    if (!FJsonSerializer::Serialize(JsonObject.ToSharedRef(),write))
    {
        TAPLOG_E(TEXT("BuildTapTrackEvent时出错,无法序列化"))
        return FString();
    }
    TAPLOG_D(TEXT("buildTraceEvent成功:%s"),*content)
    return content;
}