底部时间栏组件更换

This commit is contained in:
OLDREDSTONE
2025-05-13 21:06:03 +08:00
parent b1d7b65218
commit 7cb34ca981
5 changed files with 224 additions and 264 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using CSharpToJsonSchema; using CSharpToJsonSchema;
using Ollama; using Ollama;
using RhythmBase.Components; using RhythmBase.RhythmDoctor.Components;
using System.ComponentModel; using System.ComponentModel;
namespace RDTKEditor.AIAssistant namespace RDTKEditor.AIAssistant
+3 -2
View File
@@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:skia="clr-namespace:SkiaSharp.Views.WPF;assembly=SkiaSharp.Views.WPF" xmlns:skia="clr-namespace:SkiaSharp.Views.WPF;assembly=SkiaSharp.Views.WPF"
xmlns:local="clr-namespace:RDTKEditor" xmlns:local="clr-namespace:RDTKEditor"
xmlns:rdtkwpf="clr-namespace:RhythmBase.Control.WPF;assembly=RhythmBase.Control.WPF"
mc:Ignorable="d" mc:Ignorable="d"
Title="RDTK Editor" Height="450" Width="800"> Title="RDTK Editor" Height="450" Width="800">
<Window.DataContext> <Window.DataContext>
@@ -108,8 +109,8 @@
<GridSplitter Grid.Row="1" Grid.ColumnSpan="5" Height="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> <GridSplitter Grid.Row="1" Grid.ColumnSpan="5" Height="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
<Border Grid.ColumnSpan="5" Grid.Row="2" Background="LightSalmon"> <Border Grid.ColumnSpan="5" Grid.Row="2" Background="LightSalmon">
<ScrollViewer x:Name="timelineScrollviewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" > <ScrollViewer x:Name="timelineScrollviewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
<Canvas x:Name="timelineCanvas" Background="LightGray" > <rdtkwpf:RDTimeLinePanel x:Name="timeLine">
</Canvas> </rdtkwpf:RDTimeLinePanel>
</ScrollViewer> </ScrollViewer>
</Border> </Border>
</Grid> </Grid>
+8 -58
View File
@@ -2,8 +2,8 @@
using Ollama; using Ollama;
using RDTKEditor.AIAssistant; using RDTKEditor.AIAssistant;
using RDTKEditor.Models; using RDTKEditor.Models;
using RhythmBase.Components; using RhythmBase.RhythmDoctor.Components;
using RhythmBase.Events; using RhythmBase.RhythmDoctor.Events;
using SkiaSharp; using SkiaSharp;
using SkiaSharp.Views.Desktop; using SkiaSharp.Views.Desktop;
using System.ComponentModel; using System.ComponentModel;
@@ -12,6 +12,7 @@ using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Shapes; using System.Windows.Shapes;
using RhythmBase.Control.WPF;
namespace RDTKEditor namespace RDTKEditor
{ {
@@ -28,30 +29,8 @@ namespace RDTKEditor
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
viewModel.Level = RDLevel.Default; timeLine.Level = RDLevel.Default;
viewModel.Level.Add(new Comment() { Beat = new RDBeat(1,2.33f) });
viewModel.Level.Add(new Comment() { Beat = new RDBeat(1,4f),Y=1 });
foreach (var item in viewModel.Level)
{
var time = item.Beat.BeatOnly;
Label label = new();
label.Content = time;
label.Background = new SolidColorBrush(Colors.Red);
if (time ==1)
{
label.Margin = new Thickness(0, 0, 0, 0);
}else
{
label.Margin = new Thickness(time*10, item.Y*30, 0, 0);
} }
timelineCanvas.Children.Add(label);
}
}
private void OpenFile(object sender, RoutedEventArgs e) private void OpenFile(object sender, RoutedEventArgs e)
{ {
OpenFileDialog openFileDialog = new() OpenFileDialog openFileDialog = new()
@@ -93,7 +72,7 @@ namespace RDTKEditor
} }
else else
{ {
}
} }
private RDTKProperty[] GetProperties(BaseEvent e) private RDTKProperty[] GetProperties(BaseEvent e)
{ {
@@ -170,7 +149,7 @@ namespace RDTKEditor
}; };
} }
private readonly List<BaseEvent> selectedEvents = new(); private readonly List<BaseEvent> selectedEvents = new();
internal void OnUpdateEventProperties(RDTKProperty[] properties) internal void OnUpdateEventProperties(BaseEvent baseEvent, RDTKProperty[] properties)
{ {
ItemProperties.Items.Clear(); ItemProperties.Items.Clear();
StackPanel[] panel = new StackPanel[properties.Length]; StackPanel[] panel = new StackPanel[properties.Length];
@@ -254,26 +233,6 @@ namespace RDTKEditor
}, },
}, },
_ => new() _ => new()
{
Orientation = Orientation.Horizontal,
Children =
{
new Label(){Content = property.Name},
new TextBox() { Text = property.Value, }
},
},
RDPropertyType.Color => new()
{
AllowDrop = true,
Orientation = Orientation.Horizontal,
FlowDirection = FlowDirection.LeftToRight,
Children =
{
new Label(){Content = property.Name},
new TextBox() { Text = property.Value, }
},
},
_ => new()
{ {
Orientation = Orientation.Horizontal, Orientation = Orientation.Horizontal,
Children = Children =
@@ -323,7 +282,8 @@ namespace RDTKEditor
{ {
if (_selectedEvents.Count == 0) if (_selectedEvents.Count == 0)
return; return;
else if (_selectedEvents.Count == 1){ else if (_selectedEvents.Count == 1)
{
var e = _selectedEvents[0]; var e = _selectedEvents[0];
foreach (var property in ItemProperties.Items) foreach (var property in ItemProperties.Items)
{ {
@@ -356,12 +316,6 @@ namespace RDTKEditor
} }
private void UpdateTimeLine() private void UpdateTimeLine()
{ {
Rectangle rectangle = new()
{
Width = 100,
Height = 100,
};
timelineCanvas.Children.Add(rectangle);
} }
/*private void mainUI_PaintSurface(object sender, SkiaSharp.Views.Desktop.SKPaintSurfaceEventArgs e) /*private void mainUI_PaintSurface(object sender, SkiaSharp.Views.Desktop.SKPaintSurfaceEventArgs e)
{ {
@@ -373,10 +327,6 @@ namespace RDTKEditor
Color = SKColors.Red, Color = SKColors.Red,
}); });
}*/ }*/
private void mainUI_PaintSurface(object sender, SKPaintSurfaceEventArgs e) private void mainUI_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
{ {
var sfc = e.Surface; var sfc = e.Surface;
+1 -1
View File
@@ -1,4 +1,4 @@
using RhythmBase.Components; using RhythmBase.RhythmDoctor.Components;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
namespace RDTKEditor.Models namespace RDTKEditor.Models
+11 -2
View File
@@ -10,12 +10,21 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Ollama" Version="1.15.1-dev.12" /> <PackageReference Include="Ollama" Version="1.15.1-dev.13" />
<PackageReference Include="RhythmBase" Version="1.1.0-beta2" /> <PackageReference Include="RhythmBase" Version="1.2.0-beta1" />
<PackageReference Include="SkiaSharp.Views.WPF" Version="3.119.0-preview.1.2" /> <PackageReference Include="SkiaSharp.Views.WPF" Version="3.119.0-preview.1.2" />
<PackageReference Include="sly" Version="3.7.3" /> <PackageReference Include="sly" Version="3.7.3" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Reference Include="RhythmBase.Control.Core">
<HintPath>..\RhythmBase.Control.WPF\bin\Debug\net8.0-windows\RhythmBase.Control.Core.dll</HintPath>
</Reference>
<Reference Include="RhythmBase.Control.WPF">
<HintPath>..\RhythmBase.Control.WPF\bin\Debug\net8.0-windows\RhythmBase.Control.WPF.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<Using Include="System.IO" /> <Using Include="System.IO" />
</ItemGroup> </ItemGroup>