Skip to content

Commit

Permalink
Allow to set AssetLoader for each Container.
Browse files Browse the repository at this point in the history
  • Loading branch information
Haruma-K committed Jun 14, 2022
1 parent 1b22017 commit f7e5dcf
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
14 changes: 12 additions & 2 deletions Assets/UnityScreenNavigator/Runtime/Core/Modal/ModalContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,17 @@ private readonly Dictionary<int, AssetLoadHandle<GameObject>> _assetLoadHandles
private ModalBackdrop _backdropPrefab;
private CanvasGroup _canvasGroup;

private IAssetLoader AssetLoader => UnityScreenNavigatorSettings.Instance.AssetLoader;
private IAssetLoader _assetLoader;

/// <summary>
/// By default, <see cref="IAssetLoader" /> in <see cref="UnityScreenNavigatorSettings" /> is used.
/// If this property is set, it is used instead.
/// </summary>
public IAssetLoader AssetLoader
{
get => _assetLoader ?? UnityScreenNavigatorSettings.Instance.AssetLoader;
set => _assetLoader = value;
}

/// <summary>
/// True if in transition.
Expand Down Expand Up @@ -455,4 +465,4 @@ public void ReleasePreloaded(string resourceKey)
AssetLoader.Release(handle);
}
}
}
}
14 changes: 12 additions & 2 deletions Assets/UnityScreenNavigator/Runtime/Core/Page/PageContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,17 @@ private readonly Dictionary<int, AssetLoadHandle<GameObject>> _assetLoadHandles

private bool _isActivePageStacked;

private IAssetLoader AssetLoader => UnityScreenNavigatorSettings.Instance.AssetLoader;
private IAssetLoader _assetLoader;

/// <summary>
/// By default, <see cref="IAssetLoader" /> in <see cref="UnityScreenNavigatorSettings" /> is used.
/// If this property is set, it is used instead.
/// </summary>
public IAssetLoader AssetLoader
{
get => _assetLoader ?? UnityScreenNavigatorSettings.Instance.AssetLoader;
set => _assetLoader = value;
}

/// <summary>
/// True if in transition.
Expand Down Expand Up @@ -465,4 +475,4 @@ public void ReleasePreloaded(string resourceKey)
AssetLoader.Release(handle);
}
}
}
}
14 changes: 12 additions & 2 deletions Assets/UnityScreenNavigator/Runtime/Core/Sheet/SheetContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,17 @@ private readonly Dictionary<int, AssetLoadHandle<GameObject>> _assetLoadHandles
private int? _activeSheetId;
private CanvasGroup _canvasGroup;

private IAssetLoader AssetLoader => UnityScreenNavigatorSettings.Instance.AssetLoader;
private IAssetLoader _assetLoader;

/// <summary>
/// By default, <see cref="IAssetLoader" /> in <see cref="UnityScreenNavigatorSettings" /> is used.
/// If this property is set, it is used instead.
/// </summary>
public IAssetLoader AssetLoader
{
get => _assetLoader ?? UnityScreenNavigatorSettings.Instance.AssetLoader;
set => _assetLoader = value;
}

public int? ActiveSheetId => _activeSheetId;

Expand Down Expand Up @@ -394,4 +404,4 @@ private IEnumerator HideRoutine(bool playAnimation)
}
}
}
}
}

0 comments on commit f7e5dcf

Please sign in to comment.