This commit is contained in:
aozhiwei 2023-10-02 12:24:43 +08:00
parent 128796e486
commit 816b1aedf2
2 changed files with 12 additions and 5 deletions

View File

@ -8,31 +8,37 @@
#include "jsondatamgr.h" #include "jsondatamgr.h"
#include "app.h" #include "app.h"
static const char* WORK_PATH = "../config";
void JsonDataMgr::Init() void JsonDataMgr::Init()
{ {
if (!f8::IsOnlineEnv()) {
if (f8::IsTestEnv()) {
work_path_ = a8::Format("../%d_test_config", {GAME_ID});
} else {
work_path_ = a8::Format("../%d_dev_config", {GAME_ID});
}
}
std::string wsproxy_cluster_json_file; std::string wsproxy_cluster_json_file;
std::string master_cluster_json_file; std::string master_cluster_json_file;
std::string kcp_conf_json_file; std::string kcp_conf_json_file;
wsproxy_cluster_json_file = a8::Format wsproxy_cluster_json_file = a8::Format
("%s/zone%d/node%d/wsproxy.cluster.json", ("%s/zone%d/node%d/wsproxy.cluster.json",
{ {
WORK_PATH, work_path_,
f8::App::Instance()->GetZoneId(), f8::App::Instance()->GetZoneId(),
f8::App::Instance()->GetNodeId() f8::App::Instance()->GetNodeId()
}); });
master_cluster_json_file = a8::Format master_cluster_json_file = a8::Format
("%s/zone%d/node%d/masterserver.cluster.json", ("%s/zone%d/node%d/masterserver.cluster.json",
{ {
WORK_PATH, work_path_,
f8::App::Instance()->GetZoneId(), f8::App::Instance()->GetZoneId(),
f8::App::Instance()->GetNodeId(), f8::App::Instance()->GetNodeId(),
}); });
kcp_conf_json_file = a8::Format kcp_conf_json_file = a8::Format
("%s/zone%d/node%d/kcp_conf.json", ("%s/zone%d/node%d/kcp_conf.json",
{ {
WORK_PATH, work_path_,
f8::App::Instance()->GetZoneId(), f8::App::Instance()->GetZoneId(),
f8::App::Instance()->GetNodeId(), f8::App::Instance()->GetNodeId(),
}); });

View File

@ -36,6 +36,7 @@ class JsonDataMgr : public a8::Singleton<JsonDataMgr>
void SetKcpSwitch(int is_open); void SetKcpSwitch(int is_open);
private: private:
std::string work_path_ = "../config";
a8::XObject wsproxy_cluster_json_; a8::XObject wsproxy_cluster_json_;
a8::XObject master_cluster_json_; a8::XObject master_cluster_json_;
a8::XObject kcp_conf_json_; a8::XObject kcp_conf_json_;