-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into docs-070
- Loading branch information
Showing
15 changed files
with
385 additions
and
71 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
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
17 changes: 17 additions & 0 deletions
17
src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderItemDesignModel.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,17 @@ | ||
using System.Reactive; | ||
using NexusMods.Abstractions.Games; | ||
using NexusMods.App.UI.Controls; | ||
using ReactiveUI; | ||
|
||
namespace NexusMods.App.UI.Pages.Sorting; | ||
|
||
public class LoadOrderItemDesignModel : TreeDataGridItemModel<ILoadOrderItemModel, Guid>, ILoadOrderItemModel | ||
{ | ||
public ReactiveCommand<Unit, Unit> MoveUp { get; } = ReactiveCommand.Create(() => { }); | ||
public ReactiveCommand<Unit, Unit> MoveDown { get; } = ReactiveCommand.Create(() => { }); | ||
public int SortIndex { get; set; } | ||
public string DisplayName { get; set; } = "Display Name"; | ||
public string ModName { get; set; } = "Mod Name"; | ||
public bool IsActive { get; set; } | ||
public Guid Guid { get; set; } | ||
} |
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
76 changes: 76 additions & 0 deletions
76
src/NexusMods.App.UI/Pages/Sorting/LoadOrder/LoadOrderViewDesignViewModel.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,76 @@ | ||
using System.Collections.ObjectModel; | ||
using System.ComponentModel; | ||
using System.Diagnostics; | ||
using System.Reactive; | ||
using System.Reactive.Disposables; | ||
using Avalonia.Controls.Models.TreeDataGrid; | ||
using DynamicData; | ||
using DynamicData.Binding; | ||
using NexusMods.Abstractions.UI; | ||
using NexusMods.App.UI.Controls; | ||
using ReactiveUI; | ||
|
||
namespace NexusMods.App.UI.Pages.Sorting; | ||
|
||
public class LoadOrderDesignViewModel : AViewModel<ILoadOrderViewModel>, ILoadOrderViewModel | ||
{ | ||
public TreeDataGridAdapter<ILoadOrderItemModel, Guid> Adapter { get; set; } | ||
public string SortOrderName { get; set; } = "Sort Order Name"; | ||
public string InfoAlertTitle { get; set;} = "Info Alert Title"; | ||
public string InfoAlertHeading { get; set;} = "Info Alert Heading"; | ||
public string InfoAlertMessage { get; set;} = "Info Alert Message"; | ||
public bool InfoAlertIsVisible { get; set; } = true; | ||
public ReactiveCommand<Unit, Unit> InfoAlertCommand { get; } = ReactiveCommand.Create(() => { Console.WriteLine("InfoAlertCommand"); }); | ||
public string TrophyToolTip { get; set;} = "Trophy Tool Tip"; | ||
public ListSortDirection SortDirectionCurrent { get; set; } | ||
public bool IsWinnerTop { get; set;} | ||
public string EmptyStateMessageTitle { get; } = "Empty State Message Title"; | ||
public string EmptyStateMessageContents { get; } = "Empty State Message Contents"; | ||
|
||
public LoadOrderDesignViewModel() | ||
{ | ||
Adapter = new LoadOrderTreeDataGridDesignAdapter(); | ||
|
||
this.WhenActivated(d => | ||
{ | ||
Adapter.Activate(); | ||
Disposable.Create(() => Adapter.Deactivate()) | ||
.DisposeWith(d); | ||
} | ||
); | ||
} | ||
} | ||
|
||
|
||
// adapter used for design view, based on the actual adapter LoadOrderViewModel.LoadOrderTreeDataGridAdapter | ||
public class LoadOrderTreeDataGridDesignAdapter : TreeDataGridAdapter<ILoadOrderItemModel, Guid> | ||
{ | ||
protected override IObservable<IChangeSet<ILoadOrderItemModel, Guid>> GetRootsObservable(bool viewHierarchical) | ||
{ | ||
var items = new ObservableCollection<ILoadOrderItemModel>([ | ||
new LoadOrderItemDesignModel() { DisplayName = "Item 1", Guid = Guid.NewGuid(), SortIndex = 0 }, | ||
new LoadOrderItemDesignModel() { DisplayName = "Item 2", Guid = Guid.NewGuid(), SortIndex = 1 }, | ||
] | ||
); | ||
|
||
return items.ToObservableChangeSet(item => ((LoadOrderItemDesignModel)item).Guid); | ||
} | ||
|
||
protected override IColumn<ILoadOrderItemModel>[] CreateColumns(bool viewHierarchical) | ||
{ | ||
return | ||
[ | ||
// TODO: Use <see cref="ColumnCreator"/> to create the columns using interfaces | ||
new HierarchicalExpanderColumn<ILoadOrderItemModel>( | ||
inner: LoadOrderTreeDataGridAdapter.CreateIndexColumn("Index"), | ||
childSelector: static model => model.Children, | ||
hasChildrenSelector: static model => model.HasChildren.Value, | ||
isExpandedSelector: static model => model.IsExpanded | ||
) | ||
{ | ||
Tag = "expander", | ||
}, | ||
LoadOrderTreeDataGridAdapter.CreateNameColumn("Name"), | ||
]; | ||
} | ||
} |
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
24 changes: 24 additions & 0 deletions
24
src/NexusMods.App.UI/Pages/Sorting/SortingSelection/SortingSelectionDesignViewModel.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,24 @@ | ||
using System.Collections.ObjectModel; | ||
using NexusMods.Abstractions.UI; | ||
|
||
namespace NexusMods.App.UI.Pages.Sorting; | ||
|
||
public class SortingSelectionDesignViewModel : AViewModel<ISortingSelectionViewModel>, ISortingSelectionViewModel | ||
{ | ||
public ReadOnlyObservableCollection<ILoadOrderViewModel> LoadOrderViewModels { get; } | ||
|
||
public SortingSelectionDesignViewModel() | ||
{ | ||
var loadOrderViewModels = new ObservableCollection<ILoadOrderViewModel> | ||
{ | ||
new LoadOrderDesignViewModel { SortOrderName = "Load order (RedMOD)", | ||
InfoAlertHeading = "Load Order for REDmod files in Cyberpunk 2077 - First Loaded Wins", | ||
InfoAlertMessage = "Some Cyberpunk 2077 mods use REDmod files to alter core gameplay elements. If two REDmod files modify the same part of the game, the one loaded first will take priority and overwrite changes from those loaded later.\n\nFor example, the 1st position overwrites the 2nd, the 2nd overwrites the 3rd, and so on." | ||
}, | ||
new LoadOrderDesignViewModel { SortOrderName = "Load Order (Archive XL)" }, | ||
new LoadOrderDesignViewModel { SortOrderName = "File Overwrites" } | ||
}; | ||
|
||
LoadOrderViewModels = new ReadOnlyObservableCollection<ILoadOrderViewModel>(loadOrderViewModels); | ||
} | ||
} |
Oops, something went wrong.