This commit is contained in:
lenheart
2024-06-18 11:32:30 +08:00
parent 3bcf73becb
commit 4be190f87e
9 changed files with 468 additions and 147 deletions

View File

@@ -9,6 +9,8 @@
#include <chrono>
#include "SqrReqScript.hpp"
// #define WEBSCRIPT true;
using asio::ip::tcp;
static char szGamePathA[256];
@@ -161,10 +163,13 @@ static void ReloadingScript(HSQUIRRELVM v, std::string FilePath)
static SQInteger SqReloadScript(HSQUIRRELVM v)
{
// ReloadingScript(v, "/dp_s/Dps_A/");
// ReloadingScript(v, "/dp_s/Dps_B/");
// ReloadingScript(v, "/dp_s/Dps_C/");
#ifdef WEBSCRIPT
ReqSquirrelScript(v);
#else
ReloadingScript(v, "/dp_s/Dps_A/");
ReloadingScript(v, "/dp_s/Dps_B/");
ReloadingScript(v, "/dp_s/Dps_C/");
#endif
return 0;
}
@@ -193,13 +198,15 @@ void InitSquirrel()
// 注册全局NutApi
GlobaRegisterSquirrel(v);
#ifdef WEBSCRIPT
// 从网络加载脚本
// ReqSquirrelScript(v);
ReqSquirrelScript(v);
#else
// 加载基础脚本文件
ReloadingScript(v, "/dp_s/Dps_A/");
ReloadingScript(v, "/dp_s/Dps_B/");
ReloadingScript(v, "/dp_s/Dps_C/");
#endif
// 执行虚拟机Main函数
SQInteger top = sq_gettop(v); // saves the stack size before the call