星露谷游戏菜单

在标题菜单新增游戏按钮,可直接启动 Junimo Cart 和 Journey of the Prairie King,也支持其他游戏通过 API 接入。代码来源:https://github.com/aedenthorn/StardewValleyMods/

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

关于这个 Mod

在标题菜单右下角、现有按钮上方新增游戏按钮,打开游戏菜单。模组预装 Junimo Cart 和 Journey of the Prairie King,无需载入存档即可游玩。示例游戏:Jigsaw Puzzle。

添加游戏

模组作者可通过 API 将游戏添加到菜单,并设置点击和绘制方法:

public interface IStardewGamesAPI
{
    public void AddGame(string name, Action<Rectangle, int, int> clickAction, Action<SpriteBatch, Rectangle> drawAction);
    public void ReturnToMenu();
}

public void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
{
    var sgapi = Helper.ModRegistry.GetApi<IStardewGamesAPI>("aedenthorn.StardewGames");
    if (sgapi != null)
    {
        sgapi.AddGame(context.ModManifest.UniqueID, ClickAction, DrawAction);
    }
}

private void DrawAction(SpriteBatch b, Rectangle area)
{
    ...
}

private void ClickAction(Rectangle area, int x, int y)
{
    ...
}

API 会将游戏栏位在屏幕上的矩形范围传给两个方法;点击方法还会收到相对点击位置的 x、y 坐标,可用于处理多个按钮等情况。

代码来源:GitHub

来源与文件

  • 原作者:aedenthorn
  • 原项目:Stardew Games Menu
  • 文件:Stardew Games(ID:154791)

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

<!-- aoe-mods-source:nexusmods:stardewvalley:41623 -->