public void AddOverlordCard(OverlordCard NewCard) {
			cOverlordCardList.Add(NewCard);

			if (cDeckChoiceCtrlList.ContainsKey(NewCard.Class) == false) {
				cDeckChoiceCtrlList.Add(NewCard.Class, new Button(cGraphicsDevice, null, 0, 0, ClientRegion.Height / DECKOPTIONS_PERPAGE, ClientRegion.Width));
				cDeckChoiceCtrlList[NewCard.Class].BackgroundColor = new Color(0.8f, 0.608f, 0.398f, 1.0f);
				cDeckChoiceCtrlList[NewCard.Class].Visible = true;
				cDeckChoiceCtrlList[NewCard.Class].Text = NewCard.Class;
				cDeckChoiceCtrlList[NewCard.Class].Font = Font;
				cDeckChoiceCtrlList[NewCard.Class].FontColor = Color.Black;
				cDeckChoiceCtrlList[NewCard.Class].FontSize = (ClientRegion.Height / DECKOPTIONS_PERPAGE) / 2;
				cDeckChoiceCtrlList[NewCard.Class].Click += DeckChoiceClickHandler;

				HasChanged = true;
			}
		}
Esempio n. 2
0
        public void AddOverlordCard(OverlordCard NewCard)
        {
            cOverlordCardList.Add(NewCard);

            if (cDeckChoiceCtrlList.ContainsKey(NewCard.Class) == false)
            {
                cDeckChoiceCtrlList.Add(NewCard.Class, new Button(cGraphicsDevice, null, 0, 0, ClientRegion.Height / DECKOPTIONS_PERPAGE, ClientRegion.Width));
                cDeckChoiceCtrlList[NewCard.Class].BackgroundColor = new Color(0.8f, 0.608f, 0.398f, 1.0f);
                cDeckChoiceCtrlList[NewCard.Class].Visible         = true;
                cDeckChoiceCtrlList[NewCard.Class].Text            = NewCard.Class;
                cDeckChoiceCtrlList[NewCard.Class].Font            = Font;
                cDeckChoiceCtrlList[NewCard.Class].FontColor       = Color.Black;
                cDeckChoiceCtrlList[NewCard.Class].FontSize        = (ClientRegion.Height / DECKOPTIONS_PERPAGE) / 2;
                cDeckChoiceCtrlList[NewCard.Class].Click          += DeckChoiceClickHandler;

                HasChanged = true;
            }
        }
