Merge pull request #1340 from LostDragonist/gallery_alpha

Minor improvements to the gallery
This commit is contained in:
Timothy Baldridge 2021-02-27 03:58:05 -07:00 committed by GitHub
commit 5f53ecaab9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 16 deletions

View File

@ -36,14 +36,21 @@ namespace Wabbajack.Common
[Description("Darkest Dungeon")]
DarkestDungeon,
Dishonored,
[Description("Witcher 3")]
Witcher3,
[Description("Stardew Valley")]
StardewValley,
[Description("Kingdom Come: Deliverance")]
KingdomComeDeliverance,
[Description("MechWarrior 5: Mercenaries")]
MechWarrior5Mercenaries,
[Description("No Man's Sky")]
NoMansSky,
[Description("Dragon Age: Origins")]
DragonAgeOrigins,
[Description("Dragon Age 2")]
DragonAge2,
[Description("Dragon Age: Inquisition")]
DragonAgeInquisition,
[Description("Kerbal Space Program")]
KerbalSpaceProgram,

View File

@ -34,10 +34,10 @@ namespace Wabbajack.Lib.ModListRegistry
[JsonProperty("nsfw")]
public bool NSFW { get; set; }
[JsonProperty("utility_list")]
public bool UtilityList { get; set; }
[JsonProperty("image_contains_title")]
public bool ImageContainsTitle { get; set; }
@ -50,13 +50,13 @@ namespace Wabbajack.Lib.ModListRegistry
[JsonProperty("download_metadata")]
public DownloadMetadata? DownloadMetadata { get; set; }
[JsonIgnore]
[JsonIgnore]
public ModListSummary ValidationSummary { get; set; } = new ModListSummary();
[JsonName("Links")]
public class LinksObject
{
[JsonProperty("image")]
[JsonProperty("image")]
public string ImageUri { get; set; } = string.Empty;
[JsonProperty("readme")]
@ -92,7 +92,13 @@ namespace Wabbajack.Lib.ModListRegistry
// ignored
}
return metadata.OrderBy(m => (m.ValidationSummary?.HasFailures ?? false ? 1 : 0, m.Title)).ToList();
var random = new Random();
return metadata
// Sort randomly initially, just to give each list a fair shake
.Shuffle(random)
// Put broken lists at bottom
.OrderBy(m => (m.ValidationSummary?.HasFailures ?? false ? 1 : 0))
.ToList();
}
public static async Task<List<ModlistMetadata>> LoadUnlistedFromGithub()
@ -109,7 +115,7 @@ namespace Wabbajack.Lib.ModListRegistry
}
}
public async ValueTask<bool> NeedsDownload(AbsolutePath modlistPath)
{
if (!modlistPath.Exists) return true;
@ -150,7 +156,7 @@ namespace Wabbajack.Lib.ModListRegistry
public int Passed { get; set; }
[JsonProperty("updating")]
public int Updating { get; set; }
[JsonProperty("mirrored")]
public int Mirrored { get; set; }

View File

@ -37,7 +37,7 @@ namespace Wabbajack
[Reactive]
public bool ShowNSFW { get; set; }
[Reactive]
public bool ShowUtilityLists { get; set; }
@ -95,7 +95,6 @@ namespace Wabbajack
})
.DisposeWith(CompositeDisposable);
var random = new Random();
var sourceList = Observable.Return(Unit.Default)
.ObserveOn(RxApp.TaskpoolScheduler)
.SelectTask(async _ =>
@ -106,8 +105,6 @@ namespace Wabbajack
var list = await ModlistMetadata.LoadFromGithub();
Error = ErrorResponse.Success;
return list
// Sort randomly initially, just to give each list a fair shake
.Shuffle(random)
.AsObservableChangeSet(x => x.DownloadMetadata?.Hash ?? Hash.Empty);
}
catch (Exception ex)
@ -170,8 +167,6 @@ namespace Wabbajack
return GameType == vm.Metadata.Game.GetDescription<Game>().ToString();
}))
// Put broken lists at bottom
.Sort(Comparer<ModListMetadataVM>.Create((a, b) => a.IsBroken.CompareTo(b.IsBroken)))
.Bind(ModLists)
.Subscribe()
.DisposeWith(CompositeDisposable);
@ -197,6 +192,7 @@ namespace Wabbajack
{
List<string> gameEntries = new List<string> { ALL_GAME_TYPE };
gameEntries.AddRange(EnumExtensions.GetAllItems<Game>().Select(gameType => gameType.GetDescription<Game>()));
gameEntries.Sort();
return gameEntries;
}

View File

@ -93,7 +93,7 @@
VerticalAlignment="Center"
Content="Game" />
<ComboBox
Width="130"
Width="150"
Margin="0,0,10,0"
VerticalAlignment="Center"
Foreground="{StaticResource ForegroundBrush}"
@ -116,14 +116,14 @@
VerticalAlignment="Center"
Content="Show NSFW"
Foreground="{StaticResource ForegroundBrush}" />
<CheckBox
x:Name="ShowUtilityLists"
Margin="10,0,10,0"
VerticalAlignment="Center"
Content="Show Utility Lists"
Foreground="{StaticResource ForegroundBrush}" />
<CheckBox
x:Name="OnlyInstalledCheckbox"
Margin="10,0,10,0"