예제 #1
0
 private void SubtitleText_Enter(object sender, EventArgs e)
 {
     if (SubtitleText.Text.Equals("Profile Subtitle"))
     {
         SubtitleText.Clear();
     }
 }
예제 #2
0
        protected override void InitLevelSpecific()
        {
            Music = new GameMusic();
            Add(Music);

            SubtitleText t = new SubtitleText();

            t.AddText("QUEST FOR THE\nPIXEL PRINCESS", 6f);
            t.AddText("You, The Golden Knight, must\nrescue the princess...", 5f);
            t.AddText("...from the clutches of\nthe evil Red Guard.", 5f);
            //t.AddText("...from the clutches of\nthe evil Red Guard.", 5f);
            Subtitles.Show(0, t);

            t           = new SubtitleText("My ears! Hark the drums\nof the Red Guard!");
            t.StartTime = 64.0f;
            t.Duration  = 10.0f;
            Subtitles.Show(0, t);

            t = new SubtitleText();
            t.AddText("Music 'The Never Ending Quest For The\nPrincess II' by Producer Snafu!\nCC-BY-NC  producersnafu.bandcamp.com", 10f);
            t.AddText("FMOD Audio engine\n(c) Firelight Technologies Pty, Ltd. 2004-2009.", 6f);
            //t.Duration = 10f;
            Parent.Add(t);
            t.ScaleVector     = new Vector2(1f, 1f);
            t.Motion.Scale    = 0.35f;/// DEFAULT_SCALE;
            t.Motion.Position = new Vector2(0.35f, 0.25f);
            //t.DrawInfo.Center = Vector2.Zero;
            t.StartTime = 17f;
        }
예제 #3
0
 public ShowMessageToy(int priority, SubtitleText msg)
 {
     CanBePickedUp      = false;
     this.Priority      = priority;
     Message            = msg;
     DrawInfo.DrawColor = Color.Transparent;
 }
예제 #4
0
        private void RenderTextCell(CellRendererText renderer, TreeIter iter, SubtitleText subtitleText, SubLib.Core.Domain.Style subtitleStyle)
        {
            /* If there's no text, return empty text without line count */
            if (subtitleText.IsEmpty)
            {
                RenderEmptyTextCell(renderer);
                return;
            }

            string textMarkup  = String.Empty;
            string stylePrefix = String.Empty;
            string styleSuffix = String.Empty;

            GetStyleMarkup(subtitleStyle, ref stylePrefix, ref styleSuffix);

            bool first           = true;
            bool viewLineLengths = Base.Config.ViewLineLengths;

            foreach (string line in subtitleText)
            {
                textMarkup += (first ? String.Empty : "\n") + stylePrefix + GLib.Markup.EscapeText(line) + styleSuffix + (viewLineLengths ? " <span size=\"small\"><sup>(" + line.Length + ")</sup></span>" : String.Empty);
                if (first)
                {
                    first = false;
                }
            }

            renderer.Markup = textMarkup;
        }
예제 #5
0
 public ShowMessageToy(int priority, string msg, float duration)
 {
     CanBePickedUp      = false;
     this.Priority      = priority;
     Message            = new SubtitleText(msg);
     Message.Duration   = duration;
     DrawInfo.DrawColor = Color.Transparent;
 }
예제 #6
0
        public void Format_NullText_Throws()
        {
            SubtitleText nullText = null;

            var formatter = CreateFormatter();

            Assert.Throws <ArgumentNullException>(
                () => formatter.Format(nullText));
        }
예제 #7
0
        public void Constructor_NullText_Throws()
        {
            SubtitleText nullText = null;

            Assert.Catch <ArgumentNullException>(
                () => new Subtitle(
                    SubtitleIdTests.CreateId1(),
                    SubtitleTimestampsTests.CreateTimestamps(),
                    nullText));
        }
        public string Format(SubtitleText textLines)
        {
            if (textLines == null)
            {
                throw new ArgumentNullException(nameof(textLines));
            }

            return(string.Join(
                       ' ',
                       textLines.Value
                       .Select(l => l.Value).ToList()));
        }
