移除python依赖

This commit is contained in:
aozhiwei 2019-01-10 21:29:19 +08:00
parent 1dc9cd4216
commit 803b1812d0

View File

@ -8,6 +8,7 @@ namespace f8
{ {
void ScriptEngine::Init() void ScriptEngine::Init()
{ {
#if 0
engine_ = new a8::PyEngine(); engine_ = new a8::PyEngine();
if (getenv("is_dev_env")) { if (getenv("is_dev_env")) {
engine_->work_path = "/var/data/conf_test/game1008/res/pyscripts/"; engine_->work_path = "/var/data/conf_test/game1008/res/pyscripts/";
@ -18,13 +19,16 @@ namespace f8
if (!engine_->IsInitialized()) { if (!engine_->IsInitialized()) {
abort(); abort();
} }
#endif
} }
void ScriptEngine::UnInit() void ScriptEngine::UnInit()
{ {
#if 0
engine_->UnInit(); engine_->UnInit();
delete engine_; delete engine_;
engine_ = nullptr; engine_ = nullptr;
#endif
} }
void ScriptEngine::Update() void ScriptEngine::Update()
@ -33,6 +37,9 @@ namespace f8
bool ScriptEngine::LoadModule(const std::string& module_name) bool ScriptEngine::LoadModule(const std::string& module_name)
{ {
#if 1
return false;
#else
bool ret = engine_->LoadModule(module_name.c_str()); bool ret = engine_->LoadModule(module_name.c_str());
if (!ret) { if (!ret) {
a8::UdpLog::Instance()->Warning("load python module %s error %s\n", a8::UdpLog::Instance()->Warning("load python module %s error %s\n",
@ -43,10 +50,14 @@ namespace f8
assert(false); assert(false);
} }
return ret; return ret;
#endif
} }
bool ScriptEngine::LoadString(const std::string& str) bool ScriptEngine::LoadString(const std::string& str)
{ {
#if 1
return true;
#else
bool ret = engine_->ExecString(str.c_str()); bool ret = engine_->ExecString(str.c_str());
if (!ret) { if (!ret) {
a8::UdpLog::Instance()->Warning("load python string %s error %s", a8::UdpLog::Instance()->Warning("load python string %s error %s",
@ -57,11 +68,15 @@ namespace f8
assert(false); assert(false);
} }
return ret; return ret;
#endif
} }
std::tuple<bool, a8::XValue> ScriptEngine::CallGlobalFunc(const char* func_name, std::tuple<bool, a8::XValue> ScriptEngine::CallGlobalFunc(const char* func_name,
std::initializer_list<a8::XValue> args) std::initializer_list<a8::XValue> args)
{ {
#if 1
return std::tuple<bool, a8::XValue>();
#else
auto ret = engine_->CallGlobalFunc(func_name, args); auto ret = engine_->CallGlobalFunc(func_name, args);
if (!std::get<0>(ret)) { if (!std::get<0>(ret)) {
a8::UdpLog::Instance()->Warning("call global function %s error %s", a8::UdpLog::Instance()->Warning("call global function %s error %s",
@ -71,12 +86,16 @@ namespace f8
}); });
} }
return ret; return ret;
#endif
} }
std::tuple<bool, a8::XValue> ScriptEngine::CallModuleFunc(const char* module_name, std::tuple<bool, a8::XValue> ScriptEngine::CallModuleFunc(const char* module_name,
const char* func_name, const char* func_name,
std::initializer_list<a8::XValue> args) std::initializer_list<a8::XValue> args)
{ {
#if 1
return std::tuple<bool, a8::XValue>();
#else
auto ret = engine_->CallModuleFunc(module_name, func_name, args); auto ret = engine_->CallModuleFunc(module_name, func_name, args);
if (!std::get<0>(ret)) { if (!std::get<0>(ret)) {
a8::UdpLog::Instance()->Warning("call module function [%s] %s error %s", a8::UdpLog::Instance()->Warning("call module function [%s] %s error %s",
@ -87,5 +106,6 @@ namespace f8
}); });
} }
return ret; return ret;
#endif
} }
} }