Screen Tiling Split into two events + Some tweaks and new vfx! (#585)

* toss boys fixed

* see saw tweaks

* fixed quiz show bug

* splashdown spawn tweaked

* split screen tiling into two different events

* screen fit added
This commit is contained in:
Rapandrasmus 2023-11-24 23:49:59 +01:00 committed by GitHub
parent 2a4a5b9f8f
commit c1bcf2151e
11 changed files with 167 additions and 84 deletions

View file

@ -93,6 +93,9 @@ MonoBehaviour:
ambientBg: {fileID: 5129120947114944961}
ambientBgGO: {fileID: 269805006432045765}
letterboxBgGO: {fileID: 3741076794236313655}
overlayCanvas: {fileID: 8512930684284350359}
letterboxMask: {fileID: 8925473620302868482}
parentView: {fileID: 2077856143944097172}
camera: {fileID: 378821074852065722}
--- !u!1 &269805006432045765
GameObject:

View file

@ -1049,11 +1049,11 @@ namespace HeavenStudio.Games
SetDistance(distanceEvent.beat, distanceEvent["type"], distanceEvent["ease"]);
}
if (wantStartRally >= beat && IsRallyBeat(wantStartRally))
if (wantStartRally >= beat && IsRallyBeat(wantStartRally) && wantStartRally < nextGameSwitchBeatGlobal)
{
StartRally(wantStartRally);
}
else if (wantStartBaBum >= beat && IsBaBumBeat(wantStartBaBum))
else if (wantStartBaBum >= beat && IsBaBumBeat(wantStartBaBum) && wantStartBaBum < nextGameSwitchBeatGlobal)
{
StartBaBumBumBum(wantStartBaBum, wantCount, wantAlt);
}

View file

