Example #1
0
        protected override void DrawSelf(SpriteBatch spriteBatch)       //from ExampleMod's ExampleUI
        {
            Player   player      = Main.LocalPlayer;
            MyPlayer mPlayer     = player.GetModPlayer <MyPlayer>();
            float    frame       = (mPlayer.goldenSpinCounter / 300f) * 12f;
            int      frameHeight = goldenRectangleTexture.Height / 12; //12 frames in that sheet, both sheets are the same height

            spriteBatch.Draw(goldenRectangleTexture, GSpinMeter.GetClippingRectangle(spriteBatch), new Rectangle(0, frameHeight * (int)(frame - 1), goldenRectangleTexture.Width, frameHeight), Color.Yellow);
            spriteBatch.Draw(goldenRectangleSpinLineTexture, GSpinMeter.GetClippingRectangle(spriteBatch), new Rectangle(0, frameHeight * (int)(frame - 1), goldenRectangleSpinLineTexture.Width, frameHeight), Color.Yellow);
        }
Example #2
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            int frame       = 0;
            int frameHeight = bulletCounterTexture.Height / 7;      //24 frames in that sheet

            if (Items.SexPistolsFinal.bulletCount == 0)
            {
                frame = 0;
            }
            if (Items.SexPistolsFinal.bulletCount == 1)
            {
                frame = 1;
            }
            if (Items.SexPistolsFinal.bulletCount == 2)
            {
                frame = 2;
            }
            if (Items.SexPistolsFinal.bulletCount == 3)
            {
                frame = 3;
            }
            if (Items.SexPistolsFinal.bulletCount == 4)
            {
                frame = 4;
            }
            if (Items.SexPistolsFinal.bulletCount == 5)
            {
                frame = 5;
            }
            if (Items.SexPistolsFinal.bulletCount == 6)
            {
                frame = 6;
            }
            spriteBatch.Draw(bulletCounterTexture, bulletCountUI.GetClippingRectangle(spriteBatch), new Rectangle(0, frameHeight * frame, bulletCounterTexture.Width, frameHeight), new Color(255f, 255f, 255f, 255f));
        }
Example #3
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            Player   player      = Main.player[Main.myPlayer];
            MyPlayer mPlayer     = player.GetModPlayer <MyPlayer>();
            int      frame       = mPlayer.revolverBulletsShot;
            int      frameHeight = bulletCounterTexture.Height / 7;

            spriteBatch.Draw(bulletCounterTexture, bulletCountUI.GetClippingRectangle(spriteBatch), new Rectangle(0, frameHeight * frame, bulletCounterTexture.Width, frameHeight), new Color(255f, 255f, 255f, 255f));
        }
Example #4
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            Player   player      = Main.player[Main.myPlayer];
            MyPlayer mPlayer     = player.GetModPlayer <MyPlayer>();
            int      frame       = 6 - mPlayer.sexPistolsLeft;
            int      frameHeight = sexPistolsUITexture.Height / 7;

            spriteBatch.Draw(sexPistolsUITexture, sexPistolsUI.GetClippingRectangle(spriteBatch), new Rectangle(0, frameHeight * frame, sexPistolsUITexture.Width, frameHeight), new Color(255f, 255f, 255f, 255f));
        }
Example #5
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            Player   player  = Main.player[Main.myPlayer];
            MyPlayer mPlayer = player.GetModPlayer <MyPlayer>();

            float normalizedVoidCounter = 1f - ((float)mPlayer.voidCounter / (float)mPlayer.voidCounterMax);

            spriteBatch.Draw(VoidBarTexture, voidBarUI.GetClippingRectangle(spriteBatch), new Rectangle(0, 0, VoidBarTexture.Width, VoidBarTexture.Height), Color.White);

            //---------- This shows how to apply shaders to UI elements. In this case it was supposed to be a gradient but it looked worse than a monotone bar either way ----------
            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Main.UIScaleMatrix);

            MiscShaderData voidGradientShader = GameShaders.Misc["JoJoStandsVoidGradient"];

            voidGradientShader.UseOpacity(normalizedVoidCounter);

            voidGradientShader.Apply(null);
            spriteBatch.Draw(VoidBarBarTexture, voidBarUI.GetClippingRectangle(spriteBatch), new Rectangle(0, 0, VoidBarTexture.Width, VoidBarTexture.Height), Color.White);

            spriteBatch.End();
            spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, RasterizerState.CullCounterClockwise, null, Main.UIScaleMatrix);
        }
