fix doubled input responses in some menus

decimal marker weights
This commit is contained in:
minenice55 2024-01-21 20:10:45 -05:00
parent 029991656c
commit 607818e3be
6 changed files with 625 additions and 111 deletions

File diff suppressed because one or more lines are too long

View file

@ -12258,7 +12258,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 1504, y: -25} m_AnchoredPosition: {x: 1236, y: -25}
m_SizeDelta: {x: 360, y: 40} m_SizeDelta: {x: 360, y: 40}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &456251927 --- !u!114 &456251927
@ -16661,7 +16661,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -50.000015} m_AnchoredPosition: {x: 0, y: -50}
m_SizeDelta: {x: -48, y: -148} m_SizeDelta: {x: -48, y: -148}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &572765323 --- !u!114 &572765323
@ -26850,7 +26850,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1589389272} m_TargetGraphic: {fileID: 1589389272}
m_HandleRect: {fileID: 1589389271} m_HandleRect: {fileID: 1589389271}
m_Direction: 2 m_Direction: 2
m_Value: 1 m_Value: 0
m_Size: 1 m_Size: 1
m_NumberOfSteps: 0 m_NumberOfSteps: 0
m_OnValueChanged: m_OnValueChanged:
@ -27068,7 +27068,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 394, y: -20} m_AnchoredPosition: {x: 522, y: -20}
m_SizeDelta: {x: 48, y: 30} m_SizeDelta: {x: 48, y: 30}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &921145189 --- !u!114 &921145189
@ -32707,7 +32707,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 0, y: 146.61183} m_AnchoredPosition: {x: 0, y: 142.32655}
m_SizeDelta: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 1} m_Pivot: {x: 0.5, y: 1}
--- !u!222 &1154875945 --- !u!222 &1154875945
@ -37886,7 +37886,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 338, y: -20} m_AnchoredPosition: {x: 466, y: -20}
m_SizeDelta: {x: 64, y: 50} m_SizeDelta: {x: 64, y: 50}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1375296290 --- !u!114 &1375296290
@ -43131,8 +43131,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 178, y: -20} m_AnchoredPosition: {x: 242, y: -20}
m_SizeDelta: {x: 256, y: 20} m_SizeDelta: {x: 384, y: 20}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1594686153 --- !u!114 &1594686153
MonoBehaviour: MonoBehaviour:
@ -43455,8 +43455,8 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1220118245} m_TargetGraphic: {fileID: 1220118245}
m_HandleRect: {fileID: 1220118244} m_HandleRect: {fileID: 1220118244}
m_Direction: 2 m_Direction: 2
m_Value: 1.000001 m_Value: 1.0000008
m_Size: 0.81650156 m_Size: 0.78099126
m_NumberOfSteps: 0 m_NumberOfSteps: 0
m_OnValueChanged: m_OnValueChanged:
m_PersistentCalls: m_PersistentCalls:

View file

