/** * 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; using System.Collections.Generic; using System.Text; namespace DragonBones { /// /// - The DragonBones data. /// A DragonBones data contains multiple armature data. /// /// /// DragonBones 3.0 /// en_US /// /// - 龙骨数据。 /// 一个龙骨数据包含多个骨架数据。 /// /// /// DragonBones 3.0 /// zh_CN public class DragonBonesData : BaseObject { /// public bool autoSearch; /// /// - The animation frame rate. /// /// DragonBones 3.0 /// en_US /// /// - 动画帧频。 /// /// DragonBones 3.0 /// zh_CN public uint frameRate; /// /// - The data version. /// /// DragonBones 3.0 /// en_US /// /// - 数据版本。 /// /// DragonBones 3.0 /// zh_CN public string version; /// /// - The DragonBones data name. /// The name is consistent with the DragonBones project name. /// /// DragonBones 3.0 /// en_US /// /// - 龙骨数据名称。 /// 该名称与龙骨项目名保持一致。 /// /// DragonBones 3.0 /// zh_CN public string name; /// public ArmatureData stage; /// /// public readonly List frameIndices = new List(); /// /// public readonly List cachedFrames = new List(); /// /// - All armature data names. /// /// DragonBones 3.0 /// en_US /// /// - 所有的骨架数据名称。 /// /// DragonBones 3.0 /// zh_CN public readonly List armatureNames = new List(); /// public readonly Dictionary armatures = new Dictionary(); /// /// internal byte[] binary; /// /// internal short[] intArray; /// /// internal float[] floatArray; /// /// internal short[] frameIntArray; /// /// internal float[] frameFloatArray; /// /// internal short[] frameArray; /// /// internal ushort[] timelineArray; /// internal UserData userData = null; // Initial value. /// protected override void _OnClear() { foreach (var k in this.armatures.Keys) { this.armatures[k].ReturnToPool(); } if (this.userData != null) { this.userData.ReturnToPool(); } this.autoSearch = false; this.frameRate = 0; this.version = ""; this.name = ""; this.stage = null; this.frameIndices.Clear(); this.cachedFrames.Clear(); this.armatureNames.Clear(); this.armatures.Clear(); this.binary = null; this.intArray = null; // this.floatArray = null; // this.frameIntArray = null; // this.frameFloatArray = null; // this.frameArray = null; // this.timelineArray = null; // this.userData = null; } /// /// public void AddArmature(ArmatureData value) { if (this.armatures.ContainsKey(value.name)) { Helper.Assert(false, "Same armature: " + value.name); this.armatures[value.name].ReturnToPool(); } value.parent = this; this.armatures[value.name] = value; this.armatureNames.Add(value.name); } /// /// - Get a specific armature data. /// /// - The armature data name. /// DragonBones 3.0 /// en_US /// /// - 获取特定的骨架数据。 /// /// - 骨架数据名称。 /// DragonBones 3.0 /// zh_CN public ArmatureData GetArmature(string armatureName) { return this.armatures.ContainsKey(armatureName) ? this.armatures[armatureName] : null; } } }