Inheritance: PhotonPeer, IDisposable
Example #1
0
 public static void AddConnection(ObservablePhotonPeer peer)
 {
     connectionInfos.Add(new ConnectionInfoViewModel(peer)
     {
         FoldOut = true
     });
 }
Example #2
0
        public static void Initialize(TestContext cx)
        {
            Peer = new ObservablePhotonPeer(ExitGames.Client.Photon.ConnectionProtocol.Tcp)
            {
                Timeout = TimeSpan.FromSeconds(5)
            };
            var task = Peer.ConnectAsync("127.0.0.1:4530", "ServerApp");

            task.Wait(); // wait for timeout seconds...
        }
Example #3
0
    // Update is called once per frame
    void Update()
    {
        var peer = new ObservablePhotonPeer(ExitGames.Client.Photon.ConnectionProtocol.Tcp, "Test", 20);

        var proxy = peer.CreateTypedHub<SimpleHubProxy>();
            
        
        

        proxy.AttachInvokeFilter(x => new MogeMoge1(x));
        proxy.AttachInvokeFilter(x => new MogeMoge2(x));
        proxy.AttachReceiveFilter(x => new NugaNuga1(x));

        proxy.Publish.ToClient(100, 2000);

        proxy.Receive.ToClient().Subscribe(_ => { });




    }
Example #4
0
            public ConnectionInfoViewModel(ObservablePhotonPeer peer)
            {
                this.MaxSize = "0B";
                this.MaxSent = "0B";
                this.MaxReceived = "0B";
                this.Peer = new WeakReference(peer);
                this.GraphList = new CircularBuffer<UniRx.Tuple<int, int>>(lastWidth);

                var interval = TimeSpan.FromMilliseconds(100);

                var send = peer.ObserveSendOpCustom().Select(x => GetSize(x)).Buffer(interval, Scheduler.ThreadPool);
                var sendReceive = peer.ObserveOperationResponse().Select(x => GetSize(x.OperationResponse.Parameters)).Buffer(interval, Scheduler.ThreadPool);
                var receive = peer.ObserveReceiveEventData().Select(x => GetSize(x.Parameters)).Buffer(interval, Scheduler.ThreadPool);

                subscription = Observable.Zip(send, sendReceive, receive, (x, y, z) => Tuple.Create(x.Sum(), y.Sum() + z.Sum()))
                    .Subscribe(x =>
                    {
                        lock (GraphListLock)
                        {
                            TotalSent += x.Item1;
                            TotalReceived += x.Item2;
                            GraphList.Enqueue(x);
                        }
                    });
            }