Пример #1
0
        void BuildGump()
        {
            ClearControls();
            if (m_Book.ItemID >= 0xFEF && m_Book.ItemID <= 0xFF2)
            {
                m_BookBackground  = new GumpPic(this, 0, 0, 0x1FE, 0);
                m_PageCornerLeft  = new GumpPic(this, 0, 0, 0x1FF, 0);
                m_PageCornerRight = new GumpPic(this, 356, 0, 0x200, 0);
            }
            AddControl(m_BookBackground);   // book background gump
            AddControl(m_PageCornerLeft);   // page turn left
            m_PageCornerLeft.GumpLocalID            = 0;
            m_PageCornerLeft.MouseClickEvent       += PageCorner_MouseClickEvent;
            m_PageCornerLeft.MouseDoubleClickEvent += PageCorner_MouseDoubleClickEvent;
            AddControl(m_PageCornerRight);  // page turn right
            m_PageCornerRight.GumpLocalID            = 1;
            m_PageCornerRight.MouseClickEvent       += PageCorner_MouseClickEvent;
            m_PageCornerRight.MouseDoubleClickEvent += PageCorner_MouseDoubleClickEvent;
            // Draw the title and author page
            m_TitleTextEntry = new TextEntry(this, 45, 50, 155, 300, 1, 0, 0, m_Book.Title);
            m_TitleTextEntry.MakeThisADragger();
            m_TitleTextEntry.IsEditable = m_Book.IsEditable;
            m_AuthorTextEntry           = new TextEntry(this, 45, 110, 160, 300, 1, 0, 0, m_Book.Author);
            m_AuthorTextEntry.MakeThisADragger();
            m_AuthorTextEntry.IsEditable = m_Book.IsEditable;
            AddControl(m_TitleTextEntry, 1);
            AddControl(new HtmlGumpling(this, 45, 90, 155, 300, 0, 0, "<font color=#444>By"), 1);
            AddControl(m_AuthorTextEntry, 1);
            // Add book pages to active pages
            bool   isRight = true;
            string color   = m_Book.IsEditable ? "800" : "000";

            for (int i = 0; i < m_Book.PageCount; i++)
            {
                int onGumpPage = (i + 3) / 2;
                int x          = isRight ? 235 : 45;
                m_Pages.Add(new TextEntryPage(this, x, 32, 155, 300, i));
                m_Pages[i].SetMaxLines(8, OnPageOverflow, OnPageUnderflow);
                m_Pages[i].SetKeyboardPageControls(OnPreviousPage, OnNextPage);
                m_Pages[i].MakeThisADragger();
                m_Pages[i].IsEditable     = m_Book.IsEditable;
                m_Pages[i].LeadingHtmlTag = $"<font color=#{color}>";
                m_Pages[i].Text           = m_Book.Pages[i].GetAllLines();
                AddControl(m_Pages[i], onGumpPage);
                AddControl(new HtmlGumpling(this, x, 195, 135, 20, 0, 0, $"<center><font color=#444>{i + 1}"), onGumpPage);
                isRight = !isRight;
            }
            AudioService service = Service.Get <AudioService>();

            service.PlaySound(0x058);
            SetActivePage(1);
            UserInterface.KeyboardFocusControl = m_Pages[0];
            m_Pages[0].CaratAt = m_Pages[0].Text.Length;
        }