mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-14 21:55:09 +00:00
e371163351
* Integration of Jukebox Library (#451) * add Jukebox library todo: - saving / loading of new format - inferrence of unknown data like past versions - move the temporary float casts to proper use of double - make sound related functions take double for timing - inform people that the Jukebox sound player was renamed to SoundByte lol * make sound, input scheduling, and super curve use double precision * successfully load charts * editor works again v1 riqs can be saved and loaded * first tempo and volume markers are unmovable fix loading of charts' easing values * use gsync / freesync * update Jukebox refs to SoundByte * game events use double part 1 Air Rally - Glee Club converted * don't load song if chart load fails * finish conversion of all minigames * remove editor waveform toggle * timeline now respects added song offset length clear cache files on app close prepped notes for dsp sync * update timeline length when offset changed * update to latest Jukebox * make error panel object in global game manager * improve conductor music scheduling * added error message box fix first game events sometimes not playing * a lot * munchy monk input + mustache fixes * fork lifter and pajama party bopping * meat grinder miss bop fix * cloud monkey Real * marching orders Go! was broken * force march doesn't break when it's too early from a game switch * you can use the March! block without the marching now * convert float to double and all that * editor fixes (#459) * ditch loading dialog doesn't show up when it's supposed to * format song offset in editor * remove VorbisPlugin * Update Editor.cs * add updater for marching orders turn * make base datamodels for special entity reading (#463) * make base datamodels for special entity reading * fix crop stomp breaking when no game switch or remix end is set * fix save shortcut fix loading charts with no music * don't infer track when importing a v0 riq from another program * You can now place inputs on top of pass turn for rhythm tweezers * Rockers can do it too now * Some new curves * Converted everything to new curves and made playerballs handle themselves input-wise * working dough converted, need to fix eveerything though * ball transporter anims for pass turn * update Jukebox to latest version fixes for inferred entity loading * new sounds * OnSpawnBall reimplemented * Proper inactive handling now * gandw on balls has been added * Rhythm tweezers pass turn now works like working dough * modernised rockers pass turn * Fixed small balls not working in working dough * Fixed weird curve stuff on game switch in working dough * let play mode start if no song file is loaded fix issue with loading large audio files * add "updater" for the old marching entity --------- Co-authored-by: AstrlJelly <bdlawson115@gmail.com> Co-authored-by: Rapandrasmus <78219215+Rapandrasmus@users.noreply.github.com>
240 lines
No EOL
8.9 KiB
C#
240 lines
No EOL
8.9 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
using HeavenStudio.Util;
|
|
|
|
using DG.Tweening;
|
|
|
|
namespace HeavenStudio.Games.Loaders
|
|
{
|
|
using static Minigames;
|
|
public static class RvlForkLoader
|
|
{
|
|
public static Minigame AddGame(EventCaller eventCaller) {
|
|
return new Minigame("forkLifter", "Fork Lifter", "f1f1f1", false, false, new List<GameAction>()
|
|
{
|
|
new GameAction("flick", "Flick Food")
|
|
{
|
|
function = delegate { var e = eventCaller.currentEntity; ForkLifter.instance.Flick(e.beat, e["type"]); },
|
|
defaultLength = 3,
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("type", ForkLifter.FlickType.Pea, "Object", "The object to be flicked")
|
|
}
|
|
},
|
|
new GameAction("prepare", "Prepare Hand")
|
|
{
|
|
function = delegate { ForkLifter.instance.ForkLifterHand.Prepare(); },
|
|
defaultLength = 0.5f
|
|
},
|
|
new GameAction("gulp", "Swallow")
|
|
{
|
|
function = delegate { ForkLifter.playerInstance.Eat(); }
|
|
},
|
|
new GameAction("sigh", "Sigh")
|
|
{
|
|
|
|
function = delegate { SoundByte.PlayOneShot("games/forkLifter/sigh"); }
|
|
},
|
|
new GameAction("color", "Background Color")
|
|
{
|
|
function = delegate { var e = eventCaller.currentEntity; ForkLifter.instance.FadeBackgroundColor(e["start"], e["end"], e.length, e["instant"]); },
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("start", Color.white, "Start Color", "The color to start fading from."),
|
|
new Param("end", Color.white, "End Color", "The color to end the fade."),
|
|
new Param("instant", false, "Instant", "If checked, the background color will instantly change to the start color.")
|
|
},
|
|
resizable = true
|
|
},
|
|
new GameAction("colorGrad", "Gradient Color")
|
|
{
|
|
function = delegate { var e = eventCaller.currentEntity; ForkLifter.instance.FadeGradientColor(e["start"], e["end"], e.length, e["instant"]); },
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("start", Color.white, "Start Color", "The color to start fading from."),
|
|
new Param("end", Color.white, "End Color", "The color to end the fade."),
|
|
new Param("instant", false, "Instant", "If checked, the gradient color will instantly change to the start color.")
|
|
},
|
|
resizable = true
|
|
},
|
|
new GameAction("bop", "Bop")
|
|
{
|
|
function = delegate { var e = eventCaller.currentEntity; ForkLifter.instance.Bop(e.beat, e.length, e["bop"], e["autoBop"]); },
|
|
parameters = new List<Param>()
|
|
{
|
|
new Param("bop", true, "Keep Bopping", "Should Fork bop for the duration of the block?"),
|
|
new Param("autoBop", false, "Keep Bopping (Auto)", "Should Fork bop indefinitely?"),
|
|
},
|
|
resizable = true,
|
|
},
|
|
|
|
// These are still here for backwards-compatibility but are hidden in the editor
|
|
new GameAction("pea", "")
|
|
{
|
|
function = delegate { ForkLifter.instance.Flick(eventCaller.currentEntity.beat, 0); },
|
|
defaultLength = 3,
|
|
hidden = true
|
|
},
|
|
new GameAction("topbun", "")
|
|
{
|
|
function = delegate { ForkLifter.instance.Flick(eventCaller.currentEntity.beat, 1); },
|
|
defaultLength = 3,
|
|
hidden = true
|
|
},
|
|
new GameAction("burger", "")
|
|
{
|
|
function = delegate { ForkLifter.instance.Flick(eventCaller.currentEntity.beat, 2); },
|
|
defaultLength = 3,
|
|
hidden = true
|
|
},
|
|
new GameAction("bottombun", "")
|
|
{
|
|
function = delegate { ForkLifter.instance.Flick(eventCaller.currentEntity.beat, 3); },
|
|
defaultLength = 3,
|
|
hidden = true
|
|
},
|
|
},
|
|
new List<string>() {"rvl", "normal"},
|
|
"rvlfork", "en",
|
|
new List<string>() {}
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
namespace HeavenStudio.Games
|
|
{
|
|
using Scripts_ForkLifter;
|
|
|
|
public class ForkLifter : Minigame
|
|
{
|
|
|
|
public enum FlickType
|
|
{
|
|
Pea,
|
|
TopBun,
|
|
Burger,
|
|
BottomBun
|
|
}
|
|
|
|
public static ForkLifter instance;
|
|
public static ForkLifterPlayer playerInstance => ForkLifterPlayer.instance;
|
|
|
|
[Header("References")]
|
|
public ForkLifterHand ForkLifterHand;
|
|
|
|
[Header("Objects")]
|
|
public Animator handAnim;
|
|
public GameObject flickedObject;
|
|
public SpriteRenderer peaPreview;
|
|
[SerializeField] SpriteRenderer bg;
|
|
[SerializeField] SpriteRenderer bgGradient;
|
|
[SerializeField] SpriteRenderer viewerCircle;
|
|
[SerializeField] SpriteRenderer playerShadow;
|
|
[SerializeField] SpriteRenderer handShadow;
|
|
Tween bgColorTween;
|
|
Tween bgGradientColorTween;
|
|
Tween viewerCircleColorTween;
|
|
Tween playerShadowColorTween;
|
|
Tween handShadowColorTween;
|
|
|
|
public Sprite[] peaSprites;
|
|
public Sprite[] peaHitSprites;
|
|
|
|
private void Awake()
|
|
{
|
|
instance = this;
|
|
}
|
|
|
|
public override void OnGameSwitch(double beat)
|
|
{
|
|
base.OnGameSwitch(beat);
|
|
ForkLifterHand.CheckNextFlick();
|
|
}
|
|
|
|
|
|
public void Bop(double beat, double length, bool doesBop, bool autoBop)
|
|
{
|
|
playerInstance.shouldBop = (autoBop || doesBop);
|
|
if (!autoBop && doesBop) {
|
|
BeatAction.New(gameObject, new List<BeatAction.Action>() {
|
|
new BeatAction.Action(beat + length, delegate {
|
|
playerInstance.shouldBop = false;
|
|
})
|
|
});
|
|
}
|
|
}
|
|
|
|
public void Flick(double beat, int type)
|
|
{
|
|
SoundByte.PlayOneShotGame("forkLifter/flick");
|
|
handAnim.Play("Hand_Flick", 0, 0);
|
|
ForkLifterHand.currentFlickIndex++;
|
|
GameObject fo = Instantiate(flickedObject);
|
|
fo.transform.parent = flickedObject.transform.parent;
|
|
Pea pea = fo.GetComponent<Pea>();
|
|
pea.startBeat = beat;
|
|
pea.type = type;
|
|
fo.SetActive(true);
|
|
}
|
|
|
|
public void ChangeBackgroundColor(Color color, float beats)
|
|
{
|
|
var seconds = Conductor.instance.secPerBeat * beats;
|
|
|
|
if (bgColorTween != null)
|
|
bgColorTween.Kill(true);
|
|
if (viewerCircleColorTween != null)
|
|
viewerCircleColorTween.Kill(true);
|
|
if (handShadowColorTween != null) handShadowColorTween.Kill(true);
|
|
|
|
if (seconds == 0)
|
|
{
|
|
bg.color = color;
|
|
viewerCircle.color = color;
|
|
handShadow.color = color;
|
|
}
|
|
else
|
|
{
|
|
bgColorTween = bg.DOColor(color, seconds);
|
|
handShadowColorTween = handShadow.DOColor(color, seconds);
|
|
viewerCircleColorTween = viewerCircle.DOColor(color, seconds);
|
|
}
|
|
}
|
|
|
|
public void FadeBackgroundColor(Color start, Color end, float beats, bool instant)
|
|
{
|
|
ChangeBackgroundColor(start, 0f);
|
|
if (!instant) ChangeBackgroundColor(end, beats);
|
|
}
|
|
|
|
public void ChangeGradientColor(Color color, float beats)
|
|
{
|
|
var seconds = Conductor.instance.secPerBeat * beats;
|
|
|
|
if (bgGradientColorTween != null)
|
|
bgGradientColorTween.Kill(true);
|
|
if (playerShadowColorTween != null) playerShadowColorTween.Kill(true);
|
|
|
|
if (seconds == 0)
|
|
{
|
|
bgGradient.color = color;
|
|
playerShadow.color = color;
|
|
}
|
|
else
|
|
{
|
|
bgGradientColorTween = bgGradient.DOColor(color, seconds);
|
|
playerShadowColorTween = playerShadow.DOColor(color, seconds);
|
|
}
|
|
}
|
|
|
|
public void FadeGradientColor(Color start, Color end, float beats, bool instant)
|
|
{
|
|
ChangeGradientColor(start, 0f);
|
|
if (!instant) ChangeGradientColor(end, beats);
|
|
}
|
|
}
|
|
|
|
} |