コード例 #1
0
        public Choice(Game g, string[] s, string[] d, EventManager em, string t)
        {
            game           = g;
            dialogueWindow = game.TextureLoader.RequestTexture("UI\\World\\ChoiceWindow");
            point          = game.TextureLoader.RequestTexture("UI\\Common\\bulletpoint");
            font           = game.mediumFont;
            var baseOffset = new Point((game.GetScreenWidth() / 2) - (dialogueWindow.Width / 2), game.GetScreenHeight() - dialogueWindow.Height - 20);

            text         = TextMethods.WrapText(game.mediumFont, t, 530);
            choices      = s;
            destinations = d;
            var position = new Point(baseOffset.X + 32, baseOffset.Y);

            if (text != "")
            {
                int height = (int)game.mediumFont.MeasureString(text).Y + 2 + 24;
                position.Y += height;
            }
            rectangles = new Rectangle[choices.Length];
            int limit = 7;

            if (text.Contains("\r\n"))
            {
                limit = 6;
            }
            for (int i = 0; i < choices.Length && i < limit; i++)
            {
                choices[i]    = TextMethods.WrapText(game.mediumFont, choices[i], 494);
                rectangles[i] = new Rectangle(position.X, position.Y, (int)font.MeasureString(choices[i]).X + 40, (int)font.MeasureString(choices[i]).Y);
                position.Y   += rectangles[i].Height + 2;
            }
            eventManager = em;
            font         = game.mediumFont;
        }
コード例 #2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            var drawVector = new Vector2(TopLeft.X + 40, TopLeft.Y + 40);

            for (int i = 0; i < learnableSpells.Count; i++)
            {
                if (i == 5 || i == 10 || i == 15 || i == 20)
                {
                    drawVector.X = TopLeft.X + 40 + ((i / 5) * 63);
                    drawVector.Y = TopLeft.Y + 40;
                }
                spriteBatch.Draw(learnableSpells[i].SpellIcon, new Rectangle((int)drawVector.X, (int)drawVector.Y, 64, 64), null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0.18f);
                if (spellBook == null)
                {
                    if (game.Input.IsMouseOver(new Rectangle((int)drawVector.X, (int)drawVector.Y, 64, 63)))
                    {
                        var vec = new Vector2(TopLeft.X + 483, TopLeft.Y + 40);
                        spriteBatch.DrawString(game.mediumFont, learnableSpells[i].DisplayName, vec, Color.Black, 0, TextMethods.CenterText(game.mediumFont, learnableSpells[i].DisplayName), 1, SpriteEffects.None, 0.18f);
                        vec = new Vector2(TopLeft.X + 483, TopLeft.Y + 90);
                        spriteBatch.Draw(learnableSpells[i].SpellIcon, new Rectangle((int)vec.X, (int)vec.Y, 64, 64), null, Color.White, 0, new Vector2(32, 32), SpriteEffects.None, 0.18f);
                        vec = new Vector2(TopLeft.X + 380, TopLeft.Y + 128);
                        spriteBatch.DrawString(game.smallFont, TextMethods.WrapText(game.smallFont, learnableSpells[i].Description, 200), vec, Color.Black, 0, Vector2.Zero, 1, SpriteEffects.None, 0.18f);
                        vec = new Vector2(TopLeft.X + 380, TopLeft.Y + 380);
                        if (pc.Level >= learnableSpells[i].ReturnRequiredLevel(pc.Arcana))
                        {
                            spriteBatch.DrawString(game.smallFont, TextMethods.WrapText(game.smallFont, strings[0] + MathHelper.Clamp(learnableSpells[i].ReturnRequiredLevel(pc.Arcana), 1, 50).ToString(), 200), vec, Color.Black, 0.0f, Vector2.Zero, 1, SpriteEffects.None, 0.18f);
                        }
                        else
                        {
                            spriteBatch.DrawString(game.smallFont, TextMethods.WrapText(game.smallFont, strings[0] + MathHelper.Clamp(learnableSpells[i].ReturnRequiredLevel(pc.Arcana), 1, 50).ToString(), 200), vec, Color.Red, 0.0f, Vector2.Zero, 1, SpriteEffects.None, 0.18f);
                        }
                    }
                }
                drawVector.Y += 63;
            }
            if (confirmOverwriteLearnedSpell)
            {
                spriteBatch.Draw(confirmWindow, new Rectangle(game.GetScreenWidth() / 2, game.GetScreenHeight() / 2, 384, 192), null, Color.White, 0.0f, new Vector2(192, 69), SpriteEffects.None, 0.15f);
                spriteBatch.DrawString(game.mediumFont, TextMethods.WrapText(game.mediumFont, strings[1], 350), new Vector2(game.GetScreenWidth() / 2, game.GetScreenHeight() / 2), Color.White, 0.0f, TextMethods.CenterText(game.mediumFont, TextMethods.WrapText(game.mediumFont, strings[1], 350)), 1.0f, SpriteEffects.None, 0.13f);
            }
            if (learnedSpell != null)
            {
                drawVector = new Vector2(TopLeft.X + 103, TopLeft.Y + 390);
                spriteBatch.Draw(learnedSpell.SpellIcon, new Rectangle((int)drawVector.X, (int)drawVector.Y, 56, 56), new Rectangle(4, 4, 56, 56), Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.18f);
                drawVector = new Vector2(TopLeft.X + 163, TopLeft.Y + 390);
                spriteBatch.Draw(progressBar, new Rectangle((int)drawVector.X, (int)drawVector.Y, 9, (questStats.learnSpellProgress * 56) / 100), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.18f);
            }
            if (spellBook != null)
            {
                spellBook.Draw(spriteBatch);
            }
        }
