|
@@ -16,14 +16,14 @@ namespace ET.Server
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public static async ETTask Match(this MatchComponent self, (long, long) playerInfo)
|
|
|
|
|
|
|
+ public static async ETTask Match(this MatchComponent self, long playerId)
|
|
|
{
|
|
{
|
|
|
- if (self.waitMatchPlayers.Contains(playerInfo))
|
|
|
|
|
|
|
+ if (self.waitMatchPlayers.Contains(playerId))
|
|
|
{
|
|
{
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- self.waitMatchPlayers.Add(playerInfo);
|
|
|
|
|
|
|
+ self.waitMatchPlayers.Add(playerId);
|
|
|
|
|
|
|
|
if (self.waitMatchPlayers.Count < ConstValue.MatchCount)
|
|
if (self.waitMatchPlayers.Count < ConstValue.MatchCount)
|
|
|
{
|
|
{
|
|
@@ -32,19 +32,19 @@ namespace ET.Server
|
|
|
|
|
|
|
|
// 申请一个房间
|
|
// 申请一个房间
|
|
|
StartSceneConfig startSceneConfig = RandomGenerator.RandomArray(StartSceneConfigCategory.Instance.Maps);
|
|
StartSceneConfig startSceneConfig = RandomGenerator.RandomArray(StartSceneConfigCategory.Instance.Maps);
|
|
|
- Match2Map_GetRoom match2MapGetRoom = new Match2Map_GetRoom() {PlayerInfo = new Dictionary<long, long>()};
|
|
|
|
|
- foreach ((long id, long sessionInstanceId) in self.waitMatchPlayers)
|
|
|
|
|
|
|
+ Match2Map_GetRoom match2MapGetRoom = new Match2Map_GetRoom() {PlayerIds = new List<long>()};
|
|
|
|
|
+ foreach (long id in self.waitMatchPlayers)
|
|
|
{
|
|
{
|
|
|
- match2MapGetRoom.PlayerInfo.Add(id, sessionInstanceId);
|
|
|
|
|
|
|
+ match2MapGetRoom.PlayerIds.Add(id);
|
|
|
}
|
|
}
|
|
|
self.waitMatchPlayers.Clear();
|
|
self.waitMatchPlayers.Clear();
|
|
|
|
|
|
|
|
Map2Match_GetRoom map2MatchGetRoom = await ActorMessageSenderComponent.Instance.Call(
|
|
Map2Match_GetRoom map2MatchGetRoom = await ActorMessageSenderComponent.Instance.Call(
|
|
|
startSceneConfig.InstanceId, match2MapGetRoom) as Map2Match_GetRoom;
|
|
startSceneConfig.InstanceId, match2MapGetRoom) as Map2Match_GetRoom;
|
|
|
- foreach (var kv in match2MapGetRoom.PlayerInfo) // 这里发送消息线程不会修改PlayerInfo,所以可以直接使用
|
|
|
|
|
|
|
+ foreach (long id in match2MapGetRoom.PlayerIds) // 这里发送消息线程不会修改PlayerInfo,所以可以直接使用
|
|
|
{
|
|
{
|
|
|
- ActorMessageSenderComponent.Instance.Send(
|
|
|
|
|
- kv.Value, new Match2G_NotifyMatchSuccess() {InstanceId = map2MatchGetRoom.InstanceId});
|
|
|
|
|
|
|
+ ActorLocationSenderComponent.Instance.Get(LocationType.Player).Send(
|
|
|
|
|
+ id, new Match2G_NotifyMatchSuccess() {InstanceId = map2MatchGetRoom.InstanceId});
|
|
|
// 等待进入房间的确认消息,如果超时要通知所有玩家退出房间,重新匹配
|
|
// 等待进入房间的确认消息,如果超时要通知所有玩家退出房间,重新匹配
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|