Exemple #1
0
        public static PlayerLayer CreateShaderLayer(string name, PlayerLayer parent, Func <PlayerDrawInfo, DrawDataInfo> getDataFunc)
        {
            return(new PlayerLayer("ModLoaderMod", name, parent, (drawInfo) => {
                if (drawInfo.shadow != 0f || drawInfo.drawPlayer.invis)
                {
                    return;
                }

                DrawDataInfo drawDataInfo = getDataFunc.Invoke(drawInfo);
                Player drawPlayer = drawInfo.drawPlayer;
                var devPlayer = DeveloperPlayer.GetPlayer(drawPlayer);
                SpriteEffects effects = SpriteEffects.None;
                if (drawPlayer.direction == -1)
                {
                    effects |= SpriteEffects.FlipHorizontally;
                }

                if (drawPlayer.gravDir == -1)
                {
                    effects |= SpriteEffects.FlipVertically;
                }

                var data = new DrawData(
                    drawDataInfo.Texture,
                    drawDataInfo.Position,
                    drawDataInfo.Frame,
                    Color.White * Main.essScale * devPlayer.AndromedonEffect.LayerStrength * devPlayer.AndromedonEffect.ShaderStrength,
                    drawDataInfo.Rotation,
                    drawDataInfo.Origin,
                    1f,
                    effects,
                    0);

                BeginShaderBatch(Main.spriteBatch);
                ShaderId ??= GameShaders.Armor.GetShaderIdFromItemId(ItemID.LivingRainbowDye);
                GameShaders.Armor.Apply(ShaderId.Value, drawPlayer, data);
                var centerPos = data.position;

                for (int i = 0; i < ShaderNumSegments; i++)
                {
                    data.position = centerPos + GetDrawOffset(i);
                    data.Draw(Main.spriteBatch);
                }

                data.position = centerPos;
            }));
        }
Exemple #2
0
        protected override void Draw(ref PlayerDrawSet drawInfo)
        {
            DrawDataInfo  drawDataInfo = GetData(drawInfo);
            Player        drawPlayer   = drawInfo.drawPlayer;
            var           devPlayer    = drawPlayer.GetModPlayer <DeveloperPlayer>();
            SpriteEffects effects      = SpriteEffects.None;

            if (drawPlayer.direction == -1)
            {
                effects |= SpriteEffects.FlipHorizontally;
            }

            if (drawPlayer.gravDir == -1)
            {
                effects |= SpriteEffects.FlipVertically;
            }

            var data = new DrawData(
                drawDataInfo.Texture,
                drawDataInfo.Position,
                drawDataInfo.Frame,
                Color.White * Main.essScale * devPlayer.AndromedonEffect.LayerStrength * devPlayer.AndromedonEffect.ShaderStrength,
                drawDataInfo.Rotation,
                drawDataInfo.Origin,
                1f,
                effects,
                0);

            BeginShaderBatch(Main.spriteBatch);

            ShaderId ??= GameShaders.Armor.GetShaderIdFromItemId(ItemID.LivingRainbowDye);

            GameShaders.Armor.Apply(ShaderId.Value, drawPlayer, data);

            var centerPos = data.position;

            for (int i = 0; i < ShaderNumSegments; i++)
            {
                data.position = centerPos + GetDrawOffset(i);
                data.Draw(Main.spriteBatch);
            }

            data.position = centerPos;
        }
Exemple #3
0
        public static PlayerLayer CreateGlowLayer(string name, PlayerLayer parent, Func <PlayerDrawInfo, DrawDataInfo> getDataFunc)
        {
            return(new PlayerLayer("ModLoaderMod", name, parent, (drawInfo) => {
                if (drawInfo.shadow != 0f || drawInfo.drawPlayer.invis)
                {
                    return;
                }

                DrawDataInfo drawDataInfo = getDataFunc.Invoke(drawInfo);
                Player drawPlayer = drawInfo.drawPlayer;
                var devPlayer = DeveloperPlayer.GetPlayer(drawPlayer);
                SpriteEffects effects = SpriteEffects.None;

                if (drawPlayer.direction == -1)
                {
                    effects |= SpriteEffects.FlipHorizontally;
                }

                if (drawPlayer.gravDir == -1)
                {
                    effects |= SpriteEffects.FlipVertically;
                }

                var data = new DrawData(
                    drawDataInfo.Texture,
                    drawDataInfo.Position,
                    drawDataInfo.Frame,
                    Color.White * Main.essScale * devPlayer.AndromedonEffect.LayerStrength,
                    drawDataInfo.Rotation,
                    drawDataInfo.Origin,
                    1f,
                    effects,
                    0);

                if (devPlayer.AndromedonEffect.HasAura)
                {
                    ShaderId ??= GameShaders.Armor.GetShaderIdFromItemId(ItemID.LivingRainbowDye);
                    data.shader = ShaderId.Value;
                }

                throw new NotImplementedException();                 //TODO: Reimplement //Main.playerDrawData.Add(data);
            }));
        }