Archived
forked from RDTKEditor/RDTKEditor
Merge pull request 'master' (#6) from Koquem/RDTKEditor:master into master
Reviewed-on: obugs/RDTKEditor#6
This commit is contained in:
@@ -12,10 +12,10 @@ namespace RDTKEditor.AIAssistant
|
||||
{
|
||||
public class Assistant
|
||||
{
|
||||
public const string Deepseek = "deepseek-r1:8b";
|
||||
public const string Deepseek = "deepseek-r1:14b";
|
||||
public const string Smollm = "smollm2:135m";
|
||||
public const string Qwen_0_5 = "qwen2.5-coder:0.5b";
|
||||
public const string Qwen_3 = "qwen2.5-coder:3b";
|
||||
public const string Qwen_3 = "qwen2.5-coder:7b";
|
||||
public OllamaApiClient Ollama { get; } = new(baseUri: new Uri("http://127.0.0.1:11434/api"));
|
||||
public Chat Chat { get; }
|
||||
public Assistant(string modelName)
|
||||
|
||||
+107
-65
@@ -7,69 +7,111 @@
|
||||
xmlns:local="clr-namespace:RDTKEditor"
|
||||
mc:Ignorable="d"
|
||||
Title="RDTK Editor" Height="450" Width="800">
|
||||
<Window.DataContext>
|
||||
<local:MainViewModel/>
|
||||
</Window.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Menu Grid.Row="0" VerticalAlignment="Top">
|
||||
<MenuItem Header="文件(_F)">
|
||||
<MenuItem Header="打开文件(_O)" Click="OpenFile" InputGestureText="Ctrl+O"/>
|
||||
<MenuItem Header="保存文件(_S)" Click="SaveFile" InputGestureText="Ctrl+S"/>
|
||||
<Separator/>
|
||||
<MenuItem Header="退出(_E)" Click="Exit"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="帮助(_H)">
|
||||
<MenuItem Header="关于(_A)" Click="About"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" MinWidth="100" MaxWidth="300" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="200" MinWidth="100" MaxWidth="300" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="5" />
|
||||
<RowDefinition Height="100" MinHeight="90" MaxHeight="270"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.Column="0" Background="LightBlue">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl x:Name="ItemProperties" Background="LightGray">
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
<GridSplitter Grid.Column="1" Width="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
<Viewbox Grid.Row="0" Grid.Column="2" Stretch="Uniform">
|
||||
<Border Background="LightGray" Width="1600" Height="900">
|
||||
<skia:SKElement x:Name="mainUI" PaintSurface="mainUI_PaintSurface" />
|
||||
</Border>
|
||||
</Viewbox>
|
||||
<GridSplitter Grid.Column="3" Width="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
<Border Grid.Column="4" Background="LightBlue" >
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<Grid Background="LightGray">
|
||||
<TextBox x:Name="AIAssistantText" HorizontalAlignment="Left" VerticalAlignment="Top">
|
||||
传给 AI 的文本
|
||||
</TextBox>
|
||||
<Button x:Name="AIAssistantButton" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,30,0,0" Click="AIAssistantButton_Click" >
|
||||
测试
|
||||
</Button>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
<GridSplitter Grid.Row="1" Grid.ColumnSpan="5" Height="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
<Border Grid.ColumnSpan="5" Grid.Row="2" Background="LightSalmon">
|
||||
<ScrollViewer x:Name="timelineViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||
<Canvas x:Name="timelineCanvas" Background="LightGray" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Window.DataContext>
|
||||
<local:MainViewModel/>
|
||||
</Window.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Menu Grid.Row="0" VerticalAlignment="Top">
|
||||
<MenuItem Header="文件(_F)">
|
||||
<MenuItem Header="打开文件(_O)" Click="OpenFile" InputGestureText="Ctrl+O"/>
|
||||
<MenuItem Header="保存文件(_S)" Click="SaveFile" InputGestureText="Ctrl+S"/>
|
||||
<Separator/>
|
||||
<MenuItem Header="退出(_E)" Click="Exit"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="帮助(_H)">
|
||||
<MenuItem Header="关于(_A)" Click="About"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" MinWidth="100" MaxWidth="300" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="200" MinWidth="100" MaxWidth="300" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="5" />
|
||||
<RowDefinition Height="100" MinHeight="90" MaxHeight="270"/>
|
||||
</Grid.RowDefinitions>
|
||||
<Border Grid.Column="0" Background="LightBlue">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<ItemsControl x:Name="ItemProperties" Background="LightGray">
|
||||
<ComboBox Grid.Row="0" BorderBrush="#FFDF4444" Foreground="#FFC65E5E" RenderTransformOrigin="0.5,0.5">
|
||||
<ComboBox.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform/>
|
||||
<SkewTransform/>
|
||||
<RotateTransform Angle="-0.383"/>
|
||||
<TranslateTransform/>
|
||||
</TransformGroup>
|
||||
</ComboBox.RenderTransform>
|
||||
<ComboBox.Background>
|
||||
<LinearGradientBrush EndPoint="0,1">
|
||||
<GradientStop Color="#FFF0F0F0"/>
|
||||
<GradientStop Color="#FF963333" Offset="1"/>
|
||||
</LinearGradientBrush>
|
||||
</ComboBox.Background>
|
||||
<ComboBoxItem Content="选项 1" />
|
||||
<ComboBoxItem Content="选项 2" />
|
||||
</ComboBox>
|
||||
<Label Grid.Row="1" Content="Label" RenderTransformOrigin="0.5,0.5">
|
||||
<Label.RenderTransform>
|
||||
<TransformGroup>
|
||||
<ScaleTransform/>
|
||||
<SkewTransform/>
|
||||
<RotateTransform Angle="0.017"/>
|
||||
<TranslateTransform/>
|
||||
</TransformGroup>
|
||||
</Label.RenderTransform>
|
||||
</Label>
|
||||
<ListView Grid.Row="3" d:ItemsSource="{d:SampleData ItemCount=3}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn/>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
<GridSplitter Grid.Column="1" Width="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
<Viewbox Grid.Row="0" Grid.Column="2" Stretch="Uniform">
|
||||
<Border Background="LightGray" Width="1600" Height="900">
|
||||
<skia:SKElement x:Name="mainUI" PaintSurface="mainUI_PaintSurface" />
|
||||
</Border>
|
||||
</Viewbox>
|
||||
<GridSplitter Grid.Column="3" Width="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
<Border Grid.Column="4" Background="LightBlue" >
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||
<Grid x:Name="timelineCanvas3" Background="LightGray" >
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="20" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBox Grid.Row="0" x:Name="AIAssistantText" TextWrapping="Wrap" >
|
||||
AI问答
|
||||
</TextBox>
|
||||
<Button Grid.Row="1" x:Name="AIButton" VerticalAlignment="Bottom" Click="AIAssistantButton_Click" IsEnabled="{Binding IsButtonEnabled}" >
|
||||
点击按钮开发
|
||||
</Button>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
<GridSplitter Grid.Row="1" Grid.ColumnSpan="5" Height="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||
<Border Grid.ColumnSpan="5" Grid.Row="2" Background="LightSalmon">
|
||||
<ScrollViewer x:Name="timelineScrollviewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" >
|
||||
<Canvas x:Name="timelineCanvas" Background="LightGray" >
|
||||
</Canvas>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
+57
-34
@@ -2,6 +2,7 @@
|
||||
using Ollama;
|
||||
using RDTKEditor.AIAssistant;
|
||||
using RDTKEditor.Models;
|
||||
using RhythmBase.Components;
|
||||
using RhythmBase.Events;
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.Views.Desktop;
|
||||
@@ -9,6 +10,7 @@ using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace RDTKEditor
|
||||
@@ -24,7 +26,30 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void OpenFile(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenFileDialog openFileDialog = new()
|
||||
@@ -57,33 +82,6 @@ namespace RDTKEditor
|
||||
{
|
||||
OnUpdateEventProperties(GetProperties(new MoveRow()));
|
||||
|
||||
//OnUpdateEventProperties([
|
||||
// new(){
|
||||
// Verifier = new RDTKPropertyVerifierDefault(),
|
||||
// Name = "Name",
|
||||
// Value = "RDTK Editor",
|
||||
// Type = RDPropertyType.String,
|
||||
// },
|
||||
// new(){
|
||||
// Verifier = new RDTKPropertyVerifierDefault(),
|
||||
// Name = "Version",
|
||||
// Value = "1.0.0",
|
||||
// Type = RDPropertyType.String,
|
||||
// },
|
||||
// new(){
|
||||
// Verifier = new RDTKPropertyVerifierEnum(typeof(EventType)),
|
||||
// Name = "Description",
|
||||
// Value = "RDTK Editor 是一个简单的节奏医生关卡编辑器。",
|
||||
// Type = RDPropertyType.Enum,
|
||||
// },
|
||||
// new(){
|
||||
// Verifier = new RDTKPropertyVerifierBool(),
|
||||
// Name = "测试值",
|
||||
// Value = "true",
|
||||
// Type = RDPropertyType.Bool,
|
||||
// }
|
||||
// ]);
|
||||
//MessageBox.Show("RDTK Editor 是一个简单的节奏医生关卡编辑器。", "关于 RDTK Editor");
|
||||
}
|
||||
private RDTKProperty[] GetProperties(BaseEvent e)
|
||||
{
|
||||
@@ -135,7 +133,8 @@ namespace RDTKEditor
|
||||
Type = RDPropertyType.String,
|
||||
};
|
||||
}
|
||||
internal void OnUpdateEventProperties(RDTKProperty[] properties)
|
||||
private readonly List<BaseEvent> selectedEvents = new();
|
||||
internal void OnUpdateEventProperties(RDTKProperty[] properties)
|
||||
{
|
||||
ItemProperties.Items.Clear();
|
||||
foreach (var property in properties)
|
||||
@@ -255,13 +254,16 @@ namespace RDTKEditor
|
||||
});
|
||||
}*/
|
||||
|
||||
private void mainUI_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
|
||||
|
||||
|
||||
|
||||
private void mainUI_PaintSurface(object sender, SKPaintSurfaceEventArgs e)
|
||||
{
|
||||
var sfc = e.Surface;
|
||||
var cvs = sfc.Canvas;
|
||||
var info = e.Info;
|
||||
cvs.Clear(SKColors.Black);
|
||||
SKPoint scale = new(info.Width / _vsScale.Width, info.Height / _vsScale.Height);
|
||||
SKPoint scale = new((float)info.Width / _vsScale.Width, (float)info.Height / _vsScale.Height);
|
||||
cvs.Save();
|
||||
cvs.Scale(scale);
|
||||
Draw(cvs);
|
||||
@@ -284,7 +286,11 @@ namespace RDTKEditor
|
||||
IsStroke = true,
|
||||
});
|
||||
}
|
||||
|
||||
private void CheckBox_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("已确认");
|
||||
}
|
||||
|
||||
private async void AIAssistantButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
string input = AIAssistantText.Text;
|
||||
@@ -294,8 +300,25 @@ namespace RDTKEditor
|
||||
AIAssistantText.Text = responce.Content;
|
||||
}
|
||||
}
|
||||
public class MainViewModel : INotifyPropertyChanged
|
||||
|
||||
|
||||
public class MainViewModel : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
}
|
||||
private bool _isButtonEnabled = true;
|
||||
public bool IsButtonEnabled
|
||||
{
|
||||
get => _isButtonEnabled;
|
||||
set
|
||||
{
|
||||
_isButtonEnabled = value;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
+1
-1
@@ -91,7 +91,7 @@ namespace RDTKEditor.Models
|
||||
internal class RDTKView
|
||||
{
|
||||
|
||||
private RDLevel? Level { get; set; }
|
||||
public RDLevel? Level { get; set; }
|
||||
public RDTKView()
|
||||
{
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user