SirW_CustomHints

供其他模组添加自定义提示的模组制作工具,也会修复玩家在不同可交互物体间移动视线时提示叠加的问题。安装需要 BepInEx;修改 PlayerInteraction.Raycast 可能与其他修改同一函数的模组冲突。

0浏览
0下载点击
0点赞
0收藏

关于这个 Mod

SirW_CustomHints

这是一个供其他模组添加自定义提示的工具。提示显示在屏幕左侧,包含按键输入和说明文字。工具还提供面向特定需求的功能,并修复一个游戏问题:玩家视线在不同可交互物体间移动、且没有移开视线时,提示可能会叠加显示。例如,从货架看向标签再看回货架时,标签提示仍会残留。

安装

  1. 安装 Tobey's BepInEx Pack for Supermarket Simulator,或安装基础版 BepInEx 模组加载器。
  2. 从下载页面获取 ZIP 文件并解压。
  3. 将 .dll 文件放入 Supermarket Simulator\BepInEx\plugin 文件夹。

兼容与冲突

本模组会覆盖 PlayerInteraction.Raycast 函数,以便在玩家没有注视可交互物品时仍能显示提示。这可能与其他同样修改该函数的模组发生冲突。如果因此出现问题,可启用 DisablePermanentHints 设置来停用此覆盖。

文件中还提供了带 XML 文档的版本,位于 Files/Optional。实现说明见 README。

基本用法示例

以下示例展示如何添加普通提示、多按键提示、使用 Unity KeyCode 的提示、加宽提示窗口、常驻提示,以及翻译提示:

using BepInEx;
using HarmonyLib;
using SirW_CustomHints;

namespace MyMod
{
    [BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
    [BepInDependency("SirW_CustomHints", BepInDependency.DependencyFlags.HardDependency)]
    public class Plugin : BasePlugin
    {
        // 用于翻译提示;此项可选。
        private static CustomTranslatedHints customTranslatedHints = new CustomTranslatedHints();

        public override void Load()
        {
            // 将自定义函数附加到 SMS 代码。
            Harmony.CreateAndPatchAll(typeof(Plugin));
        }

        // 与电脑交互时添加提示。
        [HarmonyPatch(typeof(ComputerInteraction), nameof(ComputerInteraction.DefaultHint))]
        [HarmonyPostfix]
        static void ComputerExample(ComputerInteraction __instance, bool show)
        {
            // 仅在 ComputerInteraction.DefaultHint 设为显示时添加提示。
            if (show)
            {
                // 基本提示。
                CustomHints.AddHint(HintIcons.R, "Basic hint");

                // 使用多个按键的提示。
                CustomHints.AddHint([HintIcons.R, HintIcons.P], "Multi key");

                // 使用 UnityEngine.KeyCode 的提示。
                CustomHints.AddHint(HintIcons.GetKeyFromCode(KeyCode.R), "KeyCode hint");

                // 增加提示窗口宽度。
                CustomHints.AddHint(HintIcons.W, "Wider hint", 350f);

                // 常驻提示。
                CustomHints.AddHint(HintIcons.P, "Permanent hint", null, true);

                // 显示翻译提示。
                customTranslatedHints.AddHint(HintIcons.T, "translated_hint")
            }
        }

        // 创建翻译。
        private static void CreateTranslation()
        {
            string translationKey = "translated_hint";
            LocalizedStrings localizedStrings = new LocalizedStrings();
            localizedStrings["en"] = "Translated hint";
            localizedStrings["de"] = "Übersetzter Hinweis";
            localizedStrings["es-ES"] = "Pista traducida";
            localizedStrings["da-DK"] = "Oversat tip";

            // 如果列表中已有该条目,则更新它。
            TranslationEntry existingKey = customTranslatedHints.Translations.FirstOrDefault(x => x.TranslationKey == translationKey);
            if (existingKey != null)
            {
                existingKey.LocalizedStrings.Merge(localizedStrings);
            }
            else
            {
                TranslationEntry translationEntry = new TranslationEntry(translationKey, localizedStrings);
                customTranslatedHints.Translations.Add(translationEntry);
            }
        }
    }
}

示例中还使用了 HintIcons 类,其中包含所有可用图标。

计划事项

  • 增加玩家没有注视任何可交互物体时显示提示的功能。
  • 为自定义键盘快捷键增加更多图标。

署名与来源

作者:SirWintour

版本:2.3.0

来源与文件

  • 原作者:SirWintour
  • 原项目:SirW_CustomHints
  • 文件:SirW_CustomHints(ID:4117)

文件说明

DON'T UPDATE IF YOU USE GAMEPASS AND THE MOD WORKS! THIS WILL BREAK STUFF!

来源列出的依赖与关系

  • 作者列出的前置:Tobey's BepInEx Pack for Supermarket Simulator

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

<!-- aoe-mods-source:nexusmods:supermarketsimulator:759 -->