Ejemplo n.º 1
0
        public void insertComponent(FrameComponent component, int index)
        {
            if (index < 0)
                index = 0;
            if (index > components.Count)
                index = components.Count;

            components.Insert(index, component);
        }
Ejemplo n.º 2
0
        private List<FrameComponent> getFrameComponents(XElement frameData)
        {
            List<FrameComponent> frameComponents = new List<FrameComponent>();
            foreach (XElement componentData in frameData.Elements("component"))
            {
                string tileSetName = (string)componentData.Attribute("tileset");

                int leftOffset = (int)componentData.Attribute("left");
                int topOffset = (int)componentData.Attribute("top");
                int rectIndex = Convert.ToInt32(componentData.Value);

                int tileSetIndex;
                if (!tileSetNameIdMap.TryGetValue(tileSetName, out tileSetIndex))
                {
                    System.Console.Error.WriteLine("Couldn't find the tileset index for: " + tileSetName);
                }

                FrameComponent frameComponent = new FrameComponent(tileSetIndex, rectIndex, leftOffset, topOffset);
                frameComponents.Add(frameComponent);
            }
            return frameComponents;
        }
Ejemplo n.º 3
0
 public int getComponentIndex(FrameComponent component)
 {
     return components.IndexOf(component);
 }
Ejemplo n.º 4
0
 public void addComponent(FrameComponent component)
 {
     components.Add(component);
 }