Exemplo n.º 1
0
        public void DrawOther(GraphicsContext graphicsContext)
        {
            // Draw key-count
            const string KeyFontName = "Minecraftia18";
            Color color = new Color(204, 204, 204);
            Texture2D keyTexture = graphicsContext.ContentProvider.DefaultManager.LoadTexture("Key");

            graphicsContext.SpriteBatch.Begin(SamplerState.PointClamp);

            // Draw key texture shaded
            graphicsContext.SpriteBatch.DrawCentered(keyTexture, new Vector2(graphicsContext.ScreenSize.X - 48 - 1, 2 + 18 - 1), Color.Black, 0, 4);
            graphicsContext.SpriteBatch.DrawCentered(keyTexture, new Vector2(graphicsContext.ScreenSize.X - 48, 2 + 18), color.MultiplyRGB(1), 0, 4);

            // Draw key-count
            graphicsContext.SpriteBatch.DrawStringFaded(graphicsContext.FontContainer[KeyFontName], _player.Keys.ToString(), new Vector2(graphicsContext.ScreenSize.X - 24, 2), Color.Black, color);

            graphicsContext.SpriteBatch.End();
        }
Exemplo n.º 2
0
        public override void ModifyDrawLayers(List <PlayerLayer> layers)
        {
            int body = layers.FindIndex(l => l == PlayerLayer.Body);

            if (body < 0)
            {
                return;
            }

            layers.Insert(body - 1, new PlayerLayer(mod.Name, "Body",
                                                    delegate(PlayerDrawInfo drawInfo)
            {
                if (drawInfo.shadow != 0f)
                {
                    return;
                }

                if (isHolding)
                {
                    Player drawPlayer            = drawInfo.drawPlayer;
                    Mod mod                      = ModLoader.GetMod("Starjinx");
                    StarfireLampPlayer modPlayer = drawPlayer.GetModPlayer <StarfireLampPlayer>();
                    Vector2 Position             = drawPlayer.position;
                    DrawData drawData            = new DrawData();
                    SpriteEffects spriteEffects;
                    SpriteEffects effect;
                    if ((double)drawPlayer.gravDir == 1.0)
                    {
                        if (drawPlayer.direction == 1)
                        {
                            spriteEffects = SpriteEffects.None;
                            effect        = SpriteEffects.None;
                        }
                        else
                        {
                            spriteEffects = SpriteEffects.FlipHorizontally;
                            effect        = SpriteEffects.FlipHorizontally;
                        }
                    }
                    else
                    {
                        if (drawPlayer.direction == 1)
                        {
                            spriteEffects = SpriteEffects.FlipVertically;
                            effect        = SpriteEffects.FlipVertically;
                        }
                        else
                        {
                            spriteEffects = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
                            effect        = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically;
                        }
                    }

                    //change
                    Microsoft.Xna.Framework.Color color12 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int)((double)Position.X + (double)drawPlayer.width * 0.5) / 16, (int)((double)Position.Y + (double)drawPlayer.height * 0.5) / 16, Microsoft.Xna.Framework.Color.White), drawInfo.shadow);
                    Microsoft.Xna.Framework.Color color19 = Microsoft.Xna.Framework.Color.Lerp(color12, Microsoft.Xna.Framework.Color.White, 0.7f);
                    Texture2D texture2D = ModContent.GetTexture("SpiritMod/Items/Weapon/Magic/StarfireLamp/StarfireLamp");
                    Texture2D texture   = ModContent.GetTexture("SpiritMod/Items/Weapon/Magic/StarfireLamp/StarfireLampGlow");
                    int num23           = !drawPlayer.setForbiddenCooldownLocked ? 1 : 0;
                    int num24           = (int)((double)((float)((double)drawPlayer.miscCounter / 300.0 * 6.28318548202515)).ToRotationVector2().Y * 6.0);
                    float num25         = ((float)((double)drawPlayer.miscCounter / 75.0 * 6.28318548202515)).ToRotationVector2().X * 4f;
                    Microsoft.Xna.Framework.Color color20 = new Microsoft.Xna.Framework.Color(80, 70, 40, 0) * (float)((double)num25 / 8.0 + 0.5) * 0.8f;
                    if (num23 == 0)
                    {
                        num24   = 0;
                        num25   = 2f;
                        color20 = new Microsoft.Xna.Framework.Color(80, 70, 40, 0) * 0.3f;
                        color19 = color19.MultiplyRGB(new Microsoft.Xna.Framework.Color(0.5f, 0.5f, 1f));
                    }
                    Vector2 position = new Vector2((float)(int)((double)Position.X - (double)Main.screenPosition.X - (double)(drawPlayer.bodyFrame.Width / 2) + (double)(drawPlayer.width / 2)), (float)(int)((double)Position.Y - (double)Main.screenPosition.Y + (double)drawPlayer.height - (double)drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)) + new Vector2((float)(-drawPlayer.direction), (float)(num24 - 60));
                    drawData         = new DrawData(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color12, drawPlayer.bodyRotation, texture2D.Size() / 2f, 1f, spriteEffects, 0);
                    Main.playerDrawData.Add(drawData);
                    for (float num26 = 0.0f; (double)num26 < 8.0; ++num26)
                    {
                        drawData = new DrawData(texture, position + (num26 * 1.570796f).ToRotationVector2() * num25, new Microsoft.Xna.Framework.Rectangle?(), color20, drawPlayer.bodyRotation, texture2D.Size() / 2f, 1f, spriteEffects, 0);
                        Main.playerDrawData.Add(drawData);
                    }
                }
            }));
        }