So, I found out about PlayFab from the GDC talk (http://gdcvault.com/play/1023486/) and in the talk ya'll talked about using UniRx with PlayFab... but unfortunately, the code supplied was incomplete and I'm having a hard time making it work.
I've been programming for a long time, but I'm new to C# and Rx so there's a lot I'm trying to learn at once with this... so forgive me if the answer is obvious.
In the talk, there's this code:
PlayFabClientAPI.LoginWithCustomID( request, (e) => _EventStream(new LoginEvent(e)), (err) => _EventStream(new LoginEvent(err)) );
But there's nothing about how to create the LoginEvent class... and I cannot figure out what the type of e and err is. Everything I've found seems to be implicitly typed and when I look at the source, the potential results appear to be a wide number of completely unique classes.
So... how in the world do I create a constructor for the LoginEvent class when I don't know what the type of the result is? Or what is it that I'm missing here?
Thanks!
,At the PlayFab GDC talk(http://gdcvault.com/play/1023486/), ya'll discussed using UniRx with PlayFab. Unfortunately, the code displayed was incomplete as it didn't describe how to make the events.
I've been programming a long time, but there's a lot of new concepts being introduced to me with C# and UniRx, so forgive me if the answer is obvious.
I have a class that includes the code from the talk:
private Action<IPlayFabEvent> _EventStream = delegate {}; public IObservable<T> EventStream<T>() where T : IPlayFabEvent { return Observable.FromEvent<IPlayFabEvent>( h => _EventStream += h, h => _EventStream -= h ).OfType<IPlayFabEvent,T>(); }
and that compiles fine... but then when I get to the part that looks like this:
PlayFabClientAPI.LoginWithCustomID( request, (e) => _EventStream(new LoginEvent(e)), (err) => _EventStream(new LoginEvent(err)) );
I cannot for the life of me figure out what type e and err are. It seems like all the examples are implicit and looking at the playfab API source, it seems like the result could be any number of totally unique classes.
I have no idea how to create a LoginEvent class with a constructor that will accept an implicit argument... if that's even what I need to be doing? Can anyone help me?