public override void ControllerCancelled(GKPeerPickerController picker)
        {
#if DEBUG
            Console.WriteLine("ControllerCancelled");
#endif
            picker.Delegate = null;
        }
Beispiel #2
0
        public static AvailableNetworkSessionCollection Find(
            NetworkSessionType sessionType,
            int maxLocalGamers,
            NetworkSessionProperties searchProperties
            )
        {
            try
            {
                if (maxLocalGamers < 1 || maxLocalGamers > 4)
                {
                    throw new ArgumentOutOfRangeException("maxLocalGamers must be between 1 and 4.");
                }

                networkSessionType = sessionType;

                GKPeerPickerController peerPickerController = new GKPeerPickerController();
                peerPickerController.Delegate = new MonoGamePeerPickerControllerDelegate(gkSession, ReceiveData);
                if (sessionType == NetworkSessionType.SystemLink)
                {
                    peerPickerController.ConnectionTypesMask = GKPeerPickerConnectionType.Nearby;
                }
                else if (sessionType == NetworkSessionType.PlayerMatch)
                {
                    peerPickerController.ConnectionTypesMask = GKPeerPickerConnectionType.Nearby | GKPeerPickerConnectionType.Online;
                }
                peerPickerController.Show();
                List <AvailableNetworkSession> availableNetworkSessions = new List <AvailableNetworkSession>();

                return(new AvailableNetworkSessionCollection(availableNetworkSessions));
            }
            finally
            {
            }
        }
        public override void ConnectionTypeSelected(GKPeerPickerController picker, GKPeerPickerConnectionType type)
        {
            Console.WriteLine("User Selected a ConnectionType of : " + type);
            if (type == GKPeerPickerConnectionType.Online)
            {
                picker.Dismiss();
                picker.Delegate = null;

                // Implement your own internet user interface here.
            }
        }
 void ShowPeerPicker ()
 {
     _session = new GKSession ("com.lmt.gkchat2", UIDevice.CurrentDevice.Name, GKSessionMode.Peer);
     _session.ReceiveData += (s, e) => { AddToChatHistory (NSString.FromData (e.Data, NSStringEncoding.UTF8).ToString ()); };
     _session.ConnectionRequest += (s, e) => { e.Session.AcceptConnection (e.PeerID, IntPtr.Zero); };
     
     _peerPickerController = new GKPeerPickerController ();
     _peerPickerController.Delegate = new PeerPickerDelegate (this);
     _peerPickerController.ConnectionTypesMask = GKPeerPickerConnectionType.Nearby;
     _peerPickerController.Show ();
 }
Beispiel #5
0
            public override void PeerConnected(GKPeerPickerController picker, string peerId, GKSession toSession)
            {
                _controller._session = toSession;

                picker.Dismiss();
                picker.Delegate = null;

                //just disabling button once connection is made for simplicity

                _controller.chatJoin.Enabled = false;
            }
Beispiel #6
0
        void ShowPeerPicker()
        {
            _session                    = new GKSession("com.lmt.gkchat2", UIDevice.CurrentDevice.Name, GKSessionMode.Peer);
            _session.ReceiveData       += (s, e) => { AddToChatHistory(NSString.FromData(e.Data, NSStringEncoding.UTF8).ToString()); };
            _session.ConnectionRequest += (s, e) => { e.Session.AcceptConnection(e.PeerID, IntPtr.Zero); };

            _peerPickerController                     = new GKPeerPickerController();
            _peerPickerController.Delegate            = new PeerPickerDelegate(this);
            _peerPickerController.ConnectionTypesMask = GKPeerPickerConnectionType.Nearby;
            _peerPickerController.Show();
        }
Beispiel #7
0
            public override void PeerConnected(GKPeerPickerController picker, string peerId, GKSession toSession)
            {
                _controller.GameKitSession = toSession;

                picker.Dismiss();
                picker.Delegate = null;

                //just disabling once connection is made for simplicity
                _controller.joinButton.Title   = "Connected";
                _controller.joinButton.Enabled = false;
            }
Beispiel #8
0
        void ShowPeerPicker()
        {
            GameKitSession = new GKSession ("com.mikebluestein.gamekitchat", UIDevice.CurrentDevice.Name, GKSessionMode.Peer);
            GameKitSession.ReceiveData += (s, e) => { AddMessage (NSString.FromData (e.Data, NSStringEncoding.UTF8).ToString ()); };
            GameKitSession.ConnectionRequest += (s, e) => { e.Session.AcceptConnection (e.PeerID, IntPtr.Zero); };

            GKPeerPickerController peerPickerController = new GKPeerPickerController ();
            peerPickerController.Delegate = new PeerPickerDelegate (this);
            peerPickerController.ConnectionTypesMask = GKPeerPickerConnectionType.Nearby;
            peerPickerController.Show ();
        }
