Package cards

Class MacaoCard

Inherited from MacaoObject

          Usage

Fields   Constructor   Methods

Use the class MacaoCard to create cards for a card game.

Usage

Use the constructor MacaoCard to create a card. Then you need to call createFrontLookGeneric() or createFrontLookImage() to create the front look for the card. You also need to call createRearLookGeneric() or createRearLookImage() to create the rear look.

Then you should add the card to a MacaoCardStack object to handle it.

Field Summary
boolean IS_CARD
     This constant marks a card as card. It is always true.
String LOOK_NAME_FRONT
     This constant defines the name of the front look.
String LOOK_NAME_REAR
     This constant defines the name of the rear look.
String SUIT_CLUBS
     This constant defines the suit Clubs.
String SUIT_DIAMONDS
     This constant defines the suit Diamonds.
String SUIT_HEARTS
     This constant defines the suit Hearts.
String SUIT_SPADES
     This constant defines the suit Spades.

Inherited Fields
BUNCH_TYPE_SAY, BUNCH_TYPE_STAND, BUNCH_TYPE_WALK

Constructor Summary
MacaoCard(String name, String title, number left, number top, optional String cardType, optional boolean exposed, optional integer cardValue, optional String suit)
     Use this constructor to create a new card.

Method Summary
void adjustStack(optional boolean startWithCard)
     Call this method to adjust the cards of the stack to which this card is currently added.
integer compareTo(MacaoCard otherCard)
     This method is called to compare two cards for sorting a stack.
void createFrontLookGeneric(optional String cardTitle, optional String color, optional String suitImageUrl, optional String centerImageUrl, optional String cardDescription, optional boolean bigDescription, optional boolean descriptionTop)
     Call this method to create the front look of the card composed by attributes.
void createFrontLookImage(String frontImageUrl, number baseWidth, number baseHeight)
     Call this method to create the front look of the card by a single image.
void createRearLookGeneric(optional String rearColor, optional String rearImageUrl, optional boolean tile)
     Call this method to create the rear look of the card composed by attributes.
void createRearLookImage(String rearImageUrl, number baseWidth, number baseHeight)
     Call this method to create the rear look of the card by a single image.
Element createTable()
     Call this method to create a DOM table element in the front look.
String getCardType()
     Call this method to get the card type.
integer getCardValue()
     Call this method to get the card value.
String getColor()
     Call this method to geht the color definition of the text of a generic front side.
String getDescription()
     Call this method to get the description text, which is displayed in the center of a generic card.
Element getFrontElement()
     Call this method to get the DOM element of the front look.
Element getFrontElementCenter()
     Call this method to get the DOM element of the center area of the generic front look.
Element getFrontElementDescription()
     Call this method to get the DOM element of the description of the generic front look.
Element getFrontElementEast()
     Call this method to get the DOM element of the right area of the generic front look.
Element getFrontElementNorth()
     Call this method to get the DOM element of the top area of the generic front look.
Element getFrontElementSouth()
     Call this method to get the DOM element of the bottom area of the generic front look.
Element getFrontElementWest()
     Call this method to get the DOM element of the left area of the generic front look.
Element getFrontImageCenter()
     Call this method to get the DOM element of the center image of the generic front look.
Element getFrontImageEast()
     Call this method to get the DOM element of the right bottom image of the generic front look.
Element getFrontImageWest()
     Call this method to get the DOM element of the left top image of the generic front look.
String getRearColor()
     Call this method to get the background color of the generic rear look.
Element getRearElement()
     Call this method to get the DOM element of the front look.
MacaoCardStack getStack()
     Call this method to get the stack to which this card is added.
String getSuit()
     Call this method to get the suit of the card.
void initCard(String name, String title, number left, number top, optional String cardType, optional boolean exposed, optional integer cardValue, optional String suit)
     This method is called by the constructor to initialize the card.
boolean isExposed()
     Call this method to check, if currently the front side of the card is shown.
boolean isPulling()
     Call this method to check, if the card is currently walking or dragged by the user.
boolean isRedSuit()
     Call this method to check, if the suit of the card is a red suit
void moveTo(number left, number top, optional boolean dontAdjust)
     Call this method to move the card to a new position.
void objectOnClick(Event event, number mouseX, number mouseY)
     This is the inherited method onClick() from MacaoObject.
void onClickCard(Event event, number mouseX, number mouseY)
     This event handler is called when the user clicks on the card.
void onDblClickCard(Event event, number mouseX, number mouseY)
     This event handler is called when the user double clicks on the card.
void onDrop(Event event, number mouseX, number mouseY, MacaoObject toObject)
     This implementation of the event handler forwards the event onDrop to the event handers onDropToCard or onDropToStack.
void onDropToCard(MacaoCard card)
     This event handler is called, when this card or substack is dropped to another card.
void onDropToStack(MacaoCardStack stack)
     This event handler is called, when this card or substack is dropped to a stack object.
void setCardType(String cardType)
     Call this method to set the card type.
void setCardValue(integer cardValue)
     Call this method to set the card value.
void setColor(String color)
     Call this method to set the color for the text of the generic front look.
void setDescription(String description)
     Call this method to set the description text, which is displayed in the center of a generic card.
void setExposed(boolean exposed, optional boolean dontAdjustStack)
     Call this method to make the card show its front side or rear side.
