Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/application and routing fixes #9

Merged
merged 2 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,18 @@ private void RemoveReceivers()

private void AssignListeners()
{
_playingState.OnEnterState += _playSignal.Emit;
_pausedState.OnEnterState += _pauseSignal.Emit;
if (_playSignal.NotNull())
_playingState.OnEnterState += _playSignal.Emit;
if (_pauseSignal.NotNull())
_pausedState.OnEnterState += _pauseSignal.Emit;
}

private void RemoveListeners()
{
_playingState.OnEnterState -= _playSignal.Emit;
_pausedState.OnEnterState -= _pauseSignal.Emit;
if (_playSignal.NotNull())
_playingState.OnEnterState -= _playSignal.Emit;
if (_pauseSignal.NotNull())
_pausedState.OnEnterState -= _pauseSignal.Emit;
}

private void Teardown()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace TirUtilities.UI.Buttons.Experimental
/// Author : Devon Wilson
/// Company: Black Phoenix Software
/// Created: Nov 02, 2021
/// Updated: Nov 16, 2021
/// Updated: Jan 09, 2022
/// -->
/// <summary>
/// Provides a quick way to route to various common actions.
Expand Down Expand Up @@ -80,7 +80,7 @@ private void RemoveLevelListeners()
{
if ((_routeType != RouteType.LevelSignal) || _targetLevel.IsNull()) return;

_button.onClick.AddListener(_targetLevel.Emit);
_button.onClick.RemoveListener(_targetLevel.Emit);
}

#endregion
Expand Down Expand Up @@ -152,10 +152,7 @@ private void RemoveMenuListeners()
#region Unity Messages

#if UNITY_EDITOR
private void OnValidate()
{
if (_button.IsNull()) TryGetComponent(out _button);
}
private void OnValidate() => TryGetComponent(out _button);
#endif
private void Awake()
{
Expand All @@ -170,6 +167,7 @@ private void OnEnable()
AssignLevelListeners();
AssignMenuListeners();
}

private void OnDisable()
{
if (_button.IsNull()) return;
Expand Down
4 changes: 4 additions & 0 deletions Documentation/manual/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Typos in <code>DrawColliderGizmo</code>.
- <code>DrawColliderGizmo</code> no longer throws a null ref when not given a collider.
- <code>MenuPageInspector</code> no longer fuses the path name and file name when creating a <code>MenuState</code> with the inspector button.
- Possible null refs in <code>ApplicationStateMachine</code> when not supplied with play or pause signals.
- <code>RouterButton</code> now correctly removes level load listeners instead of adding more... <sub>god damn typos</sub>.
- <code>RouterButton</code> now caches its button in <code>OnValidate</code> even if it is not null.
- This change fixes a bad reference that occurs when copy/pasting the component.

## [v0.0.0-alpha.10.4]

Expand Down