Schedule Iv1.0.02026年11月29日 更新

SCreen Sign Commands

供模组作者使用的框架,可根据游戏内告示牌上的文字触发自定义命令;本模组本身不包含可直接使用的命令。需要另装使用该框架的模组,例如 SCreen Sign Colors。

简介

SCreenSignCommands 是供模组作者使用的框架,可根据游戏内告示牌上的文字触发自定义命令。本模组本身不包含命令;要在游戏中产生效果,还需安装使用该框架的模组,例如 SCreen Sign Colors。

注册命令

可使用本模组提供的 register_command 方法注册命令,并指定命令名称、描述以及触发时执行的逻辑。

using System.Collections;
using Il2CppScheduleOne.EntityFramework;
using SCreenSignCommandsIL2CPP;

public class MyMod : MelonMod
{
    public override void OnInitializeMelon()
    {
        Melon<SCreenSignCommandsIL2CPP.Core>.Instance.register_command(
            "/exampleCommand",
            "This is an example command.",
            ExampleCommandLogic
        );
    }

    private IEnumerator ExampleCommandLogic(LabelledSurfaceItem instance)
    {
        yield return null;
        instance.Label.text = $"Command executed on sign with message: {instance.Message}";
    }
}

register_command 参数:

  1. name:唯一的命令名称,例如 /exampleCommand。
  2. description:命令功能的简短说明。
  3. command_method:命令执行逻辑;必须接收 LabelledSurfaceItem 实例并返回 IEnumerator。

也可以创建 SignCommand 对象并直接注册:

var customCommand = new SignCommand(
    "customCommand",
    "A custom command example.",
    CustomCommandLogic
);

Melon<SCreenSignCommandsIL2CPP.Core>.Instance.register_command(customCommand);

补充说明

  • 命令通过协程执行。
  • 使用 SignCommand.getArgs 方法解析告示牌文本中的参数。
  • 命令逻辑应妥善处理边缘情况和无效输入。

安装与兼容性

  • 前置:MelonLoader。
  • 当前版本仅支持 IL2CPP(主分支);Mono(Alternate)版本仍在开发中。

来源

来源与文件

  • 原作者:animandan
  • 原项目:SCreen Sign Commands
  • 文件:SCreenSignCommandsIL2CPP(ID:1862)

文件说明

IL2CPP (main branch) Version. SCreenSignCommands allows mod makers to register custom commands that can be triggered based on the text written on in-game signs. This mod is a framework that other mods can use and so does not contain any commands itself.

来源列出的依赖与关系

前往 N 网打开所选文件。安装与下载要求以原作者及平台说明为准。

<!-- aoe-mods-source:nexusmods:schedule1:728 -->

下载模块

共 1 个来源
立即下载推荐来源
前往下载