本文整理汇总了C#中com.getAnimation方法的典型用法代码示例。如果您正苦于以下问题:C# com.getAnimation方法的具体用法?C# com.getAnimation怎么用?C# com.getAnimation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com
的用法示例。
在下文中一共展示了com.getAnimation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: generateKeyFramePool
/// <summary>Generates all needed keyframes from the given spriter data.</summary>
/// <remarks>Generates all needed keyframes from the given spriter data. This method sorts all objects by its z_index value to draw them in a proper way.
/// </remarks>
/// <param name="spriterData">SpriterData to generate from.</param>
/// <returns>generated keyframe list.</returns>
public static System.Collections.Generic.IList<com.brashmonkey.spriter.animation.SpriterAnimation> generateKeyFramePool(com.discobeard.spriter.dom.SpriterData data, com.discobeard.spriter.dom.Entity
entity)
{
System.Collections.Generic.IList<com.brashmonkey.spriter.animation.SpriterAnimation
> spriterAnimations = new System.Collections.Generic.List<com.brashmonkey.spriter.animation.SpriterAnimation
>();
System.Collections.Generic.IList<com.discobeard.spriter.dom.Animation> animations
= entity.getAnimation();
com.brashmonkey.spriter.mergers.SpriterAnimationBuilder frameBuilder = new com.brashmonkey.spriter.mergers.SpriterAnimationBuilder
();
foreach (com.discobeard.spriter.dom.Animation anim in animations)
{
com.brashmonkey.spriter.animation.SpriterAnimation spriterAnimation = frameBuilder
.buildAnimation(anim);
bool found = false;
foreach (com.brashmonkey.spriter.animation.SpriterKeyFrame key in spriterAnimation
.frames)
{
if (!found)
{
found = key.getTime() == anim.getLength();
}
sort(key.getObjects());
foreach (com.brashmonkey.spriter.objects.SpriterBone bone in key.getBones())
{
foreach (com.brashmonkey.spriter.objects.SpriterBone bone2 in key.getBones())
{
if (bone2.hasParent())
{
if (!bone2.equals(bone) && bone2.getParentId() == bone.getId())
{
bone.addChildBone(bone2);
}
}
}
foreach (com.brashmonkey.spriter.objects.SpriterObject @object in key.getObjects(
))
{
com.brashmonkey.spriter.file.Reference @ref = @object.getRef();
com.discobeard.spriter.dom.File f = data.getFolder()[@ref.folder].getFile()[@ref.
file];
@ref.dimensions = new com.brashmonkey.spriter.SpriterRectangle(0, f.getHeight(),
f.getWidth(), 0f);
if (bone.getId() == @object.getParentId())
{
bone.addChildObject(@object);
}
}
}
}
spriterAnimations.Add(spriterAnimation);
}
return spriterAnimations;
}
示例2: loadAnimations
private static void loadAnimations(List<XmlNode
> animations, com.discobeard.spriter.dom.Entity entity)
{
for (int i = 0; i < animations.Count; i++)
{
XmlNode a = animations[i];
com.discobeard.spriter.dom.Animation animation = new com.discobeard.spriter.dom.Animation
();
animation.setId(XmlReader.getInt(a,"id" ));
animation.setName(XmlReader.getAttribute(a,"name" ));
animation.setLength(XmlReader.getInt(a,"length" ));
animation.setLooping(XmlReader.getBool(a,"looping"));
entity.getAnimation().Add(animation);
loadMainline(XmlReader.getChildByName(a,"mainline"), animation);
loadTimelines(XmlReader.getChildrenByName(a,"timeline"), animation);
}
}
示例3: generateKeyFramePool
/// <summary>Generates all needed keyframes from the given spriter data.</summary>
/// <remarks>Generates all needed keyframes from the given spriter data. This method sorts all objects by its z_index value to draw them in a proper way.
/// </remarks>
/// <param name="spriterData">SpriterData to generate from.</param>
/// <returns>generated keyframe list.</returns>
public static IList<SpriterAnimation> generateKeyFramePool(com.discobeard.spriter.dom.SpriterData data, com.discobeard.spriter.dom.Entity
entity)
{
IList<SpriterAnimation
> spriterAnimations = new List<SpriterAnimation
>();
IList<com.discobeard.spriter.dom.Animation> animations
= entity.getAnimation();
Com.Brashmonkey.Spriter.mergers.SpriterAnimationBuilder frameBuilder = new Com.Brashmonkey.Spriter.mergers.SpriterAnimationBuilder
();
foreach (com.discobeard.spriter.dom.Animation anim in animations)
{
SpriterAnimation spriterAnimation = frameBuilder
.buildAnimation(anim);
bool found = false;
foreach (SpriterKeyFrame key in spriterAnimation
.frames)
{
if (!found)
{
found = key.getTime() == anim.getLength();
}
sort(key.getObjects());
foreach (SpriterBone bone in key.getBones())
{
foreach (SpriterBone bone2 in key.getBones())
{
if (bone2.hasParent())
{
if (!bone2.equals(bone) && bone2.getParentId() == bone.getId())
{
bone.addChildBone(bone2);
}
}
}
foreach (SpriterObject @object in key.getObjects(
))
{
Com.Brashmonkey.Spriter.file.Reference @ref = @object.getRef();
com.discobeard.spriter.dom.File f = data.getFolder()[@ref.folder].getFile()[@ref.
file];
@ref.dimensions = new Com.Brashmonkey.Spriter.SpriterRectangle(0, f.getHeight(),
f.getWidth(), 0f);
if (bone.getId() == @object.getParentId())
{
bone.addChildObject(@object);
}
}
}
}
if (!found)
{
SpriterKeyFrame firstFrame = spriterAnimation.frames
[0];
SpriterKeyFrame lastFrame = new SpriterKeyFrame
();
lastFrame.setId(spriterAnimation.keyframes());
lastFrame.setBones(new SpriterBone[firstFrame.getBones
().Length]);
lastFrame.setObjects(new SpriterObject[firstFrame
.getObjects().Length]);
for (int j = 0; j < lastFrame.getBones().Length; j++)
{
SpriterBone bone = new SpriterBone
();
firstFrame.getBones()[j].copyValuesTo(bone);
lastFrame.getBones()[j] = bone;
}
for (int j_1 = 0; j_1 < lastFrame.getObjects().Length; j_1++)
{
SpriterObject @object = new SpriterObject
();
firstFrame.getObjects()[j_1].copyValuesTo(@object);
lastFrame.getObjects()[j_1] = @object;
}
lastFrame.setTime(anim.getLength());
spriterAnimation.frames.Add(lastFrame);
}
spriterAnimations.Add(spriterAnimation);
}
return spriterAnimations;
}