Upload
unitytechnologiesjapan
View
44.793
Download
0
Embed Size (px)
Citation preview
C# /UniRx
Yoshifumi KawaiCTO Grani, Inc.
About this session
•
•
About this session
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
• 4 NPC
• 4 vs 4
• C#
• AI
•
• UniRx
• LINQ to GameObject
• MessagePack for C#
• MagicOnion
• MasterMemory
• ReMotion
• by Yoshifumi Kawai
• etc...
using
Why C#?Why Unity?
•
•
•
•
•
•
•
•
•
C#
•
•
•
•
•
•
•
•
•
How to
•
•
•
•
)
•
•
•
• IDL(Interface Definiton Language)
• IDL = JSON proto /
• IDL ……
• IDL
• C#
• IDL
IDL
• Visual Studio
•
• Unity
• Git
• ……
• C#
• C#
•
•
Visual Studio
C# C#
• C# C#
• C# 6.0(Visual Studio 2015)
•
• [MessagePackObject] => ***MessagePackFormatter
• /
•
•
•
• /
•
•
•
•
•
•
•
• /
•
•
•
•
•
• /
•
• /
•
•
•
•
• /
•
• /
•
•
•
C#
• C# /
•
•
•
•
• /
•IDL
•
•
• C#
• ……
•
•
•
•
•
•
3
gRPC
• Web API + Streaming
• Google HTTP/2 RPC
• HTTP/2 HTTP/1
• gRPC
• Web API
• (Unity )
• (Unity Web API )google
gRPC
• Web API + Streaming
• Google HTTP/2 RPC
• HTTP/2 HTTP/1
• gRPC
• Web API
• (Unity )
• (Unity Web API )google
Unity gRPC
• C# gRPC Unity
• .NET 4.5
•
• gRPC Client Unity
• .NET 3.5 + IL2CPP
• (C Core) iOS/Android
• /
• gRPC IDL Protocol Buffers/ Unity
• HTTP/2 gRPC
Unity gRPC
• C# gRPC Unity
• .NET 4.5
•
• gRPC Client Unity
• .NET 3.5 + IL2CPP
• (C Core) iOS/Android
• /
• gRPC IDL Protocol Buffers/ Unity
• HTTP/2 gRPC
•
•
•
•
•
•
•
•
• ……
•
•
•
•
•
•
•
•
• ……
UNET
• Unity
•
•
•
• C#
•
• UNET
• C#
•
• Web API ,
Web API
•
•
•
•
•
•
•
•
•
Web API
•
•
•
•
•
•
•
•
•
• Web API
Streaming Service(gRPC Battle Engine)
F for AI
• AI (DSL) F#
• F# .NET Framework
• Excel F#C# gRPC BattleEngine
• AI
Streaming Server
•
•
•
•
•
•
•
•
•
•
UniRx
•
•
•
•
•
•
•
•
•
• : 3845 : 1186
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Rx
•
•
•
•
•
Rx 3
// これで例外を共通ハンドリングIObservable<TResponse> HnadleCommonError<TRequest, TResponse>(IObservable<TResponse> source){
return source.Catch((Exception ex) =>{
// Exception使って共通エラーポップアップを出したりするとするNavigationService.ShowMessagePopUpAsync("error", "errorMessage").Subscribe();
// 呼び元に真の意味で何も返さないreturn Observable.Never<TResponse>();
});}
Pitfall of Empty
•
•
IObservable<Unit> Test(){
return Observable.FromCoroutine(() => TestCore());}
IEnumerator TestCore(){
yield return Observable.Empty<int>().ToYieldInstruction();
Debug.Log(“この行には到達する");}
Pitfall of Empty
•
•
IObservable<Unit> Test(){
return Observable.FromCoroutine(() => TestCore());}
IEnumerator TestCore(){
yield return Observable.Empty<int>().ToYieldInstruction();
Debug.Log("come here");}
UI Framework Rx
•
•
•
•
•
•
•
•
Chaotic Rx
•
•
•
•
•
Ivory.Unity.Core.Scene.<OnAfterNavigate>c__AnonStorey76A:<>m__2DC7(Unit)UniRx.Operators.Do:OnNext(Unit)UniRx.Operators.ImmutableReturnUnitObservable:Subscribe(IObserver`1)UniRx.Operators.Do:Run()UniRx.Operators.DoObservable`1:SubscribeCore(IObserver`1, IDisposable)UniRx.Operators.OperatorObservableBase`1:Subscribe(IObserver`1)UniRx.Operators.OperatorObservableBase`1:Subscribe(IObserver`1)UniRx.Operators.SelectManyOuterObserver:OnNext(Unit)UniRx.Operators.SelectMany:OnNext(Unit)UniRx.Operators.SelectMany:OnNext(Unit)UniRx.Operators.SelectMany:OnNext(Unit)UniRx.Operators.Do:OnNext(Unit)UniRx.Operators.SelectMany:OnNext(Unit)UniRx.Operators.SelectManyOuterObserver:OnNext(Unit)UniRx.Operators.Do:OnNext(Unit)UniRx.Operators.ImmutableReturnUnitObservable:Subscribe(IObserver`1)UniRx.Operators.Do:Run()UniRx.Operators.DoObservable`1:SubscribeCore(IObserver`1, IDisposable)UniRx.Operators.OperatorObservableBase`1:Subscribe(IObserver`1)UniRx.Operators.SelectManyOuterObserver:Run()UniRx.Operators.SelectManyObservable`2:SubscribeCore(IObserver`1, IDisposable)UniRx.Operators.OperatorObservableBase`1:Subscribe(IObserver`1)UniRx.Operators.Do:Run()UniRx.Operators.DoObservable`1:SubscribeCore(IObserver`1, IDisposable)UniRx.Operators.OperatorObservableBase`1:Subscribe(IObserver`1)UniRx.Operators.SelectManyOuterObserver:OnNext(Unit)UniRx.Operators.SelectMany:OnNext(Unit)UniRx.Operators.WhenAll_:OnNext(Unit)UniRx.Operators.WhenAllCollectionObserver:OnCompleted()UniRx.Operators.AsUnitObservable:OnCompleted()UniRx.Operators.WhenAll:OnCompleted()UniRx.Operators.WhenAllCollectionObserver:OnCompleted()UniRx.Operators.ImmutableReturnUnitObservable:Subscribe(IObserver`1)UniRx.Operators.WhenAll:Run()
Model-View-(Reacitve)Presenter
ViewReactive
PresenterModel
Model-View-(Reacitve)Presenter
ViewReactive
PresenterModel
Chaotic-Reacitve-Model
Reactive
PresenterModel
Chaotic-Reacitve-Model
Reactive
PresenterModel
Rx Simplicity
•
•
•
•
•
•
•
•
•
•
Rx
•
•
•
•
•
•
•
•
•
•
• Before gRPC
•
•
•
•
•
• After gRPC
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
ZeroFormatter
•
•
•
•
•
•
•
•
•
•
•
•
•
•
MessagePack for C#
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
Architecture of MasterMemory
Header LZ4+MsgPack LZ4+MsgPack LZ4+MsgPack LZ4+MsgPack
Memory<T>
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
The Future Has Come
•
• C#
•
•
•
•
•
•
Thank you!