cheer readers touch

This commit is contained in:
minenice55 2023-09-21 15:21:59 -04:00
parent 26f8fa52e4
commit ad722e0ce5
7 changed files with 187 additions and 34 deletions

View file

@ -1,4 +1,5 @@
using HeavenStudio.Util;
using HeavenStudio.InputSystem;
using JetBrains.Annotations;
using Starpelly.Transformer;
using System;
@ -106,9 +107,9 @@ namespace HeavenStudio.Games.Loaders
defaultLength = 0.5f
}
},
new List<string>() {"rvl", "normal"},
new List<string>() { "rvl", "normal" },
"rvlbooks", "en",
new List<string>() {"en"}
new List<string>() { "en" }
);
}
}
@ -176,6 +177,42 @@ namespace HeavenStudio.Games
float currentZoomCamLength;
private List<RiqEntity> allCameraEvents = new List<RiqEntity>();
const int IAAltDownCat = 4;
const int IAAltUpCat = 5;
protected static bool IA_PadAltPress(out double dt)
{
return PlayerInput.GetPadDown(InputController.ActionsPad.South, out dt);
}
protected static bool IA_BatonAltPress(out double dt)
{
return PlayerInput.GetSqueezeDown(out dt);
}
protected static bool IA_TouchAltPress(out double dt)
{
return PlayerInput.GetTouchDown(InputController.ActionsTouch.Tap, out dt)
&& instance.IsExpectingInputNow(InputAction_AltStart);
}
protected static bool IA_PadAltRelease(out double dt)
{
return PlayerInput.GetPadUp(InputController.ActionsPad.South, out dt);
}
protected static bool IA_BatonAltRelease(out double dt)
{
return PlayerInput.GetSqueezeUp(out dt);
}
public static PlayerInput.InputAction InputAction_AltStart =
new("RvlBookAltStart", new int[] { IAAltDownCat, IAAltDownCat, IAAltDownCat },
IA_PadAltPress, IA_TouchAltPress, IA_BatonAltPress);
public static PlayerInput.InputAction InputAction_AltFinish =
new("RvlBookAltFinish", new int[] { IAAltUpCat, IAFlickCat, IAAltUpCat },
IA_PadAltRelease, IA_TouchFlick, IA_BatonAltRelease);
public static PlayerInput.InputAction InputAction_TouchRelease =
new("NtrIdolTouchRelease", new int[] { IAEmptyCat, IAReleaseCat, IAEmptyCat },
IA_Empty, IA_TouchBasicRelease, IA_Empty);
void OnDestroy()
{
SoundByte.KillLoop(SpinningLoop, 0.5f);
@ -289,14 +326,29 @@ namespace HeavenStudio.Games
}
}
}
if (PlayerInput.Pressed() && !IsExpectingInputNow(InputType.STANDARD_DOWN))
if (PlayerInput.GetIsAction(InputAction_BasicPress) && !IsExpectingInputNow(InputAction_BasicPress))
{
player.FlipBook(false);
missPoster.SetActive(false);
SoundByte.PlayOneShotGame("cheerReaders/miss");
ScoreMiss(1f);
if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch
|| (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch && !IsExpectingInputNow(InputAction_AltStart)))
{
player.FlipBook(false);
missPoster.SetActive(false);
SoundByte.PlayOneShotGame("cheerReaders/miss");
ScoreMiss(1f);
}
}
if (PlayerInput.AltPressed() && !IsExpectingInputNow(InputType.STANDARD_ALT_DOWN))
if (PlayerInput.GetIsAction(InputAction_TouchRelease) && player.isSpinning)
{
if (PlayerInput.CurrentControlStyle == InputController.ControlStyles.Touch && !IsExpectingInputNow(InputAction_AltFinish))
{
player.FlipBook(false);
missPoster.SetActive(false);
SoundByte.PlayOneShotGame("cheerReaders/miss");
SoundByte.KillLoop(SpinningLoop, 0f);
ScoreMiss(1f);
}
}
if (PlayerInput.GetIsAction(InputAction_AltStart) && !IsExpectingInputNow(InputAction_AltStart))
{
SoundByte.PlayOneShotGame("cheerReaders/doingoing");
player.StartSpinBook();
@ -304,7 +356,7 @@ namespace HeavenStudio.Games
SpinningLoop = SoundByte.PlayOneShotGame("cheerReaders/bookSpinLoop", -1, 1, 1, true);
ScoreMiss(1f);
}
if (PlayerInput.AltPressedUp() && !IsExpectingInputNow(InputType.STANDARD_ALT_UP))
if (PlayerInput.GetIsAction(InputAction_AltFinish) && !IsExpectingInputNow(InputAction_AltFinish) && player.isSpinning)
{
SoundByte.PlayOneShotGame("cheerReaders/doingoing");
player.StopSpinBook();
@ -485,7 +537,7 @@ namespace HeavenStudio.Games
public void OneTwoThree(double beat, int whoSpeaks)
{
canBop = false;
ScheduleInput(beat, 2, InputType.STANDARD_DOWN, JustFlip, MissFlip, Nothing);
ScheduleInput(beat, 2, InputAction_BasicPress, JustFlip, MissFlip, Nothing);
List<MultiSound.Sound> soundsToPlay = new List<MultiSound.Sound>()
{
new MultiSound.Sound("cheerReaders/bookHorizontal", beat),
@ -613,7 +665,7 @@ namespace HeavenStudio.Games
public void ItsUpToYou(double beat, int whoSpeaks)
{
canBop = false;
ScheduleInput(beat, 2, InputType.STANDARD_DOWN, JustFlip, MissFlip, Nothing);
ScheduleInput(beat, 2, InputAction_BasicPress, JustFlip, MissFlip, Nothing);
List<MultiSound.Sound> soundsToPlay = new List<MultiSound.Sound>()
{
new MultiSound.Sound("cheerReaders/bookVertical", beat),
@ -771,7 +823,7 @@ namespace HeavenStudio.Games
public void LetsGoReadABunchaBooks(double beat, int whoSpeaks)
{
canBop = false;
ScheduleInput(beat, 2, InputType.STANDARD_DOWN, JustFlip, MissFlip, Nothing);
ScheduleInput(beat, 2, InputAction_BasicPress, JustFlip, MissFlip, Nothing);
List<MultiSound.Sound> soundsToPlay = new List<MultiSound.Sound>()
{
new MultiSound.Sound("cheerReaders/letsGoRead", beat),
@ -957,7 +1009,7 @@ namespace HeavenStudio.Games
public void RahRahSisBoomBaBoom(double beat, int whoSpeaks, bool consecutive)
{
canBop = false;
ScheduleInput(beat, 2.5f, InputType.STANDARD_DOWN, JustFlipBoom, MissFlip, Nothing);
ScheduleInput(beat, 2.5f, InputAction_BasicPress, JustFlipBoom, MissFlip, Nothing);
List<MultiSound.Sound> soundsToPlay = new List<MultiSound.Sound>()
{
new MultiSound.Sound("cheerReaders/bookDiagonal", beat + 0.5f),
@ -1168,8 +1220,8 @@ namespace HeavenStudio.Games
{
canBop = false;
float actualLength = length * 0.25f;
ScheduleInput(beat, 2 * actualLength, InputType.STANDARD_ALT_DOWN, JustHoldSpin, MissFlip, Nothing);
ScheduleInput(beat, 3 * actualLength, InputType.STANDARD_ALT_UP, JustReleaseSpin, MissFlip, Nothing);
ScheduleInput(beat, 2 * actualLength, InputAction_AltStart, JustHoldSpin, MissFlip, Nothing);
ScheduleInput(beat, 3 * actualLength, InputAction_AltFinish, JustReleaseSpin, MissFlip, Nothing).IsHittable = IsReleaseSpinHittable;
List<MultiSound.Sound> soundsToPlay = new List<MultiSound.Sound>();
if (whistle)
{
@ -1442,6 +1494,10 @@ namespace HeavenStudio.Games
playerMask.SetActive(false);
missPoster.SetActive(false);
SoundByte.PlayOneShotGame("cheerReaders/doingoing");
if (SpinningLoop != null)
SoundByte.KillLoop(SpinningLoop, 0f);
player.Miss();
shouldDoSuccessZoom = false;
foreach (var girl in allGirls)
@ -1450,6 +1506,11 @@ namespace HeavenStudio.Games
}
}
void Nothing(PlayerActionEvent caller) {}
void Nothing(PlayerActionEvent caller) { }
bool IsReleaseSpinHittable()
{
return player.isSpinning;
}
}
}

View file

@ -12,6 +12,7 @@ namespace HeavenStudio.Games.Scripts_CheerReaders
[SerializeField] GameObject blushLeft;
[SerializeField] GameObject blushRight;
public bool bookIsWhite = true;
public bool isSpinning;
public GameObject posterBook;
bool bookIsOpen;
bool noBop;
@ -136,6 +137,7 @@ namespace HeavenStudio.Games.Scripts_CheerReaders
BaseAnim.Play(bookIsWhite ? "MissWhite" : "MissBlack", 0, 0);
noBop = true;
missed = true;
isSpinning = false;
}
public void Stare()
@ -146,12 +148,13 @@ namespace HeavenStudio.Games.Scripts_CheerReaders
public void FlipBook(bool hit = true)
{
posterBook.SetActive(false);
if (hit) canOpenBook = false;
canOpenBook = !hit;
isSpinning = hit;
if (bookIsWhite != game.shouldBeBlack && hit && player)
{
RepositionBook();
return;
}
}
BaseAnim.DoScaledAnimationAsync(bookIsWhite ? "WhitetoBlack" : "BlacktoWhite", 0.5f);
bookIsWhite = !bookIsWhite;
bookIsOpen = true;
@ -173,6 +176,7 @@ namespace HeavenStudio.Games.Scripts_CheerReaders
BaseAnim.DoScaledAnimationAsync(bookIsWhite ? "SpinfromWhite" : "SpinfromBlack", 0.5f);
bookIsOpen = true;
noBop = true;
isSpinning = true;
}
public void StopSpinBook()
@ -182,6 +186,7 @@ namespace HeavenStudio.Games.Scripts_CheerReaders
BaseAnim.DoScaledAnimationAsync("OpenBook", 0.5f);
bookIsOpen = true;
noBop = true;
isSpinning = false;
}
}
}

View file

@ -710,9 +710,9 @@ namespace HeavenStudio.InputSystem
return joyBtStateCurrent.stickRX;
case InputAxis.AxisRStickY:
return joyBtStateCurrent.stickRY;
case InputAxis.TouchpadX: //isn't updated for now, so always returns 0f
case InputAxis.PointerX: //isn't updated for now, so always returns 0f
//return joyTouchStateCurrent.t0X;
case InputAxis.TouchpadY:
case InputAxis.PointerY:
//return joyTouchStateCurrent.t0Y;
default:
return 0f;
@ -727,7 +727,7 @@ namespace HeavenStudio.InputSystem
return new Vector3(joyBtStateCurrent.stickLX, joyBtStateCurrent.stickLY, 0f);
case InputVector.RStick:
return new Vector3(joyBtStateCurrent.stickRX, joyBtStateCurrent.stickRY, 0f);
case InputVector.Touchpad:
case InputVector.Pointer:
return new Vector3(joyTouchStateCurrent.t0X, joyTouchStateCurrent.t0Y, 0f);
case InputVector.Accelerometer:
return new Vector3(joyImuStateCurrent.accelX, joyImuStateCurrent.accelY, joyImuStateCurrent.accelZ);
@ -976,7 +976,7 @@ namespace HeavenStudio.InputSystem
return false;
}
public override bool GetSwipe(out double dt)
public override bool GetSlide(out double dt)
{
dt = 0;
return false;
@ -1030,5 +1030,22 @@ namespace HeavenStudio.InputSystem
{
return ControlStyles.Pad;
}
public override bool GetSqueezeDown(out double dt)
{
dt = 0;
return false;
}
public override bool GetSqueezeUp(out double dt)
{
dt = 0;
return false;
}
public override bool GetSqueeze()
{
return false;
}
}
}

