public void insertComponent(FrameComponent component, int index) { if (index < 0) index = 0; if (index > components.Count) index = components.Count; components.Insert(index, component); }
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; }
public int getComponentIndex(FrameComponent component) { return components.IndexOf(component); }
public void addComponent(FrameComponent component) { components.Add(component); }