Ejemplo n.º 1
0
        public OverrideGump(Mobile m, Type type, TimerCallback callback) : base(m, 100, 100)
        {
            c_Callback = callback;
            c_Info     = GumpInfo.GetInfo(m, type);

            Override = false;

            NewGump();
        }
Ejemplo n.º 2
0
        private void ModifyGump()
        {
            try{
                AddPage(0);

                int            maxWidth  = 0;
                int            maxHeight = 0;
                GumpBackground bg;

                foreach (GumpEntry entry in Entries)
                {
                    if (entry is GumpBackground)
                    {
                        bg = (GumpBackground)entry;

                        if (bg.X + bg.Width > maxWidth)
                        {
                            maxWidth = bg.X + bg.Width;
                        }
                        if (bg.Y + bg.Height > maxHeight)
                        {
                            maxHeight = bg.Y + bg.Height;
                        }
                    }
                }

                AddImage(maxWidth, maxHeight, 0x28DC, 0x387);
                AddItem(maxWidth, maxHeight, 0xFC1);
                AddButton(maxWidth + 2, maxHeight + 16, 0x93A, 0x93A, "Gump Art", new TimerCallback(GumpArt));

                if (!GumpInfo.HasMods(c_Owner, GetType()))
                {
                    return;
                }

                GumpInfo  info  = GumpInfo.GetInfo(c_Owner, GetType());
                ArrayList backs = new ArrayList();

                foreach (GumpEntry entry in new ArrayList(Entries))
                {
                    if (entry is GumpBackground)
                    {
                        if (info.Background != -1)
                        {
                            ((GumpBackground)entry).GumpID = info.Background;
                        }

                        backs.Add(entry);
                    }
                    else if (entry is GumpAlphaRegion && !info.DefaultTrans && !info.Transparent)
                    {
                        ((GumpAlphaRegion)entry).Width  = 0;
                        ((GumpAlphaRegion)entry).Height = 0;
                    }
                    else if (entry is HtmlPlus)
                    {
                        if ((int)((HtmlPlus)entry).Template != -1)
                        {
                            ButtonTemplate.RemoveTemplate((HtmlPlus)entry, ((HtmlPlus)entry).Template);
                            ButtonTemplate.ApplyTemplate((HtmlPlus)entry, info.Template);
                        }

                        if (!((HtmlPlus)entry).Override || info.TextColorRGB == "")
                        {
                            continue;
                        }

                        string text   = ((HtmlPlus)entry).Text;
                        int    num    = 0;
                        int    length = 0;
                        char[] chars;

                        if (text == null)
                        {
                            continue;
                        }

                        while ((num = text.ToLower().IndexOf("<basefont")) != -1 || (num = text.ToLower().IndexOf("</font")) != -1)
                        {
                            length = 0;
                            chars  = text.ToCharArray();

                            for (int i = num; i < chars.Length; ++i)
                            {
                                if (chars[i] == '>')
                                {
                                    length = i - num + 1;
                                    break;
                                }
                            }

                            if (length == 0)
                            {
                                break;
                            }

                            text = text.Substring(0, num) + text.Substring(num + length, text.Length - num - length);
                        }

                        ((HtmlPlus)entry).Text = info.TextColor + text;
                    }
                    else if (entry is ButtonPlus && (int)((ButtonPlus)entry).Template != -1)
                    {
                        ButtonTemplate.RemoveTemplate((ButtonPlus)entry, ((ButtonPlus)entry).Template);
                        ButtonTemplate.ApplyTemplate((ButtonPlus)entry, info.Template);
                    }
                }

                if (!info.DefaultTrans && info.Transparent)
                {
                    foreach (GumpBackground back in backs)
                    {
                        AddAlphaRegion(back.X, back.Y, back.Width, back.Height);
                    }
                }

                SortEntries();
            }catch { Errors.Report("GumpPlus-> ModifyGump-> " + GetType()); }
        }