Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Reactive Programming by UniRx for Asynchronous & Event Processing

58 729 vues

Publié le

Unity Asset LT
https://github.com/neuecc/UniRx/

Publié dans : Technologie
  • Use this weird secret involving text messages to get your Ex to come crawling back! Learn how ★★★ http://ow.ly/mOLD301xGxr
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • ★★ How Long Does She Want You to Last? ★★ A recent study proved that the average man lasts just 2-5 minutes in bed (during intercourse). The study also showed that many women need at least 7-10 minutes of intercourse to reach "The Big O" - and, worse still... 30% of women never get there during intercourse. Clearly, most men are NOT fulfilling there women's needs in bed. Now, as I've said many times - how long you can last is no guarantee of being a GREAT LOVER. But, not being able to last 20, 30 minutes or more, is definitely a sign that you're not going to "set your woman's world on fire" between the sheets. Question is: "What can you do to last longer?" Well, one of the best recommendations I can give you today is to read THIS report. In it, you'll discover a detailed guide to an Ancient Taoist Thrusting Technique that can help any man to last much longer in bed. I can vouch 100% for the technique because my husband has been using it for years :) Here's the link to the report  https://tinyurl.com/rockhardxxx
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Getting Started with Processing: A Hands-On Introduction to Making Interactive Graphics --- http://amzn.to/1pC7lY0
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Learning Processing, Second Edition: A Beginner's Guide to Programming Images, Animation, and Interaction (The Morgan Kaufmann Series in Computer Graphics) --- http://amzn.to/1RsFJki
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Processing: A Programming Handbook for Visual Designers and Artists (MIT Press) --- http://amzn.to/1UdwVPX
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici

