Skip to content

Multi-Mode Game Profile Sorting & Custom Reordering (Recently Played, Date Created, Alphabetical, Free/Custom) #388

Description

@undead2146

[Feature] Multi-Mode Game Profile Sorting & Custom Reordering (Recently Played, Date Created, Alphabetical, Free/Custom)

1. Problem Statement & Context

In GameProfileLauncherView.axaml and GameProfileLauncherViewModel.cs:

  • Profiles are loaded from disk via Directory.GetFiles() and appended to ObservableCollection<GameProfileItemViewModel> Profiles in non-deterministic filesystem order.
  • GameProfile.cs contains a LastPlayedAt timestamp property (line 73), but it is never updated when a profile is launched via ProfileLauncherFacade.cs.
  • There is no mechanism or UI selector to sort or manually reorder profiles.

2. User Stories & Use Cases

  • UC-1 (Recently Played / Time): As an active player, I want my most recently launched profile displayed first so I can immediately jump back into my current mod without searching.
  • UC-2 (Date Created / Date): As a mod tester, I want to sort by creation date to find new profiles I recently created.
  • UC-3 (Alphabetical / Name): As a player with 15+ profiles, I want to sort them alphabetically (A–Z / Z–A) for predictable visual scanning.
  • UC-4 (Free / Custom Order): As a user with specific favorite mods, I want to freely arrange my profiles in a custom order using drag-and-drop or Move Up/Down buttons.

3. Proposed Enums & Data Model Updates

namespace GenHub.Core.Models.Enums;

public enum ProfileSortMode
{
    LastPlayed = 0,       // Time (most recently launched first)
    DateCreated = 1,      // Date (newest created first)
    Alphabetical = 2,     // Name A to Z
    AlphabeticalDesc = 3, // Name Z to A
    Free = 4              // Custom manual order (DisplayOrder property)
}

Model Extensions

  • GameProfile.cs:
    public int DisplayOrder { get; set; } = 0;
  • UserSettings.cs:
    public ProfileSortMode ProfileSortMode { get; set; } = ProfileSortMode.LastPlayed;

4. Active Launch Tracking in ProfileLauncherFacade.cs

In ProfileLauncherFacade.cs (LaunchProfileAsync):

// Record last played timestamp upon successful launch
profile.LastPlayedAt = DateTime.UtcNow;
await profileManager.UpdateProfileAsync(profile, cancellationToken);

5. UI/UX Wireframe (GameProfileLauncherView.axaml)

+------------------------------------------------------------------------------------+
| GAME PROFILES                      Sort by: [ 🕒 Recently Played  ▼ ]  [ + SCAN ]  |
+------------------------------------------------------------------------------------+
|  +-----------------+  +-----------------+  +-----------------+  +---------------+  |
|  | Generals Online |  | ShockWave Chaos |  | Reborn Omega    |  | [ + ]         |  |
|  | 60Hz Client     |  | Mod v1.2        |  | 1.04 Patch      |  | Add New       |  |
|  | Played 10m ago  |  | Played Yesterday|  | Played 3 days ago|  | Profile       |  |
|  | [  LAUNCH  ]    |  | [  LAUNCH  ]    |  | [  LAUNCH  ]    |  |               |  |
|  +-----------------+  +-----------------+  +-----------------+  +---------------+  |
+------------------------------------------------------------------------------------+

6. Acceptance Criteria

  • ProfileSortMode enum added with LastPlayed, DateCreated, Alphabetical, AlphabeticalDesc, and Free.
  • ProfileLauncherFacade.LaunchProfileAsync updates LastPlayedAt timestamp and persists it.
  • GameProfileItemViewModel exposes LastPlayedAt, CreatedAt, and DisplayOrder.
  • Sort ComboBox in GameProfileLauncherView.axaml updates the active sorting mode and persists selection to UserSettings.
  • In Free mode, users can adjust DisplayOrder using card hover controls (◀ / ▶) or drag-and-drop.
  • "Add Profile" card remains pinned as the final item in the collection regardless of the active sort mode.
  • Unit tests in GameProfileLauncherViewModelTests verify collection reordering for all 4 sort modes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions