Пример #1
0
        private static void DrawLGSGChooseBlocks()
        {
            Rectangle dst = new Rectangle
            {
                X      = (int)(vp_per.X * 0.171875f),
                Y      = (int)(vp_per.Y * 0.266666666666667f),
                Width  = (int)(vp_per.X * 0.65625f),
                Height = (int)(vp_per.Y * 0.6625f),
            };

            if (OffScreenBuffer != null && !OffScreenBuffer.IsDisposed)
            {
                Memory.graphics.GraphicsDevice.SetRenderTarget(OffScreenBuffer);

                // Matrix osbMatrix = Matrix.CreateScale(new Vector3())
                Memory.SpriteBatchStartAlpha();
                for (int bloc = 0; bloc < 3; bloc++)
                {
                    int        block           = bloc + 3 * (Blockpage);
                    Saves.Data d               = Saves.FileList?[SlotLoc, block];
                    Tuple <Rectangle, Point> b = DrawBlock(block, d);
                    //cords returned by drawblock assume being in the offscreen buffer.
                    //Which is the size of the 3 blocks. So we need to offset
                    //everything by the draw location.
                    Rectangle r = b.Item1;
                    r.Offset(dst.Location);
                    Point p = b.Item2;
                    p.Offset(dst.Location);
                    BlockLocs[bloc] = new Tuple <Rectangle, Point, Rectangle>(r, p, new Rectangle());
                }
                Memory.SpriteBatchEnd();
                Memory.graphics.GraphicsDevice.SetRenderTarget(null);
            }
        }
