예제 #1
0
        public VendorBuyGump(AEntity vendorBackpack, VendorBuyListPacket packet)
            : base(0, 0)
        {
            // sanity checking: don't show buy gumps for empty containers.
            if (!(vendorBackpack is Container) || ((vendorBackpack as Container).Contents.Count <= 0) || (packet.Items.Count <= 0))
            {
                Dispose();
                return;
            }

            IsMoveable = true;
            // note: original gumplings start at index 0x0870.
            AddControl(m_Background = new ExpandableScroll(this, 0, 0, 360, false));
            AddControl(new HtmlGumpling(this, 0, 6, 300, 20, 0, 0, " <center><span color='#004' style='font-family:uni0;'>Shop Inventory"));

            m_ScrollBar = (IScrollBar)AddControl(new ScrollFlag(this));
            AddControl(m_ShopContents = new RenderedTextList(this, 22, 32, 250, 260, m_ScrollBar));
            BuildShopContents(vendorBackpack, packet);

            AddControl(m_TotalCost = new HtmlGumpling(this, 44, 334, 200, 30, 0, 0, string.Empty));
            UpdateCost();

            Button okButton = (Button)AddControl(new Button(this, 220, 333, 0x907, 0x908, ButtonTypes.Activate, 0, 0));

            okButton.GumpOverID       = 0x909;
            okButton.MouseClickEvent += okButton_MouseClickEvent;
        }
예제 #2
0
        public override void Update(double totalMS, double frameMS)
        {
            SpriteBatch3D sb = ServiceRegistry.GetService <SpriteBatch3D>();

            if (m_Background.Width != sb.GraphicsDevice.Viewport.Width || m_Background.Height != sb.GraphicsDevice.Viewport.Height)
            {
                m_Background.Width  = sb.GraphicsDevice.Viewport.Width;
                m_Background.Height = sb.GraphicsDevice.Viewport.Height;
            }

            if (Characters.UpdateValue != m_charListUpdate)
            {
                int entryIndex = 0;
                m_characterNames = new HtmlGumpling[Characters.Length];
                foreach (CharacterListEntry e in Characters.List)
                {
                    if (e.Name != string.Empty)
                    {
                        m_characterNames[entryIndex] = new HtmlGumpling(this, 228, 154 + 40 * entryIndex, 272, 22, 0, 0, formatHTMLCharName(entryIndex, e.Name, (m_charSelected == entryIndex ? 431 : 1278)));
                        AddControl(new ResizePic(this, m_characterNames[entryIndex]), 1);
                        AddControl(m_characterNames[entryIndex], 1);
                    }
                    entryIndex++;
                }
                m_charListUpdate = Characters.UpdateValue;
            }
            base.Update(totalMS, frameMS);
        }
예제 #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);
        }
예제 #4
0
        public UseSkillButtonGump(SkillEntry skill)
            : base(skill.ID, 0)
        {
            while (UserInterface.GetControl <UseSkillButtonGump>(skill.ID) != null)
            {
                UserInterface.GetControl <UseSkillButtonGump>(skill.ID).Dispose();
            }

            m_Skill = skill;
            m_World = Service.Get <WorldModel>();

            IsMoveable        = true;
            HandlesMouseInput = true;

            m_BG      = new ResizePic[3];
            m_BG[0]   = (ResizePic)AddControl(new ResizePic(this, 0, 0, 0x24B8, 120, 40));
            m_BG[1]   = (ResizePic)AddControl(new ResizePic(this, 0, 0, 0x24EA, 120, 40));
            m_BG[2]   = (ResizePic)AddControl(new ResizePic(this, 0, 0, 0x251C, 120, 40));
            m_Caption = (HtmlGumpling)AddControl(new HtmlGumpling(this, 0, 10, 120, 20, 0, 0, "<center>" + m_Skill.Name));

            for (int i = 0; i < 3; i++)
            {
                m_BG[i].MouseDownEvent  += EventMouseDown;
                m_BG[i].MouseUpEvent    += EventMouseUp;
                m_BG[i].MouseClickEvent += EventMouseClick;
            }
        }
예제 #5
0
 public DebugGump()
     : base(0, 0)
 {
     _world     = Service.Get <WorldModel>();
     IsMoveable = true;
     AddControl(new ResizePic(this, 0, 0, 0x2436, 256 + 16, 256 + 16));
     AddControl(_debug = new HtmlGumpling(this, 0, 0, 256, 256, 0, 0, string.Empty));
 }
예제 #6
0
        public SkillsGump()
            : base(0, 0)
        {
            IsMoveable = true;

            m_World = ServiceRegistry.GetService <WorldModel>();

            AddControl(m_Background  = new ExpandableScroll(this, 0, 0, 200));
            m_Background.TitleGumpID = 0x834;

            AddControl(m_SkillsHtml = new HtmlGumpling(this, 32, 32, 240, 200 - 92, 0, 2, string.Empty));
        }
예제 #7
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()));
        }
예제 #8
0
        public VendorSellGump(VendorSellListPacket packet)
            : base(0, 0)
        {
            IsMoveable = true;
            // note: original gumplings start at index 0x0870.
            AddControl(m_Background = new ExpandableScroll(this, 0, 0, 360, false));
            AddControl(new HtmlGumpling(this, 0, 6, 300, 20, 0, 0, " <center><span color='#004' style='font-family:uni0;'>My Inventory"));

            m_ScrollBar = (IScrollBar)AddControl(new ScrollFlag(this));
            AddControl(m_ShopContents = new RenderedTextList(this, 22, 32, 250, 260, m_ScrollBar));
            BuildShopContents(packet);

            AddControl(m_TotalCost = new HtmlGumpling(this, 44, 334, 200, 30, 0, 0, string.Empty));
            UpdateEntryAndCost();

            AddControl(m_OKButton       = new Button(this, 220, 333, 0x907, 0x908, ButtonTypes.Activate, 0, 0));
            m_OKButton.GumpOverID       = 0x909;
            m_OKButton.MouseClickEvent += okButton_MouseClickEvent;
        }
예제 #9
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()));
        }
예제 #10
0
        public override void Update(double totalMS, double frameMS)
        {
            var sb = Service.Get <SpriteBatch3D>();

            if (_background.Width != sb.GraphicsDevice.Viewport.Width || _background.Height != sb.GraphicsDevice.Viewport.Height)
            {
                _background.Width  = sb.GraphicsDevice.Viewport.Width;
                _background.Height = sb.GraphicsDevice.Viewport.Height;
            }

            if (Characters.UpdateValue != _charListUpdate)
            {
                int entryIndex = 0;
                _characterNames = new HtmlGumpling[Characters.Length];
                foreach (var e in Characters.List)
                {
                    if (e.Name != string.Empty)
                    {
                        _characterNames[entryIndex] = new HtmlGumpling(this, 228, 154 + 40 * entryIndex, 272, 22, 0, 0, formatHTMLCharName(entryIndex, e.Name, (_charSelected == entryIndex ? 431 : 1278)));
                        AddControl(new ResizePic(this, _characterNames[entryIndex]), 1);
                        AddControl(_characterNames[entryIndex], 1);
                    }
                    entryIndex++;
                }
                _charListUpdate = Characters.UpdateValue;
            }

            var input = Service.Get <IInputService>();

            if (input.HandleKeyboardEvent(KeyboardEvent.Down, WinKeys.Enter, false, false, false) && !_isWorldLoading)
            {
                if (_characterNames.Length > 0)
                {
                    _onLoginWithCharacter(0);
                    _isWorldLoading = true;
                }
            }

            base.Update(totalMS, frameMS);
        }