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 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 Smollm = "smollm2:135m";
|
||||||
public const string Qwen_0_5 = "qwen2.5-coder:0.5b";
|
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 OllamaApiClient Ollama { get; } = new(baseUri: new Uri("http://127.0.0.1:11434/api"));
|
||||||
public Chat Chat { get; }
|
public Chat Chat { get; }
|
||||||
public Assistant(string modelName)
|
public Assistant(string modelName)
|
||||||
|
|||||||
+107
-65
@@ -7,69 +7,111 @@
|
|||||||
xmlns:local="clr-namespace:RDTKEditor"
|
xmlns:local="clr-namespace:RDTKEditor"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="RDTK Editor" Height="450" Width="800">
|
Title="RDTK Editor" Height="450" Width="800">
|
||||||
<Window.DataContext>
|
<Window.DataContext>
|
||||||
<local:MainViewModel/>
|
<local:MainViewModel/>
|
||||||
</Window.DataContext>
|
</Window.DataContext>
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Menu Grid.Row="0" VerticalAlignment="Top">
|
|
||||||
<MenuItem Header="文件(_F)">
|
<Menu Grid.Row="0" VerticalAlignment="Top">
|
||||||
<MenuItem Header="打开文件(_O)" Click="OpenFile" InputGestureText="Ctrl+O"/>
|
<MenuItem Header="文件(_F)">
|
||||||
<MenuItem Header="保存文件(_S)" Click="SaveFile" InputGestureText="Ctrl+S"/>
|
<MenuItem Header="打开文件(_O)" Click="OpenFile" InputGestureText="Ctrl+O"/>
|
||||||
<Separator/>
|
<MenuItem Header="保存文件(_S)" Click="SaveFile" InputGestureText="Ctrl+S"/>
|
||||||
<MenuItem Header="退出(_E)" Click="Exit"/>
|
<Separator/>
|
||||||
</MenuItem>
|
<MenuItem Header="退出(_E)" Click="Exit"/>
|
||||||
<MenuItem Header="帮助(_H)">
|
</MenuItem>
|
||||||
<MenuItem Header="关于(_A)" Click="About"/>
|
<MenuItem Header="帮助(_H)">
|
||||||
</MenuItem>
|
<MenuItem Header="关于(_A)" Click="About"/>
|
||||||
</Menu>
|
</MenuItem>
|
||||||
<Grid Grid.Row="1">
|
</Menu>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid Grid.Row="1">
|
||||||
<ColumnDefinition Width="200" MinWidth="100" MaxWidth="300" />
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="5" />
|
<ColumnDefinition Width="200" MinWidth="100" MaxWidth="300" />
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="5" />
|
||||||
<ColumnDefinition Width="5" />
|
<ColumnDefinition Width="*"/>
|
||||||
<ColumnDefinition Width="200" MinWidth="100" MaxWidth="300" />
|
<ColumnDefinition Width="5" />
|
||||||
</Grid.ColumnDefinitions>
|
<ColumnDefinition Width="200" MinWidth="100" MaxWidth="300" />
|
||||||
<Grid.RowDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<RowDefinition Height="*"/>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="5" />
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="100" MinHeight="90" MaxHeight="270"/>
|
<RowDefinition Height="5" />
|
||||||
</Grid.RowDefinitions>
|
<RowDefinition Height="100" MinHeight="90" MaxHeight="270"/>
|
||||||
<Border Grid.Column="0" Background="LightBlue">
|
</Grid.RowDefinitions>
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
<Border Grid.Column="0" Background="LightBlue">
|
||||||
<ItemsControl x:Name="ItemProperties" Background="LightGray">
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
||||||
</ItemsControl>
|
<ItemsControl x:Name="ItemProperties" Background="LightGray">
|
||||||
</ScrollViewer>
|
<ComboBox Grid.Row="0" BorderBrush="#FFDF4444" Foreground="#FFC65E5E" RenderTransformOrigin="0.5,0.5">
|
||||||
</Border>
|
<ComboBox.RenderTransform>
|
||||||
<GridSplitter Grid.Column="1" Width="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
<TransformGroup>
|
||||||
<Viewbox Grid.Row="0" Grid.Column="2" Stretch="Uniform">
|
<ScaleTransform/>
|
||||||
<Border Background="LightGray" Width="1600" Height="900">
|
<SkewTransform/>
|
||||||
<skia:SKElement x:Name="mainUI" PaintSurface="mainUI_PaintSurface" />
|
<RotateTransform Angle="-0.383"/>
|
||||||
</Border>
|
<TranslateTransform/>
|
||||||
</Viewbox>
|
</TransformGroup>
|
||||||
<GridSplitter Grid.Column="3" Width="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
</ComboBox.RenderTransform>
|
||||||
<Border Grid.Column="4" Background="LightBlue" >
|
<ComboBox.Background>
|
||||||
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
<LinearGradientBrush EndPoint="0,1">
|
||||||
<Grid Background="LightGray">
|
<GradientStop Color="#FFF0F0F0"/>
|
||||||
<TextBox x:Name="AIAssistantText" HorizontalAlignment="Left" VerticalAlignment="Top">
|
<GradientStop Color="#FF963333" Offset="1"/>
|
||||||
传给 AI 的文本
|
</LinearGradientBrush>
|
||||||
</TextBox>
|
</ComboBox.Background>
|
||||||
<Button x:Name="AIAssistantButton" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,30,0,0" Click="AIAssistantButton_Click" >
|
<ComboBoxItem Content="选项 1" />
|
||||||
测试
|
<ComboBoxItem Content="选项 2" />
|
||||||
</Button>
|
</ComboBox>
|
||||||
</Grid>
|
<Label Grid.Row="1" Content="Label" RenderTransformOrigin="0.5,0.5">
|
||||||
</ScrollViewer>
|
<Label.RenderTransform>
|
||||||
</Border>
|
<TransformGroup>
|
||||||
<GridSplitter Grid.Row="1" Grid.ColumnSpan="5" Height="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
<ScaleTransform/>
|
||||||
<Border Grid.ColumnSpan="5" Grid.Row="2" Background="LightSalmon">
|
<SkewTransform/>
|
||||||
<ScrollViewer x:Name="timelineViewer" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
<RotateTransform Angle="0.017"/>
|
||||||
<Canvas x:Name="timelineCanvas" Background="LightGray" />
|
<TranslateTransform/>
|
||||||
</ScrollViewer>
|
</TransformGroup>
|
||||||
</Border>
|
</Label.RenderTransform>
|
||||||
</Grid>
|
</Label>
|
||||||
</Grid>
|
<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>
|
</Window>
|
||||||
|
|||||||
+56
-33
@@ -2,6 +2,7 @@
|
|||||||
using Ollama;
|
using Ollama;
|
||||||
using RDTKEditor.AIAssistant;
|
using RDTKEditor.AIAssistant;
|
||||||
using RDTKEditor.Models;
|
using RDTKEditor.Models;
|
||||||
|
using RhythmBase.Components;
|
||||||
using RhythmBase.Events;
|
using RhythmBase.Events;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
using SkiaSharp.Views.Desktop;
|
using SkiaSharp.Views.Desktop;
|
||||||
@@ -9,6 +10,7 @@ using System.ComponentModel;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace RDTKEditor
|
namespace RDTKEditor
|
||||||
@@ -24,7 +26,30 @@ namespace RDTKEditor
|
|||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
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)
|
private void OpenFile(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
OpenFileDialog openFileDialog = new()
|
OpenFileDialog openFileDialog = new()
|
||||||
@@ -57,33 +82,6 @@ namespace RDTKEditor
|
|||||||
{
|
{
|
||||||
OnUpdateEventProperties(GetProperties(new MoveRow()));
|
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)
|
private RDTKProperty[] GetProperties(BaseEvent e)
|
||||||
{
|
{
|
||||||
@@ -135,7 +133,8 @@ namespace RDTKEditor
|
|||||||
Type = RDPropertyType.String,
|
Type = RDPropertyType.String,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
internal void OnUpdateEventProperties(RDTKProperty[] properties)
|
private readonly List<BaseEvent> selectedEvents = new();
|
||||||
|
internal void OnUpdateEventProperties(RDTKProperty[] properties)
|
||||||
{
|
{
|
||||||
ItemProperties.Items.Clear();
|
ItemProperties.Items.Clear();
|
||||||
foreach (var property in properties)
|
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 sfc = e.Surface;
|
||||||
var cvs = sfc.Canvas;
|
var cvs = sfc.Canvas;
|
||||||
var info = e.Info;
|
var info = e.Info;
|
||||||
cvs.Clear(SKColors.Black);
|
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.Save();
|
||||||
cvs.Scale(scale);
|
cvs.Scale(scale);
|
||||||
Draw(cvs);
|
Draw(cvs);
|
||||||
@@ -284,6 +286,10 @@ namespace RDTKEditor
|
|||||||
IsStroke = true,
|
IsStroke = true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
private void CheckBox_Checked(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
MessageBox.Show("已确认");
|
||||||
|
}
|
||||||
|
|
||||||
private async void AIAssistantButton_Click(object sender, RoutedEventArgs e)
|
private async void AIAssistantButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -294,8 +300,25 @@ namespace RDTKEditor
|
|||||||
AIAssistantText.Text = responce.Content;
|
AIAssistantText.Text = responce.Content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class MainViewModel : INotifyPropertyChanged
|
|
||||||
|
|
||||||
|
public class MainViewModel : INotifyPropertyChanged
|
||||||
{
|
{
|
||||||
public event PropertyChangedEventHandler? PropertyChanged;
|
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
|
internal class RDTKView
|
||||||
{
|
{
|
||||||
|
|
||||||
private RDLevel? Level { get; set; }
|
public RDLevel? Level { get; set; }
|
||||||
public RDTKView()
|
public RDTKView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user