附近的人逻辑优化&Android进入骑行提示开启定位服务问题修复
This commit is contained in:
parent
99540eb1fd
commit
3a360d3437
@ -23,8 +23,16 @@
|
||||
protected virtual IEnumerator Start()
|
||||
{
|
||||
yield return null;
|
||||
_locationProvider = LocationProviderFactory.Instance.DefaultLocationProvider;
|
||||
_locationProvider.OnLocationUpdated += LocationProvider_OnLocationUpdated; ;
|
||||
//_locationProvider = LocationProviderFactory.Instance.DefaultLocationProvider;
|
||||
//_locationProvider.OnLocationUpdated += LocationProvider_OnLocationUpdated; ;
|
||||
|
||||
var mainController = transform.parent.GetComponent<CyclingController>();
|
||||
if (mainController != null)
|
||||
{
|
||||
//初始化map
|
||||
var point = mainController.GetCenterCoordinate();
|
||||
_map.Initialize(point, _map.AbsoluteZoom);
|
||||
}
|
||||
}
|
||||
|
||||
void LocationProvider_OnLocationUpdated(Unity.Location.Location location)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -32,7 +32,9 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
OnlineUserNum.text = MapUDPService.GetNearRiderCount().ToString();
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(OnlineUserNum.rectTransform);
|
||||
var nearList = MapUDPService.GetNearRiderData(pageIndex, pageSize, new double[] { playerController.Currentlatlong.x, playerController.Currentlatlong.y });
|
||||
totalPages = MapUDPService.GetNearRiderCount();
|
||||
var mod = MapUDPService.GetNearRiderCount() % pageSize;
|
||||
var pages = MapUDPService.GetNearRiderCount() / pageSize;
|
||||
totalPages = mod > 0 ? pages + 1: pages;
|
||||
//删除
|
||||
var currentNearList = FindObjectsOfType<NearByItemScript>();
|
||||
foreach (var item in currentNearList)
|
||||
@ -40,7 +42,8 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var e = nearList.Where(c => c.Id == item.UserId).FirstOrDefault();
|
||||
if (e == null)
|
||||
{
|
||||
item.transform.gameObject.SetActive(false);
|
||||
//item.transform.gameObject.SetActive(false);
|
||||
item.Dispose();
|
||||
bufferSize--;
|
||||
}
|
||||
}
|
||||
@ -50,6 +53,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Create(nearList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void Create(NearRiderModel item)
|
||||
{
|
||||
|
||||
@ -129,5 +129,10 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
_userId = userId;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
UnityEngine.Object.DestroyImmediate(this.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user