コード例 #1
0
        public AddressBookGump(Mobile owner, int listPage, ArrayList list, int[] count, AddressBook hiya)
            : base(140, 80)
        {
            m_Book = hiya;
            owner.CloseGump(typeof(AddressBookGump));
            m_List = BuildThisList(list);
            //m_List=list;
            if (m_List == null)
                m_List = new ArrayList();

            m_ListPage = listPage;
            m_CountList = count;

            m_Owner = owner;

            Closable = true;
            Disposable = true;
            Dragable = true;
            Resizable = false;

            AddPage(0);

            AddImage(3, 18, 2200);//book
            AddButton(139, 27, 0x8B0, 0x8B0, 91000, GumpButtonType.Reply, 0);

            AddLabel(42, 20, 0, "Add Contact");

            AddLabel(229, 20, 0, "Entries:");
            //Added code for working pages
            if ((m_CountList == null) && (m_List.Count > 6))
                m_CountList = new int[(int)(m_List.Count / 6)];

            if (listPage > 0)
                AddButton(23, 23, 2205, 2205, 90000, GumpButtonType.Reply, 0);

            if ((listPage + 1) * 6 < m_List.Count)
            {
                AddButton(297, 23, 2206, 2206, 90001, GumpButtonType.Reply, 0); //Next page
            }
            if (m_List.Count == 0)
                AddLabel(35, 82, 0x25, "No Entries");

            int k = 0;

            if (listPage > 0)
            {
                for (int z = 0; z < (listPage - 1); ++z)
                {
                    k = k + Convert.ToInt32(m_CountList[z]);
                }
            }

            for (int i = 0, j = 0, index = ((listPage * 6) + k); i < 6 && index >= 0 && index < m_List.Count && j >= 0; ++i, ++j, ++index)
            {
                int offset = 75 + (i * 15);
                
                AdresseeEntry entry = (AdresseeEntry)m_List[index];
                if (entry.Adressee != null && !entry.Adressee.Deleted)
                {
                    AddButton(186, offset, 0x845, 0x846, (index + 1), GumpButtonType.Reply, 0);

                    AddLabel(204, offset, GetHueFor(entry.Adressee), entry.Adressee.Name.ToString());
                }
                else
                    AddLabel(204, offset, 0, entry.Adressee.Name.ToString() + " [Void]");
                if (i == 6)
                {
                    m_CountList[listPage] = (j - 6);
                }
            }
        }
コード例 #2
0
            public FriendTarget(AddressBook item)
                : base(10, false, TargetFlags.None)
            {

                m_Book = item;
            }