mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-14 13:45:10 +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>
195 lines
No EOL
6.2 KiB
C#
195 lines
No EOL
6.2 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using TMPro;
|
|
|
|
using HeavenStudio.Util;
|
|
using HeavenStudio.InputSystem;
|
|
|
|
namespace HeavenStudio.Common
|
|
{
|
|
public class PauseMenu : MonoBehaviour
|
|
{
|
|
public enum Options
|
|
{
|
|
Continue,
|
|
StartOver,
|
|
Settings,
|
|
Quit
|
|
}
|
|
|
|
// TODO
|
|
// MAKE OPTIONS ACCEPT MOUSE INPUT
|
|
|
|
[SerializeField] float patternSpeed = 1f;
|
|
[SerializeField] SettingsDialog settingsDialog;
|
|
[SerializeField] Animator animator;
|
|
[SerializeField] TMP_Text chartTitleText;
|
|
[SerializeField] TMP_Text chartArtistText;
|
|
[SerializeField] GameObject optionArrow;
|
|
[SerializeField] GameObject optionHolder;
|
|
|
|
[SerializeField] RectTransform patternL;
|
|
[SerializeField] RectTransform patternR;
|
|
|
|
public static bool IsPaused { get { return isPaused; } }
|
|
|
|
private static bool isPaused = false;
|
|
private double pauseBeat;
|
|
private bool canPick = false;
|
|
private bool isQuitting = false;
|
|
private int optionSelected = 0;
|
|
|
|
void Pause()
|
|
{
|
|
if (GlobalGameManager.IsShowingDialog) return;
|
|
if (!Conductor.instance.isPlaying) return;
|
|
Conductor.instance.Pause();
|
|
pauseBeat = Conductor.instance.songPositionInBeatsAsDouble;
|
|
chartTitleText.text = GameManager.instance.Beatmap["remixtitle"];
|
|
chartArtistText.text = GameManager.instance.Beatmap["remixauthor"];
|
|
animator.Play("PauseShow");
|
|
SoundByte.PlayOneShot("ui/PauseIn");
|
|
|
|
isPaused = true;
|
|
canPick = false;
|
|
optionSelected = 0;
|
|
}
|
|
|
|
void UnPause(bool instant = false)
|
|
{
|
|
if ((!instant) && (!Conductor.instance.isPaused)) return;
|
|
Conductor.instance.Play(pauseBeat);
|
|
if (instant)
|
|
{
|
|
animator.Play("NoPose");
|
|
}
|
|
else
|
|
{
|
|
animator.Play("PauseHide");
|
|
SoundByte.PlayOneShot("ui/PauseOut");
|
|
}
|
|
|
|
isPaused = false;
|
|
canPick = false;
|
|
}
|
|
|
|
// Start is called before the first frame update
|
|
void Start()
|
|
{
|
|
isPaused = false;
|
|
isQuitting = false;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
if (isQuitting) return;
|
|
if (PlayerInput.GetInputController(1).GetButtonDown((int) InputController.ButtonsPad.PadPause))
|
|
{
|
|
if (isPaused)
|
|
{
|
|
UnPause();
|
|
}
|
|
else
|
|
{
|
|
Pause();
|
|
}
|
|
}
|
|
else if (isPaused && canPick && !settingsDialog.IsOpen)
|
|
{
|
|
if (Input.GetKeyDown(KeyCode.UpArrow) || PlayerInput.GetInputController(1).GetButtonDown((int)InputController.ButtonsPad.PadUp))
|
|
{
|
|
optionSelected--;
|
|
if (optionSelected < 0)
|
|
{
|
|
optionSelected = optionHolder.transform.childCount - 1;
|
|
}
|
|
ChooseOption((Options) optionSelected);
|
|
}
|
|
else if (Input.GetKeyDown(KeyCode.DownArrow) || PlayerInput.GetInputController(1).GetButtonDown((int)InputController.ButtonsPad.PadDown))
|
|
{
|
|
optionSelected++;
|
|
if (optionSelected > optionHolder.transform.childCount - 1)
|
|
{
|
|
optionSelected = 0;
|
|
}
|
|
ChooseOption((Options) optionSelected);
|
|
}
|
|
else if (Input.GetKeyDown(KeyCode.Return) || PlayerInput.GetInputController(1).GetButtonDown((int)InputController.ButtonsPad.PadE))
|
|
{
|
|
UseOption((Options) optionSelected);
|
|
}
|
|
}
|
|
|
|
if (isPaused)
|
|
{
|
|
patternL.anchoredPosition = new Vector2((Time.realtimeSinceStartup * patternSpeed) % 13, patternL.anchoredPosition.y);
|
|
patternR.anchoredPosition = new Vector2(-(Time.realtimeSinceStartup * patternSpeed) % 13, patternR.anchoredPosition.y);
|
|
}
|
|
}
|
|
|
|
public void ChooseCurrentOption()
|
|
{
|
|
ChooseOption((Options) optionSelected, false);
|
|
canPick = true;
|
|
}
|
|
|
|
public void ChooseOption(Options option, bool sound = true)
|
|
{
|
|
optionArrow.transform.position = new Vector3(optionArrow.transform.position.x, optionHolder.transform.GetChild((int) option).position.y, optionArrow.transform.position.z);
|
|
foreach (Transform child in optionHolder.transform)
|
|
{
|
|
child.transform.localScale = new Vector3(1f, 1f, 1f);
|
|
}
|
|
optionHolder.transform.GetChild((int) option).transform.localScale = new Vector3(1.2f, 1.2f, 1.2f);
|
|
if (sound)
|
|
SoundByte.PlayOneShot("ui/UIOption");
|
|
}
|
|
|
|
void UseOption(Options option)
|
|
{
|
|
switch (option)
|
|
{
|
|
case Options.Continue:
|
|
OnContinue();
|
|
break;
|
|
case Options.StartOver:
|
|
OnRestart();
|
|
break;
|
|
case Options.Settings:
|
|
OnSettings();
|
|
SoundByte.PlayOneShot("ui/UISelect");
|
|
break;
|
|
case Options.Quit:
|
|
OnQuit();
|
|
break;
|
|
}
|
|
}
|
|
|
|
void OnContinue()
|
|
{
|
|
UnPause();
|
|
}
|
|
|
|
void OnRestart()
|
|
{
|
|
UnPause(true);
|
|
GlobalGameManager.ForceFade(0, 1f, 0.5f);
|
|
GameManager.instance.Stop(0, true, 1.5f);
|
|
SoundByte.PlayOneShot("ui/UIEnter");
|
|
}
|
|
|
|
void OnQuit()
|
|
{
|
|
isQuitting = true;
|
|
SoundByte.PlayOneShot("ui/PauseQuit");
|
|
GlobalGameManager.LoadScene("Editor", 0, 0.1f);
|
|
}
|
|
|
|
void OnSettings()
|
|
{
|
|
settingsDialog.SwitchSettingsDialog();
|
|
}
|
|
}
|
|
} |