Beispiel #9
0
        void ShowPeerPicker()
        {
            GameKitSession                    = new GKSession("com.mikebluestein.gamekitchat", UIDevice.CurrentDevice.Name, GKSessionMode.Peer);
            GameKitSession.ReceiveData       += (s, e) => { AddMessage(NSString.FromData(e.Data, NSStringEncoding.UTF8).ToString()); };
            GameKitSession.ConnectionRequest += (s, e) => { e.Session.AcceptConnection(e.PeerID, IntPtr.Zero); };

            GKPeerPickerController peerPickerController = new GKPeerPickerController();

            peerPickerController.Delegate            = new PeerPickerDelegate(this);
            peerPickerController.ConnectionTypesMask = GKPeerPickerConnectionType.Nearby;
            peerPickerController.Show();
        }
        public override void ConnectionTypeSelected(GKPeerPickerController picker, GKPeerPickerConnectionType type)
        {
            Console.WriteLine( "User Selected a ConnectionType of : " + type);
            if (type == GKPeerPickerConnectionType.Online)
            {

                picker.Dismiss();
                picker.Delegate = null;

               			// Implement your own internet user interface here.

            }
        }
Beispiel #11
0
        void ShowPeerPicker ()
        {
            _gkSession = new GKSession ("com.lmt.gkvoicechat", UIDevice.CurrentDevice.Name, GKSessionMode.Peer);

            _gkSession.ReceiveData += delegate(object sender, GKDataReceivedEventArgs e) { 
                GKVoiceChatService.Default.ReceivedData (e.Data, e.PeerID); 
            };          
            
            _gkSession.ConnectionRequest += delegate(object sender, GKPeerConnectionEventArgs e) {         
                e.Session.AcceptConnection (e.PeerID, IntPtr.Zero);
            };
            
            GKPeerPickerController peerPickerController = new GKPeerPickerController ();
            peerPickerController.Delegate = new PeerPickerDelegate (this);
            peerPickerController.ConnectionTypesMask = GKPeerPickerConnectionType.Nearby;
            peerPickerController.Show ();
        }
        /*public override GKSession GetSession(GKPeerPickerController picker, GKPeerPickerConnectionType forType)
         * {
         *      Console.WriteLine( "GetSession" );
         *
         *      return gkSession;
         * }*/

        public override void PeerConnected(GKPeerPickerController picker, string peerId, GKSession toSession)
        {
            Console.WriteLine("Peer ID " + peerId + " Connected to Session ID : " + toSession.SessionID);

            // Use a retaining property to take ownership of the session.
            this.gkSession = toSession;

            // Assumes our object will also become the session's delegate.
            gkSession.Delegate     = new MonoGameSessionDelegate();
            gkSession.ReceiveData += new EventHandler <GKDataReceivedEventArgs>(receivedData);

            picker.Dismiss();

            // Remove the picker.
            picker.Delegate = null;

            // Start your game.
        }
Beispiel #13
0
        public static void ShowPeerPicker(GKPeerPickerControllerDelegate aPeerPickerControllerDelegate)
        {
            if ((Gamer.SignedInGamers.Count > 0) && (Gamer.SignedInGamers[0].IsSignedInToLive))
            {
                // Lazy load it
                if (peerPickerController == null)
                {
                    peerPickerController = new GKPeerPickerController();
                }

                if (peerPickerController != null)
                {
                    peerPickerController.ConnectionTypesMask = GKPeerPickerConnectionType.Nearby;
                    peerPickerController.Delegate            = aPeerPickerControllerDelegate;
                    peerPickerController.Show();
                }
            }
        }
Beispiel #14
0
        void ShowPeerPicker()
        {
            _gkSession = new GKSession("com.lmt.gkvoicechat", UIDevice.CurrentDevice.Name, GKSessionMode.Peer);

            _gkSession.ReceiveData += delegate(object sender, GKDataReceivedEventArgs e) {
                GKVoiceChatService.Default.ReceivedData(e.Data, e.PeerID);
            };

            _gkSession.ConnectionRequest += delegate(object sender, GKPeerConnectionEventArgs e) {
                e.Session.AcceptConnection(e.PeerID, IntPtr.Zero);
            };

            GKPeerPickerController peerPickerController = new GKPeerPickerController();

            peerPickerController.Delegate            = new PeerPickerDelegate(this);
            peerPickerController.ConnectionTypesMask = GKPeerPickerConnectionType.Nearby;
            peerPickerController.Show();
        }
Beispiel #15
0
 public override void PeerConnected (GKPeerPickerController picker, string peerId, GKSession toSession)
 {
     _controller._gkSession = toSession;
     
     picker.Dismiss ();
     picker.Delegate = null;
     
     _controller.joinButton.Title = "Connected";
     _controller.joinButton.Enabled = false;
        
     AVAudioSession audioSession = AVAudioSession.SharedInstance ();
     NSError error;
     audioSession.SetCategory (AVAudioSession.CategoryPlayAndRecord.ToString (), out error);
     audioSession.SetActive (true, out error);
     _controller._vcClient = new MyVoiceChatClient (_controller._gkSession);
     GKVoiceChatService.Default.Client = _controller._vcClient;
     GKVoiceChatService.Default.StartVoiceChat (peerId, IntPtr.Zero);
 }
