private OsbSprite fadeInOut(StoryboardLayer layer, string path, double startTime, float scale)
        {
            var sprite = fadeIn(layer, path, startTime, scale);

            sprite.Fade(startTime + Constants.beatLength * 4, 0);
            return(sprite);
        }
Beispiel #2
0
 public StoryboardSample(StoryboardLayer layer, int time, string filePath, int volume)
 {
     Layer    = layer;
     Time     = time;
     FilePath = filePath;
     Volume   = volume;
 }
Beispiel #3
0
 /// <inheritdoc />
 public StoryboardSoundSample(int startTime, StoryboardLayer layer, string filePath, double volume)
 {
     StartTime = startTime;
     Layer     = layer;
     FilePath  = filePath;
     Volume    = volume;
 }
Beispiel #4
0
        private void generateParticles(StoryboardLayer layer, double startTime, double endTime, string path, int particleNum, bool rotate)
        {
            Vector2 center = new Vector2(320, 240);
            var     step   = (endTime - startTime) / particleNum;

            for (int i = 0; i < particleNum; i++)
            {
                Vector2 randomCenter = new Vector2(320 + Random(-220, 220), 240 + Random(-100, 100));
                Vector2 distance     = Vector2.Subtract(center, randomCenter);

                var particle = layer.CreateSprite(path, OsbOrigin.Centre);

                // Spreading stuff randomly, then expanding that random position by a distance
                particle.Scale(startTime, Random(0.2, 0.6));
                particle.Color(startTime, particleColor);
                if (rotate)
                {
                    particle.Rotate(startTime, endTime, 0, Random(-Math.PI, Math.PI));
                }
                particle.Fade(easing, startTime, startTime + 227, 0, 1);
                particle.Move(easing, startTime, startTime + 227, center, randomCenter);
                particle.Move(easing, startTime + 227, endTime, particle.PositionAt(startTime + 227), Vector2.Subtract(particle.PositionAt(startTime + 227), distance));
                particle.Fade(endTime, 0);
                startTime += step;
            }
        }
Beispiel #5
0
        public override void Generate()
        {
            layer        = GetLayer("Main");
            beatduration = Beatmap.GetTimingPointAt(62840).BeatDuration;

            circleCircles("sb/heart2.png", StartTime, EndTime, new Vector2(320, 240), 170, Math.PI, -Math.PI, 0.15, 8 * 6, true, 4);
        }
Beispiel #6
0
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(80 - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;

                var sprite = layer.CreateSprite(texture.Path, Origin, position);
                sprite.Scale(line.StartTime, FontScale);
                sprite.Fade(line.StartTime - 200, line.StartTime, 0, 1);
                sprite.Fade(line.EndTime - 400, line.EndTime, 1, 0);
                if (direction)
                {
                    sprite.MoveY(OsbEasing.OutExpo, line.StartTime, line.EndTime, -40, 185);
                }
                else
                {
                    sprite.MoveY(OsbEasing.OutExpo, line.StartTime, line.EndTime, 460, 235);
                }
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
            }
        }
Beispiel #7
0
 public OsbAnimationPool(StoryboardLayer layer, string path, int frameCount, double frameDelay, OsbLoopType loopType, OsbOrigin origin, Action <OsbSprite, double, double> finalizeSprite = null)
     : base(layer, path, origin, finalizeSprite)
 {
     this.frameCount = frameCount;
     this.frameDelay = frameDelay;
     this.loopType   = loopType;
 }
Beispiel #8
0
        /// <summary>
        /// Returns specified storyboard layer.
        /// </summary>
        public List <IStoryboardObject> GetLayer(StoryboardLayer layer)
        {
            switch (layer)
            {
            case StoryboardLayer.Background:
                return(BackgroundLayer);

            case StoryboardLayer.Fail:
                return(FailLayer);

            case StoryboardLayer.Pass:
                return(PassLayer);

            case StoryboardLayer.Foreground:
                return(ForegroundLayer);

            case StoryboardLayer.Overlay:
                return(OverlayLayer);

            case StoryboardLayer.Samples:
                return(SamplesLayer);

            default:
                return(BackgroundLayer);
            }
        }
        public void TestDecodeLoopCount()
        {
            // all loop sequences in loop-count.osb have a total duration of 2000ms (fade in 0->1000ms, fade out 1000->2000ms).
            const double loop_duration = 2000;

            var decoder = new LegacyStoryboardDecoder();

            using (var resStream = TestResources.OpenResource("loop-count.osb"))
                using (var stream = new LineBufferedReader(resStream))
                {
                    var storyboard = decoder.Decode(stream);

                    StoryboardLayer background = storyboard.Layers.Single(l => l.Depth == 3);

                    // stable ensures that any loop command executes at least once, even if the loop count specified in the .osb is zero or negative.
                    StoryboardSprite zeroTimes = background.Elements.OfType <StoryboardSprite>().Single(s => s.Path == "zero-times.png");
                    Assert.That(zeroTimes.EndTime, Is.EqualTo(1000 + loop_duration));

                    StoryboardSprite oneTime = background.Elements.OfType <StoryboardSprite>().Single(s => s.Path == "one-time.png");
                    Assert.That(oneTime.EndTime, Is.EqualTo(4000 + loop_duration));

                    StoryboardSprite manyTimes = background.Elements.OfType <StoryboardSprite>().Single(s => s.Path == "many-times.png");
                    Assert.That(manyTimes.EndTime, Is.EqualTo(9000 + 40 * loop_duration));
                }
        }
