Skip to content

Releases: juniordiscart/ImpossibleOdds-Toolkit

v1.5.3 - Fixes & Small Improvements

06 Sep 19:33
Compare
Choose a tag to compare

This is a quick fix release. For the complete v1.5 update notes, check here.

Changelog:

Added

  • Added TryFindIndex extension methods for lists and arrays.
  • Added InjectStatic and InjectStaticAll methods to the DependencyInjector class, to explicitly allow injection of static members of a type.

Updated

  • Properties that are used for serialization now no longer require both their get and set methods to be defined. A warning is now displayed whenever a value is trying to write to a getter-only property, and another warning whenever a value is trying to be retrieved when only a setter has been provided.
  • An improved base method filtering is done during (de)serialization of properties. This prevents getting or setting a value multiple times.

Fixed

  • Fixed issue with deserializing a Json string containing the \" sequence. This could cause an infinite loop.
  • Fixed issue with deserializing a Json double or long value, where the serialization definition's format provider wasn't used. This could result in formatting exceptions on platforms that have a different notation for floating point numbers.
  • Fixed issue with resolving the proper type during deserialization, where it would return back to a base-type.
  • Fixed issue where the type resolve parameter defined on an interface wouldn't get picked up by the serialization cache.
  • Fixed issue with dependency injection of static members not injecting the correct target.
  • Several typo's in the documentation.

v1.5.2 - Named Injection Fix

10 Aug 07:36
Compare
Choose a tag to compare

This is a quick fix release. For the complete v1.5 update notes, check here.

Fixed

  • Fixed issue where injecting resources using an injection identifier would throw a NullReferenceException.

v1.5.1 - Purge Delegates Fix

20 Jul 21:42
Compare
Choose a tag to compare

This is a quick fix release to remedy an issue with purging delegates. For the v1.5 update notes, check here.

Fixed

  • Fixed issue where purging the delegates of an object would try to purge non-existing delegates on the object, and throw an exception.

v1.5 - State Machines, Dependency Injection Improvements & Optimizations

19 Jul 21:22
Compare
Choose a tag to compare

General note about installing updates: it is recommended that you remove the current installed package first before updating to a newer one. Some files may have been deleted or moved, which may cause conflicts or compilation errors. The default location for this package in your Unity project is at Assets/Impossible Odds/Toolkit.

This release brings the State Machine module, a common coding pattern used in a variety of situations. This tool can help you streamline the use of the pattern in your project. Additionally, the Dependency Injection module has been given some useful and nifty additions to speed up managing of your runtime resources. The serialization framework has had a pretty big caching update to reduce memory garbage generation. And finally, a bunch of smaller extension functions have been added to keep your code more concise and readable.

Happy coding!

Added

  • Added the State Machines functionality to set up and manage state machines.
  • Added Unity package data so that this toolkit can now be included as an embedded project package.
  • Added IsNullOrEmpty and IsNullOrWhitespace string extension functions in analogy of their static counterparts.
  • Added IsNullOrEmpty collection extension functions to quickly check if a list, array or other type of collection is null or empty.
  • Added TryFindIndex list and array extensions to find an index of an element.
  • Added additional sorted insertion extension functions for list-structures.
  • Added additional logging functions to provide an object as parameter, rather than a string to quickly log the value of an object without having to convert it to string manually.
  • Added a serialization processor for the System.Version and System.Guid types so these can be included in serialized data. This processor has been added to all available serialization definitions.
  • Added Dependency Injection extension functions to add a component to a game object and inject it immediately.
  • Added Dependency Injection extension functions to inject a scene, which will loop over all game objects in the scene.
  • Added an optional injection identifier for the Scene and Hierarchy scopes, to inject their scopes to objects requiring their resources to come from specific sources only.
  • Added the CompositeDependencyContainer type which is a resource container that is built by combining multiple resource containers. This allows to inject a large set objects in one go instead of going over them per resource container.
  • Added an IReadOnlyDependencyContainer interface which allows to only get resources from the container. The IDependencyContainer now inherits from this new interface as well.
  • Added a reflection caching framework to optimize and unify the way meta-data is cached and stored. The enum display names, dependency injection, weblink and serialization frameworks now use this caching instead of their internal solutions.

