-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFlash.cs
55 lines (45 loc) · 1.86 KB
/
Flash.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using OpenTK;
using OpenTK.Graphics;
using StorybrewCommon.Mapset;
using StorybrewCommon.Scripting;
using StorybrewCommon.Storyboarding;
using StorybrewCommon.Storyboarding.Util;
using StorybrewCommon.Subtitles;
using StorybrewCommon.Util;
using System;
using System.Collections.Generic;
using System.Linq;
namespace StorybrewScripts
{
public class Flash : StoryboardObjectGenerator
{
[Configurable]
public int StartTime = 0;
[Configurable]
public int EndTime = 0;
[Configurable]
public string FlashPath = "sb/flash.png";
[Configurable]
public int FadeDuration = 50;
[Configurable]
public bool UseBeatColor = false;
public override void Generate()
{
var bitmap = GetMapsetBitmap(FlashPath);
var hitobjectLayer = GetLayer("");
foreach(OsuHitObject hitobject in Beatmap.HitObjects)
{
if ((StartTime != 0 || EndTime != 0) && (hitobject.StartTime < StartTime - 5 || EndTime - 5 <= hitobject.StartTime)) continue;
foreach (int bookmark in Beatmap.Bookmarks)
{
if(!(hitobject.StartTime - 5 < bookmark && bookmark < hitobject.EndTime + 5)) continue;
var fSprite = hitobjectLayer.CreateSprite(FlashPath, OsbOrigin.Centre);
fSprite.Scale(hitobject.StartTime, hitobject.EndTime + FadeDuration, 480.0f / bitmap.Height, 480.0f / bitmap.Height);
fSprite.Fade(OsbEasing.Out, hitobject.StartTime, hitobject.EndTime + FadeDuration, 1, 0);
fSprite.Additive(hitobject.StartTime, hitobject.EndTime + FadeDuration);
if (UseBeatColor) fSprite.Color(hitobject.StartTime, hitobject.Color);
}
}
}
}
}