-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
335 additions
and
139 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
TheArchive.Core/Core/Attributes/Feature/ModInlineUncategorizedSettingsIntoMainMenu.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
using System; | ||
|
||
namespace TheArchive.Core.Attributes | ||
{ | ||
[AttributeUsage(AttributeTargets.Assembly)] | ||
public class ModInlineUncategorizedSettingsIntoMainMenu : Attribute | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,62 @@ | ||
namespace TheArchive.Core.FeaturesAPI | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace TheArchive.Core.FeaturesAPI | ||
{ | ||
public static class FeatureGroups | ||
{ | ||
public static string Accessibility => "Accessibility"; | ||
public static string Special => "Misc"; | ||
public static string Dev => "Developer"; | ||
public static string Backport => "Backport"; | ||
public static string QualityOfLife => "Quality of Life"; | ||
public static string LocalProgression => "Local Progression"; | ||
public static Group Get(string name) => Group.Get(name); | ||
|
||
public class Group | ||
{ | ||
private static readonly HashSet<Group> _allGroups = new HashSet<Group>(); | ||
|
||
public static Group Get(string name) | ||
{ | ||
return _allGroups.FirstOrDefault(g => g.Name == name); | ||
} | ||
|
||
public string Name { get; private set; } | ||
public bool InlineSettings { get; internal set; } | ||
public bool IsNewlyCreated { get; private set; } = true; | ||
|
||
public static Group GetOrCreate(string name, Action<Group> groupModification = null) | ||
{ | ||
var group = _allGroups.FirstOrDefault(g => g.Name == name); | ||
|
||
if (group != null) | ||
group.IsNewlyCreated = false; | ||
|
||
group ??= new Group(name); | ||
|
||
groupModification?.Invoke(group); | ||
|
||
return group; | ||
} | ||
|
||
private Group(string name) | ||
{ | ||
Name = name; | ||
|
||
_allGroups.Add(this); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return Name; | ||
} | ||
|
||
public static implicit operator string(Group g) => g.Name; | ||
} | ||
|
||
public static Group Accessibility { get; private set; } = Group.GetOrCreate("Accessibility"); | ||
public static Group Fixes { get; private set; } = Group.GetOrCreate("Fixes"); | ||
public static Group Hud { get; private set; } = Group.GetOrCreate("HUD / UI"); | ||
public static Group Special { get; private set; } = Group.GetOrCreate("Misc"); | ||
public static Group Dev { get; private set; } = Group.GetOrCreate("Developer"); | ||
public static Group Backport { get; private set; } = Group.GetOrCreate("Backport"); | ||
public static Group QualityOfLife { get; private set; } = Group.GetOrCreate("Quality of Life"); | ||
public static Group LocalProgression { get; private set; } = Group.GetOrCreate("Local Progression"); // , group => group.InlineSettings = true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.