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" 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"> <Menu Grid.Row="0" VerticalAlignment="Top">
<MenuItem Header="文件(_F)"> <MenuItem Header="文件(_F)">
<MenuItem Header="打开文件(_O)" Click="OpenFile" InputGestureText="Ctrl+O"/> <MenuItem Header="打开文件(_O)" Click="OpenFile" InputGestureText="Ctrl+O"/>
<MenuItem Header="保存文件(_S)" Click="SaveFile" InputGestureText="Ctrl+S"/> <MenuItem Header="保存文件(_S)" Click="SaveFile" InputGestureText="Ctrl+S"/>
<Separator/> <Separator/>
<MenuItem Header="退出(_E)" Click="Exit"/> <MenuItem Header="退出(_E)" Click="Exit"/>
</MenuItem> </MenuItem>
<MenuItem Header="帮助(_H)"> <MenuItem Header="帮助(_H)">
<MenuItem Header="关于(_A)" Click="About"/> <MenuItem Header="关于(_A)" Click="About"/>
</MenuItem> </MenuItem>
</Menu> </Menu>
<Grid Grid.Row="1"> <Grid Grid.Row="1">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="200" MinWidth="100" MaxWidth="300" /> <ColumnDefinition Width="200" MinWidth="100" MaxWidth="300" />
<ColumnDefinition Width="5" /> <ColumnDefinition Width="5" />
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="5" /> <ColumnDefinition Width="5" />
<ColumnDefinition Width="200" MinWidth="100" MaxWidth="300" /> <ColumnDefinition Width="200" MinWidth="100" MaxWidth="300" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="*"/> <RowDefinition Height="*"/>
<RowDefinition Height="5" /> <RowDefinition Height="5" />
<RowDefinition Height="100" MinHeight="90" MaxHeight="270"/> <RowDefinition Height="100" MinHeight="90" MaxHeight="270"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Border Grid.Column="0" Background="LightBlue"> <Border Grid.Column="0" Background="LightBlue">
<ScrollViewer VerticalScrollBarVisibility="Auto"> <ScrollViewer VerticalScrollBarVisibility="Auto">
<ItemsControl x:Name="ItemProperties" Background="LightGray"> <ItemsControl x:Name="ItemProperties" Background="LightGray">
</ItemsControl> <ComboBox Width="120" Height="21" BorderBrush="#FFDF4444" Foreground="#FFC65E5E" RenderTransformOrigin="0.5,0.5">
</ScrollViewer> <ComboBox.RenderTransform>
</Border> <TransformGroup>
<GridSplitter Grid.Column="1" Width="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> <ScaleTransform/>
<Viewbox Grid.Row="0" Grid.Column="2" Stretch="Uniform"> <SkewTransform/>
<Border Background="LightGray" Width="1600" Height="900"> <RotateTransform Angle="-0.383"/>
<skia:SKElement x:Name="mainUI" PaintSurface="mainUI_PaintSurface" /> <TranslateTransform/>
</Border> </TransformGroup>
</Viewbox> </ComboBox.RenderTransform>
<GridSplitter Grid.Column="3" Width="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> <ComboBox.Background>
<Border Grid.Column="4" Background="LightBlue" > <LinearGradientBrush EndPoint="0,1">
<ScrollViewer VerticalScrollBarVisibility="Auto"> <GradientStop Color="#FFF0F0F0"/>
<Grid x:Name="timelineCanvas3" Background="LightGray" /> <GradientStop Color="#FF963333" Offset="1"/>
</ScrollViewer> </LinearGradientBrush>
</Border> </ComboBox.Background>
<GridSplitter Grid.Row="1" Grid.ColumnSpan="5" Height="5" Background="Gray" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" /> <ComboBoxItem Content="选项 1" />
<Border Grid.ColumnSpan="5" Grid.Row="2" Background="LightSalmon"> <ComboBoxItem Content="选项 2" />
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> </ComboBox>
<Canvas x:Name="timelineCanvas" Background="LightGray" /> <Label Content="Label" Height="28" Width="112" RenderTransformOrigin="0.5,0.5">
</ScrollViewer> <Label.RenderTransform>
</Border> <TransformGroup>
</Grid> <ScaleTransform/>
</Grid> <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> </Window>
+22 -33
View File
@@ -19,10 +19,11 @@ namespace RDTKEditor
{ {
private SKSizeI _vsScale = new(1600,900); private SKSizeI _vsScale = new(1600,900);
private readonly RDTKView viewModel = new(); private readonly RDTKView viewModel = new();
public MainWindow() /*public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
} SlV.Content = "Button";
}*/
private void OpenFile(object sender, RoutedEventArgs e) private void OpenFile(object sender, RoutedEventArgs e)
{ {
OpenFileDialog openFileDialog = new() OpenFileDialog openFileDialog = new()
@@ -55,33 +56,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)
{ {
@@ -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 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);
@@ -282,9 +259,21 @@ namespace RDTKEditor
IsStroke = true, IsStroke = true,
}); });
} }
}
public class MainViewModel : INotifyPropertyChanged private void CheckBox_Checked(object sender, RoutedEventArgs e)
{
MessageBox.Show("已确认");
}
}
public class MainViewModel : INotifyPropertyChanged
{ {
public event PropertyChangedEventHandler? PropertyChanged; public event PropertyChangedEventHandler? PropertyChanged;
} }
} }