Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
svermeulen committed Feb 13, 2017
2 parents eb7dc4c + e8ad8e5 commit 4b33120
Show file tree
Hide file tree
Showing 706 changed files with 19,918 additions and 11,589 deletions.
17 changes: 9 additions & 8 deletions Build/CreateHtmlDocs.bat
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
@echo off

grip %~dp0\..\README.md --export .\UnityProject\Assets\Zenject\Documentation\README.html
grip %~dp0\..\Documentation\AutoMocking.md --export .\UnityProject\Assets\Zenject\Documentation\AutoMocking.html
grip %~dp0\..\Documentation\CheatSheet.md --export .\UnityProject\Assets\Zenject\Documentation\CheatSheet.html
grip %~dp0\..\Documentation\CommandsAndSignals.md --export .\UnityProject\Assets\Zenject\Documentation\CommandsAndSignals.html
grip %~dp0\..\Documentation\Factories.md --export .\UnityProject\Assets\Zenject\Documentation\Factories.html
grip %~dp0\..\Documentation\ReleaseNotes.md --export .\UnityProject\Assets\Zenject\Documentation\ReleaseNotes.html
grip %~dp0\..\Documentation\SubContainers.md --export .\UnityProject\Assets\Zenject\Documentation\SubContainers.html
grip %~dp0\..\Documentation\WritingAutomatedTests.md --export .\UnityProject\Assets\Zenject\Documentation\WritingAutomatedTests.html
grip %~dp0\..\README.md --export %~dp0\..\UnityProject\Assets\Zenject\Documentation\README.html
grip %~dp0\..\Documentation\AutoMocking.md --export %~dp0\..\UnityProject\Assets\Zenject\Documentation\AutoMocking.html
grip %~dp0\..\Documentation\CheatSheet.md --export %~dp0\..\UnityProject\Assets\Zenject\Documentation\CheatSheet.html
grip %~dp0\..\Documentation\Signals.md --export %~dp0\..\UnityProject\Assets\Zenject\Documentation\Signals.html
grip %~dp0\..\Documentation\Factories.md --export %~dp0\..\UnityProject\Assets\Zenject\Documentation\Factories.html
grip %~dp0\..\Documentation\MemoryPools.md --export %~dp0\..\UnityProject\Assets\Zenject\Documentation\MemoryPools.html
grip %~dp0\..\Documentation\ReleaseNotes.md --export %~dp0\..\UnityProject\Assets\Zenject\Documentation\ReleaseNotes.html
grip %~dp0\..\Documentation\SubContainers.md --export %~dp0\..\UnityProject\Assets\Zenject\Documentation\SubContainers.html
grip %~dp0\..\Documentation\WritingAutomatedTests.md --export %~dp0\..\UnityProject\Assets\Zenject\Documentation\WritingAutomatedTests.html
6 changes: 3 additions & 3 deletions Build/python/mtm/zen/CreateRelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def _createNonUnityZip(self, zipPath):

self._log.info('Copying Zenject dlls')
self._sys.copyFile('{0}/Zenject.dll'.format(binDir), '{0}/Zenject.dll'.format(tempDir))
self._sys.copyFile('{0}/Zenject.Commands.dll'.format(binDir), '{0}/Zenject.Commands.dll'.format(tempDir))
self._sys.copyFile('{0}/Zenject.Signals.dll'.format(binDir), '{0}/Zenject.Signals.dll'.format(tempDir))

self._zipHelper.createZipFile(tempDir, zipPath)

Expand Down Expand Up @@ -129,7 +129,7 @@ def _createCSharpPackage(self, includeSample, outputPath):
self._sys.removeFile('[ZenTempDir]/OptionalExtras/AutoMocking.meta')

self._sys.removeFile('[ZenTempDir]/Source/Zenject.csproj')
self._sys.removeFile('[ZenTempDir]/OptionalExtras/CommandsAndSignals/Zenject.Commands.csproj')
self._sys.removeFile('[ZenTempDir]/OptionalExtras/Signals/Zenject.Signals.csproj')

if not includeSample:
self._sys.deleteDirectory('[ZenTempDir]/OptionalExtras/SampleGame1 (Beginner)')
Expand All @@ -151,7 +151,7 @@ def installBindings():