コード例 #3
0
ファイル: Spellbook.cs プロジェクト: hoptond/magiciansdemo
 public override void Draw(SpriteBatch spriteBatch)
 {
     if (!castingSpell)
     {
         if (nameWindow != null)
         {
             nameWindow.Draw(spriteBatch);
         }
         base.Draw(spriteBatch);
         for (int i = 0; i < spells.Length; i++)
         {
             spells[i].Draw(spriteBatch);
             spriteBatch.DrawString(smallFont, pc.Spells[i].DisplayName, new Vector2(spells[i].Bounds.X, spells[i].Bounds.Y - 16), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.14f);
             spriteBatch.DrawString(smallFont, TextMethods.WrapText(smallFont, pc.Spells[i].Description, 182), new Vector2(spells[i].Bounds.X + 68, spells[i].Bounds.Y + 16), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.14f);
             spriteBatch.DrawString(smallFont, "SP Cost: " + pc.Spells[i].ManaCost(pc).ToString(), new Vector2(spells[i].Bounds.X + 192, spells[i].Bounds.Y + 64), Color.Blue, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.14f);
         }
     }
     else
     {
         var drawVector = new Vector2(game.GetScreenWidth() / 2, 96);
         spriteBatch.Draw(castSpellTextBack, new Rectangle((int)drawVector.X, (int)drawVector.Y, 400, 64), null, Color.White, 0, new Vector2(200, 32), SpriteEffects.None, 0.01f);
         spriteBatch.DrawString(game.mediumFont, castWorldSpellText, drawVector, Color.White, 0, TextMethods.CenterText(game.mediumFont, castWorldSpellText), 1, SpriteEffects.None, 0.00f);
     }
 }
コード例 #4
0
 public void Load(TextureLoader tl, SpriteFont smallFont)
 {
     Icon        = tl.RequestTexture("UI\\Icons\\Items\\" + iconFile);
     Description = TextMethods.WrapText(smallFont, Description, 200);
 }
