public override bool Handle(PlayerFetchDataCode fetchCode, Dictionary <byte, object> parameters, out string errorMessage) { if (base.Handle(fetchCode, parameters, out errorMessage)) { int deckID = (int)parameters[(byte)FetchAllDeckCardsParameterCode.DeckID]; Deck deck; if (subject.FindDeck(deckID, out deck)) { foreach (var card in deck.Cards) { var result = new Dictionary <byte, object> { { (byte)FetchAllDeckCardsResponseParameterCode.DeckID, deck.DeckID }, { (byte)FetchAllDeckCardsResponseParameterCode.CardID, card.CardID } }; SendResponse(fetchCode, ReturnCode.Correct, "", result); } return(true); } else { errorMessage = "Deck Not Existed"; return(false); } } else { return(false); } }
internal void SendFetchDataOperation(PlayerFetchDataCode fetchCode, Dictionary <byte, object> parameters) { Dictionary <byte, object> fetchDataParameters = new Dictionary <byte, object> { { (byte)FetchDataRequestParameterCode.FetchDataCode, (byte)fetchCode }, { (byte)FetchDataRequestParameterCode.Parameters, parameters } }; SendOperation(PlayerOperationCode.FetchData, fetchDataParameters); }
public override bool Handle(PlayerFetchDataCode fetchCode, Dictionary <byte, object> parameters, out string errorMessage) { if (base.Handle(fetchCode, parameters, out errorMessage)) { foreach (var deck in subject.Decks) { var result = new Dictionary <byte, object> { { (byte)FetchAllDecksResponseParameterCode.DeckID, deck.DeckID }, { (byte)FetchAllDecksResponseParameterCode.DeckName, deck.DeckName }, { (byte)FetchAllDecksResponseParameterCode.MaxCardCount, deck.MaxCardCount } }; SendResponse(fetchCode, ReturnCode.Correct, "", result); } return(true); } else { return(false); } }