Beispiel #10
0
 /// <inheritdoc />
 public StoryboardSoundSample(double time, StoryboardLayer layer, string filePath, double volume)
 {
     Time     = time;
     Layer    = layer;
     FilePath = filePath;
     Volume   = volume;
 }
Beispiel #11
0
 public void Generate(Camera camera, StoryboardLayer defaultLayer, double startTime, double endTime, Beatmap beatmap, int divisor = 4)
 {
     Root.GenerateTreeSprite(defaultLayer);
     beatmap.ForEachTick((int)startTime, (int)endTime, divisor, (timingPoint, time, beatCount, tickCount) =>
                         Root.GenerateTreeStates(time, camera));
     Root.GenerateTreeCommands();
 }
Beispiel #12
0
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(320 - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;

                var sprite = layer.CreateSprite(texture.Path, Origin, position);
                var bar    = layer.CreateSprite(BarPath, Origin, position);
                bar.Rotate(line.StartTime - 200, 1.5708);
                bar.MoveY(line.StartTime - 200, 450);
                bar.ScaleVec(OsbEasing.Out, line.StartTime - 200, line.StartTime + 100, 0, 0, 0.05, 1);
                bar.ScaleVec(line.StartTime + 100, line.EndTime, 0.05, 1, 0.05, 2);

                sprite.Scale(OsbEasing.Out, line.StartTime - 200, line.StartTime + 100, 0, 0.5);
                sprite.Scale(line.StartTime + 100, line.EndTime, 0.5, 0.55);
                sprite.Fade(line.StartTime - 200, line.StartTime, 0, 1);
                sprite.Fade(line.EndTime - 200, line.EndTime, 1, 0);
                bar.Fade(line.StartTime - 200, line.StartTime, 0, 1);
                bar.Fade(line.EndTime - 200, line.EndTime, 1, 0);
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
            }
        }