コード例 #5
0
        public CharacterCreateScreen(Game game)
            : base(game.Input, game.TextureLoader.RequestTexture("UI\\CharCreate\\CharacterCreateWindow"), 0.03f, new Point(game.GetScreenWidth() / 2 - 350, game.GetScreenHeight() / 2 - 295),
                   null)
        {
            this.game           = game;
            nameBar             = game.TextureLoader.RequestTexture("UI\\CharCreate\\nameBar");
            ArcanaWheel         = game.TextureLoader.RequestTexture("UI\\CharCreate\\ArcanaWheel");
            arcanaHighlight     = game.TextureLoader.RequestTexture("UI\\CharCreate\\ArcanaSelected");
            tooltipWindow       = game.TextureLoader.RequestTexture("UI\\Common\\tooltipWindow");
            maleIcon            = game.TextureLoader.RequestTexture("UI\\Common\\male");
            femaleIcon          = game.TextureLoader.RequestTexture("UI\\Common\\female");
            genderCircle        = game.TextureLoader.RequestTexture("UI\\CharCreate\\ChooseGender");
            genderHighlight     = game.TextureLoader.RequestTexture("UI\\CharCreate\\ChooseGenderHighlighted");
            greyedOut           = game.TextureLoader.RequestTexture("UI\\CharCreate\\NextGreyedOut");
            attributesWindow    = game.TextureLoader.RequestTexture("UI\\CharCreate\\CharacterCreateAttributesWindow");
            pointsRemainingBox  = game.TextureLoader.RequestTexture("UI\\CharCreate\\AttributePointsBox");
            FinishPanel         = game.TextureLoader.RequestTexture("UI\\CharCreate\\FinishWindow");
            finishTick          = game.TextureLoader.RequestTexture("UI\\CharCreate\\TickNext");
            displayTutHighlight = true;
            tutHighlight        = game.TextureLoader.RequestTexture("UI\\Common\\BlankExitButton");



            strings     = new string[21];
            strings[0]  = TextMethods.WrapText(game.mediumFont, game.LoadString("UI", "CharCreateHeaderText1"), 540);
            strings[1]  = TextMethods.WrapText(game.mediumFont, game.LoadString("UI", "CharCreateHeaderText2"), 540);
            strings[2]  = game.LoadString("UI", "CharCreateHeaderText3");
            strings[3]  = game.LoadString("UI", "CharCreateHeaderText4");
            strings[4]  = game.LoadString("UI", "LightArcanaDesc");
            strings[5]  = game.LoadString("UI", "FireArcanaDesc");
            strings[6]  = game.LoadString("UI", "EarthArcanaDesc");
            strings[7]  = game.LoadString("UI", "ShadowArcanaDesc");
            strings[8]  = game.LoadString("UI", "WaterArcanaDesc");
            strings[9]  = game.LoadString("UI", "WindArcanaDesc");
            strings[10] = game.LoadString("UI", "StrengthDesc");
            strings[11] = game.LoadString("UI", "MagicDesc");
            strings[12] = game.LoadString("UI", "SpeedDesc");
            strings[13] = game.LoadString("UI", "HealthDesc");
            strings[14] = game.LoadString("UI", "ManaDesc");
            strings[15] = game.LoadString("UI", "CharCreateAttributeDescBox");
            strings[16] = game.LoadString("UI", "PointsRemaining");
            strings[17] = game.LoadString("UI", "CharCreateHelp1");
            strings[18] = game.LoadString("UI", "CharCreateHelp2");
            strings[19] = game.LoadString("UI", "CharCreateHelp3");
            strings[20] = game.LoadString("UI", "CharCreateHelp4");

            baseOffset    = new Point(game.GetScreenWidth() / 2 - 350, game.GetScreenHeight() / 2 - 295);
            arcanaRecs    = new Rectangle[6];
            helpRectangle = new Rectangle(baseOffset.X + 7, baseOffset.Y + 533, 61, 50);
            var drawVector = new Point(game.GetScreenWidth() / 2 - 200, game.GetScreenHeight() / 2 - 180);

            arcanaRecs[0] = new Rectangle(drawVector.X + 136, drawVector.Y + 1, 128, 128);
            arcanaRecs[1] = new Rectangle(drawVector.X + 254, drawVector.Y + 68, 128, 128);
            arcanaRecs[2] = new Rectangle(drawVector.X + 254, drawVector.Y + 204, 128, 128);
            arcanaRecs[3] = new Rectangle(drawVector.X + 136, drawVector.Y + 271, 128, 128);
            arcanaRecs[4] = new Rectangle(drawVector.X + 18, drawVector.Y + 204, 128, 128);
            arcanaRecs[5] = new Rectangle(drawVector.X + 18, drawVector.Y + 68, 128, 128);

            arcanas[0] = game.TextureLoader.RequestTexture("UI\\Common\\Arcana\\Light");
            arcanas[1] = game.TextureLoader.RequestTexture("UI\\Common\\Arcana\\Fire");
            arcanas[2] = game.TextureLoader.RequestTexture("UI\\Common\\Arcana\\Nature");
            arcanas[3] = game.TextureLoader.RequestTexture("UI\\Common\\Arcana\\Shadow");
            arcanas[4] = game.TextureLoader.RequestTexture("UI\\Common\\Arcana\\Water");
            arcanas[5] = game.TextureLoader.RequestTexture("UI\\Common\\Arcana\\Wind");

            NextButton       = new Button(game.Audio, game.Input, game.TextureLoader.RequestTexture("UI\\Common\\BlankExitButton"), new Point(TopLeft.X + 631, TopLeft.Y + 532), 63, 52, "", game.TextureLoader.RequestTexture("UI\\Highlights\\ExitHighlight"), 0.028f);
            BackButton       = new Button(game.Audio, game.Input, game.TextureLoader.RequestTexture("UI\\Common\\BlankSquareButton"), new Point(TopLeft.X + 565, TopLeft.Y + 533), 61, 50, "", game.TextureLoader.RequestTexture("UI\\Highlights\\SquareHighlight"), 0.029f);
            AttributeButtons = new Button[6];
            drawVector       = new Point(game.GetScreenWidth() / 2 - 240, game.GetScreenHeight() / 2 - 230);
            var recs = new Rectangle[6];

            AttributeButtons[0] = new Button(game.Audio, game.Input, game.TextureLoader.RequestTexture("UI\\Common\\BlankSquareButton"), new Point(drawVector.X + 164, drawVector.Y + 69), 52, 32, "", game.TextureLoader.RequestTexture("UI\\Highlights\\SquareHighlight"), 0.019f);
            AttributeButtons[1] = new Button(game.Audio, game.Input, game.TextureLoader.RequestTexture("UI\\Common\\BlankSquareButton"), new Point(drawVector.X + 164, drawVector.Y + 101), 52, 32, "", game.TextureLoader.RequestTexture("UI\\Highlights\\SquareHighlight"), 0.019f);
            AttributeButtons[2] = new Button(game.Audio, game.Input, game.TextureLoader.RequestTexture("UI\\Common\\BlankSquareButton"), new Point(drawVector.X + 164, drawVector.Y + 150), 52, 32, "", game.TextureLoader.RequestTexture("UI\\Highlights\\SquareHighlight"), 0.019f);
            AttributeButtons[3] = new Button(game.Audio, game.Input, game.TextureLoader.RequestTexture("UI\\Common\\BlankSquareButton"), new Point(drawVector.X + 164, drawVector.Y + 182), 52, 32, "", game.TextureLoader.RequestTexture("UI\\Highlights\\SquareHighlight"), 0.019f);
            AttributeButtons[4] = new Button(game.Audio, game.Input, game.TextureLoader.RequestTexture("UI\\Common\\BlankSquareButton"), new Point(drawVector.X + 164, drawVector.Y + 231), 52, 32, "", game.TextureLoader.RequestTexture("UI\\Highlights\\SquareHighlight"), 0.019f);
            AttributeButtons[5] = new Button(game.Audio, game.Input, game.TextureLoader.RequestTexture("UI\\Common\\BlankSquareButton"), new Point(drawVector.X + 164, drawVector.Y + 263), 52, 32, "", game.TextureLoader.RequestTexture("UI\\Highlights\\SquareHighlight"), 0.019f);
            charAttributes.Add(Magicians.Attributes.Strength, 1);
            charAttributes.Add(Magicians.Attributes.Magic, 1);
            charAttributes.Add(Magicians.Attributes.Dexterity, 1);
            Health = 45;
            Mana   = 25;
        }
