コード例 #1
0
ファイル: Frame.cs プロジェクト: TheVirtualBoys/TOJam8
        public void insertComponent(FrameComponent component, int index)
        {
            if (index < 0)
                index = 0;
            if (index > components.Count)
                index = components.Count;

            components.Insert(index, component);
        }
コード例 #2
0
ファイル: GameData.cs プロジェクト: TheVirtualBoys/TOJam8
        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;
        }
コード例 #3
0
ファイル: Frame.cs プロジェクト: TheVirtualBoys/TOJam8
 public int getComponentIndex(FrameComponent component)
 {
     return components.IndexOf(component);
 }
コード例 #4
0
ファイル: Frame.cs プロジェクト: TheVirtualBoys/TOJam8
 public void addComponent(FrameComponent component)
 {
     components.Add(component);
 }