同步更新 RDTK

This commit is contained in:
OLDREDSTONE
2025-05-07 10:15:40 +08:00
parent 6c96c54193
commit 3533286dbc
296 changed files with 87 additions and 24997 deletions
+83 -40
View File
@@ -20,9 +20,11 @@ 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();
@@ -80,7 +82,17 @@ 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
{
}
private RDTKProperty[] GetProperties(BaseEvent e)
@@ -137,30 +149,33 @@ namespace RDTKEditor
internal void OnUpdateEventProperties(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()
@@ -169,33 +184,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)
@@ -229,10 +239,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()
{