XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEExtension.SpaceEngineers.ScriptingHelper

【DLL】太空工程师SpaceEngineer脚本依赖辅助

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFEExtension.SpaceEngineers.ScriptingHelper

优化部分代码

9446ff2
XFE工作室室长 <mail@xfegzs.com>
提交于

代码差异

4 个文件 +33 -4
Added XFEExtension.SpaceEngineers.ScriptingHelper/IProgramBase.cs +25 -0
@@ -0,0 +1,25 @@
1 using Sandbox.ModAPI.Ingame;
2
3 namespace XFEExtension.SpaceEngineers.ScriptingHelper;
4
5 /// <summary>
6 /// 定义了一个接口,提供了在游戏内脚本执行时调用的主入口点和保存状态的方法。<br/>
7 /// Defines an interface providing a main entry point for execution when the in-game script runs and a method for saving state.
8 /// </summary>
9 public interface IProgramBase
10 {
11 /// <summary>
12 /// 当游戏内脚本执行时调用。根据传入的参数和更新源执行相应的逻辑。<br/>
13 /// Executes the main entry point for the program, processing the specified argument based on the provided update
14 /// source.
15 /// </summary>
16 /// <param name="argument">需要处理的输入字符串。不能为空;表示要处理的命令或数据。<br/>The input string to be processed. Cannot be null; represents the command or data to handle.</param>
17 /// <param name="updateSource">触发执行的更新源。决定如何解释和处理参数。<br/>The source of the update triggering the execution. Determines how the argument is interpreted and processed.</param>
18 public void Main(string argument, UpdateType updateSource);
19
20 /// <summary>
21 /// 当游戏内脚本需要保存其状态时调用。可以在此方法中实现任何必要的逻辑来持久化数据,以便在脚本重新加载时恢复状态。<br/>
22 /// Called when the program needs to save its state.
23 /// </summary>
24 public void Save();
25 }
Modified XFEExtension.SpaceEngineers.ScriptingHelper/XFEExtension.SpaceEngineers.ScriptingHelper.csproj +1 -1
@@ -96,7 +96,7 @@
96 96 </Reference>
97 97 </ItemGroup>
98 98 <ItemGroup>
99 <Compile Include="ProgramBase.cs" />
99 <Compile Include="IProgramBase.cs" />
100 100 <Compile Include="Properties\AssemblyInfo.cs" />
101 101 </ItemGroup>
102 102 <ItemGroup>
Modified XFEExtension.SpaceEngineers.ScriptingHelper/XFEExtension.SpaceEngineers.ScriptingHelper.nuspec +1 -1
@@ -2,7 +2,7 @@
2 2 <package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
3 3 <metadata>
4 4 <id>XFEExtension.SpaceEngineers.ScriptingHelper</id>
5 <version>1.0.1</version>
5 <version>1.0.2</version>
6 6 <authors>XFEStudio</authors>
7 7 <description>Provides a base class for Space Engineers scripts. Adds ProgramBase directly to your project for easy copy-pasting into the game.</description>
8 8 <readme>readme.md</readme>
Modified XFEExtension.SpaceEngineers.ScriptingHelper/readme.md +6 -2
@@ -7,13 +7,15 @@ Thank you for installing XFEExtension.SpaceEngineers.ScriptingHelper!
7 7 1. This package has added a 'ProgramBase.cs' file to your project.
8 8 2. Your main 'Program' class should inherit from 'ProgramBase':
9 9
10 public class Program : ProgramBase
10 ```csharp
11 public class Program : MyGridPrgram, IProgramBase
11 12 {
12 13 public override void Main(string argument, UpdateType updateSource)
13 14 {
14 15 // Your code here
15 16 }
16 17 }
18 ```
17 19
18 20 3. When you are ready to deploy to Space Engineers:
19 21 - Copy the content of your 'Program' class.
@@ -38,13 +40,15 @@ Space Engineers 脚本助手
38 40 1. 此包已向您的项目添加了 'ProgramBase.cs' 文件。
39 41 2. 您的主 'Program' 类应继承自 'ProgramBase':
40 42
41 public class Program : ProgramBase
43 ```csharp
44 public class Program : MyGridPrgram, IProgramBase
42 45 {
43 46 public override void Main(string argument, UpdateType updateSource)
44 47 {
45 48 // 您的代码写在这里
46 49 }
47 50 }
51 ```
48 52
49 53 3. 当您准备部署到《太空工程师》时:
50 54 - 复制您的 'Program' 类里面的内容。