Moved the serverless game stuff out of msoy and back into the vilya library.

We'll be using this in game gardens, at least.
Note that the actionscript side currently doesn't compile because of
limitations in building a .swc file, but that'll be fixed soon.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@47 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Ray Greenwell
2006-08-23 02:28:36 +00:00
parent a90d7e655b
commit 70b0d759c0
27 changed files with 2835 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
package com.threerings.ezgame {
/**
* A simple card deck that encodes cards as a string like "Ac" for the
* ace of clubs, or "Td" for the 10 of diamonds.
*/
public class CardDeck
{
public function CardDeck (gameObj :GameObject, deckName :String = "deck")
{
_gameObj = gameObj;
_deckName = deckName;
var deck :Array = new Array();
for each (var rank :String in ["2", "3", "4", "5", "6", "7", "8",
"9", "T", "J", "Q", "K", "A"]) {
for each (var suit :String in ["c", "d", "h", "s"]) {
deck.push(rank + suit);
}
}
_gameObj.setCollection(_deckName, deck);
}
public function dealToPlayer (
playerIdx :int, count :int, msgName :String) :void
{
// TODO: support the callback
_gameObj.dealFromCollection(_deckName, count, msgName, null, playerIdx);
}
public function dealToData (count :int, propName :String) :void
{
_gameObj.dealFromCollection(_deckName, count, propName, null);
}
/** The game object. */
protected var _gameObj :GameObject;
/** The name of our deck. */
protected var _deckName :String;
}
}