Closed monry closed 5 years ago
(I'm not the author of Zenject, but a man who added TryFire)
So you wanna do like this?
var childSignal = new ChildSignal(); // inherits from ParentSignal
signalBus.Fire<ParentSignal>(childSignal); // Notify on all ParentSignal receivers with ChildSignal instance
If so, that's I've wonder too! 👍
Thank you for your replying !
I want to do like below code.
interface IFoo {}
class Foo : IFoo { }
// I am using UniRx linkage, but I want to make `Subscribe <IFoo>' even if I do not use it.
signalBus.GetStream<IFoo>().Subscribe(foo => { /* Do something to use `foo' */ });
var foo = new Foo();
signalBus.Fire<IFoo>(foo);
I want to observe stream used interface.
Ok I've added this but made a minor change to your solution where it looks up the declaration before instantiating the signal. This is just a bit nicer for error handling
Make it possible to pass instances of
TSignal
to methods using generics.I need an overload that I can also pass signal to the generic method version of
Fire
,TryFire
to send the spawned instance as signal.In addition, in the case of the method of the non-generic version, I can not explicitly specify the interface, so I could not do what I really wanted to do.