Example #1
0
 protected override void OnMouseEnter(int x, int y)
 {
     _labelName.Hue       = _hoverColor;
     _labelPing.Hue       = _hoverColor;
     _labelPacketLoss.Hue = _hoverColor;
     _labelName.CreateTexture();
     _labelPing.CreateTexture();
     _labelPacketLoss.CreateTexture();
     base.OnMouseEnter(x, y);
 }
Example #2
0
 protected override void OnMouseOver(int x, int y)
 {
     _labelName.Hue       = SELECTED_COLOR;
     _labelPing.Hue       = SELECTED_COLOR;
     _labelPacketLoss.Hue = SELECTED_COLOR;
     _labelName.CreateTexture();
     _labelPing.CreateTexture();
     _labelPacketLoss.CreateTexture();
     base.OnMouseOver(x, y);
 }
Example #3
0
 public ServerEntryGump(ServerListEntry entry)
 {
     _buttonId        = entry.Index;
     _labelName       = CreateRenderedText(entry.Name);
     _labelPing       = CreateRenderedText("-");
     _labelPacketLoss = CreateRenderedText("-");
     _labelName.CreateTexture();
     _labelPing.CreateTexture();
     _labelPacketLoss.CreateTexture();
     AcceptMouseInput = true;
     Width            = 393;
     Height           = new[] { _labelName.Height, _labelPing.Height, _labelPacketLoss.Height }.Max() + 10;
     X = 0;
     Y = 0;
 }
Example #4
0
            public ServerEntryGump(ServerListEntry entry)
            {
                _buttonId        = entry.Index;
                _labelName       = CreateRenderedText(entry.Name);
                _labelPing       = CreateRenderedText("-");
                _labelPacketLoss = CreateRenderedText("-");
                _labelName.CreateTexture();
                _labelPing.CreateTexture();
                _labelPacketLoss.CreateTexture();
                AcceptMouseInput = true;
                Width            = 393;
                Height           = 25;

                //Height = new[]
                //{
                //    _labelName.Height, _labelPing.Height, _labelPacketLoss.Height
                //}.Max();


                WantUpdateSize = false;
            }
Example #5
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (!AllowedToDraw || GameObject.IsDisposed)
            {
                return(false);
            }

            Texture.Ticks = Engine.Ticks;
            TextOverhead overhead = (TextOverhead)GameObject;

            if (IsSelected && _text.Hue != 0x0035)
            {
                _text.Hue = 0x0035;
                _text.CreateTexture();
                Texture = _text.Texture;
            }
            else if (!IsSelected && overhead.Hue != _text.Hue)
            {
                _text.Hue = overhead.Hue;
                _text.CreateTexture();
                Texture = _text.Texture;
            }


            HueVector = ShaderHuesTraslator.GetHueVector(0, false, overhead.Alpha, true);

            if (EdgeDetection)
            {
                GameScene gs = Engine.SceneManager.GetScene <GameScene>();

                int width  = Texture.Width - Bounds.X;
                int height = Texture.Height - Bounds.Y;

                if (position.X < Bounds.X)
                {
                    position.X = Bounds.X;
                }
                else if (position.X > Engine.Profile.Current.GameWindowSize.X * gs.Scale - width)
                {
                    position.X = Engine.Profile.Current.GameWindowSize.X * gs.Scale - width;
                }

                if (position.Y - Bounds.Y < 0)
                {
                    position.Y = Bounds.Y;
                }
                else if (position.Y > Engine.Profile.Current.GameWindowSize.Y * gs.Scale - height)
                {
                    position.Y = Engine.Profile.Current.GameWindowSize.Y * gs.Scale - height;
                }
            }

            bool ok = base.Draw(batcher, position, objectList);


            //if (_edge == null)
            //{
            //    _edge = new Texture2D(batcher.GraphicsDevice, 1, 1);
            //    _edge.SetData(new Color[] { Color.LightBlue });
            //}

            //batcher.DrawRectangle(_edge, new Rectangle((int) position.X - Bounds.X, (int) position.Y - Bounds.Y, _text.Width, _text.Height) , Vector3.Zero);

            return(ok);
        }
Example #6
0
        public override bool Draw(Batcher2D batcher, Vector3 position, MouseOverList objectList)
        {
            if (!AllowedToDraw || IsDisposed)
            {
                return(false);
            }

            Texture.Ticks = Engine.Ticks;

            if (IsSelected && _text.Hue != 0x0035)
            {
                _text.Hue = 0x0035;
                _text.CreateTexture();
                Texture = _text.Texture;
            }
            else if (!IsSelected && Hue != _text.Hue)
            {
                _text.Hue = Hue;
                _text.CreateTexture();
                Texture = _text.Texture;
            }


            HueVector = ShaderHuesTraslator.GetHueVector(0);
            GameScene gs    = Engine.SceneManager.GetScene <GameScene>();
            float     scale = gs.Scale;
            int       x     = Engine.Profile.Current.GameWindowPosition.X;
            int       y     = Engine.Profile.Current.GameWindowPosition.Y;


            float width  = Texture.Width - Bounds.X;
            float height = Texture.Height - Bounds.Y;

            width  *= scale;
            height *= scale;

            if (position.X - 6 < Bounds.X)
            {
                if (!EdgeDetection)
                {
                    return(false);
                }
                position.X = Bounds.X + 6;
            }
            else if (position.X > (Engine.Profile.Current.GameWindowSize.X + 6) * scale - width)
            {
                if (!EdgeDetection)
                {
                    return(false);
                }
                position.X = (Engine.Profile.Current.GameWindowSize.X + 6) * scale - width;
            }

            if (position.Y - 6 < Bounds.Y)
            {
                if (!EdgeDetection)
                {
                    return(false);
                }
                position.Y = Bounds.Y + 6;
            }
            else if (position.Y > (Engine.Profile.Current.GameWindowSize.Y + 6) * scale - height)
            {
                if (!EdgeDetection)
                {
                    return(false);
                }
                position.Y = (Engine.Profile.Current.GameWindowSize.Y + 6) * scale - height;
            }


            position   /= scale;
            position.X += x;
            position.Y += y;
            bool ok = base.Draw(batcher, position, objectList);

            //batcher.DrawRectangle(_edge, new Rectangle((int)position.X - Bounds.X, (int)position.Y - Bounds.Y, _text.Width, _text.Height), Vector3.Zero);

            return(ok);
        }