private void DoAuthentication()
        {
            try
            {
                if (UIDevice.CurrentDevice.CheckSystemVersion(4, 1))
                {
                    UIApplication.SharedApplication.BeginInvokeOnMainThread(delegate
                    {
                        lp = GKLocalPlayer.LocalPlayer;

                        if (lp != null)
                        {
                            if (!UIDevice.CurrentDevice.CheckSystemVersion(6, 0))
                            {
                                #pragma warning disable 618
                                // Game Center authentication for iOS 5 and older
                                lp.Authenticate(delegate(NSError error)
                                {
                                    #if DEBUG
                                    if (error != null)
                                    {
                                        Console.WriteLine(error);
                                    }
                                    #endif
                                });
                                #pragma warning restore 618
                            }
                            else
                            {
                                // Game Center authentication for iOS 6+
                                lp.AuthenticateHandler = delegate(UIViewController controller, NSError error)
                                {
                                    #if DEBUG
                                    if (error != null)
                                    {
                                        Console.WriteLine(error);
                                    }
                                    #endif

                                    if (controller != null)
                                    {
                                        ((UIViewController)Game.Instance.Services.GetService(typeof(UIViewController))).PresentViewController(controller, true, null);
                                    }
                                };
                            }
                        }
                    });
                }
            }
            #if DEBUG
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            #else
            catch
            {
            }
            #endif
        }
Esempio n. 2
0
        private void DoAuthentication()
        {
            try
            {
                var osVersion = UIDevice.CurrentDevice.SystemVersion;
                if (osVersion.Contains("."))
                {
                    if (osVersion.IndexOf(".") != osVersion.LastIndexOf("."))
                    {
                        var parts = osVersion.Split(char.Parse("."));
                        osVersion = parts[0] + "." + parts[1];
                    }
                }

                if (double.Parse(osVersion, System.Globalization.CultureInfo.InvariantCulture) > 4.1)
                {
                    UIApplication.SharedApplication.BeginInvokeOnMainThread(
                        delegate
                    {
                        lp = GKLocalPlayer.LocalPlayer;

                        if (lp != null)
                        {
                            Guide.IsVisible = true;
                            lp.Authenticate(delegate(NSError error)
                            {
                                try
                                {
                                    if (error != null)
                                    {
#if DEBUG
                                        Console.WriteLine(error);
#endif
                                    }
                                    else
                                    {
                                    }
                                }
                                finally
                                {
                                    Guide.IsVisible = false;
                                }
                            }
                                            );
                        }
                    });
                }
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.WriteLine(ex.Message);
#endif
            }
        }
Esempio n. 3
0
        private void DoAuthentication()
        {
            try
            {
                if (UIDevice.CurrentDevice.CheckSystemVersion(4, 1))
                {
                    UIApplication.SharedApplication.BeginInvokeOnMainThread(delegate
                    {
                        lp = GKLocalPlayer.LocalPlayer;
                    
                        if (lp != null)
                        {
                            if (!UIDevice.CurrentDevice.CheckSystemVersion(6, 0))
                            {
                                #pragma warning disable 618
                                // Game Center authentication for iOS 5 and older
                                lp.Authenticate(delegate(NSError error)
                                {
                                    #if DEBUG
                                    if (error != null)
                                        Console.WriteLine(error);
                                    #endif
                                });
                                #pragma warning restore 618
                            }
                            else
                            {
                                // Game Center authentication for iOS 6+
                                lp.AuthenticateHandler = delegate(UIViewController controller, NSError error)
                                {
                                    #if DEBUG
                                    if (error != null)
                                        Console.WriteLine(error);
                                    #endif

                                    if (controller != null)
                                        ((UIViewController)Game.Instance.Services.GetService(typeof(UIViewController))).PresentViewController(controller, true, null);
                                };
                            }
                        }
                    });
                }
            }
            #if DEBUG
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            #else
            catch
            {
            }
            #endif
        }
