@@ -25,12 +25,14 @@ https://github.com/freude916/sts2-quickRestart/blob/main/README.md
2525
2626## 选择文本编辑器
2727
28- 选择一个文本编辑器。可以使用[ Visual Studio Code] ( https://code.visualstudio.com/ ) 或者[ Rider] ( https://www.jetbrains.com/zh-cn/rider/download/?section=windows ) (推荐新手使用Rider)。另外也可以使用 Visual Studio等其他 IDE。以下只介绍 VS Code 的配置方法。
28+ 选择一个文本编辑器。可以使用[ Visual Studio Code] ( https://code.visualstudio.com/ ) 或者[ Rider] ( https://www.jetbrains.com/zh-cn/rider/download/?section=windows ) (< b >强烈推荐</ b >新手使用Rider)。另外也可以使用Visual Studio等其他 IDE。以下只介绍 VS Code 的配置方法。
2929
30- ## 安装VS Code插件
30+ ## 安装VS Code插件(可选)
3131
3232安装[ C# Dev Kit] ( https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csdevkit ) 。你还可以安装[ Godot Tools] ( https://marketplace.visualstudio.com/items?itemName=geequlim.godot-tools ) 等插件。
3333
34+ 记得打开设置把自动保存开了。
35+
3436![ alt text] ( ../../images/image2.png )
3537
3638## 参考官方文档
@@ -76,6 +78,7 @@ https://github.com/freude916/sts2-quickRestart/blob/main/README.md
7678``` xml
7779<Project Sdk =" Godot.NET.Sdk/4.5.1" >
7880 <PropertyGroup >
81+ <!-- 如果你安装了10.0并遇到问题,改下这里 -->
7982 <TargetFramework >net9.0</TargetFramework >
8083 <ImplicitUsings >true</ImplicitUsings >
8184 <LangVersion >12.0</LangVersion >
@@ -173,4 +176,54 @@ public class Entry
173176
174177## 不启动Godot打包(可选)
175178
176- Godot支持命令行导出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,自行搜索相关配置说明。
179+ Godot支持命令行导出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。
180+
181+ 例如在你的` .csproj ` 文件里添加` GodoExe ` 和` ExportPck ` 的内容:
182+
183+ ``` xml
184+ <Project Sdk =" Godot.NET.Sdk/4.5.1" >
185+ <PropertyGroup >
186+ <TargetFramework >net9.0</TargetFramework >
187+ <ImplicitUsings >true</ImplicitUsings >
188+ <LangVersion >12.0</LangVersion >
189+ <Nullable >enable</Nullable >
190+ <AllowUnsafeBlocks >true</AllowUnsafeBlocks >
191+
192+ <Sts2Dir >D:/Files/Softwares/Steam/steamapps/common/Slay the Spire 2</Sts2Dir >
193+ <!-- 新增 -->
194+ <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 >
195+ <Sts2DataDir >$(Sts2Dir)/data_sts2_windows_x86_64</Sts2DataDir >
196+ </PropertyGroup >
197+
198+ <ItemGroup >
199+ <Reference Include =" sts2" >
200+ <HintPath >$(Sts2DataDir)/sts2.dll</HintPath >
201+ <Private >false</Private >
202+ </Reference >
203+
204+ <Reference Include =" 0Harmony" >
205+ <HintPath >$(Sts2DataDir)/0Harmony.dll</HintPath >
206+ <Private >false</Private >
207+ </Reference >
208+ </ItemGroup >
209+
210+ <Target Name =" Copy Mod" AfterTargets =" PostBuildEvent" >
211+ <Message Text =" Copying mod to Slay the Spire 2 mods folder..." Importance =" high" />
212+ <MakeDir Directories =" $(Sts2Dir)/mods/" />
213+ <Copy SourceFiles =" $(TargetPath)" DestinationFolder =" $(Sts2Dir)/mods/$(MSBuildProjectName)/" />
214+ <Copy SourceFiles =" $(MSBuildProjectName).json" DestinationFolder =" $(Sts2Dir)/mods/$(MSBuildProjectName)/" />
215+ </Target >
216+
217+ <!-- 新增 -->
218+ <Target Name =" ExportPck" >
219+ <Message Text =" Copying PCK to Slay the Spire 2 mods folder..." Importance =" high" />
220+ <Exec Command =" " $(GodotExe)" --headless --export-pack " Windows Desktop" " $(Sts2Dir)/mods/$(MSBuildProjectName)/$(MSBuildProjectName).pck" "
221+ EnvironmentVariables =" IsInnerGodotExport=true;MSBUILDDISABLENODEREUSE=1"
222+ ContinueOnError =" WarnAndContinue" />
223+ </Target >
224+ </Project >
225+ ```
226+
227+ 然后控制台输入` dotnet build -t:ExportPck ` 即可连PCK一起导出。输入` dotnet build ` 仅编译dll。
228+
229+ 方法不限。你也可以使用` tasks.json ` 。
0 commit comments