Ejemplo n.º 1
0
        public override void DrawFrame(SceneGame scene, Vector2 pos, PoseData poseData, Facing facing, Matrix transform, Color color, ColorMatrix colorMatrix)
        {
            SpriteReference abyssalTendril = SpriteLoader.Instance.AddSprite("content/abyssal_tendril");

            var    mirror      = Microsoft.Xna.Framework.Graphics.SpriteEffects.None;
            Random rand        = new Random(this.GetHashCode());
            int    wiggleFrame = poseData.PoseFrame + rand.Next(100);

            bool tendrilDown     = IsTendrilDown(poseData.Pose);
            bool tendrilDownLast = IsTendrilDown(poseData.PoseLast);
            int  frameOffset     = 0;
            bool invisible       = poseData.Pose == CreaturePose.Walk;

            switch (poseData.Pose)
            {
            case (CreaturePose.Stand):
                frameOffset = 2 + (wiggleFrame / 10) % 4;
                break;

            case (CreaturePose.Attack):
                frameOffset = 2 + (wiggleFrame / 2) % 4;
                break;

            default:
                frameOffset = 2 + (wiggleFrame / 4) % 4;
                break;
            }

            if (tendrilDown != tendrilDownLast && poseData.PoseFrame < 5 + rand.Next(20))
            {
                frameOffset = 0 + (wiggleFrame / 10) % 2;
                invisible   = false;
            }

            if (invisible)
            {
                return;
            }

            scene.PushSpriteBatch(shader: scene.Shader, shaderSetup: (matrix, projection) =>
            {
                scene.SetupColorMatrix(Color * colorMatrix, transform * matrix, projection);
            });
            scene.DrawSprite(abyssalTendril, frameOffset, pos - new Vector2(0, 8), mirror, color, 0);
            scene.PopSpriteBatch();
        }
Ejemplo n.º 2
0
        public override void DrawIcon(SceneGame scene, Vector2 position)
        {
            var ingot = SpriteLoader.Instance.AddSprite("content/item_feather");

            scene.DrawSprite(ingot, 0, position - ingot.Middle, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, 0);
        }
Ejemplo n.º 3
0
        public override void Draw(SceneGame scene)
        {
            var             memory       = Player.Memory;
            SpriteReference cursor       = SpriteLoader.Instance.AddSprite("content/cursor");
            SpriteReference textbox      = SpriteLoader.Instance.AddSprite("content/ui_box");
            SpriteReference flagEquipped = SpriteLoader.Instance.AddSprite("content/flag_equip");

            int        edgeDistance = 75;
            int        width        = scene.Viewport.Width - edgeDistance * 2;
            int        height       = 16 * Math.Max(Items.Count, 1);
            int        x            = edgeDistance;
            int        y            = (scene.Viewport.Height - height) / 2;
            float      openCoeff    = Math.Min(Ticks / 7f, 1f);
            float      openResize   = MathHelper.Lerp(-0.5f, 0.0f, openCoeff);
            RectangleF rect         = new RectangleF(x, y, width, height);

            rect.Inflate(rect.Width * openResize, rect.Height * openResize);
            if (openCoeff > 0)
            {
                scene.DrawUI(textbox, rect.ToRectangle(), Color.White);
            }
            int i = 0;

            if (openCoeff >= 1)
            {
                if (Items.Count <= 0)
                {
                    scene.DrawText("You haven't anything.", new Vector2(x, y), Alignment.Left, new TextParameters().SetConstraints(width - 32, 16).SetBold(true).SetColor(Color.LightGray, Color.Black));
                }
                foreach (var menupoint in Items)
                {
                    var item = menupoint.Representative;

                    if (CombineSelections.Any(selection => selection.Stack == menupoint))
                    {
                        var combineSelection = CombineSelections.Find(selection => selection.Stack == menupoint);
                        if (Ticks % 2 == 0)
                        {
                            scene.SpriteBatch.Draw(cursor.Texture, new Vector2(x + 6, y + i * 16), cursor.GetFrameRect(0), Color.White);
                        }
                        item = combineSelection.Item;
                    }
                    if (menupoint == Selection.Stack)
                    {
                        scene.SpriteBatch.Draw(cursor.Texture, new Vector2(x + 0, y + i * 16), cursor.GetFrameRect(0), Color.White);
                        item = Selection.Item;
                    }

                    int selectedItems = CombineSelections.Count(selection => selection.Stack == menupoint);

                    item.DrawIcon(scene, new Vector2(x + 16 + 8, y + i * 16 + 8));
                    if (item == Player.Weapon)
                    {
                        scene.DrawSprite(flagEquipped, 0, new Vector2(x + 16, y + i * 16), SpriteEffects.None, 0);
                    }
                    if (selectedItems > 1)
                    {
                        scene.DrawText(Game.ConvertToSmallPixelText(selectedItems.ToString()), new Vector2(x + 32, y + i * 16), Alignment.Right, new TextParameters().SetColor(Color.White, Color.Black));
                    }
                    scene.DrawText($"{memory.GetName(item)} x{menupoint.Count}", new Vector2(x + 32, y + i * 16), Alignment.Left, new TextParameters().SetConstraints(width - 32, 16).SetBold(true).SetColor(Color.White, Color.Black));
                    i++;
                }
            }
        }
