-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStreamFlash.cs
57 lines (50 loc) · 1.94 KB
/
StreamFlash.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
56
57
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 StreamFlash : StoryboardObjectGenerator
{
[Configurable]
public String FlashPath = "sb/flash.png";
[Configurable]
public double Opacity = 0.2;
[Configurable]
public int FadeDuration = 50;
[Configurable]
public bool UseBeatColor = false;
private Dictionary<int, int> StartEndTime = new Dictionary<int, int>(){
{276006, 276381},
{285756, 285980}
};
public override void Generate()
{
var bitmap = GetMapsetBitmap(FlashPath);
var hitobjectLayer = GetLayer("");
foreach (KeyValuePair<int, int> item in StartEndTime)
{
int StartTime = item.Key;
int EndTime = item.Value;
foreach (var hitobject in Beatmap.HitObjects)
{
if ((StartTime != 0 || EndTime != 0) &&
(hitobject.StartTime < StartTime - 5 || EndTime - 5 <= hitobject.StartTime))
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);
}
}
}
}
}