-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
Runtime/Ui/ViewStack/Instructions/SetInteractableInstruction.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using Juce.Core.Repositories; | ||
using Juce.Core.Sequencing; | ||
using Juce.CoreUnity.Ui.Frame; | ||
using Juce.CoreUnity.ViewStack.Entries; | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace Playground.Services.ViewStack.Instructions | ||
{ | ||
public class SetInteractableInstruction : InstantInstruction | ||
{ | ||
private readonly IUiFrame frame; | ||
private readonly IKeyValueRepository<Type, IViewStackEntry> entriesRepository; | ||
private readonly Type entryId; | ||
private readonly bool interactable; | ||
|
||
public SetInteractableInstruction( | ||
IUiFrame frame, | ||
IKeyValueRepository<Type, IViewStackEntry> entriesRepository, | ||
Type entryId, | ||
bool interactable | ||
) | ||
{ | ||
this.frame = frame; | ||
this.entriesRepository = entriesRepository; | ||
this.entryId = entryId; | ||
this.interactable = interactable; | ||
} | ||
|
||
protected override void OnInstantExecute() | ||
{ | ||
bool found = entriesRepository.TryGet(entryId, out IViewStackEntry entry); | ||
|
||
if (!found) | ||
{ | ||
UnityEngine.Debug.LogError($"Tried to Show {nameof(IViewStackEntry)} of type {entryId}, " + | ||
$"but it was not registered, at {nameof(SetInteractableInstruction)}"); | ||
|
||
return; | ||
} | ||
|
||
ViewStackEntryUtils.SetInteractable(entry, interactable); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Runtime/Ui/ViewStack/Instructions/SetInteractableInstruction.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters