1
This commit is contained in:
parent
4d17cb8f23
commit
7bed28eb79
@ -64,6 +64,8 @@ execute_process(
|
||||
COMMAND touch -a cs_proto.pb.cc
|
||||
COMMAND touch -a cs_msgid.pb.h
|
||||
COMMAND touch -a cs_msgid.pb.cc
|
||||
COMMAND touch -a metatable.pb.h
|
||||
COMMAND touch -a metatable.pb.cc
|
||||
)
|
||||
aux_source_directory(.
|
||||
SRC_LIST
|
||||
@ -80,7 +82,7 @@ add_executable(
|
||||
add_custom_target(script_pb_protocol ALL)
|
||||
add_custom_command(TARGET script_pb_protocol
|
||||
PRE_BUILD
|
||||
COMMAND python ../../third_party/tools/scripts/construct/build_pb.py --cpp_out=. --pb_files=ss_proto,ss_msgid,cs_msgid,cs_proto --python_out=../tools/robot/virtualclient
|
||||
COMMAND python ../../third_party/tools/scripts/construct/build_pb.py --cpp_out=. --pb_files=ss_proto,ss_msgid,cs_msgid,cs_proto,metatable --python_out=../tools/robot/virtualclient
|
||||
)
|
||||
add_dependencies(friend_imserver script_pb_protocol)
|
||||
|
||||
|
3
server/imserver/metadata.cc
Normal file
3
server/imserver/metadata.cc
Normal file
@ -0,0 +1,3 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "metadata.h"
|
1
server/imserver/metadata.h
Normal file
1
server/imserver/metadata.h
Normal file
@ -0,0 +1 @@
|
||||
#pragma once
|
84
server/imserver/metamgr.cc
Normal file
84
server/imserver/metamgr.cc
Normal file
@ -0,0 +1,84 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <a8/stringlist.h>
|
||||
#include <a8/csvreader.h>
|
||||
|
||||
#include "framework/cpp/utils.h"
|
||||
|
||||
#include "metamgr.h"
|
||||
#include "app.h"
|
||||
#include "jsondatamgr.h"
|
||||
|
||||
#define METAMGR_READ(field_name, def_val) MetaMgr::Instance()->field_name = \
|
||||
a8::XValue(MetaMgr::Instance()->GetSysParamAsString(#field_name, #def_val));
|
||||
|
||||
#define METAMGR_READ_STR(field_name, def_val) MetaMgr::Instance()->field_name = \
|
||||
a8::XValue(MetaMgr::Instance()->GetSysParamAsString(#field_name, def_val)).GetString();
|
||||
|
||||
class MetaDataLoader
|
||||
{
|
||||
public:
|
||||
std::map<size_t, std::map<std::string, std::string> > dirty_words;
|
||||
|
||||
void Load()
|
||||
{
|
||||
if (!f8::IsOnlineEnv()) {
|
||||
if (f8::IsTestEnv()) {
|
||||
res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/rankserver.test/res%d/",
|
||||
{
|
||||
GAME_ID,
|
||||
App::Instance()->instance_id,
|
||||
GAME_ID,
|
||||
App::Instance()->instance_id
|
||||
});
|
||||
} else {
|
||||
res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/rankserver.dev/res%d/",
|
||||
{
|
||||
GAME_ID,
|
||||
App::Instance()->instance_id,
|
||||
GAME_ID,
|
||||
App::Instance()->instance_id
|
||||
});
|
||||
}
|
||||
} else {
|
||||
res_path = "../res/";
|
||||
}
|
||||
Check();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void Check()
|
||||
{
|
||||
}
|
||||
|
||||
void BindToMetaData()
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
std::string res_path;
|
||||
};
|
||||
|
||||
void MetaMgr::Init()
|
||||
{
|
||||
loader_ = new MetaDataLoader();
|
||||
loader_->Load();
|
||||
}
|
||||
|
||||
void MetaMgr::UnInit()
|
||||
{
|
||||
delete loader_;
|
||||
loader_ = nullptr;
|
||||
}
|
||||
|
||||
void MetaMgr::Reload()
|
||||
{
|
||||
delete loader_;
|
||||
loader_ = nullptr;
|
||||
|
||||
loader_ = new MetaDataLoader();
|
||||
loader_->Load();
|
||||
}
|
23
server/imserver/metamgr.h
Normal file
23
server/imserver/metamgr.h
Normal file
@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include "metadata.h"
|
||||
|
||||
class MetaDataLoader;
|
||||
class MetaMgr : public a8::Singleton<MetaMgr>
|
||||
{
|
||||
|
||||
private:
|
||||
MetaMgr() {};
|
||||
friend class a8::Singleton<MetaMgr>;
|
||||
|
||||
public:
|
||||
|
||||
void Init();
|
||||
void UnInit();
|
||||
void Reload();
|
||||
|
||||
private:
|
||||
MetaDataLoader* loader_ = nullptr;
|
||||
|
||||
friend class MetaDataLoader;
|
||||
};
|
Loading…
x
Reference in New Issue
Block a user