Added serialization for UI components
This commit is contained in:
@@ -25,4 +25,4 @@
|
||||
#include "Components/SpriteComponent.h"
|
||||
#include "Components/TransformComponent.h"
|
||||
#include "Components/WrenScriptComponent.h"
|
||||
|
||||
#include "Components/UIComponent.h"
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "src/Core/Object/Object.h"
|
||||
#include "src/Resource/UUID.h"
|
||||
#include "src/Resource/Serializable.h"
|
||||
|
||||
namespace Nuake
|
||||
{
|
||||
@@ -13,5 +14,18 @@ namespace Nuake
|
||||
std::string UIFilePath;
|
||||
bool IsWorldSpace;
|
||||
// TODO: Z-Ordering
|
||||
|
||||
json Serialize()
|
||||
{
|
||||
BEGIN_SERIALIZE();
|
||||
SERIALIZE_VAL(UIFilePath);
|
||||
END_SERIALIZE();
|
||||
}
|
||||
|
||||
bool Deserialize(const json& j)
|
||||
{
|
||||
DESERIALIZE_VAL(UIFilePath);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -65,6 +65,8 @@ namespace Nuake
|
||||
SERIALIZE_OBJECT_REF_LBL("NetScriptComponent", GetComponent<NetScriptComponent>())
|
||||
if (HasComponent<NavMeshVolumeComponent>())
|
||||
SERIALIZE_OBJECT_REF_LBL("NavMeshVolumeComponent", GetComponent<NavMeshVolumeComponent>())
|
||||
if (HasComponent<UIComponent>())
|
||||
SERIALIZE_OBJECT_REF_LBL("UIComponent", GetComponent<UIComponent>())
|
||||
|
||||
END_SERIALIZE();
|
||||
}
|
||||
@@ -99,6 +101,7 @@ namespace Nuake
|
||||
DESERIALIZE_COMPONENT(AudioEmitterComponent);
|
||||
DESERIALIZE_COMPONENT(NetScriptComponent);
|
||||
DESERIALIZE_COMPONENT(NavMeshVolumeComponent);
|
||||
DESERIALIZE_COMPONENT(UIComponent);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user