Example #1
0
    public NormalCard(int id, bool temp = true)
    {
        BattleCardTableSetting cardData = BattleCardTableSettings.Get(id);

        if (cardData == null)
        {
            throw new ArgumentOutOfRangeException("This CardID is wrong!");
        }
        CardId     = id;
        IsTempCard = temp;
        Data       = cardData;
    }
Example #2
0
 public BattleCardData(int cardId, BattlePlayer owner)
 {
     uniqueId++;
     if (uniqueId >= int.MaxValue)
     {
         uniqueId = int.MinValue;
     }
     Uid    = uniqueId;
     CardId = cardId;
     Data   = BattleCardTableSettings.Get(cardId);
     if (Data == null)
     {
         Debug.LogError("cardId: " + cardId + " not exist!");
         return;
     }
     Owner    = owner;
     ItemType = BattleEffectItemType.Card;
 }
Example #3
0
    /// <summary>
    /// 加载卡牌
    /// </summary>
    /// <param name="id"></param>
    private void InitCard(int id)
    {
        if (CardId == id)
        {
            return;
        }
        CardId = id;
        BattleCardTableSetting card = BattleCardTableSettings.Get(id);

        icon.Load(card.ShowID);
        labName.text     = I18N.Get(card.Name);
        spendingNum.text = card.Spending.ToString();
        describle.text   = I18N.Get(card.Desc);
        ShowCardType(card.Type);
        if (card.Type == 0 && card.ActionTypes[0] == 1)
        {
            labAttack.text = card.ActionParams[0].ToString();
        }
    }
Example #4
0
    public void SetCard(int cardId, int count = 1, bool showTips = false)
    {
        CardId   = cardId;
        CardNum  = count;
        CardData = BattleCardTableSettings.Get(CardId);
        leftIcon.Load(CardData.IconLeftID);
        rightIcon.Load(CardData.IconRightID);
        lblName.text     = I18N.Get(CardData.Name);
        labSpending.text = CardData.Spending.ToString();
        ShowCardType(CardData.Type);

        if (CardData.Type == 0 && CardData.ActionTypes[0] == 1)
        {
            labAttack.text = CardData.ActionParams[0].ToString();
        }
        if (showTips)
        {
            UIUtility.SetCardTips(gameObject, CardId, CardNum);
        }
    }