config = {
'PathVars': {
'UnityExePath': 'C:/Utils/Unity/Unity5.4.1f1/Editor/Unity.exe',
'UnityExePath': 'C:/Utils/Unity/PrimaryLink/Editor/Unity.exe',
'LogPath': os.path.join(BuildDir, 'Log.txt'),
'MsBuildExePath': 'C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe'
},
Expand Down
52 changes: 24 additions & 28 deletions Documentation/CheatSheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,10 @@ For more examples, you may also be interested in reading some of the Unit tests
// Create a new instance of Foo for every class that asks for it
Container.Bind<Foo>().AsTransient();

// This is equivalent since AsTransient is the default
Container.Bind<Foo>();

// Create a new instance of Foo for every class that asks for an IFoo
Container.Bind<IFoo>().To<Foo>().AsTransient();

// This is equivalent since Transient is the default
Container.Bind<IFoo>().To<Foo>();

// Non generic versions
Container.Bind(typeof(IFoo)).AsTransient();
// Non generic version
Container.Bind(typeof(IFoo)).To(typeof(Foo)).AsTransient();

///////////// AsSingle
Expand All @@ -38,12 +31,15 @@ Container.Bind<IFoo2>().To<Foo>().AsSingle();

// Non generic versions
Container.Bind(typeof(Foo)).AsSingle();
Container.Bind(typeof(IFoo)).AsSingle(typeof(Foo));
Container.Bind(typeof(IFoo)).To(typeof(Foo)).AsSingle();

// Or, as one bind statement
Container.Bind(typeof(Foo), typeof(IFoo)).To(typeof(Foo)).AsSingle();

///////////// BindAllInterfaces
///////////// BindInterfaces
// Bind all interfaces that Foo implements to a new singleton of type Foo
Container.BindAllInterfaces<Foo>().To<Foo>().AsSingle();
Container.BindInterfacesTo<Foo>().AsSingle();

// So for example if Foo implements ITickable and IInitializable then the above
// line is equivalent to this:
Expand Down Expand Up @@ -127,29 +123,29 @@ Container.Bind<Bar>().FromResolveGetter<Foo>(foo => foo.GetBar());
// Another example using values
Container.Bind<string>().FromResolveGetter<Foo>(foo => foo.GetTitle());

///////////// FromGameObject (singleton)
///////////// FromNewComponentOnNewGameObject (singleton)
// Create a new game object at the root of the scene, add the Foo MonoBehaviour to it, and name it "Foo"
Container.Bind<Foo>().FromGameObject().AsSingle();
Container.Bind<Foo>().FromNewComponentOnNewGameObject().AsSingle();

// You can also specify the game object name to use using WithGameObjectName
Container.Bind<Foo>().FromGameObject().WithGameObjectName("Foo1").AsSingle();
Container.Bind<Foo>().FromNewComponentOnNewGameObject().WithGameObjectName("Foo1").AsSingle();

// Bind to an interface instead
Container.Bind<IFoo>().To<Foo>().FromGameObject().AsSingle();
Container.Bind<IFoo>().To<Foo>().FromNewComponentOnNewGameObject().AsSingle();

///////////// FromPrefab (singleton)
///////////// FromComponentInNewPrefab (singleton)
// Create a new game object at the root of the scene using the given prefab
// It is assumed that the Foo is a MonoBehaviour here and that Foo has been
// previously added to the prefab
// After zenject creates a new GameObject from the given prefab, it will
// search the prefab for a component of type 'Foo' and return that
GameObject fooPrefab;
Container.Bind<Foo>().FromPrefab(fooPrefab).AsSingle();
Container.Bind<Foo>().FromComponentInNewPrefab(fooPrefab).AsSingle();

// Bind to interface instead
Container.Bind<IFoo>().To<Foo>().FromPrefab(fooPrefab).AsSingle();
Container.Bind<IFoo>().To<Foo>().FromComponentInNewPrefab(fooPrefab).AsSingle();

// In this example we use AsSingle but with different components
// Note here that only one instance of the given prefab will be
Expand All @@ -158,21 +154,21 @@ Container.Bind<IFoo>().To<Foo>().FromPrefab(fooPrefab).AsSingle();
// For this to work, there must be both a Foo MonoBehaviour and
// a Bar MonoBehaviour somewhere on the prefab
GameObject prefab;
Container.Bind<Foo>().FromPrefab(prefab).AsSingle();
Container.Bind<Bar>().FromPrefab(prefab).AsSingle();
Container.Bind<Foo>().FromComponentInNewPrefab(prefab).AsSingle();
Container.Bind<Bar>().FromComponentInNewPrefab(prefab).AsSingle();

///////////// FromPrefab (Transient)
///////////// FromComponentInNewPrefab (Transient)
// Instantiate a new copy of 'fooPrefab' every time an instance of Foo is
// requested by a constructor parameter, injected field, etc.
GameObject fooPrefab = null;
Container.Bind<Foo>().FromPrefab(fooPrefab);
Container.Bind<Foo>().FromComponentInNewPrefab(fooPrefab);

// Again, this is equivalent since AsTransient is the default
Container.Bind<Foo>().FromPrefab(fooPrefab).AsTransient();
Container.Bind<Foo>().FromComponentInNewPrefab(fooPrefab).AsTransient();

// Bind to interface instead
Container.Bind<IFoo>().To<Foo>().FromPrefab(fooPrefab);
Container.Bind<IFoo>().To<Foo>().FromComponentInNewPrefab(fooPrefab);

///////////// Identifiers
Expand Down Expand Up @@ -290,15 +286,15 @@ Container.BindInstance(foo2).When(c => c.ParentContexts.Where(x => x.MemberType
// This will result in IBar, IFoo, and Foo, all being bound to the same instance of
// Foo which is assume to exist somewhere on the given prefab
GameObject fooPrefab;
Container.Bind<Foo>().FromPrefab(fooPrefab).AsSingle();
Container.Bind<Foo>().FromComponentInNewPrefab(fooPrefab).AsSingle();
Container.Bind<IBar>().To<Foo>().FromResolve();
Container.Bind<IFoo>().To<IBar>().FromResolve();

// This will result in the same behaviour as the above
GameObject fooPrefab = null;
Container.Bind<Foo>().FromPrefab(fooPrefab).AsSingle();
Container.Bind<IBar>().To<Foo>().FromPrefab(fooPrefab).AsSingle();
Container.Bind<IFoo>().To<Foo>().FromPrefab(fooPrefab).AsSingle();
Container.Bind<Foo>().FromComponentInNewPrefab(fooPrefab).AsSingle();
Container.Bind<IBar>().To<Foo>().FromComponentInNewPrefab(fooPrefab).AsSingle();
Container.Bind<IFoo>().To<Foo>().FromComponentInNewPrefab(fooPrefab).AsSingle();

///////////// Rebind
Expand Down
210 changes: 0 additions & 210 deletions Documentation/CommandsAndSignals.md

This file was deleted.

Loading

0 comments on commit 4b33120

Please sign in to comment.