예제 #9
0
        protected override void InitLevelSpecific()
        {
            Music = new GameMusic();
            Sound = new GameSound();
            Add(Music);
            Add(Sound);

            // pink arthur
            king = new PinkArthur();
            king.PositionAndTarget = PINKARTHUR_POSITION;
            //king.PositionAndTarget = new Vector2(90f,158f); // debug
            Add(king);

            // graphic title/logo
            Spritelet logo = new PixieLogo("title-logo.png");

            logo.Duration            = 8f;
            logo.StartTime           = 13f;
            logo.DrawInfo.LayerDepth = 0.1f;
            Parent.AddNextUpdate(logo);

            SubtitleText t = new SubtitleText();

            t.AddText("Knights of honor!", 4f);
            t.AddText("Follow me! Together we will\nrescue Arthur, our King.", 4f);
            t.AddText("(Knights:)\nFOR JUSTICE! FOR THE KING!!", 4f).DrawInfo.DrawColor = Color.RoyalBlue;
            Subtitles.Show(0, t);
            t.StartTime = 1f;

            t = new SubtitleText();
            t.IsAutoPosition = true;
            t.ScaleVector    = new Vector2(1f, 1f);
            t.ShadowVector   = new Vector2(1f, 1f);
            t.Motion.Scale   = 0.5f;
            t.StartTime      = logo.StartTime + logo.Duration + 0.6f;
            t.AddText("Galad the Golden, you must rescue Pink Arthur...", 5f);
            t.AddText("...from the clutches of the evil Red Guard.", 5f);
            t.AddText("The Fourteen Kobalt Knights will aid you!", 5f);
            t.AddText("Arthur was taken deep into Red's Keep...", 5f);
            t.AddText("...where rumors say the Giant Red Sorceress lives.", 5f);
            t.AddText("Get him out and take him back, chivalrous knight!", 5f);
            t.AddText("", 1f);
            t.AddText("Press F1 for controls help", 6f);
            t.AddText("", 1f);
            t.AddText("Coding & art by Indiegame Garden", 4f);
            t.AddText("Sounds by Jute and artisticdude (opengameart.org)", 3f);
            t.AddText("Music by John the Luteist", 3f);
            t.AddText("Sprite by Charles Gabriel (opengameart.org)", 3f);
            t.AddText("Press F1 for controls help", 3f);
            Parent.Add(t);
            t.Motion.Position = new Vector2(Screen.Center.X, 0.08f);
        }
예제 #10
0
        /// <summary>
        /// called when player wins game
        /// </summary>
        protected void PixieHasWon()
        {
            SubtitleText t = new SubtitleText();

            t.AddText("YOU WIN!", 5f);
            t.AddText("The princess\nis rescued.", 4f);
            t.AddText("", 2f);
            t.AddText("But wait a minute...", 3f);
            t.AddText("How do we get out??", 3f);
            t.AddText("*THE END*", 3f);
            Subtitles.Show(6, t);
            hasWon = true;
        }
예제 #11
0
 private void ReadSubtitles(Encoding encoding, ParsingProperties properties, SubtitleCollection collection)
 {
     string[] lines = text.Split(new char[] { '\n' });
     for (int i = 0; i < lines.Length; i++)
     {
         SubtitleText stext = ParseSubtitleText(lines[i]);
         Style        style = new Style();
         if (!stext.IsEmpty)
         {
             Subtitle subtitle = new Subtitle(null, stext, style);
             collection.Add(subtitle);
         }
     }
 }
예제 #12
0
        protected override void InitLevelSpecific()
        {
            Music = new GameMusic();
            Add(Music);

            SubtitleText t = new SubtitleText();

            t.StartTime = 2f;
            t.AddText("Oh no.", 3f);
            t.AddText("", 3f);
            t.AddText("Where am I?", 3f);
            t.AddText("I'm lost.", 3f);
            t.AddText("Can you help me\nget back home?", 3f);
            Parent.Add(t);
        }
예제 #13
0
        private SubtitleSearchResults FindInTextContentTillIndex(int subtitleNumber, string lineBreak, Regex regex, int endIndex, SubtitleTextType textType, bool backwards)
        {
            SubtitleText text         = subtitles.GetSubtitleText(subtitleNumber, textType);
            string       subtitleText = text.Get(lineBreak);

            if (backwards)
            {
                string subtitleTextSubstring = subtitleText.Substring(endIndex);
                return(MatchValues(regex.Match(subtitleTextSubstring), subtitleNumber, textType, endIndex));
            }
            else
            {
                string subtitleTextSubstring = subtitleText.Substring(0, endIndex);
                return(MatchValues(regex.Match(subtitleTextSubstring), subtitleNumber, textType, 0));
            }
        }
예제 #14
0
        protected override void InitLevelSpecific()
        {
            Music = new GameMusic();
            Add(Music);

            SubtitleText t = new SubtitleText();

            t.AddText("Don't you just hate\ntitle screens?", 4f);
            t.AddText("Me too. I'd rather\nbe in the game.", 3f);
            t.AddText("", 2f);
            t.AddText("I'm Pixie, by the way.", 2.6f);
            t.AddText("Look, I'm a pixel!", 2.6f);
            t.AddText("Push the arrows to\nhelp me a bit.", 3f);
            t.StartTime = 2f;
            Subtitles.Show(0, t);
        }
