附近的人
This commit is contained in:
1 parent
725b510748
commit
2fcd9b23fa
94 files changed
+7063
-2007
No files matched your search
@@ -100,7 +100,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
/// </summary>
|
||||
private static void SendHeartbeat()
|
||||
{
|
||||
Send(0, PubCommData.CurrentUser.Id, new double[] { 0, 0 }, false, false, 0, true, 0);
|
||||
Send(0, App.CurrentUser.Id, new double[] { 0, 0 }, false, false, 0, true, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
if (MapUDPService._udpService == null) return;
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Send(0, PubCommData.CurrentUser.Id, new double[] { 1, 1 }, true, isExit);
|
||||
Send(0, App.CurrentUser.Id, new double[] { 1, 1 }, true, isExit);
|
||||
}
|
||||
_udpService.Close();
|
||||
|
||||
@@ -199,12 +199,15 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static int GetNearRiderCount()
|
||||
{
|
||||
return onlineUserHelper.OnlineUsers.Count();
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取附近的人(当前在线的所有人)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static object GetNearRiderData(int pageIndex, int pageSize = 5, double[] point = null)
|
||||
public static IList<NearRiderModel> GetNearRiderData(int pageIndex, int pageSize = 5, double[] point = null)
|
||||
{
|
||||
if (point == null) return null;
|
||||
|
||||
@@ -212,7 +215,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
var allOnlineUsers = onlineUserHelper.OnlineUsers;
|
||||
foreach (var item in allOnlineUsers)
|
||||
{
|
||||
if (item.Id == PubCommData.CurrentUser.Id)
|
||||
if (item.Id == App.CurrentUser.Id)
|
||||
{
|
||||
dict.Add(new Tuple<double, OnlineUser>(0, item));
|
||||
continue;
|
||||
@@ -233,15 +236,16 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
Near = n.Item1, //Math.Round(TurfHelper.GetDistances(point, n.Point) / 1000, 2),
|
||||
KGWeight = n.Item2.WeightKg.ToString(),
|
||||
Speed = Math.Round(n.Item2.Speed, 1),
|
||||
CountryImg = ConfigHelper.Host + $"User/GetCountryImg?userid={n.Item2.Id}",
|
||||
IsSelf = n.Item2.IsSelf
|
||||
});
|
||||
|
||||
return new
|
||||
{
|
||||
NearData = nearData,
|
||||
PageCount = (int)Math.Ceiling((double)allList.Count() / pageSize)
|
||||
};
|
||||
CountryImg = App.Host + $"User/GetCountryImg?userid={n.Item2.Id}",
|
||||
IsSelf = n.Item2.IsSelf,
|
||||
Id = n.Item2.Id
|
||||
}).ToList();
|
||||
return nearData;
|
||||
//return new
|
||||
//{
|
||||
// NearData = nearData,
|
||||
// PageCount = (int)Math.Ceiling((double)allList.Count() / pageSize)
|
||||
//};
|
||||
}
|
||||
|
||||
|
||||
@@ -322,7 +326,7 @@ namespace Assets.Scenes.Ride.Scripts
|
||||
{
|
||||
var list = mes.ToList();
|
||||
//去除自己的数据和命令包
|
||||
//mes.RemoveAll(item => item.MemberId == PubCommData.CurrentUser.Id || item.Point[0] == 0);
|
||||
//mes.RemoveAll(item => item.MemberId == App.CurrentUser.Id || item.Point[0] == 0);
|
||||
list.RemoveAll(item => item.Point[0] == 0 && item.Point[1] == 0);
|
||||
//去除重复数据
|
||||
list = list.Distinct(new OlineUserComparer()).ToList();
|
||||
|
||||
Reference in new issue
Block a user