public SkillButtonGump(Skill skill, int x, int y) : base(0, 0)
        {
            X                      = x;
            Y                      = y;
            CanMove                = true;
            AcceptMouseInput       = false;
            CanCloseWithRightClick = true;
            _skill                 = skill;

            AddChildren(_buttonBackgroundNormal = new ResizePic(0x24B8)
            {
                Width = 120, Height = 40
            });

            AddChildren(_buttonBackgroundOver = new ResizePic(0x24EA)
            {
                Width = 120, Height = 40
            });

            AddChildren(new HoveredLabel(skill.Name, true, 0, 1151, 105, 1, FontStyle.None, TEXT_ALIGN_TYPE.TS_CENTER)
            {
                X                = 7,
                Y                = 5,
                Height           = 35,
                AcceptMouseInput = true,
                CanMove          = true
            });
        }
Beispiel #2
0
        private void BuildGump()
        {
            Width  = 88;
            Height = 44;

            Add(_buttonBackgroundNormal = new ResizePic(0x24B8)
            {
                Width  = Width,
                Height = Height
            });

            Add(_buttonBackgroundOver = new ResizePic(0x24EA)
            {
                Width  = Width,
                Height = Height
            });

            Add(_label = new HoveredLabel(_skill.Name, true, 0, 1151, Width - 10, 1, FontStyle.None, TEXT_ALIGN_TYPE.TS_CENTER)
            {
                X                = 5,
                Y                = 5,
                Width            = Width - 10,
                AcceptMouseInput = true,
                CanMove          = true
            });
            _label.Y = (Height / 2) - (_label.Height / 2);
        }
Beispiel #3
0
        public override void Update(double totalMS, double frameMS)
        {
            if (IsInitialized && _text == null)
            {
                ResizePic resize;
                _text = new HtmlGumpling(this, 10, 10, 200, 200, 0, 0, _msg);
                int width = _text.Width + 20;
                AddControl(resize = new ResizePic(this, 0, 0, 9200, width, _text.Height + 45));
                AddControl(_text);
                // Add buttons
                switch (_type)
                {
                case MsgBoxTypes.OkOnly:
                    AddControl(new Button(this, (_text.Width + 20) / 2 - 23, _text.Height + 15, 2074, 2075, ButtonTypes.Activate, 0, 0));
                    ((Button)LastControl).GumpOverID = 2076;
                    break;

                case MsgBoxTypes.OkCancel:
                    AddControl(new Button(this, (width / 2) - 46 - 10, _text.Height + 15, 0x817, 0x818, ButtonTypes.Activate, 0, 1));
                    ((Button)LastControl).GumpOverID = 0x819;
                    AddControl(new Button(this, (width / 2) + 10, _text.Height + 15, 2074, 2075, ButtonTypes.Activate, 0, 0));
                    ((Button)LastControl).GumpOverID = 2076;
                    break;
                }

                base.Update(totalMS, frameMS);
                CenterThisControlOnScreen();
            }
            base.Update(totalMS, frameMS);
        }
        public ProfessionInfoGump(ProfessionInfo info)
        {
            _info = info;

            ClilocLoader localization = ClilocLoader.Instance;

            ResizePic background = new ResizePic(3000)
            {
                Width  = 175,
                Height = 34
            };

            background.SetTooltip(localization.GetString(info.Description), 250);

            Add(background);

            Add
            (
                new Label(localization.GetString(info.Localization), true, 0x00, font: 1)
            {
                X = 7,
                Y = 8
            }
            );

            Add(new GumpPic(121, -12, info.Graphic, 0));
        }
Beispiel #5
0
        private void BuildGump()
        {
            Width  = 120;
            Height = 40;

            Add(_buttonBackgroundNormal = new ResizePic(0x24B8)
            {
                Width  = 120,
                Height = 40
            });

            Add(_buttonBackgroundOver = new ResizePic(0x24EA)
            {
                Width  = 120,
                Height = 40
            });

            Add(new HoveredLabel(_skill.Name, true, 0, 1151, 105, 1, FontStyle.None, TEXT_ALIGN_TYPE.TS_CENTER)
            {
                X                = 7,
                Y                = 5,
                Height           = 35,
                AcceptMouseInput = true,
                CanMove          = true
            });
        }
