mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Merge pull request #45 from Dgizusse/master
tk2d Support for multiple platform SpriteCollections
This commit is contained in:
commit
ae17932d53
@ -23,8 +23,8 @@ public class tk2dSpineAttachmentLoader : AttachmentLoader {
|
|||||||
if(type != AttachmentType.region) throw new Exception("Unknown attachment type: " + type);
|
if(type != AttachmentType.region) throw new Exception("Unknown attachment type: " + type);
|
||||||
|
|
||||||
tk2dSpriteDefinition attachmentParameters = null;
|
tk2dSpriteDefinition attachmentParameters = null;
|
||||||
for(int i = 0; i < sprites.spriteDefinitions.Length; ++i) {
|
for(int i = 0; i < sprites.inst.spriteDefinitions.Length; ++i) {
|
||||||
tk2dSpriteDefinition def = sprites.spriteDefinitions[i];
|
tk2dSpriteDefinition def = sprites.inst.spriteDefinitions[i];
|
||||||
if(def.name == name) {
|
if(def.name == name) {
|
||||||
attachmentParameters = def;
|
attachmentParameters = def;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -10,7 +10,7 @@ using Spine;
|
|||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
[RequireComponent(typeof(MeshFilter))]
|
[RequireComponent(typeof(MeshFilter))]
|
||||||
[RequireComponent(typeof(MeshRenderer))]
|
[RequireComponent(typeof(MeshRenderer))]
|
||||||
public class tk2dSpineSkeleton : MonoBehaviour {
|
public class tk2dSpineSkeleton : MonoBehaviour, tk2dRuntime.ISpriteCollectionForceBuild {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
@ -137,7 +137,7 @@ public class tk2dSpineSkeleton : MonoBehaviour {
|
|||||||
mesh.triangles = triangles;
|
mesh.triangles = triangles;
|
||||||
mesh.RecalculateNormals();
|
mesh.RecalculateNormals();
|
||||||
|
|
||||||
renderer.sharedMaterial = skeletonDataAsset.sprites.spriteCollection.materials[0];
|
renderer.sharedMaterial = skeletonDataAsset.sprites.spriteCollection.inst.materials[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -188,4 +188,15 @@ public class tk2dSpineSkeleton : MonoBehaviour {
|
|||||||
state.Update(Time.deltaTime * animationSpeed);
|
state.Update(Time.deltaTime * animationSpeed);
|
||||||
state.Apply(skeleton);
|
state.Apply(skeleton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool UsesSpriteCollection(tk2dSpriteCollectionData spriteCollection) {
|
||||||
|
return skeletonDataAsset.sprites.spriteCollection == spriteCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ForceBuild() {
|
||||||
|
skeletonDataAsset.ForceUpdate();
|
||||||
|
skeleton = new Skeleton(skeletonDataAsset.GetSkeletonData());
|
||||||
|
|
||||||
|
UpdateMesh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,4 +68,8 @@ public class tk2dSpineSkeletonDataAsset : ScriptableObject {
|
|||||||
stateData.SetMix(fromAnimation[i],toAnimation[i],duration[i]);
|
stateData.SetMix(fromAnimation[i],toAnimation[i],duration[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ForceUpdate() {
|
||||||
|
MakeSkeletonAndAnimationData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user