/// <summary> /// Finds all cards that match the specified card type (Monster, Auxiliary, etc). /// </summary> /// <returns>A list containing all the cards found.</returns> /// <param name="cType">The card type to look for.</param> public List <Card> getCardsByCardType(CardInfo.CardType cType) { List <Card> cards = new List <Card>(); switch (cType) { case (CardInfo.CardType.Monster): cards.AddRange(getCardsByObjType <CardMonster>().Cast <Card>().ToList()); cards.AddRange(getCardsByObjType <ECardMonster>().Cast <Card>().ToList()); break; } return(cards); }
public CardInfo cardCharging(string pin, string seri, CardInfo.CardType cardType, string note) { this.info.pin = pin; this.info.seri = seri; this.info.cardtype = cardType; this.info.note = note; if (this.info.merchant_id == "" || this.info.api_user == "" || this.info.api_password == "") { this.info.code = 1; this.info.msg = "Chưa nhập thông tin cần thiết!"; } System.Net.ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; ASCIIEncoding encoding = new ASCIIEncoding(); string postData = ""; postData += "merchant_id=" + this.info.merchant_id; postData += "&pin=" + this.info.pin; postData += "&seri=" + this.info.seri; postData += "¬e=" + this.info.note; postData += "&card_type=" + (int)this.info.cardtype; byte[] data = encoding.GetBytes(postData); HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("https://vippay.vn/api/api/card"); myRequest.Credentials = new NetworkCredential(this.info.api_user, this.info.api_password); myRequest.Method = "POST"; myRequest.ContentType = "application/x-www-form-urlencoded"; myRequest.ContentLength = data.Length; Stream newStream = myRequest.GetRequestStream(); newStream.Write(data, 0, data.Length); newStream.Close(); HttpWebResponse response = (HttpWebResponse)myRequest.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string output = reader.ReadToEnd(); JavaScriptSerializer js = new JavaScriptSerializer(); CardInfo infoResult = js.Deserialize <CardInfo>(output); response.Close(); this.info.code = infoResult.code; this.info.info_card = infoResult.info_card; this.info.msg = infoResult.msg; this.info.transaction_id = infoResult.transaction_id; this.info.note = infoResult.note; return(this.info); }
void Start() { imagenSource = transform.GetComponent <Image>(); nameCard = transform.Find("Name").GetComponent <TextMeshProUGUI>(); nameCard.text = cardinfo.cardName; hpText = transform.Find("Image/hp").GetComponent <TextMeshProUGUI>(); imagen = cardinfo.imagen; imagenSource.sprite = imagen; genHP = cardinfo.hp; hp = cardinfo.hp; id = cardinfo.id; description = cardinfo.description; typeCard = cardinfo.typeCard; noName = transform.Find("Name").gameObject; if (typeCard == CardInfo.CardType.Player) { Destroy(noName); } }