This commit is contained in:
2025-04-15 09:48:47 +08:00
parent 083f6b239e
commit 3fa6184341
2 changed files with 117 additions and 91 deletions
+95 -58
View File
@@ -7,62 +7,99 @@
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 x:Name="timelineCanvas3" Background="LightGray" />
</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 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 Width="120" Height="21" 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 Content="Label" Height="28" Width="112" RenderTransformOrigin="0.5,0.5">
<Label.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="0.017"/>
<TranslateTransform/>
</TransformGroup>
</Label.RenderTransform>
</Label>
<ListView Height="65" Width="192" d:ItemsSource="{d:SampleData ItemCount=5}">
<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" />
</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 HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" x:Name="SlV">
<Canvas x:Name="timelineCanvas" Background="LightGray" >
<CheckBox Content="CheckBox" Checked="CheckBox_Checked" VerticalAlignment="Top" HorizontalAlignment="Center" VerticalContentAlignment="Bottom" HorizontalContentAlignment="Right" Canvas.Top="10" />
</Canvas>
</ScrollViewer>
</Border>
</Grid>
</Grid>
</Window>
+22 -33
View File
@@ -19,10 +19,11 @@ namespace RDTKEditor
{
private SKSizeI _vsScale = new(1600,900);
private readonly RDTKView viewModel = new();
public MainWindow()
/*public MainWindow()
{
InitializeComponent();
}
SlV.Content = "Button";
}*/
private void OpenFile(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new()
@@ -55,33 +56,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)
{
@@ -253,13 +227,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);
@@ -282,9 +259,21 @@ namespace RDTKEditor
IsStroke = true,
});
}
}
public class MainViewModel : INotifyPropertyChanged
private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
MessageBox.Show("已确认");
}
}
public class MainViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
}
}