修复小bug
This commit is contained in:
@@ -186,10 +186,9 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
{
|
{
|
||||||
return new StandardValuesCollection(tracks.Spine.AnimationNames);
|
return new StandardValuesCollection(tracks.Spine.AnimationNames);
|
||||||
}
|
}
|
||||||
else if (context?.Instance is object[] instances && instances.All(x => x is SpineAnimationProperty))
|
else if (context?.Instance is SpineAnimationProperty[] animTracks)
|
||||||
{
|
{
|
||||||
// XXX: 这里不知道为啥总是会得到 object[] 类型而不是具体的类型
|
// XXX: 莫名其妙好了, 不是 object[] 类型是具体的类型了
|
||||||
var animTracks = instances.Cast<SpineAnimationProperty>().ToArray();
|
|
||||||
if (animTracks.Length > 0)
|
if (animTracks.Length > 0)
|
||||||
{
|
{
|
||||||
IEnumerable<string> common = animTracks[0].Spine.AnimationNames;
|
IEnumerable<string> common = animTracks[0].Spine.AnimationNames;
|
||||||
|
|||||||
@@ -61,12 +61,10 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 皮肤属性描述符, 实现对皮肤的加载和卸载, <c><see cref="SpineSkinProperty"/>.Skin_{name}</c>
|
/// 皮肤属性描述符, 实现对皮肤的加载和卸载, <c><see cref="SpineSkinProperty"/>.{name}</c>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private class SkinPropertyDescriptor(string name, Attribute[]? attributes) : PropertyDescriptor($"Skin_{name}", attributes)
|
private class SkinPropertyDescriptor(string name, Attribute[]? attributes) : PropertyDescriptor(name, attributes)
|
||||||
{
|
{
|
||||||
private readonly string name = name;
|
|
||||||
|
|
||||||
public override Type ComponentType => typeof(SpineSkinProperty);
|
public override Type ComponentType => typeof(SpineSkinProperty);
|
||||||
public override bool IsReadOnly => false;
|
public override bool IsReadOnly => false;
|
||||||
public override Type PropertyType => typeof(bool);
|
public override Type PropertyType => typeof(bool);
|
||||||
@@ -77,7 +75,7 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
public override object? GetValue(object? component)
|
public override object? GetValue(object? component)
|
||||||
{
|
{
|
||||||
if (component is SpineSkinProperty prop)
|
if (component is SpineSkinProperty prop)
|
||||||
return prop.Spine.GetSkinStatus(name);
|
return prop.Spine.GetSkinStatus(Name);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +84,7 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
if (component is SpineSkinProperty prop)
|
if (component is SpineSkinProperty prop)
|
||||||
{
|
{
|
||||||
if (value is bool s)
|
if (value is bool s)
|
||||||
prop.Spine.SetSkinStatus(name, s);
|
prop.Spine.SetSkinStatus(Name, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,10 +65,8 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 槽位属性描述符, 实现对属性的读取和赋值
|
/// 槽位属性描述符, 实现对属性的读取和赋值
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class SlotPropertyDescriptor(string name, Attribute[]? attributes) : PropertyDescriptor($"Slot_{name}", attributes)
|
internal class SlotPropertyDescriptor(string name, Attribute[]? attributes) : PropertyDescriptor(name, attributes)
|
||||||
{
|
{
|
||||||
public string SlotName { get; } = name;
|
|
||||||
|
|
||||||
public override Type ComponentType => typeof(SpineSlotProperty);
|
public override Type ComponentType => typeof(SpineSlotProperty);
|
||||||
public override bool IsReadOnly => false;
|
public override bool IsReadOnly => false;
|
||||||
public override Type PropertyType => typeof(SlotProperty);
|
public override Type PropertyType => typeof(SlotProperty);
|
||||||
@@ -82,7 +80,7 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
public override object? GetValue(object? component)
|
public override object? GetValue(object? component)
|
||||||
{
|
{
|
||||||
if (component is SpineSlotProperty slots)
|
if (component is SpineSlotProperty slots)
|
||||||
return slots.Spine.GetSlotAttachment(SlotName);
|
return slots.Spine.GetSlotAttachment(Name);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,7 +92,7 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
if (component is SpineSlotProperty slots)
|
if (component is SpineSlotProperty slots)
|
||||||
{
|
{
|
||||||
if (value is string s)
|
if (value is string s)
|
||||||
slots.Spine.SetSlotAttachment(SlotName, s);
|
slots.Spine.SetSlotAttachment(Name, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,7 +101,7 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 对 <c><see cref="SpineSlotProperty"/>.Slot_{name}</c> 属性的包装类
|
/// 对 <c><see cref="SpineSlotProperty"/>.{name}</c> 属性的包装类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[TypeConverter(typeof(SlotPropertyConverter))]
|
[TypeConverter(typeof(SlotPropertyConverter))]
|
||||||
public class SlotProperty(SpineObject spine, string name)
|
public class SlotProperty(SpineObject spine, string name)
|
||||||
@@ -148,23 +146,22 @@ namespace SpineViewer.Spine.SpineView
|
|||||||
|
|
||||||
public override StandardValuesCollection? GetStandardValues(ITypeDescriptorContext? context)
|
public override StandardValuesCollection? GetStandardValues(ITypeDescriptorContext? context)
|
||||||
{
|
{
|
||||||
if (context?.PropertyDescriptor is SpineSlotProperty.SlotPropertyDescriptor pd)
|
if (context?.PropertyDescriptor is PropertyDescriptor pd)
|
||||||
{
|
{
|
||||||
if (context?.Instance is SpineSlotProperty slots)
|
if (context?.Instance is SpineSlotProperty slots)
|
||||||
{
|
{
|
||||||
if (slots.Spine.SlotAttachmentNames.TryGetValue(pd.SlotName, out var names))
|
if (slots.Spine.SlotAttachmentNames.TryGetValue(pd.Name, out var names))
|
||||||
return new StandardValuesCollection(names);
|
return new StandardValuesCollection(names);
|
||||||
}
|
}
|
||||||
else if (context?.Instance is object[] instances && instances.All(x => x is SpineSlotProperty))
|
else if (context?.Instance is SpineSlotProperty[] spinesSlots)
|
||||||
{
|
{
|
||||||
// XXX: 这里不知道为啥总是会得到 object[] 类型而不是具体的类型
|
// XXX: 莫名其妙好了, 不是 object[] 类型是具体的类型了
|
||||||
var spinesSlots = instances.Cast<SpineAnimationProperty>().ToArray();
|
|
||||||
if (spinesSlots.Length > 0)
|
if (spinesSlots.Length > 0)
|
||||||
{
|
{
|
||||||
IEnumerable<string> common = [];
|
IEnumerable<string> common = [];
|
||||||
foreach (var t in spinesSlots)
|
foreach (var t in spinesSlots)
|
||||||
{
|
{
|
||||||
if (t.Spine.SlotAttachmentNames.TryGetValue(pd.SlotName, out var names))
|
if (t.Spine.SlotAttachmentNames.TryGetValue(pd.Name, out var names))
|
||||||
common = common.Union(names);
|
common = common.Union(names);
|
||||||
}
|
}
|
||||||
return new StandardValuesCollection(common.ToArray());
|
return new StandardValuesCollection(common.ToArray());
|
||||||
|
|||||||
Reference in New Issue
Block a user