@ -573,16 +573,7 @@ namespace HeavenStudio.Games
ScheduleAutoplayInput(beat, length + inputBeat, InputAction_Right, AutoplayAButton, Nothing, Nothing);
}
}
if (doingConsectiveIntervals)
{
countToMatch += relevantInputs.Count;
}
else
{
countToMatch = relevantInputs.Count;
}
int hundredLoops = Mathf.FloorToInt(countToMatch / 100);
int hundredLoops = Mathf.FloorToInt((float)countToMatch / 100f);
countToMatch -= hundredLoops * 100;
doingConsectiveIntervals = consecutive;
float timeUpBeat = 0f;
@ -598,6 +589,14 @@ namespace HeavenStudio.Games
{
new BeatAction.Action(beat, delegate
{
if (doingConsectiveIntervals)
{
countToMatch += relevantInputs.Count;
}
else
{
countToMatch = relevantInputs.Count;
}
if (shouldPrepareArms)
{
contesteeLeftArmAnim.DoScaledAnimationAsync("LeftPrepare", 0.5f);

View file

@ -204,6 +204,9 @@ namespace HeavenStudio.Games
public static SeeSaw instance;
private Sound _landSoundEnd;
private double _gameSwitchBeat;
private void Awake()
{
instance = this;
@ -218,6 +221,7 @@ namespace HeavenStudio.Games
GrabJumpEvents(beat);
PersistColor(beat);
PersistColors(beat);
_gameSwitchBeat = beat;
}
public override void OnGameSwitch(double beat)
@ -225,6 +229,16 @@ namespace HeavenStudio.Games
GrabJumpEvents(beat);
PersistColor(beat);
PersistColors(beat);
_gameSwitchBeat = beat;
}
private void OnDestroy()
{
foreach (var evt in scheduledInputs)
{
evt.Disable();
}
if (_landSoundEnd != null) _landSoundEnd.Stop();
}
private void PersistColors(double beat)
@ -353,9 +367,8 @@ namespace HeavenStudio.Games
{
if (canPrepare && cond.songPositionInBeatsAsDouble < allJumpEvents[currentJumpIndex].beat)
{
float beatToJump = (float)allJumpEvents[currentJumpIndex].beat - (inJump ? 1 : 2);
SoundByte.PlayOneShotGame("seeSaw/prepareHigh", beatToJump);
if (beatToJump >= _gameSwitchBeat) SoundByte.PlayOneShotGame("seeSaw/prepareHigh", beatToJump);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beatToJump, delegate { see.SetState(inJump ? SeeSawGuy.JumpState.StartJumpIn : SeeSawGuy.JumpState.StartJump, beatToJump); see.canBop = false; })
@ -495,7 +508,7 @@ namespace HeavenStudio.Games
if (currentJumpIndex >= allJumpEvents.Count || allJumpEvents[currentJumpIndex].beat != beat + 4)
{
saw.canBop = true;
SoundByte.PlayOneShotGame("seeSaw/otherLand", beat + 4);
_landSoundEnd = SoundByte.PlayOneShotGame("seeSaw/otherLand", beat + 4);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 3.75f, delegate { see.canBop = true; }),
@ -555,7 +568,7 @@ namespace HeavenStudio.Games
{
saw.canBop = true;
float beatLength = see.ShouldEndJumpOut() ? 4 : 3;
SoundByte.PlayOneShotGame("seeSaw/otherLand", beat + beatLength);
_landSoundEnd = SoundByte.PlayOneShotGame("seeSaw/otherLand", beat + beatLength);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + beatLength - 0.25f, delegate { see.canBop = true; }),
@ -615,7 +628,7 @@ namespace HeavenStudio.Games
{
saw.canBop = true;
float beatLength = see.ShouldEndJumpOut() ? 3 : 2;
SoundByte.PlayOneShotGame("seeSaw/otherLand", beat + beatLength);
_landSoundEnd = SoundByte.PlayOneShotGame("seeSaw/otherLand", beat + beatLength);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + beatLength - 0.25f, delegate { see.canBop = true; }),
@ -674,7 +687,7 @@ namespace HeavenStudio.Games
if (currentJumpIndex >= allJumpEvents.Count || allJumpEvents[currentJumpIndex].beat != beat + 2)
{
saw.canBop = true;
SoundByte.PlayOneShotGame("seeSaw/otherLand", beat + 2);
_landSoundEnd = SoundByte.PlayOneShotGame("seeSaw/otherLand", beat + 2);
BeatAction.New(instance, new List<BeatAction.Action>()
{
new BeatAction.Action(beat + 1.75f, delegate { see.canBop = true; }),
@ -718,18 +731,19 @@ namespace HeavenStudio.Games
void DetermineSeeJump(double beat, bool miss = false, bool high = false, float height = 0)
{
if (currentJumpIndex >= 0
&& (allJumpEvents[currentJumpIndex - 1].datamodel == "seeSaw/longLong" || allJumpEvents[currentJumpIndex - 1].datamodel == "seeSaw/shortLong"))
if (currentJumpIndex < 0) return;
if (allJumpEvents[currentJumpIndex - 1].datamodel == "seeSaw/longLong" || allJumpEvents[currentJumpIndex - 1].datamodel == "seeSaw/shortLong")
{
if (NextJumpEventIsOnBeat())
{
bool shouldHighJump = allJumpEvents[currentJumpIndex]["high"] || high;
if (allJumpEvents[currentJumpIndex].datamodel is "seeSaw/longLong" or "seeSaw/shortLong")
{
see.SetState(high ? SeeSawGuy.JumpState.HighOutOut : SeeSawGuy.JumpState.OutOut, beat, miss, height);
see.SetState(shouldHighJump ? SeeSawGuy.JumpState.HighOutOut : SeeSawGuy.JumpState.OutOut, beat, miss, height);
}
else if (allJumpEvents[currentJumpIndex].datamodel is "seeSaw/longShort" or "seeSaw/shortShort")
{
see.SetState(high ? SeeSawGuy.JumpState.HighOutIn : SeeSawGuy.JumpState.OutIn, beat, miss, height);
see.SetState(shouldHighJump ? SeeSawGuy.JumpState.HighOutIn : SeeSawGuy.JumpState.OutIn, beat, miss, height);
}
}
else
@ -745,8 +759,7 @@ namespace HeavenStudio.Games
}
}
else if (currentJumpIndex >= 0
&& (allJumpEvents[currentJumpIndex - 1].datamodel == "seeSaw/longShort" || allJumpEvents[currentJumpIndex - 1].datamodel == "seeSaw/shortShort"))
else if (allJumpEvents[currentJumpIndex - 1].datamodel == "seeSaw/longShort" || allJumpEvents[currentJumpIndex - 1].datamodel == "seeSaw/shortShort")
{
if (NextJumpEventIsOnBeat())
{

View file

@ -124,10 +124,10 @@ namespace HeavenStudio.Games.Scripts_Splashdown
Instantiate(splashPrefab, splashHolder).Init("Appearsplash");
}
public void GoDown()
public void GoDown(bool splash = true)
{
SetState(MovementState.Dive, startBeat);
Instantiate(splashPrefab, splashHolder).Init("GodownSplash");
if (splash) Instantiate(splashPrefab, splashHolder).Init("GodownSplash");
}
public void Bop()

View file

@ -65,7 +65,7 @@ namespace HeavenStudio.Games.Loaders
},
new GameAction("amount", "Synchrette Amount")
{
function = delegate { Splashdown.instance.SpawnSynchrettes(eventCaller.currentEntity["amount"]); },
function = delegate { Splashdown.instance.SpawnSynchrettes(eventCaller.currentEntity["amount"], eventCaller.currentEntity.beat); },
defaultLength = 0.5f,
parameters = new List<Param>()
{
@ -93,6 +93,7 @@ namespace HeavenStudio.Games
private List<NtrSynchrette> currentSynchrettes = new List<NtrSynchrette>();
private NtrSynchrette player;
private double _gameSwitchBeat = -1;
private void Awake()
{
@ -100,6 +101,18 @@ namespace HeavenStudio.Games
SpawnSynchrettes(3);
}
public override void OnGameSwitch(double beat)
{
_gameSwitchBeat = beat;
}
public override void OnPlay(double beat)
{
var events = EventCaller.GetAllInGameManagerList("gameManager", new string[] { "switchGame" }).FindAll(x => x.beat < beat);
if (events.Count == 0) return;
_gameSwitchBeat = events[^1].beat;
}
private void Update()
{
var cond = Conductor.instance;
@ -125,7 +138,7 @@ namespace HeavenStudio.Games
}
}
public void SpawnSynchrettes(int amount)
public void SpawnSynchrettes(int amount, double beat = -1)
{
if (currentSynchrettes.Count > 0)
{
@ -137,13 +150,20 @@ namespace HeavenStudio.Games
}
if (player != null) Destroy(player.gameObject);
float startPos = -((amount / 2) * synchretteDistance) + ((amount % 2 == 0) ? synchretteDistance / 2 : 0);
bool shouldGoDown = false;
if (beat >= 0)
{
var inputEvents = EventCaller.GetAllInGameManagerList("splashdown", new string[] { "dive", "appear", "jump", "together", "togetherR9" }).FindAll(x => x.beat < beat && x.beat >= _gameSwitchBeat);
if (inputEvents.Count > 0) shouldGoDown = inputEvents[^1].datamodel == "splashdown/dive";
}
for (int i = 0; i < amount; i++)
{
NtrSynchrette spawnedSynchrette = Instantiate(synchrettePrefab, synchretteHolder);
spawnedSynchrette.transform.localPosition = new Vector3(startPos + (synchretteDistance * i), spawnedSynchrette.transform.localPosition.y, 0);
if (i < amount - 1) currentSynchrettes.Add(spawnedSynchrette);
else player = spawnedSynchrette;
if (shouldGoDown) spawnedSynchrette.GoDown(false);
}
}

View file

@ -169,7 +169,7 @@ namespace HeavenStudio.Games
protected static bool IA_TouchNrm(out double dt)
{
return PlayerInput.GetFlick(out dt)
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
&& (instance.currentReceiver is WhichTossKid.Akachan
|| (instance.lastReceiver is WhichTossKid.Akachan or WhichTossKid.None
&& instance.currentReceiver is WhichTossKid.None)
@ -178,7 +178,7 @@ namespace HeavenStudio.Games
}
protected static bool IA_TouchDir(out double dt)
{
return PlayerInput.GetFlick(out dt)
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
&& (instance.currentReceiver is WhichTossKid.Kiiyan
|| (instance.lastReceiver is WhichTossKid.Kiiyan
&& instance.currentReceiver is WhichTossKid.None)
@ -187,7 +187,7 @@ namespace HeavenStudio.Games
}
protected static bool IA_TouchAlt(out double dt)
{
return PlayerInput.GetFlick(out dt)
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
&& (instance.currentReceiver is WhichTossKid.Aokun
|| (instance.lastReceiver is WhichTossKid.Aokun
&& instance.currentReceiver is WhichTossKid.None)
@ -276,44 +276,6 @@ namespace HeavenStudio.Games
BackgroundColorUpdate();
if (cond.isPlaying && !cond.isPaused)
{
if (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch)
{
TossKid next = GetCurrentReceiver();
if (currentReceiver == WhichTossKid.None && lastReceiver != WhichTossKid.None)
{
next = GetReceiver(lastReceiver);
}
else if (currentReceiver == WhichTossKid.None && lastReceiver == WhichTossKid.None)
{
next = akachan;
}
if (PlayerInput.GetIsAction(InputAction_BasicPress))
{
if (currentBall != null && next != null)
{
if (currentBall.willBePopped)
{
next.PopBallPrepare();
}
else
{
next.Crouch();
}
}
else if (next != null)
{
next.Crouch();
}
}
else if (PlayerInput.GetIsAction(InputAction_BasicRelease))
{
if (next != null)
{
next.UnCrouch();
}
}
}
if (PlayerInput.GetIsAction(InputAction_Aka) && !IsExpectingInputNow(InputAction_Aka))
{
akachan.HitBall(false);

View file

@ -41,7 +41,7 @@ namespace HeavenStudio.Games.Scripts_TossBoys
public void Bop()
{
if (crouch || preparing) return;
if (crouch || preparing || (!anim.IsAnimationNotPlaying() && !anim.IsPlayingAnimationName(prefix + "Idle"))) return;
DoAnimationScaledAsync("Bop", 0.5f);
}

View file

@ -1025,7 +1025,15 @@ namespace HeavenStudio
}),
}
},
new GameAction("screenTiling", "Screen Tiling")
new GameAction("fitScreen", "Fit Game To Screen")
{
defaultLength = 0.5f,
parameters = new()
{
new("enable", true, "Enabled")
}
},
new GameAction("screenTiling", "Tile Screen")
{
resizable = true,
parameters = new()
@ -1034,15 +1042,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" })
}),
}
}

View file

@ -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,15 +46,47 @@ 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()
{
_image.uvRect = new Rect(0, 0, 1, 1);

View file

@ -21,6 +21,10 @@ namespace HeavenStudio
[SerializeField] GameObject ambientBgGO;
[SerializeField] GameObject letterboxBgGO;
[SerializeField] RectTransform overlayCanvas;
[SerializeField] RectTransform letterboxMask;
[SerializeField] RectTransform parentView;
public static StaticCamera instance { get; private set; }
public new Camera camera;
@ -37,6 +41,7 @@ namespace HeavenStudio
private List<RiqEntity> panEvents = new();
private List<RiqEntity> scaleEvents = new();
private List<RiqEntity> rotationEvents = new();
private List<RiqEntity> fitScreenEvents = new();
static Vector3 defaultPan = new Vector3(0, 0, 0);
static Vector3 defaultScale = new Vector3(1, 1, 1);
@ -78,6 +83,7 @@ namespace HeavenStudio
panEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "pan view" });
scaleEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "scale view" });
rotationEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "rotate view" });
fitScreenEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "fitScreen" });
panLast = defaultPan;
scaleLast = defaultScale;
@ -86,6 +92,7 @@ namespace HeavenStudio
UpdatePan();
UpdateRotation();
UpdateScale();
UpdateGameScreenFit();
canvas.localPosition = pan;
canvas.eulerAngles = new Vector3(0, 0, rotation);
@ -98,12 +105,34 @@ namespace HeavenStudio
UpdatePan();
UpdateRotation();
UpdateScale();
UpdateGameScreenFit();
canvas.localPosition = pan;
canvas.eulerAngles = new Vector3(0, 0, rotation);
canvas.localScale = scale;
}
private void UpdateGameScreenFit()
{
var curBeat = Conductor.instance.songPositionInBeatsAsDouble;
letterboxMask.localScale = new Vector3(1, 1, 1);
overlayCanvas.localScale = new Vector3(1, 1, 1);
foreach (var e in fitScreenEvents)
{
if (curBeat < e.beat) break;
if (e["enable"])
{
letterboxMask.localScale = new Vector3(parentView.sizeDelta.x / 16, parentView.sizeDelta.y / 9, 1);
overlayCanvas.localScale = new Vector3(parentView.sizeDelta.x / 16, parentView.sizeDelta.y / 9, 1);
}
else
{
letterboxMask.localScale = new Vector3(1, 1, 1);
overlayCanvas.localScale = new Vector3(1, 1, 1);
}
}
}
private void UpdatePan()
{
foreach (var e in panEvents)