libBeatsaber/src/beatnote.cpp

30 lines
672 B
C++

#include "beatnoteimpl.h"
#include <nlohmann/json.hpp>
namespace Beatsaber {
void from_json(const json& j, Note& n) {
n.time = j.value("_time", 0);
n.line = j.value("_lineIndex", 0);
n.layer = j.value("_lineLayer", 0);
n.type = j.value("_type", 0);
n.cutdir = j.value("_cutDirection", 0);
if(j.contains("_customData")) {
n.customdata = j["_customData"].dump();
}
}
void from_json(const json& j, Wall& w) {
w.time = j.value("_time", 0);
w.line = j.value("_lineIndex", 0);
w.type = j.value("_type", 0);
w.duration = j.value("_duration", 0);
w.width = j.value("_width", 1);
if(j.contains("_customData")) {
w.customdata = j["_customData"].dump();
}
}
}