Example #1
0
    public CardInfo GainNewCard(string cid)
    {
        CardAsset aset = null;

        CardDict.TryGetValue(cid, out aset);
        if (aset == null)
        {
            aset = Load(cid);
        }
        if (aset != null)
        {
            aset.ReplaceWithAmountInEffect();
            CardInfo info = new CardInfo(InstId, cid, Time.realtimeSinceStartup);
            info.ca = aset;
            cards.Add(info);
            InstId += 1;

            if (aset.HasTurnEffect || aset.TurnEffects.Count > 0)
            {
                CardsWithTurnEffect.Add(info);
            }

            return(info);
        }
        return(null);
    }
Example #2
0
    public CardInfo GainNewCard(string cid)
    {
        CardAsset aset = null;

        CardDict.TryGetValue(cid, out aset);
        if (aset == null)
        {
            aset = Load(cid);
        }
        if (aset != null)
        {
            aset.ReplaceWithAmountInEffect();
            CardInfo info = new CardInfo(InstId, cid, Time.realtimeSinceStartup);
            info.ca = aset;
            cards.Add(info);
            CardInstDict.Add(InstId, info);
            InstId += 1;

            if (aset.HasTurnEffect || aset.TurnEffects.Count > 0)
            {
                CardsWithTurnEffect.Add(info);
            }

            if (aset.CardType == eCardType.ITEM)
            {
                if (UsedItemList.Count < pRoleMdl.MaxItemNum)
                {
                    info.isDisabled = false;
                }
                else
                {
                    info.isDisabled = true;
                }
            }

            return(info);
        }
        return(null);
    }