diff --git a/README.md b/README.md index 2d15c08..391df6a 100644 --- a/README.md +++ b/README.md @@ -5,3 +5,113 @@ Oshima Studios 巨献 设定可参考:[Oshima Core 文档 | 喔 是吗?](https://docs.milimoe.com) FunGame 原项目地址:[https://github.com/project-redbud/FunGame-Core](https://github.com/project-redbud/FunGame-Core) + +--- + +# OshimaGameModule + FunGame.Server 一键部署指南 + +本仓库提供了批处理脚本,用于**自动完成**以下所有部署工作: + +- 从 GitHub 克隆所需的 4 个仓库(`FunGame-Core`、`FunGame-Server`、`OshimaGameModule`、`SQLQueryExtension`) +- 整理目录结构 +- 编译所有解决方案 +- 复制插件、配置文件、SQL 脚本 +- 启动 Web API 服务(`FunGameWebAPI.exe`) + +你**不需要**提前克隆任何东西,只需获取**两个**脚本文件即可。 + +--- + +## 系统要求 + +- **操作系统**:Windows(脚本使用 `mkdir`、`copy`、`xcopy`、`start` 等命令) +- **[.NET 10.0 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)**(`dotnet --version` 确认) +- **[Git for Windows](https://git-scm.com/downloads)**(已添加到 `PATH`) + +--- + +## 部署步骤(只需两步) + +### 1️⃣ 获取脚本 + +将以下两个脚本保存到**同一个空文件夹**中: + +- `setup.bat` +- `start-web-api.bat` + +### 2️⃣ 运行 `setup.bat` + +双击 `setup.bat`(或在命令行中执行)即可。 + +整个过程**全自动**,包括: +- 克隆四个仓库(该步骤需要网络) +- 编译三个 `.sln` 解决方案 +- 复制所有依赖文件到正确位置 +- 自动启动 `FunGameWebAPI.exe` + +如果编译失败,请查看 `build_logs\build_log.txt` 中的详细日志。 + +后续运行只需要直接运行 `start-web-api.bat` 即可。 + +--- + +## 执行后的目录结构 + +``` +当前文件夹/ +├── build_logs/ # 编译日志 +├── FunGame.Core/ # 核心库 +├── FunGame.Extension/ +│ └── FunGame.SQLQueryExtension/ # SQL扩展 +├── FunGame.Server/ # Web API服务 +│ └── bin/Debug/net10.0/ +│ ├── FunGameWebAPI.exe +│ ├── fungame.sql / fungame_sqlite.sql +│ ├── configs/ # 插件配置文件 +│ ├── maps/ # 地图相关DLL +│ ├── modules/ # 模块DLL +│ └── plugins/ +│ ├── OshimaServer/ +│ └── OshimaWebAPI/ +├── OshimaGameModule/ # 插件源码 +├── setup.bat +└── start-web-api.bat +``` + +--- + +## 常见问题 + +### ❌ `dotnet build` 失败 + +- 确认已安装符合项目版本的 **.NET SDK**(`dotnet --info`) +- 查看 `build_logs\build_log.txt` 定位具体错误 + +### ❌ git clone 失败 + +- 检查网络,确保能访问 `github.com` +- 如果网络限制 HTTPS,可改为 SSH 地址(需提前配置 SSH key) + +--- + +## 手动启动(不重新编译) + +如果只需要启动服务(不再编译),可以执行: + +```bash +cd FunGame.Server\bin\Debug\net10.0 +FunGameWebAPI.exe +``` + +--- + +## 许可证 + +各子项目遵循其各自仓库中的许可证。 + +--- + +## 需要帮助? + +请查看各子项目的 GitHub Issues,或联系维护者。 +日志文件位于 `build_logs\build_log.txt`,请附上该文件内容以便排查问题。 diff --git a/setup.bat b/setup.bat new file mode 100644 index 0000000..1a66e2b --- /dev/null +++ b/setup.bat @@ -0,0 +1,9 @@ +git clone https://github.com/project-redbud/FunGame-Core +git clone https://github.com/project-redbud/FunGame-Server +git clone https://github.com/oshima-studios/OshimaGameModule +git clone https://github.com/project-redbud/SQLQueryExtension +ren "FunGame-Core" "FunGame.Core" +ren "FunGame-Server" "FunGame.Server" +if not exist "FunGame.Extension" mkdir "FunGame.Extension" +move "SQLQueryExtension" "FunGame.Extension\FunGame.SQLQueryExtension" +call "start-web-api.bat" \ No newline at end of file diff --git a/start-web-api.bat b/start-web-api.bat new file mode 100644 index 0000000..2babe4c --- /dev/null +++ b/start-web-api.bat @@ -0,0 +1,70 @@ +if not exist "build_logs" mkdir "build_logs" +set SOLUTION1=FunGame.Core\FunGame.Core.sln +set SOLUTION2=FunGame.Server\FunGameServer.sln +set SOLUTION3=OshimaGameModule\OshimaGameModule.sln +set LOG_FILE=build_logs\build_log.txt +echo Build started at %date% %time% > %LOG_FILE% +echo ----------------------------------------------- >> %LOG_FILE% +echo Building FunGame.Core... +dotnet build %SOLUTION1% -c Debug >> %LOG_FILE% 2>&1 +if %errorlevel% neq 0 ( + echo Failed to build FunGame.Core. See log for details. + goto :error +) +echo FunGame.Core build succeeded. +echo Building FunGame.Server... +dotnet build %SOLUTION2% -c Debug >> %LOG_FILE% 2>&1 +if %errorlevel% neq 0 ( + echo Failed to build FunGame.Server. See log for details. + goto :error +) +echo FunGame.Server build succeeded. +echo Building OshimaGameModule... +dotnet build %SOLUTION3% -c Debug >> %LOG_FILE% 2>&1 +if %errorlevel% neq 0 ( + echo Failed to build OshimaGameModule. See log for details. + goto :error +) +echo OshimaGameModule build succeeded. +echo ----------------------------------------------- >> %LOG_FILE% +echo Build completed at %date% %time% >> %LOG_FILE% +echo All solutions built completely! +goto :end + +:error +echo ----------------------------------------------- >> %LOG_FILE% +echo Build failed at %date% %time%. >> %LOG_FILE% +echo Check the log file for details: %LOG_FILE% + +:end +set "coreDir=FunGame.Core\Library\SQLScript" +set "sourceDir=OshimaGameModule\bin\Debug\net10.0" +set "destDir=FunGame.Server\bin\Debug\net10.0" +set "destDir2=%destDir%\plugins\OshimaServer" +set "destDir3=%destDir%\plugins\OshimaWebAPI" +copy "%coreDir%\fungame.sql" "%destDir%" /y +copy "%coreDir%\fungame_sqlite.sql" "%destDir%" /y +if not exist "%destDir%\maps" mkdir "%destDir%\maps" +copy "%sourceDir%\OshimaCore.dll" "%destDir%\maps\OshimaCore.dll" /Y >nul +copy "%sourceDir%\OshimaMaps.dll" "%destDir%\maps\OshimaMaps.dll" /Y >nul +if not exist "%destDir%\modules" mkdir "%destDir%\modules" +copy "%sourceDir%\OshimaCore.dll" "%destDir%\modules\OshimaCore.dll" /Y >nul +copy "%sourceDir%\OshimaMaps.dll" "%destDir%\modules\OshimaMaps.dll" /Y >nul +copy "%sourceDir%\OshimaModules.dll" "%destDir%\modules\OshimaModules.dll" /Y >nul +copy "%sourceDir%\OshimaServers.dll" "%destDir%\modules\OshimaServers.dll" /Y >nul +if not exist "%destDir2%" mkdir "%destDir2%" +copy "%sourceDir%\OshimaCore.dll" "%destDir2%\OshimaCore.dll" /Y >nul +copy "%sourceDir%\OshimaMaps.dll" "%destDir2%\OshimaMaps.dll" /Y >nul +copy "%sourceDir%\OshimaModules.dll" "%destDir2%\OshimaModules.dll" /Y >nul +copy "%sourceDir%\OshimaServers.dll" "%destDir2%\OshimaServers.dll" /Y >nul +if not exist "%destDir3%" mkdir "%destDir3%" +copy "%sourceDir%\OshimaCore.dll" "%destDir3%\OshimaCore.dll" /Y >nul +copy "%sourceDir%\OshimaMaps.dll" "%destDir3%\OshimaMaps.dll" /Y >nul +copy "%sourceDir%\OshimaModules.dll" "%destDir3%\OshimaModules.dll" /Y >nul +copy "%sourceDir%\OshimaServers.dll" "%destDir3%\OshimaServers.dll" /Y >nul +copy "%sourceDir%\OshimaWebAPI.dll" "%destDir3%\OshimaWebAPI.dll" /Y >nul +if not exist "%destDir%\configs" mkdir "%destDir%\configs" +xcopy "%sourceDir%\configs\" "%destDir%\configs\" /e /i /y /q >nul + +cd FunGame.Server\bin\Debug\net10.0 +start FunGameWebAPI.exe \ No newline at end of file