This commit is contained in:
aozhiwei 2023-02-25 11:32:57 +08:00
parent d4e1269ae8
commit 7fc8efeedf
6 changed files with 100 additions and 0 deletions

View File

@ -37,6 +37,7 @@
#include "mt/MapCollider.h"
#include "mt/Grasp.h"
#include "mt/GraspBuff.h"
#include "mt/WorldObject.h"
#include "app.h"
@ -103,6 +104,7 @@ namespace mt
RegMetaTable<MapArea>(res_path_);
RegMetaTable<Grasp>(res_path_);
RegMetaTable<GraspBuff>(res_path_);
RegMetaTable<WorldObject>(res_path_);
}
void MetaMgr::Load()

View File

@ -0,0 +1,18 @@
#include "precompile.h"
#include "mt/WorldObject.h"
IMPL_TABLE(mt::WorldObject)
namespace mt
{
void WorldObject::Init1()
{
}
void WorldObject::Init2()
{
}
}

View File

@ -0,0 +1,19 @@
#pragma once
#include "mt/macro.h"
#include "mtb/WorldObject.h"
namespace mt
{
DECLARE_AUTO_ID_TABLE(WorldObject, mtb::WorldObject,
"world_object@world_object.json"
)
public:
void Init1();
void Init2();
};
}

View File

@ -0,0 +1,37 @@
#pragma once
#include <bitset>
namespace mtb
{
class WorldObject
{
public:
a8::reflect::Class* GetClass() const;
int object_id() const { return object_id_; };
int object_type() const { return object_type_; };
float x() const { return x_; };
float y() const { return y_; };
float z() const { return z_; };
bool has_object_id() const { return __flags__.test(0);};
bool has_object_type() const { return __flags__.test(1);};
bool has_x() const { return __flags__.test(2);};
bool has_y() const { return __flags__.test(3);};
bool has_z() const { return __flags__.test(4);};
protected:
int object_id_ = 0;
int object_type_ = 0;
float x_ = 0.0f;
float y_ = 0.0f;
float z_ = 0.0f;
public:
std::bitset<5> __flags__;
};
};

View File

@ -36,6 +36,7 @@
#include "mtb/RankRoom.h"
#include "mtb/Grasp.h"
#include "mtb/GraspBuff.h"
#include "mtb/WorldObject.h"
namespace mtb
{
@ -772,4 +773,18 @@ namespace mtb
return meta_class;
}
a8::reflect::Class* WorldObject::GetClass() const
{
a8::reflect::Class* meta_class = nullptr;
if (!meta_class) {
meta_class = new a8::reflect::Class("WorldObject", 5, 0);
meta_class->SetSimpleField(0, "object_id", a8::reflect::ET_INT32, my_offsetof2(WorldObject, object_id_));
meta_class->SetSimpleField(1, "object_type", a8::reflect::ET_INT32, my_offsetof2(WorldObject, object_type_));
meta_class->SetSimpleField(2, "x", a8::reflect::ET_FLOAT, my_offsetof2(WorldObject, x_));
meta_class->SetSimpleField(3, "y", a8::reflect::ET_FLOAT, my_offsetof2(WorldObject, y_));
meta_class->SetSimpleField(4, "z", a8::reflect::ET_FLOAT, my_offsetof2(WorldObject, z_));
}
return meta_class;
}
}

View File

@ -573,3 +573,12 @@ message GraspBuff
optional string attr_num = 10;
optional string effect_list = 11;
}
message WorldObject
{
optional int32 object_id= 1;
optional int32 object_type = 2;
optional float x = 3;
optional float y = 4;
optional float z = 5;
}