예제 #1
0
    /// 卡牌位置变更
    public void MoveCardPosEnum(int cardUId, RoomCardPosEnum toPosEnum)
    {
        CardControl cc = GetCardControl(cardUId);

        // if(cc.LastPosEnum == toPosEnum) return;
        if (cc.LastPosEnum != RoomCardPosEnum.None)
        {
            if (cardPosList.ContainsKey(cc.LastPosEnum))
            {
                int last = cardPosList[cc.LastPosEnum].IndexOf(cardUId);
                if (last != -1)
                {
                    cardPosList[cc.LastPosEnum].RemoveAt(last);
                }
            }
        }
        if (toPosEnum != RoomCardPosEnum.None)
        {
            if (!cardPosList.ContainsKey(toPosEnum))
            {
                cardPosList.Add(toPosEnum, new List <int>());
            }
            cardPosList[toPosEnum].Add(cardUId);
        }
        int       playerUId = GetCardPlayer(cardUId) == null ? -1 : GetCardPlayer(cardUId).playerData.UUID;
        Transform cardItem  = cc.GetItem().transform;

        cardItem.SetParent(roomControl.GetTransByPos(toPosEnum, cc.cardData, playerUId), true);
        cardItem.localScale    = new Vector3(1, 1, 1);
        cardItem.localRotation = Quaternion.identity;
        cc.MoveCard(roomControl.GetCardPos(cc.LastPosEnum, cc.cardData, playerUId), roomControl.GetCardPos(toPosEnum, cc.cardData, playerUId), toPosEnum, onMoveCompleted);
    }