예제 #15
0
        public void Format_Always_ReturnsLinesSeparatedBySpaces()
        {
            var toFormat = new SubtitleText(
                new List <CharacterLine> {
                new CharacterLine("A line"),
                new CharacterLine("Another line")
            });

            string expected = "A line Another line";

            var formatter = CreateFormatter();

            string actual = formatter.Format(toFormat);

            Assert.AreEqual(expected, actual);
        }
예제 #16
0
        protected override void InitLevelSpecific()
        {
            Music = new GameMusic();
            Add(Music);

            SubtitleText t = new SubtitleText();

            t.AddText("Always down. I want to go free!", 4.751f).ScaleVector   = new Vector2(1f, 1f);
            t.AddText("See the world, and be ... a tree!", 4.751f).ScaleVector = new Vector2(1f, 1f);
            t.StartTime = 0f;
            Subtitles.Show(0, t);

            tObjCount                 = new SubtitleText(""); tObjCount.ScaleVector = new Vector2(0.8f, 1f);
            tObjCount.StartTime       = 0f;
            tObjCount.Motion.Position = new Vector2(Screen.Width - 0.25f, 0.035f);
            tObjCount.Visible         = false;
            Subtitles.Show(-2, tObjCount);
        }
예제 #17
0
        protected override void InitLevelSpecific()
        {
            Music = new GameMusic();
            Sound = new GameSound();

            // princess

            /*
             * Princess p = new Princess();
             * p.PositionAndTarget = PRINCESS_POSITION;
             * //p.PositionAndTarget = new Vector2(90f,158f); // debug
             * Add(p);
             */

            SubtitleText t = new SubtitleText();

            t.AddText("COMPANIONS!", 4f);
            t.AddText("Follow me! Together, we will rescue\nthe Princess!", 4f);
            t.AddText("Squash those Red Guards...!", 4f);
            Subtitles.Show(0, t);
            t.StartTime = 1f;

            t = new SubtitleText();
            t.AddText("Quest for the Pixel Princess XIV", 5f);
            t.AddText("You, Galad the Golden, must rescue the Pink Princess once more...", 5f);
            t.AddText("...from the clutches of the evil Red Guard.", 5f);
            t.AddText("The Fourteen Cobalt Companions have come to your aid!", 5f);
            t.AddText("The princess was taken into Red's Keep.", 5f);
            t.AddText("Get her out, valiant knight!", 5f);
            t.AddText("", 1f);
            t.AddText("Arrows / WASD = move, SPACE = Companion's attack, X = Use Spell", 5f);
            t.AddText("", 1f);
            t.AddText("Coding & art by Indiegame Garden (IndiegameGarden.com)", 4f);
            t.AddText("Sounds by Jute and artisticdude (opengameart.org)", 4f);
            t.AddText("Music by you-may-know-who (guess!)", 4f);
            t.AddText("Sprite by Charles Gabriel (opengameart.org)", 4f);
            t.AddText("FMOD Audio engine (c) Firelight Technologies 2004-2013 (fmod.org)", 4f);

            var e = GameFactory.CreateSubtitle(t);

            t.ScaleVector = new Vector2(0.5f, 0.5f);
            e.GetComponent <PositionComp>().Position2D = new Vector2(Screen.Center.X, 0.08f);
            t.StartTime = 13f;
        }
예제 #18
0
        private Subtitle ParseSubtitle(Match match, SubtitleFormat format, ParsingProperties properties, Subtitle previousSubtitle)
        {
            SubtitleText text  = ParseSubtitleText(match, format);
            Style        style = ParseStyle(match, format);

            Subtitle subtitle = new Subtitle(null, text, style);

            if (properties.TimingMode == TimingMode.Frames)
            {
                Frames previousFrames = (previousSubtitle == null ? null : previousSubtitle.Frames);
                ParseFrames(match, subtitle.Frames, previousFrames);
            }
            else
            {
                Times previousTimes = (previousSubtitle == null ? null : previousSubtitle.Times);
                ParseTimes(match, subtitle.Times, previousTimes, properties);
            }

            format.SubtitleInputPostProcess(subtitle);
            return(subtitle);
        }
