mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 12:07:41 +02:00
fix doubled input responses in some menus
decimal marker weights
This commit is contained in:
@ -121,7 +121,7 @@ namespace HeavenStudio
|
||||
float[] categoryInputs;
|
||||
double[] categoryScores;
|
||||
string msg0, msg1, msg2;
|
||||
float barTime = 0, barStartTime = float.MaxValue;
|
||||
float barTime = 0, barStartTime = float.MaxValue, didEpilogueTime = float.MaxValue;
|
||||
Rank rank;
|
||||
bool twoMessage = false, barStarted = false, didRank = false, didEpilogue = false, subRank = false;
|
||||
|
||||
@ -574,12 +574,13 @@ namespace HeavenStudio
|
||||
audioSource.PlayOneShot(jglHi);
|
||||
}
|
||||
didEpilogue = true;
|
||||
didEpilogueTime = Time.realtimeSinceStartup + 1.5f;
|
||||
}
|
||||
else if (didEpilogue)
|
||||
else if (didEpilogue && Time.realtimeSinceStartup > didEpilogueTime)
|
||||
{
|
||||
audioSource.Stop();
|
||||
RiqFileHandler.ClearCache();
|
||||
GlobalGameManager.LoadScene("Title", 0.35f, 0.5f);
|
||||
RiqFileHandler.ClearCache();
|
||||
}
|
||||
else if (barStarted)
|
||||
{
|
||||
|
@ -11,7 +11,7 @@ using TMPro;
|
||||
|
||||
public class SectionDialog : Dialog
|
||||
{
|
||||
const float MIN_WEIGHT = 0, MAX_WEIGHT = 10;
|
||||
const float MIN_WEIGHT = 0, MAX_WEIGHT = 10, WEIGHT_INTERVAL = 0.1f;
|
||||
SectionTimelineObj sectionObj;
|
||||
[SerializeField] TMP_InputField sectionName;
|
||||
[SerializeField] Toggle challengeEnable;
|
||||
@ -40,7 +40,7 @@ public class SectionDialog : Dialog
|
||||
|
||||
markerWeight.maxValue = MAX_WEIGHT;
|
||||
markerWeight.minValue = MIN_WEIGHT;
|
||||
markerWeight.wholeNumbers = true;
|
||||
markerWeight.wholeNumbers = false;
|
||||
|
||||
if (!initHooks)
|
||||
{
|
||||
@ -68,7 +68,7 @@ public class SectionDialog : Dialog
|
||||
|
||||
markerWeight.maxValue = MAX_WEIGHT;
|
||||
markerWeight.minValue = MIN_WEIGHT;
|
||||
markerWeight.wholeNumbers = true;
|
||||
markerWeight.wholeNumbers = false;
|
||||
|
||||
UpdateCatButtonState();
|
||||
}
|
||||
@ -103,16 +103,23 @@ public class SectionDialog : Dialog
|
||||
public void SetSectionWeight()
|
||||
{
|
||||
if (sectionObj == null) return;
|
||||
sectionObj.chartEntity["weight"] = markerWeight.value;
|
||||
markerWeightManual.text = ((float) sectionObj.chartEntity["weight"]).ToString("G");
|
||||
sectionObj.chartEntity["weight"] = RoundNearest(markerWeight.value, WEIGHT_INTERVAL);
|
||||
markerWeight.value = sectionObj.chartEntity["weight"];
|
||||
markerWeightManual.text = ((float) sectionObj.chartEntity["weight"]).ToString("0.0");
|
||||
}
|
||||
|
||||
public void SetSectionWeightManual()
|
||||
{
|
||||
if (sectionObj == null) return;
|
||||
sectionObj.chartEntity["weight"] = Mathf.Round((float)Math.Clamp(Convert.ToSingle(markerWeightManual.text), MIN_WEIGHT, MAX_WEIGHT));
|
||||
sectionObj.chartEntity["weight"] = RoundNearest((float)Math.Clamp(Convert.ToSingle(markerWeightManual.text), MIN_WEIGHT, MAX_WEIGHT), WEIGHT_INTERVAL);
|
||||
markerWeight.value = sectionObj.chartEntity["weight"];
|
||||
markerWeightManual.text = ((float) sectionObj.chartEntity["weight"]).ToString("G");
|
||||
markerWeightManual.text = ((float) sectionObj.chartEntity["weight"]).ToString("0.0");
|
||||
}
|
||||
|
||||
float RoundNearest(float a, float interval)
|
||||
{
|
||||
int root = Mathf.RoundToInt(a / interval);
|
||||
return root * interval;
|
||||
}
|
||||
|
||||
void UpdateCatButtonState()
|
||||
|
@ -74,7 +74,7 @@ namespace HeavenStudio
|
||||
|
||||
private bool logoRevealed;
|
||||
|
||||
private bool menuMode, snsRevealed, playMenuRevealed, exiting, firstPress, usingMouse;
|
||||
private bool menuMode, snsRevealed, playMenuRevealed, exiting, firstPress, usingMouse, waitingForButtonUp;
|
||||
|
||||
private Animator menuAnim, selectedDisplayAnim;
|
||||
private Selectable currentSelectable, mouseSelectable;
|
||||
@ -241,9 +241,9 @@ namespace HeavenStudio
|
||||
targetBopBeat += 1;
|
||||
}
|
||||
|
||||
if (menuMode && !(exiting || GlobalGameManager.IsShowingDialog))
|
||||
var controller = PlayerInput.GetInputController(1);
|
||||
if (menuMode && !(exiting || GlobalGameManager.IsShowingDialog || firstPress || waitingForButtonUp))
|
||||
{
|
||||
var controller = PlayerInput.GetInputController(1);
|
||||
if (playMenuRevealed)
|
||||
{
|
||||
if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch)
|
||||
@ -282,11 +282,21 @@ namespace HeavenStudio
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!firstPress)
|
||||
else
|
||||
{
|
||||
UpdateSelectable(controller);
|
||||
}
|
||||
}
|
||||
if (waitingForButtonUp)
|
||||
{
|
||||
if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch)
|
||||
{
|
||||
if (controller.GetActionUp(PlayerInput.CurrentControlStyle, (int)InputController.ActionsPad.East, out _))
|
||||
{
|
||||
waitingForButtonUp = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (firstPress) firstPress = false;
|
||||
}
|
||||
|
||||
@ -556,6 +566,8 @@ namespace HeavenStudio
|
||||
campaignOption.sprite = campaignOff;
|
||||
}
|
||||
|
||||
firstPress = true;
|
||||
waitingForButtonUp = true;
|
||||
playPanel.SetActive(true);
|
||||
playMenuRevealed = true;
|
||||
SoundByte.PlayOneShot("ui/UISelect");
|
||||
@ -572,6 +584,7 @@ namespace HeavenStudio
|
||||
|
||||
public void PlayPanelAccept()
|
||||
{
|
||||
if (waitingForButtonUp) return;
|
||||
if (exiting) return;
|
||||
exiting = true;
|
||||
SoundByte.PlayOneShot("ui/UIEnter");
|
||||
|
Reference in New Issue
Block a user