@@ -67,9 +67,9 @@ https://github.com/freude916/sts2-quickRestart/blob/main/README.md
6767
6868## 创建{modid}.json
6969
70- 用 ` VS Code ` 打开项目文件夹。创建一个新文件(双击资源管理器或者右键新建文件),名字为` {modid}.json ` 。` modid ` 建议和项目名以及其中内容相同。填写以下内容。
70+ 用你的IDE(VSCode、Rider、VS等) 打开项目文件夹。创建一个新文件(双击资源管理器或者右键新建文件),名字为` {modid}.json ` 。` modid ` 建议和项目名以及其中内容相同。填写以下内容。
7171
72- * <b >不是创建` {modid}.json ` 这么一个文件,而是把` {modid} ` 替换成你的项目名,例如` Test.json ` 。之后提到的` {}``[] ` 都是替换。</b >
72+ * <b >不是创建` {modid}.json ` 这么一个文件,而是把` {modid} ` 替换成你的项目名,例如` Test.json ` 。之后提到的` {} ` ` [] ` 都是替换。</b >
7373
7474``` json
7575{
@@ -89,6 +89,12 @@ https://github.com/freude916/sts2-quickRestart/blob/main/README.md
8989
9090打开你的` .csproj ` 文件,<b >* 修改* </b >并换成以下内容:
9191
92+ * ` Rider ` 为右键你的项目,点击` Edit - Edit csproj ` 。
93+
94+ * ` VSCode ` 直接找你项目里的` .csproj ` 文件编辑。
95+
96+ ![ alt text] ( ../../images/image44.png )
97+
9298``` xml
9399<Project Sdk =" Godot.NET.Sdk/4.5.1" >
94100 <PropertyGroup >
@@ -161,7 +167,7 @@ public class Entry
161167
162168## 构建DLL
163169
164- 终端命令行输入 ` dotnet build ` (或者vscode按下` ctrl+shift+b ` 选择` dotnet: build ` ,rider点击构建 )创建dll文件。由于之前` .csproj ` 文件的配置,dll文件自动复制到游戏根目录的` mods ` 文件夹里了。
170+ 终端命令行里(找到 ` Terminal ` 按钮,或者快捷键, ` VSCode ` 为按下 ` ctrl+~ ` , ` Rider ` 为按下 ` Alt+F12 ` )输入 ` dotnet build ` (或者vscode按下` ctrl+shift+b ` 选择` dotnet: build ` ,rider点击菜单构建 )创建dll文件。由于之前` .csproj ` 文件的配置,dll文件自动复制到游戏根目录的` mods ` 文件夹里了。
165171
166172## 导出PCK
167173
@@ -172,6 +178,10 @@ public class Entry
172178* <b >注意一定得是pck!!!</b >
173179* 可选:由于现在不需要pck里包含` mod_manifest.json ` 了,在导出选项里点击` 资源 ` ,` 从项目中排除文件或目录 ` ,填写` {modid}.json ` ,` modid ` 填你自己的,不要写` {modid} ` 。
174180
181+ * 建议之后通过之后的自动打包进行。如果要兼容mac平台见下:
182+
183+ > 用文本编辑器打开` export_presets.cfg ` ,将` binary_format/architecture="x86_64" ` 改为` binary_format/architecture="msil" ` 。
184+
175185![ alt text] ( ../../images/image5.png )
176186
177187![ alt text] ( ../../images/image6.png )
@@ -188,10 +198,62 @@ public class Entry
188198
189199运行游戏。第一次会提示是否开启mod,选择是,然后游戏会关闭,打开第二次即可,如果右下角显示“已加载模组”即加载成功。如果发现存档丢失,看下一章。
190200
191- ## 不启动Godot打包 (可选)
201+ ## Rider不启动Godot打包 (可选)
192202
193203Godot支持命令行导出pck(首先你需要添加一个导出配置),例如使用终端命令:` "{你的godot.exe的路径}" --headless --export-pack "{你的导出配置的名字,例如Windows Desktop}" "{杀戮尖塔根目录}/mods/{你的modid}/{你的modid}.pck" ` ,参考 https://docs.godotengine.org/zh-cn/4.x/tutorials/editor/command_line_tutorial.html#exporting 。你可以把这个命令保存成一个cmd或者csproj里的target。
194204
205+ 打开你的` csproj ` 并新增以下内容:
206+
207+ ``` xml
208+ <Project Sdk =" Godot.NET.Sdk/4.5.1" >
209+ <PropertyGroup >
210+ <TargetFramework >net9.0</TargetFramework >
211+ <ImplicitUsings >true</ImplicitUsings >
212+ <LangVersion >12.0</LangVersion >
213+ <Nullable >enable</Nullable >
214+ <AllowUnsafeBlocks >true</AllowUnsafeBlocks >
215+
216+ <Sts2Dir >D:/Files/Softwares/Steam/steamapps/common/Slay the Spire 2</Sts2Dir >
217+ <!-- 新增 -->
218+ <GodotExe >D:/Files/Projects/godot/Godot_v4.5.1-stable_mono_win64/Godot_v4.5.1-stable_mono_win64/Godot_v4.5.1-stable_mono_win64.exe</GodotExe >
219+ <Sts2DataDir >$(Sts2Dir)/data_sts2_windows_x86_64</Sts2DataDir >
220+ </PropertyGroup >
221+
222+ <ItemGroup >
223+ <Reference Include =" sts2" >
224+ <HintPath >$(Sts2DataDir)/sts2.dll</HintPath >
225+ <Private >false</Private >
226+ </Reference >
227+
228+ <Reference Include =" 0Harmony" >
229+ <HintPath >$(Sts2DataDir)/0Harmony.dll</HintPath >
230+ <Private >false</Private >
231+ </Reference >
232+ </ItemGroup >
233+
234+ <Target Name =" Copy Mod" AfterTargets =" PostBuildEvent" >
235+ <Message Text =" Copying mod to Slay the Spire 2 mods folder..." Importance =" high" />
236+ <MakeDir Directories =" $(Sts2Dir)/mods/" />
237+ <Copy SourceFiles =" $(TargetPath)" DestinationFolder =" $(Sts2Dir)/mods/$(MSBuildProjectName)/" />
238+ <Copy SourceFiles =" $(MSBuildProjectName).json" DestinationFolder =" $(Sts2Dir)/mods/$(MSBuildProjectName)/" />
239+ </Target >
240+
241+ <!-- 新增 -->
242+ <Target Name =" ExportPck" AfterTargets =" Publish" >
243+ <Message Text =" Copying PCK to Slay the Spire 2 mods folder..." Importance =" high" />
244+ <Exec Command =" " $(GodotExe)" --headless --export-pack " Windows Desktop" " $(Sts2Dir)/mods/$(MSBuildProjectName)/$(MSBuildProjectName).pck" "
245+ EnvironmentVariables =" IsInnerGodotExport=true;MSBUILDDISABLENODEREUSE=1"
246+ ContinueOnError =" WarnAndContinue" />
247+ </Target >
248+ </Project >
249+ ```
250+
251+ 然后右键你的项目点击` Publish ` 即可。一路点OK就行。
252+
253+ ![ alt text] ( ../../images/image45.png )
254+
255+ ## VSCode不启动Godot打包(可选)
256+
195257例如在你的` .csproj ` 文件里添加` GodoExe ` 和` ExportPck ` 的内容:
196258
197259``` xml
0 commit comments