コード例 #6
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            var drawVector = new Point(game.GetScreenWidth() / 2 - 350, game.GetScreenHeight() / 2 - 295);

            if (displayTutHighlight)
            {
                spriteBatch.Draw(tutHighlight, new Rectangle(drawVector.X + 7, drawVector.Y + 533, 63, 52), null, new Color(255, 255, 255, highlightAlpha), 0, Vector2.Zero, SpriteEffects.FlipHorizontally, 0f);
            }
            BackButton.Draw(spriteBatch);
            if (Input.IsMouseOver(helpRectangle))
            {
                DrawMethods.DrawToolTip(spriteBatch, new Vector2(game.Input.oldMouseState.X, game.Input.oldMouseState.Y), game.smallFont, tooltipWindow, strings[16 + (int)stage]);
                displayTutHighlight = false;
            }
            if (!canAdvanceToNextStage())
            {
                spriteBatch.Draw(greyedOut, new Rectangle(drawVector.X + 632, drawVector.Y + 533, 61, 50), Color.White);
            }
            else
            {
                NextButton.Draw(spriteBatch);
            }
            switch (stage)
            {
            case (Stage.Naming):
            {
                spriteBatch.DrawString(game.mediumFont, strings[0], new Vector2(drawVector.X + 350, drawVector.Y + 32), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, strings[0]), 1.0f, SpriteEffects.None, 0.0f);
                drawVector.X += 125;
                drawVector.Y += 132;
                spriteBatch.Draw(nameBar, new Rectangle(drawVector.X, drawVector.Y, 500, 68), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.001f);
                drawVector.X += 6;
                drawVector.Y += 6;
                spriteBatch.DrawString(game.largeFont, playerName, drawVector.ToVector2(), Color.Black, 0.0f, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.0f);
                if (displayCursor && nameInputActive)
                {
                    spriteBatch.DrawString(game.largeFont, "|", new Vector2(drawVector.X + game.largeFont.MeasureString(playerName.Substring(0, cursorPosition)).X - 12, drawVector.Y), Color.Black, 0.0f, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.0f);
                }
                spriteBatch.Draw(genderCircle, new Rectangle(baseOffset.X + 160, baseOffset.Y + 282, 70, 70), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.001f);
                spriteBatch.Draw(maleIcon, new Rectangle(baseOffset.X + 172, baseOffset.Y + 296, 44, 44), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0f);
                spriteBatch.Draw(genderCircle, new Rectangle(baseOffset.X + 460, baseOffset.Y + 282, 70, 70), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.001f);
                spriteBatch.Draw(femaleIcon, new Rectangle(baseOffset.X + 474, baseOffset.Y + 296, 44, 44), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0f);
                if (gender == Gender.Male)
                {
                    spriteBatch.Draw(genderHighlight, new Rectangle(baseOffset.X + 160, baseOffset.Y + 282, 70, 70), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0f);
                }
                if (gender == Gender.Female)
                {
                    spriteBatch.Draw(genderHighlight, new Rectangle(baseOffset.X + 460, baseOffset.Y + 282, 70, 70), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.0f);
                }
                break;
            }

            case (Stage.Arcana):
            {
                spriteBatch.DrawString(game.mediumFont, strings[1], new Vector2(drawVector.X + 350, drawVector.Y + 32), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, strings[1]), 1.0f, SpriteEffects.None, 0.0f);
                drawVector = new Point(game.GetScreenWidth() / 2 - 200, game.GetScreenHeight() / 2 - 180);
                spriteBatch.Draw(ArcanaWheel, new Rectangle(drawVector.X, drawVector.Y, 400, 400), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.02f);
                for (int i = 0; i < arcanaRecs.Length; i++)
                {
                    if (game.Input.IsMouseOver(arcanaRecs[i]))
                    {
                        DrawMethods.DrawToolTip(spriteBatch, new Vector2(game.Input.oldMouseState.X, game.Input.oldMouseState.Y), game.smallFont, tooltipWindow, strings[4 + i]);
                        break;
                    }
                }
                if (selectedArcana != Arcana.Null)
                {
                    spriteBatch.Draw(arcanaHighlight, arcanaRecs[(int)selectedArcana], null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.01f);
                }
                break;
            }

            case (Stage.Attributes):
            {
                spriteBatch.DrawString(game.mediumFont, strings[2], new Vector2(drawVector.X + 300, drawVector.Y + 32), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, strings[2]), 1.0f, SpriteEffects.None, 0.0f);
                drawVector = new Point(game.GetScreenWidth() / 2 - 240, game.GetScreenHeight() / 2 - 230);
                spriteBatch.Draw(attributesWindow, new Rectangle(drawVector.X, drawVector.Y, 508, 426), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.02f);
                spriteBatch.DrawString(game.mediumFont, Health.ToString(), new Vector2(drawVector.X + 94, drawVector.Y + 339), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, Health.ToString()), 1.0f, SpriteEffects.None, 0.01f);
                spriteBatch.DrawString(game.mediumFont, Mana.ToString(), new Vector2(drawVector.X + 198, drawVector.Y + 339), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, Mana.ToString()), 1.0f, SpriteEffects.None, 0.01f);
                spriteBatch.DrawString(game.mediumFont, charAttributes[Attributes.Strength].ToString(), new Vector2(drawVector.X + 124, drawVector.Y + 99), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, charAttributes[Attributes.Strength].ToString()), 1.0f, SpriteEffects.None, 0.01f);
                spriteBatch.DrawString(game.mediumFont, charAttributes[Attributes.Magic].ToString(), new Vector2(drawVector.X + 124, drawVector.Y + 181), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, charAttributes[Attributes.Magic].ToString()), 1.0f, SpriteEffects.None, 0.01f);
                spriteBatch.DrawString(game.mediumFont, charAttributes[Attributes.Dexterity].ToString(), new Vector2(drawVector.X + 124, drawVector.Y + 262), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, charAttributes[Attributes.Dexterity].ToString()), 1.0f, SpriteEffects.None, 0.01f);

                var recs = new Rectangle[5];
                recs[0] = new Rectangle(drawVector.X + 15, drawVector.Y + 66, 204, 70);
                recs[1] = new Rectangle(drawVector.X + 15, drawVector.Y + 147, 204, 70);
                recs[2] = new Rectangle(drawVector.X + 15, drawVector.Y + 228, 204, 70);
                recs[3] = new Rectangle(drawVector.X + 13, drawVector.Y + 305, 101, 63);
                recs[4] = new Rectangle(drawVector.X + 118, drawVector.Y + 305, 101, 63);
                for (int i = 0; i < recs.Length; i++)
                {
                    if (game.Input.IsMouseOver(recs[i]))
                    {
                        attributeDesc = strings[10 + i];
                        goto DrawRemainingPoints;
                    }
                }
                if (pointsToAllocate > 0)
                {
                    for (int i = 0; i < AttributeButtons.Length; i++)
                    {
                        AttributeButtons[i].Draw(spriteBatch);
                    }
                }

                attributeDesc = strings[15];
