Static Public Member Functions | |
static List< List< DSCard > > | DistributeCardsIntoLists (List< DSCard > originalCardList_, int preferredCardsPerList_, int maxNumberOfLists_, DSItemDistribution cardDistribution_, DSDistributionWeight distributionWeight_) |
static List< List< T > > | DistributeItemsIntoLists< T > (List< T > originalList_, int preferredItemsPerList_, int maxNumberOfLists_, DSItemDistribution itemDistribution_, DSDistributionWeight distributionWeight_) |
This script generically distributes a specified list of items between a number of new lists.
For example: If you want to evenly split a collection of 11 Transforms between 3 new parents, where:
DSItemDistributor.DistributeItemsIntoLists<Transform>(transformList, 5, 3, DSItemDistribution.Even, DSDistributionWeight.End);
The return will be a List of Lists, containing a distribution of the Transforms between them.
This can be used to determine what parents the objects should be assigned to.
The primary way this is used in DeckStacker is for distributing several cards between multiple stacks.
This script was originally concieved as part of a Multi-Stack system that dynamically distributes cards between multiple stacks, but that idea turned out to conflict with some fundamentals of DeckStacker, and the implementation was kind of ugly, anyway.
Multi-Stack was pulled back to a smaller scope, resulting in this script.
|
inlinestatic |
A wrapper function for DistributeItemsIntoLists, because DSCards are going to be the main use case for this script.
|
inlinestatic |
Takes a list of items and other parameters, and breaks that list into several lists.
This was originally made for distributing cards into several stacks, and you want those cards distributed evenly.
This was then made generic for more versatility.