[csharp] Add audioPath to EventData and SkeletonData

This commit is contained in:
pharan 2018-01-19 02:47:44 +08:00
parent 18eec077e4
commit 83778a76c1
4 changed files with 16 additions and 3 deletions

View File

@ -39,7 +39,8 @@ namespace Spine {
public string Name { get { return name; } }
public int Int { get; set; }
public float Float { get; set; }
public string String { get; set; }
public string @String { get; set; }
public string AudioPath { get; set; }
public EventData (string name) {
if (name == null) throw new ArgumentNullException("name", "name cannot be null.");

View File

@ -151,8 +151,12 @@ namespace Spine {
if (nonessential) {
skeletonData.fps = ReadFloat(input);
skeletonData.imagesPath = ReadString(input);
if (skeletonData.imagesPath.Length == 0) skeletonData.imagesPath = null;
if (string.IsNullOrEmpty(skeletonData.imagesPath)) skeletonData.imagesPath = null;
skeletonData.audioPath = ReadString(input);
if (string.IsNullOrEmpty(skeletonData.audioPath)) skeletonData.audioPath = null;
}
// Bones.
@ -280,6 +284,7 @@ namespace Spine {
data.Int = ReadVarint(input, false);
data.Float = ReadFloat(input);
data.String = ReadString(input);
data.AudioPath = ReadString(input);
skeletonData.events.Add(data);
}

View File

@ -49,7 +49,7 @@ namespace Spine {
// Nonessential.
internal float fps;
internal string imagesPath;
internal string imagesPath, audioPath;
public string Name { get { return name; } set { name = value; } }
@ -79,7 +79,12 @@ namespace Spine {
/// <summary>The Spine version used to export this data, or null.</summary>
public string Version { get { return version; } set { version = value; } }
public string Hash { get { return hash; } set { hash = value; } }
/// <summary>The path to the images directory as defined in Spine. Available only when nonessential data was exported. May be null</summary>
public string ImagesPath { get { return imagesPath; } set { imagesPath = value; } }
/// <summary>The path to the audio directory defined in Spine. Available only when nonessential data was exported. May be null.</summary>
public string AudioPath { get { return audioPath; } set { audioPath = value; } }
/// <summary>
/// The dopesheet FPS in Spine. Available only when nonessential data was exported.</summary>

View File

@ -104,6 +104,7 @@ namespace Spine {
skeletonData.height = GetFloat(skeletonMap, "height", 0);
skeletonData.fps = GetFloat(skeletonMap, "fps", 0);
skeletonData.imagesPath = GetString(skeletonMap, "images", null);
skeletonData.audioPath = GetString(skeletonMap, "audio", null);
}
// Bones.
@ -293,6 +294,7 @@ namespace Spine {
data.Int = GetInt(entryMap, "int", 0);
data.Float = GetFloat(entryMap, "float", 0);
data.String = GetString(entryMap, "string", string.Empty);
data.AudioPath = GetString(entryMap, "audio", string.Empty);
skeletonData.events.Add(data);
}
}