Esempio n. 1
0
        public override void DrawBegin(GameTime gameTime, SpriteBatch spriteBatch)
        {
            target = new RenderTarget2D(Global.graphics, WIDTH, HEIGHT);
            Global.graphics.SetRenderTarget(target);
            Global.graphics.Clear(new Color(0, 0, 0, 0));
            spriteBatch.Begin();
            spriteBatch.Draw(background, new Vector2(0, 0), Color.White);
            hero.sprite.Draw(gameTime, spriteBatch, HEROLOCATION_X, HEROLOCATION_Y, Color.White, index: 0);
            for (int i = 0; i <= hero.level; i++)
            {
                for (int s = 0; s < Hero.SoulPerLevel[i]; s++)
                {
                    int si = 0;
                    if (hero.soul > s)
                    {
                        si = 1;
                    }
                    spriteBatch.Draw(soul[si], new Vector2(SOULSTART_X - (SOULTERM * s), SOULSTART_Y), Color.White);
                }
            }
            spriteBatch.Draw(levels[hero.level - 1], new Vector2(LEVELSTART_X, LEVELSTART_Y), Color.White);
            spriteBatch.DrawString(font, hero.name, new Vector2(2, 2), Toolbox.ParseColor("#5e3643ff"));
            spriteBatch.End();

            base.DrawBegin(gameTime, spriteBatch);

            Global.graphics.SetRenderTarget(null);
        }
Esempio n. 2
0
        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            spriteBatch.Begin();
            spriteBatch.Draw(texture, new Vector2(x, y), sourceRectangle: new Rectangle(0, 0, WIDTH, HEIGHT),
                             color: Color.White);
            if (page.animating)
            {
                page.Draw(gameTime, spriteBatch, x, y, Color.White);
            }
            else
            {
                Skill skill = skills[index];
                spriteBatch.Draw(skill.icon, new Vector2(x + ICON_X, y + ICON_Y), Color.White);
                spriteBatch.Draw(texture, new Vector2(x + ICON_X - 2, y + ICON_Y - 2),
                                 sourceRectangle: new Rectangle(0, HEIGHT, FRAME_WIDTH, FRAME_HEIGHT), color: Color.White);
                // Draw name
                Toolbox.DrawAlignedString(spriteBatch, skill.name, x + NAME_X, y + NAME_Y, font24, Toolbox.ParseColor("#5e3643ff"), PAGE_WIDTH,
                                          AlignType.Center, AlignType.Center);
                // Draw Consumption
                Toolbox.DrawAlignedString(spriteBatch, "SP " + skill.manaUsage, x + CONSUMPTION_X, y + CONSUMPTION_Y,
                                          font12, Toolbox.ParseColor("#3978a8ff"), PAGE_WIDTH, AlignType.Center, AlignType.Center);
                // Draw Description
                Toolbox.DrawAlignedString(spriteBatch, skill.GetDescription(), x + DESCRIPTION_X, y + DESCRIPTION_Y,
                                          font12, Toolbox.ParseColor("#5e3643ff"), PAGE_WIDTH, AlignType.Center, AlignType.Left);
            }

            spriteBatch.End();
        }
Esempio n. 3
0
        public override void Update(GameTime gameTime)
        {
            if (!shown)
            {
            }
            else if (starting)
            {
                yScale += 0.1f;
                if (yScale >= 1.0f)
                {
                    yScale   = 1.0f;
                    starting = false;
                }
            }
            else if (wait)
            {
            }
            else if (isEnd)
            {
                yScale -= 0.1f;
                if (yScale <= 0.0f)
                {
                    yScale   = 0.0f;
                    Finished = true;
                }
            }
            else
            {
                timespan++;
                if (timespan >= interval) // Ticking
                {
                    bool skip = false;
                    timespan = 1; // Resets timespan.
                    while (!wordProcessing && characterIndex < textList[index].Length)
                    {
                        string characterBuffer = "";
                        characterBuffer += GetCharacter();

                        if (characterBuffer == " ") // White space
                        {
                            AddWordBuffer(characterBuffer);
                            characterIndex++;
                            wordProcessing = true;
                        }
                        else if (characterBuffer == "<") // Tag
                        {
                            characterIndex++;
                            skip = true;
                            switch (GetCharacter())
                            {
                            case 'n': characterIndex += 2; NextLine(); break;     // Next line.

                            case 'w': characterIndex += 2; wait = true; break;    // Wait.

                            case 'r': characterIndex += 2; characterBuffer = "";  // Rests for a while.
                                while (GetCharacter() != '>')
                                {
                                    characterBuffer += GetCharacter();
                                    characterIndex++;
                                }
                                timespan -= int.Parse(characterBuffer);
                                characterIndex++; break;

                            case 'f':                                               // Sets interval.
                                characterIndex += 2; characterBuffer = "";
                                while (GetCharacter() != '>')
                                {
                                    characterBuffer += GetCharacter();
                                    characterIndex++;
                                }
                                interval = int.Parse(characterBuffer);
                                characterIndex++; break;

                            case 'c':                                               // Sets color.
                                characterIndex += 2; characterBuffer = "";
                                while (GetCharacter() != '>')
                                {
                                    characterBuffer += GetCharacter();
                                    characterIndex++;
                                }
                                fontColor = Toolbox.ParseColor(characterBuffer);
                                characterIndex++; break;
                            }
                        }
                        else // Normal word
                        {
                            characterIndex++;
                            if (characterIndex < textList[index].Length)
                            {
                                while (GetCharacter() != ' ' &&
                                       GetCharacter() != '<')
                                {
                                    characterBuffer += GetCharacter();
                                    characterIndex++;
                                    if (characterIndex >= textList[index].Length)
                                    {
                                        break;
                                    }
                                }
                            }
                            if (lineWidth + font.MeasureString(characterBuffer).X >= WIDTH)
                            {
                                NextLine();
                            }
                            AddWordBuffer(characterBuffer);
                            wordProcessing = true;
                        }
                    }
                    if (wordProcessing && !skip)
                    {
                        if (wordBuffer[wordBuffer.Count - 1].Process())
                        {
                            wordProcessing = false;
                        }
                    }
                    if (characterIndex >= textList[index].Length && !wordProcessing)
                    {
                        // Increase index resets variables.
                        index++;
                        if (!wait)
                        {
                            Reset();
                        }
                        if (index >= textList.Count)
                        {
                            isEnd = true;
                        }
                    }
                }
            }

            // Update words.
            foreach (DynamicWord word in wordBuffer)
            {
                word.Update(gameTime);
            }
        }