Updated

  • Updated the Dependency Injection framework to allow constructor-based injection.
  • Updated the Dependency Injection framework to allow static injection. If the object to inject is of type Type, then its static fields and properties will be injected.
  • Updated most dependency injection methods to receive a read-only container now if they only require resources to be read from the container.
  • Updated the GlobalDependencyScope to have its GlobalScope property be public instead of internal.
  • Updated the GlobalDependencyScope to be able to adjust the AutoInjectLoadedScenes at runtime.
  • Updated most frameworks to work with concurrency-safe structures. This should make (most of) this toolkit safe to use and run in multi-threaded environments.
  • Updated most attribute-related functions to work with the static Attribute functions rather than the member functions defined on the MemberInfo classes to ensure the frameworks work with attribute-related data.
  • Updated most internal workings to use arrays instead of the IEnumerable<T> interface to optimise iterating the collections.
  • Updated reflection-based method invocation to use a cached parameter list to reduce garbage generation.

Fixed

  • Fixed an issue where serialization callbacks would get invoked multiple times if overrides of the same method had the callback attribute defined as well.
  • Fixed an issue with the Shuffle extension function for lists, where certain placement patterns weren't possible.

Breaking Changes

  • The IDependencyScope requires the implementation of an Inject method now. Calling this method on your scope object should inject the objects under its scope with the resources found in its resources container. If you have a custom dependency scope type, you'll have to provide an implementation for this.

v1.4 - Serialization Type Key Overrides & Several Fixes

02 Oct 20:01
Compare
Choose a tag to compare

General note about installing updates: it is recommended that you remove the current installed package first before updating to a newer one. Some files may have been deleted or moved, which may cause conflicts or compilation errors. The default location for this package in your Unity project is at Assets/Impossible Odds/Toolkit.

As this toolkit is now being battle tested in several projects, feedback and small bug reports start to trickle in. This release focuses on providing stability fixes and add some usability features for the serialization features and custom message behaviour.

Added

  • All serialization frameworks can now define a serialization type key override through the KeyOverride property on the attribute. This allows to set or infer a type based on a different or already present value in the data. The XML serialization can also define whether the type information should be saved as a child element rather than an attribute using the SetAsElement property on the XmlType attribute.
  • JSON, HTTP body and Photon WebRPC serialization frameworks now also have support for (de)serializing structs.
  • A NullValueProcessor class for dealing with null data during deserialization. This processor will assign a default or null when the value to deserialize is null. This processor is added to every pre-defined serialization definition in the toolkit. This also fixes issue #6.

Updated

  • The HttpMessageHandle is updated to cope with the deprecated properties of the UnityWebRequest class set in Unity 2020.2. This gets rid of the warning messages in newer versions of Unity.
  • The default nested message configurator classes in HttpMessenger and WebRpcMessenger have most of their methods and fields defined as virtual and/or protected, allowing for simple override behaviour without a full custom implementation.
  • Loosened the type restriction for Type-defining attributes in several serialization frameworks. Instead of just instances of type string, instances of object are now accepted. This allows for other kinds of values to serve as type identifiers, e.g. enums.
  • All pre-defined serialization processors now require the targetType parameter of their Deserialize method to be non-null.
  • The InvokeResponseCallback method in the Weblink utilities framework now takes an additional generic parameter to reliably retrieve the callback method. This also fixes issue #7.

Fixed

  • The type verification check of a value against generic type arguments of a list or dictionary would fail for vaules that were not null. See issue #4.
  • All registered targeted callback methods were called when a message completed instead of only the matching ones to the response. See issue #5.
  • The ExactMatchProcessor would have an unhandled scenario where it would attempt to set the wrong kind of data during deserialization.

Removed

  • The InvokeIfNotNull delegate extension function with dynamic set of parameters. This method was already marked as deprecated since version 1.2 of this toolkit.

v1.3 - Multi-Named Injections & Small Optimizations

09 Sep 19:57
Compare
Choose a tag to compare

A small release for a major version number update, but an important one in terms of quality-of-life for certain projects.

