Ejemplo n.º 1
0
            public InternalGump(BaseLocalizedBook book)
                : base(50, 50)
            {
                m_Book = book;
                int page = 0;
                int pages = (int)Math.Ceiling(m_Book.Contents.Length / 2.0);

                AddPage(page);
                AddImage(0, 0, 500);

                page++;
                AddPage(page);
                
                if (book.Title is int)
                    AddHtmlLocalized(Page1X, 60, Width, 48, (int)book.Title, false, false);
                else if (book.Title is string)
                    AddHtml(Page1X, 60, Width, 48, (string)book.Title, false, false);
                else
                    AddLabel(Page1X, 60, 0, "A Book");

                AddHtml(40, 130, 200, 16, "by", false, false);

                if (book.Author is int)
                    AddHtmlLocalized(Page1X, 155, Width, 16, (int)book.Author, false, false);
                else if (book.Author is string)
                    AddHtml(Page1X, 155, Width, 16, (string)book.Author, false, false);
                else
                    AddLabel(Page1X, 155, 0, "unknown");

                for (int i = 0; i < m_Book.Contents.Length; i++)
                {
                    int cliloc = m_Book.Contents[i];
                    bool endPage = false;
                    int x = Page1X;

                    if (cliloc <= 0)
                        continue;

                    if (page == 1)
                    {
                        x = Page2X;
                        endPage = true;
                    }
                    else
                    {
                        if ((i + 1) % 2 == 0)
                            x = Page1X;
                        else if (page <= pages)
                        {
                            endPage = true;
                            x = Page2X;
                        }
                    }

                    AddHtmlLocalized(x, StartY, Width, Height, cliloc, false, false);

                    if (page < pages)
                        AddButton(356, 0, 502, 502, 0, GumpButtonType.Page, page + 1);

                    if (page > 0)
                        AddButton(0, 0, 501, 501, 0, GumpButtonType.Page, page - 1);

                    if (endPage)
                    {
                        page++;
                        AddPage(page);
                    }
                }
            }
Ejemplo n.º 2
0
            public BaseLocalizedBookGump(BaseLocalizedBook book)
                : base(50, 50)
            {
                m_Book = book;
                int page  = 0;
                int pages = (int)Math.Ceiling(m_Book.Contents.Length / 2.0);

                AddPage(page);
                AddImage(0, 0, 500);

                page++;
                AddPage(page);

                if (book.Title is int)
                {
                    AddHtmlLocalized(Page1X, 60, Width, 48, (int)book.Title, false, false);
                }
                else if (book.Title is string)
                {
                    AddHtml(Page1X, 60, Width, 48, (string)book.Title, false, false);
                }
                else
                {
                    AddLabel(Page1X, 60, 0, "A Book");
                }

                AddHtml(40, 130, 200, 16, "by", false, false);

                if (book.Author is int)
                {
                    AddHtmlLocalized(Page1X, 155, Width, 16, (int)book.Author, false, false);
                }
                else if (book.Author is string)
                {
                    AddHtml(Page1X, 155, Width, 16, (string)book.Author, false, false);
                }
                else
                {
                    AddLabel(Page1X, 155, 0, "unknown");
                }

                for (int i = 0; i < m_Book.Contents.Length; i++)
                {
                    int  cliloc  = m_Book.Contents[i];
                    bool endPage = false;
                    int  x       = Page1X;

                    if (cliloc <= 0)
                    {
                        continue;
                    }

                    if (page == 1)
                    {
                        x       = Page2X;
                        endPage = true;
                    }
                    else
                    {
                        if ((i + 1) % 2 == 0)
                        {
                            x = Page1X;
                        }
                        else if (page <= pages)
                        {
                            endPage = true;
                            x       = Page2X;
                        }
                    }

                    AddHtmlLocalized(x, StartY, Width, Height, cliloc, false, false);

                    if (page < pages)
                    {
                        AddButton(356, 0, 502, 502, 0, GumpButtonType.Page, page + 1);
                    }

                    if (page > 0)
                    {
                        AddButton(0, 0, 501, 501, 0, GumpButtonType.Page, page - 1);
                    }

                    if (endPage)
                    {
                        page++;
                        AddPage(page);
                    }
                }
            }
Ejemplo n.º 3
0
            public InternalGump(BaseLocalizedBook book)
                : base(245, 200)
            {
                TypeID = 0x237B;
                m_Book = book;
                int page  = 0;
                int pages = (int)Math.Ceiling(m_Book.Contents.Length / 2.0);

                AddImage(0, 0, 0x1FE);

                page++;
                AddPage(page);

                if (book.Title is int iTitle)
                {
                    AddHtmlLocalized(40, 30, 150, 48, iTitle, 0x0, false, false);
                }
                else if (book.Title is string sTitle)
                {
                    AddHtml(40, 30, 150, 48, sTitle, false, false);
                }
                else
                {
                    AddLabel(40, 30, 0, "A Book");
                }

                AddHtmlLocalized(40, 160, 150, 16, 1113300, 0x0, false, false); // by

                if (book.Author is int iAuthor)
                {
                    AddHtmlLocalized(40, 180, 150, 32, iAuthor, 0x0, false, false);
                }
                else if (book.Author is string sAuthor)
                {
                    AddHtml(40, 180, 150, 32, sAuthor, false, false);
                }
                else
                {
                    AddLabel(40, 180, 0, "unknown");
                }

                for (int i = 0; i < m_Book.Contents.Length; i++)
                {
                    int  cliloc  = m_Book.Contents[i];
                    bool endPage = false;
                    int  x       = 40;
                    int  y       = 30;
                    int  width   = 145;

                    if (cliloc <= 0)
                    {
                        continue;
                    }

                    if (page == 1)
                    {
                        x       = 230;
                        endPage = true;
                    }
                    else
                    {
                        if ((i + 1) % 2 == 0)
                        {
                            x     = 40;
                            y     = 35;
                            width = 150;
                        }
                        else if (page <= pages)
                        {
                            endPage = true;
                            x       = 230;
                        }
                    }

                    AddHtmlLocalized(x, y, width, 160, cliloc, 0x0, false, false);

                    if ((i + 1) % 2 == 0)
                    {
                        AddLabel(90, 200, 0x0, string.Format(" {0}", i + 1));
                    }
                    else
                    {
                        AddLabel(250, 200, 0x0, string.Format("      {0}", i + 1));
                    }

                    if (page < pages)
                    {
                        AddButton(356, 0, 0x200, 0x200, 0, GumpButtonType.Page, page + 1);
                    }

                    if (page - 1 > 0)
                    {
                        AddButton(0, 0, 0x1FF, 0x1FF, 0, GumpButtonType.Page, page - 1);
                    }

                    if (endPage)
                    {
                        page++;
                        AddPage(page);
                    }
                }
            }