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)>(){ 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.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.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))} {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"> <TabItem Header="Info" FontSize="16">
<StackPanel Name="SelectionInfo"> <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"/> <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="InfoNameText" Text="Name" FontWeight="Bold" HorizontalAlignment="Center" Margin="0 10 0 0"/>
<TextBlock Name="InfoArtistText" Text="Artist" HorizontalAlignment="Center"/> <TextBlock Name="InfoArtistText" Text="Artist" HorizontalAlignment="Center"/>
<TextBlock Name="InfoSourceText" Text="Source" HorizontalAlignment="Center"/> <TextBlock Name="InfoSourceText" Text="Source" HorizontalAlignment="Center" Margin="0 6 0 0"/>
<StackPanel Name="ChartInfoGroup" Margin="0 36 0 0"> <StackPanel Name="ChartInfoGroup" Margin="0 20 0 0">
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>
</TabItem> </TabItem>
+20 -9
View File
@@ -1,16 +1,13 @@
using Microsoft.VisualBasic;
using System; using System;
using System.Collections.ObjectModel; using System.Linq;
using System.Collections.Specialized;
using System.Threading.Tasks;
using Avalonia.Controls; using Avalonia.Controls;
using MercuryConverter.Data; using MercuryConverter.Data;
using Avalonia;
using Avalonia.Threading; using Avalonia.Threading;
using Avalonia.Media;
using System.IO; using System.IO;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using SaturnData.Notation.Core; using SaturnData.Notation.Core;
using System.Collections.Generic;
using UAssetAPI.UnrealTypes.EngineEnums;
namespace MercuryConverter.UI.Views; namespace MercuryConverter.UI.Views;
@@ -20,6 +17,7 @@ public partial class Selection : Panel
{ {
InitializeComponent(); InitializeComponent();
ListingTable.CellPointerPressed += OnCellClicked; ListingTable.CellPointerPressed += OnCellClicked;
ListingTable.SelectionChanged += OnSelectionChange;
ListingTable.SelectionMode = DataGridSelectionMode.Extended; ListingTable.SelectionMode = DataGridSelectionMode.Extended;
foreach (var (k, v) in Consts.NUM_SOURCE) 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) 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)
{
if (e.AddedItems.Count > 0)
{ {
Console.WriteLine($"{song.Id}: {song.Artist} - {song.Name}"); var song = (Song) e.AddedItems[e.AddedItems.Count-1]!;
Dispatcher.UIThread.Post(() => Dispatcher.UIThread.Post(() =>
{ {
if (song.Jacket != null) if (song.Jacket != null)
@@ -61,6 +71,7 @@ public partial class Selection : Panel
var file = File.OpenRead(song.Jacket); var file = File.OpenRead(song.Jacket);
InfoImageJacket.Source = new Bitmap(file); InfoImageJacket.Source = new Bitmap(file);
} }
InfoId.Text = song.Id;
InfoNameText.Text = song.Name; InfoNameText.Text = song.Name;
InfoArtistText.Text = song.Artist; InfoArtistText.Text = song.Artist;
InfoSourceText.Text = song.SourceName; InfoSourceText.Text = song.SourceName;