Beispiel #1
0
    //某个玩家出某个牌 将手中的牌插入某个位置 -1表示空操作  cardType为要出的牌型
    IEnumerator UserPutCard(int userID, int cardID, int sortID, int cardType = -1)
    {
        //出牌
        nextState = Logic.out_card;
        //如果ID小于0 则出刚摸上来的牌
        MahjongPrefab mahjong;

        if (cardID < 0)
        {
            mahjong = userPriority[userID].handleCard.GetMahjongCard();
        }
        else
        {
            mahjong = userPriority[userID].handCard.GetMahjongCard(cardID, 0);  //0表示从左手边开始算起 第cardID个牌
        }
        //如果有传入牌型则替换牌型
        if (cardType > 0)
        {
            mahjong.mesh.mesh = ResoucreMtr.Instance.GetMesh(cardType);
        }
        yield return(LogicCprocessor(userID, mahjong));

        //将手牌插入
        if (!userPriority[userID].handleCard.IsEmpty && sortID >= 0)
        {
            yield return(gameAct.InsertToHandCard(userPriority[userID], sortID, userPriority[userID].handleCard.GetMahjongCard()));
        }
        control.EndStatusFlag(userID, UserAction.put_card);
    }
Beispiel #2
0
    IEnumerator GetTest(CardTest type, MahjongPrefab carditem = new MahjongPrefab())
    {
        switch (type)
        {
        case CardTest.group:
            yield return(GameAct.AddGroup());

            break;

        case CardTest.handCard:
            yield return(GameAct.AddHandCard(GameAct.hostUser, carditem));

            yield return(GameAct.DisplayCard(GameAct.hostUser));

            break;

        case CardTest.outCard:
            yield return(GameAct.AddOutCard(GameAct.hostUser, carditem));

            break;

        case CardTest.spacialCard:
            yield return(GameAct.AddSpacialCard(GameAct.hostUser, carditem));

            break;

        case CardTest.getCard:
            yield return(GameAct.AddHandleCard(GameAct.hostUser, carditem));

            break;

        case CardTest.insertCard:
            int index = GameAct.hostUser.handCard.Count;
            if (index < 3)
            {
                --index;
            }
            else
            {
                index = 2;
            }
            yield return(GameAct.InsertToHandCard(GameAct.hostUser, index, GameAct.hostUser.handleCard.GetMahjongCard()));

            break;

        case CardTest.diceRoll:
            yield return(GameAct.TurnDice(Random.Range(1, 7), Random.Range(1, 7)));

            break;

        case CardTest.displayDice:
            yield return(GameAct.DisapperDice());

            break;
        }
    }