示例#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 OnFindMatch(int skill, string shortCode)
 {
     _matchService.FindMatch(skill, shortCode, (err) => // on match making Error
     {
         OnLogEntryReceived(LogEntryFactory.CreateMatchMakingErrorLogEntry(err));
     });
     OnLogEntryReceived(LogEntryFactory.CreateMatchMakingRequestLogEntry(skill, shortCode));
 }