Ejemplo n.º 1
0
 private void SetupMatchService(Action <RtSession> onStartRtSession)
 {
     _matchService.SubscribeToOnMatchNotFound(() =>
     {
         OnLogEntryReceived(LogEntryFactory.CreateMatchNotFoundLogEntry());
     });
     _matchService.SubscribeToOnMatchFound(rtSession =>
     {
         _sessionListDict.Add(rtSession.MatchId, rtSession);
         _sessionGui.MatchMakingGui.AddRealTimeSessionKey(rtSession.MatchId);
         OnLogEntryReceived(LogEntryFactory.CreateMatchFoundLogEntry(rtSession));
     });
     _sessionGui.MatchMakingGui.Initialize(
         rtSessionKey =>
     {
         if (!_sessionListDict.ContainsKey(rtSessionKey))
         {
             return;
         }
         onStartRtSession(_sessionListDict[rtSessionKey]);
         _sessionGui.RealTimeControlGui.SetActive(true);
     },
         (skill, shortCode) =>
     {
         _matchService.FindMatch(skill, shortCode);
         OnLogEntryReceived(LogEntryFactory.CreateMatchMakingRequestLogEntry(skill, shortCode));
     });
 }
 private void InitializeMatchServiceSubscriptions()
 {
     _matchService.SubscribeToOnMatchNotFound(() =>
     {
         OnLogEntryReceived(LogEntryFactory.CreateMatchNotFoundLogEntry());
     });
     _matchService.SubscribeToOnMatchFound(rtSession =>
     {
         _sessionListDict.Add(rtSession.MatchId, rtSession);
         _sessionGui.MatchMakingGui.AddRealTimeSessionKey(rtSession.MatchId);
         OnLogEntryReceived(LogEntryFactory.CreateMatchFoundLogEntry(rtSession));
     });
 }