Exemplo n.º 1
0
		public static CardInfo Intern(CardInfo cardInfo)
		{
			if (cardInfo == null) throw new ArgumentNullException("cardInfo");
			if (cardPool.ContainsKey(cardInfo.name)) return cardPool[cardInfo.name];
			cardPool[cardInfo.name] = cardInfo;
			return cardInfo;
		}
Exemplo n.º 2
0
		static CardInfo()
		{
			cardPool = new Dictionary<string, CardInfo>(StringComparer.InvariantCultureIgnoreCase);
			Assembly currentAssembly = Assembly.GetExecutingAssembly();
			string resourceName = currentAssembly.GetManifestResourceNames().Single(s => s.EndsWith("cards.xml", StringComparison.InvariantCultureIgnoreCase));
			var xml = new XmlDocument();
			xml.Load(currentAssembly.GetManifestResourceStream(resourceName));
			foreach (XmlElement card in xml.DocumentElement.ChildNodes)
			{
				var c = new CardInfo(card.GetAttribute("id"),
				                     card.GetAttribute("name"),
				                     card.GetAttribute("left"),
				                     card.GetAttribute("up"),
				                     card.GetAttribute("right"),
				                     card.GetAttribute("down"),
				                     card.GetAttribute("element"));
				cardPool.Add(c.name, c);
			}
		}
Exemplo n.º 3
0
		public bool Equals(CardInfo other)
		{
			if (ReferenceEquals(null, other)) return false;
			if (ReferenceEquals(this, other)) return true;
			return other.name == name;
		}
Exemplo n.º 4
0
		public PlayCard(CardInfo cardInfo)
		{
			this.cardInfo = cardInfo;
			inUse = false;
			isBlue = false;
		}
Exemplo n.º 5
0
		public PlayCard(CardInfo cardInfo, bool isBlue): this(cardInfo)
		{
			this.isBlue = isBlue;
		}
Exemplo n.º 6
0
		public PlayCard Extract(CardInfo cardInfo)
		{
			byte i = 0;
			while (hand[i].cardInfo != cardInfo) i++;
			return Extract(i);
		}