Убрал паттерн Builder из SaveMap из-за неправильной работы
This commit is contained in:
@@ -14,11 +14,12 @@ Actor::Actor() : loc_(new Vector3D), rot_(new Vector3D), scale_(new Vector3D)
|
|||||||
|
|
||||||
std::shared_ptr<SaveMap> Actor::save()
|
std::shared_ptr<SaveMap> Actor::save()
|
||||||
{
|
{
|
||||||
return std::make_shared<SaveMap>("Actor")
|
std::shared_ptr<SaveMap> save = std::make_shared<SaveMap>("Actor");
|
||||||
->SaveObject("loc", loc_)
|
save->SaveObject("loc", loc_);
|
||||||
->SaveObject("rot", rot_)
|
save->SaveObject("rot", rot_);
|
||||||
->SaveObject("scale", scale_)
|
save->SaveObject("scale", scale_);
|
||||||
->SaveListStrings("tags", std::move(tags));
|
save->SaveListStrings("tags", std::move(tags));
|
||||||
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::load(std::shared_ptr<SaveMap> save)
|
void Actor::load(std::shared_ptr<SaveMap> save)
|
||||||
|
|||||||
@@ -371,76 +371,64 @@ save_list_objects(std::move(save_map.save_list_objects))
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::SaveInteger(const char* name, int value) noexcept
|
void SaveMap::SaveInteger(const char* name, int value) noexcept
|
||||||
{
|
{
|
||||||
save_long[name] = value;
|
save_long[name] = value;
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::SaveDouble(const char* name, double value) noexcept
|
void SaveMap::SaveDouble(const char* name, double value) noexcept
|
||||||
{
|
{
|
||||||
save_double[name] = value;
|
save_double[name] = value;
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::SaveString(const char* name, const std::string& value) noexcept
|
void SaveMap::SaveString(const char* name, const std::string& value) noexcept
|
||||||
{
|
{
|
||||||
save_string[name] = value;
|
save_string[name] = value;
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::SaveObject(const char* name, std::shared_ptr<ISave> object) noexcept
|
void SaveMap::SaveObject(const char* name, std::shared_ptr<ISave> object) noexcept
|
||||||
{
|
{
|
||||||
save_objects[name] = object;
|
save_objects[name] = object;
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::SaveVectorInteger(const char* name, std::vector<long long>&& value) noexcept
|
void SaveMap::SaveVectorInteger(const char* name, std::vector<long long>&& value) noexcept
|
||||||
{
|
{
|
||||||
save_vector_integer[name] = std::move(value);
|
save_vector_integer[name] = std::move(value);
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::SaveVectorDouble(const char* name, std::vector<double>&& value) noexcept
|
void SaveMap::SaveVectorDouble(const char* name, std::vector<double>&& value) noexcept
|
||||||
{
|
{
|
||||||
save_vector_double[name] = std::move(value);
|
save_vector_double[name] = std::move(value);
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::SaveVectorStrings(const char* name, std::vector<std::string>&& value) noexcept
|
void SaveMap::SaveVectorStrings(const char* name, std::vector<std::string>&& value) noexcept
|
||||||
{
|
{
|
||||||
save_vector_strings[name] = std::move(value);
|
save_vector_strings[name] = std::move(value);
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::SaveVectorObject(const char* name, std::vector<std::shared_ptr<ISave>>&& value) noexcept
|
void SaveMap::SaveVectorObject(const char* name, std::vector<std::shared_ptr<ISave>>&& value) noexcept
|
||||||
{
|
{
|
||||||
save_vector_objects[name] = std::move(value);
|
save_vector_objects[name] = std::move(value);
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::SaveListInteger(const char* name, std::list<long long>&& value) noexcept
|
void SaveMap::SaveListInteger(const char* name, std::list<long long>&& value) noexcept
|
||||||
{
|
{
|
||||||
save_list_integer[name] = std::move(value);
|
save_list_integer[name] = std::move(value);
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::SaveListDouble(const char* name, std::list<double>&& value) noexcept
|
void SaveMap::SaveListDouble(const char* name, std::list<double>&& value) noexcept
|
||||||
{
|
{
|
||||||
save_list_double[name] = std::move(value);
|
save_list_double[name] = std::move(value);
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::SaveListStrings(const char* name, std::list<std::string>&& value) noexcept
|
void SaveMap::SaveListStrings(const char* name, std::list<std::string>&& value) noexcept
|
||||||
{
|
{
|
||||||
save_list_strings[name] = std::move(value);
|
save_list_strings[name] = std::move(value);
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::SaveListObject(const char* name, std::list<std::shared_ptr<ISave>>&& value) noexcept
|
void SaveMap::SaveListObject(const char* name, std::list<std::shared_ptr<ISave>>&& value) noexcept
|
||||||
{
|
{
|
||||||
save_list_objects[name] = std::move(value);
|
save_list_objects[name] = std::move(value);
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long long SaveMap::GetInteger(const char* name)
|
long long SaveMap::GetInteger(const char* name)
|
||||||
@@ -517,7 +505,7 @@ std::string SaveMap::serialize() noexcept
|
|||||||
buffer += ",\"s" + key + "\":\"" + value + '\"';
|
buffer += ",\"s" + key + "\":\"" + value + '\"';
|
||||||
|
|
||||||
for (auto& [key, value] : save_objects)
|
for (auto& [key, value] : save_objects)
|
||||||
buffer += ",\"o" + key + "\":\"" + value->save()->serialize();
|
buffer += ",\"o" + key + "\":" + value->save()->serialize();
|
||||||
|
|
||||||
for (auto& [key, value] : save_vector_integer)
|
for (auto& [key, value] : save_vector_integer)
|
||||||
{
|
{
|
||||||
@@ -631,13 +619,12 @@ std::string SaveMap::serialize() noexcept
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> SaveMap::connect_to(const std::shared_ptr<SaveMap>& parent)
|
void SaveMap::connect_to(const std::shared_ptr<SaveMap>& parent)
|
||||||
{
|
{
|
||||||
if (this->parent_ != nullptr)
|
if (this->parent_ != nullptr)
|
||||||
throw std::runtime_error("Can't connect to second parent");
|
throw std::runtime_error("Can't connect to second parent");
|
||||||
|
|
||||||
this->parent_ = parent;
|
this->parent_ = parent;
|
||||||
return std::shared_ptr<SaveMap>(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string SaveMap::CleaningJSON(const std::string& json_data)
|
std::string SaveMap::CleaningJSON(const std::string& json_data)
|
||||||
|
|||||||
@@ -44,18 +44,18 @@ public:
|
|||||||
SaveMap(SaveMap&& save_map) noexcept;
|
SaveMap(SaveMap&& save_map) noexcept;
|
||||||
|
|
||||||
// Методы созранения значений
|
// Методы созранения значений
|
||||||
std::shared_ptr<SaveMap> SaveInteger(const char* name, int value) noexcept;
|
void SaveInteger(const char* name, int value) noexcept;
|
||||||
std::shared_ptr<SaveMap> SaveDouble(const char* name, double value) noexcept;
|
void SaveDouble(const char* name, double value) noexcept;
|
||||||
std::shared_ptr<SaveMap> SaveString(const char* name, const std::string& value) noexcept;
|
void SaveString(const char* name, const std::string& value) noexcept;
|
||||||
std::shared_ptr<SaveMap> SaveObject(const char* name, std::shared_ptr<ISave> object) noexcept;
|
void SaveObject(const char* name, std::shared_ptr<ISave> object) noexcept;
|
||||||
std::shared_ptr<SaveMap> SaveVectorInteger(const char* name, std::vector<long long>&& value) noexcept;
|
void SaveVectorInteger(const char* name, std::vector<long long>&& value) noexcept;
|
||||||
std::shared_ptr<SaveMap> SaveVectorDouble(const char* name, std::vector<double>&& value) noexcept;
|
void SaveVectorDouble(const char* name, std::vector<double>&& value) noexcept;
|
||||||
std::shared_ptr<SaveMap> SaveVectorStrings(const char* name, std::vector<std::string>&& value) noexcept;
|
void SaveVectorStrings(const char* name, std::vector<std::string>&& value) noexcept;
|
||||||
std::shared_ptr<SaveMap> SaveVectorObject(const char* name, std::vector<std::shared_ptr<ISave>>&& value) noexcept;
|
void SaveVectorObject(const char* name, std::vector<std::shared_ptr<ISave>>&& value) noexcept;
|
||||||
std::shared_ptr<SaveMap> SaveListInteger(const char* name, std::list<long long>&& value) noexcept;
|
void SaveListInteger(const char* name, std::list<long long>&& value) noexcept;
|
||||||
std::shared_ptr<SaveMap> SaveListDouble(const char* name, std::list<double>&& value) noexcept;
|
void SaveListDouble(const char* name, std::list<double>&& value) noexcept;
|
||||||
std::shared_ptr<SaveMap> SaveListStrings(const char* name, std::list<std::string>&& value) noexcept;
|
void SaveListStrings(const char* name, std::list<std::string>&& value) noexcept;
|
||||||
std::shared_ptr<SaveMap> SaveListObject(const char* name, std::list<std::shared_ptr<ISave>>&& value) noexcept;
|
void SaveListObject(const char* name, std::list<std::shared_ptr<ISave>>&& value) noexcept;
|
||||||
|
|
||||||
// Методы получения значенй
|
// Методы получения значенй
|
||||||
long long GetInteger(const char* name);
|
long long GetInteger(const char* name);
|
||||||
@@ -77,7 +77,7 @@ public:
|
|||||||
// Собирает все токены в JSON объект
|
// Собирает все токены в JSON объект
|
||||||
std::string serialize() noexcept;
|
std::string serialize() noexcept;
|
||||||
|
|
||||||
std::shared_ptr<SaveMap> connect_to(const std::shared_ptr<SaveMap>& parent);
|
void connect_to(const std::shared_ptr<SaveMap>& parent);
|
||||||
|
|
||||||
static std::string CleaningJSON(const std::string& json_data);
|
static std::string CleaningJSON(const std::string& json_data);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,6 +28,18 @@ void World::Tick(double delta_time)
|
|||||||
std::shared_ptr<SaveMap> World::save()
|
std::shared_ptr<SaveMap> World::save()
|
||||||
{
|
{
|
||||||
std::shared_ptr<SaveMap> save = std::make_shared<SaveMap>("World");
|
std::shared_ptr<SaveMap> save = std::make_shared<SaveMap>("World");
|
||||||
|
|
||||||
|
std::vector<std::string> ActorsIDs;
|
||||||
|
ActorsIDs.reserve(actors_map.size());
|
||||||
|
std::list<std::shared_ptr<ISave>> actors;
|
||||||
|
for (auto[it, flag] : actors_map)
|
||||||
|
{
|
||||||
|
ActorsIDs.push_back(it);
|
||||||
|
actors.push_back(flag);
|
||||||
|
}
|
||||||
|
save->SaveVectorStrings("ActorsIDs", std::move(ActorsIDs));
|
||||||
|
save->SaveListObject("Actors", std::move(actors));
|
||||||
|
|
||||||
return save;
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ public:
|
|||||||
std::shared_ptr<T> object = std::make_shared<T>();
|
std::shared_ptr<T> object = std::make_shared<T>();
|
||||||
object->SetActorLocate(loc);
|
object->SetActorLocate(loc);
|
||||||
object->SetActorRotate(rot);
|
object->SetActorRotate(rot);
|
||||||
static_cast<Actor*>(object)->world_ = this;
|
std::static_pointer_cast<Actor>(object)->world_ = this;
|
||||||
static_cast<Actor*>(object)->name_ = name;
|
std::static_pointer_cast<Actor>(object)->name_ = name;
|
||||||
actors_map.try_emplace(name, object);
|
actors_map.try_emplace(name, object);
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,9 @@ Vector2D Vector2D::operator-(const Vector2D& v) const
|
|||||||
|
|
||||||
std::shared_ptr<SaveMap> Vector2D::save()
|
std::shared_ptr<SaveMap> Vector2D::save()
|
||||||
{
|
{
|
||||||
std::unique_ptr<SaveMap> save = std::make_unique<SaveMap>("Vector2D");
|
std::shared_ptr<SaveMap> save = std::make_shared<SaveMap>("Vector2D");
|
||||||
save->SaveDouble("x", x)->SaveDouble("y", y);
|
save->SaveDouble("x", x);
|
||||||
|
save->SaveDouble("y", y);
|
||||||
return save;
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +51,9 @@ Vector3D Vector3D::operator-(const Vector3D& v) const
|
|||||||
std::shared_ptr<SaveMap> Vector3D::save()
|
std::shared_ptr<SaveMap> Vector3D::save()
|
||||||
{
|
{
|
||||||
std::unique_ptr<SaveMap> save = std::make_unique<SaveMap>("Vector3D");
|
std::unique_ptr<SaveMap> save = std::make_unique<SaveMap>("Vector3D");
|
||||||
save->SaveDouble("x", x)->SaveDouble("y", y)->SaveDouble("z", z);
|
save->SaveDouble("x", x);
|
||||||
|
save->SaveDouble("y", y);
|
||||||
|
save->SaveDouble("z", z);
|
||||||
return save;
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+121
-91
@@ -1,93 +1,123 @@
|
|||||||
{
|
{
|
||||||
"Class name": "TestWorld",
|
"Class name": "TestWorld",
|
||||||
"dtime": 5.000000,
|
"dtime": 5,
|
||||||
"Parent parameters": {
|
"Parent parameters": {
|
||||||
"Class name":"World",
|
"Class name": "World",
|
||||||
"vsActorsIDs": ["MainCamera", "TestMesh1","TestMesh2"],
|
"vsActorsIDs": [
|
||||||
"loActors": [
|
"TestMesh1",
|
||||||
{
|
"MainCamera",
|
||||||
"Class name": "Camera",
|
"TestMesh2",
|
||||||
"Parent parameters": {
|
"TestActor1"
|
||||||
"Class name":"Actor",
|
],
|
||||||
"oloc": {
|
"loActors": [
|
||||||
"Class name":"Vector3D",
|
{
|
||||||
"dx":2.0,
|
"Class name": "StaticMesh",
|
||||||
"dy":2.0,
|
"Parent parameters": {
|
||||||
"dz":2.0
|
"Class name": "Mesh",
|
||||||
},
|
"smodel_name_": "TestModel",
|
||||||
"orot": {
|
"Parent parameters": {
|
||||||
"Class name":"Vector3D",
|
"Class name": "Actor",
|
||||||
"dx":-2.335,
|
"oloc": {
|
||||||
"dy":-0.785,
|
"Class name": "Vector3D",
|
||||||
"dz":0.0
|
"dx": 1,
|
||||||
},
|
"dy": -1,
|
||||||
"oscale": {
|
"dz": 1
|
||||||
"Class name": "Vector3D",
|
},
|
||||||
"dx": 1.0,
|
"orot": {
|
||||||
"dy": 1.0,
|
"Class name": "Vector3D",
|
||||||
"dz": 1.0
|
"dx": 0,
|
||||||
},
|
"dy": 0,
|
||||||
"tags":[]
|
"dz": 0
|
||||||
}
|
},
|
||||||
},
|
"oscale": {
|
||||||
{
|
"Class name": "Vector3D",
|
||||||
"Class name": "StaticMesh",
|
"dx": 1,
|
||||||
"Parent parameters": {
|
"dy": 1,
|
||||||
"Class name": "Mesh",
|
"dz": 1
|
||||||
"smodel_name_": "TestModel",
|
},
|
||||||
"Parent parameters": {
|
"lstags": []
|
||||||
"Class name":"Actor",
|
}
|
||||||
"oloc": {
|
}
|
||||||
"Class name":"Vector3D",
|
},
|
||||||
"dx":1.0,
|
{
|
||||||
"dy":-1.0,
|
"Class name": "Camera",
|
||||||
"dz":1.0
|
"Parent parameters": {
|
||||||
},
|
"Class name": "Actor",
|
||||||
"orot": {
|
"oloc": {
|
||||||
"Class name":"Vector3D",
|
"Class name": "Vector3D",
|
||||||
"dx":0.0,
|
"dx": 2,
|
||||||
"dy":0.0,
|
"dy": 2,
|
||||||
"dz":0.0
|
"dz": 2
|
||||||
},
|
},
|
||||||
"oscale": {
|
"orot": {
|
||||||
"Class name": "Vector3D",
|
"Class name": "Vector3D",
|
||||||
"dx": 1.0,
|
"dx": -2.335,
|
||||||
"dy": 1.0,
|
"dy": -0.785,
|
||||||
"dz": 1.0
|
"dz": 0
|
||||||
},
|
},
|
||||||
"tags":[]
|
"oscale": {
|
||||||
}
|
"Class name": "Vector3D",
|
||||||
}
|
"dx": 1,
|
||||||
},
|
"dy": 1,
|
||||||
{
|
"dz": 1
|
||||||
"Class name": "StaticMesh",
|
},
|
||||||
"Parent parameters": {
|
"lstags": []
|
||||||
"Class name": "Mesh",
|
}
|
||||||
"smodel_name_": "TestModel",
|
},
|
||||||
"Parent parameters": {
|
{
|
||||||
"Class name":"Actor",
|
"Class name": "StaticMesh",
|
||||||
"oloc": {
|
"Parent parameters": {
|
||||||
"Class name":"Vector3D",
|
"Class name": "Mesh",
|
||||||
"dx":0.0,
|
"smodel_name_": "TestModel",
|
||||||
"dy":-1.0,
|
"Parent parameters": {
|
||||||
"dz":1.0
|
"Class name": "Actor",
|
||||||
},
|
"oloc": {
|
||||||
"orot": {
|
"Class name": "Vector3D",
|
||||||
"Class name":"Vector3D",
|
"dx": 0,
|
||||||
"dx":0.0,
|
"dy": -1,
|
||||||
"dy":0.0,
|
"dz": 1
|
||||||
"dz":0.0
|
},
|
||||||
},
|
"orot": {
|
||||||
"oscale": {
|
"Class name": "Vector3D",
|
||||||
"Class name": "Vector3D",
|
"dx": 0,
|
||||||
"dx": 1.0,
|
"dy": 0,
|
||||||
"dy": 1.0,
|
"dz": 0
|
||||||
"dz": 1.0
|
},
|
||||||
},
|
"oscale": {
|
||||||
"tags":[]
|
"Class name": "Vector3D",
|
||||||
}
|
"dx": 1,
|
||||||
}
|
"dy": 1,
|
||||||
}
|
"dz": 1
|
||||||
]
|
},
|
||||||
}
|
"lstags": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Class name": "TestActor",
|
||||||
|
"Parent parameters": {
|
||||||
|
"Class name": "Actor",
|
||||||
|
"oloc": {
|
||||||
|
"Class name": "Vector3D",
|
||||||
|
"dx": 0,
|
||||||
|
"dy": 0,
|
||||||
|
"dz": 0
|
||||||
|
},
|
||||||
|
"orot": {
|
||||||
|
"Class name": "Vector3D",
|
||||||
|
"dx": 0,
|
||||||
|
"dy": 0,
|
||||||
|
"dz": 0
|
||||||
|
},
|
||||||
|
"oscale": {
|
||||||
|
"Class name": "Vector3D",
|
||||||
|
"dx": 0,
|
||||||
|
"dy": 0,
|
||||||
|
"dz": 0
|
||||||
|
},
|
||||||
|
"lstags": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "TestActor.h"
|
#include "TestActor.h"
|
||||||
|
|
||||||
|
#include "Game/SaveMap/SaveMap.hpp"
|
||||||
#include "Log/Log.hpp"
|
#include "Log/Log.hpp"
|
||||||
|
|
||||||
void TestActor::BeginPlay()
|
void TestActor::BeginPlay()
|
||||||
@@ -7,3 +8,15 @@ void TestActor::BeginPlay()
|
|||||||
Actor::BeginPlay();
|
Actor::BeginPlay();
|
||||||
Loging::Log("TestActor::BeginPlay");
|
Loging::Log("TestActor::BeginPlay");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<SaveMap> TestActor::save()
|
||||||
|
{
|
||||||
|
std::shared_ptr<SaveMap> save = std::make_shared<SaveMap>("TestActor");
|
||||||
|
save->connect_to(Actor::save());
|
||||||
|
return save;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TestActor::load(std::shared_ptr<SaveMap> save)
|
||||||
|
{
|
||||||
|
Actor::load(save->getParent());
|
||||||
|
}
|
||||||
|
|||||||
@@ -7,4 +7,7 @@ class TestActor final : public Actor
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void BeginPlay() override;
|
void BeginPlay() override;
|
||||||
|
|
||||||
|
std::shared_ptr<SaveMap> save() override;
|
||||||
|
void load(std::shared_ptr<SaveMap> save) override;
|
||||||
};
|
};
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/ext/scalar_constants.hpp>
|
#include <glm/ext/scalar_constants.hpp>
|
||||||
|
|
||||||
|
#include "../Actors/TestActor.h"
|
||||||
#include "Game/GameInstance.hpp"
|
#include "Game/GameInstance.hpp"
|
||||||
#include "Game/Actors/Camera.hpp"
|
#include "Game/Actors/Camera.hpp"
|
||||||
#include "Game/SaveMap/SaveMap.hpp"
|
#include "Game/SaveMap/SaveMap.hpp"
|
||||||
@@ -22,6 +23,9 @@ void TestWorld::BeginPlay()
|
|||||||
}
|
}
|
||||||
|
|
||||||
GetActorsByClass<Camera>()[0].lock()->SetActive();
|
GetActorsByClass<Camera>()[0].lock()->SetActive();
|
||||||
|
//SpawnActorFormClass<TestActor>("TestActor1");
|
||||||
|
//std::shared_ptr<SaveMap> save_world = save();
|
||||||
|
//Loging::Log(save_world->serialize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestWorld::Tick(double delta_time)
|
void TestWorld::Tick(double delta_time)
|
||||||
@@ -56,7 +60,8 @@ std::shared_ptr<SaveMap> TestWorld::save()
|
|||||||
{
|
{
|
||||||
std::shared_ptr<SaveMap> save = World::save();
|
std::shared_ptr<SaveMap> save = World::save();
|
||||||
std::shared_ptr<SaveMap> my_save = std::make_shared<SaveMap>("TestWorld");
|
std::shared_ptr<SaveMap> my_save = std::make_shared<SaveMap>("TestWorld");
|
||||||
my_save->SaveDouble("time", time)->connect_to(save);
|
my_save->SaveDouble("time", time);
|
||||||
|
my_save->connect_to(save);
|
||||||
return my_save;
|
return my_save;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ Camera::Camera()
|
|||||||
|
|
||||||
std::shared_ptr<SaveMap> Camera::save()
|
std::shared_ptr<SaveMap> Camera::save()
|
||||||
{
|
{
|
||||||
return std::make_shared<SaveMap>("Camera")->connect_to(Actor::save());
|
std::shared_ptr<SaveMap> save = std::make_shared<SaveMap>("Camera");
|
||||||
|
save->connect_to(Actor::save());
|
||||||
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::load(std::shared_ptr<SaveMap> save)
|
void Camera::load(std::shared_ptr<SaveMap> save)
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ Mesh::Mesh()
|
|||||||
|
|
||||||
std::shared_ptr<SaveMap> Mesh::save()
|
std::shared_ptr<SaveMap> Mesh::save()
|
||||||
{
|
{
|
||||||
return std::make_shared<SaveMap>("Mesh")
|
std::shared_ptr<SaveMap> save = std::make_shared<SaveMap>("Mesh");
|
||||||
->SaveString("model_name_", model_name_)
|
save->SaveString("model_name_", model_name_);
|
||||||
->connect_to(Actor::save());
|
save->connect_to(Actor::save());
|
||||||
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::load(std::shared_ptr<SaveMap> save)
|
void Mesh::load(std::shared_ptr<SaveMap> save)
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ StaticMesh::StaticMesh()
|
|||||||
|
|
||||||
std::shared_ptr<SaveMap> StaticMesh::save()
|
std::shared_ptr<SaveMap> StaticMesh::save()
|
||||||
{
|
{
|
||||||
return std::make_shared<SaveMap>("StaticMesh")->connect_to(Mesh::save());
|
std::shared_ptr<SaveMap> save = std::make_shared<SaveMap>("StaticMesh");
|
||||||
|
save->connect_to(Mesh::save());
|
||||||
|
return save;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StaticMesh::load(std::shared_ptr<SaveMap> save)
|
void StaticMesh::load(std::shared_ptr<SaveMap> save)
|
||||||
|
|||||||
Reference in New Issue
Block a user