Beispiel #13
0
    public OsbSprite SwipePaneNoFade(StoryboardLayer layer, OsbEasing easing, SwipeDirection direction, string file, double start, double end, Vector2 Postion, Vector2 ScaleFrom, Vector2 ScaleTo)
    {
        var Origin = OsbOrigin.TopCentre;

        switch (direction)
        {
        case SwipeDirection.Top:
            Origin = OsbOrigin.BottomCentre;
            break;

        case SwipeDirection.Bottom:
            Origin = OsbOrigin.TopCentre;
            break;

        case SwipeDirection.Left:
            Origin = OsbOrigin.CentreRight;
            break;

        case SwipeDirection.Right:
            Origin = OsbOrigin.CentreLeft;
            break;
        }
        var sprite = layer.CreateSprite(file, Origin);

        sprite.ScaleVec(easing, start, end, ScaleFrom, ScaleTo);
        sprite.Move(start, Postion);

        return(sprite);
    }
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            double last_first_time = 22993;
            double last_end_time   = 23346;

            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(SubtitleX - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;
                var lastPosition = new Vector2(SubtitleX - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                                   + texture.OffsetFor(Origin) * FontScale + new Vector2(-10, 30);
                var firstPosition = new Vector2(SubtitleX - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                                    + texture.OffsetFor(Origin) * FontScale + new Vector2(10, -30);

                var sprite = layer.CreateSprite(texture.Path, Origin, position);
                sprite.Rotate(line.StartTime - 200, MathHelper.DegreesToRadians(9));
                sprite.Scale(line.StartTime, FontScale);

                sprite.Color((OsbEasing)6, line.StartTime - 200, line.EndTime, Color4.Red, Color4.White);

                sprite.Fade(last_first_time - 300, last_first_time, 0, 0.4);
                sprite.Fade(last_end_time - 200, last_end_time, 0.4, 1);
                sprite.Move((OsbEasing)3, last_end_time - 200, last_end_time, firstPosition, position);
                sprite.Fade(line.EndTime - 200, line.EndTime, 1, 0);
                sprite.Move((OsbEasing)3, line.EndTime - 200, line.EndTime, position, lastPosition);
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
                last_first_time = line.StartTime;
                last_end_time   = line.EndTime;
            }
        }
Beispiel #15
0
 public OsbSpritePool(StoryboardLayer layer, string path, OsbOrigin origin, Action <OsbSprite, double, double> finalizeSprite = null)
 {
     this.layer          = layer;
     this.path           = path;
     this.origin         = origin;
     this.finalizeSprite = finalizeSprite;
 }
Beispiel #16
0
    public void CreateCredit(StoryboardLayer layer, double startTime, double endTime, string topString, string bottomString)
    {
        // Top Sprite //
        var topSprite = layer.CreateSprite(font.GetTexture(topString).Path);

        topSprite.MoveY(startTime, 240 - (font.GetTexture(topString).BaseHeight * 0.55) * 0.7);
        topSprite.Fade(startTime, startTime + 250, 0, 1);
        topSprite.Fade(endTime - 250, endTime, 1, 0);
        topSprite.Scale(startTime, 0.55);
        topSprite.MoveX(OsbEasing.OutExpo, startTime, startTime + 250, 400, 325);
        topSprite.MoveX(startTime + 250, endTime - 250, 325, 300);
        topSprite.MoveX(OsbEasing.InOutCubic, endTime - 250, endTime, 300, 250);


        // Bottom Sprite //
        var bottomSprite = layer.CreateSprite(font.GetTexture(bottomString).Path);

        bottomSprite.MoveY(startTime, 240 + (font.GetTexture(bottomString).BaseHeight * 0.55) * 0.7);
        bottomSprite.Fade(startTime, startTime + 250, 0, 1);
        bottomSprite.Fade(endTime - 250, endTime, 1, 0);
        bottomSprite.Scale(startTime, 0.55);
        bottomSprite.MoveX(OsbEasing.OutExpo, startTime, startTime + 250, 250, 300);
        bottomSprite.MoveX(startTime + 250, endTime - 250, 300, 325);
        bottomSprite.MoveX(OsbEasing.InOutCubic, endTime - 250, endTime, 325, 400);
    }
Beispiel #17
0
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(320 - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;

                var sprite = layer.CreateSprite(texture.Path, Origin, position);
                sprite.Scale(line.StartTime, FontScale);
                sprite.Fade(line.StartTime - 200, line.StartTime, 0, 1);
                sprite.Fade(line.EndTime - 750, line.EndTime - 250, 1, 0);
                int pos      = -25;
                int posAfter = -25;
                sprite.MoveX(OsbEasing.Out, line.StartTime - 500, line.StartTime, pos - 100, pos);
                for (double i = line.StartTime; i <= line.EndTime; i += 75)
                {
                    posAfter += 1;
                    sprite.MoveX(i, i + 75, pos, posAfter);
                    pos = posAfter;
                }
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
            }
        }
Beispiel #18
0
        public void generatePerLine(FontGenerator font, SubtitleSet subtitles, StoryboardLayer layer, bool additive)
        {
            foreach (var line in subtitles.Lines)
            {
                var texture  = font.GetTexture(line.Text);
                var position = new Vector2(320 - texture.BaseWidth * FontScale * 0.5f, SubtitleY)
                               + texture.OffsetFor(Origin) * FontScale;

                var sprite = layer.CreateSprite(texture.Path, Origin, position);
                sprite.Scale(line.StartTime, FontScale);
                sprite.Fade(line.StartTime - 200, line.StartTime, 0, 1);

                if (line.StartTime < 127564)
                {
                    sprite.Rotate(line.StartTime - 200, 0.1);
                    sprite.Move(OsbEasing.Out, line.StartTime, line.StartTime + 200, -500, 10, 320, 90);
                    sprite.Move(line.StartTime + 200, line.EndTime, 320, 90, 360, 95);
                    sprite.Fade(line.EndTime - 200, line.EndTime, 1, 0);
                }
                if (line.StartTime > 127564)
                {
                    sprite.Rotate(line.StartTime - 200, -0.1);
                    sprite.Move(OsbEasing.Out, line.StartTime, line.StartTime + 200, -500, 430, 320, 350);
                    sprite.Move(line.StartTime + 200, line.EndTime, 320, 350, 360, 345);
                    sprite.Fade(line.EndTime - 600, line.EndTime - 300, 1, 0);
                }
                if (additive)
                {
                    sprite.Additive(line.StartTime - 200, line.EndTime);
                }
            }
        }