DrawRemainingPoints:
                spriteBatch.DrawString(game.mediumFont, TextMethods.WrapText(game.mediumFont, attributeDesc, 214), new Vector2(drawVector.X + 263, drawVector.Y + 75), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.01f);
                drawVector    = new Point(game.GetScreenWidth() / 2 - 350, game.GetScreenHeight() / 2 - 295);
                drawVector.X += 73;
                drawVector.Y += 548;
                spriteBatch.Draw(pointsRemainingBox, new Rectangle(drawVector.X, drawVector.Y, 210, 36), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.02f);
                drawVector.X += 4;
                drawVector.Y += 8;
                spriteBatch.DrawString(game.mediumFont, strings[16] + pointsToAllocate, drawVector.ToVector2(), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.01f);
                break;
            }

            case (Stage.Finish):
            {
                spriteBatch.DrawString(game.mediumFont, strings[3], new Vector2(drawVector.X + 300, drawVector.Y + 32), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, strings[3]), 1.0f, SpriteEffects.None, 0.0f);
                drawVector = new Point(game.GetScreenWidth() / 2 - 240, game.GetScreenHeight() / 2 - 230);
                spriteBatch.Draw(FinishPanel, new Rectangle(drawVector.X, drawVector.Y, 508, 426), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.02f);
                spriteBatch.DrawString(game.largeFont, playerName, new Vector2(drawVector.X + 18, drawVector.Y + 8), Color.Black, 0.0f, Vector2.Zero, 1, SpriteEffects.None, 0.01f);
                if (gender == Gender.Male)
                {
                    spriteBatch.Draw(maleIcon, new Rectangle(drawVector.X + 54, drawVector.Y + 244, 44, 44), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.0f);
                }
                if (gender == Gender.Female)
                {
                    spriteBatch.Draw(femaleIcon, new Rectangle(drawVector.X + 54, drawVector.Y + 244, 44, 44), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.0f);
                }
                spriteBatch.DrawString(game.mediumFont, Health + "/" + Health, new Vector2(drawVector.X + 256, drawVector.Y + 113), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, Health + "/" + Health), 1.0f, SpriteEffects.None, 0.01f);
                spriteBatch.DrawString(game.mediumFont, Mana + "/" + Mana, new Vector2(drawVector.X + 256, drawVector.Y + 171), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, Mana + "/" + Mana), 1.0f, SpriteEffects.None, 0.01f);
                spriteBatch.DrawString(game.mediumFont, charAttributes[Attributes.Strength].ToString(), new Vector2(drawVector.X + 256, drawVector.Y + 229), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, charAttributes[Attributes.Strength].ToString()), 1.0f, SpriteEffects.None, 0.01f);
                spriteBatch.DrawString(game.mediumFont, charAttributes[Attributes.Magic].ToString(), new Vector2(drawVector.X + 256, drawVector.Y + 287), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, charAttributes[Attributes.Magic].ToString()), 1.0f, SpriteEffects.None, 0.01f);
                spriteBatch.DrawString(game.mediumFont, charAttributes[Attributes.Dexterity].ToString(), new Vector2(drawVector.X + 256, drawVector.Y + 345), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, charAttributes[Attributes.Dexterity].ToString()), 1.0f, SpriteEffects.None, 0.01f);
                spriteBatch.Draw(arcanas[(int)selectedArcana], new Rectangle(drawVector.X + 15, drawVector.Y + 94, 120, 120), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.01f);
                drawVector = new Point(game.GetScreenWidth() / 2 - 350, game.GetScreenHeight() / 2 - 295);
                spriteBatch.Draw(finishTick, new Rectangle(drawVector.X + 632, drawVector.Y + 533, 61, 50), null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0.029f);
                break;
            }
            }
        }
