コード例 #1
0
        public void Draw(SpriteBatch spriteBatch)
        {
            if (!Visible)
            {
                return;
            }
            Text.Draw(spriteBatch, new Loc());

            //when text is paused and waiting for input, flash a tick at the end
            TextPause textPause = getCurrentTextPause();

            if (textPause != null && textPause.Time == 0)
            {
                //text needs a "GetTextProgress" method, which returns the end loc of the string as its currently shown.
                //the coordinates are relative to the string's position
                Loc loc = Text.GetTextProgress() + Text.Start;

                if ((GraphicsManager.TotalFrameTick / (ulong)FrameTick.FrameToTick(CURSOR_FLASH_TIME / 2)) % 2 == 0)
                {
                    GraphicsManager.Cursor.DrawTile(spriteBatch, new Vector2(loc.X + 2, loc.Y), 0, 0);
                }
            }

            //draw down-tick
            if (HoldTime == -1 && CurrentFadeTime >= FADE_TIME && Text.Finished && (GraphicsManager.TotalFrameTick / (ulong)FrameTick.FrameToTick(CURSOR_FLASH_TIME / 2)) % 2 == 0)
            {
                Loc end = Text.GetTextProgress();
                GraphicsManager.Cursor.DrawTile(spriteBatch, new Vector2(GraphicsManager.ScreenWidth / 2 - 5, GraphicsManager.ScreenHeight / 2 + end.Y + 16), 1, 0);
            }
        }
コード例 #2
0
ファイル: DialogueBox.cs プロジェクト: Parakoopa/RogueEssence
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (!Visible)
            {
                return;
            }
            base.Draw(spriteBatch);

            //when text is paused and waiting for input, flash a tick at the end
            TextPause textPause = getCurrentTextPause();

            if (textPause != null && textPause.Time == 0)
            {
                //text needs a "GetTextProgress" method, which returns the end loc of the string as its currently shown.
                //the coordinates are relative to the string's position
                Loc loc = Text.GetTextProgress() + Text.Start;

                if ((GraphicsManager.TotalFrameTick / (ulong)FrameTick.FrameToTick(CURSOR_FLASH_TIME / 2)) % 2 == 0)
                {
                    GraphicsManager.Cursor.DrawTile(spriteBatch, new Vector2(loc.X + 2, loc.Y), 0, 0);
                }
            }

            if (speakerPic != null)
            {
                speakerPic.Draw(spriteBatch, new Loc());
            }
        }