Exemple #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);
        }
Exemple #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;
        }
Exemple #3
0
 public int getComponentIndex(FrameComponent component)
 {
     return components.IndexOf(component);
 }
Exemple #4
0
 public void addComponent(FrameComponent component)
 {
     components.Add(component);
 }