Note: while this release doesn't contain any breaking changes, it's advised to remove the old Impossible Odds Toolkit installation from your project first (found at: Assets/Impossible Odds/Toolkit), and apply the updated package afterwards.

Added

  • The global dependency injection scope can now be disabled to inject loaded scenes automatically. This prevents the scene from being scraped for injectable components when activated, and can help in reducing loading times of larger scenes. This can be toggled in the Impossible Odds section of the project's preferences panel.

Updated

  • The Inject attribute can now be placed multiple times on a member, allowing for different named context to inject the same member.

Improved

  • The Log class has now multiple overloads for each log function that can take up to three parameters, similar to the String.Format overloads, to minimize the amount of memory allocations that would otherwise occur from creating the list of parameters.

v1.2 - Photon WebRPC Support & Tool Interoperability

02 Aug 22:34
Compare
Choose a tag to compare

General note about installing updates: it is recommended that you remove the current installed package first before updating to a newer one. Some files may have been deleted or moved, which may cause conflicts or compilation errors. The default location for this package in your Unity project is at Assets/Impossible Odds/Toolkit.

This release brings support for Photon's WebRPC feature and a focus on interoperability between the tools in this toolkit. With the WebRPC tool, you can communicate securely with your web server in a very easy and similar way as you've come to know from the HTTP tool. Additionally, it's now also possible to customize and reuse earlier serialization configurations, e.g. using the JSON attributes and serialization configuration for processing your HTTP requests and responses. The documentation as well as the examples scenes for several tools have been improved.

Note: this release contains minor breaking changes regarding the JSON tool. Please check the 'Renamed' and 'Removed' entries in the changelist below.

Changelist:

Added

  • Photon WebRPC support. Check the Photon - WebRPC Extensions section in the documentation to read all the details.
  • A utility for creating and appending URL parameters. This can be found in the new static UrlUtilities class in the ImpossibleOdds.Http namespace.
  • The HttpBodySerializationDefinition now supports enum aliases and saving type information and brings it on par with the supported features by the JSON tool.
  • The HttpMessenger and WebRpcMessenger can switch their internal message processing. This allows for reusing other serialization tools found in this toolkit. More information can be found in the HTTP and WebRPC documentation pages.
  • Request and response messengers can now check how many pending requests are left by checking the Count property.
  • Several serialization definitions can set a different type resolve key by setting the TypeResolveKey property.
  • Introduced the IHttpStructuredResponse interface as a replacement for the IHttpJsonResponse interface.

Improved

  • Request and response messengers no longer throw an exception when attempting to send an already pending request again. Now, the current handle is returned instead.
  • Tightened the type parameter restriction for the ResponseCallback, ResponseType attributes. An explicit exception is now thrown when an incompatible type is provided.

Updated

  • The InvokeIfNotNull extension method with flexible parameter list has been marked obsolete because of its unintentional fallback for otherwise invalid delegate invokations.
  • The IHttpJsonResponse interface is marked obsolete as the name does not fully cover the extends of where the interface should be applied. Implement the IHttpStructuredResponse interface instead.
  • The JsonProcessor now accepts an optional instance of JsonOptions for all of its serialization and deserialization methods. If a custom serialization definition is defined, it will use those data structures instead of the predefined types by the processor itself.
  • The default logging level of the Log utility is now set to the 'info'-level when the toolkit detects no logging level has been set before.
  • The example scenes for the JSON and XML tools now have their data loaded from a text asset instead of being hardcoded in the example code.
  • The documentation of the HTTP, JSON and XML topics have been updated to contain more concrete examples as well as a complete code example at the end.
  • Additional documentation for updated tools and features.

Fixed

  • Deserializing a CData section in a pretty-printed XML document would fail as the preceding whitespace characters were seen as a first node in the internal XML document representation.

Renamed

  • JsonDefaultSerializationDefinitionJsonSerializationDefinition.

Removed

  • The abstract generic JsonSerializationDefinition<TJsonObject, TJsonArray> class.
  • The generic Deserialize<TJsonObject, TJsonArray> overload method on the JsonProcessor.