void setRearColor(String rearColor)
     Call this method to set the background color for the generic rear look.
void setToolTip(optional String toolTip)
     Call this method to set the tool tip of the front look of the card.
void walkToStack(MacaoCardStack stack, optional number velocity, optional String eventType, optional Array params)
     Call this method to make the card or substack walk to the top of another stack.

Inherited Methods
accelerate, addLookBunch, addTalkItem, adjustStacking, approachAndTryAction, approachObject, approachPos, assignRoadNode, bindToNet, calculateApproachPos, calculateStackingIndex, changeDirection, createTalkItem, getAnchorXPos, getAnchorYPos, getApproachable, getAssignedNode, getBunchPhase, getDirection, getLookDirection, getMaxVelocity, getMeetingObjectNames, getNearestNode, getNetType, getResponsesSenderName, getResponseTalkItems, getReverseGear, getVelocity, hearEvent, hearFreeText, isMeetingObject, isWalking, leave, mayILeaveNode, meet, moveAnchorTo, moveToNode, onClickOther, onClickWindow, restore, setAnchorAtBottom, setApproachable, setApproachClick, setAssignedNode, setAutoAcceleration, setAutoRestore, setBunchDepth, setBunchPhase, setCollisionBreak, setDirection, setDisableApproach, setPreferredLook, setRandomTalk, setReverseGear, setStacking, setSteeringIndex, setTalkCssClassName, setVelocity, setWalkCharacteristics, setWalkPhases, startAutoAcceleration, steeredVelocityChanged, stopWalking, store, tryAction, walkToNode, walkToPos, wanderAroundactivateDrag, activateDrop, addController, broadcastEvent, createLayer, createLook, displayMeasures, getActualLook, getCollisionCheck, getCssClassName, getFrameName, getHeight, getLayer, getLeft, getLook, getName, getTitle, getTop, getType, getVisibility, getWidth, getZIndex, getZoom, hasLook, initObject, isController, isDragActive, isDragged, isDropActive, isDropAllowed, moveTo, moveToCenter, notifyControllers, onClick, onClickOther, onClickOtherItem, onClickWindow, onCollisionOut, onCollisionOver, onDblClick, onDblClickOther, onDblClickWindow, onDragEnd, onDragOut, onDragOver, onDragStart, onDrop, onKeyDown, onKeyPress, onKeyUp, onLoad, onMouseDown, onMouseDownWindow, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onMouseUpWindow, onUnload, openPage, postEvent, refreshZoom, removeController, removeObject, say, scrollVisible, sendEvent, setActualLook, setBaseSize, setCollisionCheck, setCssClassName, setForwardMouseEvents, setHTML, setImage, setScrollVisibleOptions, setTitle, setToolTip, setType, setVisibility, setZIndex, setZoom, toBack, toFront

Field Details
boolean IS_CARD

String LOOK_NAME_FRONT

String LOOK_NAME_REAR

String SUIT_CLUBS

String SUIT_DIAMONDS

String SUIT_HEARTS

String SUIT_SPADES

Constructor Details
MacaoCard(String name, String title, number left, number top, optional String cardType, optional boolean exposed, optional integer cardValue, optional String suit)

Method Details
void adjustStack(optional boolean startWithCard)

integer compareTo(MacaoCard otherCard)

void createFrontLookGeneric(optional String cardTitle, optional String color, optional String suitImageUrl, optional String centerImageUrl, optional String cardDescription, optional boolean bigDescription, optional boolean descriptionTop)

void createFrontLookImage(String frontImageUrl, number baseWidth, number baseHeight)

void createRearLookGeneric(optional String rearColor, optional String rearImageUrl, optional boolean tile)

void createRearLookImage(String rearImageUrl, number baseWidth, number baseHeight)

Element createTable()

String getCardType()

integer getCardValue()

String getColor()

String getDescription()

Element getFrontElement()

Element getFrontElementCenter()

Element getFrontElementDescription()

Element getFrontElementEast()

Element getFrontElementNorth()

Element getFrontElementSouth()

Element getFrontElementWest()

Element getFrontImageCenter()

Element getFrontImageEast()

Element getFrontImageWest()

String getRearColor()

Element getRearElement()

MacaoCardStack getStack()

String getSuit()

void initCard(String name, String title, number left, number top, optional String cardType, optional boolean exposed, optional integer cardValue, optional String suit)

boolean isExposed()

boolean isPulling()

boolean isRedSuit()

void moveTo(number left, number top, optional boolean dontAdjust)

void objectOnClick(Event event, number mouseX, number mouseY)

void onClickCard(Event event, number mouseX, number mouseY)

void onDblClickCard(Event event, number mouseX, number mouseY)

void onDrop(Event event, number mouseX, number mouseY, MacaoObject toObject)

void onDropToCard(MacaoCard card)

void onDropToStack(MacaoCardStack stack)

void setCardType(String cardType)

void setCardValue(integer cardValue)

void setColor(String color)

void setDescription(String description)

void setExposed(boolean exposed, optional boolean dontAdjustStack)

void setRearColor(String rearColor)

void setToolTip(optional String toolTip)

void walkToStack(MacaoCardStack stack, optional number velocity, optional String eventType, optional Array params)