/**
* The MIT License (MIT)
*
* Copyright (c) 2012-2017 DragonBones team and other contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
using System.Collections.Generic;
using System.Diagnostics;
using System;
namespace DragonBones
{
///
///
enum BinaryOffset
{
WeigthBoneCount = 0,
WeigthFloatOffset = 1,
WeigthBoneIndices = 2,
MeshVertexCount = 0,
MeshTriangleCount = 1,
MeshFloatOffset = 2,
MeshWeightOffset = 3,
MeshVertexIndices = 4,
TimelineScale = 0,
TimelineOffset = 1,
TimelineKeyFrameCount = 2,
TimelineFrameValueCount = 3,
TimelineFrameValueOffset = 4,
TimelineFrameOffset = 5,
FramePosition = 0,
FrameTweenType = 1,
FrameTweenEasingOrCurveSampleCount = 2,
FrameCurveSamples = 3,
DeformVertexOffset = 0,
DeformCount = 1,
DeformValueCount = 2,
DeformValueOffset = 3,
DeformFloatOffset = 4
}
///
///
public enum ArmatureType
{
None = -1,
Armature = 0,
MovieClip = 1,
Stage = 2
}
///
public enum DisplayType
{
None = -1,
Image = 0,
Armature = 1,
Mesh = 2,
BoundingBox = 3,
Path = 4
}
///
/// - Bounding box type.
///
/// DragonBones 5.0
/// en_US
///
/// - 边界框类型。
///
/// DragonBones 5.0
/// zh_CN
public enum BoundingBoxType
{
None = -1,
Rectangle = 0,
Ellipse = 1,
Polygon = 2
}
///
///
public enum ActionType
{
Play = 0,
Frame = 10,
Sound = 11
}
///
///
public enum BlendMode
{
Normal = 0,
Add = 1,
Alpha = 2,
Darken = 3,
Difference = 4,
Erase = 5,
HardLight = 6,
Invert = 7,
Layer = 8,
Lighten = 9,
Multiply = 10,
Overlay = 11,
Screen = 12,
Subtract = 13
}
///
///
public enum TweenType
{
None = 0,
Line = 1,
Curve = 2,
QuadIn = 3,
QuadOut = 4,
QuadInOut = 5
}
///
///
public enum TimelineType
{
Action = 0,
ZOrder = 1,
BoneAll = 10,
BoneTranslate = 11,
BoneRotate = 12,
BoneScale = 13,
SlotDisplay = 20,
SlotColor = 21,
SlotDeform = 22,
IKConstraint = 30,
AnimationTime = 40,
AnimationWeight = 41
}
///
/// - Offset mode.
///
/// DragonBones 5.5
/// en_US
///
/// - 偏移模式。
///
/// DragonBones 5.5
/// zh_CN
public enum OffsetMode
{
None,
Additive,
Override
}
///
/// - Animation fade out mode.
///
/// DragonBones 4.5
/// en_US
///
/// - 动画淡出模式。
///
/// DragonBones 4.5
/// zh_CN
public enum AnimationFadeOutMode
{
///
/// - Do not fade out of any animation states.
///
/// en_US
///
/// - 不淡出任何的动画状态。
///
/// zh_CN
None = 0,
///
/// - Fade out the animation states of the same layer.
///
/// en_US
///
/// - 淡出同层的动画状态。
///
/// zh_CN
SameLayer = 1,
///
/// - Fade out the animation states of the same group.
///
/// en_US
///
/// - 淡出同组的动画状态。
///
/// zh_CN
SameGroup = 2,
///
/// - Fade out the animation states of the same layer and group.
///
/// en_US
///
/// - 淡出同层并且同组的动画状态。
///
/// zh_CN
SameLayerAndGroup = 3,
///
/// - Fade out of all animation states.
///
/// en_US
///
/// - 淡出所有的动画状态。
///
/// zh_CN
All = 4,
///
/// - Does not replace the animation state with the same name.
///
/// en_US
///
/// - 不替换同名的动画状态。
///
/// zh_CN
Single = 5
}
internal static class Helper
{
public static readonly int INT16_SIZE = 2;
public static readonly int UINT16_SIZE = 2;
public static readonly int FLOAT_SIZE = 4;
internal static void Assert(bool condition, string message)
{
Debug.Assert(condition, message);
}
internal static void ResizeList(this List list, int count, T value = default(T))
{
if (list.Count == count)
{
return;
}
if (list.Count > count)
{
list.RemoveRange(count, list.Count - count);
}
else
{
//fixed gc,may be memory will grow
//list.Capacity = count;
for (int i = list.Count, l = count; i < l; ++i)
{
list.Add(value);
}
}
}
internal static List Convert(this List