Example #1
0
        public TopicGump(Mobile GM, Bible bible, int topic) : base(20, 20)
        {
            m_GM = GM;
            m_GM.CloseGump(typeof(TopicGump));
            m_Bible = bible;
            m_Topic = topic;

            m_Book    = (int)(m_Bible.Book);
            m_Chapter = m_Bible.Chapter;

            AddPage(0);
            AddBackground(0, 0, 696, 540, 0x13BE);

            string str1, str2, str;

            int[,] verses;
            int    verselength, topiclength, ymax;
            string verse = "";

            verses      = TopicReader.GetTopicVerses((Topic)m_Topic);
            topiclength = verses.GetLength(0);
            if (topiclength < 17)
            {
                ymax = topiclength;
            }
            else
            {
                ymax = 16;
            }
            AddLabel(200, 7, 500, BibleReader.ToTitleCase(TopicReader.GetTopicName((Topic)m_Topic)));
            AddResetButton(15, 510, 400, "Home");
            if (m_Topic > 0)
            {
                AddBkwdButton(345, 510, m_Topic - 1, "Prev Topic");
            }
            if (m_Topic < 303)
            {
                AddFwdButton(645, 510, m_Topic + 1, "Next Topic");
            }
            for (int y = 0; y < ymax; y++)
            {
                try
                {
                    verse       = BibleReader.GetVerse(verses[y, 0], verses[y, 1], verses[y, 2]);
                    verselength = verse.Length < 68 ? verse.Length - 8 : 60;
                    str1        = BibleReader.Books[verses[y, 0]] + " " + verses[y, 1].ToString() + " : ";
                    str2        = verse.Substring(7, verselength) + "...";
                    str         = str1 + str2;
                    AddButton(15, 29 + (y * 24), 5541, 5542, y + 500 + (m_Topic * 1000), GumpButtonType.Reply, 0);
                    AddHtml(50, 30 + (y * 24), 635, 20, Color(str, 0x480), false, false);
                }
                catch
                {
                    break;
                }
            }
        }