mirror of
https://github.com/D1GQ/BetterAmongUs.git
synced 2026-10-19 15:51:52 +00:00
clean up
This commit is contained in:
1 parent
86460b85a4
commit
121b4b33d5
8 files changed
+22
-45
No files matched your search
@@ -1,5 +1,4 @@
|
||||
using BetterAmongUs.Attributes;
|
||||
using BetterAmongUs.Enums;
|
||||
using BetterAmongUs.Patches.Gameplay.UI.Chat;
|
||||
|
||||
namespace BetterAmongUs.Commands;
|
||||
@@ -12,7 +11,7 @@ internal sealed class AllCommandsCommand : BaseCommand
|
||||
|
||||
internal override void Run()
|
||||
{
|
||||
BaseCommand[] allNormalCommands = [.. allCommands.Where(cmd => cmd.Type == CommandType.Normal && cmd.ShowCommand())];
|
||||
BaseCommand[] allNormalCommands = [.. allCommands.Where(cmd => cmd.IsEnabled())];
|
||||
string list;
|
||||
var open = "<color=#858585>┌──────── </color>";
|
||||
var mid = "<color=#858585>├ </color>";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using BetterAmongUs.Attributes;
|
||||
using BetterAmongUs.Commands.Arguments;
|
||||
using BetterAmongUs.Enums;
|
||||
using BetterAmongUs.Helpers;
|
||||
using BetterAmongUs.Modules.Support;
|
||||
|
||||
namespace BetterAmongUs.Commands;
|
||||
|
||||
@@ -15,11 +15,6 @@ internal abstract class BaseCommand
|
||||
/// </summary>
|
||||
internal static readonly BaseCommand[] allCommands = [.. RegisterCommandAttribute.Instances];
|
||||
|
||||
/// <summary>
|
||||
/// Gets the type of the command.
|
||||
/// </summary>
|
||||
internal virtual CommandType Type => CommandType.Normal;
|
||||
|
||||
/// <summary>
|
||||
/// Gets all names for this command (including short names).
|
||||
/// </summary>
|
||||
@@ -107,4 +102,13 @@ internal abstract class BaseCommand
|
||||
if (!onlyGetStr) Utils.AddChatPrivate($"<color=#730000>{er}\n{error}");
|
||||
return $"<color=#730000>{er}\n{error}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether this command is enabled.
|
||||
/// </summary>
|
||||
/// <returns>True if the command is enabled; otherwise, false.</returns>
|
||||
internal bool IsEnabled()
|
||||
{
|
||||
return ShowCommand() && !BAUModdedSupportFlags.HasFlag(BAUModdedSupportFlags.Disable_Command + Name);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
namespace BetterAmongUs.Enums;
|
||||
|
||||
/// <summary>
|
||||
/// Defines the types of commands available in the BetterAmongUs system.
|
||||
/// </summary>
|
||||
internal enum CommandType
|
||||
{
|
||||
/// <summary>
|
||||
/// Standard command type.
|
||||
/// </summary>
|
||||
Normal,
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace BetterAmongUs.Interfaces;
|
||||
namespace BetterAmongUs.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Interface for replay events in BetterAmongUs.
|
||||
@@ -10,7 +8,6 @@ public interface IReplayEvent
|
||||
/// <summary>
|
||||
/// Gets the unique identifier for the replay event.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
string Id { get; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -15,7 +15,9 @@ namespace BetterAmongUs.Managers;
|
||||
/// </summary>
|
||||
internal sealed class BAUUpdateManager : MonoBehaviour
|
||||
{
|
||||
private bool AmUpdateing;
|
||||
private bool _updateing;
|
||||
private GameObject? mainMenu;
|
||||
private GameObject? ambience;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the singleton instance of the UpdateManager.
|
||||
@@ -68,7 +70,7 @@ internal sealed class BAUUpdateManager : MonoBehaviour
|
||||
button.OnClick = new();
|
||||
button.OnClick.AddListener(() =>
|
||||
{
|
||||
if (AmUpdateing || WaitForRestart)
|
||||
if (_updateing || WaitForRestart)
|
||||
return;
|
||||
|
||||
this.StartCoroutine(CoPressDownload(doNotPress));
|
||||
@@ -87,9 +89,6 @@ internal sealed class BAUUpdateManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unity Start method called when the component is initialized.
|
||||
/// </summary>
|
||||
private void Start()
|
||||
{
|
||||
var oldDll = Assembly.GetExecutingAssembly().Location + ".old";
|
||||
@@ -99,9 +98,6 @@ internal sealed class BAUUpdateManager : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
private GameObject? mainMenu;
|
||||
private GameObject? ambience;
|
||||
|
||||
/// <summary>
|
||||
/// Coroutine that handles the download process when the update button is pressed.
|
||||
/// </summary>
|
||||
@@ -110,7 +106,7 @@ internal sealed class BAUUpdateManager : MonoBehaviour
|
||||
[HideFromIl2Cpp]
|
||||
private IEnumerator CoPressDownload(DoNotPressButton button)
|
||||
{
|
||||
AmUpdateing = true;
|
||||
_updateing = true;
|
||||
|
||||
button.pressedSprite.enabled = true;
|
||||
button.unpressedSprite.enabled = false;
|
||||
@@ -145,6 +141,6 @@ internal sealed class BAUUpdateManager : MonoBehaviour
|
||||
Utils.ShowPopUp("Download link missing!");
|
||||
}
|
||||
|
||||
AmUpdateing = false;
|
||||
_updateing = false;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ internal static class CustomLoadingBarManager
|
||||
/// <summary>
|
||||
/// Gets the current loading bar instance.
|
||||
/// </summary>
|
||||
internal static AmongUsLoadingBar? LoadingBar => LoadingBarManager.Instance?.loadingBar;
|
||||
internal static AmongUsLoadingBar? LoadingBar => LoadingBarManager.InstanceExists ? LoadingBarManager.Instance.loadingBar : null;
|
||||
|
||||
/// <summary>
|
||||
/// Toggles the loading bar visibility.
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using BetterAmongUs.Commands;
|
||||
using BetterAmongUs.Data.Config;
|
||||
using BetterAmongUs.Enums;
|
||||
using BetterAmongUs.Helpers;
|
||||
using BetterAmongUs.Modules;
|
||||
using BetterAmongUs.Modules.Support;
|
||||
@@ -270,7 +269,7 @@ internal static class ChatCommandsPatch
|
||||
{
|
||||
// First try exact match
|
||||
var directNormalMatch = BaseCommand.allCommands
|
||||
.FirstOrDefault(c => FilterCommand(c, CommandType.Normal) &&
|
||||
.FirstOrDefault(c => c.IsEnabled() &&
|
||||
c.Names.Any(name => string.Equals(name, typedCommand, StringComparison.OrdinalIgnoreCase)));
|
||||
if (directNormalMatch != null)
|
||||
return directNormalMatch;
|
||||
@@ -278,17 +277,11 @@ internal static class ChatCommandsPatch
|
||||
// Then try partial match
|
||||
var closestNormalCommand = BaseCommand.allCommands
|
||||
.OrderBy(c => c.Name)
|
||||
.FirstOrDefault(c => FilterCommand(c, CommandType.Normal) &&
|
||||
.FirstOrDefault(c => c.IsEnabled() &&
|
||||
c.Names.Any(name => name.StartsWith(typedCommand, StringComparison.OrdinalIgnoreCase)));
|
||||
if (closestNormalCommand != null)
|
||||
return closestNormalCommand;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool FilterCommand(BaseCommand command, CommandType commandType)
|
||||
{
|
||||
// Check if command is enabled and not disabled by other mods
|
||||
return command.Type == commandType && command.ShowCommand() && !BAUModdedSupportFlags.HasFlag(BAUModdedSupportFlags.Disable_Command + command.Name);
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ internal sealed class UserInfo(string playerName, string hashPuid, string friend
|
||||
return (true, Reason);
|
||||
}
|
||||
|
||||
return (false, "");
|
||||
return (false, string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in new issue
Block a user