Skip to content

Commit

Permalink
Fix - If you spam too fast the below buttons, you can sometimes enter…
Browse files Browse the repository at this point in the history
… the card list with no buttons below.#188
  • Loading branch information
CatmanIta committed Mar 31, 2023
1 parent 83bf8d5 commit 423334e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
18 changes: 18 additions & 0 deletions Assets/_scripts/UI/UIBottomScreen.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using Lean.Gui;
using UnityEngine;

namespace Ieedo
{
Expand All @@ -13,21 +14,38 @@ public class UIBottomScreen : UIScreen

public Action OnCardsClicked;

private float cooldown = 0f;
private bool onCooldown => cooldown > 0f;
private void StartCooldown()
{
cooldown = 0.35f;
}
private void Update()
{
if (cooldown > 0f) cooldown -= Time.deltaTime;
}

void Start()
{
SetupButton(btnActivities, () =>
{
if (Statics.Input.IsExecutingAction) return;
if (onCooldown) return;
StartCooldown();
Statics.Screens.GoTo(ScreenID.Activities);
});
SetupButton(btnPillars, () =>
{
if (Statics.Input.IsExecutingAction) return;
if (onCooldown) return;
StartCooldown();
Statics.Screens.GoTo(ScreenID.Pillars);
});
SetupButton(btnCards, () =>
{
if (Statics.Input.IsExecutingAction) return;
if (onCooldown) return;
StartCooldown();
OnCardsClicked?.Invoke();
Statics.Screens.GoToTodoList();
});
Expand Down
1 change: 0 additions & 1 deletion Assets/_scripts/UI/UIButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public void SetTextColor(Color c)

public void AnimateAppear()
{
//transform.localScale = Vector3.zero;
transform.localScaleTransition(Vector3.one, 0.25f);
}

Expand Down
9 changes: 8 additions & 1 deletion Assets/_scripts/UI/UIPillarsScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,14 @@ public PillarsData RegenerateData()

public void RefreshData()
{
SwitchViewButton.transform.localScaleTransition(Statics.Mode.SessionMode == SessionMode.Session ? Vector3.one : Vector3.zero, 0.5f);
if (Statics.Mode.SessionMode == SessionMode.Session)
{
SwitchViewButton.AnimateAppear();
}
else
{
SwitchViewButton.AnimateDisappear();
}

PillarsManager.SetFocus();
AnimateToUnfocused();
Expand Down

0 comments on commit 423334e

Please sign in to comment.