View file

@ -271,7 +271,7 @@ namespace HeavenStudio.InputSystem
return false;
}
public override bool GetSwipe(out double dt)
public override bool GetSlide(out double dt)
{
dt = 0;
return false;
@ -292,5 +292,22 @@ namespace HeavenStudio.InputSystem
{
return ControlStyles.Pad;
}
public override bool GetSqueezeDown(out double dt)
{
dt = 0;
return false;
}
public override bool GetSqueezeUp(out double dt)
{
dt = 0;
return false;
}
public override bool GetSqueeze()
{
return false;
}
}
}

View file

@ -369,7 +369,7 @@ namespace HeavenStudio.InputSystem
return hasFlicked;
}
public override bool GetSwipe(out double dt)
public override bool GetSlide(out double dt)
{
dt = hasSwiped ? Time.realtimeSinceStartupAsDouble - timeMoveChange : 0;
return hasSwiped;
@ -390,5 +390,22 @@ namespace HeavenStudio.InputSystem
{
return ControlStyles.Touch;
}
public override bool GetSqueezeDown(out double dt)
{
dt = 0;
return false;
}
public override bool GetSqueezeUp(out double dt)
{
dt = 0;
return false;
}
public override bool GetSqueeze()
{
return false;
}
}
}

View file

@ -19,17 +19,20 @@ namespace HeavenStudio.InputSystem
AxisLStickY = 1,
AxisRStickX = 2,
AxisRStickY = 3,
TouchpadX = 6,
TouchpadY = 7
PointerX = 6,
PointerY = 7,
PointerDeltaX = 8,
PointerDeltaY = 9
}
public enum InputVector : int
{
LStick = 0,
RStick = 1,
Touchpad = 2,
Gyroscope = 3,
Accelerometer = 4,
Pointer = 2,
PointerSpeed = 3,
Gyroscope = 4,
Accelerometer = 5,
}
//D-Pad directions, usable to adapt analogue sticks to cardinal directions
@ -295,7 +298,10 @@ namespace HeavenStudio.InputSystem
public abstract bool GetHatDirectionUp(InputDirection direction, out double dt);
public abstract bool GetFlick(out double dt);
public abstract bool GetSwipe(out double dt);
public abstract bool GetSlide(out double dt);
public abstract bool GetSqueezeDown(out double dt);
public abstract bool GetSqueezeUp(out double dt);
public abstract bool GetSqueeze();
/// <summary>
/// Sets the player number (starts at 1, set to -1 or null for no player)