Ejemplo n.º 4
0
        public override void Draw(SceneGame scene, DrawPass pass)
        {
            var hydraBody = SpriteLoader.Instance.AddSprite("content/hydra_body");

            scene.DrawSprite(hydraBody, (int)WalkFrame, Position - hydraBody.Middle + new Vector2(0, -4) + VisualOffset(), Facing == HorizontalFacing.Right ? SpriteEffects.None : SpriteEffects.FlipHorizontally, 1);
        }
Ejemplo n.º 5
0
 public override void DrawIcon(SceneGame scene, Vector2 position)
 {
     scene.DrawSprite(Sprite, 0, position - Sprite.Middle, SpriteEffects.None, 1.0f);
 }
Ejemplo n.º 6
0
        public override void DrawIcon(SceneGame scene, Vector2 position)
        {
            var appearance = Appearance.Randomized;

            scene.DrawSprite(appearance.Sprite, 0, position - appearance.Sprite.Middle, SpriteEffects.None, 1.0f);
        }
Ejemplo n.º 7
0
        public override void DrawIcon(SceneGame scene, Vector2 position)
        {
            var potionEmpty = SpriteLoader.Instance.AddSprite("content/item_potion_empty");

            scene.DrawSprite(potionEmpty, 0, position - potionEmpty.Middle, SpriteEffects.None, 1.0f);
        }
Ejemplo n.º 8
0
        public override void DrawIcon(SceneGame scene, Vector2 position)
        {
            var orbsprite = SpriteLoader.Instance.AddSprite($"content/{OrbSprite}");

            scene.DrawSprite(orbsprite, 0, position - orbsprite.Middle, SpriteEffects.None, 1.0f);
        }
Ejemplo n.º 9
0
        public override void DrawIcon(SceneGame scene, Vector2 position)
        {
            var curse = SpriteLoader.Instance.AddSprite("content/item_curse");

            scene.DrawSprite(curse, 0, position - curse.Middle, SpriteEffects.None, 1.0f);
        }
Ejemplo n.º 10
0
        public override void Draw(SceneGame scene, DrawPass pass)
        {
            var spriteExplosion = SpriteLoader.Instance.AddSprite("content/explosion");

            scene.DrawSprite(spriteExplosion, scene.AnimationFrame(spriteExplosion, Frame, FrameEnd), Position - spriteExplosion.Middle, SpriteEffects.None, 0);
        }
Ejemplo n.º 11
0
        public override void Draw(SceneGame scene, DrawPass pass)
        {
            var snakeSpit = SpriteLoader.Instance.AddSprite("content/snake_poison");

            scene.DrawSprite(snakeSpit, 0, Position - snakeSpit.Middle, SpriteEffects.None, 0);
        }
Ejemplo n.º 12
0
        public override void Draw(SceneGame scene, DrawPass pass)
        {
            var magicOrange = SpriteLoader.Instance.AddSprite("content/magic_orange");

            scene.DrawSprite(magicOrange, (int)Frame, Position - magicOrange.Middle, SpriteEffects.None, 0);
        }