Esempio n. 4
0
        private void DoAuthentication()
        {
            try
            {
                var osVersion = UIDevice.CurrentDevice.SystemVersion;
                if (osVersion.Contains("."))
                {
                    if (osVersion.IndexOf(".") != osVersion.LastIndexOf("."))
                    {
                        var parts = osVersion.Split(char.Parse("."));
                        osVersion = parts[0] + "." + parts[1];
                    }
                }

                if (double.Parse(osVersion) > 4.1)
                {
                    lp = GKLocalPlayer.LocalPlayer;
                    if (lp != null)
                    {
                        Guide.IsVisible = true;
                        lp.Authenticate(delegate(NSError error)
                        {
                            try
                            {
                                if (error != null)
                                {
                                    Console.WriteLine(error);
                                }
                                else
                                {
                                }
                            }
                            finally
                            {
                                Guide.IsVisible = false;
                            }
                        }
                                        );
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
		private void DoAuthentication()
		{
			try 				
			{
				var osVersion = UIDevice.CurrentDevice.SystemVersion;
				if(osVersion.Contains("."))
				if(osVersion.IndexOf(".") != osVersion.LastIndexOf("."))
				{
					var parts = osVersion.Split(char.Parse("."));
					osVersion = parts[0] + "." + parts[1];
				}
				
				if (double.Parse(osVersion) > 4.1)
				{
					
					lp = GKLocalPlayer.LocalPlayer;
			        if (lp != null)
					{
						lp.Authenticate( delegate(NSError error) 
						                	{  							              
												try 
												{
													if ( error != null )
													{
														Console.WriteLine(error);
													}
													else
													{
														
													}
												} 
												finally 
												{
													
												}
											}
						                );
					}
				}
			}
			catch (Exception ex) 
			{
				Console.WriteLine(ex.Message);
			}
		}
 private void DoAuthentication()
 {
     try
     {
         var verArray = UIDevice.CurrentDevice.SystemVersion.Split(new char[] { '.' });
         if ((int.Parse(verArray[0]) >= 4) &&
             (int.Parse(verArray[1]) >= 1))
         {
             lp = GKLocalPlayer.LocalPlayer;
             if (lp != null)
             {
                 Guide.IsVisible = true;
                 lp.Authenticate(delegate(NSError error)
                 {
                     try
                     {
                         if (error != null)
                         {
                         }
                         else
                         {
                         }
                     }
                     finally
                     {
                         Guide.IsVisible = false;
                     }
                 }
                                 );
             }
         }
     }
     catch (Exception)
     {
     }
 }
Esempio n. 7
0
		private void DoAuthentication()
		{
			try 
			{
				var verArray = UIDevice.CurrentDevice.SystemVersion.Split( new char[] {'.'} );
				if ( (int.Parse(verArray[0]) >= 4)
				&& (int.Parse(verArray[1]) >= 1) )
				{
					
					lp = GKLocalPlayer.LocalPlayer;
			        if (lp != null)
					{
						Guide.IsVisible = true;
						lp.Authenticate( delegate(NSError error) 
						                	{  							              
												try 
												{
													if ( error != null )
													{
									
													}
													else
													{
														
													}
												} 
												finally 
												{
													Guide.IsVisible = false;
												}
											}
						                );
					}
				}
			}
			catch (Exception) 
			{
				
			}
		}
		private void DoAuthentication()
		{
			try 				
			{
				var osVersion = UIDevice.CurrentDevice.SystemVersion;
				if(osVersion.Contains("."))
				if(osVersion.IndexOf(".") != osVersion.LastIndexOf("."))
				{
					var parts = osVersion.Split(char.Parse("."));
					osVersion = parts[0] + "." + parts[1];
				}
				
				if (double.Parse(osVersion, System.Globalization.CultureInfo.InvariantCulture) > 4.1)
				{
                    UIApplication.SharedApplication.BeginInvokeOnMainThread(
                    delegate 
                    {
                        lp = GKLocalPlayer.LocalPlayer;
                        
    			        if (lp != null)
    					{
    						lp.Authenticate( delegate(NSError error) 
    						                	{  	
#if DEBUG
    												if ( error != null )								
    													Console.WriteLine(error);
#endif
    											}
    						                );
    					}
                    } );
				}
			}
			catch (Exception ex) 
			{
#if DEBUG				
				Console.WriteLine(ex.Message);
#endif
			}
		}