Skip to content

Commit

Permalink
Adjust loading scripts to use different events
Browse files Browse the repository at this point in the history
  • Loading branch information
Edvinas01 committed Oct 3, 2023
1 parent 3d32685 commit eed2f20
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@ internal sealed class LoadingCanvasController : MonoBehaviour
private void OnEnable()
{
var collectionEvents = sceneController.CollectionEvents;
collectionEvents.OnLoadEntered += OnLoadEntered;
collectionEvents.OnShowTransitionEntered += OnShowTransitionEntered;
collectionEvents.OnLoadProgress += OnLoadProgress;
}

private void OnDisable()
{
var collectionEvents = sceneController.CollectionEvents;
collectionEvents.OnLoadEntered -= OnLoadEntered;
collectionEvents.OnShowTransitionEntered -= OnShowTransitionEntered;
collectionEvents.OnLoadProgress -= OnLoadProgress;
}

private void OnLoadEntered(CollectionLoadEventArgs args)
private void OnShowTransitionEntered()
{
loadingStateText.text = "";
loadingStateText.text = "Loading...";
loadingPercentageText.text = "0%";
}

private void OnLoadProgress(CollectionLoadProgressEventArgs args)
{
var collectionName = args.Collection.Name;
var percentage = (int) (args.CollectionLoadProgress * 100);
var percentage = (int)(args.CollectionLoadProgress * 100);

loadingStateText.text = $"Loading \"{collectionName}\"...";
loadingPercentageText.text = $"{percentage}%";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,27 @@ internal sealed class LoadingCanvasController : MonoBehaviour
private void OnEnable()
{
var collectionEvents = sceneController.CollectionEvents;
collectionEvents.OnLoadEntered += OnLoadEntered;
collectionEvents.OnShowTransitionEntered += OnShowTransitionEntered;
collectionEvents.OnLoadProgress += OnLoadProgress;
}

private void OnDisable()
{
var collectionEvents = sceneController.CollectionEvents;
collectionEvents.OnLoadEntered -= OnLoadEntered;
collectionEvents.OnShowTransitionEntered -= OnShowTransitionEntered;
collectionEvents.OnLoadProgress -= OnLoadProgress;
}

private void OnLoadEntered(CollectionLoadEventArgs args)
private void OnShowTransitionEntered()
{
loadingStateText.text = "";
loadingStateText.text = "Loading...";
loadingPercentageText.text = "0%";
}

private void OnLoadProgress(CollectionLoadProgressEventArgs args)
{
var collectionName = args.Collection.Name;
var percentage = (int) (args.CollectionLoadProgress * 100);
var percentage = (int)(args.CollectionLoadProgress * 100);

loadingStateText.text = $"Loading \"{collectionName}\"...";
loadingPercentageText.text = $"{percentage}%";
Expand Down

0 comments on commit eed2f20

Please sign in to comment.