コード例 #7
0
ファイル: DrawMethods.cs プロジェクト: hoptond/magiciansdemo
 public static void DrawToolTip(SpriteBatch spriteBatch, Vector2 vec, SpriteFont font, Texture2D window, string s)
 {
     spriteBatch.Draw(window, new Rectangle((int)vec.X, (int)vec.Y, 400, 76), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.002f);
     spriteBatch.DrawString(font, TextMethods.WrapText(font, s, 380), new Vector2(vec.X + 12, vec.Y + 8), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.001f);
 }
コード例 #8
0
ファイル: Inventory.cs プロジェクト: hoptond/magiciansdemo
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            var drawVector = new Vector2(TopLeft.X + 23, TopLeft.Y + 64);

            for (int i = 0; i < pc.Equips.Length; i++)
            {
                if (pc.Equips[i] != null)
                {
                    spriteBatch.Draw(pc.Equips[i].Icon, new Rectangle((int)drawVector.X, (int)drawVector.Y, 64, 64), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.17f);
                }
                drawVector.X += 67;
            }
            drawVector = new Vector2(TopLeft.X + 23, TopLeft.Y + 153);
            var firstEquips = new List <Item>();

            for (int i = 0; i < pc.Inventory.Count; i++)
            {
                var drawRectangle = new Rectangle((int)drawVector.X, (int)drawVector.Y, 64, 64);
                spriteBatch.Draw(pc.Inventory[i].Icon, new Rectangle((int)drawVector.X, (int)drawVector.Y, 64, 64), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.17f);
                if ((pc.Inventory[i] is EquippableItem))
                {
                    if (pc.Equips.Contains((EquippableItem)pc.Inventory[i]) && !firstEquips.Contains(pc.Inventory[i]))
                    {
                        spriteBatch.Draw(equipIcon, new Rectangle((int)drawVector.X + 4, (int)drawVector.Y + 4, 16, 16), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.14f);
                        firstEquips.Add(pc.Inventory[i]);
                    }
                }
                if (game.Input.IsMouseOver(drawRectangle))
                {
                    if (drawHighlight)
                    {
                        spriteBatch.Draw(highlight, new Rectangle((int)drawVector.X, (int)drawVector.Y, 64, 64), Color.White);
                    }
                    if (draggedItemIndex == -1 && droppedItemIndex == -1 && displayNameWindow == false)
                    {
                        spriteBatch.DrawString(game.mediumFont, TextMethods.WrapText(game.mediumFont, pc.Inventory[i].DisplayName, 400), new Vector2(TopLeft.X + 458, TopLeft.Y + 23), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, TextMethods.WrapText(game.mediumFont, pc.Inventory[i].DisplayName, 400)), 1.0f, SpriteEffects.None, 0.17f);
                        spriteBatch.Draw(pc.Inventory[i].Icon, new Rectangle(TopLeft.X + 458, TopLeft.Y + 100, 64, 64), null, Color.White, 0.0f, new Vector2(pc.Inventory[i].Icon.Width / 2, pc.Inventory[i].Icon.Height / 2), SpriteEffects.None, 0.17f);
                        spriteBatch.DrawString(game.smallFont, pc.Inventory[i].Description, new Vector2(TopLeft.X + 458, TopLeft.Y + 164), Color.Black, 0.0f, TextMethods.CenterText(game.smallFont, pc.Inventory[i].Description), 1.0f, SpriteEffects.None, 0.17f);
                        if (pc.Inventory[i] is EquippableItem)
                        {
                            var equip = (EquippableItem)pc.Inventory[i];
                            for (int e = 0; e < equip.equipEffects.Count; e++)
                            {
                                spriteBatch.DrawString(game.smallFont, equip.equipEffects[e].Description(), new Vector2(TopLeft.X + 458, TopLeft.Y + 252 + (12 * e)), Color.Black, 0.0f, TextMethods.CenterText(game.smallFont, equip.equipEffects[e].Description()), 1.0f, SpriteEffects.None, 0.17f);
                            }
                        }
                        if (pc.Inventory[i] is ConsumableItem)
                        {
                            var consum = (ConsumableItem)pc.Inventory[i];
                            if (consum.BattleAction != null)
                            {
                                for (int e = 0; e < consum.BattleAction.actionEffects.Count; e++)
                                {
                                    spriteBatch.DrawString(game.smallFont, consum.BattleAction.ReturnInventoryDescription(e), new Vector2(TopLeft.X + 458, TopLeft.Y + 252 + (12 * e)), Color.Black, 0.0f, TextMethods.CenterText(game.smallFont, consum.BattleAction.ReturnInventoryDescription(e)), 1.0f, SpriteEffects.None, 0.17f);
                                }
                            }
                        }
                    }
                }
                drawVector.X += 67;
                if (i == 3)
                {
                    drawVector.X = TopLeft.X + 23;
                    drawVector.Y = TopLeft.Y + 220;
                }
                if (i == 7)
                {
                    drawVector.X = TopLeft.X + 23;
                    drawVector.Y = TopLeft.Y + 287;
                }
                if (i == 11)
                {
                    drawVector.X = TopLeft.X + 23;
                    drawVector.Y = TopLeft.Y + 354;
                }
            }
            if (dragAndDropActive && !confirmDropItem)
            {
                spriteBatch.Draw(pc.Inventory[draggedItemIndex].Icon, new Rectangle(game.Input.oldMouseState.X, game.Input.oldMouseState.Y, 64, 64), null, Color.FromNonPremultiplied(225, 225, 225, 135), 0.0f, new Vector2(32, 32), SpriteEffects.None, 0.0f);
            }
            if (confirmDropItem)
            {
                spriteBatch.Draw(confirmWindow, new Rectangle(game.GetScreenWidth() / 2, game.GetScreenHeight() / 2, 384, 192), null, Color.White, 0.0f, new Vector2(192, 69), SpriteEffects.None, 0.02f);
                spriteBatch.DrawString(game.mediumFont, strings[0], new Vector2(game.GetScreenWidth() / 2, game.GetScreenHeight() / 2), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, strings[0]), 1.0f, SpriteEffects.None, 0.01f);
                ConfirmButtons[0].Draw(spriteBatch);
                ConfirmButtons[1].Draw(spriteBatch);
            }
            if (displayNameWindow)
            {
                NameWindow.Draw(spriteBatch);
            }
            if (inBattle)
            {
                spriteBatch.Draw(greyedOut, new Rectangle(TopLeft.X + 348, TopLeft.Y + 413, 86, 50), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.01f);
                spriteBatch.Draw(greyedOut, new Rectangle(TopLeft.X + 440, TopLeft.Y + 413, 86, 50), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.01f);
            }
            if (inBattle)
            {
                if (party.ActiveCharacters.Count == 1)
                {
                    spriteBatch.Draw(greyedOut, new Rectangle(TopLeft.X + 348, TopLeft.Y + 413, 86, 50), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.01f);
                }
            }
        }