Esempio n. 3
0
		/// <summary>
		/// Loads all cards and decks from a common XML file
		/// </summary>
		/// <param name="Content">COntent manager object that will load the image files</param>
		/// <param name="DeckXMLFile">Path and file name of the XML file containing the card information</param>
		/// <returns>Text messages reporting any information related to loaded the deck information and images</returns>
		private string LoadGameDecks(ContentManager Content, string DeckXMLFile) {
			XmlDocument DeckXML;
			XmlNodeList CardNodeList;
			Texture2D CardImage;
			string Message = "";
			int Ctr, CardCnt;
			OverlordCard NewOLCard;

			Message = "Loading card list from " + DeckXMLFile + "\n";
			cOLFrame.CardBackList.Clear();
			cOLFrame.CardFaceList.Clear();

			try {
				DeckXML = new XmlDocument();
				DeckXML.Load(DeckXMLFile);
			} catch (Exception ExErr) {
				Message += String.Format("Failed to load XML file: {0} - {1}\n", ExErr.GetType().ToString(), ExErr.Message);
				return Message;
			}

			CardNodeList = DeckXML.DocumentElement.SelectNodes("//cardlist");
			Ctr = 0;
			foreach (XmlNode CardNode in CardNodeList) {
				Ctr += 1;
				foreach (XmlNode Tag in CardNode.ChildNodes) {
					if (Tag.Attributes == null) {
						Message += String.Format("Tag {0} '{1}' contains no attributes, skipping.\n", Ctr, Tag.Name);
						continue;
					}

					switch (Tag.Name) {
						case "autooverlord":
							if (Tag.Attributes["image"] != null) {
								CardImage = Content.Load<Texture2D>(Tag.Attributes["image"].InnerText);
								cAOFrame.CardFaceList.Add(CardImage);
							} else {
								Message += String.Format("Tag {0} '{1}' contains no image attribute, skipping.\n", Ctr, Tag.Name);
							}

							break;
						case "autooverlordback":
							if (Tag.Attributes["image"] != null) {
								CardImage = Content.Load<Texture2D>(Tag.Attributes["image"].InnerText);
								cAOFrame.CardBackList.Add(CardImage);
							} else {
								Message += String.Format("Tag {0} '{1}' contains no image attribute, skipping.\n", Ctr, Tag.Name);
							}

							break;
						case "reference":
							/*
							if (Tag.Attributes["image"] != null) {
								CardImage = Content.Load<Texture2D>(Tag.Attributes["image"].InnerText);
							} else {
								Message += String.Format("Tag {0} '{1}' contains no image attribute, skipping.\n", Ctr, Tag.Name);
								continue;
							}

							if (Tag.Attributes["description"] != null) {
								cAORefCards.Add(Tag.Attributes["description"].InnerText, CardImage);
							} else {
								Message += String.Format("Tag {0} '{1}' contains no description attribute, skipping.\n", Ctr, Tag.Name);
								continue;
							}
							*/
							break;
						case "overlordback":
							if (Tag.Attributes["image"] != null) {
								CardImage = Content.Load<Texture2D>(Tag.Attributes["image"].InnerText);

								try {
									CardCnt = Int32.Parse(Tag.Attributes["count"].InnerText);
								} catch (Exception) {
									CardCnt = 1;
								}

								cOLFrame.CardBackList.Add(CardImage);
							} else {
								Message += String.Format("Tag {0} '{1}' contains no image attribute, skipping.\n", Ctr, Tag.Name);
							}

							break;
						case "overlord":
							if (Tag.Attributes["image"] != null) {
								NewOLCard = new OverlordCard();
								NewOLCard.Image = Content.Load<Texture2D>(Tag.Attributes["image"].InnerText);
								NewOLCard.Count = Int32.Parse(Tag.Attributes["count"].InnerText);
								NewOLCard.Include = 0;
								NewOLCard.Class = Tag.Attributes["class"].InnerText;
								NewOLCard.Set = Tag.Attributes["set"].InnerText;

								cOLConfigFrame.AddOverlordCard(NewOLCard);
							} else {
								Message += String.Format("Tag {0} '{1}' contains no image attribute, skipping.\n", Ctr, Tag.Name);
							}

							break;
						case "icon":
							if (Tag.Attributes["image"] != null) {
								CardImage = Content.Load<Texture2D>(Tag.Attributes["image"].InnerText);

								cIconImages.Add(Tag.Attributes["type"].InnerText, CardImage);
							} else {
								Message += String.Format("Tag {0} '{1}' contains no image attribute, skipping.\n", Ctr, Tag.Name);
							}

							break;
						default:
							if (Tag.Name.CompareTo("#comment") == 0) {
								Message += "Found text '" + Tag.InnerText + "' outisde any tag.\n";
							} else {
								Message += "Unrecognized tag '" + Tag.Name + "'.\n";
							}
							break;
					}
				}
			}

			Message += String.Format("Card decks loading complete.\n");

			return Message;
		}
