コード例 #1
0
ファイル: Jofairden.cs プロジェクト: shasta246/tModLoader
        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;
                DeveloperPlayer devPlayer = DeveloperPlayer.GetPlayer(drawPlayer);
                SpriteEffects effects = SpriteEffects.None;
                if (drawPlayer.direction == -1)
                {
                    effects |= SpriteEffects.FlipHorizontally;
                }

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

                DrawData 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 = 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;
            }));
        }
コード例 #2
0
ファイル: Jofairden.cs プロジェクト: shasta246/tModLoader
        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;
                DeveloperPlayer devPlayer = DeveloperPlayer.GetPlayer(drawPlayer);
                SpriteEffects effects = SpriteEffects.None;
                if (drawPlayer.direction == -1)
                {
                    effects |= SpriteEffects.FlipHorizontally;
                }

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

                DrawData 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 = ShaderId ?? GameShaders.Armor.GetShaderIdFromItemId(ItemID.LivingRainbowDye);
                    data.shader = ShaderId.Value;
                }
                Main.playerDrawData.Add(data);
            }));
        }