解决消息处理bug
This commit is contained in:
parent
348552b0bc
commit
939084b074
@ -311,7 +311,7 @@ public class MainController : BaseScene
|
|||||||
MapUDPService.Send(0, App.CurrentUser.Id, new double[]{ 0d,0d}, competitionId: 0);
|
MapUDPService.Send(0, App.CurrentUser.Id, new double[]{ 0d,0d}, competitionId: 0);
|
||||||
//发送消息
|
//发送消息
|
||||||
|
|
||||||
var list = MapUDPService.GetOnlineUserList();
|
var list = MapUDPService.GetAllOnlineUserList();
|
||||||
foreach (var item in list)
|
foreach (var item in list)
|
||||||
{
|
{
|
||||||
if (item.RouteId > 0)
|
if (item.RouteId > 0)
|
||||||
@ -421,6 +421,7 @@ public class MainController : BaseScene
|
|||||||
}
|
}
|
||||||
private void OnDestroy()
|
private void OnDestroy()
|
||||||
{
|
{
|
||||||
|
EventQueueSystem.RemoveListener<LinkedMessageEvent>(LinkedMessageHandler);
|
||||||
App.isHomeChanged -= OnIsHomeChanged;
|
App.isHomeChanged -= OnIsHomeChanged;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -303,7 +303,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<OnlineUser> GetOnlineUserList()
|
public static List<OnlineUser> GetAllOnlineUserList()
|
||||||
{
|
{
|
||||||
var result = onlineUserHelper.OnlineUsers.Where(c => !c.IsSelf).ToList();
|
var result = onlineUserHelper.OnlineUsers.Where(c => !c.IsSelf).ToList();
|
||||||
return result;
|
return result;
|
||||||
@ -325,6 +325,11 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static int GetNearRiderCount()
|
public static int GetNearRiderCount()
|
||||||
|
{
|
||||||
|
return onlineUserHelper.OnlineUsers.Where(c=> (c.Point[0] != 0 && c.Point[1] != 0)|| (c.Point[0] != -1 && c.Point[1] != -1)).Count();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int GetAllOnlineUserCount()
|
||||||
{
|
{
|
||||||
return onlineUserHelper.OnlineUsers.Count();
|
return onlineUserHelper.OnlineUsers.Count();
|
||||||
}
|
}
|
||||||
@ -484,7 +489,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
var list = mes.ToList();
|
var list = mes.ToList();
|
||||||
//去除自己的数据和命令包
|
//去除自己的数据和命令包
|
||||||
//mes.RemoveAll(item => item.MemberId == App.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.RemoveAll(item => item.Point[0] == 0 && item.Point[1] == 0);
|
||||||
//去除重复数据
|
//去除重复数据
|
||||||
list = list.Distinct(new OlineUserComparer()).ToList();
|
list = list.Distinct(new OlineUserComparer()).ToList();
|
||||||
|
|
||||||
|
|||||||
@ -64,6 +64,7 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
Instance.delegates[typeof(T)] = temp;
|
Instance.delegates[typeof(T)] = temp;
|
||||||
}
|
}
|
||||||
Instance.delegateLookup.Remove(del);
|
Instance.delegateLookup.Remove(del);
|
||||||
|
keyList.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,16 +121,15 @@ namespace Assets.Scenes.Ride.Scripts
|
|||||||
return;
|
return;
|
||||||
Instance.eventQueue.Enqueue(e);
|
Instance.eventQueue.Enqueue(e);
|
||||||
}
|
}
|
||||||
static List<string> keyList = new List<string>();
|
private static Dictionary<string,GameEvent> keyList = new Dictionary<string, GameEvent>();
|
||||||
|
|
||||||
public static void QueueEventOnce(GameEvent e,string key)
|
public static void QueueEventOnce(GameEvent e,string key)
|
||||||
{
|
{
|
||||||
if (!Instance.delegates.ContainsKey(e.GetType()))
|
if (!Instance.delegates.ContainsKey(e.GetType()))
|
||||||
return;
|
return;
|
||||||
if (keyList.Contains(key))
|
if (keyList.ContainsKey(key))
|
||||||
return;
|
return;
|
||||||
keyList.Add(key);
|
keyList.Add(key,e);
|
||||||
Debug.Log(126);
|
|
||||||
Instance.eventQueue.Enqueue(e);
|
Instance.eventQueue.Enqueue(e);
|
||||||
}
|
}
|
||||||
float timer = 0.0f;
|
float timer = 0.0f;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user