v1.1 - XML Support & Serialization Performance

10 Jun 22:31
Compare
Choose a tag to compare

Note: this release contains breaking changes! Check the 'Removed' and 'Renamed' entries in the changelist below.

Installation note: It's recommended to remove your current version of the toolkit from your project first, and apply the updated package afterwards.

First of all apologies for the breaking changes to those affected by them! I figured it would be better to introduce these changes in a release when the package is still young and hasn't gathered a (huge - one can dream) following. The changes mainly affects the ImpossibleOdds.DependencyInjection framework where the term 'dependency context' didn't carry enough weight to support the intention. Every 'dependency context' is replaced by a 'dependency scope', which is a closer fit to what it actually does.

This update brings support for serializing data to and from the XML data format. It also had a big focus on improving the memory and caching performance of the underlying serialization framework. The serialization code also had a major rework for better readability and maintainability. Besides that, some smaller quality-of-life improvements have been added for enums and support for serializing properties as well instead of fields-only.

Changelist:

Added

  • XML serialization support. Check the XML section in the documentation to read all the details.
  • Support for (de)serializing properties of objects instead of only fields.
  • Enum alias caching for faster retrieval during (de)serialization.
  • Support for aliases on enums decorated with the System.Flags attribute.
  • A generic Serialize method on the Serializer class, for immediately receiving the typed result.
  • Required fields in JSON or XML can now enable the NullCheck property to perform a value check as well. When the value in the source data is null, it will stop the deserialization process.

Improved

  • Serialization of Unity primitive values (Vector3, Color, etc.) can be modified with a preferred processing method, e.g. as a JSON object versus JSON array, or using XML elements versus XML attributes. This can be configured globally in the Impossible Odds project settings window, and per serialization definition.
  • Serialization and deserialization of custom objects have improved memory usage by skipping several intermediate steps.
  • HTTP and JSON serialization definitions now use instances of ArrayList instead of List<object> to skip the generic type checking steps.
  • Objects requesting a serialization callback can now have an optional parameter of type IProcessor to get some context of what is processing the object.
  • The SerializationUtilities class now contains clearly defined functions and descriptions.
  • Exceptions thrown during serialization have a more clear description of what might have gone wrong.
  • The JSON example scene includes more logging and made the JSON output interactable to experiment with the contents.

Fixed

  • Enum alias deserialization issue.

Removed

  • Several unused interfaces in the ImpossibleOdds.Serialization namespace.
  • Several abstract classes in the ImpossibleOdds.Serialization namespace that would 'glue' several unrelated classes together.

Renamed

  • Several dependency injection related classes and interfaces:
    • IDependencyContextIDependencyScope
    • DependencyContextDependencyScope
    • GlobalContextInstallerAttributeGlobalScopeInstallerAttribute
    • GlobalDependencyContextGlobalDependencyScope
    • HierarchyDependencyContextHierarchyDependencyScope
    • SceneDependencyContextSceneDependencyScope
    • IDependencyContextInstallerIDependencyScopeInstaller
    • AbstractDependencyContextBehaviourAbstractDependencyScopeBehaviour

v1.0.2 - Extensions & Fixes

11 May 21:28
Compare
Choose a tag to compare

Note: this release contains a breaking change! Check the 'Renamed' entries in the changelist below.

Changelist:

Added

  • DependencyContainerExtensions collapsing frequently chained methods into a single call.

Fixed

  • The global dependency context was only injected in the scene's root game objects. Now their children are processed as well.

Renamed

  • FunctorBindingGeneratorBinding. The file and documentation already used the right name, but the actual class did not reflect this yet. Note: this is a breaking change!

v1.0.1 - Improved Documentation & Combined Package

04 Feb 19:33
Compare
Choose a tag to compare

Small update that unifies the packages, making it the same setup and layout as you would download it from the Unity Asset Store.

Changelist:

Added

  • A combined documentation file in the package.
  • The examples to the package.

Improved

  • Documentation and added some more flavor to the Core Utilities description.

Updated

  • The string extension functions to throw an ArgumentException instead of an ArgumentNullException if the string argument is empty or just white space characters.