示例#1
0
        public void Draw(int ox = 0, int oy = 0, int scrollY = 0)
        {
            Rectangle value = textArea;

            value.X = 0;
            value.Y = -scrollY;
            Rectangle destinationRectangle = textArea;

            destinationRectangle.X += ox;
            destinationRectangle.Y += oy;
            Vector2i position = dialogPosition;

            position.X += ox;
            position.Y += oy;
            background.Draw(position, 1f);
            Main.spriteBatch.Draw(textTexture, destinationRectangle, value, Color.White);
            if (isScrollable)
            {
                int       x    = position.X + (background.Width >> 1) - 8;
                Rectangle rect = new Rectangle(x, position.Y + 2, 16, 16);
                if (scrollY < 0)
                {
                    SpriteSheet <_sheetSprites> .DrawCentered(135, ref rect, SpriteEffects.FlipVertically);
                }
                if (scrollY > minOffsetY)
                {
                    rect.Y = position.Y + background.Height - 16 - 2;
                    SpriteSheet <_sheetSprites> .DrawCentered(135, ref rect);
                }
            }
        }
示例#2
0
        public void Draw(Vector2 position)
        {
            Vector2 origin  = new Vector2(background.Width >> 1, background.Height >> 1);
            Vector2 origin2 = new Vector2(backgroundSelected.Width >> 1, backgroundSelected.Height >> 1);
            int     num     = 4;
            int     num2    = num * 2 + 1;
            int     num3    = num + 1;

            for (int num4 = num2; num4 > 0; num4--)
            {
                int num5 = selected - num3 + num4;
                if (num5 < 0)
                {
                    num5 += options.Length;
                }
                else if (num5 >= options.Length)
                {
                    num5 -= options.Length;
                }
                float num6 = (float)num - Math.Abs((float)(num4 - num3) + ScrollTween * (float)scrollDirection);
                float val  = 1f - 0.25f * Math.Abs((float)(num4 - num3) + ScrollTween * (float)scrollDirection);
                val = Math.Max(0.75f, val);
                if (!(num6 < 0f) && !(val < 0f))
                {
                    Texture2D texture2D = options[num5];
                    Vector2   origin3   = new Vector2(texture2D.Width >> 1, texture2D.Height >> 1);
                    Vector2   value     = spacing * ScrollTween * (float)scrollDirection;
                    Vector2   position2 = position + spacing * (num4 - num3) + value;
                    if (num5 == selected)
                    {
                        Main.spriteBatch.Draw(backgroundSelected, position2, null, Color.White * num6, 0f, origin2, val, SpriteEffects.None, 0f);
                    }
                    else
                    {
                        Main.spriteBatch.Draw(background, position2, null, Color.White * num6, 0f, origin, 1f, SpriteEffects.None, 0f);
                    }
                    Main.spriteBatch.Draw(texture2D, position2, null, Color.White * num6, 0f, origin3, 1f, SpriteEffects.None, 0f);
                }
            }
            if (!Scrolling)
            {
                Vector2   value2 = spacing * ((float)num - 0.25f);
                Vector2   vector = position - value2 - new Vector2(8f, 8f);
                Rectangle rect   = new Rectangle((int)vector.X, (int)vector.Y, 16, 16);
                SpriteSheet <_sheetSprites> .DrawCentered(136, ref rect, SpriteEffects.FlipHorizontally);

                Vector2 vector2 = position + value2 - new Vector2(8f, 8f);
                rect.X = (int)vector2.X;
                rect.Y = (int)vector2.Y;
                SpriteSheet <_sheetSprites> .DrawCentered(136, ref rect);
            }
        }
示例#3
0
        private void DrawArrows(Vector2 position, Vector2 spacing)
        {
            Vector2   vector = position - spacing - new Vector2(8f, 8f);
            Rectangle rect   = new Rectangle((int)vector.X, (int)vector.Y, 16, 16);

            SpriteSheet <_sheetSprites> .DrawCentered(136, ref rect, SpriteEffects.FlipHorizontally);

            Vector2 vector2 = position + spacing - new Vector2(8f, 8f);

            rect.X = (int)vector2.X;
            rect.Y = (int)vector2.Y;
            SpriteSheet <_sheetSprites> .DrawCentered(136, ref rect);
        }
示例#4
0
        public void Draw(Vector2 position, float alpha)
        {
            Rectangle bounds = background.Bounds;
            int       num    = bounds.Width + 2;
            int       num2   = bounds.Height + 2;
            int       num3   = bounds.Width >> 1;
            int       num4   = bounds.Height >> 1;
            int       num5   = num * columns - 2;
            int       num6   = num2 * rows - 2;

            position.X -= num5 >> 1;
            position.Y -= num6 >> 1;
            position.X += num3;
            position.Y += num4;
            Color   color     = Color.White * alpha;
            Vector2 position2 = default(Vector2);

            for (int num7 = rows - 1; num7 > -1; num7--)
            {
                int num8 = (int)position.Y + num7 * num2;
                for (int num9 = columns - 1; num9 > -1; num9--)
                {
                    if (num7 != selected.Y || num9 != selected.X)
                    {
                        int num10 = (int)position.X + num9 * num;
                        int num11 = num7 * columns + num9;
                        position2.X = num10 - num3;
                        position2.Y = num8 - num4;
                        Main.spriteBatch.Draw(background, position2, color);
                        SpriteSheet <_sheetSprites> .DrawCentered(1269 + num11, num10, num8, sources[num11], color);
                    }
                }
            }
            Vector2 position3 = default(Vector2);
            float   scale     = (flashTimer > 0) ? (1f + 0.1f * (float)flashTimer) : 1f;

            position3.X = position.X + (float)(selected.X * num);
            position3.Y = position.Y + (float)(selected.Y * num2);
            Main.spriteBatch.Draw(picker, position3, null, color, 0f, pickerOrigin, scale, SpriteEffects.None, 0f);
            SpriteSheet <_sheetSprites> .DrawCentered(1269 + Selected, (int)position3.X, (int)position3.Y, sources[Selected], color, scale);
        }