Skip to content

Commit

Permalink
Merge branch 'hotfix/0.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvtesh committed Mar 19, 2020
2 parents 1b2cd5e + d345d81 commit 06bface
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 4 deletions.
8 changes: 8 additions & 0 deletions Assets/Plugins/UnityFx.Mvc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/); this project adheres to [Semantic Versioning](http://semver.org/).

## [0.3.1] - 2020.03.19

### Added
- Added ability for `UGUIViewFactoryBuilder` to add multiple prefabs in a single call ([#13](https://github.com/Arvtesh/UnityFx.Mvc/issues/13)).

### Fixed
- Fixed coimpile error on Unity 2019.3+ ([#14](https://github.com/Arvtesh/UnityFx.Mvc/issues/14)).

## [0.3.0] - 2020.02.20

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ internal class PlayerLoopEventSource : IPresenterEventSource

#region IPresenterEventSource

public void SetPresenter(IPresenterEvents presenter)
public void AddPresenter(IPresenterEvents presenter)
{
var success = false;
var loop = PlayerLoop.GetCurrentPlayerLoop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace UnityFx.Mvc
{
/// <summary>
/// BUilder of UGUI-based <see cref="IViewFactory"/> instances.
/// Builder of UGUI-based <see cref="IViewFactory"/> instances.
/// </summary>
/// <seealso cref="PresenterBuilder"/>
/// <seealso href="https://en.wikipedia.org/wiki/Builder_pattern"/>
Expand Down Expand Up @@ -45,6 +45,8 @@ public UGUIViewFactoryBuilder(GameObject go)
/// <exception cref="ArgumentNullException">Thrown if either <paramref name="prefabPath"/> or <paramref name="prefabGo"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentException">Thrown is <paramref name="prefabPath"/> is invalid.</exception>
/// <seealso cref="AddLayer(Transform)"/>
/// <seealso cref="AddViewPrefabs(GameObject[])"/>
/// <seealso cref="AddViewPrefabs(string, GameObject[])"/>
/// <seealso cref="Build"/>
public UGUIViewFactoryBuilder AddViewPrefab(string prefabPath, GameObject prefabGo)
{
Expand Down Expand Up @@ -72,6 +74,76 @@ public UGUIViewFactoryBuilder AddViewPrefab(string prefabPath, GameObject prefab
return this;
}

/// <summary>
/// Adds preloaded view prefabs.
/// </summary>
/// <param name="prefabs">The preloaded prefabs.</param>
/// <exception cref="ArgumentNullException">Thrown if either <paramref name="prefabPath"/> or <paramref name="prefabGo"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentException">Thrown if any of the prefabs is <see langword="null"/>.</exception>
/// <seealso cref="AddLayer(Transform)"/>
/// <seealso cref="AddViewPrefab(string, GameObject)"/>
/// <seealso cref="AddViewPrefabs(string, GameObject[])"/>
/// <seealso cref="Build"/>
public UGUIViewFactoryBuilder AddViewPrefabs(params GameObject[] prefabs)
{
return AddViewPrefabs(null, prefabs);
}

/// <summary>
/// Adds preloaded view prefabs.
/// </summary>
/// <param name="pathPrefix">A prefix string to add to the prefab names.</param>
/// <param name="prefabs">The preloaded prefabs.</param>
/// <exception cref="ArgumentNullException">Thrown if either <paramref name="prefabPath"/> or <paramref name="prefabGo"/> is <see langword="null"/>.</exception>
/// <exception cref="ArgumentException">Thrown if any of the prefabs is <see langword="null"/>.</exception>
/// <seealso cref="AddLayer(Transform)"/>
/// <seealso cref="AddViewPrefab(string, GameObject)"/>
/// <seealso cref="AddViewPrefabs(GameObject[])"/>
/// <seealso cref="Build"/>
public UGUIViewFactoryBuilder AddViewPrefabs(string pathPrefix, params GameObject[] prefabs)
{
if (prefabs is null)
{
throw new ArgumentNullException(nameof(prefabs));
}

if (_viewPrefabs is null)
{
_viewPrefabs = new Dictionary<string, GameObject>();
}

if (string.IsNullOrEmpty(pathPrefix))
{
foreach (var go in prefabs)
{
if (go)
{
_viewPrefabs.Add(go.name, go);
}
else
{
throw new ArgumentException("Prefab is null.", nameof(prefabs));
}
}
}
else
{
foreach (var go in prefabs)
{
if (go)
{
_viewPrefabs.Add(pathPrefix + go.name, go);
}
else
{
throw new ArgumentException("Prefab is null.", nameof(prefabs));
}
}
}

return this;
}

/// <summary>
/// Adds a new view layer.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Assets/Plugins/UnityFx.Mvc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.unityfx.mvc",
"version": "0.3.0",
"version": "0.3.1",
"displayName": "MVC(S) framework for Unity.",
"description": "As outlined in [ASP.NET Core documentation](https://docs.microsoft.com/en-us/aspnet/core/mvc/overview), the Model-View-Controller (MVC) architectural pattern separates an application into three main groups of components: Models, Views, and Controllers. This pattern helps to achieve separation of concerns. Using this pattern, user requests are routed to a Controller which is responsible for working with the Model to perform user actions and/or retrieve results of queries. The Controller chooses the View to display to the user, and provides it with any Model data it requires.

Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/); this project adheres to [Semantic Versioning](http://semver.org/).

## [0.3.1] - 2020.03.19

### Added
- Added ability for `UGUIViewFactoryBuilder` to add multiple prefabs in a single call ([#13](https://github.com/Arvtesh/UnityFx.Mvc/issues/13)).

### Fixed
- Fixed coimpile error on Unity 2019.3+ ([#14](https://github.com/Arvtesh/UnityFx.Mvc/issues/14)).

## [0.3.0] - 2020.02.20

### Added
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Npm package is available at [npmjs.com](https://www.npmjs.com/package/com.unityf
}
],
"dependencies": {
"com.unityfx.mvc": "0.3.0"
"com.unityfx.mvc": "0.3.1"
}
}
```
Expand Down

0 comments on commit 06bface

Please sign in to comment.