mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-05 02:06:53 +08:00
[csharp] Port of commit 11b339b. Added slot path nonsessential data.
This commit is contained in:
parent
9602a715d9
commit
468656ba0e
@ -199,7 +199,15 @@ namespace Spine {
|
|||||||
// Slots.
|
// Slots.
|
||||||
SlotData[] slots = skeletonData.slots.Resize(n = input.ReadInt(true)).Items;
|
SlotData[] slots = skeletonData.slots.Resize(n = input.ReadInt(true)).Items;
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
String slotName = input.ReadString();
|
String slotName = input.ReadString(); //, path = null;
|
||||||
|
if (nonessential) {
|
||||||
|
int slash = slotName.LastIndexOf('/');
|
||||||
|
if (slash != -1) {
|
||||||
|
//path = slotName.Substring(0, slash);
|
||||||
|
slotName = slotName.Substring(slash + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BoneData boneData = bones[input.ReadInt(true)];
|
BoneData boneData = bones[input.ReadInt(true)];
|
||||||
SlotData slotData = new SlotData(i, slotName, boneData);
|
SlotData slotData = new SlotData(i, slotName, boneData);
|
||||||
int color = input.ReadInt();
|
int color = input.ReadInt();
|
||||||
@ -218,7 +226,9 @@ namespace Spine {
|
|||||||
|
|
||||||
slotData.attachmentName = input.ReadStringRef();
|
slotData.attachmentName = input.ReadStringRef();
|
||||||
slotData.blendMode = (BlendMode)input.ReadInt(true);
|
slotData.blendMode = (BlendMode)input.ReadInt(true);
|
||||||
if (nonessential) input.ReadBoolean(); // if (nonessential) data.visible = input.readBoolean();
|
if (nonessential) {
|
||||||
|
input.ReadBoolean(); // data.visible = input.readBoolean(); data.path = path;
|
||||||
|
}
|
||||||
slots[i] = slotData;
|
slots[i] = slotData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -58,6 +58,7 @@ namespace Spine {
|
|||||||
/// <summary>The skeleton's bones, sorted parent first. The root bone is always the first bone.</summary>
|
/// <summary>The skeleton's bones, sorted parent first. The root bone is always the first bone.</summary>
|
||||||
public ExposedList<BoneData> Bones { get { return bones; } }
|
public ExposedList<BoneData> Bones { get { return bones; } }
|
||||||
|
|
||||||
|
/// <summary>The skeleton's slots in the setup pose draw order.</summary>
|
||||||
public ExposedList<SlotData> Slots { get { return slots; } }
|
public ExposedList<SlotData> Slots { get { return slots; } }
|
||||||
|
|
||||||
/// <summary>All skins, including the default skin.</summary>
|
/// <summary>All skins, including the default skin.</summary>
|
||||||
|
|||||||
@ -143,7 +143,13 @@ namespace Spine {
|
|||||||
// Slots.
|
// Slots.
|
||||||
if (root.ContainsKey("slots")) {
|
if (root.ContainsKey("slots")) {
|
||||||
foreach (Dictionary<string, Object> slotMap in (List<Object>)root["slots"]) {
|
foreach (Dictionary<string, Object> slotMap in (List<Object>)root["slots"]) {
|
||||||
string slotName = (string)slotMap["name"];
|
string slotName = (string)slotMap["name"]; //, path = null;
|
||||||
|
int slash = slotName.LastIndexOf('/');
|
||||||
|
if (slash != -1) {
|
||||||
|
//path = slotName.Substring(0, slash);
|
||||||
|
slotName = slotName.Substring(slash + 1);
|
||||||
|
}
|
||||||
|
|
||||||
string boneName = (string)slotMap["bone"];
|
string boneName = (string)slotMap["bone"];
|
||||||
BoneData boneData = skeletonData.FindBone(boneName);
|
BoneData boneData = skeletonData.FindBone(boneName);
|
||||||
if (boneData == null) throw new Exception("Slot bone not found: " + boneName);
|
if (boneData == null) throw new Exception("Slot bone not found: " + boneName);
|
||||||
@ -170,6 +176,8 @@ namespace Spine {
|
|||||||
data.blendMode = (BlendMode)Enum.Parse(typeof(BlendMode), (string)slotMap["blend"], true);
|
data.blendMode = (BlendMode)Enum.Parse(typeof(BlendMode), (string)slotMap["blend"], true);
|
||||||
else
|
else
|
||||||
data.blendMode = BlendMode.Normal;
|
data.blendMode = BlendMode.Normal;
|
||||||
|
//data.visible = slotMap.getBoolean("visible", true);
|
||||||
|
//data.path = path;
|
||||||
skeletonData.slots.Add(data);
|
skeletonData.slots.Add(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -40,6 +40,10 @@ namespace Spine {
|
|||||||
internal string attachmentName;
|
internal string attachmentName;
|
||||||
internal BlendMode blendMode;
|
internal BlendMode blendMode;
|
||||||
|
|
||||||
|
// Nonessential.
|
||||||
|
// bool visible = true;
|
||||||
|
// string path;
|
||||||
|
|
||||||
/// <summary>The index of the slot in <see cref="Skeleton.Slots"/>.</summary>
|
/// <summary>The index of the slot in <see cref="Skeleton.Slots"/>.</summary>
|
||||||
public int Index { get { return index; } }
|
public int Index { get { return index; } }
|
||||||
/// <summary>The name of the slot, which is unique across all slots in the skeleton.</summary>
|
/// <summary>The name of the slot, which is unique across all slots in the skeleton.</summary>
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
"name": "com.esotericsoftware.spine.spine-csharp",
|
"name": "com.esotericsoftware.spine.spine-csharp",
|
||||||
"displayName": "spine-csharp Runtime",
|
"displayName": "spine-csharp Runtime",
|
||||||
"description": "This plugin provides the spine-csharp core runtime.",
|
"description": "This plugin provides the spine-csharp core runtime.",
|
||||||
"version": "4.2.11",
|
"version": "4.2.12",
|
||||||
"unity": "2018.3",
|
"unity": "2018.3",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Esoteric Software",
|
"name": "Esoteric Software",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user