Beispiel #6
0
 internal GumpBackGround(ResizePic bg)
 {
     Location  = new Point2D(bg.X, bg.Y);
     Size      = new Size(bg.Height, bg.Width);
     GumpID    = bg.GumpId;
     Page      = bg.Page;
     ElementID = bg.ElemNum;
 }
Beispiel #7
0
        public MessageBoxGump(int w, int h, string message, Action <bool> action, bool hasBackground = false) : base(0, 0)
        {
            CanMove = true;
            CanCloseWithRightClick = false;
            CanCloseWithEsc        = false;
            AcceptMouseInput       = false;

            ControlInfo.IsModal = true;
            ControlInfo.Layer   = UILayer.Over;
            WantUpdateSize      = false;

            Width   = w;
            Height  = h;
            _action = action;

            Add(new ResizePic(0x0A28)
            {
                Width = w, Height = h
            });

            if (hasBackground)
            {
                ResizePic background = new ResizePic(3000)
                {
                    X      = X + 30,
                    Y      = Y + 40,
                    Width  = Width - 60,
                    Height = Height - 100
                };

                Add(background);
            }

            Add(new Label(message, false, 0x0386, Width - 90, 1)
            {
                X = 40,
                Y = 45
            });

            X = (Client.Game.Window.ClientBounds.Width - Width) >> 1;
            Y = (Client.Game.Window.ClientBounds.Height - Height) >> 1;

            // OK
            Button b;

            Add(b = new Button(0, 0x0481, 0x0483, 0x0482)
            {
                Y            = Height - 45,
                ButtonAction = ButtonAction.Activate
            });

            b.X = (Width - b.Width) >> 1;

            WantUpdateSize = false;
        }
Beispiel #8
0
 private void OnResize()
 {
     if (Service.Has <ChatControl>())
     {
         Service.Remove <ChatControl>();
     }
     ClearControls();
     Size = new Vector2Int(_worldWidth + BorderWidth * 2, _worldHeight + BorderHeight * 2);
     AddControl(_border     = new ResizePic(this, 0, 0, 0xa3c, Width, Height));
     AddControl(_viewport   = new WorldViewport(this, BorderWidth, BorderHeight, _worldWidth, _worldHeight));
     AddControl(_chatWindow = new ChatControl(this, BorderWidth, BorderHeight, _worldWidth, _worldHeight));
     Service.Add <ChatControl>(_chatWindow);
 }
Beispiel #9
0
        private void OnResize()
        {
            if (Service.Has <ChatControl>())
            {
                Service.Remove <ChatControl>();
            }

            ClearControls();

            Size = new Point(m_WorldWidth + BorderWidth * 2, m_WorldHeight + BorderHeight * 2);
            AddControl(m_Border     = new ResizePic(this, 0, 0, 0xa3c, Width, Height));
            AddControl(m_Viewport   = new WorldViewport(this, BorderWidth, BorderHeight, m_WorldWidth, m_WorldHeight));
            AddControl(m_ChatWindow = new ChatControl(this, BorderWidth, BorderHeight, m_WorldWidth, m_WorldHeight));
            Service.Add <ChatControl>(m_ChatWindow);
        }
Beispiel #10
0
        private void OnResize()
        {
            if (ServiceRegistry.ServiceExists <ChatControl>())
            {
                ServiceRegistry.Unregister <ChatControl>();
            }

            ClearControls();

            Size = new Point(m_WorldWidth + BorderWidth * 2, m_WorldHeight + BorderHeight * 2);
            AddControl(m_Border     = new ResizePic(this, 0, 0, 0xa3c, Width, Height));
            AddControl(m_Viewport   = new WorldViewport(this, BorderWidth, BorderHeight, m_WorldWidth, m_WorldHeight));
            AddControl(m_ChatWindow = new ChatControl(this, BorderWidth, BorderHeight, 400, m_WorldHeight));
            ServiceRegistry.Register <ChatControl>(m_ChatWindow);
        }