Beispiel #16
0
            public override void PeerConnected(GKPeerPickerController picker, string peerId, GKSession toSession)
            {
                _controller._gkSession = toSession;

                picker.Dismiss();
                picker.Delegate = null;

                _controller.joinButton.Title   = "Connected";
                _controller.joinButton.Enabled = false;

                AVAudioSession audioSession = AVAudioSession.SharedInstance();
                NSError        error;

                audioSession.SetCategory(AVAudioSession.CategoryPlayAndRecord.ToString(), out error);
                audioSession.SetActive(true, out error);
                _controller._vcClient             = new MyVoiceChatClient(_controller._gkSession);
                GKVoiceChatService.Default.Client = _controller._vcClient;
                GKVoiceChatService.Default.StartVoiceChat(peerId, IntPtr.Zero);
            }
Beispiel #17
0
		public static void ShowPeerPicker(GKPeerPickerControllerDelegate aPeerPickerControllerDelegate)
		{
			AssertInitialised ();

			if ( ( Gamer.SignedInGamers.Count > 0 ) && ( Gamer.SignedInGamers[0].IsSignedInToLive ) )
			{
				// Lazy load it
				if ( peerPickerController == null )
				{
					peerPickerController = new GKPeerPickerController();
				}

			    if (peerPickerController != null)		
			    {			
					peerPickerController.ConnectionTypesMask = GKPeerPickerConnectionType.Nearby;
					peerPickerController.Delegate = aPeerPickerControllerDelegate;
					peerPickerController.Show();					
			    }
			}
		}
 public override void ControllerCancelled(GKPeerPickerController picker)
 {
     Console.WriteLine( "ControllerCancelled");
     picker.Delegate = null;
 }
Beispiel #19
0
 public override void ControllerCancelled(GKPeerPickerController picker)
 {
     picker.Delegate = null;
 }
        /*public override GKSession GetSession(GKPeerPickerController picker, GKPeerPickerConnectionType forType)
        {
            Console.WriteLine( "GetSession" );

            return gkSession;
        }*/
        public override void PeerConnected(GKPeerPickerController picker, string peerId, GKSession toSession)
        {
            Console.WriteLine( "Peer ID " + peerId + " Connected to Session ID : " + toSession.SessionID );

            // Use a retaining property to take ownership of the session.
            this.gkSession = toSession;

            // Assumes our object will also become the session's delegate.
            gkSession.Delegate = new MonoGameSessionDelegate();
            gkSession.ReceiveData += new EventHandler<GKDataReceivedEventArgs>(receivedData);

            picker.Dismiss();

            // Remove the picker.
            picker.Delegate = null;

            // Start your game.
        }
 public override void PeerConnected (GKPeerPickerController picker, string peerId, GKSession toSession)
 {
     _controller._session = toSession;
     
     picker.Dismiss ();
     picker.Delegate = null;
     
     //just disabling button once connection is made for simplicity
     
     _controller.chatJoin.Enabled = false;
 }
 public override GKSession GetSession (GKPeerPickerController picker, GKPeerPickerConnectionType forType)
 {
     return _controller._session;
 }
Beispiel #23
0
 public override GKSession GetSession(GKPeerPickerController picker, GKPeerPickerConnectionType forType)
 {
     return(_controller._session);
 }
 public override void ControllerCancelled (GKPeerPickerController picker)
 {
     picker.Delegate = null;
 }
Beispiel #25
0
        public static AvailableNetworkSessionCollection Find(
            NetworkSessionType sessionType,
            int maxLocalGamers,
            NetworkSessionProperties searchProperties
            )
        {
            try
            {
                if ( maxLocalGamers < 1 ||   maxLocalGamers > 4 )
                    throw new ArgumentOutOfRangeException( "maxLocalGamers must be between 1 and 4." );

                networkSessionType = sessionType;

                GKPeerPickerController peerPickerController = new GKPeerPickerController();
                peerPickerController.Delegate = new MonoGamePeerPickerControllerDelegate(gkSession, ReceiveData);
                if ( sessionType == NetworkSessionType.SystemLink )
                {
                 	peerPickerController.ConnectionTypesMask = GKPeerPickerConnectionType.Nearby;
                }
                else if ( sessionType == NetworkSessionType.PlayerMatch )
                {
                    peerPickerController.ConnectionTypesMask = GKPeerPickerConnectionType.Nearby | GKPeerPickerConnectionType.Online;
                }
                peerPickerController.Show();
                List<AvailableNetworkSession> availableNetworkSessions = new List<AvailableNetworkSession>();

                return new AvailableNetworkSessionCollection( availableNetworkSessions );
            }
            finally
            {
            }
        }
Beispiel #26
0
            public override void PeerConnected(GKPeerPickerController picker, string peerId, GKSession toSession)
            {
                _controller.GameKitSession = toSession;

                picker.Dismiss ();
                picker.Delegate = null;

                //just disabling once connection is made for simplicity
                _controller.joinButton.Title = "Connected";
                _controller.joinButton.Enabled = false;
            }