RedHerring.Clues
2.0.0
dotnet add package RedHerring.Clues --version 2.0.0
NuGet\Install-Package RedHerring.Clues -Version 2.0.0
<PackageReference Include="RedHerring.Clues" Version="2.0.0" />
paket add RedHerring.Clues --version 2.0.0
#r "nuget: RedHerring.Clues, 2.0.0"
// Install RedHerring.Clues as a Cake Addin #addin nuget:?package=RedHerring.Clues&version=2.0.0 // Install RedHerring.Clues as a Cake Tool #tool nuget:?package=RedHerring.Clues&version=2.0.0
Red Herring Clues
Simple definition system for your data-driven project.
Accessing Definition
Use Definitions
or IDefinitions
, depending on how much access you need.
IEnumerable<T> GetAll<T>() where T : ADefinition;
Returns all definitions of the given type.
T Get<T>(CompositeId id) where T : ADefinition;
Returns the definition of the given type, with the specified id
.
bool TryGet<T>(CompositeId id, out T definition) where T : ADefinition;
Returns true
if the definition of the given type, with the specified id
, exists.
bool Contains<T>(CompositeId id) where T : ADefinition;
Returns true
if the definition of the given type, with the specified id
, exists.
T Default<T>() where T : ADefinition;
Returns the default definition of the given type.
If no definition is marked as default, it will return null
.
Loading Definitions
To use Clues in your project, all you need to do is create an instance of Definitions
.
Loading and creation of definitions is up to you (you may want to deserialize from XML, JSON, etc.).
Once they are deserialized, you just need to feed them into the Definitions
instance to
var indexer = new DefinitionIndexer();
var loader = new DefinitionLoader(indexer);
// use RedHerring.Deduction crawler to register indexer and process types
// process definitions
var definitions = new Definitions();
definitions.Load(loader);
CompositeId
Id that consists of 2 parts, Primary
and Secondary
, both of which are a uint
internally.
It is up to you, how you use this, even using all 8 bytes as a single Id
is fine..
It comes with a property drawer, for easier editing.
Both parts of the id are visually represented by 4 characters, with values between 0-255
.
A Definition
Basic definition type from which all of the other definitions need to inherit if ADefinition
.
It contains some basic properties:
- IsDefault - It this the default definition for the type?
- Id - The
CompositeId
used to identify this definition.
You will need to override the Init
method to create a game-ready definition from raw deserialized data.
Feel free to raise an exception during Init
, ideally one that derives from FailedToInitializeDefinitionException
.
Definition Type Attribute
Attribute to use on your custom definition type, in order to have it registered as another definition type, in addition to its own. The current types need to derived from the specified type.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- RedHerring.Alexandria (>= 1.0.0)
- RedHerring.Deduction (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.