Chickensoft.GoDotCollections
1.4.4
Chickensoft.GoDotCollections has been renamed to Chickensoft.Collections ^-^
dotnet add package Chickensoft.GoDotCollections --version 1.4.4
NuGet\Install-Package Chickensoft.GoDotCollections -Version 1.4.4
<PackageReference Include="Chickensoft.GoDotCollections" Version="1.4.4" />
paket add Chickensoft.GoDotCollections --version 1.4.4
#r "nuget: Chickensoft.GoDotCollections, 1.4.4"
// Install Chickensoft.GoDotCollections as a Cake Addin #addin nuget:?package=Chickensoft.GoDotCollections&version=1.4.4 // Install Chickensoft.GoDotCollections as a Cake Tool #tool nuget:?package=Chickensoft.GoDotCollections&version=1.4.4
GoDotCollections
Chickensoft's collections collection.
<p align="center"> <img alt="Cardboard Box with Chickensoft Logo" src="Chickensoft.GoDotCollections/icon.png" width="200"> </p>
Sometimes you need a collection abstraction that just isn't present in dotnet. Well, here you are.
Install
Currently, there are no Godot-specific dependencies. This is just a netstandard2.0 package — use with any Godot version!
Map
A typed facade over OrderedDictionary
. Provides a basic mechanism to store strongly typed keys and values (preserving key insertion order).
AutoProp
GoDotCollections includes a small reactive helper object that allows you to make observable properties in the style of IObservable
, but is implemented over plain C# events and modifies the API to be more ergonomic a la Chickensoft.
AutoProps are basically a simplified version of a BehaviorSubject
that only updates when the new value is not equal to the previous value, as determined by the equality comparer (or the default one if you don't provide one).
using Chickensoft.GoDotCollections;
public class MyObject : IDisposable {
// Read-only version exposed as interface.
public IAutoProp<bool> MyValue => _myValue;
// Read-write version.
private readonly AutoProp<bool> _myValue = new AutoProp<bool>(false);
public void Update() {
// Update our values based on new information.
_myValue.OnNext(true);
// ...
// Check the latest value.
if (_myValue.Value) {
// ...
}
// Subscribe to all future changes, **AND** get called immediately with the
// current value.
_myValue.Sync += OnMyValueChanged;
// Subscribe to all future changes.
_myValue.Changed += OnMyValueChanged;
// Subscribe to completed
_myValue.Completed += OnMyValueCompleted;
// Subscribe to errors
_myValue.Error += OnMyValueError;
// Optional: inform completed listeners we're done updating values
_myValue.OnCompleted();
// Optional: send error listeners an error value
_myValue.OnError(new System.InvalidOperationException());
// ...
// Always unsubscribe C# events when you're done :)
_myValue.Sync -= OnMyValueChanged;
_myValue.Changed -= OnMyValueChanged;
_myValue.Completed -= OnMyValueCompleted;
_myValue.Error -= OnMyValueError;
// Or clear all subscriptions at once:
_myValue.Clear();
// When your object is disposing:
_myValue.Dispose();
}
private void OnMyValueChanged(bool value) { }
private void OnMyValueCompleted() { }
private void OnMyValueError(Exception err) { }
// ...
}
✅ Uses plain C# events.
Observers are called one-at-a-time, in-order of subscription, on the invoking thread, and synchronously (and will always be that way unless Microsoft tampers with the underlying Multicast delegate implementation that powers C# events).
Chickensoft prefers to keep everything synchronous and deterministic in game development, only adding parallelization or asynchronicity where it's absolutely necessary for performance. Otherwise, simpler is better.
✅ Familiar API.
If you've ever used
IObservable
and/orBehaviorSubject
, you basically already know how to use this.✅ Guarantees order of events and allows updates from handlers.
If you change the value from a changed event handler, it will queue up the next value and process it synchronously afterwards. This allows it to pass through each desired value, guaranteeing callbacks will be called in the correct order for each value it passes through.
✅ Doesn't update if the value hasn't changed.
🐣 Package generated from a 🐤 Chickensoft Template — https://chickensoft.games
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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. 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.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Chickensoft.GoDotCollections:
Package | Downloads |
---|---|
Chickensoft.GoDotTest
C# test runner for Godot. Run tests from the command line, collect code coverage, and debug tests in VSCode. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.4.4 | 6,088 | 4/25/2024 | |
1.4.3 | 118 | 4/25/2024 | |
1.4.0 | 14,888 | 10/27/2023 | |
1.3.4 | 16,830 | 4/1/2023 | |
1.3.2 | 221 | 4/1/2023 | |
1.3.1 | 215 | 4/1/2023 | |
1.3.0 | 241 | 4/1/2023 | |
1.2.0-godot.4.beta.16 | 126 | 1/30/2023 | |
1.2.0-beta8 | 114 | 12/17/2022 | |
1.2.0-beta6 | 110 | 11/24/2022 | |
1.2.0-beta.4.0.0.17 | 112 | 2/6/2023 | |
1.1.2-beta3 | 126 | 10/29/2022 | |
1.1.1-beta6 | 107 | 11/24/2022 | |
1.1.1-beta3 | 110 | 10/29/2022 | |
1.1.1-beta1 | 199 | 9/17/2022 | |
1.1.0-beta1 | 209 | 9/17/2022 | |
1.0.0 | 777 | 7/22/2022 | |
0.0.3 | 938 | 6/20/2022 | |
0.0.2 | 1,402 | 6/19/2022 | |
0.0.1 | 409 | 6/19/2022 | |
0.0.0 | 110 | 4/25/2024 | |
0.0.0-devbuild | 88 | 4/25/2024 |
Chickensoft.GoDotCollections release.