예제 #19
0
        /// <summary>
        /// called when player wins game
        /// </summary>
        protected void PixieHasWon()
        {
            SubtitleText t = new SubtitleText();

            t.AddText("We DID IT!", 3f);
            t.AddText("I found my friends!", 3f);
            t.AddText("Hi, Trixie!", 3f);
            t.AddText("Hi, Dixie!", 3f);
            t.AddText("Hi, everyone!", 3f);
            t.AddText("This is...", 3f);
            t.AddText("it's...", 2f);
            t.AddText("AMAZING!!!", 9f);
            t.AddText("", 9f);
            t.AddText("And now, bring...", 3f);
            t.AddText("...me back to the entrance!", 4f);
            t.AddText("", 1f);
            t.AddText("JUST KIDDING :-)", 3f);
            t.AddText("", 7f);
            t.AddText("See you in another\ngreat Pixie game:", 3f);

            const float showTitleDuration = 5.5f;

            t.AddText("Pixie: Escape from the\n  Game Art Graveyard", showTitleDuration);
            t.AddText("         Pixie vs.\nThe Shader Legions", showTitleDuration);
            t.AddText("Pixie Goes Retro", showTitleDuration);
            t.AddText(" Pixie's Journey\nto the Cuda Core", showTitleDuration);
            t.AddText("Pixie and the City", showTitleDuration);
            Subtitles.Show(10, t);
            //Motion.ScaleTarget = 3f;
            //Motion.ScaleSpeed = 0.04f;
            Motion.ZoomTarget       = 0.15f;
            Motion.ZoomSpeed        = 0.0007f;
            Motion.ZoomCenterTarget = pixie.Motion;
            //Motion.ZoomCenter = Screen.Center;
            Background.Target      = new Vector2(Background.Texture.Width / 2, Background.Texture.Height / 2);
            Background.TargetSpeed = 0.5f;
            Background.Velocity    = 0.51f;
            hasWon = true;
            isBackgroundScrollingOn = false;
        }
예제 #20
0
        private void Filter(object parameter = null)
        {
            IEnumerable <SubtitlePart> filteredParts = Subtitle.AllParts;

            if (EndTime != TimeSpan.Zero)
            {
                filteredParts = Subtitle.AllParts.Where(p => (string.IsNullOrEmpty(SubtitleText) || p.Lines.ToLower().Contains(SubtitleText.ToLower())) && p.ModifiedStartTiming.TimeSpan >= StartTime && p.ModifiedStartTiming.TimeSpan <= EndTime);
            }

            Subtitle.FilteredParts.Clear();

            foreach (var filteredPart in filteredParts)
            {
                Subtitle.FilteredParts.Add(filteredPart);
            }

            //Subtitle.SelectedPart = Subtitle.FilteredParts.FirstOrDefault();
        }
예제 #21
0
        private SubtitleSearchResults FindInTextContentFromIndex(int subtitleNumber, string lineBreak, Regex regex, int startIndex, SubtitleTextType textType)
        {
            SubtitleText text = subtitles.GetSubtitleText(subtitleNumber, textType);

            return(MatchValues(regex.Match(text.Get(lineBreak), startIndex), subtitleNumber, textType, 0));
        }
예제 #22
0
 private void SubtitleText_Click(object sender, EventArgs e)
 {
     SubtitleText.Clear();
 }
