Tweezers: Allowed inputting via arrow keys. Editor: Remix files now saved as .tengoku files (.rhmania files can still be opened via the editor).

This commit is contained in:
Jenny Crowe 2022-02-21 22:43:31 -07:00
parent 02b5d27feb
commit 081c08e47f
5 changed files with 42 additions and 12 deletions

View file

@ -28,7 +28,7 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
float stateBeat = Conductor.instance.GetPositionFromMargin(createBeat + game.tweezerBeatOffset + game.beatInterval, 1f); float stateBeat = Conductor.instance.GetPositionFromMargin(createBeat + game.tweezerBeatOffset + game.beatInterval, 1f);
StateCheck(stateBeat); StateCheck(stateBeat);
if (PlayerInput.Pressed()) if (PlayerInput.Pressed(true))
{ {
if (state.perfect) if (state.perfect)
{ {

View file

@ -39,7 +39,7 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
stateBeat = Conductor.instance.GetPositionFromMargin(createBeat + game.tweezerBeatOffset + game.beatInterval, 1f); stateBeat = Conductor.instance.GetPositionFromMargin(createBeat + game.tweezerBeatOffset + game.beatInterval, 1f);
StateCheck(stateBeat); StateCheck(stateBeat);
if (PlayerInput.Pressed()) if (PlayerInput.Pressed(true))
{ {
if (state.perfect) if (state.perfect)
{ {
@ -60,7 +60,7 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
stateBeat = Conductor.instance.GetPositionFromMargin(createBeat + game.tweezerBeatOffset + game.beatInterval + 0.5f, 1f); stateBeat = Conductor.instance.GetPositionFromMargin(createBeat + game.tweezerBeatOffset + game.beatInterval + 0.5f, 1f);
StateCheck(stateBeat); StateCheck(stateBeat);
if (PlayerInput.PressedUp()) if (PlayerInput.PressedUp(true))
{ {
// It's possible to release earlier than earlyTime, // It's possible to release earlier than earlyTime,
// and the hair will automatically be released before lateTime, // and the hair will automatically be released before lateTime,

View file

@ -28,7 +28,7 @@ namespace RhythmHeavenMania.Games.RhythmTweezers
private void LateUpdate() private void LateUpdate()
{ {
if (PlayerInput.Pressed()) if (PlayerInput.Pressed(true))
{ {
if (!pluckingThisFrame) // Did you do a successful pluck earlier in the frame? if (!pluckingThisFrame) // Did you do a successful pluck earlier in the frame?
{ {

View file

@ -281,7 +281,7 @@ namespace RhythmHeavenMania.Editor
{ {
var extensions = new[] var extensions = new[]
{ {
new ExtensionFilter("Rhythm Heaven Mania Remix File", "rhmania") new ExtensionFilter("Heaven Studio Remix File", "tengoku")
}; };
StandaloneFileBrowser.SaveFilePanelAsync("Save Remix As", "", "remix_level", extensions, (string path) => StandaloneFileBrowser.SaveFilePanelAsync("Save Remix As", "", "remix_level", extensions, (string path) =>
@ -323,7 +323,7 @@ namespace RhythmHeavenMania.Editor
{ {
var extensions = new[] var extensions = new[]
{ {
new ExtensionFilter("Rhythm Heaven Mania Remix File", "rhmania") new ExtensionFilter("Heaven Studio Remix File", new string[] { "tengoku", "rhmania" })
}; };
StandaloneFileBrowser.OpenFilePanelAsync("Open Remix", "", extensions, false, (string[] paths) => StandaloneFileBrowser.OpenFilePanelAsync("Open Remix", "", extensions, false, (string[] paths) =>

View file

@ -6,19 +6,22 @@ namespace RhythmHeavenMania
{ {
public class PlayerInput public class PlayerInput
{ {
public static bool Pressed() public static bool Pressed(bool includeDPad = false)
{ {
return Input.GetKeyDown(KeyCode.Z) && !GameManager.instance.autoplay && Conductor.instance.isPlaying; bool keyDown = Input.GetKeyDown(KeyCode.Z) || (includeDPad && GetAnyDirectionDown());
return keyDown && !GameManager.instance.autoplay && Conductor.instance.isPlaying;
} }
public static bool PressedUp() public static bool PressedUp(bool includeDPad = false)
{ {
return Input.GetKeyUp(KeyCode.Z) && !GameManager.instance.autoplay && Conductor.instance.isPlaying; bool keyUp = Input.GetKeyUp(KeyCode.Z) || (includeDPad && GetAnyDirectionUp());
return keyUp && !GameManager.instance.autoplay && Conductor.instance.isPlaying;
} }
public static bool Pressing() public static bool Pressing(bool includeDPad = false)
{ {
return Input.GetKey(KeyCode.Z) && !GameManager.instance.autoplay && Conductor.instance.isPlaying; bool pressing = Input.GetKey(KeyCode.Z) || (includeDPad && GetAnyDirection());
return pressing && !GameManager.instance.autoplay && Conductor.instance.isPlaying;
} }
@ -36,5 +39,32 @@ namespace RhythmHeavenMania
{ {
return Input.GetKey(KeyCode.X) && !GameManager.instance.autoplay && Conductor.instance.isPlaying; return Input.GetKey(KeyCode.X) && !GameManager.instance.autoplay && Conductor.instance.isPlaying;
} }
public static bool GetAnyDirectionDown()
{
return Input.GetKeyDown(KeyCode.UpArrow)
|| Input.GetKeyDown(KeyCode.DownArrow)
|| Input.GetKeyDown(KeyCode.LeftArrow)
|| Input.GetKeyDown(KeyCode.RightArrow);
}
public static bool GetAnyDirectionUp()
{
return Input.GetKeyUp(KeyCode.UpArrow)
|| Input.GetKeyUp(KeyCode.DownArrow)
|| Input.GetKeyUp(KeyCode.LeftArrow)
|| Input.GetKeyUp(KeyCode.RightArrow);
}
public static bool GetAnyDirection()
{
return Input.GetKey(KeyCode.UpArrow)
|| Input.GetKey(KeyCode.DownArrow)
|| Input.GetKey(KeyCode.LeftArrow)
|| Input.GetKey(KeyCode.RightArrow);
}
} }
} }