mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
Add sprites for settings in wiki
This commit is contained in:
1 parent
cac15bf07f
commit
c1978bbb88
3 files changed
+36
-3
No files matched your search
@@ -3,8 +3,10 @@ using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Il2CppInterop.Runtime.Attributes;
|
||||
using MiraAPI.Modifiers;
|
||||
using MiraAPI.Roles;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI.GameOptions;
|
||||
@@ -26,6 +28,12 @@ public abstract class AbstractOptionGroup
|
||||
/// </summary>
|
||||
public abstract string GroupName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite of the group that is displayed in the match info guide.
|
||||
/// </summary>
|
||||
[HideFromIl2Cpp]
|
||||
public virtual LoadableAsset<Sprite> Sprite => MiraAssets.IconSettings;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Optionable type of the group.
|
||||
/// </summary>
|
||||
@@ -52,7 +60,12 @@ public abstract class AbstractOptionGroup
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this group's options are shown in the Match Info Guide.
|
||||
/// </summary>
|
||||
public virtual bool ShowInMatchInfoGuide => true;
|
||||
public virtual bool ShowInMatchInfoGuide => ParentMenu is MenuCategory.Game;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the name title of the group when it is in the match info guide.
|
||||
/// </summary>
|
||||
public virtual string RoleGuideTitle => GroupName;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the group <see cref="Color"/>. This is used to color the group in the options menu.
|
||||
|
||||
@@ -1544,7 +1544,7 @@ public static class RoleGuidePatches
|
||||
break;
|
||||
case SettingsTabIndex:
|
||||
_titleText.text = GetSettingsTitle();
|
||||
_titleIcon.sprite = MiraAssets.IconSettings.LoadAsset();
|
||||
_titleIcon.sprite = GetSettingsIcon();
|
||||
break;
|
||||
case RolesTabIndex:
|
||||
_titleText.text = MiraLocaleManager.Get("Roles");
|
||||
@@ -2103,11 +2103,27 @@ public static class RoleGuidePatches
|
||||
: $"{pageTitle} Settings {counter}";
|
||||
}
|
||||
|
||||
private static Sprite GetSettingsIcon()
|
||||
{
|
||||
if (!_uiInitialized || _settingsSearching || _settingsPage == 0 || _settingsPages.Count == 0)
|
||||
{
|
||||
return MiraAssets.IconSettings;
|
||||
}
|
||||
|
||||
return _settingsPages[_settingsPage - 1].Sprite;
|
||||
}
|
||||
|
||||
private static void UpdateSettingsTitle()
|
||||
{
|
||||
if (_titleText && IsSettingsTabActive)
|
||||
{
|
||||
_titleText.text = GetSettingsTitle();
|
||||
if (_titleIcon)
|
||||
{
|
||||
_titleIcon.sprite = GetSettingsIcon();
|
||||
|
||||
_titleIcon.SetSizeLimit(0.55f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,9 @@ using MiraAPI.GameOptions;
|
||||
using MiraAPI.GameOptions.OptionTypes;
|
||||
using MiraAPI.PluginLoading;
|
||||
using MiraAPI.Translation;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using Reactor.Utilities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI.Utilities;
|
||||
|
||||
@@ -22,7 +24,9 @@ internal sealed class GuideOptionPage(AbstractOptionGroup group, string modAbbre
|
||||
{
|
||||
public AbstractOptionGroup Group { get; } = group;
|
||||
|
||||
public string Title { get; } = group.GroupName.Translate();
|
||||
public string Title { get; } = group.RoleGuideTitle;
|
||||
|
||||
public LoadableAsset<Sprite> Sprite { get; } = group.Sprite;
|
||||
|
||||
public string ModAbbreviation { get; } = modAbbreviation;
|
||||
|
||||
|
||||
Reference in new issue
Block a user