Added documentation to new classes and methods

This commit is contained in:
David Higueros committed 2026-07-12 23:35:14 -06:00
1 parent 24443c94ca
commit bae3ff8cea
3 files changed
+50

No files matched your search

+23
View File
@@ -41,6 +41,18 @@ public abstract class CustomMultiSelectMenu<TEntry>(IntPtr il2CppPtr)
public record MenuEntry(ShapeshifterPanel Panel, TEntry Entry) : IMenuEntry;
/// <summary>
/// Creates a <typeparamref name="TMenu"/>.
/// </summary>
/// <typeparam name="TMenu">The type of <see cref="CustomMultiSelectMenu{TEntry}"/>.</typeparam>
/// <param name="activeColor">The <see cref="Color"/> to use when an entry is selected but not hovered over.</param>
/// <param name="hoverSelectSprite">The <see cref="Sprite"/> to use when an entry is hovered over while not selected.</param>
/// <param name="hoverSelectColor">The <see cref="Color"/> to use when an entry is hovered over while not selected.</param>
/// <param name="hoverDeselectSprite">The <see cref="Sprite"/> to use when an entry is hovered over while selected.</param>
/// <param name="hoverDeselectColor">The <see cref="Color"/> to use when an entry is hovered over while selected.</param>
/// <param name="onMouseOut">Function that can optionally be run when the mouse is moved outside a menu panel.</param>
/// <param name="onMouseOver">Function that can optionally be run when the mouse is moved over a menu panel.</param>
/// <returns>New <typeparamref name="TMenu"/> object.</returns>
protected static TMenu Create<TMenu>(
Color? activeColor = null,
LoadableAsset<Sprite>? hoverSelectSprite = null,
@@ -70,6 +82,13 @@ public abstract class CustomMultiSelectMenu<TEntry>(IntPtr il2CppPtr)
return customMenu;
}
/// <summary>
/// Setup the given <paramref name="panel"/> once created, given its index, entry, and onClick action.
/// </summary>
/// <param name="panel">The panel to configure.</param>
/// <param name="i">The <paramref name="panel"/>'s index.</param>
/// <param name="entry">The <paramref name="panel"/>'s <typeparamref name="TEntry"/> entry.</param>
/// <param name="onClick">Action to perform when the <paramref name="panel"/> is clicked on.</param>
protected abstract void SetupPanelEntry(ShapeshifterPanel panel, int i, TEntry entry, Action onClick);
/// <summary>
@@ -172,11 +191,15 @@ public abstract class CustomMultiSelectMenu<TEntry>(IntPtr il2CppPtr)
onSelection!(selectedEntries.Select(se => se.Entry).ToList());
}
/// <inheritdoc/>
protected override bool IsEntrySelected(IMenuEntry entry)
{
return selectedEntries.Any(e => e.Panel == entry.Panel);
}
/// <inheritdoc cref="CustomPhoneMenu.SetNameplateAppearance(IMenuEntry, LoadableAsset{Sprite}?, Color?, Color?)"/>
/// <param name="menuEntry"></param>
/// <param name="isSelected">Whether the menu entry is actively selected.</param>
[HideFromIl2Cpp]
protected void SetNameplateAppearance(IMenuEntry menuEntry, bool isSelected)
{
+26
View File
@@ -152,6 +152,14 @@ public abstract class CustomPhoneMenu(IntPtr il2CppPtr) : Minigame(il2CppPtr), I
}
#pragma warning restore CS0809 // Obsolete member overrides non-obsolete member
/// <summary>
/// Register new menu panels given a set of entries.
/// </summary>
/// <typeparam name="TEntry">The type of the entry.</typeparam>
/// <param name="entries">The entries to create panels for.</param>
/// <param name="entryPanelConfig">Function to configure the menu's panel once created, given its index and entry.</param>
/// <param name="menuEntryMaker">Function to create a <see cref="IMenuEntry"/> for a given panel and it's entry.
/// If <see langword="null"/>, it will create <see cref="BasicEntry"/>s, acting as wrappers for the <see cref="ShapeshifterPanel"/>s.</param>
protected void RegisterPanels<TEntry>(
IEnumerable<TEntry> entries,
Action<ShapeshifterPanel, int, TEntry> entryPanelConfig,
@@ -196,6 +204,12 @@ public abstract class CustomPhoneMenu(IntPtr il2CppPtr) : Minigame(il2CppPtr), I
}
}
/// <inheritdoc cref="RegisterPanels{TEntry}(IEnumerable{TEntry}, Action{ShapeshifterPanel, int, TEntry}, Func{ShapeshifterPanel, TEntry, IMenuEntry}?)"/>
/// <param name="entries"></param>
/// <param name="onEntryClick">Action to perform when a given entry is clicked on.
/// Argument will be <see langword="null"/> if the back button was clicked instead.</param>
/// <param name="entryPanelConfig">Function to configure the menu's panel once created, given its index, entry, and onClick action.</param>
/// <param name="menuEntryMaker"></param>
protected void RegisterPanels<TEntry>(
IEnumerable<TEntry> entries,
Action<TEntry?> onEntryClick,
@@ -205,8 +219,20 @@ public abstract class CustomPhoneMenu(IntPtr il2CppPtr) : Minigame(il2CppPtr), I
RegisterPanels(entries, (p, i, e) => entryPanelConfig(p, i, e, () => onEntryClick(e)), menuEntryMaker);
}
/// <summary>
/// Determines if a given entry is currently selected, not just hovered over.
/// </summary>
/// <param name="entry">The <see cref="IMenuEntry"/> to check.</param>
/// <returns><see langword="true"/> if the <paramref name="entry"/> is selected, else <see langword="false"/>.</returns>
protected virtual bool IsEntrySelected(IMenuEntry entry) => false;
/// <summary>
/// Set the icon, over color, and unselected color for a given entry.
/// </summary>
/// <param name="menuEntry">The menu entry.</param>
/// <param name="sprite">The <see cref="Sprite"/> to use as the icon, if any.</param>
/// <param name="overColor">The <see cref="Color"/> to use when hovering over an entry.</param>
/// <param name="unselectedColor">The <see cref="Color"/> to use when not hovering over an entry.</param>
[HideFromIl2Cpp]
protected static void SetNameplateAppearance(
IMenuEntry menuEntry, LoadableAsset<Sprite>? sprite, Color? overColor, Color? unselectedColor)
+1
View File
@@ -58,6 +58,7 @@ public class CustomPlayerMenu(IntPtr il2CppPtr) : CustomMultiSelectMenu<PlayerCo
potentialVictims = EntryPanels;
}
/// <inheritdoc/>
protected override void SetupPanelEntry(ShapeshifterPanel panel, int i, PlayerControl player, Action onClick)
{
var flag = PlayerControl.LocalPlayer.Data.Role.NameColor == player.Data.Role.NameColor;