33PhotonRxは、[ Photon Unity Networking] ( https://www-jp.exitgames.com/ja/PUN ) を[ UniRx] ( https://github.com/neuecc/UniRx ) のObservableとして扱えるようにしたライブラリです。
44Photonのコールバック群をObservableTriggerとして定義しています。
55
6- ## 導入方法
6+ PhotonRx supports to [ Photon Unity Networking] ( https://www-jp.exitgames.com/ja/PUN ) as Observable([ UniRx] ( https://github.com/neuecc/UniRx ) ).
7+
8+
9+ ## 導入方法 (How to install)
710
811PhotonRx.unitypackageをプロジェクトにインポートしてください。
912[ Photon Unity Networking] ( https://www-jp.exitgames.com/ja/PUN ) と[ UniRx] ( https://github.com/neuecc/UniRx ) は含んでいないので、これらは自身でインポートする必要があります。
1013
11- ## 使い方
14+ Include [ PhotonRx.unitypackage] ( https://github.com/TORISOUP/PhotonRx/releases ) to your Unity project.
15+ (PhotonRx dose NOT contain PUN and UniRx assets.)
1216
13- ObservableTriggerと同様に、this.xxxAsObservableでストリームを取得することができます。
17+ ## 使い方(How to use)
1418
1519``` csharp
1620using System ;
@@ -24,19 +28,17 @@ public class SubscribeConnection : MonoBehaviour
2428 private void Start ()
2529 {
2630 this .OnConnectedToPhotonAsObservable ()
27- .Subscribe (_ => Debug .Log (" サーバへ接続成功 " ));
31+ .Subscribe (_ => Debug .Log (" Success " ));
2832
2933 this .OnFailedToConnectToPhotonAsObservable ()
30- .Subscribe (_ => Debug .Log (" サーバへの接続失敗 " ));
34+ .Subscribe (_ => Debug .Log (" Failure " ));
3135 }
3236}
3337
3438```
3539
3640## Task support
3741
38- ` .NET 4.6 ` モードであればログインおよび部屋に参加する場合に` Task ` を使うことができます。
39- ` Photon.Task ` 以下のメソッドを利用してください。
4042
4143``` cs
4244using UnityEngine ;
@@ -61,12 +63,12 @@ public class TaskSample : MonoBehaviour
6163
6264 private async Task <bool > Connect ()
6365 {
64- // サーバに接続
65- var connect = await PhotoTask .ConnectUsingSettings (" v1" );
66+ // Connect to server
67+ var connect = await PhotonTask .ConnectUsingSettings (" v1" );
6668
6769 if (connect .IsFailure )
6870 {
69- // 失敗
71+ // Failure
7072 Debug .LogError (connect .ToFailure .Value );
7173 }
7274
@@ -75,18 +77,18 @@ public class TaskSample : MonoBehaviour
7577
7678 private async Task <bool > JoinRoom ()
7779 {
78- // 適当な部屋に参加する
79- var randomJoined = await PhotoTask .JoinRandomRoom ();
80+ // Join random room
81+ var randomJoined = await PhotonTask .JoinRandomRoom ();
8082
81- // 成功なら終わり
83+ // Success
8284 if (randomJoined .IsSuccess ) return true ;
8385
84- // 部屋を作って参加する
85- var created = await PhotoTask .CreateRoom (" test" , null , null , null );
86+ // Create new room
87+ var created = await PhotonTask .CreateRoom (" test" , null , null , null );
8688
8789 if (! created .IsSuccess )
8890 {
89- // 失敗
91+ // Failure
9092 Debug .LogError (created .ToFailure .Value );
9193 }
9294
@@ -95,9 +97,9 @@ public class TaskSample : MonoBehaviour
9597}
9698```
9799
98- ## 配布ライセンス
100+ ## LICENSE
99101
100- MIT Licenseで公開します
102+ MIT License.
101103
102104
103105## 権利表記
0 commit comments