View file

@ -305,6 +305,36 @@ namespace HeavenStudio
return a && PlayerHasControl();
}
public static bool GetSqueeze()
{
bool a = GetInputController(1).GetSqueeze();
return a && PlayerHasControl();
}
public static bool GetSqueezeDown()
{
bool a = GetInputController(1).GetSqueezeDown(out _);
return a && PlayerHasControl();
}
public static bool GetSqueezeDown(out double dt)
{
bool a = GetInputController(1).GetSqueezeDown(out dt);
return a && PlayerHasControl();
}
public static bool GetSqueezeUp()
{
bool a = GetInputController(1).GetSqueezeUp(out _);
return a && PlayerHasControl();
}
public static bool GetSqueezeUp(out double dt)
{
bool a = GetInputController(1).GetSqueezeUp(out dt);
return a && PlayerHasControl();
}
public static bool GetTouchDown(InputController.ActionsTouch ac, out double dt)
{
bool a = GetInputController(1).GetActionDown(InputController.ControlStyles.Touch, (int)ac, out dt);
@ -335,15 +365,15 @@ namespace HeavenStudio
return a && PlayerHasControl();
}
public static bool GetSwipe()
public static bool GetSlide()
{
bool a = GetInputController(1).GetSwipe(out _);
bool a = GetInputController(1).GetSlide(out _);
return a && PlayerHasControl();
}
public static bool GetSwipe(out double dt)
public static bool GetSlide(out double dt)
{
bool a = GetInputController(1).GetSwipe(out dt);
bool a = GetInputController(1).GetSlide(out dt);
return a && PlayerHasControl();
}