예제 #23
0
        /* Private members */

        private string FieldEvaluator(Match match)
        {
            Group  fieldGroup = match.Groups["Field"];
            string field      = fieldGroup.Value;

            switch (field)
            {
            case "StartFrame":
                int startFrame = subtitle.Frames.Start;
                return(FormatedField(startFrame, match));

            case "StartElapsedFrames":
                int previousFrames     = (previousSubtitle == null ? 0 : previousSubtitle.Frames.End);
                int startElapsedFrames = subtitle.Frames.Start - previousFrames;
                return(FormatedField(startElapsedFrames, match));

            case "EndFrame":
                int endFrame = subtitle.Frames.End;
                return(FormatedField(endFrame, match));

            case "EndElapsedFrames":
                int endElapsedFrames = subtitle.Frames.Duration;
                return(FormatedField(endElapsedFrames, match));

            case "StartHours":
                int startHours = subtitle.Times.Start.Hours;
                return(FormatedField(startHours, 2, match));

            case "StartMinutes":
                int startMinutes = subtitle.Times.Start.Minutes;
                return(FormatedField(startMinutes, 2, match));

            case "StartSeconds":
                int startSeconds = subtitle.Times.Start.Seconds;
                return(FormatedField(startSeconds, 2, match));

            case "StartDeciseconds":
                int startDeciseconds = DivideAndRound(subtitle.Times.Start.Milliseconds, 100);
                return(FormatedField(startDeciseconds, 1, match));

            case "StartTotalDeciseconds":
                int startTotalDeciseconds = DivideAndRound((int)subtitle.Times.Start.TotalMilliseconds, 100);
                return(startTotalDeciseconds.ToString());

            case "StartCentiseconds":
                int startCentiseconds = DivideAndRound(subtitle.Times.Start.Milliseconds, 10);
                return(FormatedField(startCentiseconds, 2, match));

            case "StartMilliseconds":
                int startMilliseconds = subtitle.Times.Start.Milliseconds;
                return(FormatedField(startMilliseconds, 3, match));

            case "StartMillisecondsAsFrames":
                int startMillisecondsAsFrames = (int)TimingUtil.TimeMillisecondsToFrames(subtitle.Times.Start.Milliseconds, this.subtitleProperties.CurrentFrameRate);
                return(FormatedField(startMillisecondsAsFrames, 2, match));

            case "StartMillisecondsAsFramesPAL":
                int startMillisecondsAsFramesPAL = (int)TimingUtil.TimeMillisecondsToFrames(subtitle.Times.Start.Milliseconds, 25);
                return(FormatedField(startMillisecondsAsFramesPAL, 2, match));

            case "StartMillisecondsAsFramesNTSC":
                int startMillisecondsAsFramesNTSC = (int)TimingUtil.TimeMillisecondsToFrames(subtitle.Times.Start.Milliseconds, 29.97F);
                return(FormatedField(startMillisecondsAsFramesNTSC, 2, match));

            case "EndMillisecondsAsFrames":
                int endMillisecondsAsFrames = (int)TimingUtil.TimeMillisecondsToFrames(subtitle.Times.End.Milliseconds, this.subtitleProperties.CurrentFrameRate);
                return(FormatedField(endMillisecondsAsFrames, 2, match));

            case "EndMillisecondsAsFramesPAL":
                int endMillisecondsAsFramesPAL = (int)TimingUtil.TimeMillisecondsToFrames(subtitle.Times.End.Milliseconds, 25);
                return(FormatedField(endMillisecondsAsFramesPAL, 2, match));

            case "EndMillisecondsAsFramesNTSC":
                int endMillisecondsAsFramesNTSC = (int)TimingUtil.TimeMillisecondsToFrames(subtitle.Times.End.Milliseconds, 29.97F);
                return(FormatedField(endMillisecondsAsFramesNTSC, 2, match));

            case "StartElapsedTime":
                TimeSpan previousTime     = (previousSubtitle == null ? TimeSpan.Zero : previousSubtitle.Times.End);
                TimeSpan startElapsedTime = subtitle.Times.Start - previousTime;
                return(FormatedField(startElapsedTime.TotalSeconds));

            case "EndHours":
                int endHours = subtitle.Times.End.Hours;
                return(FormatedField(endHours, 2, match));

            case "EndMinutes":
                int endMinutes = subtitle.Times.End.Minutes;
                return(FormatedField(endMinutes, 2, match));

            case "EndSeconds":
                int endSeconds = subtitle.Times.End.Seconds;
                return(FormatedField(endSeconds, 2, match));

            case "EndDeciseconds":
                int endDeciseconds = DivideAndRound(subtitle.Times.End.Milliseconds, 100);
                return(FormatedField(endDeciseconds, 1, match));

            case "EndTotalDeciseconds":
                int endTotalDeciseconds = DivideAndRound((int)subtitle.Times.End.TotalMilliseconds, 100);
                return(endTotalDeciseconds.ToString());

            case "EndCentiseconds":
                int endCentiseconds = DivideAndRound(subtitle.Times.End.Milliseconds, 10);
                return(FormatedField(endCentiseconds, 2, match));

            case "EndMilliseconds":
                int endMilliseconds = subtitle.Times.End.Milliseconds;
                return(FormatedField(endMilliseconds, 3, match));

            case "EndElapsedTime":
                TimeSpan endElapsedTime = subtitle.Times.Duration;
                return(FormatedField(endElapsedTime.TotalSeconds));

            case "Text":
                SubtitleText subtitleText = (textType == SubtitleTextType.Text ? subtitle.Text : subtitle.Translation);
                string       text         = subtitleText.GetTrimLines(format.LineBreak);
                return(text.ToString());

            case "Style":
                string style = format.StyleToString(subtitle.Style);
                return(style.ToString());

            case "EndOfStyle":
                string endOfStyle = format.EndOfStyleToString(subtitle.Style);
                return(endOfStyle.ToString());

            case "SubtitleNumber":
                return(FormatedField(subtitleNumber, match));

            default:
                return(match.Value);
            }
        }