Skip to content

Commit

Permalink
chore: code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
xhayper committed Aug 23, 2024
1 parent 57c25eb commit 25ff050
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
7 changes: 4 additions & 3 deletions COTL_API/CustomInventory/Patches/CustomInventoryPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,10 @@ private static void InventoryItem_AllBurnableFuel(ref List<InventoryItem.ITEM_TY
private static void CookingData_GetAllFoods(ref InventoryItem.ITEM_TYPE[] __result)
{
var copy = __result;
__result = __result
.Concat(CustomItemList.Where(i => !copy.Contains(i.Key) && i.Value.IsFood).Select(i => i.Key))
.ToArray();
__result =
[
.. __result, .. CustomItemList.Where(i => !copy.Contains(i.Key) && i.Value.IsFood).Select(i => i.Key)
];
}


Expand Down
2 changes: 1 addition & 1 deletion COTL_API/CustomLocalization/CustomLocalizationPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private static bool GameSettings_OnLanguageChanged(GameSettings __instance, int
private static bool GameSettings_GetLanguageIndex(GameSettings __instance, ref int __result)
{
__instance._languageSelector._prefilledContent =
__instance._languageSelector._prefilledContent.AddRange(LocalizationMap.Keys.ToArray());
__instance._languageSelector._prefilledContent.AddRange([.. LocalizationMap.Keys]);
__instance._languageSelector.UpdateContent(__instance._languageSelector._prefilledContent);
if (!LanguageList.Contains(SettingsManager.Settings.Game.Language)) return true;
__result = LanguageUtilities.AllLanguages.Length + LanguageList.IndexOf(SettingsManager.Settings.Game.Language);
Expand Down
3 changes: 1 addition & 2 deletions COTL_API/Helpers/PluginPaths.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ internal static class PluginPaths
{
internal static string ResolvePath(params string[] paths)
{
return Path.Combine(new List<string> { Plugin.Instance != null ? Plugin.Instance.PluginPath : "" }.Concat(paths)
.ToArray());
return Path.Combine([Plugin.Instance != null ? Plugin.Instance.PluginPath : "", .. paths]);
}

internal static string ResolveAssetPath(params string[] paths)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static void Postfix(

__instance.Hide();
____commandHistory.Push(item.CommandItem.Command);
__instance.OnItemChosen?.Invoke(____commandHistory.ToArray());
__instance.OnItemChosen?.Invoke([.. ____commandHistory]);
}
}
}
8 changes: 6 additions & 2 deletions COTL_API/UI/UIManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ private static void UISettingsMenuController_OnShowStarted(UISettingsMenuControl
originalGraphicsSettings.OnShow -= showDelegate;
originalGraphicsSettings.OnHide -= hideDelegate;

__instance.transform.GetComponentInChildren<SettingsTabNavigatorBase>()._tabs = __instance.transform
.GetComponentInChildren<SettingsTabNavigatorBase>()._tabs.Append(tab).ToArray();
__instance.transform.GetComponentInChildren<SettingsTabNavigatorBase>()._tabs =
[
.. __instance.transform
.GetComponentInChildren<SettingsTabNavigatorBase>()._tabs,
tab
];
var button = newSettings.GetComponentInChildren<MMButton>();
button.onClick.RemoveAllListeners();
button.onClick.AddListener(() => stnb.TransitionTo(tab));
Expand Down

0 comments on commit 25ff050

Please sign in to comment.