상속: XmlBrick, IPointToBrick
예제 #1
0
 public bool Equals(XmlPointToBrick b)
 {                                              //TODO: maybe find a possibility to check basic brick equals also
                                                // but as it creates xml output it would ned to create also the reference,
                                                // which usually needs a whole insatntiated programme. so it might be a good idea to seperate it
     return /*this.Equals((XmlBrick)b) &&*/ (this.PointedXmlSpriteReference.Equals(b.PointedXmlSpriteReference)
                                             ); //&& this.PointedSprite.Equals(b.PointedSprite);
 }
 public bool Equals(XmlPointToBrick b)
 {           //TODO: maybe find a possibility to check basic brick equals also
             // but as it creates xml output it would ned to create also the reference, 
             // which usually needs a whole insatntiated programme. so it might be a good idea to seperate it
     return /*this.Equals((XmlBrick)b) &&*/ this.PointedXmlSpriteReference.Equals(b.PointedXmlSpriteReference)
         ;//&& this.PointedSprite.Equals(b.PointedSprite);
 }
예제 #3
0
        public override bool Equals(System.Object obj)
        {
            XmlPointToBrick b = obj as XmlPointToBrick;

            if ((object)b == null)
            {
                return(false);
            }

            return(this.Equals(b) && this.PointedXmlSpriteReference.Equals(b.PointedXmlSpriteReference)
                   );//&& this.PointedSprite.Equals(b.PointedSprite);
        }
        public void XmlPointToBrickReferencedObjectTest()
        {
            TextReader sr = new StringReader("<brick type=\"PointToBrick\"> <pointedObject reference=\"../../../../../../object[2]/scriptList/script[3]/brickList/brick/pointedObject\"/> </brick>");
            var xRoot = XElement.Load(sr);

            var testObject = new XmlPointToBrick(xRoot);

            TextReader spriteSr = new StringReader("<object name=\"Airplane\"> <lookList></lookList> <soundList> </soundList> <scriptList> <script type=\"WhenScript\"> <brickList> </brickList> </script> </scriptList> </object>");
            var SpriteXRoot = XElement.Load(spriteSr);

            testObject.PointedXmlSpriteReference.Sprite = new XmlSprite(SpriteXRoot);

            var referenceObject = new XmlPointToBrick()
            {
                PointedXmlSpriteReference = new XmlSpriteReference(xRoot.Element(XmlConstants.PointedObject)),
            };

            referenceObject.PointedXmlSpriteReference.Sprite = new XmlSprite(SpriteXRoot);

            Assert.AreEqual(referenceObject, testObject);
        }