Reactive Programming by UniRx for Asynchronous & Event Processing

  1. 1. Reactive Programming by UniRx for Asynchronous & Event Processing 2014/07/30 Yoshifumi Kawai - @neuecc
  2. 2. Self Introduction @ CTO C# 5.0 + .NET Framework 4.5 + ASP.NET MVC 5 C# Web @ Microsoft MVP for Visual C# / C# Web http://neue.cc/ Twitter @neuecc
  3. 3. What’s Reactive Programming?
  4. 4. Functional Reactive Programming http://en.wikipedia.org/wiki/Functional_reactive_programming Excel …… Reactive Extensions FRP (Haskell ) 2009 .NET Reactive Extensions
  5. 5. Functional Reactive Programming http://en.wikipedia.org/wiki/Functional_reactive_programming Excel …… Reactive Extensions FRP (Haskell ) 2009 .NET Reactive Extensions UniRx ReactiveExtensions(Rx) Unity
  6. 6. Gartner’s Hype Cycle 2013 Application Architecture/Application Development On the Rise - Reactive Programming
  7. 7. Technology Radar Languages & Framework ThoughtWorks Technology Radar July 2014 Rx ADOPT OK TRIAL ASSESS HOLD
  8. 8. Across Languages RxJava Netflix for Java/Scala ReactiveCocoa GitHub 5073 for Objective-C RxJS/bacon.js JavaScript RxJS bacon.js
  9. 9. UniRx
  10. 10. UniRx 100 Asset Store Reactive Programming Reactive Extensions RxJava Wiki
  11. 11. UniRx - Reactive Extensions for Unity
  12. 12. Reactive Extensions(Rx) is LINQ C# LINQ LINQ(to Objects) C# Rx LINQ LINQ Reactive Programming Rx
  13. 13. UniRx is .NET(C#) Rx Unity https://github.com/neuecc/UniRx http://u3d.as/7tT (Asset Store, Price : FREE) Rx + Unity C# …… https://rx.codeplex.com/ Bart De Smet Microsoft Unity :)
  14. 14. Q C# LINQ Rx 5 …… 3 @IT http://www.atmarkit.co.jp/fdotnet/introrx/introrx_01/introrx_01_01.html AOT Safe LINQ iOS AOT Unity + iOS AOT http://neue.cc/2014/07/01_474.html
  15. 15. Reactive Extensions is LINQ to Events LINQ to Asynchronous
  16. 16. Event is Observable Sequence Rx IObservable<T> time OnTap 3 Tap 5 Tap 1 Tap
  17. 17. IEnumerable <-> IObservable IObservable<T> time IEnumerable<T> length IEnumerable<T> length .Where(x => x % 2 == 0) IObservable<T> time .Where(x => x % 2 == 0) Where LINQ
  18. 18. Push Event Stream Event Processing Interactive/Visualize
  19. 19. Internet of Things Push Kinect Oculus Twitter Streaming PubSub, WebSocket Logs are Stream(Fluentd, Amazon Kinesis, Azure Event Hubs) MonoBehaviour Update , OnMouseClick, etc...
  20. 20. LINQ
  21. 21. LINQ LINQ LINQ
  22. 22. Better EventHandling
  23. 23. Limitations of .NET Events // public event Action<int> OnHitDamage; // player.OnHitDamage += (damage) => { if (damage >= 1000) { // " " } }; player.OnHitDamage -= /* */
  24. 24. Observable Sequence to the Rescue IObservable<int> onHitDamage = player.OnHitDamage; var criticalHit = onHitDamage .Where(x =>x >= 1000); var subscription = criticalHit.Subscribe(damage => /* ... */); subscription.Dispose(); LINQ
  25. 25. Lifecycle Resource Management // Disposable CompositeDisposable subscriptions = new CompositeDisposable(); void Awake() { var player = new Player(); var enemy1 = new Player(); var enemy2 = new Player(); // player.OnHitDamage.Subscribe().AddTo(subscriptions); enemy1.OnHitDamage.Subscribe().AddTo(subscriptions); enemy2.OnHitDamage.Subscribe().AddTo(subscriptions); } void OnDestroy() { // subscriptions.Dispose(); }
  26. 26. Curing Your Asynchronous Programming Blues
  27. 27. yield return is awaitable IEnumerator GetBingText() { var www = new WWW("http://bing.com/"); yield return www; // Debug.Log(www.text); } It’s Unity’s awesome feature!
  28. 28. But... IEnumerator GetGoogle() { var www = new WWW("http://google.com/"); yield return www; } IEnumerator OnMouseDown() { try { // yield return StartCoroutine(GetGoogle()); } catch { } } IEnumerator yield return try-catch
  29. 29. IEnumerator GetGoogle(Action<string> onCompleted, Action<Exception> onError) { var www = new WWW("http://google.com/"); yield return www; if (!www.error) onError(new Exception(www.error)); else onCompleted(www.text); } ……(JavaScript ) IEnumerator
  30. 30. Rx Unity ObservableWWW.Get("http://google.co.jp/") .SelectMany(x => ObservableWWW.Get(x)) // .Retry(3) // 3 .Subscribe( x => Debug.Log(x), // ex => Debug.LogException(ex)); // Rx x x x
  31. 31. Why can Rx apply to asynchronous? x IEnumerable<T> IObservable<T> IObservable<T> time event async IE<T>
  32. 32. Why can Rx apply to asynchronous? x IEnumerable<T> IObservable<T> IObservable<T> time event async IE<T> Orchestrate Rx
  33. 33. var parallel = Observable.WhenAll( ObservableWWW.Get("http://google.com/"), ObservableWWW.Get("http://bing.com/"), ObservableWWW.Get("http://unity3d.com/")); parallel.Subscribe(xs => { Debug.Log(xs[0].Substring(0, 100)); // google Debug.Log(xs[1].Substring(0, 100)); // bing Debug.Log(xs[2].Substring(0, 100)); // unity });
  34. 34. IObservable<T> time IObservable<T> time WhenAll Observable.WhenAll( ObservableWWW.Get(), ObservableWWW.Get(), ObservableWWW.Get()) Subscribe(xs => xs[0], xs[1], xs[2])
  35. 35. Conclusion
  36. 36. Reactive Programming UniRx Available Now GitHub - https://github.com/neuecc/UniRx/ Asset Store(FREE) – http://u3d.as/7tT Update (v4.4)

×