-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1760 from Nexus-Mods/feat/multiple-loadouts-part2
Multiple loadouts part2
- Loading branch information
Showing
8 changed files
with
337 additions
and
103 deletions.
There are no files selected for viewing
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
25 changes: 25 additions & 0 deletions
25
src/NexusMods.App.UI/Controls/LoadoutCard/ILoadoutCardViewModel.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 |
---|---|---|
@@ -1,6 +1,31 @@ | ||
using System.Reactive; | ||
using Avalonia.Media; | ||
using NexusMods.App.UI.Controls.LoadoutBadge; | ||
using ReactiveUI; | ||
|
||
namespace NexusMods.App.UI.Controls.LoadoutCard; | ||
|
||
public interface ILoadoutCardViewModel : IViewModelInterface | ||
{ | ||
ILoadoutBadgeViewModel LoadoutBadgeViewModel { get; } | ||
|
||
string LoadoutName { get; } | ||
|
||
IImage LoadoutImage { get; } | ||
|
||
bool IsLoadoutApplied { get; } | ||
|
||
string HumanizedLoadoutLastApplyTime { get; } | ||
|
||
string HumanizedLoadoutCreationTime { get; } | ||
|
||
string LoadoutModCount { get; } | ||
|
||
bool IsDeleting { get; } | ||
|
||
ReactiveCommand<Unit, Unit> VisitLoadoutCommand { get; } | ||
|
||
ReactiveCommand<Unit, Unit> CloneLoadoutCommand { get; } | ||
|
||
ReactiveCommand<Unit, Unit> DeleteLoadoutCommand { get; } | ||
} |
42 changes: 42 additions & 0 deletions
42
src/NexusMods.App.UI/Controls/LoadoutCard/LoadoutCardDesignViewModel.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,42 @@ | ||
using System.Reactive; | ||
using System.Reactive.Disposables; | ||
using System.Reactive.Linq; | ||
using Avalonia.Media; | ||
using Avalonia.Media.Imaging; | ||
using Avalonia.Platform; | ||
using NexusMods.App.UI.Controls.LoadoutBadge; | ||
using ReactiveUI; | ||
using ReactiveUI.Fody.Helpers; | ||
|
||
namespace NexusMods.App.UI.Controls.LoadoutCard; | ||
|
||
public class LoadoutCardDesignViewModel : AViewModel<ILoadoutCardViewModel>, ILoadoutCardViewModel | ||
{ | ||
public LoadoutCardDesignViewModel() | ||
{ | ||
this.WhenActivated(d => | ||
{ | ||
// Cycle thorough all the states for preview purposes | ||
Observable.Interval(TimeSpan.FromSeconds(2.5)) | ||
.Subscribe(_ => | ||
{ | ||
IsDeleting = !IsDeleting; | ||
}) | ||
.DisposeWith(d); | ||
} | ||
); | ||
} | ||
|
||
public ILoadoutBadgeViewModel LoadoutBadgeViewModel { get; } = new LoadoutBadgeDesignViewModel(); | ||
public string LoadoutName { get; } = "Loadout B"; | ||
public IImage LoadoutImage { get; } = new Bitmap(AssetLoader.Open(new Uri("avares://NexusMods.App.UI/Assets/DesignTime/cyberpunk_game.png"))); | ||
|
||
public bool IsLoadoutApplied { get; } = true; | ||
public string HumanizedLoadoutLastApplyTime { get; } = "Last applied 2 months ago"; | ||
public string HumanizedLoadoutCreationTime { get; } = "Created 10 months ago"; | ||
public string LoadoutModCount { get; } = "Mods 276"; | ||
[Reactive] public bool IsDeleting { get; private set; } = true; | ||
public ReactiveCommand<Unit, Unit> VisitLoadoutCommand { get; } = ReactiveCommand.Create(() => { }); | ||
public ReactiveCommand<Unit, Unit> CloneLoadoutCommand { get; } = ReactiveCommand.Create(() => { }); | ||
public ReactiveCommand<Unit, Unit> DeleteLoadoutCommand { get; } = ReactiveCommand.Create(() => { }); | ||
} |
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
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
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.