Example #6
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            Player    player  = Main.player[Main.myPlayer];
            MyPlayer  mPlayer = player.GetModPlayer <MyPlayer>();
            Texture2D redDot  = ModContent.GetTexture("JoJoStands/UI/RedDot");

            spriteBatch.Draw(aerosmithRadarTexture, aerosmithRadarUI.GetClippingRectangle(spriteBatch), new Rectangle(0, 1, aerosmithRadarTexture.Width, aerosmithRadarTexture.Height), new Color(255f, 255f, 255f, 255f));
            for (int k = 0; k < Main.maxNPCs; k++)
            {
                if (Main.npc[k].active && Main.npc[k].lifeMax > 5 && !Main.npc[k].townNPC)
                {
                    float xDistance             = Main.projectile[mPlayer.aerosmithWhoAmI].position.X - Main.npc[k].position.X;
                    float yDistance             = Main.projectile[mPlayer.aerosmithWhoAmI].position.Y - Main.npc[k].position.Y;
                    float xMaxDetectionDistance = Main.screenWidth + 120f;
                    float yMaxDetectionDistance = Main.screenHeight + 120f;
                    if (xDistance < xMaxDetectionDistance && yDistance < yMaxDetectionDistance && xDistance > -xMaxDetectionDistance && yDistance > -yMaxDetectionDistance)
                    {
                        if (xDistance < 675f && xDistance > -675f && yDistance < 675f && yDistance > -675f)
                        {
                            spriteBatch.Draw(redDot, new Rectangle((int)(centerDot.Left.Pixels + 13f + (-xDistance / 18f)) + (int)aerosmithRadarUI.Left.Pixels, (int)(centerDot.Top.Pixels + 13f + (-yDistance / 18f)) + (int)aerosmithRadarUI.Top.Pixels, 10, 10), new Rectangle(0, 1, 10, 10), new Color(255f, 255f, 255f, 255f));
                        }
                    }
                }
            }
            if (Main.netMode != NetmodeID.SinglePlayer)
            {
                for (int i = 0; i < Main.maxPlayers; i++)
                {
                    Player    detectedPlayer = Main.player[i];
                    Texture2D orangeDot      = ModContent.GetTexture("JoJoStands/UI/OrangeDot");
                    if (detectedPlayer.active && detectedPlayer.team != player.team)
                    {
                        float xDistance             = Main.projectile[mPlayer.aerosmithWhoAmI].position.X - detectedPlayer.position.X;
                        float yDistance             = Main.projectile[mPlayer.aerosmithWhoAmI].position.Y - detectedPlayer.position.Y;
                        float xMaxDetectionDistance = Main.screenWidth + 120f;
                        float yMaxDetectionDistance = Main.screenHeight + 120f;
                        if (detectedPlayer.active && xDistance < xMaxDetectionDistance && yDistance < yMaxDetectionDistance && xDistance > -xMaxDetectionDistance && yDistance > -yMaxDetectionDistance)
                        {
                            if (xDistance < 675f && xDistance > -675f && yDistance < 675f && yDistance > -675f)
                            {
                                spriteBatch.Draw(orangeDot, new Rectangle((int)(centerDot.Left.Pixels + 13f + (-xDistance / 18f)) + (int)aerosmithRadarUI.Left.Pixels, (int)(centerDot.Top.Pixels + 13f + (-yDistance / 18f)) + (int)aerosmithRadarUI.Top.Pixels, 10, 10), new Rectangle(0, 1, 10, 10), new Color(255f, 255f, 255f, 255f));
                            }
                        }
                    }
                }
            }
        }
