summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/InternalExtensions.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-12-20 22:34:59 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2020-12-20 22:34:59 -0500
commit85cb824c3b96905d4e991946db61802a24e350c9 (patch)
tree6eaf73612baab4d6134a4376b7c9734b231ec63a /src/SMAPI/Framework/InternalExtensions.cs
parent2e8c7e06c5c46834b570b667cb7497fe4cc408ac (diff)
downloadSMAPI-85cb824c3b96905d4e991946db61802a24e350c9.tar.gz
SMAPI-85cb824c3b96905d4e991946db61802a24e350c9.tar.bz2
SMAPI-85cb824c3b96905d4e991946db61802a24e350c9.zip
update for draw changes
That includes child menus, UI draw mode, and UI scaling.
Diffstat (limited to 'src/SMAPI/Framework/InternalExtensions.cs')
-rw-r--r--src/SMAPI/Framework/InternalExtensions.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/InternalExtensions.cs b/src/SMAPI/Framework/InternalExtensions.cs
index b6704f26..ba1879da 100644
--- a/src/SMAPI/Framework/InternalExtensions.cs
+++ b/src/SMAPI/Framework/InternalExtensions.cs
@@ -1,11 +1,13 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Reflection;
using System.Threading;
using Microsoft.Xna.Framework.Graphics;
using StardewModdingAPI.Framework.Events;
using StardewModdingAPI.Framework.Reflection;
using StardewValley;
+using StardewValley.Menus;
namespace StardewModdingAPI.Framework
{
@@ -154,6 +156,22 @@ namespace StardewModdingAPI.Framework
}
/****
+ ** IActiveClickableMenu
+ ****/
+ /// <summary>Get a string representation of the menu chain to the given menu (including the specified menu), in parent to child order.</summary>
+ /// <param name="menu">The menu whose chain to get.</param>
+ public static string GetMenuChainLabel(this IClickableMenu menu)
+ {
+ static IEnumerable<IClickableMenu> GetAncestors(IClickableMenu menu)
+ {
+ for (; menu != null; menu = menu.GetParentMenu())
+ yield return menu;
+ }
+
+ return string.Join(" > ", GetAncestors(menu).Reverse().Select(p => p.GetType().FullName));
+ }
+
+ /****
** Sprite batch
****/
/// <summary>Get whether the sprite batch is between a begin and end pair.</summary>