split screen tiling into two different events
This commit is contained in:
parent
7ca0117e0e
commit
247465681f
|
|
@ -1025,7 +1025,7 @@ namespace HeavenStudio
|
|||
}),
|
||||
}
|
||||
},
|
||||
new GameAction("screenTiling", "Screen Tiling")
|
||||
new GameAction("screenTiling", "Tile Screen")
|
||||
{
|
||||
resizable = true,
|
||||
parameters = new()
|
||||
|
|
@ -1034,15 +1034,26 @@ namespace HeavenStudio
|
|||
new("yStart", new EntityTypes.Float(1, 100, 1), "Start Vertical Tiles"),
|
||||
new("xEnd", new EntityTypes.Float(1, 100, 1), "End Horizontal Tiles"),
|
||||
new("yEnd", new EntityTypes.Float(1, 100, 1), "End Vertical Tiles"),
|
||||
|
||||
new Param("axis", StaticCamera.ViewAxis.All, "Axis"),
|
||||
new("ease", Util.EasingFunction.Ease.Linear, "Ease", "", new()
|
||||
{
|
||||
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "xStart", "yStart" })
|
||||
}),
|
||||
}
|
||||
},
|
||||
new GameAction("scrollTiles", "Scroll Tiles")
|
||||
{
|
||||
resizable = true,
|
||||
parameters = new()
|
||||
{
|
||||
new("xScrollStart", new EntityTypes.Float(-100, 100, 0), "Start Horizontal Scroll"),
|
||||
new("yScrollStart", new EntityTypes.Float(-100, 100, 0), "Start Vertical Scroll"),
|
||||
new("xScrollEnd", new EntityTypes.Float(-100, 100, 0), "End Horizontal Scroll"),
|
||||
new("yScrollEnd", new EntityTypes.Float(-100, 100, 0), "End Vertical Scroll"),
|
||||
|
||||
new Param("axis", StaticCamera.ViewAxis.All, "Axis"),
|
||||
new("ease", Util.EasingFunction.Ease.Linear, "Ease", "", new()
|
||||
{
|
||||
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "xStart", "yStart", "xScrollStart", "yScrollStart" })
|
||||
new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "xScrollStart", "yScrollStart" })
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ namespace HeavenStudio
|
|||
{
|
||||
private RawImage _image;
|
||||
|
||||
private List<RiqEntity> _events = new();
|
||||
private List<RiqEntity> _tileEvents = new();
|
||||
private List<RiqEntity> _scrollEvents = new();
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
|
|
@ -24,14 +25,19 @@ namespace HeavenStudio
|
|||
|
||||
public void OnBeatChanged(double beat)
|
||||
{
|
||||
_events = EventCaller.GetAllInGameManagerList("vfx", new string[] { "screenTiling" });
|
||||
_tileEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "screenTiling" });
|
||||
_scrollEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "scrollTiles" });
|
||||
ResetUVRect();
|
||||
Update();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
foreach (var e in _events)
|
||||
float newXTiles = 1;
|
||||
float newYTiles = 1;
|
||||
float newXScroll = 0;
|
||||
float newYScroll = 0;
|
||||
foreach (var e in _tileEvents)
|
||||
{
|
||||
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||
if (normalized < 0) break;
|
||||
|
|
@ -40,13 +46,45 @@ namespace HeavenStudio
|
|||
|
||||
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
||||
|
||||
float newXTiles = func(e["xStart"], e["xEnd"], clampNormal);
|
||||
float newYTiles = func(e["yStart"], e["yEnd"], clampNormal);
|
||||
float newXScroll = func(e["xScrollStart"], e["xScrollEnd"], clampNormal);
|
||||
float newYScroll = func(e["yScrollStart"], e["yScrollEnd"], clampNormal);
|
||||
|
||||
_image.uvRect = new Rect(newXScroll, newYScroll, newXTiles, newYTiles);
|
||||
switch ((StaticCamera.ViewAxis)e["axis"])
|
||||
{
|
||||
case StaticCamera.ViewAxis.All:
|
||||
newXTiles = func(e["xStart"], e["xEnd"], clampNormal);
|
||||
newYTiles = func(e["yStart"], e["yEnd"], clampNormal);
|
||||
break;
|
||||
case StaticCamera.ViewAxis.X:
|
||||
newXTiles = func(e["xStart"], e["xEnd"], clampNormal);
|
||||
break;
|
||||
case StaticCamera.ViewAxis.Y:
|
||||
newYTiles = func(e["yStart"], e["yEnd"], clampNormal);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var e in _scrollEvents)
|
||||
{
|
||||
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
||||
if (normalized < 0) break;
|
||||
|
||||
float clampNormal = Mathf.Clamp01(normalized);
|
||||
|
||||
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
|
||||
|
||||
switch ((StaticCamera.ViewAxis)e["axis"])
|
||||
{
|
||||
case StaticCamera.ViewAxis.All:
|
||||
newXScroll = func(e["xScrollStart"], e["xScrollEnd"], clampNormal);
|
||||
newYScroll = func(e["yScrollStart"], e["yScrollEnd"], clampNormal);
|
||||
break;
|
||||
case StaticCamera.ViewAxis.X:
|
||||
newXScroll = func(e["xScrollStart"], e["xScrollEnd"], clampNormal);
|
||||
break;
|
||||
case StaticCamera.ViewAxis.Y:
|
||||
newYScroll = func(e["yScrollStart"], e["yScrollEnd"], clampNormal);
|
||||
break;
|
||||
}
|
||||
}
|
||||
_image.uvRect = new Rect(newXScroll, newYScroll, newXTiles, newYTiles);
|
||||
}
|
||||
|
||||
public void ResetUVRect()
|
||||
|
|
|
|||
Loading…
Reference in a new issue