Example #7
0
        protected override void DrawSelf(SpriteBatch spriteBatch)       //from ExampleMod's ExampleUI
        {
            Player player = Main.player[Main.myPlayer];

            Items.Hamon.HamonPlayer hamonPlayer = player.GetModPlayer <Items.Hamon.HamonPlayer>();
            int frame       = 0;
            int frameHeight = hamonBarTexture.Height / 24;      //24 frames in that sheet

            if (hamonPlayer.amountOfHamon >= 3 && hamonPlayer.amountOfHamon <= 12)
            {
                frame = 0;
            }
            if (hamonPlayer.amountOfHamon >= 13 && hamonPlayer.amountOfHamon <= 24)
            {
                frame = 1;
            }
            if (hamonPlayer.amountOfHamon >= 25 && hamonPlayer.amountOfHamon <= 36)
            {
                frame = 2;
            }
            if (hamonPlayer.amountOfHamon >= 37 && hamonPlayer.amountOfHamon <= 48)
            {
                frame = 3;
            }
            if (hamonPlayer.amountOfHamon >= 49 && hamonPlayer.amountOfHamon <= 60)
            {
                frame = 4;
            }
            if (hamonPlayer.amountOfHamon >= 61 && hamonPlayer.amountOfHamon <= 75)
            {
                frame = 5;
            }
            if (hamonPlayer.amountOfHamon >= 76 && hamonPlayer.amountOfHamon <= 90)
            {
                frame = 6;
            }
            if (hamonPlayer.amountOfHamon >= 91 && hamonPlayer.amountOfHamon <= 105)
            {
                frame = 7;
            }
            if (hamonPlayer.amountOfHamon >= 106 && hamonPlayer.amountOfHamon <= 120)
            {
                frame = 8;
            }
            if (hamonPlayer.amountOfHamon >= 121 && hamonPlayer.amountOfHamon <= 140)
            {
                frame = 9;
            }
            if (hamonPlayer.amountOfHamon >= 141 && hamonPlayer.amountOfHamon <= 160)
            {
                frame = 10;
            }
            if (hamonPlayer.amountOfHamon >= 161 && hamonPlayer.amountOfHamon <= 180)
            {
                frame = 11;
            }
            if (hamonPlayer.amountOfHamon >= 181 && hamonPlayer.amountOfHamon <= 192)   //Aja stone frames
            {
                frame = 12;
            }
            if (hamonPlayer.amountOfHamon >= 193 && hamonPlayer.amountOfHamon <= 204)
            {
                frame = 13;
            }
            if (hamonPlayer.amountOfHamon >= 205 && hamonPlayer.amountOfHamon <= 216)
            {
                frame = 14;
            }
            if (hamonPlayer.amountOfHamon >= 217 && hamonPlayer.amountOfHamon <= 228)
            {
                frame = 15;
            }
            if (hamonPlayer.amountOfHamon >= 229 && hamonPlayer.amountOfHamon <= 240)       //last of the first row
            {
                frame = 16;
            }
            if (hamonPlayer.amountOfHamon >= 241 && hamonPlayer.amountOfHamon <= 255)       //2nd row starts here
            {
                frame = 17;
            }
            if (hamonPlayer.amountOfHamon >= 256 && hamonPlayer.amountOfHamon <= 270)
            {
                frame = 18;
            }
            if (hamonPlayer.amountOfHamon >= 271 && hamonPlayer.amountOfHamon <= 285)
            {
                frame = 19;
            }
            if (hamonPlayer.amountOfHamon >= 286 && hamonPlayer.amountOfHamon <= 300)       //3rd row starts here
            {
                frame = 20;
            }
            if (hamonPlayer.amountOfHamon >= 301 && hamonPlayer.amountOfHamon <= 320)
            {
                frame = 21;
            }
            if (hamonPlayer.amountOfHamon >= 321 && hamonPlayer.amountOfHamon <= 340)
            {
                frame = 22;
            }
            if (hamonPlayer.amountOfHamon >= 341 && hamonPlayer.amountOfHamon <= 360)
            {
                frame = 23;
            }
            spriteBatch.Draw(hamonBarTexture, HamonBar.GetClippingRectangle(spriteBatch), new Rectangle(0, frameHeight * frame, hamonBarTexture.Width, frameHeight), Color.Yellow);
        }