Ejemplo n.º 1
0
        public bool GetBaseCount(TileSet root, int index, out int baseIndex, out int count)
        {
            for (int i = 0; i < root.Entries.Count; ++i)
            {
                object o = root.Entries[i];

                if (o is TileSet)
                {
                    if (GetBaseCount((TileSet)o, index, out baseIndex, out count))
                    {
                        return(true);
                    }
                }
                else if (o is TileSetEntry)
                {
                    TileSetEntry tse = (TileSetEntry)o;

                    if (index >= tse.BaseIndex && index < tse.BaseIndex + tse.Count && Array.IndexOf(tse.Tiles, index) >= 0)
                    {
                        baseIndex = tse.BaseIndex;
                        count     = tse.Count;
                        return(true);
                    }
                }
            }

            baseIndex = index;
            count     = 1;

            return(false);
        }
Ejemplo n.º 2
0
        private void tileEntry_Click(object sender, EventArgs e)
        {
            PictureBox   box       = (PictureBox)sender;
            TileSetEntry tileEntry = (TileSetEntry)box.Tag;

            m_Designer.TileCursor = tileEntry;
        }
Ejemplo n.º 3
0
        public void BuildFoundation()
        {
            AddComponent(0, 0, 0, 0x66);
            AddComponent(m_UserWidth - 1, m_UserHeight - 1, 0, 0x65);

            for (int x = 1; x < m_UserWidth; ++x)
            {
                AddComponent(x, m_UserHeight, 0, 0x751);
                AddComponent(x, 0, 0, 0x63);

                if (x < m_UserWidth - 1)
                {
                    AddComponent(x, m_UserHeight - 1, 0, 0x63);
                }
            }

            for (int y = 1; y < m_UserHeight; ++y)
            {
                AddComponent(0, y, 0, 0x64);

                if (y < m_UserHeight - 1)
                {
                    AddComponent(m_UserWidth - 1, y, 0, 0x64);
                }
            }

            TileSetEntry te = new TileSetEntry(0x31F4, 4);

            for (int x = 1; x < m_UserWidth; ++x)
            {
                for (int y = 1; y < m_UserHeight; ++y)
                {
                    AddComponent(x, y, LevelZ[1], 0, te.GetRandomIndex(), te.BaseIndex, te.Count, 0);
                }
            }
        }