chartinfo tweaks, add ID

This commit is contained in:
Alex
2025-08-19 20:01:43 -07:00
parent 2e5fc7191f
commit 12a13b4194
3 changed files with 24 additions and 12 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ public partial class ChartInfo : UserControl
{
private static readonly IReadOnlyDictionary<Difficulty, (Color, Color)> COLORS = new Dictionary<Difficulty, (Color, Color)>(){
{Difficulty.Normal, (new Color(0xff, 0x1b, 0x7c, 0xff), new Color(0xff, 0x3f, 0x66, 0xfa))},
{Difficulty.Hard, (new Color(0xff, 0xFF, 0xC3, 0x00), new Color(0xff, 0xFF, 0xA0, 0x00))},
{Difficulty.Hard, (new Color(0xff, 0xF2, 0xB5, 0x00), new Color(0xff, 0xFF, 0xA0, 0x00))},
{Difficulty.Expert, (new Color(0xff, 0xFF, 0x00, 0x84), new Color(0xff, 0xCF, 0x00, 0x5B))},
{Difficulty.Inferno, (new Color(0xff, 0x40, 0x00, 0x43), new Color(0xff, 0x1F, 0x00, 0x20))}
};
+3 -2
View File
@@ -19,11 +19,12 @@
<TabItem Header="Info" FontSize="16">
<StackPanel Name="SelectionInfo">
<TextBlock Name="InfoId" FontFamily="monospace" Text="S00-000" HorizontalAlignment="Center"/>
<Image Name="InfoImageJacket" Margin="24 0 24 0" Source="/Assets/imgs/jacket-placeholder.png"/>
<TextBlock Name="InfoNameText" Text="Name" FontWeight="Bold" HorizontalAlignment="Center" Margin="0 10 0 0"/>
<TextBlock Name="InfoArtistText" Text="Artist" HorizontalAlignment="Center"/>
<TextBlock Name="InfoSourceText" Text="Source" HorizontalAlignment="Center"/>
<StackPanel Name="ChartInfoGroup" Margin="0 36 0 0">
<TextBlock Name="InfoSourceText" Text="Source" HorizontalAlignment="Center" Margin="0 6 0 0"/>
<StackPanel Name="ChartInfoGroup" Margin="0 20 0 0">
</StackPanel>
</StackPanel>
</TabItem>
+20 -9
View File
@@ -1,16 +1,13 @@
using Microsoft.VisualBasic;
using System;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Threading.Tasks;
using System.Linq;
using Avalonia.Controls;
using MercuryConverter.Data;
using Avalonia;
using Avalonia.Threading;
using Avalonia.Media;
using System.IO;
using Avalonia.Media.Imaging;
using SaturnData.Notation.Core;
using System.Collections.Generic;
using UAssetAPI.UnrealTypes.EngineEnums;
namespace MercuryConverter.UI.Views;
@@ -20,6 +17,7 @@ public partial class Selection : Panel
{
InitializeComponent();
ListingTable.CellPointerPressed += OnCellClicked;
ListingTable.SelectionChanged += OnSelectionChange;
ListingTable.SelectionMode = DataGridSelectionMode.Extended;
foreach (var (k, v) in Consts.NUM_SOURCE)
@@ -47,13 +45,25 @@ public partial class Selection : Panel
}
}
/// <summary>
/// Table cell right click handler.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnCellClicked(object? sender, DataGridCellPointerPressedEventArgs e)
{
Console.WriteLine($"{e.PointerPressedEventArgs.KeyModifiers} - {e.Cell}");
var cell = e.Cell;
var tb = (TextBlock)cell.Content!;
if (e.Row.DataContext is Song song)
Console.WriteLine($"{e.PointerPressedEventArgs.Properties.IsRightButtonPressed} - {e.Cell.Content}");
}
private void OnSelectionChange(object sender, SelectionChangedEventArgs e)
{
Console.WriteLine($"{song.Id}: {song.Artist} - {song.Name}");
if (e.AddedItems.Count > 0)
{
var song = (Song) e.AddedItems[e.AddedItems.Count-1]!;
Dispatcher.UIThread.Post(() =>
{
if (song.Jacket != null)
@@ -61,6 +71,7 @@ public partial class Selection : Panel
var file = File.OpenRead(song.Jacket);
InfoImageJacket.Source = new Bitmap(file);
}
InfoId.Text = song.Id;
InfoNameText.Text = song.Name;
InfoArtistText.Text = song.Artist;
InfoSourceText.Text = song.SourceName;