Esempio n. 1
0
        public List <Object> get(string xmlContainer)
        {
            if (!active)
            {
                return(null);
            }

            mDoc.Load(mFilename);

            XmlNode nodeRoot = mDoc.DocumentElement.GetElementsByTagName(xmlContainer)[0];

            if (nodeRoot == null)
            {
                return(null);
            }

            XmlNodeList nodeList = nodeRoot.ChildNodes;

            if (nodeList.Count <= 0)
            {
                return(null);
            }

            List <Object> objects = new List <Object>();

            foreach (XmlElement node in nodeList)
            {
                Object obj = new Object();

                if (node.LocalName == Objects.ObjectDictionary_Moveable.UNBREAKABLE.ToString())
                {
                    obj = new MoveableObject();
                }
                else if (node.LocalName == Objects.ObjectDictionary_Moveable.BREAKABLE.ToString())
                {
                    obj = new BreakableObject();
                }
                else if (node.LocalName == Objects.ObjectDictionary_Moveable.EXPLOSIVE.ToString())
                {
                    obj = new ExplosiveObject();
                }


                if (!obj.GetAdditionalAttributes(node))
                {
                    continue;
                }

                objects.Add(obj);
            }

            return(objects);
        }
Esempio n. 2
0
        /* Updates the object description box appropriately */
        private void listview_moveableObjectList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (listview_moveableObjectList.SelectedItem != null)
            {
                grid_objectDescription.Visibility = Visibility.Visible;

                Object typeCollector = listview_moveableObjectList.SelectedItem as Object;
                string description;


                if (typeCollector.Type == Objects.ObjectDictionary_Moveable.UNBREAKABLE)
                {
                    typeCollector = new MoveableObject(listview_moveableObjectList.SelectedItem as MoveableObject);
                    description   = (listview_moveableObjectList.SelectedItem as MoveableObject).Print(maxDescriptionLength);
                }

                else if (typeCollector.Type == Objects.ObjectDictionary_Moveable.BREAKABLE)
                {
                    typeCollector = new BreakableObject(listview_moveableObjectList.SelectedItem as BreakableObject);
                    description   = (listview_moveableObjectList.SelectedItem as BreakableObject).Print(maxDescriptionLength);
                }

                else if (typeCollector.Type == Objects.ObjectDictionary_Moveable.EXPLOSIVE)
                {
                    typeCollector = new ExplosiveObject(listview_moveableObjectList.SelectedItem as ExplosiveObject);
                    description   = (listview_moveableObjectList.SelectedItem as ExplosiveObject).Print(maxDescriptionLength);
                }
                else
                {
                    typeCollector = new Object(listview_moveableObjectList.SelectedItem as Object);
                    description   = typeCollector.Print(maxDescriptionLength);
                }


                label_descriptionList.Text = description;

                if (map_canvas.IsEnabled)
                {
                    AddObjectToMap(typeCollector);
                }
            }
            else
            {
                grid_objectDescription.Visibility = Visibility.Hidden;
            }
        }
Esempio n. 3
0
 public BreakableObject(BreakableObject cpy)
     : base(cpy.Name, cpy.Sprite_filename, cpy.Mass)
 {
     mType   = Objects.ObjectDictionary_Moveable.BREAKABLE;
     mHealth = cpy.Health;
 }