Example #1
0
            public AttacherTerreGump(Tresorier tr, Categorie ct, int page)
                : base(0, 0)
            {
                tresorier = tr;
                cat       = ct;
                this.page = page;

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

                AddPage(0);
                AddBackground(31, 48, 416, 440, 9250);
                AddBackground(39, 56, 400, 424, 3500);

                AddLabel(174, 75, 1301, cat.Nom == "" ? @"Rentes et Géopolitique" : cat.Nom);

                if (cat.Parent != null)
                {
                    AddButton(72, 99, 4014, 4015, (int)Buttons.MenuPrecedent, GumpButtonType.Reply, 0);
                    AddLabel(108, 100, 1301, @"Menu Précédent");
                }

                int maxpages = (cat.CategoriesCount + cat.TerresCount) / 10;
                int i        = -1;
                int basey    = 123;
                int offset   = 0;

                foreach (Categorie c in cat.Categories())
                {
                    i++;
                    if (i < page * 10)
                    {
                        continue;
                    }
                    if ((page + 1) * 10 < i)
                    {
                        break;
                    }
                    AddLabel(86, basey + offset * 30 + 1, 1301, c.Nom);
                    AddButton(354, basey + offset * 30, 4005, 4006, 100 + i, GumpButtonType.Reply, 0);
                    offset = (offset + 1) % 10;
                }
                if (i == -1)
                {
                    i = 0;
                }
                int j = -1;

                foreach (Terre t in cat.Terres())
                {
                    j++;
                    if (i + j < page * 10)
                    {
                        continue;
                    }
                    if ((page + 1) * 10 < i + j)
                    {
                        break;
                    }
                    AddLabel(86, basey + offset * 30 + 1, 1301, t.Nom);
                    AddButton(354, basey + offset * 30, 4011, 4012, 200 + j, GumpButtonType.Reply, 0);
                    offset = (offset + 1) % 10;
                }

                if (page < maxpages)
                {
                    AddButton(402, 418, 5601, 5605, (int)Buttons.NextPage, GumpButtonType.Reply, 0);
                }
                if (page > 0)
                {
                    AddButton(59, 418, 5603, 5607, (int)Buttons.PreviousPage, GumpButtonType.Reply, 0);
                }
            }
Example #2
0
        public GeopolGump(Categorie ct, int page) : base(0, 0)
        {
            cat       = ct;
            this.page = page;

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

            AddPage(0);
            AddBackground(31, 48, 416, 550, 9250);
            AddBackground(39, 56, 400, 534, 3500);

            AddLabel(174, 75, 1301, cat.Nom == "" ? @"Rentes et Géopolitique" : cat.Nom);


            if (cat.Parent != null)
            {
                AddButton(72, 99, 4014, 4015, (int)Buttons.MenuPrecedent, GumpButtonType.Reply, 0);
                AddLabel(108, 100, 1301, @"Menu Précédent");
            }

            AddButton(209, 440, 4005, 4006, (int)Buttons.AjouterCategorie, GumpButtonType.Reply, 0);
            AddLabel(64, 441, 1301, @"Ajouter une catégorie");
            AddButton(381, 440, 4005, 4006, (int)Buttons.AjouterTerre, GumpButtonType.Reply, 0);
            AddLabel(261, 441, 1301, @"Ajouter une terre");

            AddImageTiled(67, 472, 342, 3, 96);
            AddImage(61, 463, 95);
            AddImage(408, 463, 97);
            AddLabel(209, 486, 1301, @"Gérer les rentes");
            AddButton(330, 485, 4005, 4006, (int)Buttons.GererRentes, GumpButtonType.Reply, 0);
            AddLabel(177, 516, 1301, @"Supprimer la catégorie");
            AddButton(330, 515, 4017, 4018, (int)Buttons.Supprimer, GumpButtonType.Reply, 0);
            AddLabel(99, 546, 1301, @"Afficher le journal des événements");
            AddButton(330, 545, 4011, 4012, (int)Buttons.AfficherJournal, GumpButtonType.Reply, 0);


            int maxpages = (cat.CategoriesCount + cat.TerresCount) / 10;
            int i        = -1;
            int basey    = 123;
            int offset   = 0;

            foreach (Categorie c in cat.Categories())
            {
                i++;
                if (i < page * 10)
                {
                    continue;
                }
                if ((page + 1) * 10 < i)
                {
                    break;
                }
                AddLabel(86, basey + offset * 30 + 1, 1301, c.Nom);
                AddButton(354, basey + offset * 30, 4005, 4006, 100 + i, GumpButtonType.Reply, 0);
                offset = (offset + 1) % 10;
            }
            if (i == -1)
            {
                i = 0;
            }
            int j = -1;

            foreach (Terre t in cat.Terres())
            {
                j++;
                if (i + j < page * 10)
                {
                    continue;
                }
                if ((page + 1) * 10 < i + j)
                {
                    break;
                }
                AddLabel(86, basey + offset * 30 + 1, 1301, t.Nom);
                AddButton(354, basey + offset * 30, 4011, 4012, 200 + j, GumpButtonType.Reply, 0);
                offset = (offset + 1) % 10;
            }

            if (page < maxpages)
            {
                AddButton(402, 418, 5601, 5605, (int)Buttons.NextPage, GumpButtonType.Reply, 0);
            }
            if (page > 0)
            {
                AddButton(59, 418, 5603, 5607, (int)Buttons.PreviousPage, GumpButtonType.Reply, 0);
            }
        }