예제 #1
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);
                AddButton(maxWidth + 10, maxHeight + 4, 0x93A, 0x93A, "Transparency", new TimerCallback(Trans));
                AddButton(maxWidth + 10, maxHeight + 15, 0x938, 0x938, "Default", new TimerCallback(Default));
                AddButton(maxWidth - 5, maxHeight + 2, 0x2626, 0x2627, "BackgroundDown", new TimerCallback(BackDown));
                AddButton(maxWidth + 19, maxHeight + 2, 0x2622, 0x2623, "BackgroundUp", new TimerCallback(BackUp));
                AddButton(maxWidth - 5, maxHeight + 13, 0x2626, 0x2627, "TextColorDown", new TimerCallback(TextDown));
                AddButton(maxWidth + 19, maxHeight + 13, 0x2622, 0x2623, "TextColorUp", new TimerCallback(TextUp));

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

                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 (!((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;
                    }
                }

                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()); }
        }
예제 #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()); }
        }