Пример #2
0
        private static Tuple <Rectangle, Point> DrawBlock(int block, Saves.Data d)
        {
            block++;
            Rectangle dst = new Rectangle
            {
                X      = 0,
                Y      = (OffScreenBuffer.Height / 3 * ((block - 1) % 3)),
                Width  = (OffScreenBuffer.Width),
                Height = OffScreenBuffer.Height / 3,
            };
            Vector2 offset = dst.Location.ToVector2();

            DrawBox(dst);

            Vector2 blocknumpos = new Vector2
            {
                X = (OffScreenBuffer.Width * 0.00952381f),
                Y = 0,
            } +offset;
            Vector2 blocknumsize = new Vector2(OffScreenBuffer.Height * 0.00628930817610063f);

            Memory.Icons.Draw(block, Icons.NumType.Num_8x16_0, 2, "D2", blocknumpos, blocknumsize, fade); // 2,2 looks close

            Rectangle faceRect = new Rectangle
            {
                X      = (int)(OffScreenBuffer.Width * 0.0654761904761905f),
                Y      = (int)(OffScreenBuffer.Height * 0.0157232704402516f),
                Width  = (int)(OffScreenBuffer.Width * 0.113095238095238f),
                Height = (int)(OffScreenBuffer.Height * 0.30188679245283f),
            };

            faceRect.Offset(offset);
            sbyte mainchar = -1;

            for (byte face = 0; d != null && d.Party != null && face < d.Party.Length; face++)
            {
                if (face != 0)
                {
                    faceRect.Offset(faceRect.Width, 0);
                }
                if (d.Party[face] != Saves.Characters.Blank)
                {
                    Memory.Faces.Draw(d.Party[face], faceRect, Vector2.UnitY, fade);
                    Memory.Icons.Draw(Icons.ID.MenuBorder, 2, faceRect, new Vector2(1f), fade);
                    if (mainchar == -1)
                    {
                        mainchar = (sbyte)face;
                    }
                }
            }
            if (mainchar > -1 && d != null && d.Party != null && d.Party[mainchar] != Saves.Characters.Blank)
            {
                Vector2 detailsLoc = new Vector2
                {
                    X = (int)(OffScreenBuffer.Width * 0.408333333333333f),
                    Y = (int)(OffScreenBuffer.Height * 0.0251572327044026f),
                } +offset;
                FF8String name = Memory.Strings.GetName(d.Party[mainchar], d);
                FF8String lv_  = new FF8String($"LV.   {d.firstcharacterslevel}");
                TextScale = new Vector2(OffScreenBuffer.Width * 0.0030303030297619f, OffScreenBuffer.Height * 0.00636792452830189f);
                Memory.font.RenderBasicText(name, detailsLoc, TextScale, Fade: fade);

                int playy = (int)detailsLoc.Y;
                detailsLoc.Y += (int)(OffScreenBuffer.Height * 0.0817610062893082f);
                Rectangle disc = Memory.font.RenderBasicText(lv_, detailsLoc, TextScale, Fade: fade);
                disc.Offset(0, (int)(OffScreenBuffer.Height * 0.0125786163522013f));
                disc.X = (int)(OffScreenBuffer.Width * 0.583333333333333f);
                Vector2 DiscScale = new Vector2(OffScreenBuffer.Height * 0.0060987230787661f);
                Memory.Icons.Draw(Icons.ID.DISC, 2, disc, DiscScale, fade);
                Vector2 CurrDiscLoc = new Vector2(disc.X + (0.119047619047619f * OffScreenBuffer.Width), disc.Y);
                Memory.Icons.Draw((int)d.CurrentDisk + 1, 0, 2, "D1", CurrDiscLoc, DiscScale, fade);
                float X1 = OffScreenBuffer.Width * 0.952380952380952f;
                float X2 = OffScreenBuffer.Width * -0.0238095238095238f;
                float X3 = OffScreenBuffer.Width * -0.0952380952380952f;
                disc.Location = new Vector2 {
                    X = X1, Y = disc.Y
                }.ToPoint();
                Memory.Icons.Draw(Icons.ID.G, 2, disc, DiscScale, fade);
                double digits = (d.AmountofGil == 0?1:Math.Floor(Math.Log10(d.AmountofGil) + 2));

                disc.Offset(new Vector2 {
                    X = (float)(digits * X2)
                });
                Memory.Icons.Draw((int)d.AmountofGil, 0, 2, "D1", disc.Location.ToVector2(), DiscScale, fade);
                disc.Location = new Vector2 {
                    X = X1, Y = playy
                }.ToPoint();
                disc.Offset(new Vector2 {
                    X = X2
                });
                Memory.Icons.Draw(d.Timeplayed.Minutes, 0, 2, "D2", disc.Location.ToVector2(), DiscScale, fade);

                if ((int)d.Timeplayed.TotalHours > 0)
                {
                    disc.Offset(new Vector2 {
                        X = 1 * X2
                    });
                    Memory.Icons.Draw(Icons.ID.Colon, 13, disc, DiscScale, fade);
                    disc.Offset(new Vector2 {
                        X = (float)Math.Floor(Math.Log10((int)d.Timeplayed.TotalHours) + 1) * X2
                    });
                    Memory.Icons.Draw((int)d.Timeplayed.TotalHours, 0, 2, "D1", disc.Location.ToVector2(), DiscScale, fade);
                }
                disc.Offset(new Vector2 {
                    X = X3 + X2
                });
                Memory.Icons.Draw(Icons.ID.PLAY, 13, disc, DiscScale, fade);
                Rectangle locbox = new Rectangle
                {
                    X      = faceRect.Width + faceRect.X,
                    Y      = (int)(OffScreenBuffer.Height * 0.19496855345912f),
                    Width  = OffScreenBuffer.Width - faceRect.Width - faceRect.X,
                    Height = (int)(OffScreenBuffer.Height * 0.138364779874214f),
                };
                locbox.Offset(offset);
                DrawBox(locbox);
                FF8String loc = Memory.Strings.Read(Strings.FileID.AREAMES, 0, d.LocationID).ReplaceRegion();
                locbox.Offset(0.0297619047619048f * OffScreenBuffer.Width, 0.0440251572327044f * OffScreenBuffer.Height);
                Memory.font.RenderBasicText(loc, locbox.Location, TextScale, Fade: fade);
            }

            dst.X      = (int)(vp_per.X * 0f);
            dst.Y      = (int)(vp_per.Y * 0.220833333333333f * ((block - 1) % 3));
            dst.Width  = (int)(vp_per.X * 0.65625f);
            dst.Height = (int)(vp_per.Y * 0.220833333333333f);
            return(new Tuple <Rectangle, Point>(dst, (dst.Location.ToVector2() + new Vector2(25f, dst.Height / 2)).ToPoint()));
        }