Example #1
0
        protected TimelineKey GetTimelineKey(XmlElement element, Animation animation)
        {
            int timeline = element.GetInt("timeline", 0);
            int key = element.GetInt("key", 0);

            var timelineObj = animation.GetTimeline(timeline);
            if (timelineObj == null)
            {
                Debug.LogError(String.Format(
                    System.Globalization.CultureInfo.InvariantCulture,
                    "Unable to find timeline {0} in animation {1}",
                    timeline,
                    animation.Id));
            }
            return timelineObj.GetKey(key);
        }
        File GetFile(XmlElement element)
        {
            var folderId = element.GetInt("folder", -1);
            var fileId = element.GetInt("file", -1);

            File file = null;
            var folder = Timeline.Animation.Entity.Scml.GetFolder(folderId);
            if (folder != null)
            {
                file = folder.GetFile(fileId);
                if (file == null)
                {
                    Debug.LogError(string.Format("File Not Found! folder: {0}   file: {1}", folderId, fileId));
                }
            }
            else
            {
                Debug.LogError(string.Format("Folder Not Found!  folder: {0}", folderId));
            }
            return file;
        }
Example #3
0
        protected virtual void Parse(XmlElement element, Entity entity)
		{
			Entity = entity;

            Name = element.GetString("name", "");
            Length_Ms = element.GetInt("length", -1);
            LoopType = LoopTypeUtils.Parse(element);
            LoopTo = element.GetInt("loop_to", 0);

            LoadTimelines(element);
            LoadMainline(element);
        }
Example #4
0
 protected override void Parse(XmlElement element)
 {
     base.Parse(element);
     ZIndex = element.GetInt("z_index", Id);
 }
Example #5
0
 protected virtual void Parse(XmlElement element)
 {
     Id = element.GetInt("id", -1);
 }
Example #6
0
        private void Parse(XmlElement element, SpriterAnimation animation, MainlineKey parentKey)
        {
            Referenced = GetTimelineKey(element, animation);

            int parentId = element.GetInt("parent", -1);
            if(parentId >= 0)
            {
                Parent = parentKey.GetBoneRef(parentId);
            }
        }
        protected virtual void Parse(XmlElement element)
        {
            Vector2 position;
            position.x = element.GetFloat("x", 0.0f);
            position.y = element.GetFloat("y", 0.0f);
            Position = position;

            Vector2 scale = Vector2.one;
            scale.x = element.GetFloat("scale_x", 1.0f);
            scale.y = element.GetFloat("scale_y", 1.0f);
            Scale = scale;

            Angle_Deg = element.GetFloat("angle", 0.0f);

            int spinVal = element.GetInt("spin", 1);
            Spin = (spinVal == -1) ? SpinDirection.Clockwise : SpinDirection.CounterClockwise;
        }
Example #8
0
        protected override void Parse(XmlElement element)
        {
            base.Parse(element);

            Time_Ms = element.GetInt("time", 0);
        }
Example #9
0
        protected virtual void Parse(XmlElement element, Folder folder)
        {
            Folder = folder;

            var type = element.GetString("type", "image");
            switch(type)
            {
                case "image":
                    FileType = FileType.Image;
                    break;
                case "atlas_image":
                    FileType = FileType.AtlasImage;
                    break;
                case "sound_effect":
                    FileType = FileType.SoundEffect;
                    break;
                case "entity":
                    FileType = FileType.Entity;
                    break;
                default:
                    FileType = FileType.INVALID_TYPE;
                    break;
            }

            Name = element.GetString("name", "");

            Vector2 pivot;
            pivot.x = element.GetFloat("pivot_x", 0.0f);
            pivot.y = element.GetFloat("pivot_y", 0.0f);
            Pivot = pivot;

            Vector2 size;
            size.x = element.GetInt("width", 0);
            size.y = element.GetInt("height", 0);
            Size = size;

            Vector2 offset;
            offset.x = element.GetInt("offset_x", 0);
            offset.y = element.GetInt("offset_y", 0);
            Offset = offset;

            Vector2 originalSize;
            originalSize.x = element.GetInt("original_width", 0);
            originalSize.y = element.GetInt("original_height", 0);
            OriginalSize = originalSize;
        }
Example #10
0
        protected virtual void Parse(XmlElement element)
        {
            Vector2 position;
            position.x = element.GetFloat("x", 0.0f);
            position.y = element.GetFloat("y", 0.0f);
            Position = position;

            Vector2 scale = Vector2.one;
            scale.x = element.GetFloat("scale_x", 1.0f);
            scale.y = element.GetFloat("scale_y", 1.0f);
            Scale = scale;

            Angle_Deg = element.GetFloat("angle", 0.0f);

            Spin = (SpinDirection)element.GetInt("spin", 1);
        }