找回密码
 立即注册
查看: 4543|回复: 65

[脚本] 这是ios手机上的代码,没解读出来是什么意思?

[复制链接]
发表于 2012-12-5 21:06 | 显示全部楼层 |阅读模式
  1. using UnityEngine;
  2. using System.Collections.Generic;


  3. public class CoreLocationGUIManager : MonoBehaviour
  4. {
  5.     public GUIText text1;
  6.     public GUIText text2;
  7.    
  8.     public GUIText text3;
  9.     public GUIText text4;
  10.     int modulous = 0;
  11.    
  12.    
  13.     void Start()
  14.     {
  15.         // kill the dang keyboard frame
  16.         iPhoneKeyboard.autorotateToPortrait = false;
  17.         iPhoneKeyboard.autorotateToPortraitUpsideDown = false;
  18.         iPhoneKeyboard.autorotateToLandscapeRight = false;
  19.         iPhoneKeyboard.autorotateToLandscapeLeft = false;
  20.         
  21.         // listen for location changes
  22.         CoreLocationManager.locationServicesDidUpdate += locationServicesDidUpdate;
  23.     }
  24.    
  25.    
  26.     public void locationServicesDidUpdate( CoreLocationData locationData )
  27.     {
  28.         Debug.Log( "locationServicesDidUpdate event: " + locationData );
  29.         
  30.         text1.text = locationData.latitude.ToString();
  31.         text2.text = locationData.longitude.ToString();
  32.     }
  33.    
  34.    
  35.     void Update()
  36.     {
  37.         // only grab the compass data every 10 frames
  38.         if( modulous++ % 10 == 0 )
  39.         {
  40.             text3.text = CoreLocationBinding.getMagneticHeading().ToString();
  41.             text4.text = CoreLocationBinding.getTrueHeading().ToString();
  42.         }
  43.     }
  44.    
  45.    
  46.     void OnGUI()
  47.     {
  48.         float yPos = 10.0f;
  49.         float xPos = 20.0f;
  50.         float width = 160.0f;

  51.         
  52.         if( GUI.Button( new Rect( xPos, yPos, width, 40 ), "Is Compass Avaialble?" ) )
  53.         {
  54.             bool compassAvailable = CoreLocationBinding.isCompassAvailable();
  55.             Debug.Log( "CoreMotion isCompassAvailable: " + compassAvailable );
  56.         }
  57.         
  58.         
  59.         if( GUI.Button( new Rect( xPos, yPos += 50, width, 40 ), "Set Distance Filter to 10" ) )
  60.         {
  61.             CoreLocationBinding.setDistanceFilter( 10 );
  62.         }
  63.         
  64.         
  65.         if( GUI.Button( new Rect( xPos, yPos += 50, width, 40 ), "Set Heading Filter to 3" ) )
  66.         {
  67.             CoreLocationBinding.setHeadingFilter( 3 );
  68.         }
  69.         
  70.         
  71.         if( GUI.Button( new Rect( xPos, yPos += 50, width, 40 ), "Start Updating Location" ) )
  72.         {
  73.             CoreLocationBinding.startUpdatingLocation();
  74.         }
  75.         
  76.         
  77.         if( GUI.Button( new Rect( xPos, yPos += 50, width, 40 ), "Stop Updating Location" ) )
  78.         {
  79.             CoreLocationBinding.stopUpdatingLocation();
  80.         }
  81.         
  82.         
  83.         // Second column
  84.         xPos += xPos + width;
  85.         yPos = 10.0f;
  86.         
  87.         if( GUI.Button( new Rect( xPos, yPos, width, 40 ), "Start Updating Heading" ) )
  88.         {
  89.             CoreLocationBinding.startUpdatingHeading();
  90.         }
  91.         

  92.         if( GUI.Button( new Rect( xPos, yPos += 50, width, 40 ), "Stop Updating Heading" ) )
  93.         {
  94.             CoreLocationBinding.stopUpdatingHeading();
  95.         }
  96.    
  97.     }


  98. }

复制代码
start中是对 横竖屏的控制下面就不知道了,谁测试下

没做过ios 所以不大懂

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
发表于 2017-5-8 12:36 | 显示全部楼层
好帖就是要顶
发表于 2017-5-8 12:48 | 显示全部楼层
说的非常好
发表于 2017-5-8 12:30 | 显示全部楼层
很好哦
发表于 2017-5-8 12:47 | 显示全部楼层
不错不错
发表于 2017-5-8 13:11 | 显示全部楼层
LZ真是人才
发表于 2017-5-16 11:04 | 显示全部楼层
很不错
发表于 2017-5-16 11:22 | 显示全部楼层
顶顶多好
发表于 2017-5-16 11:50 | 显示全部楼层
真心顶
发表于 2017-5-16 11:52 | 显示全部楼层
难得一见的好帖
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-4-29 21:16 , Processed in 0.104650 second(s), 26 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表