Skip to content

Commit

Permalink
Preform code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelCoding25 committed Jan 16, 2024
1 parent ae5269d commit ec83af1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
26 changes: 13 additions & 13 deletions vMenu/MainMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ public MainMenu()
}
#endregion
#region keymapping
string KeyMappingID = String.IsNullOrWhiteSpace(GetSettingsString(Setting.vmenu_keymapping_id)) ? "Default" : GetSettingsString(Setting.vmenu_keymapping_id);
string KeyMappingID = String.IsNullOrWhiteSpace(GetSettingsString(Setting.vmenu_keymapping_id)) ? "Default" : GetSettingsString(Setting.vmenu_keymapping_id);
RegisterCommand($"vMenu:{KeyMappingID}:NoClip", new Action<dynamic, List<dynamic>, string>((dynamic source, List<dynamic> args, string rawCommand) =>
{
if ( IsAllowed(Permission.NoClip) )
if (IsAllowed(Permission.NoClip))
{
if (Game.PlayerPed.IsInVehicle())
{
Expand All @@ -146,17 +146,17 @@ public MainMenu()
}), false);
RegisterCommand($"vMenu:{KeyMappingID}:MenuToggle", new Action<dynamic, List<dynamic>, string>((dynamic source, List<dynamic> args, string rawCommand) =>
{
if (MenuEnabled)
{
if (!MenuController.IsAnyMenuOpen())
{
Menu.OpenMenu();
}
else
{
MenuController.CloseAllMenus();
}
}
if (MenuEnabled)
{
if (!MenuController.IsAnyMenuOpen())
{
Menu.OpenMenu();
}
else
{
MenuController.CloseAllMenus();
}
}
}), false);

if (!(GetSettingsString(Setting.vmenu_noclip_toggle_key) == null))
Expand Down
2 changes: 1 addition & 1 deletion vMenu/Noclip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private async Task NoClipHandler()

BeginScaleformMovieMethod(Scale, "SET_DATA_SLOT");
ScaleformMovieMethodAddParamInt(6);
string KeyMappingID = String.IsNullOrWhiteSpace(GetSettingsString(Setting.vmenu_keymapping_id)) ? "Default" : GetSettingsString(Setting.vmenu_keymapping_id);
string KeyMappingID = String.IsNullOrWhiteSpace(GetSettingsString(Setting.vmenu_keymapping_id)) ? "Default" : GetSettingsString(Setting.vmenu_keymapping_id);
PushScaleformMovieMethodParameterString($"~INPUT_{JOAAT($"vMenu:{KeyMappingID}:NoClip")}~");
PushScaleformMovieMethodParameterString($"Toggle NoClip");
EndScaleformMovieMethod();
Expand Down
8 changes: 4 additions & 4 deletions vMenu/menus/MpPedCustomization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public class MpPedCustomization
internal MenuItem editPedBtn = new("Edit Saved Character", "This allows you to edit everything about your saved character. The changes will be saved to this character's save file entry once you hit the save button.");

// Need to be editable from other functions
private readonly MenuListItem setCategoryBtn = new("Set Character Category", new List<string> {}, 0, "Sets this character's category. Select to save.");
private readonly MenuListItem categoryBtn = new("Character Category", new List<string> {}, 0, "Sets this character's category.");
private readonly MenuListItem setCategoryBtn = new("Set Character Category", new List<string> { }, 0, "Sets this character's category. Select to save.");
private readonly MenuListItem categoryBtn = new("Character Category", new List<string> { }, 0, "Sets this character's category.");

public static bool DontCloseMenus { get { return MenuController.PreventExitingMenu; } set { MenuController.PreventExitingMenu = value; } }
public static bool DisableBackButton { get { return MenuController.DisableBackButton; } set { MenuController.DisableBackButton = value; } }
Expand Down Expand Up @@ -2605,7 +2605,7 @@ string ChangeCallback(MenuDynamicListItem item, bool left)
}
}
}
}
}
Notify.Success($"Your saved category has been deleted. {updatedCount}/{totalCount} characters {(deletePeds ? "deleted" : "updated")}.");
MenuController.CloseAllMenus();
Expand Down Expand Up @@ -2737,7 +2737,7 @@ private List<string> GetAllCategoryNames()

private List<MenuItem.Icon> GetCategoryIcons(List<string> categoryNames)
{
List<MenuItem.Icon> icons = new List<MenuItem.Icon> {};
List<MenuItem.Icon> icons = new List<MenuItem.Icon> { };

foreach (var name in categoryNames)
{
Expand Down
6 changes: 3 additions & 3 deletions vMenu/menus/SavedVehicles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class SavedVehicles
private SavedVehicleCategory currentCategory;

// Need to be editable from other functions
private readonly MenuListItem setCategoryBtn = new("Set Vehicle Category", new List<string> {}, 0, "Sets this Vehicle's category. Select to save.");
private readonly MenuListItem setCategoryBtn = new("Set Vehicle Category", new List<string> { }, 0, "Sets this Vehicle's category. Select to save.");

/// <summary>
/// Creates the menu.
Expand Down Expand Up @@ -185,7 +185,7 @@ string ChangeCallback(MenuDynamicListItem item, bool left)
var spacer = GetSpacerMenuItem("↓ Vehicles ↓");
savedVehiclesCategoryMenu.AddMenuItem(spacer);
if (savedVehicles.Count > 0)
{
foreach (var kvp in savedVehicles)
Expand Down Expand Up @@ -901,7 +901,7 @@ private List<string> GetAllCategoryNames()

private List<MenuItem.Icon> GetCategoryIcons(List<string> categoryNames)
{
List<MenuItem.Icon> icons = new List<MenuItem.Icon> {};
List<MenuItem.Icon> icons = new List<MenuItem.Icon> { };

foreach (var name in categoryNames)
{
Expand Down
10 changes: 4 additions & 6 deletions vMenu/menus/VoiceChat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
using MenuAPI;

using static vMenuClient.CommonFunctions;

using static vMenuShared.PermissionsManager;

using static vMenuShared.ConfigManager;
using static vMenuShared.PermissionsManager;

namespace vMenuClient.menus
{
Expand Down Expand Up @@ -69,7 +67,7 @@ private void CreateMenu()
"2 km",
"Global",
};
var voiceChatProximity = new MenuItem("Voice Chat Proximity (" + ConvertToMetric(currentProximity) + ")" , "Set the voice chat receiving proximity in meters. Set to 0 for global.");
var voiceChatProximity = new MenuItem("Voice Chat Proximity (" + ConvertToMetric(currentProximity) + ")", "Set the voice chat receiving proximity in meters. Set to 0 for global.");
var voiceChatChannel = new MenuListItem("Voice Chat Channel", channels, channels.IndexOf(currentChannel), "Set the voice chat channel.");

if (IsAllowed(Permission.VCEnable))
Expand Down Expand Up @@ -121,7 +119,7 @@ private void CreateMenu()
{
currentProximity = resultfloat;
Subtitle.Custom($"New voice chat proximity set to: ~b~{ConvertToMetric(currentProximity)}~s~.");
voiceChatProximity.Text = ("Voice Chat Proximity (" + ConvertToMetric(currentProximity) + ")" );
voiceChatProximity.Text = ("Voice Chat Proximity (" + ConvertToMetric(currentProximity) + ")");
}
}
};
Expand All @@ -145,7 +143,7 @@ static string ConvertToMetric(float input)
val = (input / 1000) + "km";
}
}
if (input==0)
if (input == 0)
{
val = "global";
}
Expand Down

0 comments on commit ec83af1

Please sign in to comment.