private void GetLocationInfo() { _nReqAmapLocationCount++; string sError = "第" + _nReqAmapLocationCount + "次定位!"; Debug.Log(sError); #if UNITY_ANDROID AMapLocationInfo amap = AMapLocation.Instance.GetAmapLocationInfo(); if (amap.NErrorCode == 0) { StringBuilder sb = new StringBuilder(); string sErrorCode = "错误码为:" + amap.NErrorCode + "\n"; Debug.Log("错误码为:" + sErrorCode); string sIdAddr = "地址为:" + amap.SIdAddr + "\n"; Debug.Log("地址为:" + sIdAddr); string sCountry = "国家为:" + amap.SCountry + "\n"; Debug.Log("国家为:" + sCountry); string sProvince = "省份为:" + amap.SProvince + "\n"; Debug.Log("省份为:" + sProvince); string sCity = "城市为:" + amap.SCity + "\n"; Debug.Log("城市为:" + sCity); string sDistrict = "城区为:" + amap.SDistrict + "\n"; Debug.Log("城区为:" + sDistrict); string sStreet = "街道为:" + amap.SStreet + "\n"; Debug.Log("街道为:" + sStreet); string sStreetNum = "街道牌号为:" + amap.SStreetNum + "\n"; Debug.Log("街道牌号为:" + sStreetNum); string sCityCode = "城市编码为:" + amap.SCityCode + "\n"; Debug.Log("城市编码为:" + sCityCode); string sAdCode = "地区编码为:" + amap.SAdCode + "\n"; Debug.Log("地区编码为:" + sAdCode); string sAoiInfo = "定位AOI信息为:" + amap.SAoiInfo + "\n"; Debug.Log("定位AOI信息为:" + sAoiInfo); string sLongitudes = "经度为:" + amap.Longitude + "\n"; Debug.Log("经度为:" + sLongitudes); string sLatitudes = "纬度为:" + amap.Latitude + "\n"; Debug.Log("纬度为:" + sLatitudes); sb.Append(sIdAddr); sb.Append(sCountry); sb.Append(sProvince); sb.Append(sCity); sb.Append(sDistrict); sb.Append(sStreet); sb.Append(sStreetNum); sb.Append(sCityCode); sb.Append(sAdCode); sb.Append(sAoiInfo); sb.Append(sLongitudes); sb.Append(sLatitudes); if (sIdAddr.Contains("未找到地址")) { Player.Instance.Address = "未找到地址!请检查定位信息..."; StartAmapLocation(); } else { Player.Instance.Address = amap.SIdAddr; //发送定位信息 ClientToServerMsg.SetAdrress(amap.SIdAddr); } } else { GameData.Tips = ((ErrorMessage)amap.NErrorCode).ToString(); UIManager.Instance.ShowUiPanel(UIPaths.PanelTips, OpenPanelType.MinToMax); SoundManager.Instance.PlaySound(UIPaths.SOUND_BUTTON); Debug.Log(((ErrorMessage)amap.NErrorCode).ToString()); } #endif }