mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-10 11:45:09 +00:00
Added Checkbox Parameter + Toggle Inputs Event
So now you can disable inputs if you need to :)
This commit is contained in:
parent
daf19fae54
commit
687f2b53f4
8 changed files with 42 additions and 8 deletions
|
@ -25,6 +25,7 @@ namespace RhythmHeavenMania
|
|||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valA;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valB;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valC;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public bool toggle;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type2;
|
||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public EasingFunction.Ease ease;
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace RhythmHeavenMania
|
|||
public float startBeat;
|
||||
[NonSerialized] public GameObject currentGameO;
|
||||
public bool autoplay;
|
||||
public bool canInput = true;
|
||||
|
||||
public event Action<float> onBeatChanged;
|
||||
|
||||
|
@ -195,10 +196,16 @@ namespace RhythmHeavenMania
|
|||
}
|
||||
}
|
||||
|
||||
public void ToggleInputs(bool inputs)
|
||||
{
|
||||
canInput = inputs;
|
||||
}
|
||||
|
||||
#region Play Events
|
||||
|
||||
public void Play(float beat)
|
||||
{
|
||||
canInput = true;
|
||||
StartCoroutine(PlayCo(beat));
|
||||
onBeatChanged?.Invoke(beat);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace RhythmHeavenMania.Games
|
|||
{
|
||||
if (aceTimes == 0)
|
||||
{
|
||||
if (triggersAutoplay && (GameManager.instance.autoplay || autoPlay) && normalizedBeat > 0.99f)
|
||||
if (triggersAutoplay && (GameManager.instance.autoplay || autoPlay) && GameManager.instance.canInput && normalizedBeat > 0.99f)
|
||||
{
|
||||
OnAce();
|
||||
if (!autoPlay)
|
||||
|
|
|
@ -358,7 +358,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
|||
|
||||
private void CheckIfFall(float normalizedBeat)
|
||||
{
|
||||
if (normalizedBeat > Minigame.LateTime() && !GameManager.instance.autoplay)
|
||||
if (normalizedBeat > Minigame.LateTime() && (!GameManager.instance.autoplay || !GameManager.instance.canInput))
|
||||
{
|
||||
Jukebox.PlayOneShotGame("spaceSoccer/missNeutral");
|
||||
ball = null;
|
||||
|
|
|
@ -15,6 +15,7 @@ namespace RhythmHeavenMania.Editor
|
|||
[Header("Property Prefabs")]
|
||||
[SerializeField] private GameObject IntegerP;
|
||||
[SerializeField] private GameObject FloatP;
|
||||
[SerializeField] private GameObject BooleanP;
|
||||
[SerializeField] private GameObject DropdownP;
|
||||
[SerializeField] private GameObject ColorP;
|
||||
|
||||
|
@ -106,6 +107,10 @@ namespace RhythmHeavenMania.Editor
|
|||
{
|
||||
prefab = FloatP;
|
||||
}
|
||||
else if(type is bool)
|
||||
{
|
||||
prefab = BooleanP;
|
||||
}
|
||||
else if (objType.IsEnum)
|
||||
{
|
||||
prefab = DropdownP;
|
||||
|
|
|
@ -21,6 +21,10 @@ namespace RhythmHeavenMania.Editor
|
|||
public Slider slider;
|
||||
public TMP_InputField inputField;
|
||||
|
||||
[Header("Boolean")]
|
||||
[Space(10)]
|
||||
public Toggle toggle;
|
||||
|
||||
[Header("Dropdown")]
|
||||
[Space(10)]
|
||||
public TMP_Dropdown dropdown;
|
||||
|
@ -86,6 +90,15 @@ namespace RhythmHeavenMania.Editor
|
|||
parameterManager.entity[propertyName] = slider.value;
|
||||
});
|
||||
}
|
||||
else if(type is bool)
|
||||
{
|
||||
toggle.isOn = (bool)type;
|
||||
|
||||
toggle.onValueChanged.AddListener(delegate
|
||||
{
|
||||
parameterManager.entity[propertyName] = toggle.isOn;
|
||||
});
|
||||
}
|
||||
else if (objType.IsEnum)
|
||||
{
|
||||
List<TMP_Dropdown.OptionData> dropDownData = new List<TMP_Dropdown.OptionData>();
|
||||
|
|
|
@ -105,6 +105,13 @@ namespace RhythmHeavenMania
|
|||
new Param("valB", new EntityTypes.Float(0, 1, 0), "End Opacity"),
|
||||
new Param("ease", EasingFunction.Ease.Linear, "Ease")
|
||||
} ),
|
||||
new GameAction("toggle inputs", delegate
|
||||
{
|
||||
GameManager.instance.ToggleInputs(eventCaller.currentEntity.toggle);
|
||||
}, 0.5f, true, new List<Param>()
|
||||
{
|
||||
new Param("toggle", true, "Enable Inputs")
|
||||
}),
|
||||
}),
|
||||
new Minigame("countIn", "Count-Ins", "", false, true, new List<GameAction>()
|
||||
{
|
||||
|
|
|
@ -6,38 +6,39 @@ namespace RhythmHeavenMania
|
|||
{
|
||||
public class PlayerInput
|
||||
{
|
||||
|
||||
public static bool Pressed(bool includeDPad = false)
|
||||
{
|
||||
bool keyDown = Input.GetKeyDown(KeyCode.Z) || (includeDPad && GetAnyDirectionDown());
|
||||
return keyDown && !GameManager.instance.autoplay && Conductor.instance.isPlaying;
|
||||
return keyDown && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput ;
|
||||
}
|
||||
|
||||
public static bool PressedUp(bool includeDPad = false)
|
||||
{
|
||||
bool keyUp = Input.GetKeyUp(KeyCode.Z) || (includeDPad && GetAnyDirectionUp());
|
||||
return keyUp && !GameManager.instance.autoplay && Conductor.instance.isPlaying;
|
||||
return keyUp && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
||||
}
|
||||
|
||||
public static bool Pressing(bool includeDPad = false)
|
||||
{
|
||||
bool pressing = Input.GetKey(KeyCode.Z) || (includeDPad && GetAnyDirection());
|
||||
return pressing && !GameManager.instance.autoplay && Conductor.instance.isPlaying;
|
||||
return pressing && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
||||
}
|
||||
|
||||
|
||||
public static bool AltPressed()
|
||||
{
|
||||
return Input.GetKeyDown(KeyCode.X) && !GameManager.instance.autoplay && Conductor.instance.isPlaying;
|
||||
return Input.GetKeyDown(KeyCode.X) && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
||||
}
|
||||
|
||||
public static bool AltPressedUp()
|
||||
{
|
||||
return Input.GetKeyUp(KeyCode.X) && !GameManager.instance.autoplay && Conductor.instance.isPlaying;
|
||||
return Input.GetKeyUp(KeyCode.X) && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
||||
}
|
||||
|
||||
public static bool AltPressing()
|
||||
{
|
||||
return Input.GetKey(KeyCode.X) && !GameManager.instance.autoplay && Conductor.instance.isPlaying;
|
||||
return Input.GetKey(KeyCode.X) && !GameManager.instance.autoplay && Conductor.instance.isPlaying && GameManager.instance.canInput;
|
||||
}
|
||||
|
||||
public static bool GetAnyDirectionDown()
|
||||
|
|
Loading…
Reference in a new issue