Archived
forked from RDTKEditor/RDTKEditor
同步更新 RDTK
This commit is contained in:
+91
-41
@@ -2,6 +2,7 @@
|
||||
using Ollama;
|
||||
using RDTKEditor.AIAssistant;
|
||||
using RDTKEditor.Models;
|
||||
using RhythmBase.Components;
|
||||
using RhythmBase.Events;
|
||||
using SkiaSharp;
|
||||
using SkiaSharp.Views.Desktop;
|
||||
@@ -18,12 +19,18 @@ namespace RDTKEditor
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private Assistant Assistant = new(Assistant.Qwen_3);
|
||||
private SKSizeI _vsScale = new(1600,900);
|
||||
private readonly Assistant Assistant = new(Assistant.Qwen_3);
|
||||
private SKSizeI _vsScale = new(1600, 900);
|
||||
private readonly RDTKView viewModel = new();
|
||||
private readonly List<BaseEvent> _selectedEvents = [];
|
||||
internal readonly Dictionary<Type, StackPanel[]> _eventPanel = [];
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
RDLevel level = RDLevel.Default;
|
||||
var setVfx = new SetVFXPreset();
|
||||
level.Add(setVfx);
|
||||
_selectedEvents = [setVfx];
|
||||
}
|
||||
private void OpenFile(object sender, RoutedEventArgs e)
|
||||
{
|
||||
@@ -55,7 +62,19 @@ namespace RDTKEditor
|
||||
}
|
||||
private void About(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OnUpdateEventProperties(GetProperties(new MoveRow()));
|
||||
if (_selectedEvents.Count == 0)
|
||||
{
|
||||
MessageBox.Show("请先选择一个事件。", "提示", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
return;
|
||||
}
|
||||
if (_selectedEvents.Count == 1)
|
||||
{
|
||||
OnUpdateEventProperties(_selectedEvents[0], GetProperties(_selectedEvents[0]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//OnUpdateEventProperties([
|
||||
// new(){
|
||||
@@ -135,33 +154,36 @@ namespace RDTKEditor
|
||||
Type = RDPropertyType.String,
|
||||
};
|
||||
}
|
||||
internal void OnUpdateEventProperties(RDTKProperty[] properties)
|
||||
internal void OnUpdateEventProperties(BaseEvent baseEvent, RDTKProperty[] properties)
|
||||
{
|
||||
ItemProperties.Items.Clear();
|
||||
StackPanel[] panel = new StackPanel[properties.Length];
|
||||
if (_eventPanel.ContainsKey(baseEvent.GetType()))
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var property in properties)
|
||||
{
|
||||
StackPanel stackPanel;
|
||||
switch (property.Type)
|
||||
StackPanel stackPanel = property.Type switch
|
||||
{
|
||||
case RDPropertyType.Bool:
|
||||
stackPanel = new()
|
||||
{
|
||||
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), }
|
||||
},
|
||||
};
|
||||
break;
|
||||
case RDPropertyType.Enum:
|
||||
stackPanel = 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()
|
||||
@@ -170,33 +192,28 @@ namespace RDTKEditor
|
||||
SelectedValue = property.Value,
|
||||
}
|
||||
},
|
||||
};
|
||||
break;
|
||||
case RDPropertyType.String:
|
||||
stackPanel = 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, }
|
||||
},
|
||||
};
|
||||
break;
|
||||
default:
|
||||
stackPanel = new()
|
||||
{
|
||||
Orientation = Orientation.Horizontal,
|
||||
Children =
|
||||
},
|
||||
_ => new()
|
||||
{
|
||||
Orientation = Orientation.Horizontal,
|
||||
Children =
|
||||
{
|
||||
new Label(){Content = property.Name},
|
||||
new Label(){Content = property.Value}
|
||||
}
|
||||
};
|
||||
break;
|
||||
}
|
||||
},
|
||||
};
|
||||
foreach (var child in stackPanel.Children)
|
||||
{
|
||||
switch (child)
|
||||
@@ -230,10 +247,43 @@ namespace RDTKEditor
|
||||
ItemProperties.Items.Add(stackPanel);
|
||||
property.PropertyChanged += (e, s) => UpdateEvent();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private void UpdateEvent()
|
||||
{
|
||||
MessageBox.Show("Update Event");
|
||||
if (_selectedEvents.Count == 0)
|
||||
return;
|
||||
else if (_selectedEvents.Count == 1){
|
||||
var e = _selectedEvents[0];
|
||||
foreach (var property in ItemProperties.Items)
|
||||
{
|
||||
if (property is StackPanel stackPanel)
|
||||
{
|
||||
foreach (var child in stackPanel.Children)
|
||||
{
|
||||
switch (child)
|
||||
{
|
||||
case CheckBox checkBox:
|
||||
e.GetType().GetProperty(stackPanel.Name)?.SetValue(e, checkBox.IsChecked);
|
||||
break;
|
||||
case TextBox textBox:
|
||||
e.GetType().GetProperty(stackPanel.Name)?.SetValue(e, textBox.Text);
|
||||
break;
|
||||
case ComboBox comboBox:
|
||||
e.GetType().GetProperty(stackPanel.Name)?.SetValue(e, comboBox.SelectedValue);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
private void UpdateTimeLine()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user