Beispiel #1
0
 static public int constructor(IntPtr l)
 {
     try {
         int             argc = LuaDLL.lua_gettop(l);
         PokerBase.Poker o;
         if (argc == 2)
         {
             System.Int32 a1;
             checkType(l, 2, out a1);
             o = new PokerBase.Poker(a1);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         else if (argc == 3)
         {
             PokerBase.ePOKER_TYPE a1;
             checkEnum(l, 2, out a1);
             System.Int32 a2;
             checkType(l, 3, out a2);
             o = new PokerBase.Poker(a1, a2);
             pushValue(l, true);
             pushValue(l, o);
             return(2);
         }
         return(error(l, "New object failed."));
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #2
0
 static public int get_Index(IntPtr l)
 {
     try {
         PokerBase.Poker self = (PokerBase.Poker)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.Index);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #3
0
 static public int get_Type(IntPtr l)
 {
     try {
         PokerBase.Poker self = (PokerBase.Poker)checkSelf(l);
         pushValue(l, true);
         pushEnum(l, (int)self.Type);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #4
0
 static public int toString(IntPtr l)
 {
     try {
         PokerBase.Poker self = (PokerBase.Poker)checkSelf(l);
         var             ret  = self.toString();
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #5
0
 static public int set_BagIndex(IntPtr l)
 {
     try {
         PokerBase.Poker self = (PokerBase.Poker)checkSelf(l);
         System.Int32    v;
         checkType(l, 2, out v);
         self.BagIndex = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Beispiel #6
0
 // 洗牌
 public void Shuffle()
 {
     if (_publicPokerBag == null)
     {
         return;
     }
     System.Random random = new System.Random();
     for (int i = 0; i < _publicPokerBag.Count; i++)
     {
         int   willIndex = random.Next(_publicPokerBag.Count);
         Poker temp      = _publicPokerBag[willIndex];
         _publicPokerBag[willIndex] = _publicPokerBag[i];
         _publicPokerBag[i]         = temp;
     }
 }
Beispiel #7
0
        // 创建公共牌堆
        public void CreatePokerBag(int bagCnt = 1, ePOKER_COUNT pCnt = ePOKER_COUNT.both)
        {
            _publicBagCnt = bagCnt;
            if (_publicPokerBag != null)
            {
                _publicPokerBag.Clear();
            }

            for (int i = 0; i < (int)pCnt * _publicBagCnt; i++)
            {
                Poker poker = new Poker(i);
                AddPokerToBag(poker);
            }
            Shuffle();
            PrintPokerBag();
        }
Beispiel #8
0
        // 打印
        public void PrintPokerBag()
        {
            string printText = "";

            for (int i = 0; i < _publicPokerBag.Count; i++)
            {
                Poker poker = _publicPokerBag[i];
                if ((i + 1) % (int)(ePOKER_COUNT.suit) == 0 || i == _publicPokerBag.Count - 1)
                {
                    Debug.LogError(printText + poker.toString());
                    printText = "";
                }
                else
                {
                    printText += poker.toString() + " 、 ";
                }
            }
        }
Beispiel #9
0
 public int AddOwnPoker(Poker poker)
 {
     _ownPokers.Add(poker);
     return(_ownPokers.Count);
 }
Beispiel #10
0
 public int AddPublicPoker(Poker poker)
 {
     _publicPokers.Add(poker);
     return(_publicPokers.Count);
 }