Esempio n. 4
0
        /// <summary>
        /// Loads all cards and decks from a common XML file
        /// </summary>
        /// <param name="Content">COntent manager object that will load the image files</param>
        /// <param name="DeckXMLFile">Path and file name of the XML file containing the card information</param>
        /// <returns>Text messages reporting any information related to loaded the deck information and images</returns>
        private string LoadGameDecks(ContentManager Content, string DeckXMLFile)
        {
            XmlDocument  DeckXML;
            XmlNodeList  CardNodeList;
            Texture2D    CardImage;
            string       Message = "";
            int          Ctr, CardCnt;
            OverlordCard NewOLCard;

            Message = "Loading card list from " + DeckXMLFile + "\n";
            cOLFrame.CardBackList.Clear();
            cOLFrame.CardFaceList.Clear();

            try {
                DeckXML = new XmlDocument();
                DeckXML.Load(DeckXMLFile);
            } catch (Exception ExErr) {
                Message += String.Format("Failed to load XML file: {0} - {1}\n", ExErr.GetType().ToString(), ExErr.Message);
                return(Message);
            }

            CardNodeList = DeckXML.DocumentElement.SelectNodes("//cardlist");
            Ctr          = 0;
            foreach (XmlNode CardNode in CardNodeList)
            {
                Ctr += 1;
                foreach (XmlNode Tag in CardNode.ChildNodes)
                {
                    if (Tag.Attributes == null)
                    {
                        Message += String.Format("Tag {0} '{1}' contains no attributes, skipping.\n", Ctr, Tag.Name);
                        continue;
                    }

                    switch (Tag.Name)
                    {
                    case "autooverlord":
                        if (Tag.Attributes["image"] != null)
                        {
                            CardImage = Content.Load <Texture2D>(Tag.Attributes["image"].InnerText);
                            cAOFrame.CardFaceList.Add(CardImage);
                        }
                        else
                        {
                            Message += String.Format("Tag {0} '{1}' contains no image attribute, skipping.\n", Ctr, Tag.Name);
                        }

                        break;

                    case "autooverlordback":
                        if (Tag.Attributes["image"] != null)
                        {
                            CardImage = Content.Load <Texture2D>(Tag.Attributes["image"].InnerText);
                            cAOFrame.CardBackList.Add(CardImage);
                        }
                        else
                        {
                            Message += String.Format("Tag {0} '{1}' contains no image attribute, skipping.\n", Ctr, Tag.Name);
                        }

                        break;

                    case "reference":
                        /*
                         * if (Tag.Attributes["image"] != null) {
                         *      CardImage = Content.Load<Texture2D>(Tag.Attributes["image"].InnerText);
                         * } else {
                         *      Message += String.Format("Tag {0} '{1}' contains no image attribute, skipping.\n", Ctr, Tag.Name);
                         *      continue;
                         * }
                         *
                         * if (Tag.Attributes["description"] != null) {
                         *      cAORefCards.Add(Tag.Attributes["description"].InnerText, CardImage);
                         * } else {
                         *      Message += String.Format("Tag {0} '{1}' contains no description attribute, skipping.\n", Ctr, Tag.Name);
                         *      continue;
                         * }
                         */
                        break;

                    case "overlordback":
                        if (Tag.Attributes["image"] != null)
                        {
                            CardImage = Content.Load <Texture2D>(Tag.Attributes["image"].InnerText);

                            try {
                                CardCnt = Int32.Parse(Tag.Attributes["count"].InnerText);
                            } catch (Exception) {
                                CardCnt = 1;
                            }

                            cOLFrame.CardBackList.Add(CardImage);
                        }
                        else
                        {
                            Message += String.Format("Tag {0} '{1}' contains no image attribute, skipping.\n", Ctr, Tag.Name);
                        }

                        break;

                    case "overlord":
                        if (Tag.Attributes["image"] != null)
                        {
                            NewOLCard         = new OverlordCard();
                            NewOLCard.Image   = Content.Load <Texture2D>(Tag.Attributes["image"].InnerText);
                            NewOLCard.Count   = Int32.Parse(Tag.Attributes["count"].InnerText);
                            NewOLCard.Include = 0;
                            NewOLCard.Class   = Tag.Attributes["class"].InnerText;
                            NewOLCard.Set     = Tag.Attributes["set"].InnerText;

                            cOLConfigFrame.AddOverlordCard(NewOLCard);
                        }
                        else
                        {
                            Message += String.Format("Tag {0} '{1}' contains no image attribute, skipping.\n", Ctr, Tag.Name);
                        }

                        break;

                    case "icon":
                        if (Tag.Attributes["image"] != null)
                        {
                            CardImage = Content.Load <Texture2D>(Tag.Attributes["image"].InnerText);

                            cIconImages.Add(Tag.Attributes["type"].InnerText, CardImage);
                        }
                        else
                        {
                            Message += String.Format("Tag {0} '{1}' contains no image attribute, skipping.\n", Ctr, Tag.Name);
                        }

                        break;

                    default:
                        if (Tag.Name.CompareTo("#comment") == 0)
                        {
                            Message += "Found text '" + Tag.InnerText + "' outisde any tag.\n";
                        }
                        else
                        {
                            Message += "Unrecognized tag '" + Tag.Name + "'.\n";
                        }
                        break;
                    }
                }
            }

            Message += String.Format("Card decks loading complete.\n");

            return(Message);
        }