mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-13 21:25:09 +00:00
Merge pull request #27 from CarsonKompon/editor-enable-disable-inputs-event
Added Checkbox Parameter + Toggle Inputs Event
This commit is contained in:
commit
a30ddcf544
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 valA;
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valB;
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valB;
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valC;
|
[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 type;
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type2;
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type2;
|
||||||
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public EasingFunction.Ease ease;
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public EasingFunction.Ease ease;
|
||||||
|
|
|
@ -36,6 +36,7 @@ namespace RhythmHeavenMania
|
||||||
public float startBeat;
|
public float startBeat;
|
||||||
[NonSerialized] public GameObject currentGameO;
|
[NonSerialized] public GameObject currentGameO;
|
||||||
public bool autoplay;
|
public bool autoplay;
|
||||||
|
public bool canInput = true;
|
||||||
|
|
||||||
public event Action<float> onBeatChanged;
|
public event Action<float> onBeatChanged;
|
||||||
|
|
||||||
|
@ -195,10 +196,16 @@ namespace RhythmHeavenMania
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ToggleInputs(bool inputs)
|
||||||
|
{
|
||||||
|
canInput = inputs;
|
||||||
|
}
|
||||||
|
|
||||||
#region Play Events
|
#region Play Events
|
||||||
|
|
||||||
public void Play(float beat)
|
public void Play(float beat)
|
||||||
{
|
{
|
||||||
|
canInput = true;
|
||||||
StartCoroutine(PlayCo(beat));
|
StartCoroutine(PlayCo(beat));
|
||||||
onBeatChanged?.Invoke(beat);
|
onBeatChanged?.Invoke(beat);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace RhythmHeavenMania.Games
|
||||||
{
|
{
|
||||||
if (aceTimes == 0)
|
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();
|
OnAce();
|
||||||
if (!autoPlay)
|
if (!autoPlay)
|
||||||
|
|
|
@ -358,7 +358,7 @@ namespace RhythmHeavenMania.Games.SpaceSoccer
|
||||||
|
|
||||||
private void CheckIfFall(float normalizedBeat)
|
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");
|
Jukebox.PlayOneShotGame("spaceSoccer/missNeutral");
|
||||||
ball = null;
|
ball = null;
|
||||||
|
|
|
@ -15,6 +15,7 @@ namespace RhythmHeavenMania.Editor
|
||||||
[Header("Property Prefabs")]
|
[Header("Property Prefabs")]
|
||||||
[SerializeField] private GameObject IntegerP;
|
[SerializeField] private GameObject IntegerP;
|
||||||
[SerializeField] private GameObject FloatP;
|
[SerializeField] private GameObject FloatP;
|
||||||
|
[SerializeField] private GameObject BooleanP;
|
||||||
[SerializeField] private GameObject DropdownP;
|
[SerializeField] private GameObject DropdownP;
|
||||||
[SerializeField] private GameObject ColorP;
|
[SerializeField] private GameObject ColorP;
|
||||||
|
|
||||||
|
@ -106,6 +107,10 @@ namespace RhythmHeavenMania.Editor
|
||||||
{
|
{
|
||||||
prefab = FloatP;
|
prefab = FloatP;
|
||||||
}
|
}
|
||||||
|
else if(type is bool)
|
||||||
|
{
|
||||||
|
prefab = BooleanP;
|
||||||
|
}
|
||||||
else if (objType.IsEnum)
|
else if (objType.IsEnum)
|
||||||
{
|
{
|
||||||
prefab = DropdownP;
|
prefab = DropdownP;
|
||||||
|
|
|
@ -21,6 +21,10 @@ namespace RhythmHeavenMania.Editor
|
||||||
public Slider slider;
|
public Slider slider;
|
||||||
public TMP_InputField inputField;
|
public TMP_InputField inputField;
|
||||||
|
|
||||||
|
[Header("Boolean")]
|
||||||
|
[Space(10)]
|
||||||
|
public Toggle toggle;
|
||||||
|
|
||||||
[Header("Dropdown")]
|
[Header("Dropdown")]
|
||||||
[Space(10)]
|
[Space(10)]
|
||||||
public TMP_Dropdown dropdown;
|
public TMP_Dropdown dropdown;
|
||||||
|
@ -86,6 +90,15 @@ namespace RhythmHeavenMania.Editor
|
||||||
parameterManager.entity[propertyName] = slider.value;
|
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)
|
else if (objType.IsEnum)
|
||||||
{
|
{
|
||||||
List<TMP_Dropdown.OptionData> dropDownData = new List<TMP_Dropdown.OptionData>();
|
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("valB", new EntityTypes.Float(0, 1, 0), "End Opacity"),
|
||||||
new Param("ease", EasingFunction.Ease.Linear, "Ease")
|
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>()
|
new Minigame("countIn", "Count-Ins", "", false, true, new List<GameAction>()
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,38 +6,39 @@ namespace RhythmHeavenMania
|
||||||
{
|
{
|
||||||
public class PlayerInput
|
public class PlayerInput
|
||||||
{
|
{
|
||||||
|
|
||||||
public static bool Pressed(bool includeDPad = false)
|
public static bool Pressed(bool includeDPad = false)
|
||||||
{
|
{
|
||||||
bool keyDown = Input.GetKeyDown(KeyCode.Z) || (includeDPad && GetAnyDirectionDown());
|
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)
|
public static bool PressedUp(bool includeDPad = false)
|
||||||
{
|
{
|
||||||
bool keyUp = Input.GetKeyUp(KeyCode.Z) || (includeDPad && GetAnyDirectionUp());
|
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)
|
public static bool Pressing(bool includeDPad = false)
|
||||||
{
|
{
|
||||||
bool pressing = Input.GetKey(KeyCode.Z) || (includeDPad && GetAnyDirection());
|
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()
|
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()
|
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()
|
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()
|
public static bool GetAnyDirectionDown()
|
||||||
|
|
Loading…
Reference in a new issue