diff --git a/AIAssistant/Model.cs b/AIAssistant/Model.cs index 65bef72..205ae39 100644 --- a/AIAssistant/Model.cs +++ b/AIAssistant/Model.cs @@ -5,7 +5,7 @@ using System.Text; using System.Threading.Tasks; using CSharpToJsonSchema; using Ollama; -using RhythmBase.Components; +using RhythmBase.RhythmDoctor.Components; using System.ComponentModel; namespace RDTKEditor.AIAssistant diff --git a/MainWindow.xaml b/MainWindow.xaml index 5d0df3a..905050e 100644 --- a/MainWindow.xaml +++ b/MainWindow.xaml @@ -5,113 +5,114 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:skia="clr-namespace:SkiaSharp.Views.WPF;assembly=SkiaSharp.Views.WPF" xmlns:local="clr-namespace:RDTKEditor" + xmlns:rdtkwpf="clr-namespace:RhythmBase.Control.WPF;assembly=RhythmBase.Control.WPF" mc:Ignorable="d" Title="RDTK Editor" Height="450" Width="800"> - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - AI问答 - - - - - - - - - - - - - - + + AI问答 + + + + + + + + + + + + + + diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs index dd74a5c..a2d7324 100644 --- a/MainWindow.xaml.cs +++ b/MainWindow.xaml.cs @@ -2,8 +2,8 @@ using Ollama; using RDTKEditor.AIAssistant; using RDTKEditor.Models; -using RhythmBase.Components; -using RhythmBase.Events; +using RhythmBase.RhythmDoctor.Components; +using RhythmBase.RhythmDoctor.Events; using SkiaSharp; using SkiaSharp.Views.Desktop; using System.ComponentModel; @@ -12,6 +12,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Shapes; +using RhythmBase.Control.WPF; namespace RDTKEditor { @@ -28,30 +29,8 @@ namespace RDTKEditor public MainWindow() { InitializeComponent(); - viewModel.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); - } - - - } - - + timeLine.Level = RDLevel.Default; + } private void OpenFile(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new() @@ -93,7 +72,7 @@ namespace RDTKEditor } else { - + } } private RDTKProperty[] GetProperties(BaseEvent e) { @@ -170,7 +149,7 @@ namespace RDTKEditor }; } private readonly List selectedEvents = new(); - internal void OnUpdateEventProperties(RDTKProperty[] properties) + internal void OnUpdateEventProperties(BaseEvent baseEvent, RDTKProperty[] properties) { ItemProperties.Items.Clear(); StackPanel[] panel = new StackPanel[properties.Length]; @@ -180,26 +159,26 @@ namespace RDTKEditor } else { - foreach (var property in properties) - { - StackPanel stackPanel = property.Type switch + foreach (var property in properties) { - RDPropertyType.Bool => new() + StackPanel stackPanel = property.Type switch { - Orientation = Orientation.Horizontal, - FlowDirection = FlowDirection.LeftToRight, - Children = + RDPropertyType.Bool => new() + { + Orientation = Orientation.Horizontal, + FlowDirection = FlowDirection.LeftToRight, + Children = { new Label(){Content = property.Name}, new CheckBox() { IsChecked = bool.Parse( property.Value), } }, - }, - RDPropertyType.Enum => new() - { - AllowDrop = true, - Orientation = Orientation.Horizontal, - FlowDirection = FlowDirection.LeftToRight, - Children = + }, + RDPropertyType.Enum => new() + { + AllowDrop = true, + Orientation = Orientation.Horizontal, + FlowDirection = FlowDirection.LeftToRight, + Children = { new Label(){Content = property.Name}, new ComboBox() @@ -208,114 +187,94 @@ namespace RDTKEditor SelectedValue = property.Value, } }, - }, - RDPropertyType.String => new() - { - AllowDrop = true, - Orientation = Orientation.Horizontal, - FlowDirection = FlowDirection.LeftToRight, - Children = + }, + RDPropertyType.String => new() + { + AllowDrop = true, + Orientation = Orientation.Horizontal, + FlowDirection = FlowDirection.LeftToRight, + Children = { new Label(){Content = property.Name}, new TextBox() { Text = property.Value, } }, - }, - RDPropertyType.Integer => new() - { - AllowDrop = true, - Orientation = Orientation.Horizontal, - FlowDirection = FlowDirection.LeftToRight, - Children = + }, + RDPropertyType.Integer => new() + { + AllowDrop = true, + Orientation = Orientation.Horizontal, + FlowDirection = FlowDirection.LeftToRight, + Children = { new Label(){Content = property.Name}, new TextBox() { Text = property.Value, } }, - }, - RDPropertyType.Float => new() - { - AllowDrop = true, - Orientation = Orientation.Horizontal, - FlowDirection = FlowDirection.LeftToRight, - Children = + }, + RDPropertyType.Float => new() + { + AllowDrop = true, + Orientation = Orientation.Horizontal, + FlowDirection = FlowDirection.LeftToRight, + Children = { new Label(){Content = property.Name}, new TextBox() { Text = property.Value, } }, - }, - RDPropertyType.Color => new() - { - AllowDrop = true, - Orientation = Orientation.Horizontal, - FlowDirection = FlowDirection.LeftToRight, - Children = + }, + 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, - 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, - Children = + }, + _ => new() + { + Orientation = Orientation.Horizontal, + Children = { new Label(){Content = property.Name}, new Label(){Content = property.Value} } - }, - }; - foreach (var child in stackPanel.Children) - { - switch (child) + }, + }; + foreach (var child in stackPanel.Children) { - case CheckBox checkBox: - checkBox.Checked += (sender, e) => - { - property.OnChanged("true"); - }; - checkBox.Unchecked += (sender, e) => - { - property.OnChanged("false"); - }; - break; - case TextBox textBox: - textBox.TextChanged += (sender, e) => - { - property.OnChanged(textBox.Text); - }; - break; - case ComboBox comboBox: - comboBox.SelectionChanged += (sender, e) => - { - property.OnChanged(comboBox.SelectedValue); - }; - break; - default: - break; + switch (child) + { + case CheckBox checkBox: + checkBox.Checked += (sender, e) => + { + property.OnChanged("true"); + }; + checkBox.Unchecked += (sender, e) => + { + property.OnChanged("false"); + }; + break; + case TextBox textBox: + textBox.TextChanged += (sender, e) => + { + property.OnChanged(textBox.Text); + }; + break; + case ComboBox comboBox: + comboBox.SelectionChanged += (sender, e) => + { + property.OnChanged(comboBox.SelectedValue); + }; + break; + default: + break; + } } + ItemProperties.Items.Add(stackPanel); + property.PropertyChanged += (e, s) => UpdateEvent(); } - ItemProperties.Items.Add(stackPanel); - property.PropertyChanged += (e, s) => UpdateEvent(); - } } } @@ -323,7 +282,8 @@ namespace RDTKEditor { if (_selectedEvents.Count == 0) return; - else if (_selectedEvents.Count == 1){ + else if (_selectedEvents.Count == 1) + { var e = _selectedEvents[0]; foreach (var property in ItemProperties.Items) { @@ -356,12 +316,6 @@ namespace RDTKEditor } 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) { @@ -373,11 +327,7 @@ namespace RDTKEditor Color = SKColors.Red, }); }*/ - - - - - private void mainUI_PaintSurface(object sender, SKPaintSurfaceEventArgs e) + private void mainUI_PaintSurface(object sender, SKPaintSurfaceEventArgs e) { var sfc = e.Surface; var cvs = sfc.Canvas; @@ -406,11 +356,11 @@ namespace RDTKEditor IsStroke = true, }); } - private void CheckBox_Checked(object sender, RoutedEventArgs e) - { + private void CheckBox_Checked(object sender, RoutedEventArgs e) + { MessageBox.Show("已确认"); - } - + } + private async void AIAssistantButton_Click(object sender, RoutedEventArgs e) { string input = AIAssistantText.Text; @@ -422,21 +372,21 @@ namespace RDTKEditor } - public class MainViewModel : INotifyPropertyChanged + public class MainViewModel : INotifyPropertyChanged { public event PropertyChangedEventHandler? PropertyChanged; - private bool _isButtonEnabled = true; - public bool IsButtonEnabled - { - get => _isButtonEnabled; - set - { - _isButtonEnabled = value; - - } - } + private bool _isButtonEnabled = true; + public bool IsButtonEnabled + { + get => _isButtonEnabled; + set + { + _isButtonEnabled = value; - } + } + } + + } diff --git a/Models/RDTKView.cs b/Models/RDTKView.cs index 6898146..70a3c2a 100644 --- a/Models/RDTKView.cs +++ b/Models/RDTKView.cs @@ -1,4 +1,4 @@ -using RhythmBase.Components; +using RhythmBase.RhythmDoctor.Components; using System.Diagnostics.CodeAnalysis; namespace RDTKEditor.Models diff --git a/RDTKEditor.csproj b/RDTKEditor.csproj index f76e346..4d2c923 100644 --- a/RDTKEditor.csproj +++ b/RDTKEditor.csproj @@ -10,12 +10,21 @@ - - + + + + + ..\RhythmBase.Control.WPF\bin\Debug\net8.0-windows\RhythmBase.Control.Core.dll + + + ..\RhythmBase.Control.WPF\bin\Debug\net8.0-windows\RhythmBase.Control.WPF.dll + + +