Esempio n. 1
0
 public void getCards(Table.Cards cards)
 {
     Debug.Log("收到牌");
     CardController.Instance.cleanUp();
     for (int i = 0; i < cards.cards.Count; i++)
     {
         CardController.Instance.addCard(CardConst.getCardInfo(cards.cards[i]).type, CardConst.getCardInfo(cards.cards[i]).value);
     }
     EventDispatcher.Instance.Dispatch(GameEventConst.CARD_TO_HAND);
 }
Esempio n. 2
0
    public void play(Table.Play play)
    {
        Debug.Log("收到play返回");
        if (play.err_no == 0)
        {
            switch (play.id.idToPos())
            {
            case 0:
                GameConst.isTurn = false;
                CardController.Instance.cleanUp();
                for (int i = 0; i < play.leftcard.Count; i++)
                {
                    CardController.Instance.addCard(CardConst.getCardInfo(play.leftcard[i]).type, CardConst.getCardInfo(play.leftcard[i]).value);
                }
                DataMgr.Instance._heCards[0] = play.outcards;
                break;

            case 1:
                DataMgr.Instance.rightCardNum = play.leftcard.Count;
                DataMgr.Instance._heCards[1]  = play.outcards;
                break;

            case 2:
                DataMgr.Instance.topCardNum  = play.leftcard.Count;
                DataMgr.Instance._heCards[2] = play.outcards;
                break;

            case 3:
                DataMgr.Instance.leftCardNum = play.leftcard.Count;
                DataMgr.Instance._heCards[3] = play.outcards;
                break;
            }

            SoundMgr._instance.soundPlay(GameConst.Language + ((RoleController.Instance._playerDic[play.id].Sex?0:1000) + play.card), GameConst.soundVol);
            DataMgr.Instance._curCard = play.card;
            Debug.Log("现在的cur" + play.card);
            EventDispatcher.Instance.Dispatch(GameEventConst.PUT_HE_CARD, play.id.idToPos(), play.card);
        }
        else
        {
            //QuickTips.ShowRedQuickTips("play___" + play.err_no);
        }
    }
Esempio n. 3
0
 public Card(int bigNum)
 {
     _bigNum   = bigNum;
     _cardType = CardConst.getCardInfo(bigNum).type;
     _cardNum  = CardConst.getCardInfo(bigNum).value;
 }
Esempio n. 4
0
 public bool addCard(int bigNum)
 {
     return(addCard(CardConst.getCardInfo(bigNum).type, CardConst.getCardInfo(bigNum).value));
 }
Esempio n. 5
0
    void OnGUI()
    {
        //if (GUILayout.Button("测试", GUILayout.Width(50), GUILayout.Height(20)))
        //{
        //    List<int> cards = new List<int>();
        //    cards.Add(2);
        //    cards.Add(2);
        //    cards.Add(2);

        //    cards.Add(5);
        //    cards.Add(5);
        //    cards.Add(5);

        //    cards.Add(6);
        //    cards.Add(6);
        //    cards.Add(6);

        //    cards.Add(9);
        //    cards.Add(9);

        //    cards.Add(21);
        //    cards.Add(21);
        //    cards.Add(21);


        //    if (CardController.Instance.IsCanHU(cards) == true)
        //    {
        //        Debug.Log(" can hu");
        //    }
        //    else
        //    {
        //        Debug.Log("can not hu");
        //    }
        //}
        //return;
        GUILayout.BeginHorizontal();

        for (int i = 0; i < 9; i++)
        {
            GUILayout.Label((i + 1) + "万");
            cards[i] = int.Parse(GUILayout.TextField(cards[i].ToString(), GUILayout.Width(30)));
        }


        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        for (int i = 9; i < 18; i++)
        {
            GUILayout.Label((i - 8) + "条");
            cards[i] = int.Parse(GUILayout.TextField(cards[i].ToString(), GUILayout.Width(30)));
        }

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        for (int i = 18; i < 27; i++)
        {
            GUILayout.Label((i - 17) + "饼");
            cards[i] = int.Parse(GUILayout.TextField(cards[i].ToString(), GUILayout.Width(30)));
        }

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("东");
        cards[27] = int.Parse(GUILayout.TextField(cards[27].ToString(), GUILayout.Width(30)));
        GUILayout.Label("南");
        cards[28] = int.Parse(GUILayout.TextField(cards[28].ToString(), GUILayout.Width(30)));
        GUILayout.Label("西");
        cards[29] = int.Parse(GUILayout.TextField(cards[29].ToString(), GUILayout.Width(30)));
        GUILayout.Label("北");
        cards[30] = int.Parse(GUILayout.TextField(cards[30].ToString(), GUILayout.Width(30)));

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("中");
        cards[31] = int.Parse(GUILayout.TextField(cards[31].ToString(), GUILayout.Width(30)));
        GUILayout.Label("發");
        cards[32] = int.Parse(GUILayout.TextField(cards[32].ToString(), GUILayout.Width(30)));
        GUILayout.Label("白");
        cards[33] = int.Parse(GUILayout.TextField(cards[33].ToString(), GUILayout.Width(30)));
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("只测是否能胡(任意牌数)", GUILayout.Width(200), GUILayout.Height(40)))
        {
            CardController.Instance.cleanUp();
            for (int i = 0; i < cards.Length; i++)
            {
                for (int j = 0; j < cards[i]; j++)
                {
                    CardController.Instance.addCard(CardConst.getCardInfo(i + 1).type, CardConst.getCardInfo(i + 1).value);
                }
            }
            bool bo = CardController.Instance.checkCard(CardController.Instance._myCardList);
            if (bo)
            {
                str = "能胡";
            }
            else
            {
                str = "不能胡";
            }
        }
        if (GUILayout.Button("测试胡牌类型(14张牌)", GUILayout.Width(200), GUILayout.Height(40)))
        {
            CardController.Instance.cleanUp();
            for (int i = 0; i < cards.Length; i++)
            {
                for (int j = 0; j < cards[i]; j++)
                {
                    CardController.Instance.addCard(CardConst.getCardInfo(i + 1).type, CardConst.getCardInfo(i + 1).value);
                }
            }
            bool bo = CardController.Instance.checkCard(CardController.Instance._myCardList);
            if (bo)
            {                                           //str = "能胡";
                int     hutype = CardController.Instance.getHuType(CardController.Instance._myCardList);
                HuScore hscore = GetHuType.Instance.gethuScore(hutype);
                str = hscore.name + "  " + hscore.score;
            }
            else
            {
                str = "不能胡";
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("<color='#ff0000'>" + str + "</color>");
        GUILayout.EndHorizontal();
    }