Beispiel #19
0
    public OsbSprite BackgroundOverlayPopup(StoryboardLayer layer, string file)
    {
        var sprite = layer.CreateSprite(file);

        sprite.Scale(0, 854.0f / MainStoryboard.Instance.GetMapsetBitmap(MainStoryboard.Instance.Beatmap.BackgroundPath).Width);
        sprite.Fade(0, 0);
        return(sprite);
    }
        private void zoomIn(StoryboardLayer layer, string path, double startTime, double endTime, double zoomBy)
        {
            var sprite = layer.CreateSprite(path, OsbOrigin.Centre);

            sprite.Fade(easing, startTime - Constants.beatLength * fadeby, startTime, 0, 1);
            sprite.Scale(startTime - Constants.beatLength * fadeby, endTime, Constants.screenScale, Constants.screenScale * zoomBy);
            sprite.Fade(endTime, 0);
        }
Beispiel #21
0
 public SpriteSet(SpriteSet other)
 {
     layer = other.layer;
     foreach (OsbSprite sprite in other.sprites)
     {
         sprites.Add(layer.CreateSprite(sprite.TexturePath, sprite.Origin, sprite.InitialPosition));
     }
 }
        private OsbSprite fadeIn(StoryboardLayer layer, string path, double startTime, float scale)
        {
            var sprite = layer.CreateSprite(path, OsbOrigin.Centre);

            sprite.Scale(startTime - Constants.beatLength * 0.5f, scale);
            sprite.Fade(startTime - Constants.beatLength * 0.5f, startTime, 0, 1);
            return(sprite);
        }
Beispiel #23
0
 public DrawableStoryboardLayer(StoryboardLayer layer)
 {
     Layer            = layer;
     RelativeSizeAxes = Axes.Both;
     Anchor           = Anchor.Centre;
     Origin           = Anchor.Centre;
     Enabled          = layer.EnabledWhenPassing;
 }
Beispiel #24
0
 public void Generate(Camera camera, StoryboardLayer defaultLayer, double startTime, double endTime, double timeStep)
 {
     Root.GenerateTreeSprite(defaultLayer);
     for (var time = startTime; time < endTime + 5; time += timeStep)
     {
         Root.GenerateTreeStates(time, camera);
     }
     Root.GenerateTreeCommands();
 }
Beispiel #25
0
            public LayerElementContainer(StoryboardLayer layer)
            {
                storyboardLayer = layer;

                Size = new Vector2(640, 480);

                Anchor = Anchor.Centre;
                Origin = Anchor.Centre;
            }
Beispiel #26
0
 public void Generate(Camera camera, StoryboardLayer defaultLayer, double startTime, double endTime, double timeStep, int loopCount, Action <LoopCommand, OsbSprite> action = null)
 {
     Root.GenerateTreeSprite(defaultLayer);
     for (var time = startTime; time < endTime + 5; time += timeStep)
     {
         Root.GenerateTreeStates(time, camera);
     }
     Root.GenerateTreeLoopCommands(startTime, endTime, loopCount, action, offsetCommands: true);
 }
Beispiel #27
0
            public LayerElementContainer(StoryboardLayer layer)
            {
                storyboardLayer = layer;

                Width  = 640;
                Height = 480;
                Anchor = Anchor.Centre;
                Origin = Anchor.Centre;
            }
Beispiel #28
0
        public override void Generate()
        {
		    layer = GetLayer("Main");
            beatduration = Beatmap.GetTimingPointAt(12578).BeatDuration;
            var circleC1 = new CircleC(new Vector2(320,240), 32, 60, layer, 1269);

            circleC1.circleFade(12578,500,0.125*beatduration,6);
            
        }
Beispiel #29
0
    public OsbSprite FullscreenFlash(StoryboardLayer layer, string file)
    {
        var sprite = layer.CreateSprite(file);

        sprite.ScaleVec(0, new Vector2(854, 480));
        sprite.Color(0, Color4.White);
        sprite.Fade(0, 0);
        return(sprite);
    }
Beispiel #30
0
        public void GenerateTreeSprite(StoryboardLayer defaultLayer)
        {
            var layer = Layer ?? defaultLayer;

            GenerateSprite(layer);
            foreach (var child in children)
            {
                child.GenerateTreeSprite(InheritsLayer ? layer : defaultLayer);
            }
        }