public static ErrorEntity UpdateCard(string accessToken, string cardId, BaseCard baseCard) { var url = string.Format("https://api.weixin.qq.com/card/update?access_token={0}", accessToken); var dic = new Dictionary <string, object>(); dic.Add("card_id", cardId); dic.Add(baseCard.GetType().Name.ToLower(), baseCard); return(Utils.PostResult <ErrorEntity>(dic, url)); }
/// <summary> /// 创建卡券 /// </summary> /// <param name="info">卡券信息</param> /// <param name="cardType">卡券类型</param> /// <param name="accessToken">全局票据</param> public static CardIdInfo Create(BaseCard info, string accessToken) { var cardType = info.GetType().Name; var url = string.Format("https://api.weixin.qq.com/card/create?access_token={0}", accessToken); var dictionary = new Dictionary <string, object>(); dictionary.Add("card_type", cardType.ToUpper()); dictionary.Add(cardType.ToLower(), info); var oo = new { card = dictionary }; return(Utils.PostResult <CardIdInfo>(oo, url)); }
// Method to get the CardType enum value of a card public static CardType GetCardType(this BaseCard card) { Type cardBaseType = card.GetType().BaseType; switch (cardBaseType.Name) { case "MinionCard": return(CardType.Minion); case "SpellCard": return(CardType.Spell); case "WeaponCard": return(CardType.Weapon); default: return(CardType.None); } }
private string GetGlowType() { switch (Card.GetType().BaseType.Name) { case "MinionCard": if (Card.As <MinionCard>().Rarity == CardRarity.Legendary) { return("LegendaryMinion"); } return("Weapon"); case "SpellCard": return("Spell"); case "WeaponCard": return("Weapon"); default: return("Normal"); } }