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 8ab0659073
commit a1e18d4f67
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_AnchorMin: {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_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &456251927
@ -16661,7 +16661,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
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_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &572765323
@ -26850,7 +26850,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1589389272}
m_HandleRect: {fileID: 1589389271}
m_Direction: 2
m_Value: 1
m_Value: 0
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
@ -27068,7 +27068,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {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_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &921145189
@ -32707,7 +32707,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, 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_Pivot: {x: 0.5, y: 1}
--- !u!222 &1154875945
@ -37886,7 +37886,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {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_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1375296290
@ -43131,8 +43131,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 178, y: -20}
m_SizeDelta: {x: 256, y: 20}
m_AnchoredPosition: {x: 242, y: -20}
m_SizeDelta: {x: 384, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1594686153
MonoBehaviour:
@ -43455,8 +43455,8 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1220118245}
m_HandleRect: {fileID: 1220118244}
m_Direction: 2
m_Value: 1.000001
m_Size: 0.81650156
m_Value: 1.0000008
m_Size: 0.78099126
m_NumberOfSteps: 0
m_OnValueChanged:
m_PersistentCalls:

View file

@ -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)
{

View file

@ -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()

View file

@ -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");

View file

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