Beispiel #11
0
        public ContextMenuGump(ContextMenuData data)
            : base(0, 0)
        {
            m_Data = data;

            IResourceProvider provider = ServiceRegistry.GetService <IResourceProvider>();
            AFont             font     = (AFont)provider.GetUnicodeFont(1);

            m_Background = (ResizePic)AddControl(new ResizePic(this, 0, 0, 0x0A3C, 50, font.Height * m_Data.Count + 20));

            StringBuilder htmlContextItems = new StringBuilder();

            for (int i = 0; i < m_Data.Count; i++)
            {
                htmlContextItems.Append(string.Format("<a href='{0}' color='#DDD' hovercolor='#FFF' activecolor='#BBB' style='text-decoration:none;'>{1}</a><br/>", m_Data[i].ResponseCode, m_Data[i].Caption));
            }
            m_MenuItems = (HtmlGumpling)AddControl(new HtmlGumpling(this, 10, 10, 200, font.Height * m_Data.Count, 0, 0, htmlContextItems.ToString()));
        }
Beispiel #12
0
        public PopupMenuGump(PopupMenuData data) : base(0, 0)
        {
            CanMove = false;
            CanCloseWithRightClick = true;


            ResizePic pic = new ResizePic(0x0A3C)
            {
                Alpha = 0.25f
            };

            Add(pic);
            int  offsetY = 10;
            bool arrowAdded = false;
            int  width = 0, height = 20;

            for (int i = 0; i < data.Items.Length; i++)
            {
                ref readonly var item = ref data.Items[i];
Beispiel #13
0
        public ContextMenuGump(ContextMenuData data)
            : base(0, 0)
        {
            MetaData.IsModal = true;
            MetaData.ModalClickOutsideAreaClosesThisControl = true;

            _data = data;

            var provider = Service.Get <IResourceProvider>();
            var font     = (AFont)provider.GetUnicodeFont(1);

            _background = (ResizePic)AddControl(new ResizePic(this, 0, 0, 0x0A3C, 50, font.Height * _data.Count + 20));

            var htmlContextItems = new StringBuilder();

            for (var i = 0; i < _data.Count; i++)
            {
                htmlContextItems.Append(string.Format("<a href='{0}' color='#DDD' hovercolor='#FFF' activecolor='#BBB' style='text-decoration:none;'>{1}</a><br/>", _data[i].ResponseCode, _data[i].Caption));
            }
            _menuItems = (HtmlGumpling)AddControl(new HtmlGumpling(this, 10, 10, 200, font.Height * _data.Count, 0, 0, htmlContextItems.ToString()));
        }
Beispiel #14
0
        public ProfessionInfoGump(ProfessionInfo info)
        {
            _info = info;

            ClilocLoader localization = FileManager.Cliloc;

            ResizePic background = new ResizePic(3000)
            {
                Width  = 175,
                Height = 34,
            };

            background.SetTooltip(localization.Translate(info.Description), 250);

            Add(background);

            Add(new Label(localization.Translate(info.Localization), true, 0x00, font: 1)
            {
                X = 7,
                Y = 8,
            });

            Add(new GumpPic(121, -12, info.Graphic, 0));
        }
        public MessageBoxGump(int w, int h, string message, Action <bool> action, bool hasBackground = false, MessageButtonType menuType = MessageButtonType.OK) : base(0, 0)
        {
            CanMove = true;
            CanCloseWithRightClick = false;
            CanCloseWithEsc        = false;
            AcceptMouseInput       = true;
            AcceptKeyboardInput    = true;

            IsModal        = true;
            LayerOrder     = UILayer.Over;
            WantUpdateSize = false;

            Width   = w;
            Height  = h;
            _action = action;

            Add
            (
                new ResizePic(0x0A28)
            {
                Width = w, Height = h
            }
            );

            if (hasBackground)
            {
                ResizePic background = new ResizePic(3000)
                {
                    X      = X + 30,
                    Y      = Y + 40,
                    Width  = Width - 60,
                    Height = Height - 100
                };

                Add(background);
            }

            Add
            (
                new Label
                (
                    message,
                    false,
                    0x0386,
                    Width - 90,
                    1
                )
            {
                X = 40,
                Y = 45
            }
            );

            X = (Client.Game.Window.ClientBounds.Width - Width) >> 1;
            Y = (Client.Game.Window.ClientBounds.Height - Height) >> 1;

            // OK
            Button b;

            Add
            (
                b = new Button(0, 0x0481, 0x0483, 0x0482)
            {
                Y            = Height - 45,
                ButtonAction = ButtonAction.Activate
            }
            );

            b.X = (Width - b.Width) >> 1;


            if (menuType == MessageButtonType.OK_CANCEL)
            {
                Button bCancel;

                Add
                (
                    bCancel = new Button(1, 0x047E, 0x047F, 0x0480)
                {
                    Y            = Height - 45,
                    ButtonAction = ButtonAction.Activate
                }
                );

                b.X        = Width / 2 - bCancel.Width;
                bCancel.X  = Width / 2 - bCancel.Width;
                bCancel.X += b.Width + 5;
            }


            WantUpdateSize = false;

            UIManager.KeyboardFocusControl = this;
            UIManager.KeyboardFocusControl.SetKeyboardFocus();
        }
Beispiel #16
0
        private TopBarGump() : base(0, 0)
        {
            CanMove                = true;
            AcceptMouseInput       = true;
            CanCloseWithRightClick = false;
            exeEnhancedMap         = new EnhancedMapOpen();

            if (exeEnhancedMap.isMapInstalled)
            {
                mapInstalled = true;
            }

            // little
            Add
            (
                new ResizePic(0x13BE)
            {
                Width = 30, Height = 27
            },
                2
            );

            Add
            (
                new Button(0, 0x15A1, 0x15A1, 0x15A1)
            {
                X = 5, Y = 3, ToPage = 1
            },
                2
            );


            // big
            UOTexture th1 = GumpsLoader.Instance.GetTexture(0x098B);
            UOTexture th2 = GumpsLoader.Instance.GetTexture(0x098D);

            int smallWidth = 50;

            if (th1 != null)
            {
                smallWidth = th1.Width;
            }

            int largeWidth = 100;

            if (th2 != null)
            {
                largeWidth = th2.Width;
            }
            /* Giga487 */
            int[][] textTable =
            {
                new [] { (int)labelBig.big,   (int)Buttons.WorldMap     },
                new [] { (int)labelBig.big,   (int)Buttons.Paperdoll    },
                new [] { (int)labelBig.big,   (int)Buttons.Inventory    },
                new [] { (int)labelBig.big,   (int)Buttons.Journal      },
                new [] { (int)labelBig.small, (int)Buttons.Chat         },
                //new [] {0, (int) Buttons.Help },
                new [] { (int)labelBig.big,   (int)Buttons.VendorSearch },
                new [] { (int)labelBig.small, (int)Buttons.UOMarsBible  },
                new [] { (int)labelBig.small, (int)Buttons.UOMarsForum  },
                new [] { (int)labelBig.small, (int)Buttons.Debug        },
                new [] { (int)labelBig.big,   (int)Buttons.EnhancedMap  } //1 vuol dire che il tasto è grande, imbarazzo
                //new [] {1, (int) Buttons.GlobalChat },
            };

            string[] texts =
            {
                ResGumps.WorldMap, ResGumps.Paperdoll, ResGumps.Inventory, ResGumps.Journal, ResGumps.Chat, "Vendor Search", "UO Bible", "Forum", "FPS", "EnhancedMap"
            };

            bool hasUOStore = Client.Version >= ClientVersion.CV_706400;

            ResizePic background;

            Add
            (
                background = new ResizePic(0x13BE)
            {
                Height = 27,
            },
                1
            );

            Add
            (
                new Button(0, 0x15A4, 0x15A4, 0x15A4)
            {
                X = 5, Y = 3, ToPage = 2
            },
                1
            );

            int startX = 30;

            for (int i = 0; i < texts.Length; i++)
            {
                if (!hasUOStore && i >= (int)Buttons.UOStore)
                {
                    break;
                }

                ushort graphic = (ushort)(textTable[i][0] != 0 ? 0x098D : 0x098B);

                if (mapInstalled == false && (texts[i] == "EnhancedMap"))
                {
                    continue;
                }

                Add
                (
                    new RighClickableButton
                    (
                        textTable[i][1],
                        graphic,
                        graphic,
                        graphic,
                        texts[i],
                        1,
                        true,
                        0,
                        0x0036
                    )
                {
                    ButtonAction = ButtonAction.Activate,
                    X            = startX,
                    Y            = 1,
                    FontCenter   = true
                },
                    1
                );

                startX          += (textTable[i][0] != 0 ? largeWidth : smallWidth) + 1;
                background.Width = startX;
            }

            background.Width = startX + 1;

            //layer
            LayerOrder = UILayer.Over;
        }
Beispiel #17
0
        public PopupMenuGump(PopupMenuData data) : base(0, 0)
        {
            _data = data;
            CloseIfClickOutside = true;
            //ControlInfo.IsModal = true;
            //ControlInfo.ModalClickOutsideAreaClosesThisControl = true;
            CanMove = false;

            ResizePic pic = new ResizePic(0x0A3C)
            {
                IsTransparent = true, Alpha = 0.25f
            };

            Add(pic);
            int  offsetY = 10;
            bool arrowAdded = false;
            int  width = 0, height = 20;

            foreach (PopupMenuItem item in data.Items)
            {
                string text = FileManager.Cliloc.GetString(item.Cliloc);

                Label label = new Label(text, true, item.Hue, font: 1)
                {
                    X = 10, Y = offsetY
                };

                HitBox box = new HitBox(10, offsetY, label.Width, label.Height)
                {
                    IsTransparent = true, Tag = item.Index
                };

                box.MouseClick += (sender, e) =>
                {
                    if (e.Button == MouseButton.Left)
                    {
                        HitBox l = (HitBox)sender;
                        GameActions.ResponsePopupMenu(_data.Serial, (ushort)l.Tag);
                        Dispose();
                    }
                };
                Add(box);
                Add(label);

                if ((item.Flags & 0x02) != 0 && !arrowAdded)
                {
                    arrowAdded = true;

                    // TODO: wat?
                    Add(new Button(0, 0x15E6, 0x15E2, 0x15E2)
                    {
                        X = 20, Y = offsetY
                    });
                    height += 20;
                }

                offsetY += label.Height;

                if (!arrowAdded)
                {
                    height += label.Height;

                    if (width < label.Width)
                    {
                        width = label.Width;
                    }
                }
            }

            width += 20;

            if (height <= 10 || width <= 20)
            {
                Dispose();
            }
            else
            {
                pic.Width  = width;
                pic.Height = height;
                foreach (HitBox box in FindControls <HitBox>())
                {
                    box.Width = width - 20;
                }
            }
        }
Beispiel #18
0
        public PopupMenuGump(PopupMenuData data) : base(0, 0)
        {
            CloseIfClickOutside = true;
            //ControlInfo.IsModal = true;
            //ControlInfo.ModalClickOutsideAreaClosesThisControl = true;
            CanMove = false;

            ResizePic pic = new ResizePic(0x0A3C)
            {
                Alpha = 0.25f
            };

            Add(pic);
            int  offsetY = 10;
            bool arrowAdded = false;
            int  width = 0, height = 20;

            foreach (PopupMenuItem item in data.Items)
            {
                string text = UOFileManager.Cliloc.GetString(item.Cliloc);

                ushort hue = item.Hue;

                if (item.ReplacedHue != 0)
                {
                    uint h = HuesHelper.Color16To32(item.ReplacedHue);
                    (byte b, byte g, byte r, byte a) = HuesHelper.GetBGRA(h);

                    Color c = new Color(r, g, b, a);

                    if (c.A == 0)
                    {
                        c.A = 0xFF;
                    }

                    UOFileManager.Fonts.SetUseHTML(true, HuesHelper.RgbaToArgb(c.PackedValue));
                }

                Label label = new Label(text, true, 0xFFFF, font: 1)
                {
                    X = 10, Y = offsetY
                };
                UOFileManager.Fonts.SetUseHTML(false);

                HitBox box = new HitBox(10, offsetY, label.Width, label.Height)
                {
                    Tag = item.Index
                };

                box.MouseUp += (sender, e) =>
                {
                    if (e.Button == MouseButton.Left)
                    {
                        HitBox l = (HitBox)sender;
                        GameActions.ResponsePopupMenu(data.Serial, (ushort)l.Tag);
                        Dispose();
                    }
                };
                Add(box);
                Add(label);

                if ((item.Flags & 0x02) != 0 && !arrowAdded)
                {
                    arrowAdded = true;

                    // TODO: wat?
                    Add(new Button(0, 0x15E6, 0x15E2, 0x15E2)
                    {
                        X = 20, Y = offsetY
                    });
                    height += 20;
                }

                offsetY += label.Height;

                if (!arrowAdded)
                {
                    height += label.Height;

                    if (width < label.Width)
                    {
                        width = label.Width;
                    }
                }
            }

            width += 20;

            if (height <= 10 || width <= 20)
            {
                Dispose();
            }
            else
            {
                pic.Width  = width;
                pic.Height = height;
                foreach (HitBox box in FindControls <HitBox>())
                {
                    box.Width = width - 20;
                }
            }
        }
Beispiel #19
0
        private TopBarGump() : base(0, 0)
        {
            CanMove                = true;
            AcceptMouseInput       = true;
            CanCloseWithRightClick = false;

            // little
            Add(new ResizePic(0x13BE)
            {
                Width = 30, Height = 27
            }, 2);
            Add(new Button(0, 0x15A1, 0x15A1, 0x15A1)
            {
                X = 5, Y = 3, ToPage = 1
            }, 2);


            // big
            UOTexture th1 = GumpsLoader.Instance.GetTexture(0x098B);
            UOTexture th2 = GumpsLoader.Instance.GetTexture(0x098D);

            int smallWidth = 50;

            if (th1 != null)
            {
                smallWidth = th1.Width;
            }

            int largeWidth = 100;

            if (th2 != null)
            {
                largeWidth = th2.Width;
            }

            int[][] textTable =
            {
                new [] { 0, (int)Buttons.Map        },
                new [] { 1, (int)Buttons.Paperdoll  },
                new [] { 1, (int)Buttons.Inventory  },
                new [] { 1, (int)Buttons.Journal    },
                new [] { 0, (int)Buttons.Chat       },
                new [] { 0, (int)Buttons.Help       },
                new [] { 1, (int)Buttons.WorldMap   },
                new [] { 0, (int)Buttons.Info       },
                new [] { 0, (int)Buttons.Debug      },
                new [] { 1, (int)Buttons.NetStats   },

                new [] { 1, (int)Buttons.UOStore    },
                new [] { 1, (int)Buttons.GlobalChat },
            };

            string[] texts = { "Map", "Paperdoll", "Inventory", "Journal", "Chat", "Help", "World Map", "< ? >", "Debug", "NetStats", "UOStore", "Global Chat" };

            bool hasUOStore = Client.Version >= ClientVersion.CV_706400;

            ResizePic background;

            Add(background = new ResizePic(0x13BE)
            {
                Height = 27
            }, 1);

            Add(new Button(0, 0x15A4, 0x15A4, 0x15A4)
            {
                X = 5, Y = 3, ToPage = 2
            }, 1);

            int startX = 30;

            for (int i = 0; i < textTable.Length; i++)
            {
                if (!hasUOStore && i >= (int)Buttons.UOStore)
                {
                    break;
                }

                ushort graphic = (ushort)(textTable[i][0] != 0 ? 0x098D : 0x098B);

                Add(new RighClickableButton(textTable[i][1], graphic, graphic, graphic, texts[i], 1, true, 0, 0x0036)
                {
                    ButtonAction = ButtonAction.Activate,
                    X            = startX,
                    Y            = 1,
                    FontCenter   = true
                }, 1);

                startX          += (textTable[i][0] != 0 ? largeWidth : smallWidth) + 1;
                background.Width = startX;
            }

            background.Width = startX + 1;

            //layer
            ControlInfo.Layer = UILayer.Over;
        }
Beispiel #20
0
        public PopupMenuGump(PopupMenuData data) : base(0, 0)
        {
            CanMove = false;
            CanCloseWithRightClick = true;


            ResizePic pic = new ResizePic(0x0A3C)
            {
                Alpha = 0.25f
            };

            Add(pic);
            int  offsetY = 10;
            bool arrowAdded = false;
            int  width = 0, height = 20;

            for (int i = 0; i < data.Items.Length; i++)
            {
                ref PopupMenuItem item = ref data.Items[i];

                string text = ClilocLoader.Instance.GetString(item.Cliloc);

                ushort hue = item.Hue;

                if (item.ReplacedHue != 0)
                {
                    uint h = HuesHelper.Color16To32(item.ReplacedHue);
                    (byte b, byte g, byte r, byte a) = HuesHelper.GetBGRA(h);

                    Color c = new Color(r, g, b, a);

                    if (c.A == 0)
                    {
                        c.A = 0xFF;
                    }

                    FontsLoader.Instance.SetUseHTML(true, HuesHelper.RgbaToArgb(c.PackedValue));
                }

                Label label = new Label(text, true, hue, font: 1)
                {
                    X = 10,
                    Y = offsetY
                };

                FontsLoader.Instance.SetUseHTML(false);

                HitBox box = new HitBox(10, offsetY, label.Width, label.Height)
                {
                    Tag = item.Index
                };

                box.MouseUp += (sender, e) =>
                {
                    if (e.Button == MouseButtonType.Left)
                    {
                        HitBox l = (HitBox)sender;
                        GameActions.ResponsePopupMenu(data.Serial, (ushort)l.Tag);
                        Dispose();
                    }
                };

                Add(box);
                Add(label);

                if ((item.Flags & 0x02) != 0 && !arrowAdded)
                {
                    arrowAdded = true;

                    // TODO: wat?
                    Add
                    (
                        new Button(0, 0x15E6, 0x15E2, 0x15E2)
                    {
                        X = 20,
                        Y = offsetY
                    }
                    );

                    height += 20;
                }

                offsetY += label.Height;

                if (!arrowAdded)
                {
                    height += label.Height;

                    if (width < label.Width)
                    {
                        width = label.Width;
                    }
                }
            }
Beispiel #21
0
        public PopupMenuGump(PopupMenuData data) : base(0, 0)
        {
            CanMove = false;
            CanCloseWithRightClick = true;
            _data = data;

            ResizePic pic = new ResizePic(0x0A3C)
            {
                Alpha = 0.75f
            };

            Add(pic);
            int  offsetY = 10;
            bool arrowAdded = false;
            int  width = 0, height = 20;

            for (int i = 0; i < data.Items.Length; i++)
            {
                ref PopupMenuItem item = ref data.Items[i];

                string text = ClilocLoader.Instance.GetString(item.Cliloc);

                ushort hue = item.Hue;

                if (item.ReplacedHue != 0)
                {
                    uint h = (HuesHelper.Color16To32(item.ReplacedHue) << 8) | 0xFF;

                    FontsLoader.Instance.SetUseHTML(true, h);
                }

                Label label = new Label(text, true, hue, font: 1)
                {
                    X = 10,
                    Y = offsetY
                };

                FontsLoader.Instance.SetUseHTML(false);

                HitBox box = new HitBox(10, offsetY, label.Width, label.Height)
                {
                    Tag = item.Index
                };

                box.MouseEnter += (sender, e) =>
                {
                    _selectedItem = (ushort)(sender as HitBox).Tag;
                };

                Add(box);
                Add(label);

                if ((item.Flags & 0x02) != 0 && !arrowAdded)
                {
                    arrowAdded = true;

                    // TODO: wat?
                    Add
                    (
                        new Button(0, 0x15E6, 0x15E2, 0x15E2)
                    {
                        X = 20,
                        Y = offsetY
                    }
                    );

                    height += 20;
                }

                offsetY += label.Height;

                if (!arrowAdded)
                {
                    height += label.Height;

                    if (width < label.Width)
                    {
                        width = label.Width;
                    }
                }
            }