Skip to content

Commit

Permalink
Merge pull request #4 from kekchpek/develop
Browse files Browse the repository at this point in the history
Fix ability to specify same types for views; update test project
  • Loading branch information
kekchpek authored Feb 26, 2024
2 parents 693ade8 + c1e8476 commit cbd63f6
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions DemoUnityProj/CCG/Assets/Code/Core/CoreInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public override void InstallBindings()
() => Resources.Load<GameObject>("Prefabs/Views/LoadingPopup"));
Container.InstallView<CoolPopupView, ICoolPopupViewModel, CoolPopupViewModel>(ViewNames.CoolPopup,
() => Resources.Load<GameObject>("Prefabs/Views/CoolPopup/CoolPopup"));
Container.InstallView<CoolPopupView, ICoolPopupViewModel, CoolPopupViewModel>(ViewNames.SameCoolPopupButWithOtherName,
() => Resources.Load<GameObject>("Prefabs/Views/CoolPopup/CoolPopup"));
Container.InstallView<TimeCounterView, ITimeCounterViewModel, TimeCounterViewModel>();

Container.Install<ImageSystemInstaller>();
Expand Down
1 change: 1 addition & 0 deletions DemoUnityProj/CCG/Assets/Code/Core/ViewNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ public static class ViewNames
public static string HandController => "HandController";
public static string LoadingPopup => "LoadingPopup";
public static string CoolPopup => "CoolPopup";
public static string SameCoolPopupButWithOtherName => "CoolPopup2";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private void IntiGame()

public void OnPopupButtonClicked()
{
_viewManager.Open(ViewLayerIds.Popup, ViewNames.CoolPopup, new CoolPopupPayload(false))
_viewManager.Open(ViewLayerIds.Popup, ViewNames.SameCoolPopupButWithOtherName, new CoolPopupPayload(false))
.OnFail(Debug.LogException);
}

Expand Down
Binary file modified DemoUnityProj/CCG/Assets/Libs/UnityMVVM.dll
Binary file not shown.
Binary file modified DemoUnityProj/QuickStartUnityMVVM/Assets/Libs/UnityMVVM.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion src/UnityMVVM/DI/DiContainerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private static void InstallViewInternal<TView, TViewModel, TViewModelImpl>(DiCon
.Bind<IViewModelsFactory>()
.WithId(viewName)
.To<ViewModelsFactory<TView>>()
.AsSingle()
.AsTransient()
.WithArgumentsExplicit(new []
{
new TypeValuePair(typeof(Func<GameObject>), viewPrefabGetter),
Expand Down

0 comments on commit cbd63f6

Please sign in to comment.