DeckStacker v1.0
A card manager plugin for Unity games.
 
Loading...
Searching...
No Matches
DeckStacker.DSRestackHelper Class Reference

Public Member Functions

void CalculateCardMeasurements ()
 
void UpdateCardStackOrigin (bool overstuffed_)
 
void SetStackType (DSStackType newStackType_)
 
Vector3 PilePositioning (int i_)
 
Vector3 TypicalStackPositioning (int i_)
 
Vector3 OverstuffedTightPositioning (int i_, int howManyStackedAtBeginning_)
 
Vector3 OverstuffedLoosePositioning (int i_)
 

Properties

DSStackType stackType [get]
 
DSCardSpacingOverrideSettings cardSpacingOverrideSettings [get]
 
bool alignToCenter [get]
 
bool reverseDirection [get]
 
int cardAmountUntilOverstuff [get]
 
List< DSCardvisibleShufflingCards [get, set]
 

Detailed Description

This script:

  • Updates position scaling
  • Provides data related to restacking to the DSRestacker code.

Note: All vector calculations here are in localSpace of _stack.cardManager.cardStackParent

Member Function Documentation

◆ CalculateCardMeasurements()

void DeckStacker.DSRestackHelper.CalculateCardMeasurements ( )
inline

This method updates data that will be used in Restack operations in DSRestacker. This will be / neads to be called in the following 2 scenerios:

  1. When a stack is empty, and a card is added to it so that measurements fit the card type.
  2. When the screen resizes, to make sure things like availableSpace are recalculated.

◆ OverstuffedLoosePositioning()

Vector3 DeckStacker.DSRestackHelper.OverstuffedLoosePositioning ( int i_)
inline

Used in DSRestacker: Overstuffed is when there are enough cards in a stack that card spacing needs to be adjusted to fit all cards in the bounding box in a pleasing fashion.

This method returns overstuffed card positions for loose stacks, at the specified card order.

◆ OverstuffedTightPositioning()

Vector3 DeckStacker.DSRestackHelper.OverstuffedTightPositioning ( int i_,
int howManyStackedAtBeginning_ )
inline

Used in DSRestacker: Overstuffed is when there are enough cards in a stack that card spacing needs to be adjusted to fit all cards in the bounding box in a pleasing fashion.

This method returns overstuffed card positions for tight stacks, at the specified card order.

◆ PilePositioning()

Vector3 DeckStacker.DSRestackHelper.PilePositioning ( int i_)
inline

Used in DSRestacker: This returns the correct position of a card in a pile stack, at the card order of i_.

◆ SetStackType()

void DeckStacker.DSRestackHelper.SetStackType ( DSStackType newStackType_)
inline

Any time the stackType is updated, measurements need to be recalculated and a restack needs to happen. This method:

  1. Sets the DSStackType of this stack
  2. Calls CalculateCardMeasurements()
  3. Triggers a restack for this stack

◆ TypicalStackPositioning()

Vector3 DeckStacker.DSRestackHelper.TypicalStackPositioning ( int i_)
inline

Used in DSRestacker: Returns the typical card positions, at the specified card order.

In CalculateCardMeasurements(), the card spacing value has already been updated before this is called.

"Typical" positions are non-overstuffed, and not centered.

◆ UpdateCardStackOrigin()

void DeckStacker.DSRestackHelper.UpdateCardStackOrigin ( bool overstuffed_)
inline

Called in DSRestacker: This updates the cardStackOriginPoint coordinates for restack operations.

Property Documentation

◆ alignToCenter

bool DeckStacker.DSRestackHelper.alignToCenter
get

Offsets card stack to be centered in the stack bounding box.

◆ cardAmountUntilOverstuff

int DeckStacker.DSRestackHelper.cardAmountUntilOverstuff
get

This value determines if we need to adjust card positioning to accomodate for more cards.

When a stack has overtaken this limit, it is considered overstuffed.

Overstuffed stacks will adjust how they arrange cards in the following way.

  • Tight stacks will place additional cards in the first card space (evenly spaced)
  • Loose stacks will adjust card spacing to evenly position all cards

The amount of cards until a stack is overstuffed is determined by the stack's "bounding box", defined by the DSCardManager.cardStackParent RectTransform dimensions.

◆ cardSpacingOverrideSettings

DSCardSpacingOverrideSettings DeckStacker.DSRestackHelper.cardSpacingOverrideSettings
get

Allows the dev to customize which spacing values are overrided.

◆ reverseDirection

bool DeckStacker.DSRestackHelper.reverseDirection
get

Swaps the direction of the stack, moving the stack origin to the opposite end of the bounding box.

◆ stackType

DSStackType DeckStacker.DSRestackHelper.stackType
get

DSStackType defines how a stack's cards should be arranged.

See DSEnums for explainations of the different stack types.

◆ visibleShufflingCards

List<DSCard> DeckStacker.DSRestackHelper.visibleShufflingCards
getset

These cards will not be hidden during the shuffle animation. (see DSCard.ManageDefaultCardInStackVisibility())


The documentation for this class was generated from the following file: