Skip to content

Commit

Permalink
Revert "Merge pull request #4 from mackysoft/feature/generic-scenedata"
Browse files Browse the repository at this point in the history
This reverts commit 496db5d, reversing
changes made to cb3628f.
  • Loading branch information
mackysoft committed Oct 30, 2023
1 parent 7092ccd commit 99976bc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,9 @@ public interface ISceneIdentifier
ISceneHandle CreateHandle ();
}

public interface ISceneIdentifier<TSceneData> : ISceneIdentifier where TSceneData : ISceneData
{
}

public interface ISceneHandle
{
UniTask<Scene> Load (IProgress<float> progress = null, CancellationToken cancellationToken = default);
UniTask Unload (IProgress<float> progress = null, CancellationToken cancellationToken = default);
}

public static class SceneIdentifierExtensions
{
public static ISceneIdentifier<T> AsTyped<T> (this ISceneIdentifier identifier) where T : ISceneData
{
if (identifier == null)
{
throw new ArgumentNullException(nameof(identifier));
}
if (identifier is ISceneIdentifier<T> typedIdentifier)
{
return typedIdentifier;
}
return new TypedDataSceneIdentifier<T>(identifier);
}

sealed class TypedDataSceneIdentifier<T> : ISceneIdentifier<T> where T : ISceneData
{

readonly ISceneIdentifier m_Inner;

public TypedDataSceneIdentifier(ISceneIdentifier inner)
{
m_Inner = inner ?? throw new ArgumentNullException(nameof(inner));
}

public ISceneHandle CreateHandle() => m_Inner.CreateHandle();

}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@ public static UniTask Push (this ISceneNavigator navigator, ISceneIdentifier sce
return navigator.Push(new LoadSceneRequest(scene, transitionDirector, data, interruptOperation), cancellationToken);
}

public static UniTask Push<T> (this ISceneNavigator navigator, ISceneIdentifier<T> scene, ITransitionDirector transitionDirector = null, T data = default, IAsyncOperation interruptOperation = null, CancellationToken cancellationToken = default) where T : ISceneData
{
if (navigator == null)
{
throw new ArgumentNullException(nameof(navigator));
}
return navigator.Push(new LoadSceneRequest(scene, transitionDirector, data, interruptOperation), cancellationToken);
}

public static UniTask Pop (this ISceneNavigator navigator, ITransitionDirector transitionDirector = null, IAsyncOperation interruptOperation = null, CancellationToken cancellationToken = default)
{
if (navigator == null)
Expand All @@ -132,15 +123,6 @@ public static UniTask Change (this ISceneNavigator navigator, ISceneIdentifier s
return navigator.Change(new LoadSceneRequest(scene, transitionDirector, data, interruptOperation), cancellationToken);
}

public static UniTask Change<T> (this ISceneNavigator navigator, ISceneIdentifier<T> scene, ITransitionDirector transitionDirector = null, T data = default, IAsyncOperation interruptOperation = null, CancellationToken cancellationToken = default) where T : ISceneData
{
if (navigator == null)
{
throw new ArgumentNullException(nameof(navigator));
}
return navigator.Change(new LoadSceneRequest(scene, transitionDirector, data, interruptOperation), cancellationToken);
}

public static UniTask Replace (this ISceneNavigator navigator, ISceneIdentifier scene, ITransitionDirector transitionDirector = null, ISceneData data = null, IAsyncOperation interruptOperation = null, CancellationToken cancellationToken = default)
{
if (navigator == null)
Expand All @@ -150,15 +132,6 @@ public static UniTask Replace (this ISceneNavigator navigator, ISceneIdentifier
return navigator.Replace(new LoadSceneRequest(scene, transitionDirector, data, interruptOperation), cancellationToken);
}

public static UniTask Replace<T> (this ISceneNavigator navigator, ISceneIdentifier<T> scene, ITransitionDirector transitionDirector = null, T data = default, IAsyncOperation interruptOperation = null, CancellationToken cancellationToken = default) where T : ISceneData
{
if (navigator == null)
{
throw new ArgumentNullException(nameof(navigator));
}
return navigator.Replace(new LoadSceneRequest(scene, transitionDirector, data, interruptOperation), cancellationToken);
}

public static UniTask Reload (this ISceneNavigator navigator, ITransitionDirector transitionDirector = null, IAsyncOperation interruptOperation = null, CancellationToken cancellationToken = default)
{
if (navigator == null)
Expand Down

0 comments on commit 99976bc

Please sign in to comment.