private void HandleQueueEntryResponse(QueueEntryResponse response) { if (response.Successfulness) { queueInfoText.SetRegularText("U redu si za igru\nIgra će početi kada se pronađe protivnik"); m_isInQueue = true; SetCorrectButtonText(); } else { queueInfoText.SetRegularText("*** GREŠKA PRI ULASKU U RED ***\n" + response.Message); } m_waitingForResponse = false; }
public IRemoteObject Handle(AsyncUserToken token, IRemoteObject request) { QueueEntryRequest queueEntryRequest = request as QueueEntryRequest; var response = new QueueEntryResponse(); try { if (queueEntryRequest.Deck == null) { throw new MatchmakingException("Neodgovarajuć špil"); } var deck = CardUtils.CardIdsToLinkedList(cardList, queueEntryRequest.Deck); if (deck.Count != GameConfig.DECK_SIZE) { throw new MatchmakingException("Neodgovarajuća veličina špila"); } var queueEntry = new UserQueueWrapper { Token = token, Deck = deck }; matchmaker.AddUserToQueue(queueEntry); response.Successfulness = true; } catch (Exception e) { if (e is CardUtilsException || e is MatchmakingException) { response.Successfulness = false; response.Message = e.Message; } else { throw; } } return(response); }