コード例 #9
0
ファイル: Dialogue.cs プロジェクト: hoptond/magiciansdemo
        public void SetText(string t, Walker e)
        {
            var chara = game.party.GetPlayerCharacter(0);

            switch (game.settings.textSpeed)
            {
            case (TextSpeed.Fast):
            {
                originDelay = 7f;
                break;
            }

            case (TextSpeed.Medium):
            {
                originDelay = 14f;
                break;
            }

            case (TextSpeed.Slow):
            {
                originDelay = 20f;
                break;
            }
            }
            if (Text == "")
            {
                Text         = t;
                this.State   = DiagStates.Parsing;
                textPosition = 0;
            }
            int i = 0;

            //todo: replace this horrible shitcode with regex at some point
            while (i + 4 < Text.Length)
            {
                if (Text[i] == '$')
                {
                    Text = Text.Remove(i, 1);
                    if (Text[i] == 'c')
                    {
                        for (int c = i; c < Text.Length; c++)
                        {
                            if (c == ' ')
                            {
                                var counter = Text.Substring(i, c - 1);
                                if (game.gameCounters.ContainsKey(counter))
                                {
                                    Text = Text.Remove(i, c - 1);
                                    Text = Text.Insert(i, game.gameCounters[counter].ToString());
                                }
                                break;
                            }
                        }
                    }
                    if (Text.Substring(i, 2) == "up")
                    {
                        var s = game.settings.upKey.ToString();
                        Text = Text.Remove(i, 2);
                        Text = Text.Insert(i, s);
                    }
                    if (Text.Substring(i, 4) == "down")
                    {
                        var s = game.settings.downKey.ToString();
                        Text = Text.Remove(i, 4);
                        Text = Text.Insert(i, s);
                    }
                    if (Text.Substring(i, 4) == "left")
                    {
                        var s = game.settings.leftKey.ToString();
                        Text = Text.Remove(i, 4);
                        Text = Text.Insert(i, s);
                    }
                    if (Text.Substring(i, 4) == "rght")
                    {
                        var s = game.settings.rightKey.ToString();
                        Text = Text.Remove(i, 4);
                        Text = Text.Insert(i, s);
                    }
                    if (Text.Substring(i, 3) == "map")
                    {
                        var s = game.settings.upKey.ToString();
                        Text = Text.Remove(i, 3);
                        Text = Text.Insert(i, game.settings.mapKey.ToString());
                    }
                    if (Text.Substring(i, 3) == "run")
                    {
                        var s = game.settings.upKey.ToString();
                        Text = Text.Remove(i, 3);
                        Text = Text.Insert(i, game.settings.runKey.ToString());
                    }
                    if (Text.Substring(i, 4) == "stat")
                    {
                        var s = game.settings.statusKey.ToString();
                        Text = Text.Remove(i, 4);
                        Text = Text.Insert(i, s);
                    }
                    if (Text.Substring(i, 3) == "snk")
                    {
                        var s = game.settings.sneakKey.ToString();
                        Text = Text.Remove(i, 3);
                        Text = Text.Insert(i, s);
                    }
                    if (Text.Substring(i, 4) == "spll")
                    {
                        Text = Text.Remove(i, 5);
                        Text = Text.Insert(i, game.party.QuestStats.learntSpellString);
                    }
                    if (Text.Substring(i, 4) == "scre")
                    {
                        Text = Text.Remove(i, 4);
                        Text = Text.Insert(i, game.party.QuestStats.Grade.ToString());
                        i    = 0;
                    }
                    if (Text.Substring(i, 4) == "plyr")
                    {
                        Text = Text.Remove(i, 4);
                        Text = Text.Insert(i, chara.Name);
                        i    = 0;
                    }
                    if (Text.Substring(i, 4) == "PLYR")
                    {
                        Text = Text.Remove(i, 4);
                        Text = Text.Insert(i, chara.Name.ToUpper());
                        i    = 0;
                    }
                    if (Text.Substring(i, 4).ToLower() == "prn1")
                    {
                        var caps = false;
                        if (char.IsUpper(Text[i + 1]))
                        {
                            caps = true;
                        }
                        Text = Text.Remove(i, 4);
                        switch (chara.Gender)
                        {
                        case (Gender.Male):
                        {
                            Text = Text.Insert(i, game.LoadString("Common", "MalePronoun1"));
                            break;
                        }

                        case (Gender.Female):
                        {
                            Text = Text.Insert(i, game.LoadString("Common", "FemalePronoun1"));
                            break;
                        }

                        case (Gender.Other):
                        {
                            Text = Text.Insert(i, game.LoadString("Common", "NeutralPronoun1"));
                            break;
                        }
                        }
                        if (caps)
                        {
                            var s = Text.Substring(i, 1);
                            Text.Remove(i, 1);
                            Text.Insert(i, s.ToUpper());
                        }
                        i = 0;
                    }
                    if (Text.Substring(i, 3) == "spl")
                    {
                        var number = int.Parse(Text.Substring(i + 3, 1));
                        Text = Text.Remove(i, 4);
                        try
                        {
                            Text = Text.Insert(i, chara.Spells[number].DisplayName);
                        }
                        catch
                        {
                            Text = Text.Insert(i, chara.Spells[chara.Spells.Count - 1].DisplayName);
                        }
                    }
                    if (Text.Substring(i, 4) == "item")
                    {
                        var word = "";
                        for (int w = i; w < Text.Length; w++)
                        {
                            if (Text[w] == ' ' || Text[w] == '!' || Text[w] == '?' || Text[w] == '.' | Text[w] == ',')
                            {
                                word = Text.Substring(i, w - i);
                                break;
                            }
                        }
                        if (word != "")
                        {
                            var itemname = "";
                            itemname = game.Items.Find(itm => itm.InternalName == word).DisplayName;
                            if (itemname != "")
                            {
                                Text = Text.Remove(i, word.Length);
                                Text = Text.Insert(i, itemname);
                            }
                        }
                    }
                    if (Text.Substring(i, 4) == "prn2")
                    {
                        bool caps = false;
                        if (char.IsUpper(Text[i + 1]))
                        {
                            caps = true;
                        }
                        Text = Text.Remove(i, 4);
                        switch (chara.Gender)
                        {
                        case (Gender.Male):
                        {
                            Text = Text.Insert(i, game.LoadString("Common", "MalePronoun2"));
                            break;
                        }

                        case (Gender.Female):
                        {
                            Text = Text.Insert(i, game.LoadString("Common", "FemalePronoun2"));
                            break;
                        }

                        case (Gender.Other):
                        {
                            Text = Text.Insert(i, game.LoadString("Common", "NeutralPronoun2"));
                            break;
                        }
                        }
                        if (caps)
                        {
                            var s = Text.Substring(i, 1);
                            Text.Remove(i, 1);
                            Text.Insert(i, s.ToUpper());
                        }
                        i = 0;
                    }
                    if (Text.Substring(i, 4) == "prn3")
                    {
                        var caps = false;
                        if (char.IsUpper(Text[i + 1]))
                        {
                            caps = true;
                        }
                        Text = Text.Remove(i, 4);
                        switch (chara.Gender)
                        {
                        case (Gender.Male):
                        {
                            Text = Text.Insert(i, game.LoadString("Common", "MalePronoun3"));
                            break;
                        }

                        case (Gender.Female):
                        {
                            Text = Text.Insert(i, game.LoadString("Common", "FemalePronoun3"));
                            break;
                        }

                        case (Gender.Other):
                        {
                            Text = Text.Insert(i, game.LoadString("Common", "NeutralPronoun3"));
                            break;
                        }
                        }
                        if (caps)
                        {
                            var s = Text.Substring(i, 1);
                            Text.Remove(i, 1);
                            Text.Insert(i, s.ToUpper());
                        }
                        i = 0;
                    }
                    try
                    {
                        if (Text.Substring(i - 2, 2) == ". ")
                        {
                            if (Char.IsLetter(Text[i - 2]))
                            {
                                if (Char.IsLower(Text[i - 2]))
                                {
                                    var letter = Char.ToUpper(Text[i - 2]);
                                    Text = Text.Remove(i - 2, 1);
                                    Text = Text.Insert(i - 2, letter.ToString());
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                    if (i < Text.Length - 2)
                    {
                        if (Text.Substring(i, 2) == "\\n")
                        {
                            Text = Text.Remove(i, 2);
                            Text = Text.Insert(i, Environment.NewLine);
                        }
                    }
                }
                i++;
            }
            if (Text.Length > 0)
            {
                if (Char.IsLower(Text[0]))
                {
                    var letter = Char.ToUpper(Text[0]);
                    Text = Text.Remove(0, 1);
                    Text = Text.Insert(0, letter.ToString());
                }
            }
            if (e != null)
            {
                activeSpeaker = e;
                if (activeSpeaker != null)
                {
                    activeSpeaker.ChangeWalkerState(WalkerState.Talking);
                }
                if (activeSpeaker.DisplayName != null)
                {
                    if (game.mediumFont.MeasureString(activeSpeaker.DisplayName).X > 150)
                    {
                        usingBigNameWindow = true;
                    }
                }
            }
            steps = 0;
            Text  = TextMethods.WrapText(game.mediumFont, Text, 700);
        }