Exemplo n.º 1
0
        public CarpetAddon(int type, int width, int height)
        {
            CarpetInfo info = CarpetInfo.GetInfo(type);

            AddComponent(new AddonComponent(info.GetItemPart(Position.Top).ItemID), 0, 0, 0);
            AddComponent(new AddonComponent(info.GetItemPart(Position.Right).ItemID), width, 0, 0);
            AddComponent(new AddonComponent(info.GetItemPart(Position.Left).ItemID), 0, height, 0);
            AddComponent(new AddonComponent(info.GetItemPart(Position.Bottom).ItemID), width, height, 0);

            int w = width - 1;
            int h = height - 1;

            for (int y = 1; y <= h; ++y)
            {
                AddComponent(new AddonComponent(info.GetItemPart(Position.West).ItemID), 0, y, 0);
                AddComponent(new AddonComponent(info.GetItemPart(Position.East).ItemID), width, y, 0);
            }

            for (int x = 1; x <= w; ++x)
            {
                AddComponent(new AddonComponent(info.GetItemPart(Position.North).ItemID), x, 0, 0);
                AddComponent(new AddonComponent(info.GetItemPart(Position.South).ItemID), x, height, 0);
            }

            for (int x = 1; x <= w; ++x)
            {
                for (int y = 1; y <= h; ++y)
                {
                    AddComponent(new AddonComponent(info.GetItemPart(Position.Center).ItemID), x, y, 0);
                }
            }
        }
Exemplo n.º 2
0
        public CarpetGump(BaseAddonDeed deed, IPoint3D p, Map map, int width, int height) : base(30, 30)
        {
            m_Deed   = deed;
            m_P3D    = p;
            m_Map    = map;
            m_Width  = width;
            m_Height = height;

            AddPage(0);

            AddBackground(0, 0, 450, 180, 9200);

            AddAlphaRegion(12, 12, 381, 22);
            AddHtml(13, 13, 379, 20, "<BASEFONT COLOR=WHITE>Choose a carpet type</BASEFONT>", false, false);

            AddAlphaRegion(398, 12, 40, 22);
            AddAlphaRegion(12, 39, 426, 129);

            AddImage(400, 16, 9766);
            AddImage(420, 16, 9762);
            AddPage(1);

            int page = 1;

            for (int i = 0, index = 0; i < CarpetInfo.Infos.Length; ++i, ++index)
            {
                if (index >= EntryCount)
                {
                    if ((EntryCount * page) == EntryCount)
                    {
                        AddImage(400, 16, 0x2626);
                    }

                    AddButton(420, 16, 0x15E1, 0x15E5, 0, GumpButtonType.Page, page + 1);

                    ++page;
                    index = 0;

                    AddPage(page);

                    AddButton(400, 16, 0x15E3, 0x15E7, 0, GumpButtonType.Page, page - 1);

                    if ((CarpetInfo.Infos.Length - (EntryCount * page)) < EntryCount)
                    {
                        AddImage(420, 16, 0x2622);
                    }
                }

                CarpetInfo info = CarpetInfo.GetInfo(i);

                for (int j = 0; j < info.Entries.Length; ++j)
                {
                    AddItem(20 + (index * 140) + info.Entries[j].OffsetX, 46 + info.Entries[j].OffsetY, info.Entries[j].ItemID);
                }

                AddButton(20 + (index * 140), 46, 1209, 1210, i + 1, GumpButtonType.Reply, 0);
            }
        }
Exemplo n.º 3
0
        public void UpdateComponents()
        {
            for (int i = Components.Count - 1; i >= 0; i--)
            {
                if (Components[i] != null && !Components[i].Deleted)
                {
                    Components[i].Delete();
                }
            }

            Components.Clear();

            CarpetInfo info = CarpetInfo.GetInfo(m_Type);

            AddComponent(new AddonComponent(info.GetCarpetPart(Position.Top).ItemID), 0, 0, 0);
            AddComponent(new AddonComponent(info.GetCarpetPart(Position.Right).ItemID), m_Width, 0, 0);
            AddComponent(new AddonComponent(info.GetCarpetPart(Position.Left).ItemID), 0, m_Height, 0);
            AddComponent(new AddonComponent(info.GetCarpetPart(Position.Bottom).ItemID), m_Width, m_Height, 0);

            int w = m_Width - 1;
            int h = m_Height - 1;

            for (int y = 1; y <= h; ++y)
            {
                AddComponent(new AddonComponent(info.GetCarpetPart(Position.West).ItemID), 0, y, 0);
                AddComponent(new AddonComponent(info.GetCarpetPart(Position.East).ItemID), m_Width, y, 0);
            }

            for (int x = 1; x <= w; ++x)
            {
                AddComponent(new AddonComponent(info.GetCarpetPart(Position.North).ItemID), x, 0, 0);
                AddComponent(new AddonComponent(info.GetCarpetPart(Position.South).ItemID), x, m_Height, 0);
            }

            for (int x = 1; x <= w; ++x)
            {
                for (int y = 1; y <= h; ++y)
                {
                    AddComponent(new AddonComponent(info.GetCarpetPart(Position.Center).ItemID), x, y, 0);
                }
            }
        }