Esempio n. 1
0
        public override void Update(double totalMS, double frameMS)
        {
            base.Update(totalMS, frameMS);

            if (Keyboard.Alt && Engine.UI.AnchorManager[this] != null)
            {
                if (_lockGumpPic == null)
                {
                    _lockGumpPic = new GumpPic(0, 0, 0x082C, 0);
                    _lockGumpPic.Update(totalMS, frameMS);
                    _lockGumpPic.AcceptMouseInput = true;
                    _lockGumpPic.X        = Width - _lockGumpPic.Width;
                    _lockGumpPic.Y        = 0;
                    _lockGumpPic.MouseUp += _lockGumpPic_MouseClick;

                    Add(_lockGumpPic);
                }

                if (Engine.UI.MouseOverControl != null && (Engine.UI.MouseOverControl == this || Engine.UI.MouseOverControl.RootParent == this))
                {
                    _lockGumpPic.Hue = 34;
                }
                else
                {
                    _lockGumpPic.Hue = 0;
                }
            }
            else if ((!Keyboard.Alt || Engine.UI.AnchorManager[this] == null) && _lockGumpPic != null)
            {
                Remove(_lockGumpPic);
                _lockGumpPic.Dispose();
                _lockGumpPic = null;
            }
        }
Esempio n. 2
0
        public void ForceUpdate()
        {
            Children[0].Dispose();
            _iconizerArea?.Dispose();
            _iconized?.Dispose();

            BuildGump();
            ItemsOnAdded(null, new CollectionChangedEventArgs <Serial>(FindControls <ItemGump>().Select(s => s.LocalSerial)));
        }
Esempio n. 3
0
        public override void Update(double totalMS, double frameMS)
        {
            if (m_gump == null || m_useLargeMap != UltimaVars.EngineVars.MiniMap_LargeFormat)
            {
                m_useLargeMap = UltimaVars.EngineVars.MiniMap_LargeFormat;
                if (m_gump != null)
                {
                    m_gump.Dispose();
                }
                m_gump = new GumpPic(this, 0, 0, 0, (m_useLargeMap ? 5011 : 5010), 0);
                m_gump.OnMouseClick       = onClickMap;
                m_gump.OnMouseDoubleClick = onDoubleClickMap;
                m_gump.MakeDragger(this);
                m_gump.MakeCloseTarget(this);
                AddControl(m_gump);
            }

            base.Update(totalMS, frameMS);
        }
Esempio n. 4
0
        public override void Update(double totalMS, double frameMS)
        {
            base.Update(totalMS, frameMS);

            if (Input.Keyboard.Alt && Engine.AnchorManager[this] != null && _lockGumpPic == null)
            {
                _lockGumpPic = new GumpPic(0, 0, 0x082C, 0);
                _lockGumpPic.Update(totalMS, frameMS);
                _lockGumpPic.AcceptMouseInput = true;
                _lockGumpPic.X           = Width - _lockGumpPic.Width;
                _lockGumpPic.Y           = 0;
                _lockGumpPic.MouseClick += _lockGumpPic_MouseClick;

                Add(_lockGumpPic);
            }
            else if ((!Input.Keyboard.Alt || Engine.AnchorManager[this] == null) && _lockGumpPic != null)
            {
                Remove(_lockGumpPic);
                _lockGumpPic.Dispose();
                _lockGumpPic = null;
            }
        }
Esempio n. 5
0
        private void BuildGump()
        {
            CanMove            = true;
            CanBeSaved         = true;
            WantUpdateSize     = false;
            _isCorspeContainer = Graphic == 0x0009;

            Item item = World.Items.Get(LocalSerial);

            if (item == null)
            {
                Dispose();
                return;
            }

            item.Items.Added   -= ItemsOnAdded;
            item.Items.Removed -= ItemsOnRemoved;
            item.Items.Added   += ItemsOnAdded;
            item.Items.Removed += ItemsOnRemoved;

            float scale = Engine.UI.ContainerScale;

            _data = ContainerManager.Get(Graphic);
            if (_data.MinimizerArea != Rectangle.Empty && _data.IconizedGraphic != 0)
            {
                _iconizerArea = new HitBox((int)(_data.MinimizerArea.X * scale),
                                           (int)(_data.MinimizerArea.Y * scale),
                                           (int)(_data.MinimizerArea.Width * scale),
                                           (int)(_data.MinimizerArea.Height * scale));
                _iconized = new GumpPic(0, 0, _data.IconizedGraphic, 0);
            }
            Graphic g = _data.Graphic;

            GumpPicContainer container;

            Add(container = new GumpPicContainer(0, 0, g, 0, item));

            if (_isCorspeContainer)
            {
                _eyeGumpPic?.Dispose();
                Add(_eyeGumpPic = new GumpPic((int)(45 * scale), (int)(30 * scale), 0x0045, 0));

                _eyeGumpPic.Width  = (int)(_eyeGumpPic.Width * scale);
                _eyeGumpPic.Height = (int)(_eyeGumpPic.Height * scale);
            }


            Width  = container.Width = (int)(container.Width * scale);
            Height = container.Height = (int)(container.Height * scale);

            ContainerGump gg = Engine.UI.Gumps.OfType <ContainerGump>().FirstOrDefault(s => s.LocalSerial == LocalSerial);

            if (gg == null)
            {
                if (Engine.UI.GetGumpCachePosition(LocalSerial, out Point location) && item.Serial == World.Player.Equipment[(int)Layer.Backpack])
                {
                    Location = location;
                }
                else
                {
                    if (Engine.Profile.Current.OverrideContainerLocation)
                    {
                        switch (Engine.Profile.Current.OverrideContainerLocationSetting)
                        {
                        case 0:
                            SetPositionNearGameObject(g, item);
                            break;

                        case 1:
                            SetPositionTopRight();
                            break;

                        case 2:
                            SetPositionByLastDragged();
                            break;
                        }

                        if ((X + Width) > Engine.WindowWidth)
                        {
                            X -= Width;
                        }

                        if ((Y + Height) > Engine.WindowHeight)
                        {
                            Y -= Height;
                        }
                    }
                    else
                    {
                        ContainerManager.CalculateContainerPosition(g);
                        X = ContainerManager.X;
                        Y = ContainerManager.Y;
                    }
                }
            }
            else
            {
                X = gg.X;
                Y = gg.Y;
            }


            if (_data.OpenSound != 0)
            {
                Engine.SceneManager.CurrentScene.Audio.PlaySound(_data.OpenSound);
            }
        }