-
Notifications
You must be signed in to change notification settings - Fork 1
Release 0.13.2 #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release 0.13.2 #23
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,14 @@ All notable changes to this package will be documented in this file. | |
| The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) | ||
| and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). | ||
|
|
||
| ## [0.13.2] - 2024-11-13 | ||
|
|
||
| **New**: | ||
| - Added a constructor to *GameObjectPool* that allows to setup a costum instantiator | ||
|
|
||
| **Fixed**: | ||
| - Fixed *ObjectPool* & *PoolService* tests that would block builds sometimes | ||
|
|
||
| ## [0.13.1] - 2024-11-04 | ||
|
|
||
| **Fixed**: | ||
|
Comment on lines
4
to
17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
@@ -27,47 +35,53 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. | |
|
|
||
| ## [0.12.0] - 2024-10-22 | ||
|
|
||
| - Added IRngData to PoolService to suppprt read only data structure and allow abtract injection of data into other objects | ||
| **New**: | ||
| - Added *IRngData* to *PoolService* to suppprt read only data structure and allow abtract injection of data into other objects | ||
|
|
||
| **Changed**: | ||
| - Changed RngData to a class in orther to avoid boxing/unboxing performance when injecting IRngData. | ||
| - Changed *RngData* to a class in orther to avoid boxing/unboxing performance when injecting *IRngData*. | ||
|
|
||
| ## [0.11.0] - 2024-10-19 | ||
|
|
||
| - Added Spawn<T>(T data) method to PoolService to allow spawning new objects with defined spawning data | ||
| - Added GetPool<T>() && TryGetPool<T>() methods to PoolService to allow requesting the pool object maintained by the pool service. | ||
| **New**: | ||
| - Added *Spawn<T>(T data)* method to *PoolService* to allow spawning new objects with defined spawning data | ||
| - Added *GetPool<T>()* && *TryGetPool<T>()* methods to *PoolService* to allow requesting the pool object maintained by the pool service. | ||
|
|
||
| **Changed**: | ||
| - Removed IsSpawned<T>() method from PoolService because is not a fundamental function and can now be accessed from the Pool requested from GetPool() | ||
| - Now Spawn<T>(T data) also invokes OnSpawn() without data so objects that implement IPoolEntitySpawn have the entire behaviour lifecycle | ||
| - Removed *IsSpawned<T>()* method from *PoolService* because is not a fundamental function and can now be accessed from the Pool requested from *GetPool()* | ||
| - Now *Spawn<T>(T data)* also invokes *OnSpawn()* without data so objects that implement *IPoolEntitySpawn* have the entire behaviour lifecycle | ||
|
|
||
| ## [0.10.0] - 2024-10-11 | ||
|
Comment on lines
+38
to
54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changelog entries for versions 0.7.0, 0.6.2, 0.6.1, 0.6.0, 0.4.1, 0.4.0, 0.3.1, 0.3.0, 0.2.0, 0.1.1, and 0.1.0 are correct. Overall, the changelog updates seem to accurately reflect the changes made in each version.
|
||
|
|
||
| - Updated CommandService to allow non struct type commands to be executed for reference type commands | ||
| - Added Spawn<T>(T data) method to pool object to allow spawning new objects with defined spawning data | ||
| **New**: | ||
| - Updated *CommandService* to allow non struct type commands to be executed for reference type commands | ||
| - Added *Spawn<T>(T data)* method to pool object to allow spawning new objects with defined spawning data | ||
|
|
||
| ## [0.9.0] - 2024-08-10 | ||
|
|
||
| **New**: | ||
| - Updated interfaces and classes related to data services, enhancing modularity and improving version handling. | ||
| - Added classes for Git commands, version management, and random number generation. | ||
|
|
||
| **Changed**: | ||
| - Restructured the data service interfaces, consolidating functionality into a single IDataService interface and removing unnecessary interfaces. | ||
| - Changed AddData to AddOrReplaceData in the DataService implementation. | ||
| - Removed the isLocal state from data handling. | ||
| - Restructured the data service interfaces, consolidating functionality into a single *IDataService* interface and removing unnecessary interfaces. | ||
| - Changed *AddData* to *AddOrReplaceData* in the *DataService* implementation. | ||
| - Removed the *isLocal* state from data handling. | ||
|
|
||
| ## [0.8.1] - 2023-08-27 | ||
|
|
||
| **New**: | ||
| - Added GitEditorProcess class to run Git commands as processes, enabling checks for valid Git repositories, retrieving current branch names, commit hashes, and diffs from given commits. | ||
| - Introduced VersionEditorUtils class for managing application versioning. This includes setting and saving the internal version before building, loading version data from disk, and generating an internal version suffix based on Git information and build settings. | ||
| - Introduced *VersionEditorUtils* class for managing application versioning. This includes setting and saving the internal version before building, loading version data from disk, and generating an internal version suffix based on Git information and build settings. | ||
|
|
||
| **Changed**: | ||
| - Enhanced IInstaller interface with new methods for binding multiple type interfaces to a single instance, improving modularity and code organization. | ||
| - Enhanced *IInstaller* interface with new methods for binding multiple type interfaces to a single instance, improving modularity and code organization. | ||
|
|
||
| ## [0.8.0] - 2023-08-05 | ||
|
|
||
| - Introduced MainInstaller, a singleton class for managing instances in the project. | ||
| - Added RngService for generating and managing random numbers. | ||
| **New**: | ||
| - Introduced *MainInstaller*, a singleton class for managing instances in the project. | ||
| - Added *RngService* for generating and managing random numbers. | ||
| - Implemented VersionServices to manage application version, including asynchronous loading of version data and comparison of version strings. | ||
|
|
||
| ## [0.7.1] - 2023-07-28 | ||
|
|
@@ -81,29 +95,33 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. | |
|
|
||
| ## [0.7.0] - 2023-07-28 | ||
|
|
||
| **New**: | ||
| - Introduced a code review process using GitHub Actions workflow. | ||
| - Added IInstaller interface and Installer implementation for binding and resolving instances. | ||
| - Added *IInstaller* interface and Installer implementation for binding and resolving instances. | ||
| - Updated namespaces, removed unused code, and modified method calls in test classes. | ||
|
|
||
| **Changed**: | ||
| - Removed dependency on ICommandNetworkService and SendCommand method in CommandService. | ||
| - Updated IDataService interface and DataService class to handle local and online data saving. | ||
| - Improved readability of MessageBrokerService class by using var for type inference. | ||
| - Removed dependency on *ICommandNetworkService *and SendCommand method in *CommandService*. | ||
| - Updated *IDataService* interface and *DataService* class to handle local and online data saving. | ||
| - Improved readability of *MessageBrokerService* class by using var for type inference. | ||
| - Removed unused network service related interfaces, classes, and methods. | ||
| - Modified calculation of overFlow in TickService to check for zero DeltaTime. | ||
|
|
||
| ## [0.6.2] - 2020-09-10 | ||
|
|
||
| **Changed**: | ||
| - Made *NetworkService* abstract and removed *INetworkService* to make easier to work with | ||
| - Improved Readme documentation | ||
|
|
||
| ## [0.6.1] - 2020-09-09 | ||
|
|
||
| **New**: | ||
| - Added connection between *NetworkService* & *CommandService* | ||
| - Added integration tests | ||
|
|
||
| ## [0.6.0] - 2020-09-09 | ||
|
|
||
| **New**: | ||
| - Added *NetworkService* | ||
| - Improved Readme documentation | ||
|
|
||
|
|
@@ -115,10 +133,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. | |
|
|
||
| ## [0.4.1] - 2020-07-09 | ||
|
|
||
| **New**: | ||
| - Added *CommandService* | ||
|
|
||
| ## [0.4.0] - 2020-07-09 | ||
|
|
||
| **New**: | ||
| - Added *DataService* | ||
|
|
||
| ## [0.3.1] - 2020-02-25 | ||
|
|
@@ -129,14 +149,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. | |
|
|
||
| ## [0.3.0] - 2020-02-09 | ||
|
|
||
| **Changed**: | ||
| - Now the *MainInstaller* checks the object binding relationship in compile time | ||
| - The *CoroutineService* no longer fails on null coroutines | ||
| - Improved the *ObjectPools* helper classes with a now static global instatiator for game objects. | ||
|
|
||
| **Changed**: | ||
| - Now the *PoolService* is only a service container for objects pools and no longer creates/initializes new pools. | ||
| - Removed *Pool.Clear* functionality. Use *DespawnAll* or delete the pool instead | ||
|
|
||
| **Fixed**: | ||
| - The *CoroutineService* no longer fails on null coroutines | ||
|
|
||
| ## [0.2.0] - 2020-01-19 | ||
|
|
||
| - Added new *ObjectPool* & *GameObjectPool* pools to allow to allow to use object pools independent from the *PoolService*. This allows to have different pools of the same type in the project in different object controllers | ||
|
|
@@ -148,6 +169,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. | |
|
|
||
| ## [0.1.1] - 2020-01-06 | ||
|
|
||
| **New**: | ||
| - Added License | ||
|
|
||
| ## [0.1.0] - 2020-01-06 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,7 +44,7 @@ public interface IPoolEntityDespawn | |
| } | ||
|
|
||
| /// <summary> | ||
| /// This interface allows to self despawn by maintaining the reference of the pool that created it | ||
| /// This interface allows to self despawn by maintaining the reference of the despawing call | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment mentions "despawing call" instead of "pool that created it". Please update the comment to reflect the correct functionality. - /// This interface allows to self despawn by maintaining the reference of the despawing call
+ /// This interface allows to self despawn by maintaining the reference of the pool that created it |
||
| /// </summary> | ||
| /// <remarks> | ||
| /// Implemenation of this class: | ||
|
|
@@ -182,29 +182,6 @@ public bool IsSpawned(Func<T, bool> conditionCheck) | |
| return false; | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public bool Despawn(bool onlyFirst, Func<T, bool> entityGetter) | ||
| { | ||
| var despawned = false; | ||
|
|
||
| for (var i = 0; i < SpawnedEntities.Count; i++) | ||
| { | ||
| if (!entityGetter(SpawnedEntities[i])) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
| despawned = Despawn(SpawnedEntities[i]); | ||
|
|
||
| if (onlyFirst) | ||
| { | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| return despawned; | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public List<T> Clear() | ||
| { | ||
|
Comment on lines
182
to
187
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The code has been simplified and refactored. It seems that the - public bool Despawn(bool onlyFirst, Func<T, bool> entityGetter)
- {
- var despawned = false;
-
- for (var i = 0; i < SpawnedEntities.Count; i++)
- {
- if (!entityGetter(SpawnedEntities[i]))
- {
- continue;
- }
-
- despawned = Despawn(SpawnedEntities[i]);
-
- if (onlyFirst)
- {
- break;
- }
- }
-
- return despawned;
- }
+ /// <inheritdoc />
+ public List<T> Clear()
+ {
+ // implementation
+ } |
||
|
|
@@ -262,6 +239,29 @@ public bool Despawn(T entity) | |
| return true; | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public bool Despawn(bool onlyFirst, Func<T, bool> entityGetter) | ||
| { | ||
| var despawned = false; | ||
|
|
||
| for (var i = 0; i < SpawnedEntities.Count; i++) | ||
| { | ||
| if (!entityGetter(SpawnedEntities[i])) | ||
| { | ||
| continue; | ||
| } | ||
|
|
||
| despawned = Despawn(SpawnedEntities[i]); | ||
|
|
||
| if (onlyFirst) | ||
| { | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| return despawned; | ||
| } | ||
|
Comment on lines
+242
to
+263
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The - public bool Despawn(bool onlyFirst, Func<T, bool> entityGetter)
- {
- var despawned = false;
-
- for (var i = 0; i < SpawnedEntities.Count; i++)
- {
- if (!entityGetter(SpawnedEntities[i]))
- {
- continue;
- }
-
- despawned = Despawn(SpawnedEntities[i]);
-
- if (onlyFirst)
- {
- break;
- }
- }
-
- return despawned;
- }
+ /// <inheritdoc />
+ public bool Despawn(bool onlyFirst, Func<T, bool> entityGetter)
+ {
+ // updated implementation
+ } |
||
|
|
||
| public abstract void Dispose(); | ||
|
|
||
| protected virtual T SpawnEntity() | ||
|
|
@@ -356,6 +356,10 @@ public GameObjectPool(uint initSize, GameObject sampleEntity) : base(initSize, s | |
| { | ||
| } | ||
|
|
||
| public GameObjectPool(uint initSize, GameObject sampleEntity, Func<GameObject, GameObject> instantiator) : base(initSize, sampleEntity, instantiator) | ||
| { | ||
| } | ||
|
|
||
|
Comment on lines
+359
to
+362
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A new constructor has been added to the - public GameObjectPool(uint initSize, GameObject sampleEntity, Func<GameObject, GameObject> instantiator) : base(initSize, sampleEntity, instantiator)
- {
- }
+ public GameObjectPool(uint initSize, GameObject sampleEntity, Func<GameObject, GameObject> instantiator) : base(initSize, sampleEntity, instantiator)
+ {
+ // implementation
+ } |
||
| /// <inheritdoc /> | ||
| public override void Dispose() | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,7 +18,7 @@ public interface IGameLogicMockup | |
| void CallMockup(int payload); | ||
| } | ||
|
|
||
| private struct CommandMockup : IGameCommand<IGameLogicMockup> | ||
| private class CommandMockup : IGameCommand<IGameLogicMockup> | ||
| { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing the - private struct CommandMockup : IGameCommand<IGameLogicMockup>
+ private class CommandMockup : IGameCommand<IGameLogicMockup> |
||
| public int Payload; | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -15,7 +15,19 @@ public class ObjectPoolTest | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private IMockEntity _mockEntity; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private uint _initialSize = 5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public interface IMockEntity : IPoolEntitySpawn, IPoolEntityDespawn, IPoolEntityObject<object>, IPoolEntitySpawn<object> { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public interface IMockEntity : IPoolEntitySpawn, IPoolEntityDespawn, IPoolEntityObject<IMockEntity>, IPoolEntitySpawn<object> { } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public class MockEntity : IMockEntity | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| private IObjectPool<IMockEntity> _pool; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public void Init(IObjectPool<IMockEntity> pool) => _pool = pool; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public bool Despawn() => _pool.Despawn(this); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public void OnDespawn() {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public void OnSpawn() {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public void OnSpawn(object data) {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+19
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add null check for _pool in Despawn method The MockEntity implementation looks good overall, but the Despawn method should validate that _pool has been initialized to prevent NullReferenceException. Consider adding a null check: public class MockEntity : IMockEntity
{
private IObjectPool<IMockEntity> _pool;
public void Init(IObjectPool<IMockEntity> pool) => _pool = pool;
- public bool Despawn() => _pool.Despawn(this);
+ public bool Despawn()
+ {
+ if (_pool == null)
+ {
+ throw new InvalidOperationException("Pool not initialized. Call Init before Despawn.");
+ }
+ return _pool.Despawn(this);
+ }
public void OnDespawn() {}
public void OnSpawn() {}
public void OnSpawn(object data) {}
}📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [SetUp] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public void Init() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -65,6 +77,19 @@ public void Despawn_Successfully() | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _mockEntity.Received().OnDespawn(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /* Uncomment when finding someone that can help fix this interface | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [Test] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public void EntityDespawn_Successfully() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var pool = Substitute.For<IObjectPool<IMockEntity>>(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| var entity = new MockEntity(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| entity.Init(pool); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Assert.IsTrue(entity.Despawn()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pool.Received().Despawn(entity); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }*/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [Test] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| public void Despawn_NotSpawnedObject_ReturnsFalse() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changelog entry for version 0.13.2 looks good.