@ -121,7 +121,7 @@ namespace HeavenStudio
float[] categoryInputs; float[] categoryInputs;
double[] categoryScores; double[] categoryScores;
string msg0, msg1, msg2; string msg0, msg1, msg2;
float barTime = 0, barStartTime = float.MaxValue; float barTime = 0, barStartTime = float.MaxValue, didEpilogueTime = float.MaxValue;
Rank rank; Rank rank;
bool twoMessage = false, barStarted = false, didRank = false, didEpilogue = false, subRank = false; bool twoMessage = false, barStarted = false, didRank = false, didEpilogue = false, subRank = false;
@ -574,12 +574,13 @@ namespace HeavenStudio
audioSource.PlayOneShot(jglHi); audioSource.PlayOneShot(jglHi);
} }
didEpilogue = true; didEpilogue = true;
didEpilogueTime = Time.realtimeSinceStartup + 1.5f;
} }
else if (didEpilogue) else if (didEpilogue && Time.realtimeSinceStartup > didEpilogueTime)
{ {
audioSource.Stop(); audioSource.Stop();
RiqFileHandler.ClearCache();
GlobalGameManager.LoadScene("Title", 0.35f, 0.5f); GlobalGameManager.LoadScene("Title", 0.35f, 0.5f);
RiqFileHandler.ClearCache();
} }
else if (barStarted) else if (barStarted)
{ {

View file

@ -11,7 +11,7 @@ using TMPro;
public class SectionDialog : Dialog 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; SectionTimelineObj sectionObj;
[SerializeField] TMP_InputField sectionName; [SerializeField] TMP_InputField sectionName;
[SerializeField] Toggle challengeEnable; [SerializeField] Toggle challengeEnable;
@ -40,7 +40,7 @@ public class SectionDialog : Dialog
markerWeight.maxValue = MAX_WEIGHT; markerWeight.maxValue = MAX_WEIGHT;
markerWeight.minValue = MIN_WEIGHT; markerWeight.minValue = MIN_WEIGHT;
markerWeight.wholeNumbers = true; markerWeight.wholeNumbers = false;
if (!initHooks) if (!initHooks)
{ {
@ -68,7 +68,7 @@ public class SectionDialog : Dialog
markerWeight.maxValue = MAX_WEIGHT; markerWeight.maxValue = MAX_WEIGHT;
markerWeight.minValue = MIN_WEIGHT; markerWeight.minValue = MIN_WEIGHT;
markerWeight.wholeNumbers = true; markerWeight.wholeNumbers = false;
UpdateCatButtonState(); UpdateCatButtonState();
} }
@ -103,16 +103,23 @@ public class SectionDialog : Dialog
public void SetSectionWeight() public void SetSectionWeight()
{ {
if (sectionObj == null) return; if (sectionObj == null) return;
sectionObj.chartEntity["weight"] = markerWeight.value; sectionObj.chartEntity["weight"] = RoundNearest(markerWeight.value, WEIGHT_INTERVAL);
markerWeightManual.text = ((float) sectionObj.chartEntity["weight"]).ToString("G"); markerWeight.value = sectionObj.chartEntity["weight"];
markerWeightManual.text = ((float) sectionObj.chartEntity["weight"]).ToString("0.0");
} }
public void SetSectionWeightManual() public void SetSectionWeightManual()
{ {
if (sectionObj == null) return; 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"]; 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() void UpdateCatButtonState()

View file

@ -74,7 +74,7 @@ namespace HeavenStudio
private bool logoRevealed; 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 Animator menuAnim, selectedDisplayAnim;
private Selectable currentSelectable, mouseSelectable; private Selectable currentSelectable, mouseSelectable;
@ -241,9 +241,9 @@ namespace HeavenStudio
targetBopBeat += 1; targetBopBeat += 1;
} }
if (menuMode && !(exiting || GlobalGameManager.IsShowingDialog))
{
var controller = PlayerInput.GetInputController(1); var controller = PlayerInput.GetInputController(1);
if (menuMode && !(exiting || GlobalGameManager.IsShowingDialog || firstPress || waitingForButtonUp))
{
if (playMenuRevealed) if (playMenuRevealed)
{ {
if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch) if (PlayerInput.CurrentControlStyle != InputController.ControlStyles.Touch)
@ -282,11 +282,21 @@ namespace HeavenStudio
} }
} }
} }
else if (!firstPress) else
{ {
UpdateSelectable(controller); 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; if (firstPress) firstPress = false;
} }
@ -556,6 +566,8 @@ namespace HeavenStudio
campaignOption.sprite = campaignOff; campaignOption.sprite = campaignOff;
} }
firstPress = true;
waitingForButtonUp = true;
playPanel.SetActive(true); playPanel.SetActive(true);
playMenuRevealed = true; playMenuRevealed = true;
SoundByte.PlayOneShot("ui/UISelect"); SoundByte.PlayOneShot("ui/UISelect");
@ -572,6 +584,7 @@ namespace HeavenStudio
public void PlayPanelAccept() public void PlayPanelAccept()
{ {
if (waitingForButtonUp) return;
if (exiting) return; if (exiting) return;
exiting = true; exiting = true;
SoundByte.PlayOneShot("ui/UIEnter"); SoundByte.PlayOneShot("ui/UIEnter");

View file

@ -44,5 +44,7 @@ MonoBehaviour:
- Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs - Assets/Scripts/Games/BoardMeeting/BoardMeeting.cs
- Assets/Scripts/PersistentDataManager.cs - Assets/Scripts/PersistentDataManager.cs
- Assets/Scripts/UI/Overlays/OverlaysManager.cs - Assets/Scripts/UI/Overlays/OverlaysManager.cs
- Assets/Scripts/TitleManager.cs
- Assets/Scripts/LevelEditor/Timeline/SpecialTmeline/SectionDialog.cs
PathsToSkipImportEvent: [] PathsToSkipImportEvent: []
PathsToIgnoreOverwriteSettingOnAttribute: [] PathsToIgnoreOverwriteSettingOnAttribute: []