-
Notifications
You must be signed in to change notification settings - Fork 0
IDeckBuilderService
IDeckBuilderService is an interface that defines the ruels for deckbuilding within a Format.
Type: Interface
Namespace: IGamePlugInBase
Assembly: IGamePlugInBase.dll
Property Name | Type | Description |
---|---|---|
CardList | IEnumerable<DeckBuilderCardArt> | A list of cards available to the Format. |
SearchFields | IEnuemrable<SearchField> | A list of fields with which can be accessed via Advanced Search in the Window. |
public void InitializeService();
Initializes the necessary variables for the Service, when the Format and DeckBuilder is opened by the Window. Typically the CardList (and maybe SearchField) which takes a long time to load and is best left until it is only needed.
While this Method can be left empty. It is best to initialize a Card List in this method rather than when the Game or Format is initialized and created. This is because it can cause lag within the Deck Builder Application when multiple Plug-Ins are attempting to load their large Card Lists at the same time. As such, perform initializations of the CardList in this Method when it is only strictly necessary.
IDeckBuilderService.ValidateMaximum(DeckBuilderCard, Dictionary<string, IEnumerable<DeckBuilderCard>>)
public bool ValidateMaximum(DeckBuilderCard card, Dictionary<string, IEnumerable<DeckBuilderCard>> decks);
Determines whether a card has reached the maximum copies it is allowed across the whole Decklist. It is only checked when a card is about to be added to the Decklist. It is not called when a card is moved between Decklists nor when saving the Decklist.
card
DeckBuilderCard
The card that is being added to the Decklist for the Format.
decks
Dictionary<string, IEnumerable<DeckBuilderCard>>
The current decklist before the card has been added. The Key denotes which Deck the cards are contained in.
Boolean
True if the Card has reached the maximum allowable copies (won't be added). False if it can still be added.
This method is used for verifying that a card has reached its maximum allowable copies. It should avoid iterating through the 'decks' parameter more than once. However, it can be done if necessary but attempt to limit it to the least iterations possible so that the user is not impacted by lag whenever they attempt to add a card to the Deck.
IDeckBuilderService.GetStats(Dictionary<string, IEnumerable<DeckBuilderCard>>)
public string GetStats(Dictionary<string, IEnumerable<DeckBuilderCard>> decks);
Counts cards in the current Decklist to provide a Summary to the user what cards exist in the Decklist.
decks
Dictionary<string, IEnumerable<DeckBuilderCard>
The current decklist that has been added to the Format. The Key denotes which Deck the cards are contained in.
String
A summary of the cards in the overall Decklist.
IDeckBuilderService.GetDetailedStats(Dictionary<string, IEnumerable<DeckBuilderCard>>)
public string GetStats(Dictionary<string, IEnumerable<DeckBuilderCard>> decks);
Counts cards in the current Decklist to provide a clear Summary to the user what cards exist in the Decklist.
decks
Dictionary<string, IEnumerable<DeckBuilderCard>
The current decklist that has been added to the Format. The Key denotes which Deck the cards are contained in.
String
A summary of the cards in the overall Decklist. This should be more detailed than GetStats.
IDeckBuilderService.AdvancedFilterSearchList(IEnumerable<DeckBuilderCardArt>, IEnumerable<SearchField>)
public IEnumerable<DeckBuilderCardArt> AdvancedFilterSearchList(IEnumerable<DeckBuilderCardArt> cards, IEnumerable<SearchField> searchFields)
Filters a list based on the value of certain Search Fields.
cards
IEnumerable<DeckBuilderCardArt>
The cardlist that is to be filtered.
searchFields
IEnumerable<SearchField>
The search criteria which is retrieved from the Application.
IEnumerable<DeckBuilderCardArt>
The filtered cardlist the contains only the cards that meet the Search Criteria from searchFields.
Searching should not take more than 1 Iteration in any circumstance. It is also best to skip a value as soon as it fails to meet 1 Search Criteria, as well as filter out any SearchFields that don't need to be checked for.
IDeckBuilerService.CompareCards(DeckBuilderCard, DeckBuilderCard)
public int CompareCards(DeckBuilderCard x, DeckBuilderCard y)
Compares two cards and determines which Card precedes the other. Used for sorting a Cardlist/Decklist.
x
DeckBuilderCard
The first card to check from.
y
DeckBuilderCard
The other card to check from.
Int32
A value that indicates the relative order of the objects being compared. The return value ahs these meanings:
Value | Meaning |
---|---|
Less than zero | Parameter `x` comes before Parameter `y` in the sort order. |
Zero | Parameter `x` and Parameter `y` are the same position in sort order. |
Greater than zero | Parameter `x` comes after Parameter `y` in the sort order. |
IDeckBuilderService.DefaultDeckName(DeckBuilderCard)
public string DefaultDeckName(DeckBuilderCard card)
Returns the Key for the Default Deck that a card will be added into when the User and does not specify which Deck they are adding to.
card
DeckBuilderCard
The card that the user is attempting to add.
String
The short-name of the Deck that the card is to be added to.
It is possible to ignore this value and use the NullDeckBuilderService that is provided which will allow the creation of illegal decklists.